PHP 8.2.30
Preview: bind.js Size: 1.64 KB
/opt/alt/alt-nodejs9/root/lib/node_modules/npm/node_modules/cli-table2/node_modules/lodash/function/bind.js

var createWrapper = require('../internal/createWrapper'),
    replaceHolders = require('../internal/replaceHolders'),
    restParam = require('./restParam');

/** Used to compose bitmasks for wrapper metadata. */
var BIND_FLAG = 1,
    PARTIAL_FLAG = 32;

/**
 * Creates a function that invokes `func` with the `this` binding of `thisArg`
 * and prepends any additional `_.bind` arguments to those provided to the
 * bound function.
 *
 * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
 * may be used as a placeholder for partially applied arguments.
 *
 * **Note:** Unlike native `Function#bind` this method does not set the "length"
 * property of bound functions.
 *
 * @static
 * @memberOf _
 * @category Function
 * @param {Function} func The function to bind.
 * @param {*} thisArg The `this` binding of `func`.
 * @param {...*} [partials] The arguments to be partially applied.
 * @returns {Function} Returns the new bound function.
 * @example
 *
 * var greet = function(greeting, punctuation) {
 *   return greeting + ' ' + this.user + punctuation;
 * };
 *
 * var object = { 'user': 'fred' };
 *
 * var bound = _.bind(greet, object, 'hi');
 * bound('!');
 * // => 'hi fred!'
 *
 * // using placeholders
 * var bound = _.bind(greet, object, _, '!');
 * bound('hi');
 * // => 'hi fred!'
 */
var bind = restParam(function(func, thisArg, partials) {
  var bitmask = BIND_FLAG;
  if (partials.length) {
    var holders = replaceHolders(partials, bind.placeholder);
    bitmask |= PARTIAL_FLAG;
  }
  return createWrapper(func, bitmask, thisArg, partials, holders);
});

// Assign default placeholders.
bind.placeholder = {};

module.exports = bind;

Directory Contents

Dirs: 0 × Files: 26

Name Size Perms Modified Actions
1.26 KB lrw-r--r-- 2021-09-28 11:28:34
Edit Download
1.04 KB lrw-r--r-- 2021-09-28 11:28:34
Edit Download
41 B lrw-r--r-- 2021-09-28 11:28:34
Edit Download
1.13 KB lrw-r--r-- 2021-09-28 11:28:34
Edit Download
1.64 KB lrw-r--r-- 2021-09-28 11:28:35
Edit Download
1.57 KB lrw-r--r-- 2021-09-28 11:28:34
Edit Download
1.99 KB lrw-r--r-- 2021-09-28 11:28:34
Edit Download
41 B lrw-r--r-- 2021-09-28 11:28:35
Edit Download
1.41 KB lrw-r--r-- 2021-09-28 11:28:34
Edit Download
1.24 KB lrw-r--r-- 2021-09-28 11:28:34
Edit Download
5.39 KB lrw-r--r-- 2021-09-28 11:28:34
Edit Download
699 B lrw-r--r-- 2021-09-28 11:28:34
Edit Download
742 B lrw-r--r-- 2021-09-28 11:28:34
Edit Download
617 B lrw-r--r-- 2021-09-28 11:28:34
Edit Download
574 B lrw-r--r-- 2021-09-28 11:28:34
Edit Download
2.43 KB lrw-r--r-- 2021-09-28 11:28:34
Edit Download
1.56 KB lrw-r--r-- 2021-09-28 11:28:34
Edit Download
803 B lrw-r--r-- 2021-09-28 11:28:34
Edit Download
650 B lrw-r--r-- 2021-09-28 11:28:34
Edit Download
1.26 KB lrw-r--r-- 2021-09-28 11:28:34
Edit Download
1.23 KB lrw-r--r-- 2021-09-28 11:28:34
Edit Download
1.22 KB lrw-r--r-- 2021-09-28 11:28:34
Edit Download
1.85 KB lrw-r--r-- 2021-09-28 11:28:34
Edit Download
1.15 KB lrw-r--r-- 2021-09-28 11:28:34
Edit Download
2.40 KB lrw-r--r-- 2021-09-28 11:28:35
Edit Download
1.01 KB lrw-r--r-- 2021-09-28 11:28:34
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).