You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
619 B
JavaScript
21 lines
619 B
JavaScript
9 years ago
|
var createWrapper = require('./createWrapper'),
|
||
|
replaceHolders = require('./replaceHolders'),
|
||
|
restParam = require('../function/restParam');
|
||
|
|
||
|
/**
|
||
|
* Creates a `_.partial` or `_.partialRight` function.
|
||
|
*
|
||
|
* @private
|
||
|
* @param {boolean} flag The partial bit flag.
|
||
|
* @returns {Function} Returns the new partial function.
|
||
|
*/
|
||
|
function createPartial(flag) {
|
||
|
var partialFunc = restParam(function(func, partials) {
|
||
|
var holders = replaceHolders(partials, partialFunc.placeholder);
|
||
|
return createWrapper(func, flag, undefined, partials, holders);
|
||
|
});
|
||
|
return partialFunc;
|
||
|
}
|
||
|
|
||
|
module.exports = createPartial;
|