source: trip-planner-front/node_modules/lodash/wrap.js@ 188ee53

Last change on this file since 188ee53 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 871 bytes
RevLine 
[6a3a178]1var castFunction = require('./_castFunction'),
2 partial = require('./partial');
3
4/**
5 * Creates a function that provides `value` to `wrapper` as its first
6 * argument. Any additional arguments provided to the function are appended
7 * to those provided to the `wrapper`. The wrapper is invoked with the `this`
8 * binding of the created function.
9 *
10 * @static
11 * @memberOf _
12 * @since 0.1.0
13 * @category Function
14 * @param {*} value The value to wrap.
15 * @param {Function} [wrapper=identity] The wrapper function.
16 * @returns {Function} Returns the new function.
17 * @example
18 *
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
30module.exports = wrap;
Note: See TracBrowser for help on using the repository browser.