diff --git a/lodash.js b/lodash.js index 8aaf06a47..335e4baf8 100644 --- a/lodash.js +++ b/lodash.js @@ -854,22 +854,30 @@ * @returns {Function} Returns a new `lodash` function. * @example * - * _.mixin({ 'add': function(a, b) { return a + b; } }, false); + * _.mixin({ 'add': function(a, b) { return a + b; } }); * * var lodash = _.runInContext(); - * lodash.mixin({ 'sub': function(a, b) { return a - b; } }, false); + * lodash.mixin({ 'sub': function(a, b) { return a - b; } }); * * _.isFunction(_.add); * // => true - * * _.isFunction(_.sub); * // => false * * lodash.isFunction(lodash.add); * // => false - * * lodash.isFunction(lodash.sub); * // => true + * + * // using `context` to mock `Date#getTime` use in `_.now` + * var mock = _.runInContext({ + * 'Date': function() { + * return { 'getTime': getTimeMock }; + * } + * }); + * + * // or creating a suped-up `defer` in Node.js + * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer; */ function runInContext(context) { // Avoid issues with some ES3 environments that attempt to use values, named diff --git a/test/test.js b/test/test.js index 58e028524..b317a80d8 100644 --- a/test/test.js +++ b/test/test.js @@ -12605,7 +12605,7 @@ var lodash = _.runInContext(_.assign({}, root, { 'Date': function() { - return { 'getTime': getTime, 'valueOf': getTime }; + return { 'getTime': getTime }; } }));