Safely transform multiple rest arguments

This commit is contained in:
Victor Felder
2015-12-14 13:49:47 +01:00
parent 3dfb4eb8c6
commit 2dea8b2352
3 changed files with 19 additions and 5 deletions

View File

@@ -9,3 +9,10 @@ function t(f, ...items) {
x = items[0];
x = items[1];
}
function u(f, g, ...items) {
var x = f;
var y = g;
x = items[0];
y = items[1];
}

View File

@@ -1,11 +1,18 @@
var t = function (f) {
var x = f;
x = arguments[1];
x = arguments[2];
x = arguments.length <= 1 ? undefined : arguments[1];
x = arguments.length <= 2 ? undefined : arguments[2];
};
function t(f) {
var x = f;
x = arguments[1];
x = arguments[2];
x = arguments.length <= 1 ? undefined : arguments[1];
x = arguments.length <= 2 ? undefined : arguments[2];
}
function u(f, g) {
var x = f;
var y = g;
x = arguments.length <= 2 ? undefined : arguments[2];
y = arguments.length <= 3 ? undefined : arguments[3];
}