ThinkSSL🔒 一键申购 5分钟快速签发 30天无理由退款 购买更放心 广告
## wrap + [link](./wrap "Link to this entry.") + [source](https://github.com/lodash/lodash/blob/4.5.0正式版/lodash.src.js#L9223 "View in source.") + [npm](https://www.npmjs.com/package/lodash.wrap "See the npm package.") ``` _.wrap(value, wrapper) ``` 创建一个函数。提供的 `value` 包装在 wrapper 函数的第一个参数里。 任何附加的参数都提供给 wrapper 函数。 被调用时 `this` 绑定在创建的函数上。 ### 参数 1. value (\*) 要包装的值 2. wrapper (Function) 包装函数 ### 返回值 (Function) 返回新的函数 ### 示例 ``` var p = _.wrap(_.escape, function(func, text) { return '<p>' + func(text) + '</p>'; }); p('fred, barney, & pebbles'); // => '<p>fred, barney, &amp; pebbles</p>' ```