mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-02 16:17:50 +00:00
Remove the constant module.
This commit is contained in:
22
constant.js
22
constant.js
@@ -1,22 +0,0 @@
|
||||
/**
|
||||
* Creates a function that returns `value`.
|
||||
*
|
||||
* @since 2.4.0
|
||||
* @category Util
|
||||
* @param {*} value The value to return from the new function.
|
||||
* @returns {Function} Returns the new constant function.
|
||||
* @example
|
||||
*
|
||||
* const objects = times(2, constant({ 'a': 1 }));
|
||||
*
|
||||
* console.log(objects);
|
||||
* // => [{ 'a': 1 }, { 'a': 1 }]
|
||||
*
|
||||
* console.log(objects[0] === objects[1]);
|
||||
* // => true
|
||||
*/
|
||||
function constant(value) {
|
||||
return () => value;
|
||||
}
|
||||
|
||||
export default constant;
|
||||
Reference in New Issue
Block a user