Permalink
Browse files

.concat flattens arrays passed in

  • Loading branch information...
Raynos authored and substack committed Jul 24, 2012
1 parent 32d53d2 commit 841f21f60b12e912d853f0b1e9c34723a30509a1
Showing with 6 additions and 2 deletions.
  1. +6 −2 index.js
View
@@ -1,14 +1,18 @@
exports = module.exports = ap;
function ap (args, fn) {
return function () {
- return fn.apply(this, args.concat.apply(args, arguments));
+ var rest = [].slice.call(arguments)
+ args.push.apply(args, rest)
+ return fn.apply(this, args);
};
}
exports.pa = pa;
function pa (args, fn) {
return function () {
- return fn.apply(this, [].slice.call(arguments).concat(args));
+ var rest = [].slice.call(arguments)
+ rest.push.apply(rest, args)
+ return fn.apply(this, rest);
};
}

0 comments on commit 841f21f

Please sign in to comment.