Updated to Drupal 8.6.4, which is PHP 7.3 friendly. Also updated HTMLaw library....
[yaffs-website] / node_modules / grunt-legacy-util / node_modules / lodash / _createPartialWrapper.js
1 var apply = require('./_apply'),
2     createCtorWrapper = require('./_createCtorWrapper'),
3     root = require('./_root');
4
5 /** Used to compose bitmasks for wrapper metadata. */
6 var BIND_FLAG = 1;
7
8 /**
9  * Creates a function that wraps `func` to invoke it with the optional `this`
10  * binding of `thisArg` and the `partials` prepended to those provided to
11  * the wrapper.
12  *
13  * @private
14  * @param {Function} func The function to wrap.
15  * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper` for more details.
16  * @param {*} thisArg The `this` binding of `func`.
17  * @param {Array} partials The arguments to prepend to those provided to the new function.
18  * @returns {Function} Returns the new wrapped function.
19  */
20 function createPartialWrapper(func, bitmask, thisArg, partials) {
21   var isBind = bitmask & BIND_FLAG,
22       Ctor = createCtorWrapper(func);
23
24   function wrapper() {
25     var argsIndex = -1,
26         argsLength = arguments.length,
27         leftIndex = -1,
28         leftLength = partials.length,
29         args = Array(leftLength + argsLength),
30         fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
31
32     while (++leftIndex < leftLength) {
33       args[leftIndex] = partials[leftIndex];
34     }
35     while (argsLength--) {
36       args[leftIndex++] = arguments[++argsIndex];
37     }
38     return apply(fn, isBind ? thisArg : this, args);
39   }
40   return wrapper;
41 }
42
43 module.exports = createPartialWrapper;