mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 06:27:49 +00:00
Add _.callback as an alias of _.createCallback.
This commit is contained in:
@@ -187,6 +187,7 @@
|
||||
|
||||
## `Utilities`
|
||||
* <a href="#_now">`_.now`</a>
|
||||
* <a href="#_createcallbackfuncidentity-thisarg-argcount" class="alias">`_.callback` -> `createCallback`</a>
|
||||
* <a href="#_constantvalue">`_.constant`</a>
|
||||
* <a href="#_createcallbackfuncidentity-thisarg-argcount">`_.createCallback`</a>
|
||||
* <a href="#_identityvalue">`_.identity`</a>
|
||||
@@ -4322,7 +4323,7 @@ _.unescape('fred, barney & pebbles');
|
||||
<!-- div -->
|
||||
|
||||
### <a id="_now"></a>`_.now`
|
||||
<a href="#_now">#</a> [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L7093 "View in source") [Ⓣ][1]
|
||||
<a href="#_now">#</a> [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L7094 "View in source") [Ⓣ][1]
|
||||
|
||||
*(unknown)*: Gets the number of milliseconds that have elapsed since the Unix epoch *(1 January `1970 00`:00:00 UTC)*.
|
||||
|
||||
@@ -4367,10 +4368,13 @@ getter() === object;
|
||||
<!-- div -->
|
||||
|
||||
### <a id="_createcallbackfuncidentity-thisarg-argcount"></a>`_.createCallback([func=identity], [thisArg], [argCount])`
|
||||
<a href="#_createcallbackfuncidentity-thisarg-argcount">#</a> [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6889 "View in source") [Ⓣ][1]
|
||||
<a href="#_createcallbackfuncidentity-thisarg-argcount">#</a> [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6890 "View in source") [Ⓣ][1]
|
||||
|
||||
Produces a callback bound to an optional `thisArg`. If `func` is a property name the created callback will return the property value for a given element. If `func` is an object the created callback will return `true` for elements that contain the equivalent object properties, otherwise it will return `false`.
|
||||
|
||||
#### Aliases
|
||||
*_.callback*
|
||||
|
||||
#### Arguments
|
||||
1. `[func=identity]` *(*)*: The value to convert to a callback.
|
||||
2. `[thisArg]` *(*)*: The `this` binding of the created callback.
|
||||
@@ -4406,7 +4410,7 @@ _.filter(characters, 'age__gt38');
|
||||
<!-- div -->
|
||||
|
||||
### <a id="_identityvalue"></a>`_.identity(value)`
|
||||
<a href="#_identityvalue">#</a> [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6912 "View in source") [Ⓣ][1]
|
||||
<a href="#_identityvalue">#</a> [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6913 "View in source") [Ⓣ][1]
|
||||
|
||||
This method returns the first argument provided to it.
|
||||
|
||||
@@ -4431,7 +4435,7 @@ _.identity(object) === object;
|
||||
<!-- div -->
|
||||
|
||||
### <a id="_matchprops"></a>`_.match(props)`
|
||||
<a href="#_matchprops">#</a> [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6941 "View in source") [Ⓣ][1]
|
||||
<a href="#_matchprops">#</a> [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6942 "View in source") [Ⓣ][1]
|
||||
|
||||
Creates a "_.where" style function, which performs a deep comparison between a given object and the `props` object, returning `true` if the given object has equivalent property values, else `false`.
|
||||
|
||||
@@ -4465,7 +4469,7 @@ _.find(characters, matchAge);
|
||||
<!-- div -->
|
||||
|
||||
### <a id="_mixinobjectlodash-source-options"></a>`_.mixin([object=lodash], source, [options])`
|
||||
<a href="#_mixinobjectlodash-source-options">#</a> [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6999 "View in source") [Ⓣ][1]
|
||||
<a href="#_mixinobjectlodash-source-options">#</a> [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L7000 "View in source") [Ⓣ][1]
|
||||
|
||||
Adds function properties of a source object to the destination object. If `object` is a function methods will be added to its prototype as well.
|
||||
|
||||
@@ -4503,7 +4507,7 @@ _('fred').vowels();
|
||||
<!-- div -->
|
||||
|
||||
### <a id="_noconflict"></a>`_.noConflict()`
|
||||
<a href="#_noconflict">#</a> [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L7059 "View in source") [Ⓣ][1]
|
||||
<a href="#_noconflict">#</a> [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L7060 "View in source") [Ⓣ][1]
|
||||
|
||||
Reverts the '_' variable to its previous value and returns a reference to the `lodash` function.
|
||||
|
||||
@@ -4523,7 +4527,7 @@ var lodash = _.noConflict();
|
||||
<!-- div -->
|
||||
|
||||
### <a id="_noop"></a>`_.noop()`
|
||||
<a href="#_noop">#</a> [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L7076 "View in source") [Ⓣ][1]
|
||||
<a href="#_noop">#</a> [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L7077 "View in source") [Ⓣ][1]
|
||||
|
||||
A no-operation function.
|
||||
|
||||
@@ -4542,7 +4546,7 @@ _.noop(object) === undefined;
|
||||
<!-- div -->
|
||||
|
||||
### <a id="_parseintvalue-radix"></a>`_.parseInt(value, [radix])`
|
||||
<a href="#_parseintvalue-radix">#</a> [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L7117 "View in source") [Ⓣ][1]
|
||||
<a href="#_parseintvalue-radix">#</a> [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L7118 "View in source") [Ⓣ][1]
|
||||
|
||||
Converts `value` to an integer of the specified radix. If `radix` is `undefined` or `0` a `radix` of `10` is used unless the `value` is a hexadecimal, in which case a `radix` of `16` is used.
|
||||
|
||||
@@ -4569,7 +4573,7 @@ _.parseInt('08');
|
||||
<!-- div -->
|
||||
|
||||
### <a id="_propertykey"></a>`_.property(key)`
|
||||
<a href="#_propertykey">#</a> [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L7148 "View in source") [Ⓣ][1]
|
||||
<a href="#_propertykey">#</a> [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L7149 "View in source") [Ⓣ][1]
|
||||
|
||||
Creates a "_.pluck" style function, which returns the `key` value of a given object.
|
||||
|
||||
@@ -4603,7 +4607,7 @@ _.sortBy(characters, getName);
|
||||
<!-- div -->
|
||||
|
||||
### <a id="_randommin0-max1-floatingfalse"></a>`_.random([min=0], [max=1], [floating=false])`
|
||||
<a href="#_randommin0-max1-floatingfalse">#</a> [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L7181 "View in source") [Ⓣ][1]
|
||||
<a href="#_randommin0-max1-floatingfalse">#</a> [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L7182 "View in source") [Ⓣ][1]
|
||||
|
||||
Produces a random number between `min` and `max` *(inclusive)*. If only one argument is provided a number between `0` and the given number will be returned. If `floating` is truey or either `min` or `max` are floats a floating-point number will be returned instead of an integer.
|
||||
|
||||
@@ -4638,7 +4642,7 @@ _.random(1.2, 5.2);
|
||||
<!-- div -->
|
||||
|
||||
### <a id="_resultobject-key-defaultvalue"></a>`_.result(object, key, [defaultValue])`
|
||||
<a href="#_resultobject-key-defaultvalue">#</a> [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L7246 "View in source") [Ⓣ][1]
|
||||
<a href="#_resultobject-key-defaultvalue">#</a> [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L7247 "View in source") [Ⓣ][1]
|
||||
|
||||
Resolves the value of property `key` on `object`. If `key` is a function it will be invoked with the `this` binding of `object` and its result returned, else the property value is returned. If `object` is `null` or `undefined` then `undefined` is returned. If a default value is provided it will be returned if the property value resolves to `undefined`.
|
||||
|
||||
@@ -4695,7 +4699,7 @@ Create a new `lodash` function using the given context object.
|
||||
<!-- div -->
|
||||
|
||||
### <a id="_timesn-callback-thisarg"></a>`_.times(n, callback, [thisArg])`
|
||||
<a href="#_timesn-callback-thisarg">#</a> [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L7277 "View in source") [Ⓣ][1]
|
||||
<a href="#_timesn-callback-thisarg">#</a> [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L7278 "View in source") [Ⓣ][1]
|
||||
|
||||
Executes the callback `n` times, returning an array of the results of each callback execution. The callback is bound to `thisArg` and invoked with one argument; *(index)*.
|
||||
|
||||
@@ -4727,7 +4731,7 @@ _.times(3, function(n) { this.cast(n); }, mage);
|
||||
<!-- div -->
|
||||
|
||||
### <a id="_uniqueidprefix"></a>`_.uniqueId([prefix])`
|
||||
<a href="#_uniqueidprefix">#</a> [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L7305 "View in source") [Ⓣ][1]
|
||||
<a href="#_uniqueidprefix">#</a> [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L7306 "View in source") [Ⓣ][1]
|
||||
|
||||
Generates a unique ID. If `prefix` is provided the ID will be appended to it.
|
||||
|
||||
@@ -4780,7 +4784,7 @@ A reference to the `lodash` function.
|
||||
<!-- div -->
|
||||
|
||||
### <a id="_version"></a>`_.VERSION`
|
||||
<a href="#_version">#</a> [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L7512 "View in source") [Ⓣ][1]
|
||||
<a href="#_version">#</a> [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L7514 "View in source") [Ⓣ][1]
|
||||
|
||||
*(string)*: The semantic version number.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user