Skip to content

Commit

Permalink
.concat flattens arrays passed in
Browse files Browse the repository at this point in the history
  • Loading branch information
Raynos committed Jul 24, 2012
1 parent 32d53d2 commit 15307bb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -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);
};
}

Expand Down

0 comments on commit 15307bb

Please sign in to comment.