CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes45downloads
wrap.js31 linesDownload Raw Back to lodash-es
1import castFunction from './_castFunction.js';2import partial from './partial.js';3 4/**5 * Creates a function that provides `value` to `wrapper` as its first6 * argument. Any additional arguments provided to the function are appended7 * to those provided to the `wrapper`. The wrapper is invoked with the `this`8 * binding of the created function.9 *10 * @static11 * @memberOf _12 * @since 0.1.013 * @category Function14 * @param {*} value The value to wrap.15 * @param {Function} [wrapper=identity] The wrapper function.16 * @returns {Function} Returns the new function.17 * @example18 *19 * var p = _.wrap(_.escape, function(func, text) {20 *   return '<p>' + func(text) + '</p>';21 * });22 *23 * p('fred, barney, & pebbles');24 * // => '<p>fred, barney, &amp; pebbles</p>'25 */26function wrap(value, wrapper) {27  return partial(castFunction(wrapper), value);28}29 30export default wrap;31 
basant307/AI_Governance_Project · CoolFace