Skip to content
Browse files

push mutates the array >_<

  • Loading branch information...
1 parent 841f21f commit 5031be1167ba31074611069379e9bb5736879f95 @Raynos Raynos committed with Jul 24, 2012
Showing with 3 additions and 2 deletions.
  1. +3 −2 index.js
View
5 index.js
@@ -2,8 +2,9 @@ exports = module.exports = ap;
function ap (args, fn) {
return function () {
var rest = [].slice.call(arguments)
- args.push.apply(args, rest)
- return fn.apply(this, args);
+ , first = args.slice()
+ first.push.apply(first, rest)
+ return fn.apply(this, first);
};
}

0 comments on commit 5031be1

Please sign in to comment.
Something went wrong with that request. Please try again.