@@ -1338,20 +1338,20 @@ var staticMethod = `
1338
1338
` ;
1339
1339
1340
1340
var inplaceMethodWithArgs = `
1341
- (function %name%(... args) {
1341
+ (function %name%(% args% ) {
1342
1342
for (var i = 0; i < this.rows; i++) {
1343
1343
for (var j = 0; j < this.columns; j++) {
1344
- this[i][j] = %method%(this[i][j], ... args);
1344
+ this[i][j] = %method%(this[i][j], % args% );
1345
1345
}
1346
1346
}
1347
1347
return this;
1348
1348
})
1349
1349
` ;
1350
1350
1351
1351
var staticMethodWithArgs = `
1352
- (function %name%(matrix, ... args) {
1352
+ (function %name%(matrix, % args% ) {
1353
1353
var newMatrix = new Matrix(matrix);
1354
- return newMatrix.%name%(... args);
1354
+ return newMatrix.%name%(% args% );
1355
1355
})
1356
1356
` ;
1357
1357
@@ -1406,13 +1406,17 @@ for (var method of methods) {
1406
1406
}
1407
1407
1408
1408
var methodsWithArgs = [
1409
- [ 'Math.pow' , 'pow' ]
1409
+ [ 'Math.pow' , 1 , 'pow' ]
1410
1410
] ;
1411
1411
1412
1412
for ( var methodWithArg of methodsWithArgs ) {
1413
- var inplaceMethWithArgs = eval ( fillTemplateFunction ( inplaceMethodWithArgs , { name : methodWithArg [ 1 ] , method : methodWithArg [ 0 ] } ) ) ;
1414
- var staticMethWithArgs = eval ( fillTemplateFunction ( staticMethodWithArgs , { name : methodWithArg [ 1 ] } ) ) ;
1415
- for ( var i = 1 ; i < methodWithArg . length ; i ++ ) {
1413
+ var args = 'arg0' ;
1414
+ for ( var i = 1 ; i < methodWithArg [ 1 ] ; i ++ ) {
1415
+ args += `, arg${ i } ` ;
1416
+ }
1417
+ var inplaceMethWithArgs = eval ( fillTemplateFunction ( inplaceMethodWithArgs , { name : methodWithArg [ 2 ] , method : methodWithArg [ 0 ] , args : args } ) ) ;
1418
+ var staticMethWithArgs = eval ( fillTemplateFunction ( staticMethodWithArgs , { name : methodWithArg [ 2 ] , args : args } ) ) ;
1419
+ for ( var i = 2 ; i < methodWithArg . length ; i ++ ) {
1416
1420
Matrix . prototype [ methodWithArg [ i ] ] = inplaceMethWithArgs ;
1417
1421
Matrix [ methodWithArg [ i ] ] = staticMethWithArgs ;
1418
1422
}
0 commit comments