Skip to content

Commit

Permalink
Use _.restArguments in _.partial
Browse files Browse the repository at this point in the history
  • Loading branch information
jgonggrijp committed Feb 4, 2021
1 parent ce3f0ed commit c654128
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
8 changes: 4 additions & 4 deletions modules/partial.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import _ from './underscore.js';
// pre-filled. Set `_.partial.placeholder` for a custom placeholder argument.
var partial = restArguments(function(func, boundArgs) {
var placeholder = partial.placeholder;
var bound = function() {
var bound = restArguments(function(_args) {
var position = 0, length = boundArgs.length;
var args = [];
for (var i = 0; i < length; i++) {
args.push(boundArgs[i] === placeholder ? arguments[position++] : boundArgs[i]);
args.push(boundArgs[i] === placeholder ? _args[position++] : boundArgs[i]);
}
while (position < arguments.length) args.push(arguments[position++]);
while (position < _args.length) args.push(_args[position++]);
return executeBound(func, bound, this, this, args);
};
});
return bound;
});

Expand Down
8 changes: 4 additions & 4 deletions underscore-esm.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion underscore-esm.js.map

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions underscore.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion underscore.js.map

Large diffs are not rendered by default.

0 comments on commit c654128

Please sign in to comment.