_.runInContext([context=root])
Create a new pristine lodash
function using the context
object.
Since
1.1.0
Arguments
[context=root]
(Object): The context object.
Returns
(Function): Returns a new lodash
function.
Example
_.mixin({ 'foo': _.constant('foo') });var lodash = _.runInContext();lodash.mixin({ 'bar': lodash.constant('bar') });_.isFunction(_.foo);// => true_.isFunction(_.bar);// => falselodash.isFunction(lodash.foo);// => falselodash.isFunction(lodash.bar);// => true// Create a suped-up `defer` in Node.js.var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
当前内容版权归 lodash.com 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 lodash.com .