Add _.runInContext doc example.

This commit is contained in:
John-David Dalton
2014-05-20 00:53:32 -07:00
parent 891ebb8ff6
commit c0265f8fd9

View File

@@ -539,6 +539,21 @@
* @category Utilities
* @param {Object} [context=root] The context object.
* @returns {Function} Returns a new `lodash` function.
* @example
*
* var lodash = _.runInContext();
*
* lodash.mixin({
* 'exists': function(value) {
* return value != null;
* }
* }, false);
*
* _.isFunction(lodash.exists);
* // => true
*
* _.isFunction(_.exists);
* // => false
*/
function runInContext(context) {
// Avoid issues with some ES3 environments that attempt to use values, named