* Creates a function that either curries or invokes `func` with optional * `this` binding and partially applied arguments. * * @private * @param {Function|string} func The function or method name to reference. * @param {number} bitmask The bitmask of flags. * The bitma
(func, bitmask, thisArg, partials, holders, argPos, ary, arity)
| 5169 | * @returns {Function} Returns the new wrapped function. |
| 5170 | */ |
| 5171 | function createWrapper(func, bitmask, thisArg, partials, holders, argPos, ary, arity) { |
| 5172 | var isBindKey = bitmask & BIND_KEY_FLAG; |
| 5173 | if (!isBindKey && typeof func != 'function') { |
| 5174 | throw new TypeError(FUNC_ERROR_TEXT); |
| 5175 | } |
| 5176 | var length = partials ? partials.length : 0; |
| 5177 | if (!length) { |
| 5178 | bitmask &= ~(PARTIAL_FLAG | PARTIAL_RIGHT_FLAG); |
| 5179 | partials = holders = null; |
| 5180 | } |
| 5181 | length -= (holders ? holders.length : 0); |
| 5182 | if (bitmask & PARTIAL_RIGHT_FLAG) { |
| 5183 | var partialsRight = partials, |
| 5184 | holdersRight = holders; |
| 5185 | |
| 5186 | partials = holders = null; |
| 5187 | } |
| 5188 | var data = isBindKey ? null : getData(func), |
| 5189 | newData = [func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity]; |
| 5190 | |
| 5191 | if (data) { |
| 5192 | mergeData(newData, data); |
| 5193 | bitmask = newData[1]; |
| 5194 | arity = newData[9]; |
| 5195 | } |
| 5196 | newData[9] = arity == null |
| 5197 | ? (isBindKey ? 0 : func.length) |
| 5198 | : (nativeMax(arity - length, 0) || 0); |
| 5199 | |
| 5200 | if (bitmask == BIND_FLAG) { |
| 5201 | var result = createBindWrapper(newData[0], newData[2]); |
| 5202 | } else if ((bitmask == PARTIAL_FLAG || bitmask == (BIND_FLAG | PARTIAL_FLAG)) && !newData[4].length) { |
| 5203 | result = createPartialWrapper.apply(undefined, newData); |
| 5204 | } else { |
| 5205 | result = createHybridWrapper.apply(undefined, newData); |
| 5206 | } |
| 5207 | var setter = data ? baseSetData : setData; |
| 5208 | return setter(result, newData); |
| 5209 | } |
| 5210 | |
| 5211 | /** |
| 5212 | * A specialized version of `baseIsEqualDeep` for arrays with support for |
no test coverage detected