X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=node_modules%2Fgrunt-legacy-util%2Fnode_modules%2Flodash%2F_createCurryWrapper.js;fp=node_modules%2Fgrunt-legacy-util%2Fnode_modules%2Flodash%2F_createCurryWrapper.js;h=2fc9f7e6c9716c9cd1ac4f4b9b4e217b46b9f997;hp=0000000000000000000000000000000000000000;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad diff --git a/node_modules/grunt-legacy-util/node_modules/lodash/_createCurryWrapper.js b/node_modules/grunt-legacy-util/node_modules/lodash/_createCurryWrapper.js new file mode 100644 index 000000000..2fc9f7e6c --- /dev/null +++ b/node_modules/grunt-legacy-util/node_modules/lodash/_createCurryWrapper.js @@ -0,0 +1,42 @@ +var apply = require('./_apply'), + createCtorWrapper = require('./_createCtorWrapper'), + createHybridWrapper = require('./_createHybridWrapper'), + createRecurryWrapper = require('./_createRecurryWrapper'), + replaceHolders = require('./_replaceHolders'), + root = require('./_root'); + +/** + * Creates a function that wraps `func` to enable currying. + * + * @private + * @param {Function} func The function to wrap. + * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper` for more details. + * @param {number} arity The arity of `func`. + * @returns {Function} Returns the new wrapped function. + */ +function createCurryWrapper(func, bitmask, arity) { + var Ctor = createCtorWrapper(func); + + function wrapper() { + var length = arguments.length, + index = length, + args = Array(length), + fn = (this && this !== root && this instanceof wrapper) ? Ctor : func, + placeholder = wrapper.placeholder; + + while (index--) { + args[index] = arguments[index]; + } + var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder) + ? [] + : replaceHolders(args, placeholder); + + length -= holders.length; + return length < arity + ? createRecurryWrapper(func, bitmask, createHybridWrapper, placeholder, undefined, args, holders, undefined, undefined, arity - length) + : apply(fn, this, args); + } + return wrapper; +} + +module.exports = createCurryWrapper;