mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 02:17:50 +00:00
Move callback above constant.
This commit is contained in:
42
lodash.js
42
lodash.js
@@ -8063,27 +8063,6 @@
|
|||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a function that returns `value`.
|
|
||||||
*
|
|
||||||
* @static
|
|
||||||
* @memberOf _
|
|
||||||
* @category Utilities
|
|
||||||
* @param {*} value The value to return from the new function.
|
|
||||||
* @returns {Function} Returns the new function.
|
|
||||||
* @example
|
|
||||||
*
|
|
||||||
* var object = { 'name': 'fred' };
|
|
||||||
* var getter = _.constant(object);
|
|
||||||
* getter() === object;
|
|
||||||
* // => true
|
|
||||||
*/
|
|
||||||
function constant(value) {
|
|
||||||
return function() {
|
|
||||||
return value;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a function bound to an optional `thisArg`. If `func` is a property
|
* Creates a function bound to an optional `thisArg`. If `func` is a property
|
||||||
* name the created callback returns the property value for a given element.
|
* name the created callback returns the property value for a given element.
|
||||||
@@ -8130,6 +8109,27 @@
|
|||||||
return type == 'object' ? matches(func) : property(func);
|
return type == 'object' ? matches(func) : property(func);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a function that returns `value`.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
* @memberOf _
|
||||||
|
* @category Utilities
|
||||||
|
* @param {*} value The value to return from the new function.
|
||||||
|
* @returns {Function} Returns the new function.
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var object = { 'name': 'fred' };
|
||||||
|
* var getter = _.constant(object);
|
||||||
|
* getter() === object;
|
||||||
|
* // => true
|
||||||
|
*/
|
||||||
|
function constant(value) {
|
||||||
|
return function() {
|
||||||
|
return value;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method returns the first argument provided to it.
|
* This method returns the first argument provided to it.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user