mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-12 03:47:50 +00:00
Clarify _.runInContext docs and usage example. [ci skip]
This commit is contained in:
21
lodash.js
21
lodash.js
@@ -585,7 +585,7 @@
|
|||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new `lodash` function using the given `context` object.
|
* Create a new pristine `lodash` function using the given `context` object.
|
||||||
*
|
*
|
||||||
* @static
|
* @static
|
||||||
* @memberOf _
|
* @memberOf _
|
||||||
@@ -594,19 +594,22 @@
|
|||||||
* @returns {Function} Returns a new `lodash` function.
|
* @returns {Function} Returns a new `lodash` function.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
|
* _.mixin({ 'add': function(a, b) { return a + b; } }, false);
|
||||||
|
*
|
||||||
* var lodash = _.runInContext();
|
* var lodash = _.runInContext();
|
||||||
|
* lodash.mixin({ 'sub': function(a, b) { return a - b; } }, false);
|
||||||
*
|
*
|
||||||
* lodash.mixin({
|
* _.isFunction(_.add);
|
||||||
* 'exists': function(value) {
|
|
||||||
* return value != null;
|
|
||||||
* }
|
|
||||||
* }, false);
|
|
||||||
*
|
|
||||||
* _.isFunction(lodash.exists);
|
|
||||||
* // => true
|
* // => true
|
||||||
*
|
*
|
||||||
* _.isFunction(_.exists);
|
* _.isFunction(_.sub);
|
||||||
* // => false
|
* // => false
|
||||||
|
*
|
||||||
|
* lodash.isFunction(lodash.add);
|
||||||
|
* // => false
|
||||||
|
*
|
||||||
|
* lodash.isFunction(lodash.sub);
|
||||||
|
* // => true
|
||||||
*/
|
*/
|
||||||
function runInContext(context) {
|
function runInContext(context) {
|
||||||
// Avoid issues with some ES3 environments that attempt to use values, named
|
// Avoid issues with some ES3 environments that attempt to use values, named
|
||||||
|
|||||||
Reference in New Issue
Block a user