CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes45downloads
partial.js51 linesDownload Raw Back to lodash-es
1import baseRest from './_baseRest.js';2import createWrap from './_createWrap.js';3import getHolder from './_getHolder.js';4import replaceHolders from './_replaceHolders.js';5 6/** Used to compose bitmasks for function metadata. */7var WRAP_PARTIAL_FLAG = 32;8 9/**10 * Creates a function that invokes `func` with `partials` prepended to the11 * arguments it receives. This method is like `_.bind` except it does **not**12 * alter the `this` binding.13 *14 * The `_.partial.placeholder` value, which defaults to `_` in monolithic15 * builds, may be used as a placeholder for partially applied arguments.16 *17 * **Note:** This method doesn't set the "length" property of partially18 * applied functions.19 *20 * @static21 * @memberOf _22 * @since 0.2.023 * @category Function24 * @param {Function} func The function to partially apply arguments to.25 * @param {...*} [partials] The arguments to be partially applied.26 * @returns {Function} Returns the new partially applied function.27 * @example28 *29 * function greet(greeting, name) {30 *   return greeting + ' ' + name;31 * }32 *33 * var sayHelloTo = _.partial(greet, 'hello');34 * sayHelloTo('fred');35 * // => 'hello fred'36 *37 * // Partially applied with placeholders.38 * var greetFred = _.partial(greet, _, 'fred');39 * greetFred('hi');40 * // => 'hi fred'41 */42var partial = baseRest(function(func, partials) {43  var holders = replaceHolders(partials, getHolder(partial));44  return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);45});46 47// Assign default placeholders.48partial.placeholder = {};49 50export default partial;51 
basant307/AI_Governance_Project · CoolFace