mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-06 17:47:49 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6b3e0da93c |
@@ -1,4 +1,4 @@
|
|||||||
# lodash-es v4.13.0
|
# lodash-es v4.13.1
|
||||||
|
|
||||||
The [Lodash](https://lodash.com/) library exported as [ES](http://www.ecma-international.org/ecma-262/6.0/) modules.
|
The [Lodash](https://lodash.com/) library exported as [ES](http://www.ecma-international.org/ecma-262/6.0/) modules.
|
||||||
|
|
||||||
@@ -7,4 +7,4 @@ Generated using [lodash-cli](https://www.npmjs.com/package/lodash-cli):
|
|||||||
$ lodash modularize exports=es -o ./
|
$ lodash modularize exports=es -o ./
|
||||||
```
|
```
|
||||||
|
|
||||||
See the [package source](https://github.com/lodash/lodash/tree/4.13.0-es) for more details.
|
See the [package source](https://github.com/lodash/lodash/tree/4.13.1-es) for more details.
|
||||||
|
|||||||
30
_createFind.js
Normal file
30
_createFind.js
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
import baseIteratee from './_baseIteratee.js';
|
||||||
|
import isArrayLike from './isArrayLike.js';
|
||||||
|
import keys from './keys.js';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a `_.find` or `_.findLast` function.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {Function} findIndexFunc The function to find the collection index.
|
||||||
|
* @returns {Function} Returns the new find function.
|
||||||
|
*/
|
||||||
|
function createFind(findIndexFunc) {
|
||||||
|
return function(collection, predicate, fromIndex) {
|
||||||
|
var iterable = Object(collection);
|
||||||
|
predicate = baseIteratee(predicate, 3);
|
||||||
|
if (!isArrayLike(collection)) {
|
||||||
|
var props = keys(collection);
|
||||||
|
}
|
||||||
|
var index = findIndexFunc(props || collection, function(value, key) {
|
||||||
|
if (props) {
|
||||||
|
key = value;
|
||||||
|
value = iterable[key];
|
||||||
|
}
|
||||||
|
return predicate(value, key, iterable);
|
||||||
|
}, fromIndex);
|
||||||
|
return index > -1 ? collection[props ? props[index] : index] : undefined;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export default createFind;
|
||||||
@@ -9,6 +9,6 @@ import stubFalse from './stubFalse.js';
|
|||||||
* @param {*} value The value to check.
|
* @param {*} value The value to check.
|
||||||
* @returns {boolean} Returns `true` if `func` is maskable, else `false`.
|
* @returns {boolean} Returns `true` if `func` is maskable, else `false`.
|
||||||
*/
|
*/
|
||||||
var isMaskable = !coreJsData ? stubFalse : isFunction;
|
var isMaskable = coreJsData ? isFunction : stubFalse;
|
||||||
|
|
||||||
export default isMaskable;
|
export default isMaskable;
|
||||||
|
|||||||
9
find.js
9
find.js
@@ -1,6 +1,5 @@
|
|||||||
|
import createFind from './_createFind.js';
|
||||||
import findIndex from './findIndex.js';
|
import findIndex from './findIndex.js';
|
||||||
import isArrayLike from './isArrayLike.js';
|
|
||||||
import values from './values.js';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Iterates over elements of `collection`, returning the first element
|
* Iterates over elements of `collection`, returning the first element
|
||||||
@@ -39,10 +38,6 @@ import values from './values.js';
|
|||||||
* _.find(users, 'active');
|
* _.find(users, 'active');
|
||||||
* // => object for 'barney'
|
* // => object for 'barney'
|
||||||
*/
|
*/
|
||||||
function find(collection, predicate, fromIndex) {
|
var find = createFind(findIndex);
|
||||||
collection = isArrayLike(collection) ? collection : values(collection);
|
|
||||||
var index = findIndex(collection, predicate, fromIndex);
|
|
||||||
return index > -1 ? collection[index] : undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default find;
|
export default find;
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
|
import createFind from './_createFind.js';
|
||||||
import findLastIndex from './findLastIndex.js';
|
import findLastIndex from './findLastIndex.js';
|
||||||
import isArrayLike from './isArrayLike.js';
|
|
||||||
import values from './values.js';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method is like `_.find` except that it iterates over elements of
|
* This method is like `_.find` except that it iterates over elements of
|
||||||
@@ -22,10 +21,6 @@ import values from './values.js';
|
|||||||
* });
|
* });
|
||||||
* // => 3
|
* // => 3
|
||||||
*/
|
*/
|
||||||
function findLast(collection, predicate, fromIndex) {
|
var findLast = createFind(findLastIndex);
|
||||||
collection = isArrayLike(collection) ? collection : values(collection);
|
|
||||||
var index = findLastIndex(collection, predicate, fromIndex);
|
|
||||||
return index > -1 ? collection[index] : undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default findLast;
|
export default findLast;
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ import toInteger from './toInteger.js';
|
|||||||
import lodash from './wrapperLodash.js';
|
import lodash from './wrapperLodash.js';
|
||||||
|
|
||||||
/** Used as the semantic version number. */
|
/** Used as the semantic version number. */
|
||||||
var VERSION = '4.13.0';
|
var VERSION = '4.13.1';
|
||||||
|
|
||||||
/** Used to compose bitmasks for wrapper metadata. */
|
/** Used to compose bitmasks for wrapper metadata. */
|
||||||
var BIND_KEY_FLAG = 2;
|
var BIND_KEY_FLAG = 2;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "lodash-es",
|
"name": "lodash-es",
|
||||||
"version": "4.13.0",
|
"version": "4.13.1",
|
||||||
"description": "Lodash exported as ES modules.",
|
"description": "Lodash exported as ES modules.",
|
||||||
"keywords": "es6, modules, stdlib, util",
|
"keywords": "es6, modules, stdlib, util",
|
||||||
"homepage": "https://lodash.com/custom-builds",
|
"homepage": "https://lodash.com/custom-builds",
|
||||||
|
|||||||
Reference in New Issue
Block a user