replace slice with a loop in rest parameters

This commit is contained in:
Sebastian McKenzie
2015-01-06 17:05:52 +11:00
parent 7439247095
commit 4c9e39afa1
17 changed files with 58 additions and 33 deletions

View File

@@ -1,6 +1,9 @@
"use strict";
var _slice = Array.prototype.slice;
var concat = function () {
var arrs = _slice.call(arguments);
var arrs = [];
for (var _key = 0; _key < arguments.length; _key++) {
arrs[$__0] = arguments[_key];
}
};

View File

@@ -1,10 +1,17 @@
"use strict";
var _slice = Array.prototype.slice;
var t = function (f) {
var items = _slice.call(arguments, 1);
var items = [];
for (var _key = 1; _key < arguments.length; _key++) {
items[$__0] = arguments[_key];
}
};
function t(f) {
var items = _slice.call(arguments, 1);
var items = [];
for (var _key2 = 1; _key2 < arguments.length; _key2++) {
items[$__0] = arguments[_key2];
}
}

View File

@@ -1,10 +1,17 @@
"use strict";
var _slice = Array.prototype.slice;
var t = function () {
var items = _slice.call(arguments);
var items = [];
for (var _key = 0; _key < arguments.length; _key++) {
items[$__0] = arguments[_key];
}
};
function t() {
var items = _slice.call(arguments);
var items = [];
for (var _key2 = 0; _key2 < arguments.length; _key2++) {
items[$__0] = arguments[_key2];
}
}

View File

@@ -2,7 +2,7 @@
var _slice = Array.prototype.slice;
function foo() {
return bar.apply(null, ["test"].concat(_slice.call(arguments)));
return bar.apply(undefined, ["test"].concat(_slice.call(arguments)));
}
function bar(one, two, three) {

View File

@@ -1,7 +1,7 @@
"use strict";
function foo() {
return bar.apply(null, arguments);
return bar.apply(undefined, arguments);
}
function bar(one, two, three) {

View File

@@ -1,3 +1,3 @@
"use strict";
f.apply(null, [1, 2, 3]);
f.apply(undefined, [1, 2, 3]);

View File

@@ -4,4 +4,4 @@ var _toArray = function (arr) {
return Array.isArray(arr) ? arr : Array.from(arr);
};
add.apply(null, _toArray(numbers).concat([foo, bar]));
add.apply(undefined, _toArray(numbers).concat([foo, bar]));

View File

@@ -4,4 +4,4 @@ var _toArray = function (arr) {
return Array.isArray(arr) ? arr : Array.from(arr);
};
add.apply(null, [foo].concat(_toArray(numbers), [bar]));
add.apply(undefined, [foo].concat(_toArray(numbers), [bar]));

View File

@@ -4,4 +4,4 @@ var _toArray = function (arr) {
return Array.isArray(arr) ? arr : Array.from(arr);
};
add.apply(null, [foo, bar].concat(_toArray(numbers)));
add.apply(undefined, [foo, bar].concat(_toArray(numbers)));

View File

@@ -4,4 +4,4 @@ var _toArray = function (arr) {
return Array.isArray(arr) ? arr : Array.from(arr);
};
add.apply(null, [foo].concat(_toArray(numbers), [bar, what], _toArray(test)));
add.apply(undefined, [foo].concat(_toArray(numbers), [bar, what], _toArray(test)));

View File

@@ -4,4 +4,4 @@ var _toArray = function (arr) {
return Array.isArray(arr) ? arr : Array.from(arr);
};
add.apply(null, _toArray(numbers));
add.apply(undefined, _toArray(numbers));

View File

@@ -1,3 +1,3 @@
function foo(...test) {
function foo() {
test("bar", ...arguments);
}

View File

@@ -1,5 +1,5 @@
"use strict";
function foo() {
var test = customNamespace.slice.call(arguments);
test.apply(undefined, ["bar"].concat(customNamespace.slice.call(arguments)));
}

View File

@@ -1,3 +1,3 @@
function foo(...test) {
function foo() {
test("bar", ...arguments);
}

View File

@@ -1,5 +1,5 @@
"use strict";
function foo() {
var test = to5Runtime.slice.call(arguments);
test.apply(undefined, ["bar"].concat(to5Runtime.slice.call(arguments)));
}