diff --git a/1. b/1. deleted file mode 100644 index a9cc75b..0000000 --- a/1. +++ /dev/null @@ -1,436 +0,0 @@ - - - - - - - - - - - - - lodash中文文档 1.入门指南 - - - - - - - - -
- -
-
-

Download

-

Review the build differences & pick the one that’s right for you.

- -

Installation

-

In a browser:

-
<script src="lodash.js"></script>
-

In an AMD loader:

-
require(['lodash'], function(_) {});
-

Using npm:

-
$ {sudo -H} npm i -g npm$ npm i --save lodash
-

In Node.js/io.js:

-
// load the modern build
-var _ = require('lodash');
-
-// or a method category
-var array = require('lodash/array');
-
-// or a method (great for smaller builds with browserify/webpack)
-var chunk = require('lodash/array/chunk');
-

See the package source for more details.

-

Note: -Don’t assign values to the special variable_” when in the REPL. -Install n_ for a REPL that includes lodash by default.

-

Module formats

-

lodash is also available in a variety of other builds & module formats.

- -

CDN copies are available on cdnjs & jsDelivr. -Create custom builds with only the features you need. -Looking for more functional usage? Try lodash-fp.

-

Dive in

-

Check out our changelog, roadmap, as well as community created podcasts, posts, & videos.

-

Support

-

Tested in Chrome 43-44, Firefox 38-39, IE 6-11, MS Edge, Safari 5-8, ChakraNode 0.12.2, Node.js 0.8.28, 0.10.40, 0.12.7, & 4.0.0, PhantomJS 1.9.8, RingoJS 0.11, & Rhino 1.7.6

-

Automated browser & CI test runs are available. Special thanks to Sauce Labs for providing automated browser testing.

-
-
-
-
-
- - - - - - - - diff --git a/2. b/2. deleted file mode 100644 index e69ab63..0000000 --- a/2. +++ /dev/null @@ -1,471 +0,0 @@ - - - - - - - - - - - - - lodash中文文档 2.自定义构建 - - - - - - - - -
- -
-
-

Custom builds

-

Custom builds make it easy to create lightweight versions of lodash containing only the features you need. To top it off, we handle all function dependency & alias mapping for you. Review the build differences & pick the one that’s right for you.

-

Using Grunt? We also provide a Grunt plugin to build lodash as part of your Gruntfile.

-

The lodash command-line utility is available when lodash-cli is installed as a global package:

-
$ {sudo -H} npm i -g npm
-$ {sudo -H} npm i -g lodash-cli
-$ lodash -h
-

Note: Uninstall older versions before installing lodash-cli.

-
    -
  • Compat builds, with support for old & new environments, are created using the compat modifier. (default)
  • -
-
lodash compat
-
    -
  • Modern builds, tailored for newer environments with ES5/ES6 support, are created using the modern modifier.
  • -
-
lodash modern
-
    -
  • Strict builds, with ES strict mode enabled, are created using the strict modifier.
  • -
-
lodash strict
-
    -
  • Modularized builds, splitting lodash into modules, are created using the modularize modifier.
  • -
-
lodash modularize
-

Build commands:

-
    -
  • Use the category command to pass comma separated categories of functions to include in the build. Valid categories are “array”, “chain”, “collection”, “date”, “function”, “lang”, “object”, “number”, “string”, & “utility”.
  • -
-
lodash category=collection,function
-
    -
  • Use the exports command to pass comma separated names of ways to export the lodash function. Valid exports are “amd”, “commonjs”, “es”, “global”, “iojs”, “node”, “npm”, “none”, & “umd”.
  • -
-
lodash exports=amd,commonjs,iojs
-
    -
  • Use the iife command to specify code to replace the IIFE that wraps lodash.
  • -
-
lodash iife="!function(window,undefined){%output%}(this)"
-
    -
  • Use the include command to pass comma separated names of functions to include in the build.
  • -
-
lodash include=each,filter,map
-
    -
  • Use the minus command to pass comma separated function/category names to remove from the build.
  • -
-
lodash modern minus=result,shuffle
-
    -
  • Use the plus command to pass comma separated function/category names to add to the build.
  • -
-
lodash category=array plus=random,template
-
    -
  • Use the template command to pass the file path pattern used to match template files to precompile. Note: Precompiled templates are assigned to the _.<span class="me1">templates</span> object.
  • -
-
lodash template="./*.jst"
-
    -
  • Use the settings command to pass template settings used when precompiling templates.
  • -
-
lodash settings="{interpolate:/\{\{([\s\S]+?)\}\}/g}"
-
    -
  • Use the moduleId command to specify the AMD module ID for lodash or the module ID used to include lodash in compiled templates. Use “none” as the module ID to create compiled templates without a dependency on lodash.
  • -
-
lodash moduleId=underscore
-

Notes:

-
    -
  • All commands except compat & modern may be combined
  • -
  • The exports values “es” & “npm” may only be used in conjunction with the modularize command
  • -
  • The modularize command uses the first exports values as its module format, ignoring subsequent values.
  • -
  • Unless specified by -o or --output all files created are saved to the current working directory
  • -
  • Node.js 0.10.8-0.10.11 have bugs preventing minified builds
  • -
-

The following options are also supported:

-
-c, --stdout .......... Write output to standard output
--d, --development ..... Write only the non-minified development output
--h, --help ............ Display help information
--m, --source-map ...... Generate a source map using an optional source map URL
--o, --output .......... Write output to a given path/filename
--p, --production ...... Write only the minified production output
--s, --silent .......... Skip status updates normally logged to the console
--V, --version ......... Output current version of lodash
-
-
-
-
-
- - - - - - - - diff --git a/VERSION.html b/VERSION.html index 7d2ed5d..6f35d03 100644 --- a/VERSION.html +++ b/VERSION.html @@ -392,7 +392,7 @@
-

VERSION source

+

VERSION source

_.VERSION

(string): The semantic version number.

diff --git a/add.html b/add.html index 80f78f4..e802805 100644 --- a/add.html +++ b/add.html @@ -392,7 +392,7 @@
-

add source npm

+

add source npm

_.add(augend, addend)

Adds two numbers.

diff --git a/after.html b/after.html index d34bc23..d676896 100644 --- a/after.html +++ b/after.html @@ -392,7 +392,7 @@
-

after source npm

+

after source npm

_.after(n, func)

The opposite of _.before; this method creates a function that invokes diff --git a/all.html b/all.html index 4455596..633dbad 100644 --- a/all.html +++ b/all.html @@ -784,7 +784,7 @@

参数

  • [values] (...Array)

    用于对比差异的数组

  • -
  • [iteratee=_.identity] (Function|Object|string)

    这个函数会调用每一个元素

    +
  • [iteratee=_.identity] (Function|Object|string)

    这个函数会处理每一个元素

  • 返回值 (Array)

    @@ -833,7 +833,7 @@

    参数

  • [values] (...Array)

    用于对比差异的数组

  • -
  • [comparator] (Function)

    这个函数会调用每一个元素

    +
  • [comparator] (Function)

    这个函数会处理每一个元素

  • 返回值 (Array)

    @@ -1634,7 +1634,7 @@

    参数

    1. [arrays] (...Array)

      需要检索的数组

    2. -
    3. [iteratee=_.identity] (Function|Object|string)

      这个函数会调用每一个元素

      +
    4. [iteratee=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

    返回值 (Array)

    @@ -1681,7 +1681,7 @@

    参数

    1. [arrays] (...Array)

      需要检索的数组

    2. -
    3. [comparator] (Function)

      这个函数会调用每一个元素

      +
    4. [comparator] (Function)

      这个函数会处理每一个元素

    返回值 (Array)

    @@ -2009,7 +2009,7 @@

    参数

  • values (Array)

    要移除的值

  • -
  • [iteratee=_.identity] (Function|Object|string)

    这个函数会调用每一个元素

    +
  • [iteratee=_.identity] (Function|Object|string)

    这个函数会处理每一个元素

  • 返回值 (Array)

    @@ -2110,7 +2110,7 @@

    参数

    1. array (Array)

      需要调整的数组

    2. -
    3. [predicate=_.identity] (Function|Object|string)

      这个函数会调用每一个元素

      +
    4. [predicate=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

    返回值 (Array)

    @@ -2253,7 +2253,7 @@

    参数

  • value (*)

    要评估位置的值

  • -
  • [iteratee=_.identity] (Function|Object|string)

    这个函数会调用每一个元素

    +
  • [iteratee=_.identity] (Function|Object|string)

    这个函数会处理每一个元素

  • 返回值 (number)

    @@ -2390,7 +2390,7 @@

    参数

  • value (*)

    要评估位置的值

  • -
  • [iteratee=_.identity] (Function|Object|string)

    这个函数会调用每一个元素

    +
  • [iteratee=_.identity] (Function|Object|string)

    这个函数会处理每一个元素

  • 返回值 (number)

    @@ -2518,7 +2518,7 @@

    参数

    1. array (Array)

      要调整的数组

    2. -
    3. [iteratee] (Function)

      这个函数会调用每一个元素

      +
    4. [iteratee] (Function)

      这个函数会处理每一个元素

    返回值 (Array)

    @@ -2706,7 +2706,7 @@

    参数

    1. array (Array)

      需要处理的数组

    2. -
    3. [predicate=_.identity] (Function|Object|string)

      这个函数会调用每一个元素

      +
    4. [predicate=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

    返回值 (Array)

    @@ -2769,7 +2769,7 @@

    参数

    1. array (Array)

      需要处理的数组

    2. -
    3. [predicate=_.identity] (Function|Object|string)

      这个函数会调用每一个元素

      +
    4. [predicate=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

    返回值 (Array)

    @@ -2873,7 +2873,7 @@

    参数

    1. [arrays] (...Array)

      需要处理的数组队列

    2. -
    3. [iteratee=_.identity] (Function|Object|string)

      这个函数会调用每一个元素

      +
    4. [iteratee=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

    返回值 (Array)

    @@ -2921,7 +2921,7 @@

    参数

    1. [arrays] (...Array)

      需要处理的数组队列

    2. -
    3. [comparator] (Function)

      这个函数会调用每一个元素

      +
    4. [comparator] (Function)

      这个函数会处理每一个元素

    返回值 (Array)

    @@ -3008,7 +3008,7 @@

    参数

    1. array (Array)

      需要处理的数组

    2. -
    3. [iteratee=_.identity] (Function|Object|string)

      这个函数会调用每一个元素

      +
    4. [iteratee=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

    返回值 (Array)

    @@ -3055,7 +3055,7 @@

    参数

    1. array (Array)

      需要处理的数组

    2. -
    3. [comparator] (Function)

      这个函数会调用每一个元素

      +
    4. [comparator] (Function)

      这个函数会处理每一个元素

    返回值 (Array)

    @@ -3274,7 +3274,7 @@

    参数

    1. [arrays] (...Array)

      要处理的数组

    2. -
    3. [iteratee=_.identity] (Function|Object|string)

      这个函数会调用每一个元素

      +
    4. [iteratee=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

    返回值 (Array)

    @@ -3321,7 +3321,7 @@

    参数

    1. [arrays] (...Array)

      要处理的数组

    2. -
    3. [comparator] (Function)

      这个函数会调用每一个元素

      +
    4. [comparator] (Function)

      这个函数会处理每一个元素

    返回值 (Array)

    @@ -4086,7 +4086,7 @@

    示例

    参数

      -
    1. [iteratee=_.identity] (Function|Object|string)

      这个函数会调用每一个元素

      +
    2. [iteratee=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

    返回值 (Object)

    @@ -4123,24 +4123,21 @@

    示例

    })();
    -

    countBy source npm

    +

    countBy source npm

    _.countBy(collection, [iteratee=_.identity])
    -

    Creates an object composed of keys generated from the results of running -each element of collection through iteratee. The corresponding value -of each key is the number of times the key was returned by iteratee. -The iteratee is invoked with one argument: (value).

    +

    创建一个组成对象,key是经过 iteratee 处理的集合的结果,value 是处理结果的次数。 iteratee 会传入一个参数:(value)。

    参数

      -
    1. collection (Array|Object)

      The collection to iterate over.

      +
    2. collection (Array|Object)

      需要遍历的集合

    3. -
    4. [iteratee=_.identity] (Function|Object|string)

      这个函数会调用每一个元素

      +
    5. [iteratee=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

    返回值 (Object)

    -

    Returns the composed aggregate object.

    +

    返回一个组成汇总的对象

    示例

    _.countBy([6.1, 4.2, 6.3], Math.floor);
    @@ -4172,23 +4169,21 @@ 

    示例

    })();
    -

    every source npm

    +

    every source npm

    _.every(collection, [predicate=_.identity])
    -

    Checks if predicate returns truthy for all elements of collection. -Iteration is stopped once predicate returns falsey. The predicate is -invoked with three arguments: (value, index|key, collection).

    +

    通过 predicate 检查集合中的元素是否都返回 真值,只要 predicate 返回一次假值,遍历就停止,并返回 false。
    predicate 会传入3个参数:(value, index|key, collection)

    参数

      -
    1. collection (Array|Object)

      The collection to iterate over.

      +
    2. collection (Array|Object)

      需要遍历的集合

    3. -
    4. [predicate=_.identity] (Function|Object|string)

      The function invoked per iteration.

      +
    5. [predicate=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

    返回值 (boolean)

    -

    Returns true if all elements pass the predicate check, else false.

    +

    返回 true,如果所有元素经 predicate 检查都为真值,否则返回 false。

    示例

    _.every([true, 1, null, 'yes'], Boolean);
    @@ -4234,23 +4229,21 @@ 

    示例

    })();
    -

    filter source npm

    +

    filter source npm

    _.filter(collection, [predicate=_.identity])
    -

    Iterates over elements of collection, returning an array of all elements -predicate returns truthy for. The predicate is invoked with three arguments:
    -(value, index|key, collection).

    +

    遍历集合中的元素,筛选出一个经过 predicate 检查结果为真值的数组,predicate 会传入3个参数:(value, index|key, collection)。

    参数

      -
    1. collection (Array|Object)

      The collection to iterate over.

      +
    2. collection (Array|Object)

      需要遍历的集合

    3. -
    4. [predicate=_.identity] (Function|Object|string)

      The function invoked per iteration.

      +
    5. [predicate=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

    返回值 (Array)

    -

    Returns the new filtered array.

    +

    返回筛选结果的新数组

    示例

    var resolve = _.partial(_.map, _, 'user');
    @@ -4298,23 +4291,21 @@ 

    示例

    })();
    -

    find source npm

    +

    find source npm

    _.find(collection, [predicate=_.identity])
    -

    Iterates over elements of collection, returning the first element -predicate returns truthy for. The predicate is invoked with three arguments:
    -(value, index|key, collection).

    +

    遍历集合中的元素,返回最先经 predicate 检查为真值的元素。 predicate 会传入3个元素:(value, index|key, collection)。

    参数

      -
    1. collection (Array|Object)

      The collection to search.

      +
    2. collection (Array|Object)

      要检索的集合

    3. -
    4. [predicate=_.identity] (Function|Object|string)

      The function invoked per iteration.

      +
    5. [predicate=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

    返回值 (*)

    -

    Returns the matched element, else undefined.

    +

    返回匹配元素,否则返回 undefined

    示例

    var resolve = _.partial(_.result, _, 'user');
    @@ -4363,22 +4354,21 @@ 

    示例

    })();
    -

    findLast source npm

    +

    findLast source npm

    _.findLast(collection, [predicate=_.identity])
    -

    This method is like _.find except that it iterates over elements of -collection from right to left.

    +

    这个方法类似 _.find,除了它是从右至左遍历集合的。

    参数

      -
    1. collection (Array|Object)

      The collection to search.

      +
    2. collection (Array|Object)

      要检索的集合

    3. -
    4. [predicate=_.identity] (Function|Object|string)

      The function invoked per iteration.

      +
    5. [predicate=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

    返回值 (*)

    -

    Returns the matched element, else undefined.

    +

    返回匹配元素,否则返回 undefined

    示例

    _.findLast([1, 2, 3, 4], function(n) {
    @@ -4409,39 +4399,36 @@ 

    示例

    })();
    -

    forEach each source npm

    +

    forEach each source npm

    _.forEach(collection, [iteratee=_.identity])
    -

    Iterates over elements of collection invoking iteratee for each element. -The iteratee is invoked with three arguments: (value, index|key, collection). -Iteratee functions may exit iteration early by explicitly returning false. +

    调用 iteratee 遍历集合中的元素,iteratee 会传入3个参数:(value, index|key, collection)。 +如果显式的返回 false ,iteratee 会提前退出。

    -注意: As with other "Collections" methods, objects with a "length" property -are iterated like arrays. To avoid this behavior use _.forIn or _.forOwn -for object iteration.

    +注意: 与其他集合方法一样,对象的 length 属性也会被遍历,避免这种情况,可以用 _.forIn 或者 _.forOwn 代替。

    参数

      -
    1. collection (Array|Object)

      The collection to iterate over.

      +
    2. collection (Array|Object)

      需要遍历的集合

    3. -
    4. [iteratee=_.identity] (Function)

      The function invoked per iteration.

      +
    5. [iteratee=_.identity] (Function)

      这个函数会处理每一个元素

    返回值 (Array|Object)

    -

    Returns collection.

    +

    返回集合

    示例

    _([1, 2]).forEach(function(value) {
       console.log(value);
     });
    -// => logs `1` then `2`
    +// => 输出 `1` 和 `2`
     
     _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
       console.log(key);
     });
    -// => logs 'a' then 'b' (iteration order is not guaranteed)
    +// => 输出 'a' 和 'b' (不保证遍历的顺序)
     
    @@ -4466,28 +4453,27 @@

    示例

    })();
    -

    forEachRight eachRight source npm

    +

    forEachRight eachRight source npm

    _.forEachRight(collection, [iteratee=_.identity])
    -

    This method is like _.forEach except that it iterates over elements of -collection from right to left.

    +

    这个方法类似 _.forEach,除了它是从右到左遍历的集合中的元素的。

    参数

      -
    1. collection (Array|Object)

      The collection to iterate over.

      +
    2. collection (Array|Object)

      需要遍历的集合

    3. -
    4. [iteratee=_.identity] (Function)

      The function invoked per iteration.

      +
    5. [iteratee=_.identity] (Function)

      这个函数会处理每一个元素

    返回值 (Array|Object)

    -

    Returns collection.

    +

    返回集合

    示例

    _.forEachRight([1, 2], function(value) {
       console.log(value);
     });
    -// => logs `2` then `1`
    +// => 输出 `2` 和 `1`
     
    @@ -4512,24 +4498,21 @@

    示例

    })();
    -

    groupBy source npm

    +

    groupBy source npm

    _.groupBy(collection, [iteratee=_.identity])
    -

    Creates an object composed of keys generated from the results of running -each element of collection through iteratee. The corresponding value -of each key is an array of the elements responsible for generating the key. -The iteratee is invoked with one argument: (value).

    +

    创建一个对象组成,key 是经 iteratee 处理的结果, value 是产生 key 的元素数组。 iteratee 会传入1个参数:(value)。

    参数

      -
    1. collection (Array|Object)

      The collection to iterate over.

      +
    2. collection (Array|Object)

      需要遍历的集合

    3. -
    4. [iteratee=_.identity] (Function|Object|string)

      这个函数会调用每一个元素

      +
    5. [iteratee=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

    返回值 (Object)

    -

    Returns the composed aggregate object.

    +

    返回一个组成汇总的对象

    示例

    _.groupBy([6.1, 4.2, 6.3], Math.floor);
    @@ -4562,26 +4545,25 @@ 

    示例

    })();
    -

    includes source npm

    +

    includes source npm

    _.includes(collection, value, [fromIndex=0])
    -

    Checks if value is in collection. If collection is a string it's checked -for a substring of value, otherwise SameValueZero -is used for equality comparisons. If fromIndex is negative, it's used as -the offset from the end of collection.

    +

    检查 值 是否在 集合中,如果集合是字符串,那么检查 值 是否在字符串中。 +其他情况用 SameValueZero 等值比较。 +如果指定 fromIndex 是负数,从结尾开始检索。

    参数

      -
    1. collection (Array|Object|string)

      The collection to search.

      +
    2. collection (Array|Object|string)

      要检索的集合

    3. -
    4. value (*)

      The value to search for.

      +
    5. value (*)

      要检索的值

    6. -
    7. [fromIndex=0] (number)

      The index to search from.

      +
    8. [fromIndex=0] (number)

      要检索的 index 位置

    返回值 (boolean)

    -

    Returns true if value is found, else false.

    +

    如果找到 value 返回 ture, 否则返回 false。

    示例

    _.includes([1, 2, 3], 1);
    @@ -4619,26 +4601,24 @@ 

    示例

    })();
    -

    invokeMap source npm

    +

    invokeMap source npm

    _.invokeMap(collection, path, [args])
    -

    Invokes the method at path of each element in collection, returning -an array of the results of each invoked method. Any additional arguments -are provided to each invoked method. If methodName is a function it's -invoked for, and this bound to, each element in collection.

    +

    调用 path 的方法处理集合中的每一个元素,返回处理的数组。 +如何附加的参数会传入到调用方法中。如果方法名是个函数,集合中的每个元素都会被调用到。

    参数

      -
    1. collection (Array|Object)

      The collection to iterate over.

      +
    2. collection (Array|Object)

      需要遍历的集合

    3. -
    4. path (Array|Function|string)

      The path of the method to invoke or the function invoked per iteration.

      +
    5. path (Array|Function|string)

      要调用的方法名 或者 这个函数会处理每一个元素

    6. [args] (...*)

      The arguments to invoke each method with.

    返回值 (Array)

    -

    Returns the array of results.

    +

    返回数组结果

    示例

    _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
    @@ -4670,24 +4650,22 @@ 

    示例

    })();
    -

    keyBy source npm

    +

    keyBy source npm

    _.keyBy(collection, [iteratee=_.identity])
    -

    Creates an object composed of keys generated from the results of running -each element of collection through iteratee. The corresponding value -of each key is the last element responsible for generating the key. The -iteratee is invoked with one argument: (value).

    +

    创建一个对象组成。key 是经 iteratee 处理的结果,value 是产生key的元素。 +iteratee 会传入1个参数:(value)。

    参数

      -
    1. collection (Array|Object)

      The collection to iterate over.

      +
    2. collection (Array|Object)

      需要遍历的集合

    3. -
    4. [iteratee=_.identity] (Function|Object|string)

      这个函数会调用每一个元素

      +
    5. [iteratee=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

    返回值 (Object)

    -

    Returns the composed aggregate object.

    +

    返回一个组成汇总的对象

    示例

    var keyData = [
    @@ -4726,34 +4704,33 @@ 

    示例

    })();
    -

    map source npm

    +

    map source npm

    _.map(collection, [iteratee=_.identity])
    -

    Creates an array of values by running each element in collection through -iteratee. The iteratee is invoked with three arguments:
    -(value, index|key, collection). +

    创建一个经过 iteratee 处理的集合中每一个元素的结果数组。 +iteratee 会传入3个参数:(value, index|key, collection)。

    -Many lodash methods are guarded to work as iteratees for methods like -_.every, _.filter, _.map, _.mapValues, _.reject, and _.some. +有许多 lodash 的方法以 iteratees 的身份守护其工作,例如: +_.every, _.filter, _.map, _.mapValues, _.reject, 以及 _.some

    -The guarded methods are:
    +被守护的有:
    ary, curry, curryRight, drop, dropRight, every, fill, invert, parseInt, random, range, rangeRight, slice, some, sortBy, take, takeRight, template, trim, trimEnd, trimStart, -and words

    +以及 words

    参数

      -
    1. collection (Array|Object)

      The collection to iterate over.

      +
    2. collection (Array|Object)

      需要遍历的集合

    3. -
    4. [iteratee=_.identity] (Function|Object|string)

      The function invoked per iteration.

      +
    5. [iteratee=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

    返回值 (Array)

    -

    Returns the new mapped array.

    +

    返回映射后的新数组

    示例

    function square(n) {
    @@ -4764,7 +4741,7 @@ 

    示例

    // => [3, 6] _.map({ 'a': 1, 'b': 2 }, square); -// => [3, 6] (iteration order is not guaranteed) +// => [3, 6] (无法保证遍历的顺序) var users = [ { 'user': 'barney' }, @@ -4798,26 +4775,25 @@

    示例

    })();
    -

    orderBy source npm

    +

    orderBy source npm

    _.orderBy(collection, [iteratees=[_.identity]], [orders])
    -

    This method is like _.sortBy except that it allows specifying the sort -orders of the iteratees to sort by. If orders is unspecified, all values -are sorted in ascending order. Otherwise, specify an order of "desc" for -descending or "asc" for ascending sort order of corresponding values.

    +

    这个方法类似 _.sortBy,除了它允许以 iteratees 来指定排序规则。 +如果没指定 orders,所有值以升序排序。 +其他情况,指定 "desc" 降序,指定 "asc" 升序其对应值。

    参数

      -
    1. collection (Array|Object)

      The collection to iterate over.

      +
    2. collection (Array|Object)

      需要遍历的集合

    3. -
    4. [iteratees=[_.identity]] (Function[]|Object[]|string[])

      The iteratees to sort by.

      +
    5. [iteratees=[_.identity]] (Function[]|Object[]|string[])

      通过 iteratees 决定排序

    6. -
    7. [orders] (string[])

      The sort orders of iteratees.

      +
    8. [orders] (string[])

      决定 iteratees 的排序方法

    返回值 (Array)

    -

    Returns the new sorted array.

    +

    排序排序后的新数组

    示例

    var resolve = _.partial(_.map, _, _.values);
    @@ -4829,7 +4805,7 @@ 

    示例

    { 'user': 'barney', 'age': 36 } ]; -// sort by `user` in ascending order and by `age` in descending order +// 以 `user` 升序排序 再 以 `age` 降序排序。 resolve( _.orderBy(users, ['user', 'age'], ['asc', 'desc']) ); // => [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]]
    @@ -4856,7 +4832,7 @@

    示例

    })();
    -

    partition source npm

    +

    partition source npm

    _.partition(collection, [predicate=_.identity])

    Creates an array of elements split into two groups, the first of which @@ -4867,9 +4843,9 @@

    示例

    参数

      -
    1. collection (Array|Object)

      The collection to iterate over.

      +
    2. collection (Array|Object)

      需要遍历的集合

    3. -
    4. [predicate=_.identity] (Function|Object|string)

      The function invoked per iteration.

      +
    5. [predicate=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

    返回值 (Array)

    @@ -4924,7 +4900,7 @@

    示例

    })();
    -

    reduce source npm

    +

    reduce source npm

    _.reduce(collection, [iteratee=_.identity], [accumulator])

    Reduces collection to a value which is the accumulated result of running @@ -4946,9 +4922,9 @@

    示例

    参数

      -
    1. collection (Array|Object)

      The collection to iterate over.

      +
    2. collection (Array|Object)

      需要遍历的集合

    3. -
    4. [iteratee=_.identity] (Function)

      The function invoked per iteration.

      +
    5. [iteratee=_.identity] (Function)

      这个函数会处理每一个元素

    6. [accumulator] (*)

      The initial value.

    7. @@ -4966,7 +4942,7 @@

      示例

      (result[value] || (result[value] = [])).push(key); return result; }, {}); -// => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed) +// => { '1': ['a', 'c'], '2': ['b'] } (无法保证遍历的顺序)
    @@ -4991,7 +4967,7 @@

    示例

    })();
    -

    reduceRight source npm

    +

    reduceRight source npm

    _.reduceRight(collection, [iteratee=_.identity], [accumulator])

    This method is like _.reduce except that it iterates over elements of @@ -5000,9 +4976,9 @@

    示例

    参数

      -
    1. collection (Array|Object)

      The collection to iterate over.

      +
    2. collection (Array|Object)

      需要遍历的集合

    3. -
    4. [iteratee=_.identity] (Function)

      The function invoked per iteration.

      +
    5. [iteratee=_.identity] (Function)

      这个函数会处理每一个元素

    6. [accumulator] (*)

      The initial value.

    7. @@ -5041,7 +5017,7 @@

      示例

      })();
    -

    reject source npm

    +

    reject source npm

    _.reject(collection, [predicate=_.identity])

    The opposite of _.filter; this method returns the elements of collection @@ -5050,9 +5026,9 @@

    示例

    参数

      -
    1. collection (Array|Object)

      The collection to iterate over.

      +
    2. collection (Array|Object)

      需要遍历的集合

    3. -
    4. [predicate=_.identity] (Function|Object|string)

      The function invoked per iteration.

      +
    5. [predicate=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

    返回值 (Array)

    @@ -5104,7 +5080,7 @@

    示例

    })();
    -

    sample source npm

    +

    sample source npm

    _.sample(collection)

    Gets a random element from collection.

    @@ -5145,7 +5121,7 @@

    示例

    })();
    -

    sampleSize source npm

    +

    sampleSize source npm

    _.sampleSize(collection, [n=0])

    Gets n random elements from collection.

    @@ -5188,7 +5164,7 @@

    示例

    })();
    -

    shuffle source npm

    +

    shuffle source npm

    _.shuffle(collection)

    Creates an array of shuffled values, using a version of the @@ -5230,7 +5206,7 @@

    示例

    })();
    -

    size source npm

    +

    size source npm

    _.size(collection)

    Gets the size of collection by returning its length for array-like @@ -5278,7 +5254,7 @@

    示例

    })();
    -

    some source npm

    +

    some source npm

    _.some(collection, [predicate=_.identity])

    Checks if predicate returns truthy for any element of collection. @@ -5288,9 +5264,9 @@

    示例

    参数

      -
    1. collection (Array|Object)

      The collection to iterate over.

      +
    2. collection (Array|Object)

      需要遍历的集合

    3. -
    4. [predicate=_.identity] (Function|Object|string)

      The function invoked per iteration.

      +
    5. [predicate=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

    返回值 (boolean)

    @@ -5340,7 +5316,7 @@

    示例

    })();
    -

    sortBy source npm

    +

    sortBy source npm

    _.sortBy(collection, [iteratees=[_.identity]])

    Creates an array of elements, sorted in ascending order by the results of @@ -5351,7 +5327,7 @@

    示例

    参数

      -
    1. collection (Array|Object)

      The collection to iterate over.

      +
    2. collection (Array|Object)

      需要遍历的集合

    3. [iteratees=[_.identity]] (...(Function|Function[]|Object|Object[]|string|string[])

      The iteratees to sort by, specified individually or in arrays.

    4. @@ -5403,7 +5379,7 @@

      示例

      })();
    -

    now source npm

    +

    now source npm

    _.now()

    Gets the timestamp of the number of milliseconds that have elapsed since @@ -5442,7 +5418,7 @@

    示例

    })();
    -

    after source npm

    +

    after source npm

    _.after(n, func)

    The opposite of _.before; this method creates a function that invokes @@ -5494,7 +5470,7 @@

    示例

    })();
    -

    ary source npm

    +

    ary source npm

    _.ary(func, [n=func.length])

    Creates a function that accepts up to n arguments, ignoring any @@ -5538,7 +5514,7 @@

    示例

    })();
    -

    before source npm

    +

    before source npm

    _.before(n, func)

    Creates a function that invokes func, with the this binding and arguments @@ -5583,7 +5559,7 @@

    示例

    })();
    -

    bind source npm

    +

    bind source npm

    _.bind(func, thisArg, [partials])

    Creates a function that invokes func with the this binding of thisArg @@ -5650,7 +5626,7 @@

    示例

    })();
    -

    bindKey source npm

    +

    bindKey source npm

    _.bindKey(object, key, [partials])

    Creates a function that invokes the method at object[key] and prepends @@ -5726,7 +5702,7 @@

    示例

    })();
    -

    curry source npm

    +

    curry source npm

    _.curry(func, [arity=func.length])

    Creates a function that accepts arguments of func and either invokes @@ -5796,7 +5772,7 @@

    示例

    })();
    -

    curryRight source npm

    +

    curryRight source npm

    _.curryRight(func, [arity=func.length])

    This method is like _.curry except that arguments are applied to func @@ -5863,7 +5839,7 @@

    示例

    })();
    -

    debounce source npm

    +

    debounce source npm

    _.debounce(func, [wait=0], [options])

    Creates a debounced function that delays invoking func until after wait @@ -5944,7 +5920,7 @@

    示例

    })();
    -

    defer source npm

    +

    defer source npm

    _.defer(func, [args])

    Defers invoking the func until the current call stack has cleared. Any @@ -5990,7 +5966,7 @@

    示例

    })();
    -

    delay source npm

    +

    delay source npm

    _.delay(func, wait, [args])

    Invokes func after wait milliseconds. Any additional arguments are @@ -6038,7 +6014,7 @@

    示例

    })();
    -

    flip source npm

    +

    flip source npm

    _.flip(func)

    Creates a function that invokes func with arguments reversed.

    @@ -6083,7 +6059,7 @@

    示例

    })();
    -

    memoize source npm

    +

    memoize source npm

    _.memoize(func, [resolver])

    Creates a function that memoizes the result of func. If resolver is @@ -6155,7 +6131,7 @@

    示例

    })();
    -

    negate source npm

    +

    negate source npm

    _.negate(predicate)

    Creates a function that negates the result of the predicate func. The @@ -6202,7 +6178,7 @@

    示例

    })();
    -

    once source npm

    +

    once source npm

    _.once(func)

    Creates a function that is restricted to invoking func once. Repeat calls @@ -6247,7 +6223,7 @@

    示例

    })();
    -

    overArgs source npm

    +

    overArgs source npm

    _.overArgs(func, [transforms])

    Creates a function that invokes func with arguments transformed by @@ -6306,7 +6282,7 @@

    示例

    })();
    -

    partial source npm

    +

    partial source npm

    _.partial(func, [partials])

    Creates a function that invokes func with partial arguments prepended @@ -6369,7 +6345,7 @@

    示例

    })();
    -

    partialRight source npm

    +

    partialRight source npm

    _.partialRight(func, [partials])

    This method is like _.partial except that partially applied arguments @@ -6431,7 +6407,7 @@

    示例

    })();
    -

    rearg source npm

    +

    rearg source npm

    _.rearg(func, indexes)

    Creates a function that invokes func with arguments arranged according @@ -6481,7 +6457,7 @@

    示例

    })();
    -

    rest source npm

    +

    rest source npm

    _.rest(func, [start=func.length-1])

    Creates a function that invokes func with the this binding of the @@ -6533,7 +6509,7 @@

    示例

    })();
    -

    spread source npm

    +

    spread source npm

    _.spread(func)

    Creates a function that invokes func with the this binding of the created @@ -6593,7 +6569,7 @@

    示例

    })();
    -

    throttle source npm

    +

    throttle source npm

    _.throttle(func, [wait=0], [options])

    Creates a throttled function that only invokes func at most once per @@ -6665,7 +6641,7 @@

    示例

    })();
    -

    unary source npm

    +

    unary source npm

    _.unary(func)

    Creates a function that accepts up to one argument, ignoring any @@ -6707,7 +6683,7 @@

    示例

    })();
    -

    wrap source npm

    +

    wrap source npm

    _.wrap(value, wrapper)

    Creates a function that provides value to the wrapper function as its @@ -6757,7 +6733,7 @@

    示例

    })();
    -

    clone source npm

    +

    clone source npm

    _.clone(value)

    Creates a shallow clone of value. @@ -6813,7 +6789,7 @@

    示例

    })();
    -

    cloneDeep source npm

    +

    cloneDeep source npm

    _.cloneDeep(value)

    This method is like _.clone except that it recursively clones value.

    @@ -6860,7 +6836,7 @@

    示例

    })();
    -

    cloneDeepWith source npm

    +

    cloneDeepWith source npm

    _.cloneDeepWith(value, [customizer])

    This method is like _.cloneWith except that it recursively clones value.

    @@ -6915,7 +6891,7 @@

    示例

    })();
    -

    cloneWith source npm

    +

    cloneWith source npm

    _.cloneWith(value, [customizer])

    This method is like _.clone except that it accepts customizer which @@ -6973,7 +6949,7 @@

    示例

    })();
    -

    eq source npm

    +

    eq source npm

    _.eq(value, other)

    Performs a SameValueZero @@ -7032,7 +7008,7 @@

    示例

    })();
    -

    gt source npm

    +

    gt source npm

    _.gt(value, other)

    Checks if value is greater than other.

    @@ -7081,7 +7057,7 @@

    示例

    })();
    -

    gte source npm

    +

    gte source npm

    _.gte(value, other)

    Checks if value is greater than or equal to other.

    @@ -7130,7 +7106,7 @@

    示例

    })();
    -

    isArguments source npm

    +

    isArguments source npm

    _.isArguments(value)

    Checks if value is likely an arguments object.

    @@ -7174,7 +7150,7 @@

    示例

    })();
    -

    isArray source npm

    +

    isArray source npm

    _.isArray(value)

    Checks if value is classified as an Array object.

    @@ -7224,7 +7200,7 @@

    示例

    })();
    -

    isArrayLike source npm

    +

    isArrayLike source npm

    _.isArrayLike(value)

    Checks if value is array-like. A value is considered array-like if it's @@ -7276,7 +7252,7 @@

    示例

    })();
    -

    isArrayLikeObject source npm

    +

    isArrayLikeObject source npm

    _.isArrayLikeObject(value)

    This method is like _.isArrayLike except that it also checks if value @@ -7327,7 +7303,7 @@

    示例

    })();
    -

    isBoolean source npm

    +

    isBoolean source npm

    _.isBoolean(value)

    Checks if value is classified as a boolean primitive or object.

    @@ -7371,7 +7347,7 @@

    示例

    })();
    -

    isDate source npm

    +

    isDate source npm

    _.isDate(value)

    Checks if value is classified as a Date object.

    @@ -7415,7 +7391,7 @@

    示例

    })();
    -

    isElement source npm

    +

    isElement source npm

    _.isElement(value)

    Checks if value is likely a DOM element.

    @@ -7459,7 +7435,7 @@

    示例

    })();
    -

    isEmpty source npm

    +

    isEmpty source npm

    _.isEmpty(value)

    Checks if value is empty. A value is considered empty unless it's an @@ -7514,7 +7490,7 @@

    示例

    })();
    -

    isEqual source npm

    +

    isEqual source npm

    _.isEqual(value, other)

    Performs a deep comparison between two values to determine if they are @@ -7571,7 +7547,7 @@

    示例

    })();
    -

    isEqualWith source npm

    +

    isEqualWith source npm

    _.isEqualWith(value, other, [customizer])

    This method is like _.isEqual except that it accepts customizer which is @@ -7632,7 +7608,7 @@

    示例

    })();
    -

    isError source npm

    +

    isError source npm

    _.isError(value)

    Checks if value is an Error, EvalError, RangeError, ReferenceError, @@ -7677,7 +7653,7 @@

    示例

    })();
    -

    isFinite source npm

    +

    isFinite source npm

    _.isFinite(value)

    Checks if value is a finite primitive number. @@ -7730,7 +7706,7 @@

    示例

    })();
    -

    isFunction source npm

    +

    isFunction source npm

    _.isFunction(value)

    Checks if value is classified as a Function object.

    @@ -7774,7 +7750,7 @@

    示例

    })();
    -

    isInteger source npm

    +

    isInteger source npm

    _.isInteger(value)

    Checks if value is an integer. @@ -7827,7 +7803,7 @@

    示例

    })();
    -

    isLength source npm

    +

    isLength source npm

    _.isLength(value)

    Checks if value is a valid array-like length. @@ -7880,7 +7856,7 @@

    示例

    })();
    -

    isMatch source npm

    +

    isMatch source npm

    _.isMatch(object, source)

    Performs a deep comparison between object and source to determine if @@ -7932,7 +7908,7 @@

    示例

    })();
    -

    isMatchWith source npm

    +

    isMatchWith source npm

    _.isMatchWith(object, source, [customizer])

    This method is like _.isMatch except that it accepts customizer which @@ -7993,7 +7969,7 @@

    示例

    })();
    -

    isNaN source npm

    +

    isNaN source npm

    _.isNaN(value)

    Checks if value is NaN. @@ -8047,7 +8023,7 @@

    示例

    })();
    -

    isNative source npm

    +

    isNative source npm

    _.isNative(value)

    Checks if value is a native function.

    @@ -8091,7 +8067,7 @@

    示例

    })();
    -

    isNil source npm

    +

    isNil source npm

    _.isNil(value)

    Checks if value is null or undefined.

    @@ -8138,7 +8114,7 @@

    示例

    })();
    -

    isNull source npm

    +

    isNull source npm

    _.isNull(value)

    Checks if value is null.

    @@ -8182,7 +8158,7 @@

    示例

    })();
    -

    isNumber source npm

    +

    isNumber source npm

    _.isNumber(value)

    Checks if value is classified as a Number primitive or object. @@ -8236,7 +8212,7 @@

    示例

    })();
    -

    isObject source npm

    +

    isObject source npm

    _.isObject(value)

    Checks if value is the language type of Object. @@ -8287,7 +8263,7 @@

    示例

    })();
    -

    isObjectLike source npm

    +

    isObjectLike source npm

    _.isObjectLike(value)

    Checks if value is object-like. A value is object-like if it's not null @@ -8338,7 +8314,7 @@

    示例

    })();
    -

    isPlainObject source npm

    +

    isPlainObject source npm

    _.isPlainObject(value)

    Checks if value is a plain object, that is, an object created by the @@ -8393,7 +8369,7 @@

    示例

    })();
    -

    isRegExp source npm

    +

    isRegExp source npm

    _.isRegExp(value)

    Checks if value is classified as a RegExp object.

    @@ -8437,7 +8413,7 @@

    示例

    })();
    -

    isSafeInteger source npm

    +

    isSafeInteger source npm

    _.isSafeInteger(value)

    Checks if value is a safe integer. An integer is safe if it's an IEEE-754 @@ -8491,7 +8467,7 @@

    示例

    })();
    -

    isString source npm

    +

    isString source npm

    _.isString(value)

    Checks if value is classified as a String primitive or object.

    @@ -8535,7 +8511,7 @@

    示例

    })();
    -

    isSymbol source npm

    +

    isSymbol source npm

    _.isSymbol(value)

    Checks if value is classified as a Symbol primitive or object.

    @@ -8579,7 +8555,7 @@

    示例

    })();
    -

    isTypedArray source npm

    +

    isTypedArray source npm

    _.isTypedArray(value)

    Checks if value is classified as a typed array.

    @@ -8623,7 +8599,7 @@

    示例

    })();
    -

    isUndefined source npm

    +

    isUndefined source npm

    _.isUndefined(value)

    Checks if value is undefined.

    @@ -8667,7 +8643,7 @@

    示例

    })();
    -

    lt source npm

    +

    lt source npm

    _.lt(value, other)

    Checks if value is less than other.

    @@ -8716,7 +8692,7 @@

    示例

    })();
    -

    lte source npm

    +

    lte source npm

    _.lte(value, other)

    Checks if value is less than or equal to other.

    @@ -8765,7 +8741,7 @@

    示例

    })();
    -

    toArray source npm

    +

    toArray source npm

    _.toArray(value)

    Converts value to an array.

    @@ -8808,7 +8784,7 @@

    示例

    })();
    -

    toInteger source npm

    +

    toInteger source npm

    _.toInteger(value)

    Converts value to an integer. @@ -8861,7 +8837,7 @@

    示例

    })();
    -

    toLength source npm

    +

    toLength source npm

    _.toLength(value)

    Converts value to an integer suitable for use as the length of an @@ -8912,7 +8888,7 @@

    示例

    })();
    -

    toNumber source npm

    +

    toNumber source npm

    _.toNumber(value)

    Converts value to a number.

    @@ -8962,7 +8938,7 @@

    示例

    })();
    -

    toPlainObject source npm

    +

    toPlainObject source npm

    _.toPlainObject(value)

    Converts value to a plain object flattening inherited enumerable @@ -9013,7 +8989,7 @@

    示例

    })();
    -

    toSafeInteger source npm

    +

    toSafeInteger source npm

    _.toSafeInteger(value)

    Converts value to a safe integer. A safe integer can be compared and @@ -9064,7 +9040,7 @@

    示例

    })();
    -

    toString source npm

    +

    toString source npm

    _.toString(value)

    Converts value to a string if it's not one. An empty string is returned @@ -9112,7 +9088,7 @@

    示例

    })();
    -

    add source npm

    +

    add source npm

    _.add(augend, addend)

    Adds two numbers.

    @@ -9155,7 +9131,7 @@

    示例

    })();
    -

    ceil source npm

    +

    ceil source npm

    _.ceil(number, [precision=0])

    Computes number rounded up to precision.

    @@ -9204,7 +9180,7 @@

    示例

    })();
    -

    floor source npm

    +

    floor source npm

    _.floor(number, [precision=0])

    Computes number rounded down to precision.

    @@ -9253,7 +9229,7 @@

    示例

    })();
    -

    max source npm

    +

    max source npm

    _.max(array)

    Computes the maximum value of array. If array is empty or falsey @@ -9298,19 +9274,19 @@

    示例

    })();
    -

    maxBy source npm

    +

    maxBy source npm

    _.maxBy(array, [iteratee=_.identity])

    This method is like _.max except that it accepts iteratee which is invoked for each element in array to generate the criterion by which -the value is ranked. The iteratee is invoked with one argument: (value).

    +the value is ranked. The iteratee 会传入1个参数:(value)。

    参数

    1. array (Array)

      The array to iterate over.

    2. -
    3. [iteratee=_.identity] (Function|Object|string)

      这个函数会调用每一个元素

      +
    4. [iteratee=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

    返回值 (*)

    @@ -9352,7 +9328,7 @@

    示例

    })();
    -

    mean source npm

    +

    mean source npm

    _.mean(array)

    Computes the mean of the values in array.

    @@ -9393,7 +9369,7 @@

    示例

    })();
    -

    min source npm

    +

    min source npm

    _.min(array)

    Computes the minimum value of array. If array is empty or falsey @@ -9438,19 +9414,19 @@

    示例

    })();
    -

    minBy source npm

    +

    minBy source npm

    _.minBy(array, [iteratee=_.identity])

    This method is like _.min except that it accepts iteratee which is invoked for each element in array to generate the criterion by which -the value is ranked. The iteratee is invoked with one argument: (value).

    +the value is ranked. The iteratee 会传入1个参数:(value)。

    参数

    1. array (Array)

      The array to iterate over.

    2. -
    3. [iteratee=_.identity] (Function|Object|string)

      这个函数会调用每一个元素

      +
    4. [iteratee=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

    返回值 (*)

    @@ -9492,7 +9468,7 @@

    示例

    })();
    -

    round source npm

    +

    round source npm

    _.round(number, [precision=0])

    Computes number rounded to precision.

    @@ -9541,7 +9517,7 @@

    示例

    })();
    -

    subtract source npm

    +

    subtract source npm

    _.subtract(minuend, subtrahend)

    Subtract two numbers.

    @@ -9584,7 +9560,7 @@

    示例

    })();
    -

    sum source npm

    +

    sum source npm

    _.sum(array)

    Computes the sum of the values in array.

    @@ -9625,19 +9601,19 @@

    示例

    })();
    -

    sumBy source npm

    +

    sumBy source npm

    _.sumBy(array, [iteratee=_.identity])

    This method is like _.sum except that it accepts iteratee which is invoked for each element in array to generate the value to be summed. -The iteratee is invoked with one argument: (value).

    +The iteratee 会传入1个参数:(value)。

    参数

    1. array (Array)

      The array to iterate over.

    2. -
    3. [iteratee=_.identity] (Function|Object|string)

      这个函数会调用每一个元素

      +
    4. [iteratee=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

    返回值 (number)

    @@ -9740,7 +9716,7 @@

    返回值 (number)

    })();
    -

    clamp source npm

    +

    clamp source npm

    _.clamp(number, [min], max)

    Returns a number whose value is limited to the given range specified @@ -9789,7 +9765,7 @@

    示例

    })();
    -

    inRange source npm

    +

    inRange source npm

    _.inRange(number, [start=0], end)

    Checks if n is between start and up to but not including, end. If @@ -9855,7 +9831,7 @@

    示例

    })();
    -

    random source npm

    +

    random source npm

    _.random([min=0], [max=1], [floating])

    Produces a random number between min and max (inclusive). If only one @@ -9916,7 +9892,7 @@

    示例

    })();
    -

    assign source npm

    +

    assign source npm

    _.assign(object, [sources])

    Assigns own enumerable properties of source objects to the destination @@ -9976,7 +9952,7 @@

    示例

    })();
    -

    assignIn extend source npm

    +

    assignIn extend source npm

    _.assignIn(object, [sources])

    This method is like _.assign except that it iterates over own and @@ -10034,7 +10010,7 @@

    示例

    })();
    -

    assignInWith extendWith source npm

    +

    assignInWith extendWith source npm

    _.assignInWith(object, sources, [customizer])

    This method is like _.assignIn except that it accepts customizer which @@ -10091,7 +10067,7 @@

    示例

    })();
    -

    assignWith source npm

    +

    assignWith source npm

    _.assignWith(object, sources, [customizer])

    This method is like _.assign except that it accepts customizer which @@ -10148,7 +10124,7 @@

    示例

    })();
    -

    at source npm

    +

    at source npm

    _.at(object, [paths])

    Creates an array of values corresponding to paths of object.

    @@ -10196,7 +10172,7 @@

    示例

    })();
    -

    create source npm

    +

    create source npm

    _.create(prototype, [properties])

    Creates an object that inherits from the prototype object. If a properties @@ -10257,7 +10233,7 @@

    示例

    })();
    -

    defaults source npm

    +

    defaults source npm

    _.defaults(object, [sources])

    Assigns own and inherited enumerable properties of source objects to the @@ -10306,7 +10282,7 @@

    示例

    })();
    -

    defaultsDeep source npm

    +

    defaultsDeep source npm

    _.defaultsDeep(object, [sources])

    This method is like _.defaults except that it recursively assigns @@ -10353,7 +10329,7 @@

    示例

    })();
    -

    findKey source npm

    +

    findKey source npm

    _.findKey(object, [predicate=_.identity])

    This method is like _.find except that it returns the key of the first @@ -10364,7 +10340,7 @@

    参数

    1. object (Object)

      The object to search.

    2. -
    3. [predicate=_.identity] (Function|Object|string)

      The function invoked per iteration.

      +
    4. [predicate=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

    返回值 (string|undefined)

    @@ -10378,7 +10354,7 @@

    示例

    }; _.findKey(users, function(o) { return o.age < 40; }); -// => 'barney' (iteration order is not guaranteed) +// => 'barney' (无法保证遍历的顺序) // 使用了 `_.matches` 的回调结果 _.findKey(users, { 'age': 1, 'active': true }); @@ -10415,7 +10391,7 @@

    示例

    })();
    -

    findLastKey source npm

    +

    findLastKey source npm

    _.findLastKey(object, [predicate=_.identity])

    This method is like _.findKey except that it iterates over elements of @@ -10426,7 +10402,7 @@

    参数

    1. object (Object)

      The object to search.

    2. -
    3. [predicate=_.identity] (Function|Object|string)

      The function invoked per iteration.

      +
    4. [predicate=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

    返回值 (string|undefined)

    @@ -10477,7 +10453,7 @@

    示例

    })();
    -

    forIn source npm

    +

    forIn source npm

    _.forIn(object, [iteratee=_.identity])

    Iterates over own and inherited enumerable properties of an object invoking @@ -10490,7 +10466,7 @@

    参数

    1. object (Object)

      The object to iterate over.

    2. -
    3. [iteratee=_.identity] (Function)

      The function invoked per iteration.

      +
    4. [iteratee=_.identity] (Function)

      这个函数会处理每一个元素

    返回值 (Object)

    @@ -10507,7 +10483,7 @@

    示例

    _.forIn(new Foo, function(value, key) { console.log(key); }); -// => logs 'a', 'b', then 'c' (iteration order is not guaranteed) +// => logs 'a', 'b', then 'c' (无法保证遍历的顺序)
    @@ -10532,7 +10508,7 @@

    示例

    })();
    -

    forInRight source npm

    +

    forInRight source npm

    _.forInRight(object, [iteratee=_.identity])

    This method is like _.forIn except that it iterates over properties of @@ -10543,7 +10519,7 @@

    参数

    1. object (Object)

      The object to iterate over.

    2. -
    3. [iteratee=_.identity] (Function)

      The function invoked per iteration.

      +
    4. [iteratee=_.identity] (Function)

      这个函数会处理每一个元素

    返回值 (Object)

    @@ -10585,7 +10561,7 @@

    示例

    })();
    -

    forOwn source npm

    +

    forOwn source npm

    _.forOwn(object, [iteratee=_.identity])

    Iterates over own enumerable properties of an object invoking iteratee @@ -10598,7 +10574,7 @@

    参数

    1. object (Object)

      The object to iterate over.

    2. -
    3. [iteratee=_.identity] (Function)

      The function invoked per iteration.

      +
    4. [iteratee=_.identity] (Function)

      这个函数会处理每一个元素

    返回值 (Object)

    @@ -10615,7 +10591,7 @@

    示例

    _.forOwn(new Foo, function(value, key) { console.log(key); }); -// => logs 'a' then 'b' (iteration order is not guaranteed) +// => logs 'a' then 'b' (无法保证遍历的顺序)
    @@ -10640,7 +10616,7 @@

    示例

    })();
    -

    forOwnRight source npm

    +

    forOwnRight source npm

    _.forOwnRight(object, [iteratee=_.identity])

    This method is like _.forOwn except that it iterates over properties of @@ -10651,7 +10627,7 @@

    参数

    1. object (Object)

      The object to iterate over.

    2. -
    3. [iteratee=_.identity] (Function)

      The function invoked per iteration.

      +
    4. [iteratee=_.identity] (Function)

      这个函数会处理每一个元素

    返回值 (Object)

    @@ -10693,7 +10669,7 @@

    示例

    })();
    -

    functions source npm

    +

    functions source npm

    _.functions(object)

    Creates an array of function property names from own enumerable properties @@ -10742,7 +10718,7 @@

    示例

    })();
    -

    functionsIn source npm

    +

    functionsIn source npm

    _.functionsIn(object)

    Creates an array of function property names from own and inherited @@ -10791,7 +10767,7 @@

    示例

    })();
    -

    get source npm

    +

    get source npm

    _.get(object, path, [defaultValue])

    Gets the value at path of object. If the resolved value is @@ -10845,7 +10821,7 @@

    示例

    })();
    -

    has source npm

    +

    has source npm

    _.has(object, path)

    Checks if path is a direct property of object.

    @@ -10900,7 +10876,7 @@

    示例

    })();
    -

    hasIn source npm

    +

    hasIn source npm

    _.hasIn(object, path)

    Checks if path is a direct or inherited property of object.

    @@ -10954,7 +10930,7 @@

    示例

    })();
    -

    invert source npm

    +

    invert source npm

    _.invert(object, [multiVal])

    Creates an object composed of the inverted keys and values of object. @@ -11005,7 +10981,7 @@

    示例

    })();
    -

    invoke source npm

    +

    invoke source npm

    _.invoke(object, path, [args])

    Invokes the method at path of object.

    @@ -11052,7 +11028,7 @@

    示例

    })();
    -

    keys source npm

    +

    keys source npm

    _.keys(object)

    Creates an array of the own enumerable property names of object. @@ -11080,7 +11056,7 @@

    示例

    Foo.prototype.c = 3; _.keys(new Foo); -// => ['a', 'b'] (iteration order is not guaranteed) +// => ['a', 'b'] (无法保证遍历的顺序) _.keys('hi'); // => ['0', '1'] @@ -11108,7 +11084,7 @@

    示例

    })();
    -

    keysIn source npm

    +

    keysIn source npm

    _.keysIn(object)

    Creates an array of the own and inherited enumerable property names of object. @@ -11134,7 +11110,7 @@

    示例

    Foo.prototype.c = 3; _.keysIn(new Foo); -// => ['a', 'b', 'c'] (iteration order is not guaranteed) +// => ['a', 'b', 'c'] (无法保证遍历的顺序)
    @@ -11159,7 +11135,7 @@

    示例

    })();
    -

    mapKeys source npm

    +

    mapKeys source npm

    _.mapKeys(object, [iteratee=_.identity])

    The opposite of _.mapValues; this method creates an object with the @@ -11171,7 +11147,7 @@

    参数

    1. object (Object)

      The object to iterate over.

    2. -
    3. [iteratee=_.identity] (Function|Object|string)

      The function invoked per iteration.

      +
    4. [iteratee=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

    返回值 (Object)

    @@ -11206,7 +11182,7 @@

    示例

    })();
    -

    mapValues source npm

    +

    mapValues source npm

    _.mapValues(object, [iteratee=_.identity])

    Creates an object with the same keys as object and values generated by @@ -11218,7 +11194,7 @@

    参数

    1. object (Object)

      The object to iterate over.

    2. -
    3. [iteratee=_.identity] (Function|Object|string)

      The function invoked per iteration.

      +
    4. [iteratee=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

    返回值 (Object)

    @@ -11231,11 +11207,11 @@

    示例

    }; _.mapValues(users, function(o) { return o.age; }); -// => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) +// => { 'fred': 40, 'pebbles': 1 } (无法保证遍历的顺序) // 使用了 `_.property` 的回调结果 _.mapValues(users, 'age'); -// => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) +// => { 'fred': 40, 'pebbles': 1 } (无法保证遍历的顺序)
    @@ -11260,7 +11236,7 @@

    示例

    })();
    -

    merge source npm

    +

    merge source npm

    _.merge(object, [sources])

    Recursively merges own and inherited enumerable properties of source @@ -11319,7 +11295,7 @@

    示例

    })();
    -

    mergeWith source npm

    +

    mergeWith source npm

    _.mergeWith(object, sources, customizer)

    This method is like _.merge except that it accepts customizer which @@ -11384,7 +11360,7 @@

    示例

    })();
    -

    omit source npm

    +

    omit source npm

    _.omit(object, [props])

    The opposite of _.pick; this method creates an object composed of the @@ -11430,7 +11406,7 @@

    示例

    })();
    -

    omitBy source npm

    +

    omitBy source npm

    _.omitBy(object, [predicate=_.identity])

    The opposite of _.pickBy; this method creates an object composed of the @@ -11477,7 +11453,7 @@

    示例

    })();
    -

    pick source npm

    +

    pick source npm

    _.pick(object, [props])

    Creates an object composed of the picked object properties.

    @@ -11522,7 +11498,7 @@

    示例

    })();
    -

    pickBy source npm

    +

    pickBy source npm

    _.pickBy(object, [predicate=_.identity])

    Creates an object composed of the object properties predicate returns @@ -11568,7 +11544,7 @@

    示例

    })();
    -

    result source npm

    +

    result source npm

    _.result(object, path, [defaultValue])

    This method is like _.get except that if the resolved value is a function @@ -11626,7 +11602,7 @@

    示例

    })();
    -

    set source npm

    +

    set source npm

    _.set(object, path, value)

    Sets the value at path of object. If a portion of path doesn't exist @@ -11681,7 +11657,7 @@

    示例

    })();
    -

    setWith source npm

    +

    setWith source npm

    _.setWith(object, path, value, [customizer])

    This method is like _.set except that it accepts customizer which is @@ -11731,7 +11707,7 @@

    示例

    })();
    -

    toPairs source npm

    +

    toPairs source npm

    _.toPairs(object)

    Creates an array of own enumerable key-value pairs for object.

    @@ -11754,7 +11730,7 @@

    示例

    Foo.prototype.c = 3; _.toPairs(new Foo); -// => [['a', 1], ['b', 2]] (iteration order is not guaranteed) +// => [['a', 1], ['b', 2]] (无法保证遍历的顺序)
    @@ -11779,7 +11755,7 @@

    示例

    })();
    -

    toPairsIn source npm

    +

    toPairsIn source npm

    _.toPairsIn(object)

    Creates an array of own and inherited enumerable key-value pairs for object.

    @@ -11802,7 +11778,7 @@

    示例

    Foo.prototype.c = 3; _.toPairsIn(new Foo); -// => [['a', 1], ['b', 2], ['c', 1]] (iteration order is not guaranteed) +// => [['a', 1], ['b', 2], ['c', 1]] (无法保证遍历的顺序)
    @@ -11827,7 +11803,7 @@

    示例

    })();
    -

    transform source npm

    +

    transform source npm

    _.transform(object, [iteratee=_.identity], [accumulator])

    An alternative to _.reduce; this method transforms object to a new @@ -11842,7 +11818,7 @@

    参数

    1. object (Array|Object)

      The object to iterate over.

    2. -
    3. [iteratee=_.identity] (Function)

      The function invoked per iteration.

      +
    4. [iteratee=_.identity] (Function)

      这个函数会处理每一个元素

    5. [accumulator] (*)

      The custom accumulator value.

    6. @@ -11885,7 +11861,7 @@

      示例

      })();
    -

    unset source npm

    +

    unset source npm

    _.unset(object, path)

    Removes the property at path of object.

    @@ -11938,7 +11914,7 @@

    示例

    })();
    -

    values source npm

    +

    values source npm

    _.values(object)

    Creates an array of the own enumerable property values of object. @@ -11964,7 +11940,7 @@

    示例

    Foo.prototype.c = 3; _.values(new Foo); -// => [1, 2] (iteration order is not guaranteed) +// => [1, 2] (无法保证遍历的顺序) _.values('hi'); // => ['h', 'i'] @@ -11992,7 +11968,7 @@

    示例

    })();
    -

    valuesIn source npm

    +

    valuesIn source npm

    _.valuesIn(object)

    Creates an array of the own and inherited enumerable property values of object. @@ -12018,7 +11994,7 @@

    示例

    Foo.prototype.c = 3; _.valuesIn(new Foo); -// => [1, 2, 3] (iteration order is not guaranteed) +// => [1, 2, 3] (无法保证遍历的顺序)
    @@ -12213,7 +12189,7 @@

    示例

    })();
    -

    VERSION source

    +

    VERSION source

    _.VERSION

    (string): The semantic version number.

    @@ -12241,7 +12217,7 @@

    示例

    })();
    -

    camelCase source npm

    +

    camelCase source npm

    _.camelCase([string=''])

    Converts string to camel case.

    @@ -12288,7 +12264,7 @@

    示例

    })();
    -

    capitalize source npm

    +

    capitalize source npm

    _.capitalize([string=''])

    Converts the first character of string to upper case and the remaining @@ -12330,7 +12306,7 @@

    示例

    })();
    -

    deburr source npm

    +

    deburr source npm

    _.deburr([string=''])

    Deburrs string by converting latin-1 supplementary letters#Character_table) @@ -12372,7 +12348,7 @@

    示例

    })();
    -

    endsWith source npm

    +

    endsWith source npm

    _.endsWith([string=''], [target], [position=string.length])

    Checks if string ends with the given target string.

    @@ -12423,7 +12399,7 @@

    示例

    })();
    -

    escape source npm

    +

    escape source npm

    _.escape([string=''])

    Converts the characters "&", "<", ">", '"', "'", and "`" in string to @@ -12487,7 +12463,7 @@

    示例

    })();
    -

    escapeRegExp source npm

    +

    escapeRegExp source npm

    _.escapeRegExp([string=''])

    Escapes the RegExp special characters "^", "$", "\", ".", "*", "+", @@ -12529,7 +12505,7 @@

    示例

    })();
    -

    kebabCase source npm

    +

    kebabCase source npm

    _.kebabCase([string=''])

    Converts string to kebab case.

    @@ -12576,7 +12552,7 @@

    示例

    })();
    -

    lowerCase source npm

    +

    lowerCase source npm

    _.lowerCase([string=''])

    Converts string, as space separated words, to lower case.

    @@ -12623,7 +12599,7 @@

    示例

    })();
    -

    lowerFirst source npm

    +

    lowerFirst source npm

    _.lowerFirst([string=''])

    Converts the first character of string to lower case.

    @@ -12667,7 +12643,7 @@

    示例

    })();
    -

    pad source npm

    +

    pad source npm

    _.pad([string=''], [length=0], [chars=' '])

    Pads string on the left and right sides if it's shorter than length. @@ -12719,7 +12695,7 @@

    示例

    })();
    -

    padEnd source npm

    +

    padEnd source npm

    _.padEnd([string=''], [length=0], [chars=' '])

    Pads string on the right side if it's shorter than length. Padding @@ -12771,7 +12747,7 @@

    示例

    })();
    -

    padStart source npm

    +

    padStart source npm

    _.padStart([string=''], [length=0], [chars=' '])

    Pads string on the left side if it's shorter than length. Padding @@ -12823,7 +12799,7 @@

    示例

    })();
    -

    parseInt source npm

    +

    parseInt source npm

    _.parseInt(string, [radix])

    Converts string to an integer of the specified radix. If radix is @@ -12875,7 +12851,7 @@

    示例

    })();
    -

    repeat source npm

    +

    repeat source npm

    _.repeat([string=''], [n=0])

    Repeats the given string n times.

    @@ -12924,7 +12900,7 @@

    示例

    })();
    -

    replace source npm

    +

    replace source npm

    _.replace([string=''], pattern, replacement)

    Replaces matches for pattern in string with replacement. @@ -12972,7 +12948,7 @@

    示例

    })();
    -

    snakeCase source npm

    +

    snakeCase source npm

    _.snakeCase([string=''])

    Converts string to snake case.

    @@ -13019,7 +12995,7 @@

    示例

    })();
    -

    split source npm

    +

    split source npm

    _.split([string=''], separator, [limit])

    Splits string by separator. @@ -13067,7 +13043,7 @@

    示例

    })();
    -

    startCase source npm

    +

    startCase source npm

    _.startCase([string=''])

    Converts string to start case.

    @@ -13114,7 +13090,7 @@

    示例

    })();
    -

    startsWith source npm

    +

    startsWith source npm

    _.startsWith([string=''], [target], [position=0])

    Checks if string starts with the given target string.

    @@ -13165,7 +13141,7 @@

    示例

    })();
    -

    template source npm

    +

    template source npm

    _.template([string=''], [options])

    Creates a compiled template function that can interpolate data properties @@ -13298,7 +13274,7 @@

    示例

    })();
    -

    toLower source npm

    +

    toLower source npm

    _.toLower([string=''])

    Converts string, as a whole, to lower case.

    @@ -13345,7 +13321,7 @@

    示例

    })();
    -

    toUpper source npm

    +

    toUpper source npm

    _.toUpper([string=''])

    Converts string, as a whole, to upper case.

    @@ -13392,7 +13368,7 @@

    示例

    })();
    -

    trim source npm

    +

    trim source npm

    _.trim([string=''], [chars=whitespace])

    Removes leading and trailing whitespace or specified characters from string.

    @@ -13441,7 +13417,7 @@

    示例

    })();
    -

    trimEnd source npm

    +

    trimEnd source npm

    _.trimEnd([string=''], [chars=whitespace])

    Removes trailing whitespace or specified characters from string.

    @@ -13487,7 +13463,7 @@

    示例

    })();
    -

    trimStart source npm

    +

    trimStart source npm

    _.trimStart([string=''], [chars=whitespace])

    Removes leading whitespace or specified characters from string.

    @@ -13533,7 +13509,7 @@

    示例

    })();
    -

    truncate source npm

    +

    truncate source npm

    _.truncate([string=''], [options])

    Truncates string if it's longer than the given maximum string length. @@ -13601,7 +13577,7 @@

    示例

    })();
    -

    unescape source npm

    +

    unescape source npm

    _.unescape([string=''])

    The inverse of _.escape; this method converts the HTML entities @@ -13648,7 +13624,7 @@

    示例

    })();
    -

    upperCase source npm

    +

    upperCase source npm

    _.upperCase([string=''])

    Converts string, as space separated words, to upper case.

    @@ -13695,7 +13671,7 @@

    示例

    })();
    -

    upperFirst source npm

    +

    upperFirst source npm

    _.upperFirst([string=''])

    Converts the first character of string to upper case.

    @@ -13739,7 +13715,7 @@

    示例

    })();
    -

    words source npm

    +

    words source npm

    _.words([string=''], [pattern])

    Splits string into an array of its words.

    @@ -13785,7 +13761,7 @@

    示例

    })();
    -

    attempt source npm

    +

    attempt source npm

    _.attempt(func)

    Attempts to invoke func, returning either the result or the caught error @@ -13833,7 +13809,7 @@

    示例

    })();
    -

    bindAll source npm

    +

    bindAll source npm

    _.bindAll(object, methodNames)

    Binds methods of an object to the object itself, overwriting the existing @@ -13888,7 +13864,7 @@

    示例

    })();
    -

    cond source npm

    +

    cond source npm

    _.cond(pairs)

    Creates a function that iterates over pairs invoking the corresponding @@ -13944,7 +13920,7 @@

    示例

    })();
    -

    conforms source npm

    +

    conforms source npm

    _.conforms(source)

    Creates a function that invokes the predicate properties of source with @@ -13992,7 +13968,7 @@

    示例

    })();
    -

    constant source npm

    +

    constant source npm

    _.constant(value)

    Creates a function that returns value.

    @@ -14036,7 +14012,7 @@

    示例

    })();
    -

    flow source npm

    +

    flow source npm

    _.flow([funcs])

    Creates a function that returns the result of invoking the provided @@ -14084,7 +14060,7 @@

    示例

    })();
    -

    flowRight source npm

    +

    flowRight source npm

    _.flowRight([funcs])

    This method is like _.flow except that it creates a function that @@ -14131,7 +14107,7 @@

    示例

    })();
    -

    identity source npm

    +

    identity source npm

    _.identity(value)

    This method returns the first argument provided to it.

    @@ -14174,7 +14150,7 @@

    示例

    })();
    -

    iteratee source npm

    +

    iteratee source npm

    _.iteratee([func=_.identity])

    Creates a function that invokes func with the arguments of the created @@ -14236,7 +14212,7 @@

    示例

    })();
    -

    matches source npm

    +

    matches source npm

    _.matches(source)

    Creates a function that performs a deep partial comparison between a given @@ -14287,7 +14263,7 @@

    示例

    })();
    -

    matchesProperty source npm

    +

    matchesProperty source npm

    _.matchesProperty(path, srcValue)

    Creates a function that performs a deep partial comparison between the @@ -14340,7 +14316,7 @@

    示例

    })();
    -

    method source npm

    +

    method source npm

    _.method(path, [args])

    Creates a function that invokes the method at path of a given object. @@ -14392,7 +14368,7 @@

    示例

    })();
    -

    methodOf source npm

    +

    methodOf source npm

    _.methodOf(object, [args])

    The opposite of _.method; this method creates a function that invokes @@ -14443,7 +14419,7 @@

    示例

    })();
    -

    mixin source npm

    +

    mixin source npm

    _.mixin([object=lodash], source, [options])

    Adds all own enumerable function properties of a source object to the @@ -14510,7 +14486,7 @@

    示例

    })();
    -

    noConflict source npm

    +

    noConflict source npm

    _.noConflict()

    Reverts the _ variable to its previous value and returns a reference to @@ -14546,7 +14522,7 @@

    示例

    })();
    -

    noop source npm

    +

    noop source npm

    _.noop()

    A no-operation function that returns undefined regardless of the @@ -14582,7 +14558,7 @@

    示例

    })();
    -

    nthArg source npm

    +

    nthArg source npm

    _.nthArg([n=0])

    Creates a function that returns its nth argument.

    @@ -14625,7 +14601,7 @@

    示例

    })();
    -

    over source npm

    +

    over source npm

    _.over(iteratees)

    Creates a function that invokes iteratees with the arguments provided @@ -14669,7 +14645,7 @@

    示例

    })();
    -

    overEvery source npm

    +

    overEvery source npm

    _.overEvery(predicates)

    Creates a function that checks if all of the predicates return @@ -14719,7 +14695,7 @@

    示例

    })();
    -

    overSome source npm

    +

    overSome source npm

    _.overSome(predicates)

    Creates a function that checks if any of the predicates return @@ -14769,7 +14745,7 @@

    示例

    })();
    -

    property source npm

    +

    property source npm

    _.property(path)

    Creates a function that returns the value at path of a given object.

    @@ -14818,7 +14794,7 @@

    示例

    })();
    -

    propertyOf source npm

    +

    propertyOf source npm

    _.propertyOf(object)

    The opposite of _.property; this method creates a function that returns @@ -14866,7 +14842,7 @@

    示例

    })();
    -

    range source npm

    +

    range source npm

    _.range([start=0], end, [step=1])

    Creates an array of numbers (positive and/or negative) progressing from @@ -14937,7 +14913,7 @@

    示例

    })();
    -

    rangeRight source npm

    +

    rangeRight source npm

    _.rangeRight([start=0], end, [step=1])

    This method is like _.range except that it populates values in @@ -15064,7 +15040,7 @@

    示例

    })();
    -

    times source npm

    +

    times source npm

    _.times(n, [iteratee=_.identity])

    Invokes the iteratee function n times, returning an array of the results @@ -15075,7 +15051,7 @@

    参数

    1. n (number)

      The number of times to invoke iteratee.

    2. -
    3. [iteratee=_.identity] (Function)

      The function invoked per iteration.

      +
    4. [iteratee=_.identity] (Function)

      这个函数会处理每一个元素

    返回值 (Array)

    @@ -15111,7 +15087,7 @@

    示例

    })();
    -

    toPath source npm

    +

    toPath source npm

    _.toPath(value)

    Converts value to a property path array.

    @@ -15164,7 +15140,7 @@

    示例

    })();
    -

    uniqueId source npm

    +

    uniqueId source npm

    _.uniqueId([prefix])

    Generates a unique ID. If prefix is provided the ID is appended to it.

    diff --git a/ary.html b/ary.html index 7be6bd8..e2ebb56 100644 --- a/ary.html +++ b/ary.html @@ -392,7 +392,7 @@
    -

    ary source npm

    +

    ary source npm

    _.ary(func, [n=func.length])

    Creates a function that accepts up to n arguments, ignoring any diff --git a/assign.html b/assign.html index b2a52f5..67d9440 100644 --- a/assign.html +++ b/assign.html @@ -392,7 +392,7 @@

    -

    assign source npm

    +

    assign source npm

    _.assign(object, [sources])

    Assigns own enumerable properties of source objects to the destination diff --git a/assignIn.html b/assignIn.html index 6b6f5dd..db63d72 100644 --- a/assignIn.html +++ b/assignIn.html @@ -392,7 +392,7 @@

    -

    assignIn extend source npm

    +

    assignIn extend source npm

    _.assignIn(object, [sources])

    This method is like _.assign except that it iterates over own and diff --git a/assignInWith.html b/assignInWith.html index bca3eef..1a90f88 100644 --- a/assignInWith.html +++ b/assignInWith.html @@ -392,7 +392,7 @@

    -

    assignInWith extendWith source npm

    +

    assignInWith extendWith source npm

    _.assignInWith(object, sources, [customizer])

    This method is like _.assignIn except that it accepts customizer which diff --git a/assignWith.html b/assignWith.html index 4dce9ef..ce04b68 100644 --- a/assignWith.html +++ b/assignWith.html @@ -392,7 +392,7 @@

    -

    assignWith source npm

    +

    assignWith source npm

    _.assignWith(object, sources, [customizer])

    This method is like _.assign except that it accepts customizer which diff --git a/at.html b/at.html index fde0b49..073fa74 100644 --- a/at.html +++ b/at.html @@ -392,7 +392,7 @@

    -

    at source npm

    +

    at source npm

    _.at(object, [paths])

    Creates an array of values corresponding to paths of object.

    diff --git a/attempt.html b/attempt.html index 5e4a58a..2f45549 100644 --- a/attempt.html +++ b/attempt.html @@ -392,7 +392,7 @@
    -

    attempt source npm

    +

    attempt source npm

    _.attempt(func)

    Attempts to invoke func, returning either the result or the caught error diff --git a/before.html b/before.html index 0446177..5910dd4 100644 --- a/before.html +++ b/before.html @@ -392,7 +392,7 @@

    -

    before source npm

    +

    before source npm

    _.before(n, func)

    Creates a function that invokes func, with the this binding and arguments diff --git a/bind.html b/bind.html index 8f3b434..97725d3 100644 --- a/bind.html +++ b/bind.html @@ -392,7 +392,7 @@

    -

    bind source npm

    +

    bind source npm

    _.bind(func, thisArg, [partials])

    Creates a function that invokes func with the this binding of thisArg diff --git a/bindAll.html b/bindAll.html index 87a7307..7179481 100644 --- a/bindAll.html +++ b/bindAll.html @@ -392,7 +392,7 @@

    -

    bindAll source npm

    +

    bindAll source npm

    _.bindAll(object, methodNames)

    Binds methods of an object to the object itself, overwriting the existing diff --git a/bindKey.html b/bindKey.html index 29fffdd..dbd611d 100644 --- a/bindKey.html +++ b/bindKey.html @@ -392,7 +392,7 @@

    -

    bindKey source npm

    +

    bindKey source npm

    _.bindKey(object, key, [partials])

    Creates a function that invokes the method at object[key] and prepends diff --git a/camelCase.html b/camelCase.html index ef0f575..1d7132d 100644 --- a/camelCase.html +++ b/camelCase.html @@ -392,7 +392,7 @@

    -

    camelCase source npm

    +

    camelCase source npm

    _.camelCase([string=''])

    Converts string to camel case.

    diff --git a/capitalize.html b/capitalize.html index 013966f..3fb2a04 100644 --- a/capitalize.html +++ b/capitalize.html @@ -392,7 +392,7 @@
    -

    capitalize source npm

    +

    capitalize source npm

    _.capitalize([string=''])

    Converts the first character of string to upper case and the remaining diff --git a/ceil.html b/ceil.html index 263b979..7dc4f75 100644 --- a/ceil.html +++ b/ceil.html @@ -392,7 +392,7 @@

    -

    ceil source npm

    +

    ceil source npm

    _.ceil(number, [precision=0])

    Computes number rounded up to precision.

    diff --git a/clamp.html b/clamp.html index fbf32a5..0026976 100644 --- a/clamp.html +++ b/clamp.html @@ -392,7 +392,7 @@
    -

    clamp source npm

    +

    clamp source npm

    _.clamp(number, [min], max)

    Returns a number whose value is limited to the given range specified diff --git a/clone.html b/clone.html index 78318f7..33e8bd4 100644 --- a/clone.html +++ b/clone.html @@ -392,7 +392,7 @@

    -

    clone source npm

    +

    clone source npm

    _.clone(value)

    Creates a shallow clone of value. diff --git a/cloneDeep.html b/cloneDeep.html index 0aac883..3e7ca71 100644 --- a/cloneDeep.html +++ b/cloneDeep.html @@ -392,7 +392,7 @@

    -

    cloneDeep source npm

    +

    cloneDeep source npm

    _.cloneDeep(value)

    This method is like _.clone except that it recursively clones value.

    diff --git a/cloneDeepWith.html b/cloneDeepWith.html index 46e0733..ac51dbe 100644 --- a/cloneDeepWith.html +++ b/cloneDeepWith.html @@ -392,7 +392,7 @@
    -

    cloneDeepWith source npm

    +

    cloneDeepWith source npm

    _.cloneDeepWith(value, [customizer])

    This method is like _.cloneWith except that it recursively clones value.

    diff --git a/cloneWith.html b/cloneWith.html index ba68a6b..cc930da 100644 --- a/cloneWith.html +++ b/cloneWith.html @@ -392,7 +392,7 @@
    -

    cloneWith source npm

    +

    cloneWith source npm

    _.cloneWith(value, [customizer])

    This method is like _.clone except that it accepts customizer which diff --git a/cond.html b/cond.html index b19a0a1..4347637 100644 --- a/cond.html +++ b/cond.html @@ -392,7 +392,7 @@

    -

    cond source npm

    +

    cond source npm

    _.cond(pairs)

    Creates a function that iterates over pairs invoking the corresponding diff --git a/conforms.html b/conforms.html index 21a8f12..2111922 100644 --- a/conforms.html +++ b/conforms.html @@ -392,7 +392,7 @@

    -

    conforms source npm

    +

    conforms source npm

    _.conforms(source)

    Creates a function that invokes the predicate properties of source with diff --git a/constant.html b/constant.html index a0741dc..964c5ea 100644 --- a/constant.html +++ b/constant.html @@ -392,7 +392,7 @@

    -

    constant source npm

    +

    constant source npm

    _.constant(value)

    Creates a function that returns value.

    diff --git a/countBy.html b/countBy.html index db2bf10..e4b66b5 100644 --- a/countBy.html +++ b/countBy.html @@ -392,24 +392,21 @@
    -

    countBy source npm

    +

    countBy source npm

    _.countBy(collection, [iteratee=_.identity])
    -

    Creates an object composed of keys generated from the results of running -each element of collection through iteratee. The corresponding value -of each key is the number of times the key was returned by iteratee. -The iteratee is invoked with one argument: (value).

    +

    创建一个组成对象,key是经过 iteratee 处理的集合的结果,value 是处理结果的次数。 iteratee 会传入一个参数:(value)。

    参数

      -
    1. collection (Array|Object)

      The collection to iterate over.

      +
    2. collection (Array|Object)

      需要遍历的集合

    3. -
    4. [iteratee=_.identity] (Function|Object|string)

      这个函数会调用每一个元素

      +
    5. [iteratee=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

    返回值 (Object)

    -

    Returns the composed aggregate object.

    +

    返回一个组成汇总的对象

    示例

    _.countBy([6.1, 4.2, 6.3], Math.floor);
    diff --git a/create.html b/create.html
    index d76d5f3..1cd9749 100644
    --- a/create.html
    +++ b/create.html
    @@ -392,7 +392,7 @@
     
     
    -

    create source npm

    +

    create source npm

    _.create(prototype, [properties])

    Creates an object that inherits from the prototype object. If a properties diff --git a/css/doc.css b/css/doc.css index 283cddc..fbb5fd3 100644 --- a/css/doc.css +++ b/css/doc.css @@ -49,7 +49,7 @@ header a.build { float:right; font-size:8px; color:#aaa; margin:1px; line-height #toc ul { list-style:none; padding:0; margin:0; } span.aliases { font-size:0.7em; color:#999; font-style:italic; } -#content span.aliases:before { content:" (alias: "; } +#content span.aliases:before { content:" (别名: "; } #content span.aliases:after { content:")"; } #tochead a { margin:10px 0 0 0; } diff --git a/curry.html b/curry.html index 296ba1b..0c97c8d 100644 --- a/curry.html +++ b/curry.html @@ -392,7 +392,7 @@

    -

    curry source npm

    +

    curry source npm

    _.curry(func, [arity=func.length])

    Creates a function that accepts arguments of func and either invokes diff --git a/curryRight.html b/curryRight.html index 56501d1..36c00d3 100644 --- a/curryRight.html +++ b/curryRight.html @@ -392,7 +392,7 @@

    -

    curryRight source npm

    +

    curryRight source npm

    _.curryRight(func, [arity=func.length])

    This method is like _.curry except that arguments are applied to func diff --git a/debounce.html b/debounce.html index a6e65fe..d458ceb 100644 --- a/debounce.html +++ b/debounce.html @@ -392,7 +392,7 @@

    -

    debounce source npm

    +

    debounce source npm

    _.debounce(func, [wait=0], [options])

    Creates a debounced function that delays invoking func until after wait diff --git a/deburr.html b/deburr.html index 7312cca..bd0732c 100644 --- a/deburr.html +++ b/deburr.html @@ -392,7 +392,7 @@

    -

    deburr source npm

    +

    deburr source npm

    _.deburr([string=''])

    Deburrs string by converting latin-1 supplementary letters#Character_table) diff --git a/defaults.html b/defaults.html index 02777ec..03101d5 100644 --- a/defaults.html +++ b/defaults.html @@ -392,7 +392,7 @@

    -

    defaults source npm

    +

    defaults source npm

    _.defaults(object, [sources])

    Assigns own and inherited enumerable properties of source objects to the diff --git a/defaultsDeep.html b/defaultsDeep.html index 125740e..fec644e 100644 --- a/defaultsDeep.html +++ b/defaultsDeep.html @@ -392,7 +392,7 @@

    -

    defaultsDeep source npm

    +

    defaultsDeep source npm

    _.defaultsDeep(object, [sources])

    This method is like _.defaults except that it recursively assigns diff --git a/defer.html b/defer.html index a49360c..79f44af 100644 --- a/defer.html +++ b/defer.html @@ -392,7 +392,7 @@

    -

    defer source npm

    +

    defer source npm

    _.defer(func, [args])

    Defers invoking the func until the current call stack has cleared. Any diff --git a/delay.html b/delay.html index caf62ed..a91f9a1 100644 --- a/delay.html +++ b/delay.html @@ -392,7 +392,7 @@

    -

    delay source npm

    +

    delay source npm

    _.delay(func, wait, [args])

    Invokes func after wait milliseconds. Any additional arguments are diff --git a/differenceBy.html b/differenceBy.html index 43c0337..7a55fb0 100644 --- a/differenceBy.html +++ b/differenceBy.html @@ -404,7 +404,7 @@

    参数

  • [values] (...Array)

    用于对比差异的数组

  • -
  • [iteratee=_.identity] (Function|Object|string)

    这个函数会调用每一个元素

    +
  • [iteratee=_.identity] (Function|Object|string)

    这个函数会处理每一个元素

  • 返回值 (Array)

    diff --git a/differenceWith.html b/differenceWith.html index 947430b..587f0e0 100644 --- a/differenceWith.html +++ b/differenceWith.html @@ -404,7 +404,7 @@

    参数

  • [values] (...Array)

    用于对比差异的数组

  • -
  • [comparator] (Function)

    这个函数会调用每一个元素

    +
  • [comparator] (Function)

    这个函数会处理每一个元素

  • 返回值 (Array)

    diff --git a/endsWith.html b/endsWith.html index aa2a750..8f484c5 100644 --- a/endsWith.html +++ b/endsWith.html @@ -392,7 +392,7 @@
    -

    endsWith source npm

    +

    endsWith source npm

    _.endsWith([string=''], [target], [position=string.length])

    Checks if string ends with the given target string.

    diff --git a/eq.html b/eq.html index 74931bc..bd1779f 100644 --- a/eq.html +++ b/eq.html @@ -392,7 +392,7 @@
    -

    eq source npm

    +

    eq source npm

    _.eq(value, other)

    Performs a SameValueZero diff --git a/escape.html b/escape.html index 41b24e8..ae36136 100644 --- a/escape.html +++ b/escape.html @@ -392,7 +392,7 @@

    -

    escape source npm

    +

    escape source npm

    _.escape([string=''])

    Converts the characters "&", "<", ">", '"', "'", and "`" in string to diff --git a/escapeRegExp.html b/escapeRegExp.html index 6cc28c5..83fee6d 100644 --- a/escapeRegExp.html +++ b/escapeRegExp.html @@ -392,7 +392,7 @@

    -

    escapeRegExp source npm

    +

    escapeRegExp source npm

    _.escapeRegExp([string=''])

    Escapes the RegExp special characters "^", "$", "\", ".", "*", "+", diff --git a/every.html b/every.html index e1347ab..0bda631 100644 --- a/every.html +++ b/every.html @@ -392,23 +392,21 @@

    -

    every source npm

    +

    every source npm

    _.every(collection, [predicate=_.identity])
    -

    Checks if predicate returns truthy for all elements of collection. -Iteration is stopped once predicate returns falsey. The predicate is -invoked with three arguments: (value, index|key, collection).

    +

    通过 predicate 检查集合中的元素是否都返回 真值,只要 predicate 返回一次假值,遍历就停止,并返回 false。
    predicate 会传入3个参数:(value, index|key, collection)

    参数

      -
    1. collection (Array|Object)

      The collection to iterate over.

      +
    2. collection (Array|Object)

      需要遍历的集合

    3. -
    4. [predicate=_.identity] (Function|Object|string)

      The function invoked per iteration.

      +
    5. [predicate=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

    返回值 (boolean)

    -

    Returns true if all elements pass the predicate check, else false.

    +

    返回 true,如果所有元素经 predicate 检查都为真值,否则返回 false。

    示例

    _.every([true, 1, null, 'yes'], Boolean);
    diff --git a/filter.html b/filter.html
    index a51a19e..87e3558 100644
    --- a/filter.html
    +++ b/filter.html
    @@ -392,23 +392,21 @@
     
     
    -

    filter source npm

    +

    filter source npm

    _.filter(collection, [predicate=_.identity])
    -

    Iterates over elements of collection, returning an array of all elements -predicate returns truthy for. The predicate is invoked with three arguments:
    -(value, index|key, collection).

    +

    遍历集合中的元素,筛选出一个经过 predicate 检查结果为真值的数组,predicate 会传入3个参数:(value, index|key, collection)。

    参数

      -
    1. collection (Array|Object)

      The collection to iterate over.

      +
    2. collection (Array|Object)

      需要遍历的集合

    3. -
    4. [predicate=_.identity] (Function|Object|string)

      The function invoked per iteration.

      +
    5. [predicate=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

    返回值 (Array)

    -

    Returns the new filtered array.

    +

    返回筛选结果的新数组

    示例

    var resolve = _.partial(_.map, _, 'user');
    diff --git a/find.html b/find.html
    index eccc256..1cd4f52 100644
    --- a/find.html
    +++ b/find.html
    @@ -392,23 +392,21 @@
     
     
    -

    find source npm

    +

    find source npm

    _.find(collection, [predicate=_.identity])
    -

    Iterates over elements of collection, returning the first element -predicate returns truthy for. The predicate is invoked with three arguments:
    -(value, index|key, collection).

    +

    遍历集合中的元素,返回最先经 predicate 检查为真值的元素。 predicate 会传入3个元素:(value, index|key, collection)。

    参数

      -
    1. collection (Array|Object)

      The collection to search.

      +
    2. collection (Array|Object)

      要检索的集合

    3. -
    4. [predicate=_.identity] (Function|Object|string)

      The function invoked per iteration.

      +
    5. [predicate=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

    返回值 (*)

    -

    Returns the matched element, else undefined.

    +

    返回匹配元素,否则返回 undefined

    示例

    var resolve = _.partial(_.result, _, 'user');
    diff --git a/findKey.html b/findKey.html
    index 56f281c..84c08e6 100644
    --- a/findKey.html
    +++ b/findKey.html
    @@ -392,7 +392,7 @@
     
     
    -

    findKey source npm

    +

    findKey source npm

    _.findKey(object, [predicate=_.identity])

    This method is like _.find except that it returns the key of the first @@ -403,7 +403,7 @@

    参数

    1. object (Object)

      The object to search.

    2. -
    3. [predicate=_.identity] (Function|Object|string)

      The function invoked per iteration.

      +
    4. [predicate=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

    返回值 (string|undefined)

    @@ -417,7 +417,7 @@

    示例

    }; _.findKey(users, function(o) { return o.age < 40; }); -// => 'barney' (iteration order is not guaranteed) +// => 'barney' (无法保证遍历的顺序) // 使用了 `_.matches` 的回调结果 _.findKey(users, { 'age': 1, 'active': true }); diff --git a/findLast.html b/findLast.html index e10e982..141cd7d 100644 --- a/findLast.html +++ b/findLast.html @@ -392,22 +392,21 @@
    -

    findLast source npm

    +

    findLast source npm

    _.findLast(collection, [predicate=_.identity])
    -

    This method is like _.find except that it iterates over elements of -collection from right to left.

    +

    这个方法类似 _.find,除了它是从右至左遍历集合的。

    参数

      -
    1. collection (Array|Object)

      The collection to search.

      +
    2. collection (Array|Object)

      要检索的集合

    3. -
    4. [predicate=_.identity] (Function|Object|string)

      The function invoked per iteration.

      +
    5. [predicate=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

    返回值 (*)

    -

    Returns the matched element, else undefined.

    +

    返回匹配元素,否则返回 undefined

    示例

    _.findLast([1, 2, 3, 4], function(n) {
    diff --git a/findLastKey.html b/findLastKey.html
    index 5e052a1..c4ebb19 100644
    --- a/findLastKey.html
    +++ b/findLastKey.html
    @@ -392,7 +392,7 @@
     
     
    -

    findLastKey source npm

    +

    findLastKey source npm

    _.findLastKey(object, [predicate=_.identity])

    This method is like _.findKey except that it iterates over elements of @@ -403,7 +403,7 @@

    参数

    1. object (Object)

      The object to search.

    2. -
    3. [predicate=_.identity] (Function|Object|string)

      The function invoked per iteration.

      +
    4. [predicate=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

    返回值 (string|undefined)

    diff --git a/flip.html b/flip.html index 52e2fb4..12b30d9 100644 --- a/flip.html +++ b/flip.html @@ -392,7 +392,7 @@
    -

    flip source npm

    +

    flip source npm

    _.flip(func)

    Creates a function that invokes func with arguments reversed.

    diff --git a/floor.html b/floor.html index a06257d..b35128d 100644 --- a/floor.html +++ b/floor.html @@ -392,7 +392,7 @@
    -

    floor source npm

    +

    floor source npm

    _.floor(number, [precision=0])

    Computes number rounded down to precision.

    diff --git a/flow.html b/flow.html index ee79283..d11af73 100644 --- a/flow.html +++ b/flow.html @@ -392,7 +392,7 @@
    -

    flow source npm

    +

    flow source npm

    _.flow([funcs])

    Creates a function that returns the result of invoking the provided diff --git a/flowRight.html b/flowRight.html index bdeac32..7e03866 100644 --- a/flowRight.html +++ b/flowRight.html @@ -392,7 +392,7 @@

    -

    flowRight source npm

    +

    flowRight source npm

    _.flowRight([funcs])

    This method is like _.flow except that it creates a function that diff --git a/forEach.html b/forEach.html index 47dc4cb..a61adde 100644 --- a/forEach.html +++ b/forEach.html @@ -392,39 +392,36 @@

    -

    forEach each source npm

    +

    forEach each source npm

    _.forEach(collection, [iteratee=_.identity])
    -

    Iterates over elements of collection invoking iteratee for each element. -The iteratee is invoked with three arguments: (value, index|key, collection). -Iteratee functions may exit iteration early by explicitly returning false. +

    调用 iteratee 遍历集合中的元素,iteratee 会传入3个参数:(value, index|key, collection)。 +如果显式的返回 false ,iteratee 会提前退出。

    -注意: As with other "Collections" methods, objects with a "length" property -are iterated like arrays. To avoid this behavior use _.forIn or _.forOwn -for object iteration.

    +注意: 与其他集合方法一样,对象的 length 属性也会被遍历,避免这种情况,可以用 _.forIn 或者 _.forOwn 代替。

    参数

      -
    1. collection (Array|Object)

      The collection to iterate over.

      +
    2. collection (Array|Object)

      需要遍历的集合

    3. -
    4. [iteratee=_.identity] (Function)

      The function invoked per iteration.

      +
    5. [iteratee=_.identity] (Function)

      这个函数会处理每一个元素

    返回值 (Array|Object)

    -

    Returns collection.

    +

    返回集合

    示例

    _([1, 2]).forEach(function(value) {
       console.log(value);
     });
    -// => logs `1` then `2`
    +// => 输出 `1` 和 `2`
     
     _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
       console.log(key);
     });
    -// => logs 'a' then 'b' (iteration order is not guaranteed)
    +// => 输出 'a' 和 'b' (不保证遍历的顺序)
     
    diff --git a/forEachRight.html b/forEachRight.html index 11748dd..6f926b5 100644 --- a/forEachRight.html +++ b/forEachRight.html @@ -392,28 +392,27 @@
    -

    forEachRight eachRight source npm

    +

    forEachRight eachRight source npm

    _.forEachRight(collection, [iteratee=_.identity])
    -

    This method is like _.forEach except that it iterates over elements of -collection from right to left.

    +

    这个方法类似 _.forEach,除了它是从右到左遍历的集合中的元素的。

    参数

      -
    1. collection (Array|Object)

      The collection to iterate over.

      +
    2. collection (Array|Object)

      需要遍历的集合

    3. -
    4. [iteratee=_.identity] (Function)

      The function invoked per iteration.

      +
    5. [iteratee=_.identity] (Function)

      这个函数会处理每一个元素

    返回值 (Array|Object)

    -

    Returns collection.

    +

    返回集合

    示例

    _.forEachRight([1, 2], function(value) {
       console.log(value);
     });
    -// => logs `2` then `1`
    +// => 输出 `2` 和 `1`
     
    diff --git a/forIn.html b/forIn.html index 6ca7621..c52525f 100644 --- a/forIn.html +++ b/forIn.html @@ -392,7 +392,7 @@
    -

    forIn source npm

    +

    forIn source npm

    _.forIn(object, [iteratee=_.identity])

    Iterates over own and inherited enumerable properties of an object invoking @@ -405,7 +405,7 @@

    参数

    1. object (Object)

      The object to iterate over.

    2. -
    3. [iteratee=_.identity] (Function)

      The function invoked per iteration.

      +
    4. [iteratee=_.identity] (Function)

      这个函数会处理每一个元素

    返回值 (Object)

    @@ -422,7 +422,7 @@

    示例

    _.forIn(new Foo, function(value, key) { console.log(key); }); -// => logs 'a', 'b', then 'c' (iteration order is not guaranteed) +// => logs 'a', 'b', then 'c' (无法保证遍历的顺序)
    diff --git a/forInRight.html b/forInRight.html index a01f8ad..420695d 100644 --- a/forInRight.html +++ b/forInRight.html @@ -392,7 +392,7 @@
    -

    forInRight source npm

    +

    forInRight source npm

    _.forInRight(object, [iteratee=_.identity])

    This method is like _.forIn except that it iterates over properties of @@ -403,7 +403,7 @@

    参数

    1. object (Object)

      The object to iterate over.

    2. -
    3. [iteratee=_.identity] (Function)

      The function invoked per iteration.

      +
    4. [iteratee=_.identity] (Function)

      这个函数会处理每一个元素

    返回值 (Object)

    diff --git a/forOwn.html b/forOwn.html index 4d90723..1bc29d8 100644 --- a/forOwn.html +++ b/forOwn.html @@ -392,7 +392,7 @@
    -

    forOwn source npm

    +

    forOwn source npm

    _.forOwn(object, [iteratee=_.identity])

    Iterates over own enumerable properties of an object invoking iteratee @@ -405,7 +405,7 @@

    参数

    1. object (Object)

      The object to iterate over.

    2. -
    3. [iteratee=_.identity] (Function)

      The function invoked per iteration.

      +
    4. [iteratee=_.identity] (Function)

      这个函数会处理每一个元素

    返回值 (Object)

    @@ -422,7 +422,7 @@

    示例

    _.forOwn(new Foo, function(value, key) { console.log(key); }); -// => logs 'a' then 'b' (iteration order is not guaranteed) +// => logs 'a' then 'b' (无法保证遍历的顺序)
    diff --git a/forOwnRight.html b/forOwnRight.html index 23eb288..33bd75c 100644 --- a/forOwnRight.html +++ b/forOwnRight.html @@ -392,7 +392,7 @@
    -

    forOwnRight source npm

    +

    forOwnRight source npm

    _.forOwnRight(object, [iteratee=_.identity])

    This method is like _.forOwn except that it iterates over properties of @@ -403,7 +403,7 @@

    参数

    1. object (Object)

      The object to iterate over.

    2. -
    3. [iteratee=_.identity] (Function)

      The function invoked per iteration.

      +
    4. [iteratee=_.identity] (Function)

      这个函数会处理每一个元素

    返回值 (Object)

    diff --git a/functions.html b/functions.html index b676f38..8848dd3 100644 --- a/functions.html +++ b/functions.html @@ -392,7 +392,7 @@
    -

    functions source npm

    +

    functions source npm

    _.functions(object)

    Creates an array of function property names from own enumerable properties diff --git a/functionsIn.html b/functionsIn.html index 794fc2a..aa00961 100644 --- a/functionsIn.html +++ b/functionsIn.html @@ -392,7 +392,7 @@

    -

    functionsIn source npm

    +

    functionsIn source npm

    _.functionsIn(object)

    Creates an array of function property names from own and inherited diff --git a/get.html b/get.html index 527591b..8361d64 100644 --- a/get.html +++ b/get.html @@ -392,7 +392,7 @@

    -

    get source npm

    +

    get source npm

    _.get(object, path, [defaultValue])

    Gets the value at path of object. If the resolved value is diff --git a/groupBy.html b/groupBy.html index e337648..98ca52c 100644 --- a/groupBy.html +++ b/groupBy.html @@ -392,24 +392,21 @@

    -

    groupBy source npm

    +

    groupBy source npm

    _.groupBy(collection, [iteratee=_.identity])
    -

    Creates an object composed of keys generated from the results of running -each element of collection through iteratee. The corresponding value -of each key is an array of the elements responsible for generating the key. -The iteratee is invoked with one argument: (value).

    +

    创建一个对象组成,key 是经 iteratee 处理的结果, value 是产生 key 的元素数组。 iteratee 会传入1个参数:(value)。

    参数

      -
    1. collection (Array|Object)

      The collection to iterate over.

      +
    2. collection (Array|Object)

      需要遍历的集合

    3. -
    4. [iteratee=_.identity] (Function|Object|string)

      这个函数会调用每一个元素

      +
    5. [iteratee=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

    返回值 (Object)

    -

    Returns the composed aggregate object.

    +

    返回一个组成汇总的对象

    示例

    _.groupBy([6.1, 4.2, 6.3], Math.floor);
    diff --git a/gt.html b/gt.html
    index 0f6051b..db8a046 100644
    --- a/gt.html
    +++ b/gt.html
    @@ -392,7 +392,7 @@
     
     
    -

    gt source npm

    +

    gt source npm

    _.gt(value, other)

    Checks if value is greater than other.

    diff --git a/gte.html b/gte.html index 7549e57..27890fe 100644 --- a/gte.html +++ b/gte.html @@ -392,7 +392,7 @@
    -

    gte source npm

    +

    gte source npm

    _.gte(value, other)

    Checks if value is greater than or equal to other.

    diff --git a/has.html b/has.html index f234dad..496e62a 100644 --- a/has.html +++ b/has.html @@ -392,7 +392,7 @@
    -

    has source npm

    +

    has source npm

    _.has(object, path)

    Checks if path is a direct property of object.

    diff --git a/hasIn.html b/hasIn.html index ac19ec6..d6c16e8 100644 --- a/hasIn.html +++ b/hasIn.html @@ -392,7 +392,7 @@
    -

    hasIn source npm

    +

    hasIn source npm

    _.hasIn(object, path)

    Checks if path is a direct or inherited property of object.

    diff --git a/identity.html b/identity.html index bd32c68..a9ee510 100644 --- a/identity.html +++ b/identity.html @@ -392,7 +392,7 @@
    -

    identity source npm

    +

    identity source npm

    _.identity(value)

    This method returns the first argument provided to it.

    diff --git a/inRange.html b/inRange.html index 9131c87..754d806 100644 --- a/inRange.html +++ b/inRange.html @@ -392,7 +392,7 @@
    -

    inRange source npm

    +

    inRange source npm

    _.inRange(number, [start=0], end)

    Checks if n is between start and up to but not including, end. If diff --git a/includes.html b/includes.html index ce07948..2723155 100644 --- a/includes.html +++ b/includes.html @@ -392,26 +392,25 @@

    -

    includes source npm

    +

    includes source npm

    _.includes(collection, value, [fromIndex=0])
    -

    Checks if value is in collection. If collection is a string it's checked -for a substring of value, otherwise SameValueZero -is used for equality comparisons. If fromIndex is negative, it's used as -the offset from the end of collection.

    +

    检查 值 是否在 集合中,如果集合是字符串,那么检查 值 是否在字符串中。 +其他情况用 SameValueZero 等值比较。 +如果指定 fromIndex 是负数,从结尾开始检索。

    参数

      -
    1. collection (Array|Object|string)

      The collection to search.

      +
    2. collection (Array|Object|string)

      要检索的集合

    3. -
    4. value (*)

      The value to search for.

      +
    5. value (*)

      要检索的值

    6. -
    7. [fromIndex=0] (number)

      The index to search from.

      +
    8. [fromIndex=0] (number)

      要检索的 index 位置

    返回值 (boolean)

    -

    Returns true if value is found, else false.

    +

    如果找到 value 返回 ture, 否则返回 false。

    示例

    _.includes([1, 2, 3], 1);
    diff --git a/intersectionBy.html b/intersectionBy.html
    index 4b1d6c9..39683fc 100644
    --- a/intersectionBy.html
    +++ b/intersectionBy.html
    @@ -402,7 +402,7 @@ 

    参数

    1. [arrays] (...Array)

      需要检索的数组

    2. -
    3. [iteratee=_.identity] (Function|Object|string)

      这个函数会调用每一个元素

      +
    4. [iteratee=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

    返回值 (Array)

    diff --git a/intersectionWith.html b/intersectionWith.html index 8cd23bd..882da08 100644 --- a/intersectionWith.html +++ b/intersectionWith.html @@ -402,7 +402,7 @@

    参数

    1. [arrays] (...Array)

      需要检索的数组

    2. -
    3. [comparator] (Function)

      这个函数会调用每一个元素

      +
    4. [comparator] (Function)

      这个函数会处理每一个元素

    返回值 (Array)

    diff --git a/invert.html b/invert.html index b203e2a..8072580 100644 --- a/invert.html +++ b/invert.html @@ -392,7 +392,7 @@
    -

    invert source npm

    +

    invert source npm

    _.invert(object, [multiVal])

    Creates an object composed of the inverted keys and values of object. diff --git a/invoke.html b/invoke.html index 7e81cf4..6c8702a 100644 --- a/invoke.html +++ b/invoke.html @@ -392,7 +392,7 @@

    -

    invoke source npm

    +

    invoke source npm

    _.invoke(object, path, [args])

    Invokes the method at path of object.

    diff --git a/invokeMap.html b/invokeMap.html index bbff27c..087724f 100644 --- a/invokeMap.html +++ b/invokeMap.html @@ -392,26 +392,24 @@
    -

    invokeMap source npm

    +

    invokeMap source npm

    _.invokeMap(collection, path, [args])
    -

    Invokes the method at path of each element in collection, returning -an array of the results of each invoked method. Any additional arguments -are provided to each invoked method. If methodName is a function it's -invoked for, and this bound to, each element in collection.

    +

    调用 path 的方法处理集合中的每一个元素,返回处理的数组。 +如何附加的参数会传入到调用方法中。如果方法名是个函数,集合中的每个元素都会被调用到。

    参数

      -
    1. collection (Array|Object)

      The collection to iterate over.

      +
    2. collection (Array|Object)

      需要遍历的集合

    3. -
    4. path (Array|Function|string)

      The path of the method to invoke or the function invoked per iteration.

      +
    5. path (Array|Function|string)

      要调用的方法名 或者 这个函数会处理每一个元素

    6. [args] (...*)

      The arguments to invoke each method with.

    返回值 (Array)

    -

    Returns the array of results.

    +

    返回数组结果

    示例

    _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
    diff --git a/isArguments.html b/isArguments.html
    index c061d31..55292b5 100644
    --- a/isArguments.html
    +++ b/isArguments.html
    @@ -392,7 +392,7 @@
     
     
    -

    isArguments source npm

    +

    isArguments source npm

    _.isArguments(value)

    Checks if value is likely an arguments object.

    diff --git a/isArray.html b/isArray.html index a4491e4..b8fa6c3 100644 --- a/isArray.html +++ b/isArray.html @@ -392,7 +392,7 @@
    -

    isArray source npm

    +

    isArray source npm

    _.isArray(value)

    Checks if value is classified as an Array object.

    diff --git a/isArrayLike.html b/isArrayLike.html index 5ecdae5..beb5567 100644 --- a/isArrayLike.html +++ b/isArrayLike.html @@ -392,7 +392,7 @@
    -

    isArrayLike source npm

    +

    isArrayLike source npm

    _.isArrayLike(value)

    Checks if value is array-like. A value is considered array-like if it's diff --git a/isArrayLikeObject.html b/isArrayLikeObject.html index 6655b66..86f90cb 100644 --- a/isArrayLikeObject.html +++ b/isArrayLikeObject.html @@ -392,7 +392,7 @@

    -

    isArrayLikeObject source npm

    +

    isArrayLikeObject source npm

    _.isArrayLikeObject(value)

    This method is like _.isArrayLike except that it also checks if value diff --git a/isBoolean.html b/isBoolean.html index 43598bd..bc1e230 100644 --- a/isBoolean.html +++ b/isBoolean.html @@ -392,7 +392,7 @@

    -

    isBoolean source npm

    +

    isBoolean source npm

    _.isBoolean(value)

    Checks if value is classified as a boolean primitive or object.

    diff --git a/isDate.html b/isDate.html index c98bb75..0d414f7 100644 --- a/isDate.html +++ b/isDate.html @@ -392,7 +392,7 @@
    -

    isDate source npm

    +

    isDate source npm

    _.isDate(value)

    Checks if value is classified as a Date object.

    diff --git a/isElement.html b/isElement.html index fe689e9..2ba9e4f 100644 --- a/isElement.html +++ b/isElement.html @@ -392,7 +392,7 @@
    -

    isElement source npm

    +

    isElement source npm

    _.isElement(value)

    Checks if value is likely a DOM element.

    diff --git a/isEmpty.html b/isEmpty.html index 7c7ab1e..80916d8 100644 --- a/isEmpty.html +++ b/isEmpty.html @@ -392,7 +392,7 @@
    -

    isEmpty source npm

    +

    isEmpty source npm

    _.isEmpty(value)

    Checks if value is empty. A value is considered empty unless it's an diff --git a/isEqual.html b/isEqual.html index df0a62e..9012609 100644 --- a/isEqual.html +++ b/isEqual.html @@ -392,7 +392,7 @@

    -

    isEqual source npm

    +

    isEqual source npm

    _.isEqual(value, other)

    Performs a deep comparison between two values to determine if they are diff --git a/isEqualWith.html b/isEqualWith.html index 3a018a6..d477ae3 100644 --- a/isEqualWith.html +++ b/isEqualWith.html @@ -392,7 +392,7 @@

    -

    isEqualWith source npm

    +

    isEqualWith source npm

    _.isEqualWith(value, other, [customizer])

    This method is like _.isEqual except that it accepts customizer which is diff --git a/isError.html b/isError.html index dbfe00a..b3ad2e6 100644 --- a/isError.html +++ b/isError.html @@ -392,7 +392,7 @@

    -

    isError source npm

    +

    isError source npm

    _.isError(value)

    Checks if value is an Error, EvalError, RangeError, ReferenceError, diff --git a/isFinite.html b/isFinite.html index b0c8793..a90ba1e 100644 --- a/isFinite.html +++ b/isFinite.html @@ -392,7 +392,7 @@

    -

    isFinite source npm

    +

    isFinite source npm

    _.isFinite(value)

    Checks if value is a finite primitive number. diff --git a/isFunction.html b/isFunction.html index 823aee4..5396c3a 100644 --- a/isFunction.html +++ b/isFunction.html @@ -392,7 +392,7 @@

    -

    isFunction source npm

    +

    isFunction source npm

    _.isFunction(value)

    Checks if value is classified as a Function object.

    diff --git a/isInteger.html b/isInteger.html index 21068fb..44a5340 100644 --- a/isInteger.html +++ b/isInteger.html @@ -392,7 +392,7 @@
    -

    isInteger source npm

    +

    isInteger source npm

    _.isInteger(value)

    Checks if value is an integer. diff --git a/isLength.html b/isLength.html index d106f35..28c569b 100644 --- a/isLength.html +++ b/isLength.html @@ -392,7 +392,7 @@

    -

    isLength source npm

    +

    isLength source npm

    _.isLength(value)

    Checks if value is a valid array-like length. diff --git a/isMatch.html b/isMatch.html index 1998647..f6af72b 100644 --- a/isMatch.html +++ b/isMatch.html @@ -392,7 +392,7 @@

    -

    isMatch source npm

    +

    isMatch source npm

    _.isMatch(object, source)

    Performs a deep comparison between object and source to determine if diff --git a/isMatchWith.html b/isMatchWith.html index 4da77c9..68461b2 100644 --- a/isMatchWith.html +++ b/isMatchWith.html @@ -392,7 +392,7 @@

    -

    isMatchWith source npm

    +

    isMatchWith source npm

    _.isMatchWith(object, source, [customizer])

    This method is like _.isMatch except that it accepts customizer which diff --git a/isNaN.html b/isNaN.html index e7cdc2e..59ed59a 100644 --- a/isNaN.html +++ b/isNaN.html @@ -392,7 +392,7 @@

    -

    isNaN source npm

    +

    isNaN source npm

    _.isNaN(value)

    Checks if value is NaN. diff --git a/isNative.html b/isNative.html index 3dcc6b5..805eaa5 100644 --- a/isNative.html +++ b/isNative.html @@ -392,7 +392,7 @@

    -

    isNative source npm

    +

    isNative source npm

    _.isNative(value)

    Checks if value is a native function.

    diff --git a/isNil.html b/isNil.html index ad4f74e..48ef053 100644 --- a/isNil.html +++ b/isNil.html @@ -392,7 +392,7 @@
    -

    isNil source npm

    +

    isNil source npm

    _.isNil(value)

    Checks if value is null or undefined.

    diff --git a/isNull.html b/isNull.html index 2bec148..a5a16df 100644 --- a/isNull.html +++ b/isNull.html @@ -392,7 +392,7 @@
    -

    isNull source npm

    +

    isNull source npm

    _.isNull(value)

    Checks if value is null.

    diff --git a/isNumber.html b/isNumber.html index 31e13a7..ac98171 100644 --- a/isNumber.html +++ b/isNumber.html @@ -392,7 +392,7 @@
    -

    isNumber source npm

    +

    isNumber source npm

    _.isNumber(value)

    Checks if value is classified as a Number primitive or object. diff --git a/isObject.html b/isObject.html index 3218ce1..1c5d89a 100644 --- a/isObject.html +++ b/isObject.html @@ -392,7 +392,7 @@

    -

    isObject source npm

    +

    isObject source npm

    _.isObject(value)

    Checks if value is the language type of Object. diff --git a/isObjectLike.html b/isObjectLike.html index 1ac35fe..56eea22 100644 --- a/isObjectLike.html +++ b/isObjectLike.html @@ -392,7 +392,7 @@

    -

    isObjectLike source npm

    +

    isObjectLike source npm

    _.isObjectLike(value)

    Checks if value is object-like. A value is object-like if it's not null diff --git a/isPlainObject.html b/isPlainObject.html index 7a81650..2211ed0 100644 --- a/isPlainObject.html +++ b/isPlainObject.html @@ -392,7 +392,7 @@

    -

    isPlainObject source npm

    +

    isPlainObject source npm

    _.isPlainObject(value)

    Checks if value is a plain object, that is, an object created by the diff --git a/isRegExp.html b/isRegExp.html index 329d492..19f3409 100644 --- a/isRegExp.html +++ b/isRegExp.html @@ -392,7 +392,7 @@

    -

    isRegExp source npm

    +

    isRegExp source npm

    _.isRegExp(value)

    Checks if value is classified as a RegExp object.

    diff --git a/isSafeInteger.html b/isSafeInteger.html index e117a37..687e927 100644 --- a/isSafeInteger.html +++ b/isSafeInteger.html @@ -392,7 +392,7 @@
    -

    isSafeInteger source npm

    +

    isSafeInteger source npm

    _.isSafeInteger(value)

    Checks if value is a safe integer. An integer is safe if it's an IEEE-754 diff --git a/isString.html b/isString.html index ce8f6e2..2675bd8 100644 --- a/isString.html +++ b/isString.html @@ -392,7 +392,7 @@

    -

    isString source npm

    +

    isString source npm

    _.isString(value)

    Checks if value is classified as a String primitive or object.

    diff --git a/isSymbol.html b/isSymbol.html index 8c191e6..eb5f567 100644 --- a/isSymbol.html +++ b/isSymbol.html @@ -392,7 +392,7 @@
    -

    isSymbol source npm

    +

    isSymbol source npm

    _.isSymbol(value)

    Checks if value is classified as a Symbol primitive or object.

    diff --git a/isTypedArray.html b/isTypedArray.html index 7b38043..c59e687 100644 --- a/isTypedArray.html +++ b/isTypedArray.html @@ -392,7 +392,7 @@
    -

    isTypedArray source npm

    +

    isTypedArray source npm

    _.isTypedArray(value)

    Checks if value is classified as a typed array.

    diff --git a/isUndefined.html b/isUndefined.html index 1beed92..83915e7 100644 --- a/isUndefined.html +++ b/isUndefined.html @@ -392,7 +392,7 @@
    -

    isUndefined source npm

    +

    isUndefined source npm

    _.isUndefined(value)

    Checks if value is undefined.

    diff --git a/iteratee.html b/iteratee.html index be7ce5b..96b3c3e 100644 --- a/iteratee.html +++ b/iteratee.html @@ -392,7 +392,7 @@
    -

    iteratee source npm

    +

    iteratee source npm

    _.iteratee([func=_.identity])

    Creates a function that invokes func with the arguments of the created diff --git a/js/lodash-zh.js b/js/lodash-zh.js index 5d73548..6d6c576 100644 --- a/js/lodash-zh.js +++ b/js/lodash-zh.js @@ -428,7 +428,7 @@ * * @private * @param {Array} array The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. + * @param {Function} iteratee 这个函数会处理每一个元素 * @returns {Array} Returns `array`. */ function arrayEach (array, iteratee) { @@ -449,7 +449,7 @@ * * @private * @param {Array} array The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. + * @param {Function} iteratee 这个函数会处理每一个元素 * @returns {Array} Returns `array`. */ function arrayEachRight (array, iteratee) { @@ -469,7 +469,7 @@ * * @private * @param {Array} array The array to iterate over. - * @param {Function} predicate The function invoked per iteration. + * @param {Function} predicate 这个函数会处理每一个元素 * @returns {boolean} Returns `true` if all elements pass the predicate check, else `false`. */ function arrayEvery (array, predicate) { @@ -490,7 +490,7 @@ * * @private * @param {Array} array The array to iterate over. - * @param {Function} predicate The function invoked per iteration. + * @param {Function} predicate 这个函数会处理每一个元素 * @returns {Array} Returns the new filtered array. */ function arrayFilter (array, predicate) { @@ -514,7 +514,7 @@ * * @private * @param {Array} array The array to search. - * @param {*} target The value to search for. + * @param {*} target 要检索的值 * @returns {boolean} Returns `true` if `target` is found, else `false`. */ function arrayIncludes (array, value) { @@ -527,8 +527,8 @@ * * @private * @param {Array} array The array to search. - * @param {*} target The value to search for. - * @param {Function} comparator 这个函数会调用每一个元素 + * @param {*} target 要检索的值 + * @param {Function} comparator 这个函数会处理每一个元素 * @returns {boolean} Returns `true` if `target` is found, else `false`. */ function arrayIncludesWith (array, value, comparator) { @@ -549,7 +549,7 @@ * * @private * @param {Array} array The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. + * @param {Function} iteratee 这个函数会处理每一个元素 * @returns {Array} Returns the new mapped array. */ function arrayMap (array, iteratee) { @@ -588,7 +588,7 @@ * * @private * @param {Array} array The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. + * @param {Function} iteratee 这个函数会处理每一个元素 * @param {*} [accumulator] The initial value. * @param {boolean} [initFromArray] Specify using the first element of `array` as the initial value. * @returns {*} Returns the accumulated value. @@ -612,7 +612,7 @@ * * @private * @param {Array} array The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. + * @param {Function} iteratee 这个函数会处理每一个元素 * @param {*} [accumulator] The initial value. * @param {boolean} [initFromArray] Specify using the last element of `array` as the initial value. * @returns {*} Returns the accumulated value. @@ -634,7 +634,7 @@ * * @private * @param {Array} array The array to iterate over. - * @param {Function} predicate The function invoked per iteration. + * @param {Function} predicate 这个函数会处理每一个元素 * @returns {boolean} Returns `true` if any element passes the predicate check, else `false`. */ function arraySome (array, predicate) { @@ -684,8 +684,8 @@ * the provided `eachFunc`. * * @private - * @param {Array|Object} collection The collection to search. - * @param {Function} predicate The function invoked per iteration. + * @param {Array|Object} collection 要检索的集合 + * @param {Function} predicate 这个函数会处理每一个元素 * @param {Function} eachFunc The function to iterate over `collection`. * @param {boolean} [retKey] Specify returning the key of the found element instead of the element itself. * @returns {*} Returns the found element or its key, else `undefined`. @@ -707,7 +707,7 @@ * * @private * @param {Array} array The array to search. - * @param {Function} predicate The function invoked per iteration. + * @param {Function} predicate 这个函数会处理每一个元素 * @param {boolean} [fromRight] Specify iterating from right to left. * @returns {number} Returns the index of the matched value, else `-1`. */ @@ -728,7 +728,7 @@ * * @private * @param {Array} array The array to search. - * @param {*} value The value to search for. + * @param {*} value 要检索的值 * @param {number} fromIndex The index to search from. * @returns {number} Returns the index of the matched value, else `-1`. */ @@ -753,8 +753,8 @@ * `eachFunc`. * * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} iteratee The function invoked per iteration. + * @param {Array|Object} collection 需要遍历的集合 + * @param {Function} iteratee 这个函数会处理每一个元素 * @param {*} accumulator The initial value. * @param {boolean} initFromCollection Specify using the first or last element of `collection` as the initial value. * @param {Function} eachFunc The function to iterate over `collection`. @@ -794,7 +794,7 @@ * * @private * @param {Array} array The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. + * @param {Function} iteratee 这个函数会处理每一个元素 * @returns {number} Returns the sum. */ function baseSum (array, iteratee) { @@ -817,7 +817,7 @@ * * @private * @param {number} n The number of times to invoke `iteratee`. - * @param {Function} iteratee The function invoked per iteration. + * @param {Function} iteratee 这个函数会处理每一个元素 * @returns {Array} Returns the array of results. */ function baseTimes (n, iteratee) { @@ -1887,7 +1887,7 @@ * * @private * @param {Object} cache The set cache to search. - * @param {*} value The value to search for. + * @param {*} value 要检索的值 * @returns {number} Returns `true` if `value` is found, else `false`. */ function cacheHas (cache, value) { @@ -2341,8 +2341,8 @@ * @private * @param {Array} array The array to inspect. * @param {Array} values The values to exclude. - * @param {Function} [iteratee] 这个函数会调用每一个元素 - * @param {Function} [comparator] 这个函数会调用每一个元素 + * @param {Function} [iteratee] 这个函数会处理每一个元素 + * @param {Function} [comparator] 这个函数会处理每一个元素 * @returns {Array} Returns the new array of filtered values. */ function baseDifference (array, values, iteratee, comparator) { @@ -2393,8 +2393,8 @@ * The base implementation of `_.forEach` without support for callback shorthands. * * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} iteratee The function invoked per iteration. + * @param {Array|Object} collection 需要遍历的集合 + * @param {Function} iteratee 这个函数会处理每一个元素 * @returns {Array|Object} Returns `collection`. */ var baseEach = createBaseEach(baseForOwn); @@ -2403,8 +2403,8 @@ * The base implementation of `_.forEachRight` without support for callback shorthands. * * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} iteratee The function invoked per iteration. + * @param {Array|Object} collection 需要遍历的集合 + * @param {Function} iteratee 这个函数会处理每一个元素 * @returns {Array|Object} Returns `collection`. */ var baseEachRight = createBaseEach(baseForOwnRight, true); @@ -2413,8 +2413,8 @@ * The base implementation of `_.every` without support for callback shorthands. * * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} predicate The function invoked per iteration. + * @param {Array|Object} collection 需要遍历的集合 + * @param {Function} predicate 这个函数会处理每一个元素 * @returns {boolean} Returns `true` if all elements pass the predicate check, else `false` */ function baseEvery (collection, predicate) { @@ -2458,8 +2458,8 @@ * The base implementation of `_.filter` without support for callback shorthands. * * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} predicate The function invoked per iteration. + * @param {Array|Object} collection 需要遍历的集合 + * @param {Function} predicate 这个函数会处理每一个元素 * @returns {Array} Returns the new filtered array. */ function baseFilter (collection, predicate) { @@ -2523,7 +2523,7 @@ * * @private * @param {Object} object The object to iterate over. - * @param {Function} iteratee The function invoked per iteration. + * @param {Function} iteratee 这个函数会处理每一个元素 * @param {Function} keysFunc The function to get the keys of `object`. * @returns {Object} Returns `object`. */ @@ -2535,7 +2535,7 @@ * * @private * @param {Object} object The object to iterate over. - * @param {Function} iteratee The function invoked per iteration. + * @param {Function} iteratee 这个函数会处理每一个元素 * @param {Function} keysFunc The function to get the keys of `object`. * @returns {Object} Returns `object`. */ @@ -2546,7 +2546,7 @@ * * @private * @param {Object} object The object to iterate over. - * @param {Function} iteratee The function invoked per iteration. + * @param {Function} iteratee 这个函数会处理每一个元素 * @returns {Object} Returns `object`. */ function baseForIn (object, iteratee) { @@ -2558,7 +2558,7 @@ * * @private * @param {Object} object The object to iterate over. - * @param {Function} iteratee The function invoked per iteration. + * @param {Function} iteratee 这个函数会处理每一个元素 * @returns {Object} Returns `object`. */ function baseForOwn (object, iteratee) { @@ -2570,7 +2570,7 @@ * * @private * @param {Object} object The object to iterate over. - * @param {Function} iteratee The function invoked per iteration. + * @param {Function} iteratee 这个函数会处理每一个元素 * @returns {Object} Returns `object`. */ function baseForOwnRight (object, iteratee) { @@ -2646,8 +2646,8 @@ * * @private * @param {Array} arrays The arrays to inspect. - * @param {Function} [iteratee] 这个函数会调用每一个元素 - * @param {Function} [comparator] 这个函数会调用每一个元素 + * @param {Function} [iteratee] 这个函数会处理每一个元素 + * @param {Function} [comparator] 这个函数会处理每一个元素 * @returns {Array} Returns the new array of shared values. */ function baseIntersection (arrays, iteratee, comparator) { @@ -2925,8 +2925,8 @@ * The base implementation of `_.map` without support for callback shorthands. * * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} iteratee The function invoked per iteration. + * @param {Array|Object} collection 需要遍历的集合 + * @param {Function} iteratee 这个函数会处理每一个元素 * @returns {Array} Returns the new mapped array. */ function baseMap (collection, iteratee) { @@ -3069,7 +3069,7 @@ * The base implementation of `_.orderBy` without param guards. * * @private - * @param {Array|Object} collection The collection to iterate over. + * @param {Array|Object} collection 需要遍历的集合 * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by. * @param {string[]} orders The sort orders of `iteratees`. * @returns {Array} Returns the new sorted array. @@ -3176,7 +3176,7 @@ * @private * @param {Array} array The array to modify. * @param {Array} values The values to remove. - * @param {Function} [iteratee] 这个函数会调用每一个元素 + * @param {Function} [iteratee] 这个函数会处理每一个元素 * @returns {Array} Returns `array`. */ function basePullAllBy (array, values, iteratee) { @@ -3370,8 +3370,8 @@ * The base implementation of `_.some` without support for callback shorthands. * * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} predicate The function invoked per iteration. + * @param {Array|Object} collection 需要遍历的集合 + * @param {Function} predicate 这个函数会处理每一个元素 * @returns {boolean} Returns `true` if any element passes the predicate check, else `false`. */ function baseSome (collection, predicate) { @@ -3424,7 +3424,7 @@ * @private * @param {Array} array The sorted array to inspect. * @param {*} value The value to evaluate. - * @param {Function} iteratee 这个函数会调用每一个元素 + * @param {Function} iteratee 这个函数会处理每一个元素 * @param {boolean} [retHighest] Specify returning the highest qualified index. * @returns {number} Returns the index at which `value` should be inserted into `array`. */ @@ -3480,7 +3480,7 @@ * * @private * @param {Array} array The array to inspect. - * @param {Function} [iteratee] 这个函数会调用每一个元素 + * @param {Function} [iteratee] 这个函数会处理每一个元素 * @returns {Array} Returns the new duplicate free array. */ function baseSortedUniqBy (array, iteratee) { @@ -3521,8 +3521,8 @@ * * @private * @param {Array} array The array to inspect. - * @param {Function} [iteratee] 这个函数会调用每一个元素 - * @param {Function} [comparator] 这个函数会调用每一个元素 + * @param {Function} [iteratee] 这个函数会处理每一个元素 + * @param {Function} [comparator] 这个函数会处理每一个元素 * @returns {Array} Returns the new duplicate free array. */ function baseUniq (array, iteratee, comparator) { @@ -3597,7 +3597,7 @@ * * @private * @param {Array} array The array to query. - * @param {Function} predicate The function invoked per iteration. + * @param {Function} predicate 这个函数会处理每一个元素 * @param {boolean} [isDrop] Specify dropping elements instead of taking them. * @param {boolean} [fromRight] Specify iterating from right to left. * @returns {Array} Returns the slice of `array`. @@ -3641,8 +3641,8 @@ * * @private * @param {Array} arrays The arrays to inspect. - * @param {Function} [iteratee] 这个函数会调用每一个元素 - * @param {Function} [comparator] 这个函数会调用每一个元素 + * @param {Function} [iteratee] 这个函数会处理每一个元素 + * @param {Function} [comparator] 这个函数会处理每一个元素 * @returns {Array} Returns the new array of values. */ function baseXor (arrays, iteratee, comparator) { @@ -5376,7 +5376,7 @@ * @category Array * @param {Array} array 需要处理的数组 * @param {...Array} [values] 用于对比差异的数组 - * @param {Function|Object|string} [iteratee=_.identity] 这个函数会调用每一个元素 + * @param {Function|Object|string} [iteratee=_.identity] 这个函数会处理每一个元素 * @returns {Array} 返回一个差异化后的新数组 * @example * @@ -5405,7 +5405,7 @@ * @category Array * @param {Array} array 需要处理的数组 * @param {...Array} [values] 用于对比差异的数组 - * @param {Function} [comparator] 这个函数会调用每一个元素 + * @param {Function} [comparator] 这个函数会处理每一个元素 * @returns {Array} 返回一个差异化后的新数组 * @example * @@ -5863,7 +5863,7 @@ * @memberOf _ * @category Array * @param {...Array} [arrays] 需要检索的数组 - * @param {Function|Object|string} [iteratee=_.identity] 这个函数会调用每一个元素 + * @param {Function|Object|string} [iteratee=_.identity] 这个函数会处理每一个元素 * @returns {Array} 返回数组中共享元素的新数组 * @example * @@ -5895,7 +5895,7 @@ * @memberOf _ * @category Array * @param {...Array} [arrays] 需要检索的数组 - * @param {Function} [comparator] 这个函数会调用每一个元素 + * @param {Function} [comparator] 这个函数会处理每一个元素 * @returns {Array} 返回数组中共享元素的新数组 * @example * @@ -6055,7 +6055,7 @@ * @category Array * @param {Array} array 需要调整的数组 * @param {Array} values 要移除的值 - * @param {Function|Object|string} [iteratee=_.identity] 这个函数会调用每一个元素 + * @param {Function|Object|string} [iteratee=_.identity] 这个函数会处理每一个元素 * @returns {Array} 返回数组本身 * @example * @@ -6111,7 +6111,7 @@ * @memberOf _ * @category Array * @param {Array} array 需要调整的数组 - * @param {Function|Object|string} [predicate=_.identity] 这个函数会调用每一个元素 + * @param {Function|Object|string} [predicate=_.identity] 这个函数会处理每一个元素 * @returns {Array} 返回被移除的元素的数组 * @example * @@ -6225,7 +6225,7 @@ * @category Array * @param {Array} array 需要检索的已排序数组 * @param {*} value 要评估位置的值 - * @param {Function|Object|string} [iteratee=_.identity] 这个函数会调用每一个元素 + * @param {Function|Object|string} [iteratee=_.identity] 这个函数会处理每一个元素 * @returns {number} 返回 value 应该在数组中插入的 index。 * @example * @@ -6293,7 +6293,7 @@ * @category Array * @param {Array} array 需要检索的已排序数组 * @param {*} value 要评估位置的值 - * @param {Function|Object|string} [iteratee=_.identity] 这个函数会调用每一个元素 + * @param {Function|Object|string} [iteratee=_.identity] 这个函数会处理每一个元素 * @returns {number} 返回 value 应该在数组中插入的 index。 * @example * @@ -6356,7 +6356,7 @@ * @memberOf _ * @category Array * @param {Array} array 要调整的数组 - * @param {Function} [iteratee] 这个函数会调用每一个元素 + * @param {Function} [iteratee] 这个函数会处理每一个元素 * @returns {Array} 返回一个不重复的数组 * @example * @@ -6459,7 +6459,7 @@ * @memberOf _ * @category Array * @param {Array} array 需要处理的数组 - * @param {Function|Object|string} [predicate=_.identity] 这个函数会调用每一个元素 + * @param {Function|Object|string} [predicate=_.identity] 这个函数会处理每一个元素 * @returns {Array} 返回提取的元素数组 * @example * @@ -6499,7 +6499,7 @@ * @memberOf _ * @category Array * @param {Array} array 需要处理的数组 - * @param {Function|Object|string} [predicate=_.identity] 这个函数会调用每一个元素 + * @param {Function|Object|string} [predicate=_.identity] 这个函数会处理每一个元素 * @returns {Array} 返回提取的元素数组 * @example * @@ -6556,7 +6556,7 @@ * @memberOf _ * @category Array * @param {...Array} [arrays] 需要处理的数组队列 - * @param {Function|Object|string} [iteratee=_.identity] 这个函数会调用每一个元素 + * @param {Function|Object|string} [iteratee=_.identity] 这个函数会处理每一个元素 * @returns {Array} 返回处理好的数组 * @example * @@ -6583,7 +6583,7 @@ * @memberOf _ * @category Array * @param {...Array} [arrays] 需要处理的数组队列 - * @param {Function} [comparator] 这个函数会调用每一个元素 + * @param {Function} [comparator] 这个函数会处理每一个元素 * @returns {Array} 返回处理好的数组 * @example * @@ -6627,7 +6627,7 @@ * @memberOf _ * @category Array * @param {Array} array 需要处理的数组 - * @param {Function|Object|string} [iteratee=_.identity] 这个函数会调用每一个元素 + * @param {Function|Object|string} [iteratee=_.identity] 这个函数会处理每一个元素 * @returns {Array} 返回不重复的数组 * @example * @@ -6651,7 +6651,7 @@ * @memberOf _ * @category Array * @param {Array} array 需要处理的数组 - * @param {Function} [comparator] 这个函数会调用每一个元素 + * @param {Function} [comparator] 这个函数会处理每一个元素 * @returns {Array} 返回不重复的数组 * @example * @@ -6772,7 +6772,7 @@ * @memberOf _ * @category Array * @param {...Array} [arrays] 要处理的数组 - * @param {Function|Object|string} [iteratee=_.identity] 这个函数会调用每一个元素 + * @param {Function|Object|string} [iteratee=_.identity] 这个函数会处理每一个元素 * @returns {Array} 包含了所有唯一值的新数组 * @example * @@ -6798,7 +6798,7 @@ * @memberOf _ * @category Array * @param {...Array} [arrays] 要处理的数组 - * @param {Function} [comparator] 这个函数会调用每一个元素 + * @param {Function} [comparator] 这个函数会处理每一个元素 * @returns {Array} 包含了所有唯一值的新数组 * @example * @@ -7068,7 +7068,7 @@ * @static * @memberOf _ * @category Chain - * @param {Function|Object|string} [iteratee=_.identity] 这个函数会调用每一个元素 + * @param {Function|Object|string} [iteratee=_.identity] 这个函数会处理每一个元素 * @returns {Object} 返回 `lodash` 的包装实例 * @example * @@ -7231,17 +7231,14 @@ /*------------------------------------------------------------------------*/ /** - * Creates an object composed of keys generated from the results of running - * each element of `collection` through `iteratee`. The corresponding value - * of each key is the number of times the key was returned by `iteratee`. - * The iteratee is invoked with one argument: (value). + * 创建一个组成对象,key是经过 `iteratee` 处理的集合的结果,value 是处理结果的次数。 `iteratee` 会传入一个参数:(value)。 * * @static * @memberOf _ * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function|Object|string} [iteratee=_.identity] 这个函数会调用每一个元素 - * @returns {Object} Returns the composed aggregate object. + * @param {Array|Object} collection 需要遍历的集合 + * @param {Function|Object|string} [iteratee=_.identity] 这个函数会处理每一个元素 + * @returns {Object} 返回一个组成汇总的对象 * @example * * _.countBy([6.1, 4.2, 6.3], Math.floor); @@ -7255,17 +7252,16 @@ }); /** - * Checks if `predicate` returns truthy for **all** elements of `collection`. - * Iteration is stopped once `predicate` returns falsey. The predicate is - * invoked with three arguments: (value, index|key, collection). + * 通过 `predicate` 检查集合中的元素是否都返回 真值,只要 `predicate` 返回一次假值,遍历就停止,并返回 false。 + * `predicate` 会传入3个参数:(value, index|key, collection) * * @static * @memberOf _ * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. + * @param {Array|Object} collection 需要遍历的集合 + * @param {Function|Object|string} [predicate=_.identity] 这个函数会处理每一个元素 * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. - * @returns {boolean} Returns `true` if all elements pass the predicate check, else `false`. + * @returns {boolean} 返回 true,如果所有元素经 predicate 检查都为真值,否则返回 false。 * @example * * _.every([true, 1, null, 'yes'], Boolean); @@ -7297,16 +7293,14 @@ } /** - * Iterates over elements of `collection`, returning an array of all elements - * `predicate` returns truthy for. The predicate is invoked with three arguments: - * (value, index|key, collection). + * 遍历集合中的元素,筛选出一个经过 `predicate` 检查结果为真值的数组,predicate 会传入3个参数:(value, index|key, collection)。 * * @static * @memberOf _ * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. - * @returns {Array} Returns the new filtered array. + * @param {Array|Object} collection 需要遍历的集合 + * @param {Function|Object|string} [predicate=_.identity] 这个函数会处理每一个元素 + * @returns {Array} 返回筛选结果的新数组 * @example * * var resolve = _.partial(_.map, _, 'user'); @@ -7337,16 +7331,14 @@ } /** - * Iterates over elements of `collection`, returning the first element - * `predicate` returns truthy for. The predicate is invoked with three arguments: - * (value, index|key, collection). + * 遍历集合中的元素,返回最先经 `predicate` 检查为真值的元素。 predicate 会传入3个元素:(value, index|key, collection)。 * * @static * @memberOf _ * @category Collection - * @param {Array|Object} collection The collection to search. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. - * @returns {*} Returns the matched element, else `undefined`. + * @param {Array|Object} collection 要检索的集合 + * @param {Function|Object|string} [predicate=_.identity] 这个函数会处理每一个元素 + * @returns {*} 返回匹配元素,否则返回 `undefined` * @example * * var resolve = _.partial(_.result, _, 'user'); @@ -7382,15 +7374,14 @@ } /** - * This method is like `_.find` except that it iterates over elements of - * `collection` from right to left. + * 这个方法类似 `_.find`,除了它是从右至左遍历集合的。 * * @static * @memberOf _ * @category Collection - * @param {Array|Object} collection The collection to search. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. - * @returns {*} Returns the matched element, else `undefined`. + * @param {Array|Object} collection 要检索的集合 + * @param {Function|Object|string} [predicate=_.identity] 这个函数会处理每一个元素 + * @returns {*} 返回匹配元素,否则返回 `undefined` * @example * * _.findLast([1, 2, 3, 4], function(n) { @@ -7408,32 +7399,29 @@ } /** - * Iterates over elements of `collection` invoking `iteratee` for each element. - * The iteratee is invoked with three arguments: (value, index|key, collection). - * Iteratee functions may exit iteration early by explicitly returning `false`. + * 调用 `iteratee` 遍历集合中的元素,iteratee 会传入3个参数:(value, index|key, collection)。 + * 如果显式的返回 false ,`iteratee` 会提前退出。 * - * **注意:** As with other "Collections" methods, objects with a "length" property - * are iterated like arrays. To avoid this behavior use `_.forIn` or `_.forOwn` - * for object iteration. + * **注意:** 与其他集合方法一样,对象的 `length` 属性也会被遍历,避免这种情况,可以用 `_.forIn` 或者 `_.forOwn` 代替。 * * @static * @memberOf _ * @alias each * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Array|Object} Returns `collection`. + * @param {Array|Object} collection 需要遍历的集合 + * @param {Function} [iteratee=_.identity] 这个函数会处理每一个元素 + * @returns {Array|Object} 返回集合 * @example * * _([1, 2]).forEach(function(value) { * console.log(value); * }); - * // => logs `1` then `2` + * // => 输出 `1` 和 `2` * * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) { * console.log(key); * }); - * // => logs 'a' then 'b' (iteration order is not guaranteed) + * // => 输出 'a' 和 'b' (不保证遍历的顺序) */ function forEach (collection, iteratee) { return (typeof iteratee == 'function' && isArray(collection)) @@ -7442,22 +7430,21 @@ } /** - * This method is like `_.forEach` except that it iterates over elements of - * `collection` from right to left. + * 这个方法类似 `_.forEach`,除了它是从右到左遍历的集合中的元素的。 * * @static * @memberOf _ * @alias eachRight * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Array|Object} Returns `collection`. + * @param {Array|Object} collection 需要遍历的集合 + * @param {Function} [iteratee=_.identity] 这个函数会处理每一个元素 + * @returns {Array|Object} 返回集合 * @example * * _.forEachRight([1, 2], function(value) { * console.log(value); * }); - * // => logs `2` then `1` + * // => 输出 `2` 和 `1` */ function forEachRight (collection, iteratee) { return (typeof iteratee == 'function' && isArray(collection)) @@ -7466,17 +7453,14 @@ } /** - * Creates an object composed of keys generated from the results of running - * each element of `collection` through `iteratee`. The corresponding value - * of each key is an array of the elements responsible for generating the key. - * The iteratee is invoked with one argument: (value). + * 创建一个对象组成,key 是经 iteratee 处理的结果, value 是产生 key 的元素数组。 iteratee 会传入1个参数:(value)。 * * @static * @memberOf _ * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function|Object|string} [iteratee=_.identity] 这个函数会调用每一个元素 - * @returns {Object} Returns the composed aggregate object. + * @param {Array|Object} collection 需要遍历的集合 + * @param {Function|Object|string} [iteratee=_.identity] 这个函数会处理每一个元素 + * @returns {Object} 返回一个组成汇总的对象 * @example * * _.groupBy([6.1, 4.2, 6.3], Math.floor); @@ -7495,19 +7479,19 @@ }); /** - * Checks if `value` is in `collection`. If `collection` is a string it's checked - * for a substring of `value`, otherwise [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) - * is used for equality comparisons. If `fromIndex` is negative, it's used as - * the offset from the end of `collection`. + * 检查 值 是否在 集合中,如果集合是字符串,那么检查 值 是否在字符串中。 + * 其他情况用 [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) 等值比较。 + * 如果指定 `fromIndex` 是负数,从结尾开始检索。 * * @static * @memberOf _ * @category Collection - * @param {Array|Object|string} collection The collection to search. - * @param {*} value The value to search for. - * @param {number} [fromIndex=0] The index to search from. + * @param {Array|Object|string} collection 要检索的集合 + * @param {*} value 要检索的值 + * @param {number} [fromIndex=0] 要检索的 index 位置 * @param- {Object} [guard] Enables use as an iteratee for functions like `_.reduce`. - * @returns {boolean} Returns `true` if `value` is found, else `false`. + * @returns {boolean} 如果找到 value 返回 ture, 否则返回 false。 + * * @example * * _.includes([1, 2, 3], 1); @@ -7536,19 +7520,17 @@ } /** - * Invokes the method at `path` of each element in `collection`, returning - * an array of the results of each invoked method. Any additional arguments - * are provided to each invoked method. If `methodName` is a function it's - * invoked for, and `this` bound to, each element in `collection`. + * 调用 `path` 的方法处理集合中的每一个元素,返回处理的数组。 + * 如何附加的参数会传入到调用方法中。如果方法名是个函数,集合中的每个元素都会被调用到。 * * @static * @memberOf _ * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Array|Function|string} path The path of the method to invoke or - * the function invoked per iteration. + * @param {Array|Object} collection 需要遍历的集合 + * @param {Array|Function|string} path 要调用的方法名 或者 + * 这个函数会处理每一个元素 * @param {...*} [args] The arguments to invoke each method with. - * @returns {Array} Returns the array of results. + * @returns {Array} 返回数组结果 * @example * * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort'); @@ -7571,17 +7553,15 @@ }); /** - * Creates an object composed of keys generated from the results of running - * each element of `collection` through `iteratee`. The corresponding value - * of each key is the last element responsible for generating the key. The - * iteratee is invoked with one argument: (value). + * 创建一个对象组成。key 是经 `iteratee` 处理的结果,value 是产生key的元素。 + * iteratee 会传入1个参数:(value)。 * * @static * @memberOf _ * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function|Object|string} [iteratee=_.identity] 这个函数会调用每一个元素 - * @returns {Object} Returns the composed aggregate object. + * @param {Array|Object} collection 需要遍历的集合 + * @param {Function|Object|string} [iteratee=_.identity] 这个函数会处理每一个元素 + * @returns {Object} 返回一个组成汇总的对象 * @example * * var keyData = [ @@ -7602,25 +7582,24 @@ }); /** - * Creates an array of values by running each element in `collection` through - * `iteratee`. The iteratee is invoked with three arguments: - * (value, index|key, collection). + * 创建一个经过 `iteratee` 处理的集合中每一个元素的结果数组。 + * iteratee 会传入3个参数:(value, index|key, collection)。 * - * Many lodash methods are guarded to work as iteratees for methods like - * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`. + * 有许多 lodash 的方法以 iteratees 的身份守护其工作,例如: + * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, 以及 `_.some` * - * The guarded methods are: + * 被守护的有: * `ary`, `curry`, `curryRight`, `drop`, `dropRight`, `every`, `fill`, * `invert`, `parseInt`, `random`, `range`, `rangeRight`, `slice`, `some`, * `sortBy`, `take`, `takeRight`, `template`, `trim`, `trimEnd`, `trimStart`, - * and `words` + * 以及 `words` * * @static * @memberOf _ * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration. - * @returns {Array} Returns the new mapped array. + * @param {Array|Object} collection 需要遍历的集合 + * @param {Function|Object|string} [iteratee=_.identity] 这个函数会处理每一个元素 + * @returns {Array} 返回映射后的新数组 * @example * * function square(n) { @@ -7631,7 +7610,7 @@ * // => [3, 6] * * _.map({ 'a': 1, 'b': 2 }, square); - * // => [3, 6] (iteration order is not guaranteed) + * // => [3, 6] (无法保证遍历的顺序) * * var users = [ * { 'user': 'barney' }, @@ -7648,19 +7627,18 @@ } /** - * This method is like `_.sortBy` except that it allows specifying the sort - * orders of the iteratees to sort by. If `orders` is unspecified, all values - * are sorted in ascending order. Otherwise, specify an order of "desc" for - * descending or "asc" for ascending sort order of corresponding values. + * 这个方法类似 `_.sortBy`,除了它允许以 iteratees 来指定排序规则。 + * 如果没指定 `orders`,所有值以升序排序。 + * 其他情况,指定 "desc" 降序,指定 "asc" 升序其对应值。 * * @static * @memberOf _ * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function[]|Object[]|string[]} [iteratees=[_.identity]] The iteratees to sort by. - * @param {string[]} [orders] The sort orders of `iteratees`. + * @param {Array|Object} collection 需要遍历的集合 + * @param {Function[]|Object[]|string[]} [iteratees=[_.identity]] 通过 iteratees 决定排序 + * @param {string[]} [orders] 决定 iteratees 的排序方法 * @param- {Object} [guard] Enables use as an iteratee for functions like `_.reduce`. - * @returns {Array} Returns the new sorted array. + * @returns {Array} 排序排序后的新数组 * @example * * var resolve = _.partial(_.map, _, _.values); @@ -7672,7 +7650,7 @@ * { 'user': 'barney', 'age': 36 } * ]; * - * // sort by `user` in ascending order and by `age` in descending order + * // 以 `user` 升序排序 再 以 `age` 降序排序。 * resolve( _.orderBy(users, ['user', 'age'], ['asc', 'desc']) ); * // => [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] */ @@ -7699,8 +7677,8 @@ * @static * @memberOf _ * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. + * @param {Array|Object} collection 需要遍历的集合 + * @param {Function|Object|string} [predicate=_.identity] 这个函数会处理每一个元素 * @returns {Array} Returns the array of grouped elements. * @example * @@ -7753,8 +7731,8 @@ * @static * @memberOf _ * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {Array|Object} collection 需要遍历的集合 + * @param {Function} [iteratee=_.identity] 这个函数会处理每一个元素 * @param {*} [accumulator] The initial value. * @returns {*} Returns the accumulated value. * @example @@ -7768,7 +7746,7 @@ * (result[value] || (result[value] = [])).push(key); * return result; * }, {}); - * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed) + * // => { '1': ['a', 'c'], '2': ['b'] } (无法保证遍历的顺序) */ function reduce (collection, iteratee, accumulator) { var func = isArray(collection) ? arrayReduce : baseReduce, @@ -7784,8 +7762,8 @@ * @static * @memberOf _ * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {Array|Object} collection 需要遍历的集合 + * @param {Function} [iteratee=_.identity] 这个函数会处理每一个元素 * @param {*} [accumulator] The initial value. * @returns {*} Returns the accumulated value. * @example @@ -7811,8 +7789,8 @@ * @static * @memberOf _ * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. + * @param {Array|Object} collection 需要遍历的集合 + * @param {Function|Object|string} [predicate=_.identity] 这个函数会处理每一个元素 * @returns {Array} Returns the new filtered array. * @example * @@ -7955,8 +7933,8 @@ * @static * @memberOf _ * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. + * @param {Array|Object} collection 需要遍历的集合 + * @param {Function|Object|string} [predicate=_.identity] 这个函数会处理每一个元素 * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. * @returns {boolean} Returns `true` if any element passes the predicate check, else `false`. * @example @@ -7998,7 +7976,7 @@ * @static * @memberOf _ * @category Collection - * @param {Array|Object} collection The collection to iterate over. + * @param {Array|Object} collection 需要遍历的集合 * @param {...(Function|Function[]|Object|Object[]|string|string[])} [iteratees=[_.identity]] * The iteratees to sort by, specified individually or in arrays. * @returns {Array} Returns the new sorted array. @@ -10558,7 +10536,7 @@ * @memberOf _ * @category Object * @param {Object} object The object to search. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. + * @param {Function|Object|string} [predicate=_.identity] 这个函数会处理每一个元素 * @returns {string|undefined} Returns the key of the matched element, else `undefined`. * @example * @@ -10569,7 +10547,7 @@ * }; * * _.findKey(users, function(o) { return o.age < 40; }); - * // => 'barney' (iteration order is not guaranteed) + * // => 'barney' (无法保证遍历的顺序) * * // 使用了 `_.matches` 的回调结果 * _.findKey(users, { 'age': 1, 'active': true }); @@ -10595,7 +10573,7 @@ * @memberOf _ * @category Object * @param {Object} object The object to search. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. + * @param {Function|Object|string} [predicate=_.identity] 这个函数会处理每一个元素 * @returns {string|undefined} Returns the key of the matched element, else `undefined`. * @example * @@ -10634,7 +10612,7 @@ * @memberOf _ * @category Object * @param {Object} object The object to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {Function} [iteratee=_.identity] 这个函数会处理每一个元素 * @returns {Object} Returns `object`. * @example * @@ -10648,7 +10626,7 @@ * _.forIn(new Foo, function(value, key) { * console.log(key); * }); - * // => logs 'a', 'b', then 'c' (iteration order is not guaranteed) + * // => logs 'a', 'b', then 'c' (无法保证遍历的顺序) */ function forIn (object, iteratee) { return object == null ? object : baseFor(object, toFunction(iteratee), keysIn); @@ -10662,7 +10640,7 @@ * @memberOf _ * @category Object * @param {Object} object The object to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {Function} [iteratee=_.identity] 这个函数会处理每一个元素 * @returns {Object} Returns `object`. * @example * @@ -10692,7 +10670,7 @@ * @memberOf _ * @category Object * @param {Object} object The object to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {Function} [iteratee=_.identity] 这个函数会处理每一个元素 * @returns {Object} Returns `object`. * @example * @@ -10706,7 +10684,7 @@ * _.forOwn(new Foo, function(value, key) { * console.log(key); * }); - * // => logs 'a' then 'b' (iteration order is not guaranteed) + * // => logs 'a' then 'b' (无法保证遍历的顺序) */ function forOwn (object, iteratee) { return object && baseForOwn(object, toFunction(iteratee)); @@ -10720,7 +10698,7 @@ * @memberOf _ * @category Object * @param {Object} object The object to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {Function} [iteratee=_.identity] 这个函数会处理每一个元素 * @returns {Object} Returns `object`. * @example * @@ -10959,7 +10937,7 @@ * Foo.prototype.c = 3; * * _.keys(new Foo); - * // => ['a', 'b'] (iteration order is not guaranteed) + * // => ['a', 'b'] (无法保证遍历的顺序) * * _.keys('hi'); * // => ['0', '1'] @@ -11002,7 +10980,7 @@ * Foo.prototype.c = 3; * * _.keysIn(new Foo); - * // => ['a', 'b', 'c'] (iteration order is not guaranteed) + * // => ['a', 'b', 'c'] (无法保证遍历的顺序) */ function keysIn (object) { var index = -1, @@ -11032,7 +11010,7 @@ * @memberOf _ * @category Object * @param {Object} object The object to iterate over. - * @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration. + * @param {Function|Object|string} [iteratee=_.identity] 这个函数会处理每一个元素 * @returns {Object} Returns the new mapped object. * @example * @@ -11060,7 +11038,7 @@ * @memberOf _ * @category Object * @param {Object} object The object to iterate over. - * @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration. + * @param {Function|Object|string} [iteratee=_.identity] 这个函数会处理每一个元素 * @returns {Object} Returns the new mapped object. * @example * @@ -11070,11 +11048,11 @@ * }; * * _.mapValues(users, function(o) { return o.age; }); - * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) + * // => { 'fred': 40, 'pebbles': 1 } (无法保证遍历的顺序) * * // 使用了 `_.property` 的回调结果 * _.mapValues(users, 'age'); - * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) + * // => { 'fred': 40, 'pebbles': 1 } (无法保证遍历的顺序) */ function mapValues (object, iteratee) { var result = {}; @@ -11364,7 +11342,7 @@ * Foo.prototype.c = 3; * * _.toPairs(new Foo); - * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed) + * // => [['a', 1], ['b', 2]] (无法保证遍历的顺序) */ function toPairs (object) { return baseToPairs(object, keys(object)); @@ -11388,7 +11366,7 @@ * Foo.prototype.c = 3; * * _.toPairsIn(new Foo); - * // => [['a', 1], ['b', 2], ['c', 1]] (iteration order is not guaranteed) + * // => [['a', 1], ['b', 2], ['c', 1]] (无法保证遍历的顺序) */ function toPairsIn (object) { return baseToPairs(object, keysIn(object)); @@ -11406,7 +11384,7 @@ * @memberOf _ * @category Object * @param {Array|Object} object The object to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {Function} [iteratee=_.identity] 这个函数会处理每一个元素 * @param {*} [accumulator] The custom accumulator value. * @returns {*} Returns the accumulated value. * @example @@ -11492,7 +11470,7 @@ * Foo.prototype.c = 3; * * _.values(new Foo); - * // => [1, 2] (iteration order is not guaranteed) + * // => [1, 2] (无法保证遍历的顺序) * * _.values('hi'); * // => ['h', 'i'] @@ -11521,7 +11499,7 @@ * Foo.prototype.c = 3; * * _.valuesIn(new Foo); - * // => [1, 2, 3] (iteration order is not guaranteed) + * // => [1, 2, 3] (无法保证遍历的顺序) */ function valuesIn (object) { return object == null ? baseValues(object, keysIn(object)) : []; @@ -13445,7 +13423,7 @@ * @memberOf _ * @category Utility * @param {number} n The number of times to invoke `iteratee`. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {Function} [iteratee=_.identity] 这个函数会处理每一个元素 * @returns {Array} Returns the array of results. * @example * @@ -13620,13 +13598,13 @@ /** * This method is like `_.max` except that it accepts `iteratee` which is * invoked for each element in `array` to generate the criterion by which - * the value is ranked. The iteratee is invoked with one argument: (value). + * the value is ranked. The iteratee 会传入1个参数:(value)。 * * @static * @memberOf _ * @category Math * @param {Array} array The array to iterate over. - * @param {Function|Object|string} [iteratee=_.identity] 这个函数会调用每一个元素 + * @param {Function|Object|string} [iteratee=_.identity] 这个函数会处理每一个元素 * @returns {*} Returns the maximum value. * @example * @@ -13691,13 +13669,13 @@ /** * This method is like `_.min` except that it accepts `iteratee` which is * invoked for each element in `array` to generate the criterion by which - * the value is ranked. The iteratee is invoked with one argument: (value). + * the value is ranked. The iteratee 会传入1个参数:(value)。 * * @static * @memberOf _ * @category Math * @param {Array} array The array to iterate over. - * @param {Function|Object|string} [iteratee=_.identity] 这个函数会调用每一个元素 + * @param {Function|Object|string} [iteratee=_.identity] 这个函数会处理每一个元素 * @returns {*} Returns the minimum value. * @example * @@ -13788,13 +13766,13 @@ /** * This method is like `_.sum` except that it accepts `iteratee` which is * invoked for each element in `array` to generate the value to be summed. - * The iteratee is invoked with one argument: (value). + * The iteratee 会传入1个参数:(value)。 * * @static * @memberOf _ * @category Math * @param {Array} array The array to iterate over. - * @param {Function|Object|string} [iteratee=_.identity] 这个函数会调用每一个元素 + * @param {Function|Object|string} [iteratee=_.identity] 这个函数会处理每一个元素 * @returns {number} Returns the sum. * @example * diff --git a/js/lodash.js b/js/lodash.js deleted file mode 100644 index 12e2e7b..0000000 --- a/js/lodash.js +++ /dev/null @@ -1,14325 +0,0 @@ -/** - * @license - * lodash 4.0.0-pre - * Copyright 2012-2015 The Dojo Foundation - * Based on Underscore.js 1.8.3 - * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license - */ -;(function() { - - /** Used as a safe reference for `undefined` in pre-ES5 environments. */ - var undefined; - - /** Used as the semantic version number. */ - var VERSION = '4.0.0-pre'; - - /** Used to compose bitmasks for wrapper metadata. */ - var BIND_FLAG = 1, - BIND_KEY_FLAG = 2, - CURRY_BOUND_FLAG = 4, - CURRY_FLAG = 8, - CURRY_RIGHT_FLAG = 16, - PARTIAL_FLAG = 32, - PARTIAL_RIGHT_FLAG = 64, - ARY_FLAG = 128, - REARG_FLAG = 256, - FLIP_FLAG = 512; - - /** Used to compose bitmasks for comparison styles. */ - var UNORDERED_COMPARE_FLAG = 1, - PARTIAL_COMPARE_FLAG = 2; - - /** Used as default options for `_.truncate`. */ - var DEFAULT_TRUNC_LENGTH = 30, - DEFAULT_TRUNC_OMISSION = '...'; - - /** Used to detect hot functions by number of calls within a span of milliseconds. */ - var HOT_COUNT = 150, - HOT_SPAN = 16; - - /** Used as the size to enable large array optimizations. */ - var LARGE_ARRAY_SIZE = 200; - - /** Used to indicate the type of lazy iteratees. */ - var LAZY_FILTER_FLAG = 1, - LAZY_MAP_FLAG = 2, - LAZY_WHILE_FLAG = 3; - - /** Used as the `TypeError` message for "Functions" methods. */ - var FUNC_ERROR_TEXT = 'Expected a function'; - - /** Used to stand-in for `undefined` hash values. */ - var HASH_UNDEFINED = '__lodash_hash_undefined__'; - - /** Used as references for various `Number` constants. */ - var INFINITY = 1 / 0, - MAX_SAFE_INTEGER = 9007199254740991, - MAX_INTEGER = 1.7976931348623157e+308, - NAN = 0 / 0; - - /** Used as references for the maximum length and index of an array. */ - var MAX_ARRAY_LENGTH = 4294967295, - MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, - HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1; - - /** Used as the internal argument placeholder. */ - var PLACEHOLDER = '__lodash_placeholder__'; - - /** `Object#toString` result references. */ - var argsTag = '[object Arguments]', - arrayTag = '[object Array]', - boolTag = '[object Boolean]', - dateTag = '[object Date]', - errorTag = '[object Error]', - funcTag = '[object Function]', - genTag = '[object GeneratorFunction]', - mapTag = '[object Map]', - numberTag = '[object Number]', - objectTag = '[object Object]', - regexpTag = '[object RegExp]', - setTag = '[object Set]', - stringTag = '[object String]', - weakMapTag = '[object WeakMap]'; - - var arrayBufferTag = '[object ArrayBuffer]', - float32Tag = '[object Float32Array]', - float64Tag = '[object Float64Array]', - int8Tag = '[object Int8Array]', - int16Tag = '[object Int16Array]', - int32Tag = '[object Int32Array]', - uint8Tag = '[object Uint8Array]', - uint8ClampedTag = '[object Uint8ClampedArray]', - uint16Tag = '[object Uint16Array]', - uint32Tag = '[object Uint32Array]'; - - /** Used to match empty string literals in compiled template source. */ - var reEmptyStringLeading = /\b__p \+= '';/g, - reEmptyStringMiddle = /\b(__p \+=) '' \+/g, - reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g; - - /** Used to match HTML entities and HTML characters. */ - var reEscapedHtml = /&(?:amp|lt|gt|quot|#39|#96);/g, - reUnescapedHtml = /[&<>"'`]/g, - reHasEscapedHtml = RegExp(reEscapedHtml.source), - reHasUnescapedHtml = RegExp(reUnescapedHtml.source); - - /** Used to match template delimiters. */ - var reEscape = /<%-([\s\S]+?)%>/g, - reEvaluate = /<%([\s\S]+?)%>/g, - reInterpolate = /<%=([\s\S]+?)%>/g; - - /** Used to match property names within property paths. */ - var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; - - /** Used to match `RegExp` [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns). */ - var reRegExpChar = /[\\^$.*+?()[\]{}|]/g, - reHasRegExpChar = RegExp(reRegExpChar.source); - - /** Used to match backslashes in property paths. */ - var reEscapeChar = /\\(\\)?/g; - - /** Used to match [ES template delimiters](http://ecma-international.org/ecma-262/6.0/#sec-template-literal-lexical-components). */ - var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; - - /** Used to match `RegExp` flags from their coerced string values. */ - var reFlags = /\w*$/; - - /** Used to detect hexadecimal string values. */ - var reHasHexPrefix = /^0x/i; - - /** Used to detect bad signed hexadecimal string values. */ - var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; - - /** Used to detect binary string values. */ - var reIsBinary = /^0b[01]+$/i; - - /** Used to detect host constructors (Safari > 5). */ - var reIsHostCtor = /^\[object .+?Constructor\]$/; - - /** Used to detect octal string values. */ - var reIsOctal = /^0o[0-7]+$/i; - - /** Used to detect unsigned integer values. */ - var reIsUint = /^(?:0|[1-9]\d*)$/; - - /** Used to match latin-1 supplementary letters (excluding mathematical operators). */ - var reLatin1 = /[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g; - - /** Used to ensure capturing order of template delimiters. */ - var reNoMatch = /($^)/; - - /** Used to match unescaped characters in compiled string literals. */ - var reUnescapedString = /['\n\r\u2028\u2029\\]/g; - - /** Used to compose unicode character classes. */ - var rsAstralRange = '\\ud800-\\udfff', - rsComboRange = '\\u0300-\\u036f\\ufe20-\\ufe23', - rsDingbatRange = '\\u2700-\\u27bf', - rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff', - rsMathOpRange = '\\xac\\xb1\\xd7\\xf7', - rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf', - rsQuoteRange = '\\u2018\\u2019\\u201c\\u201d', - rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000', - rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde', - rsVarRange = '\\ufe0e\\ufe0f', - rsBreakRange = rsMathOpRange + rsNonCharRange + rsQuoteRange + rsSpaceRange; - - /** Used to compose unicode capture groups. */ - var rsAstral = '[' + rsAstralRange + ']', - rsBreak = '[' + rsBreakRange + ']', - rsCombo = '[' + rsComboRange + ']', - rsDigits = '\\d+', - rsDingbat = '[' + rsDingbatRange + ']', - rsLower = '[' + rsLowerRange + ']', - rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']', - rsModifier = '(?:\\ud83c[\\udffb-\\udfff])', - rsNonAstral = '[^' + rsAstralRange + ']', - rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}', - rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]', - rsUpper = '[' + rsUpperRange + ']', - rsZWJ = '\\u200d'; - - /** Used to compose unicode regexes. */ - var rsLowerMisc = '(?:' + rsLower + '|' + rsMisc + ')', - rsUpperMisc = '(?:' + rsUpper + '|' + rsMisc + ')', - reOptMod = rsModifier + '?', - rsOptVar = '[' + rsVarRange + ']?', - rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*', - rsSeq = rsOptVar + reOptMod + rsOptJoin, - rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq, - rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')'; - - /** Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). */ - var reComboMark = RegExp(rsCombo, 'g'); - - /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */ - var reComplexSymbol = RegExp(rsSymbol + rsSeq, 'g'); - - /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */ - var reHasComplexSymbol = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']'); - - /** Used to match non-compound words composed of alphanumeric characters. */ - var reBasicWord = /[a-zA-Z0-9]+/g; - - /** Used to match complex or compound words. */ - var reComplexWord = RegExp([ - rsUpper + '?' + rsLower + '+(?=' + [rsBreak, rsUpper, '$'].join('|') + ')', - rsUpperMisc + '+(?=' + [rsBreak, rsUpper + rsLowerMisc, '$'].join('|') + ')', - rsUpper + '?' + rsLowerMisc + '+', - rsDigits + '(?:' + rsLowerMisc + '+)?', - rsEmoji - ].join('|'), 'g'); - - /** Used to detect strings that need a more robust regexp to match words. */ - var reHasComplexWord = /[a-z][A-Z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/; - - /** Used to assign default `context` object properties. */ - var contextProps = [ - 'Array', 'Date', 'Error', 'Float32Array', 'Float64Array', 'Function', - 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object', - 'Reflect', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array', - 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap', '_', - 'clearTimeout', 'isFinite', 'parseFloat', 'parseInt', 'setTimeout' - ]; - - /** Used to make template sourceURLs easier to identify. */ - var templateCounter = -1; - - /** Used to identify `toStringTag` values of typed arrays. */ - var typedArrayTags = {}; - typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = - typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = - typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = - typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = - typedArrayTags[uint32Tag] = true; - typedArrayTags[argsTag] = typedArrayTags[arrayTag] = - typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = - typedArrayTags[dateTag] = typedArrayTags[errorTag] = - typedArrayTags[funcTag] = typedArrayTags[mapTag] = - typedArrayTags[numberTag] = typedArrayTags[objectTag] = - typedArrayTags[regexpTag] = typedArrayTags[setTag] = - typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false; - - /** Used to identify `toStringTag` values supported by `_.clone`. */ - var cloneableTags = {}; - cloneableTags[argsTag] = cloneableTags[arrayTag] = - cloneableTags[arrayBufferTag] = cloneableTags[boolTag] = - cloneableTags[dateTag] = cloneableTags[float32Tag] = - cloneableTags[float64Tag] = cloneableTags[int8Tag] = - cloneableTags[int16Tag] = cloneableTags[int32Tag] = - cloneableTags[mapTag] = cloneableTags[numberTag] = - cloneableTags[objectTag] = cloneableTags[regexpTag] = - cloneableTags[setTag] = cloneableTags[stringTag] = - cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = - cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; - cloneableTags[errorTag] = cloneableTags[funcTag] = - cloneableTags[weakMapTag] = false; - - /** Used to map latin-1 supplementary letters to basic latin letters. */ - var deburredLetters = { - '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A', - '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a', - '\xc7': 'C', '\xe7': 'c', - '\xd0': 'D', '\xf0': 'd', - '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E', - '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e', - '\xcC': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I', - '\xeC': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i', - '\xd1': 'N', '\xf1': 'n', - '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O', - '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o', - '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U', - '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u', - '\xdd': 'Y', '\xfd': 'y', '\xff': 'y', - '\xc6': 'Ae', '\xe6': 'ae', - '\xde': 'Th', '\xfe': 'th', - '\xdf': 'ss' - }; - - /** Used to map characters to HTML entities. */ - var htmlEscapes = { - '&': '&', - '<': '<', - '>': '>', - '"': '"', - "'": ''', - '`': '`' - }; - - /** Used to map HTML entities to characters. */ - var htmlUnescapes = { - '&': '&', - '<': '<', - '>': '>', - '"': '"', - ''': "'", - '`': '`' - }; - - /** Used to determine if values are of the language type `Object`. */ - var objectTypes = { - 'function': true, - 'object': true - }; - - /** Used to escape characters for inclusion in compiled string literals. */ - var stringEscapes = { - '\\': '\\', - "'": "'", - '\n': 'n', - '\r': 'r', - '\u2028': 'u2028', - '\u2029': 'u2029' - }; - - /** Detect free variable `exports`. */ - var freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType) ? exports : null; - - /** Detect free variable `module`. */ - var freeModule = (objectTypes[typeof module] && module && !module.nodeType) ? module : null; - - /** Detect free variable `global` from Node.js. */ - var freeGlobal = checkGlobal(freeExports && freeModule && typeof global == 'object' && global); - - /** Detect free variable `self`. */ - var freeSelf = checkGlobal(objectTypes[typeof self] && self); - - /** Detect free variable `window`. */ - var freeWindow = checkGlobal(objectTypes[typeof window] && window); - - /** Detect the popular CommonJS extension `module.exports`. */ - var moduleExports = (freeModule && freeModule.exports === freeExports) ? freeExports : null; - - /** Detect `this` as the global object. */ - var thisGlobal = checkGlobal(objectTypes[typeof this] && this); - - /** - * Used as a reference to the global object. - * - * The `this` value is used if it's the global object to avoid Greasemonkey's - * restricted `window` object, otherwise the `window` object is used. - */ - var root = freeGlobal || ((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) || freeSelf || thisGlobal || Function('return this')(); - - /*--------------------------------------------------------------------------*/ - - /** - * Adds the key-value `pair` to `map`. - * - * @private - * @param {Object} map The map to modify. - * @param {Array} pair The key-value pair to add. - * @returns {Object} Returns `map`. - */ - function addMapEntry(map, pair) { - map.set(pair[0], pair[1]); - return map; - } - - /** - * Adds `value` to `set`. - * - * @private - * @param {Object} set The set to modify. - * @param {*} value The value to add. - * @returns {Object} Returns `set`. - */ - function addSetEntry(set, value) { - set.add(value); - return set; - } - - /** - * A faster alternative to `Function#apply`, this function invokes `func` - * with the `this` binding of `thisArg` and the arguments of `args`. - * - * @private - * @param {Function} func The function to invoke. - * @param {*} thisArg The `this` binding of `func`. - * @param {...*} [args] The arguments to invoke `func` with. - * @returns {*} Returns the result of `func`. - */ - function apply(func, thisArg, args) { - var length = args ? args.length : 0; - switch (length) { - case 0: return func.call(thisArg); - case 1: return func.call(thisArg, args[0]); - case 2: return func.call(thisArg, args[0], args[1]); - case 3: return func.call(thisArg, args[0], args[1], args[2]); - } - return func.apply(thisArg, args); - } - - /** - * Creates a new array concatenating `array` with `other`. - * - * @private - * @param {Array} array The first array to concatenate. - * @param {Array} other The second array to concatenate. - * @returns {Array} Returns the new concatenated array. - */ - function arrayConcat(array, other) { - var index = -1, - length = array.length, - othIndex = -1, - othLength = other.length, - result = Array(length + othLength); - - while (++index < length) { - result[index] = array[index]; - } - while (++othIndex < othLength) { - result[index++] = other[othIndex]; - } - return result; - } - - /** - * A specialized version of `_.forEach` for arrays without support for - * callback shorthands. - * - * @private - * @param {Array} array The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns `array`. - */ - function arrayEach(array, iteratee) { - var index = -1, - length = array.length; - - while (++index < length) { - if (iteratee(array[index], index, array) === false) { - break; - } - } - return array; - } - - /** - * A specialized version of `_.forEachRight` for arrays without support for - * callback shorthands. - * - * @private - * @param {Array} array The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns `array`. - */ - function arrayEachRight(array, iteratee) { - var length = array.length; - - while (length--) { - if (iteratee(array[length], length, array) === false) { - break; - } - } - return array; - } - - /** - * A specialized version of `_.every` for arrays without support for - * callback shorthands. - * - * @private - * @param {Array} array The array to iterate over. - * @param {Function} predicate The function invoked per iteration. - * @returns {boolean} Returns `true` if all elements pass the predicate check, else `false`. - */ - function arrayEvery(array, predicate) { - var index = -1, - length = array.length; - - while (++index < length) { - if (!predicate(array[index], index, array)) { - return false; - } - } - return true; - } - - /** - * A specialized version of `_.filter` for arrays without support for - * callback shorthands. - * - * @private - * @param {Array} array The array to iterate over. - * @param {Function} predicate The function invoked per iteration. - * @returns {Array} Returns the new filtered array. - */ - function arrayFilter(array, predicate) { - var index = -1, - length = array.length, - resIndex = -1, - result = []; - - while (++index < length) { - var value = array[index]; - if (predicate(value, index, array)) { - result[++resIndex] = value; - } - } - return result; - } - - /** - * A specialized version of `_.includes` for arrays without support for - * specifying an index to search from. - * - * @private - * @param {Array} array The array to search. - * @param {*} target The value to search for. - * @returns {boolean} Returns `true` if `target` is found, else `false`. - */ - function arrayIncludes(array, value) { - return !!array.length && baseIndexOf(array, value, 0) > -1; - } - - /** - * A specialized version of `_.includesWith` for arrays without support for - * specifying an index to search from. - * - * @private - * @param {Array} array The array to search. - * @param {*} target The value to search for. - * @param {Function} comparator The comparator invoked per element. - * @returns {boolean} Returns `true` if `target` is found, else `false`. - */ - function arrayIncludesWith(array, value, comparator) { - var index = -1, - length = array.length; - - while (++index < length) { - if (comparator(value, array[index])) { - return true; - } - } - return false; - } - - /** - * A specialized version of `_.map` for arrays without support for callback - * shorthands. - * - * @private - * @param {Array} array The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns the new mapped array. - */ - function arrayMap(array, iteratee) { - var index = -1, - length = array.length, - result = Array(length); - - while (++index < length) { - result[index] = iteratee(array[index], index, array); - } - return result; - } - - /** - * Appends the elements of `values` to `array`. - * - * @private - * @param {Array} array The array to modify. - * @param {Array} values The values to append. - * @returns {Array} Returns `array`. - */ - function arrayPush(array, values) { - var index = -1, - length = values.length, - offset = array.length; - - while (++index < length) { - array[offset + index] = values[index]; - } - return array; - } - - /** - * A specialized version of `_.reduce` for arrays without support for - * callback shorthands. - * - * @private - * @param {Array} array The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @param {*} [accumulator] The initial value. - * @param {boolean} [initFromArray] Specify using the first element of `array` as the initial value. - * @returns {*} Returns the accumulated value. - */ - function arrayReduce(array, iteratee, accumulator, initFromArray) { - var index = -1, - length = array.length; - - if (initFromArray && length) { - accumulator = array[++index]; - } - while (++index < length) { - accumulator = iteratee(accumulator, array[index], index, array); - } - return accumulator; - } - - /** - * A specialized version of `_.reduceRight` for arrays without support for - * callback shorthands. - * - * @private - * @param {Array} array The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @param {*} [accumulator] The initial value. - * @param {boolean} [initFromArray] Specify using the last element of `array` as the initial value. - * @returns {*} Returns the accumulated value. - */ - function arrayReduceRight(array, iteratee, accumulator, initFromArray) { - var length = array.length; - if (initFromArray && length) { - accumulator = array[--length]; - } - while (length--) { - accumulator = iteratee(accumulator, array[length], length, array); - } - return accumulator; - } - - /** - * A specialized version of `_.some` for arrays without support for callback - * shorthands. - * - * @private - * @param {Array} array The array to iterate over. - * @param {Function} predicate The function invoked per iteration. - * @returns {boolean} Returns `true` if any element passes the predicate check, else `false`. - */ - function arraySome(array, predicate) { - var index = -1, - length = array.length; - - while (++index < length) { - if (predicate(array[index], index, array)) { - return true; - } - } - return false; - } - - /** - * Assigns `value` to `key` of `object` if the existing value is not equivalent - * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) - * for equality comparisons. - * - * @private - * @param {Object} object The object to modify. - * @param {string} key The key of the property to assign. - * @param {*} value The value to assign. - */ - function assignValue(object, key, value) { - var oldValue = object[key]; - if ((value === value ? (value !== oldValue) : (oldValue === oldValue)) || - (value === undefined && !(key in object))) { - object[key] = value; - } - } - - /** - * This function is like `assignValue` except that it doesn't assign `undefined` values. - * - * @private - * @param {Object} object The object to modify. - * @param {string} key The key of the property to assign. - * @param {*} value The value to assign. - */ - function assignMergeValue(object, key, value) { - var oldValue = object[key]; - if ((value !== undefined && - (value === value ? (value !== oldValue) : (oldValue === oldValue))) || - (typeof key == 'number' && - value === undefined && !(key in object))) { - object[key] = value; - } - } - - /** - * The base implementation of methods like `_.max` and `_.min` which accepts a - * `comparator` to determine the extremum value. - * - * @private - * @param {Array} array The array to iterate over. - * @param {Function} iteratee The iteratee invoked per iteration. - * @param {Function} comparator The comparator used to compare values. - * @returns {*} Returns the extremum value. - */ - function baseExtremum(array, iteratee, comparator) { - var index = -1, - length = array.length; - - while (++index < length) { - var value = array[index], - current = iteratee(value); - - if (current != null && (computed === undefined - ? current === current - : comparator(current, computed) - )) { - var computed = current, - result = value; - } - } - return result; - } - - /** - * The base implementation of methods like `_.find` and `_.findKey`, without - * support for callback shorthands, which iterates over `collection` using - * the provided `eachFunc`. - * - * @private - * @param {Array|Object} collection The collection to search. - * @param {Function} predicate The function invoked per iteration. - * @param {Function} eachFunc The function to iterate over `collection`. - * @param {boolean} [retKey] Specify returning the key of the found element instead of the element itself. - * @returns {*} Returns the found element or its key, else `undefined`. - */ - function baseFind(collection, predicate, eachFunc, retKey) { - var result; - eachFunc(collection, function(value, key, collection) { - if (predicate(value, key, collection)) { - result = retKey ? key : value; - return false; - } - }); - return result; - } - - /** - * The base implementation of `_.findIndex` and `_.findLastIndex` without - * support for callback shorthands. - * - * @private - * @param {Array} array The array to search. - * @param {Function} predicate The function invoked per iteration. - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {number} Returns the index of the matched value, else `-1`. - */ - function baseFindIndex(array, predicate, fromRight) { - var length = array.length, - index = fromRight ? length : -1; - - while ((fromRight ? index-- : ++index < length)) { - if (predicate(array[index], index, array)) { - return index; - } - } - return -1; - } - - /** - * The base implementation of `_.indexOf` without `fromIndex` bounds checks. - * - * @private - * @param {Array} array The array to search. - * @param {*} value The value to search for. - * @param {number} fromIndex The index to search from. - * @returns {number} Returns the index of the matched value, else `-1`. - */ - function baseIndexOf(array, value, fromIndex) { - if (value !== value) { - return indexOfNaN(array, fromIndex); - } - var index = fromIndex - 1, - length = array.length; - - while (++index < length) { - if (array[index] === value) { - return index; - } - } - return -1; - } - - /** - * The base implementation of `_.reduce` and `_.reduceRight`, without support - * for callback shorthands, which iterates over `collection` using the provided - * `eachFunc`. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @param {*} accumulator The initial value. - * @param {boolean} initFromCollection Specify using the first or last element of `collection` as the initial value. - * @param {Function} eachFunc The function to iterate over `collection`. - * @returns {*} Returns the accumulated value. - */ - function baseReduce(collection, iteratee, accumulator, initFromCollection, eachFunc) { - eachFunc(collection, function(value, index, collection) { - accumulator = initFromCollection - ? (initFromCollection = false, value) - : iteratee(accumulator, value, index, collection); - }); - return accumulator; - } - - /** - * The base implementation of `_.sortBy` which uses `comparer` to define - * the sort order of `array` and replaces criteria objects with their - * corresponding values. - * - * @private - * @param {Array} array The array to sort. - * @param {Function} comparer The function to define sort order. - * @returns {Array} Returns `array`. - */ - function baseSortBy(array, comparer) { - var length = array.length; - - array.sort(comparer); - while (length--) { - array[length] = array[length].value; - } - return array; - } - - /** - * The base implementation of `_.sum` without support for callback shorthands. - * - * @private - * @param {Array} array The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {number} Returns the sum. - */ - function baseSum(array, iteratee) { - var result, - index = -1, - length = array.length; - - while (++index < length) { - var current = iteratee(array[index]); - if (current !== undefined) { - result = result === undefined ? current : (result + current); - } - } - return result; - } - - /** - * The base implementation of `_.times` without support for callback shorthands - * or max array length checks. - * - * @private - * @param {number} n The number of times to invoke `iteratee`. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns the array of results. - */ - function baseTimes(n, iteratee) { - var index = -1, - result = Array(n); - - while (++index < n) { - result[index] = iteratee(index); - } - return result; - } - - /** - * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array - * of key-value pairs for `object` corresponding to the property names of `props`. - * - * @private - * @param {Object} object The object to query. - * @param {Array} props The property names to get values for. - * @returns {Object} Returns the new array of key-value pairs. - */ - function baseToPairs(object, props) { - return arrayMap(props, function(key) { - return [key, object[key]]; - }); - } - - /** - * The base implementation of `_.trim` without support trimming non-whitespace - * characters. - * - * @private - * @param {string} string The string to trim. - * @returns {string} Returns the trimmed string. - */ - function baseTrim(string) { - return string - ? string.slice(trimmedStartIndex(string), trimmedEndIndex(string) + 1) - : string; - } - - /** - * The base implementation of `_.unary` without support for storing wrapper metadata. - * - * @private - * @param {Function} func The function to cap arguments for. - * @returns {Function} Returns the new function. - */ - function baseUnary(func) { - return function(value) { - return func(value); - }; - } - - /** - * The base implementation of `_.values` and `_.valuesIn` which creates an - * array of `object` property values corresponding to the property names - * of `props`. - * - * @private - * @param {Object} object The object to query. - * @param {Array} props The property names to get values for. - * @returns {Object} Returns the array of property values. - */ - function baseValues(object, props) { - return arrayMap(props, function(key) { - return object[key]; - }); - } - - /** - * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol - * that is not found in the character symbols. - * - * @private - * @param {Array} strSymbols The string symbols to inspect. - * @param {Array} chrSymbols The character symbols to find. - * @returns {number} Returns the index of the first unmatched string symbol. - */ - function charsStartIndex(strSymbols, chrSymbols) { - var index = -1, - length = strSymbols.length; - - while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} - return index; - } - - /** - * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol - * that is not found in the character symbols. - * - * @private - * @param {Array} strSymbols The string symbols to inspect. - * @param {Array} chrSymbols The character symbols to find. - * @returns {number} Returns the index of the last unmatched string symbol. - */ - function charsEndIndex(strSymbols, chrSymbols) { - var index = strSymbols.length; - - while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} - return index; - } - - /** - * Checks if `value` is a global object. - * - * @private - * @param {*} value The value to check. - * @returns {null|Object} Returns `value` if it's a global object, else `null`. - */ - function checkGlobal(value) { - return (value && value.Object === Object) ? value : null; - } - - /** - * Compares values to sort them in ascending order. - * - * @private - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {number} Returns the sort order indicator for `value`. - */ - function compareAscending(value, other) { - if (value !== other) { - var valIsNull = value === null, - valIsUndef = value === undefined, - valIsReflexive = value === value; - - var othIsNull = other === null, - othIsUndef = other === undefined, - othIsReflexive = other === other; - - if ((value > other && !othIsNull) || !valIsReflexive || - (valIsNull && !othIsUndef && othIsReflexive) || - (valIsUndef && othIsReflexive)) { - return 1; - } - if ((value < other && !valIsNull) || !othIsReflexive || - (othIsNull && !valIsUndef && valIsReflexive) || - (othIsUndef && valIsReflexive)) { - return -1; - } - } - return 0; - } - - /** - * Used by `_.orderBy` to compare multiple properties of a value to another - * and stable sort them. - * - * If `orders` is unspecified, all values are sorted in ascending order. Otherwise, - * specify an order of "desc" for descending or "asc" for ascending sort order - * of corresponding values. - * - * @private - * @param {Object} object The object to compare. - * @param {Object} other The other object to compare. - * @param {boolean[]|string[]} orders The order to sort by for each property. - * @returns {number} Returns the sort order indicator for `object`. - */ - function compareMultiple(object, other, orders) { - var index = -1, - objCriteria = object.criteria, - othCriteria = other.criteria, - length = objCriteria.length, - ordersLength = orders.length; - - while (++index < length) { - var result = compareAscending(objCriteria[index], othCriteria[index]); - if (result) { - if (index >= ordersLength) { - return result; - } - var order = orders[index]; - return result * (order === 'desc' ? -1 : 1); - } - } - // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications - // that causes it, under certain circumstances, to provide the same value for - // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247 - // for more details. - // - // This also ensures a stable sort in V8 and other engines. - // See https://code.google.com/p/v8/issues/detail?id=90 for more details. - return object.index - other.index; - } - - /** - * Copies the values of `source` to `array`. - * - * @private - * @param {Array} source The array to copy values from. - * @param {Array} [array=[]] The array to copy values to. - * @returns {Array} Returns `array`. - */ - function copyArray(source, array) { - var index = -1, - length = source.length; - - array || (array = Array(length)); - while (++index < length) { - array[index] = source[index]; - } - return array; - } - - /** - * Copies properties of `source` to `object`. - * - * @private - * @param {Object} source The object to copy properties from. - * @param {Array} props The property names to copy. - * @param {Object} [object={}] The object to copy properties to. - * @returns {Object} Returns `object`. - */ - function copyObject(source, props, object) { - return copyObjectWith(source, props, object); - } - - /** - * This function is like `copyObject` except that it accepts a function to - * customize copied values. - * - * @private - * @param {Object} source The object to copy properties from. - * @param {Array} props The property names to copy. - * @param {Object} [object={}] The object to copy properties to. - * @param {Function} [customizer] The function to customize copied values. - * @returns {Object} Returns `object`. - */ - function copyObjectWith(source, props, object, customizer) { - object || (object = {}); - - var index = -1, - length = props.length; - - while (++index < length) { - var key = props[index], - newValue = customizer ? customizer(object[key], source[key], key, object, source) : source[key]; - - assignValue(object, key, newValue); - } - return object; - } - - /** - * Used by `_.deburr` to convert latin-1 supplementary letters to basic latin letters. - * - * @private - * @param {string} letter The matched letter to deburr. - * @returns {string} Returns the deburred letter. - */ - function deburrLetter(letter) { - return deburredLetters[letter]; - } - - /** - * Used by `_.escape` to convert characters to HTML entities. - * - * @private - * @param {string} chr The matched character to escape. - * @returns {string} Returns the escaped character. - */ - function escapeHtmlChar(chr) { - return htmlEscapes[chr]; - } - - /** - * Used by `_.template` to escape characters for inclusion in compiled string literals. - * - * @private - * @param {string} chr The matched character to escape. - * @returns {string} Returns the escaped character. - */ - function escapeStringChar(chr) { - return '\\' + stringEscapes[chr]; - } - - /** - * Gets the index at which the first occurrence of `NaN` is found in `array`. - * - * @private - * @param {Array} array The array to search. - * @param {number} fromIndex The index to search from. - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {number} Returns the index of the matched `NaN`, else `-1`. - */ - function indexOfNaN(array, fromIndex, fromRight) { - var length = array.length, - index = fromIndex + (fromRight ? 0 : -1); - - while ((fromRight ? index-- : ++index < length)) { - var other = array[index]; - if (other !== other) { - return index; - } - } - return -1; - } - - /** - * Checks if `value` is a host object in IE < 9. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a host object, else `false`. - */ - function isHostObject(value) { - // Many host objects are `Object` objects that can coerce to strings - // despite having improperly defined `toString` methods. - var result = false; - if (value != null && typeof value.toString != 'function') { - try { - result = !!(value + ''); - } catch (e) {} - } - return result; - } - - /** - * Checks if `value` is a valid array-like index. - * - * @private - * @param {*} value The value to check. - * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. - * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. - */ - function isIndex(value, length) { - value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1; - length = length == null ? MAX_SAFE_INTEGER : length; - return value > -1 && value % 1 == 0 && value < length; - } - - /** - * Used by `trimmedStartIndex` and `trimmedEndIndex` to determine if a - * character code is whitespace. - * - * @private - * @param {number} charCode The character code to inspect. - * @returns {boolean} Returns `true` if `charCode` is whitespace, else `false`. - */ - function isSpace(charCode) { - return ((charCode <= 160 && (charCode >= 9 && charCode <= 13) || charCode == 32 || charCode == 160) || charCode == 5760 || charCode == 6158 || - (charCode >= 8192 && (charCode <= 8202 || charCode == 8232 || charCode == 8233 || charCode == 8239 || charCode == 8287 || charCode == 12288 || charCode == 65279))); - } - - /** - * Converts `iterator` to an array. - * - * @private - * @param {Object} iterator The iterator to convert. - * @returns {Array} Returns the converted array. - */ - function iteratorToArray(iterator) { - var data, - result = []; - - while (!(data = iterator.next()).done) { - result.push(data.value); - } - return result; - } - - /** - * Converts `map` to an array. - * - * @private - * @param {Object} map The map to convert. - * @returns {Array} Returns the converted array. - */ - function mapToArray(map) { - var index = -1, - result = Array(map.size); - - map.forEach(function(value, key) { - result[++index] = [key, value]; - }); - return result; - } - - /** - * Replaces all `placeholder` elements in `array` with an internal placeholder - * and returns an array of their indexes. - * - * @private - * @param {Array} array The array to modify. - * @param {*} placeholder The placeholder to replace. - * @returns {Array} Returns the new array of placeholder indexes. - */ - function replaceHolders(array, placeholder) { - var index = -1, - length = array.length, - resIndex = -1, - result = []; - - while (++index < length) { - if (array[index] === placeholder) { - array[index] = PLACEHOLDER; - result[++resIndex] = index; - } - } - return result; - } - - /** - * Converts `set` to an array. - * - * @private - * @param {Object} set The set to convert. - * @returns {Array} Returns the converted array. - */ - function setToArray(set) { - var index = -1, - result = Array(set.size); - - set.forEach(function(value) { - result[++index] = value; - }); - return result; - } - - /** - * Gets the number of symbols in `string`. - * - * @param {string} string The string to inspect. - * @returns {number} Returns the string size. - */ - function stringSize(string) { - if (!(string && reHasComplexSymbol.test(string))) { - return string.length; - } - var result = reComplexSymbol.lastIndex = 0; - while (reComplexSymbol.test(string)) { - result++; - } - return result; - } - - /** - * Converts `string` to an array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the converted array. - */ - function stringToArray(string) { - return string ? string.match(reComplexSymbol) : []; - } - - /** - * Used by `_.trim` and `_.trimStart` to get the index of the first non-whitespace - * character of `string`. - * - * @private - * @param {string} string The string to inspect. - * @returns {number} Returns the index of the first non-whitespace character. - */ - function trimmedStartIndex(string) { - var index = -1, - length = string.length; - - while (++index < length && isSpace(string.charCodeAt(index))) {} - return index; - } - - /** - * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace - * character of `string`. - * - * @private - * @param {string} string The string to inspect. - * @returns {number} Returns the index of the last non-whitespace character. - */ - function trimmedEndIndex(string) { - var index = string.length; - - while (index-- && isSpace(string.charCodeAt(index))) {} - return index; - } - - /** - * Used by `_.unescape` to convert HTML entities to characters. - * - * @private - * @param {string} chr The matched character to unescape. - * @returns {string} Returns the unescaped character. - */ - function unescapeHtmlChar(chr) { - return htmlUnescapes[chr]; - } - - /*--------------------------------------------------------------------------*/ - - /** - * Create a new pristine `lodash` function using the `context` object. - * - * @static - * @memberOf _ - * @category Utility - * @param {Object} [context=root] The context object. - * @returns {Function} Returns a new `lodash` function. - * @example - * - * _.mixin({ 'foo': _.constant('foo') }); - * - * var lodash = _.runInContext(); - * lodash.mixin({ 'bar': lodash.constant('bar') }); - * - * _.isFunction(_.foo); - * // => true - * _.isFunction(_.bar); - * // => false - * - * lodash.isFunction(lodash.foo); - * // => false - * lodash.isFunction(lodash.bar); - * // => true - * - * // using `context` to mock `Date#getTime` use in `_.now` - * var mock = _.runInContext({ - * 'Date': function() { - * return { 'getTime': getTimeMock }; - * } - * }); - * - * // or creating a suped-up `defer` in Node.js - * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer; - */ - function runInContext(context) { - context = context ? _.defaults({}, context, _.pick(root, contextProps)) : root; - - /** Built-in constructor references. */ - var Date = context.Date, - Error = context.Error, - Math = context.Math, - RegExp = context.RegExp, - TypeError = context.TypeError; - - /** Used for built-in method references. */ - var arrayProto = context.Array.prototype, - objectProto = context.Object.prototype, - stringProto = context.String.prototype; - - /** Used to resolve the decompiled source of functions. */ - var fnToString = context.Function.prototype.toString; - - /** Used to check objects for own properties. */ - var hasOwnProperty = objectProto.hasOwnProperty; - - /** Used to generate unique IDs. */ - var idCounter = 0; - - /** Used to infer the `Object` constructor. */ - var objCtorString = fnToString.call(Object); - - /** - * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) - * of values. - */ - var objToString = objectProto.toString; - - /** Used to restore the original `_` reference in `_.noConflict`. */ - var oldDash = root._; - - /** Used to detect if a method is native. */ - var reIsNative = RegExp('^' + - fnToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') - .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' - ); - - /** Built-in value references. */ - var Reflect = context.Reflect, - Symbol = context.Symbol, - Uint8Array = context.Uint8Array, - clearTimeout = context.clearTimeout, - enumerate = Reflect ? Reflect.enumerate : undefined, - getPrototypeOf = Object.getPrototypeOf, - iteratorSymbol = typeof (iteratorSymbol = Symbol && Symbol.iterator) == 'symbol' ? iteratorSymbol : undefined, - parseFloat = context.parseFloat, - pow = Math.pow, - propertyIsEnumerable = objectProto.propertyIsEnumerable, - setTimeout = context.setTimeout, - splice = arrayProto.splice; - - /* Built-in method references for those with the same name as other `lodash` methods. */ - var nativeCeil = Math.ceil, - nativeFloor = Math.floor, - nativeIsFinite = context.isFinite, - nativeJoin = arrayProto.join, - nativeKeys = Object.keys, - nativeMax = Math.max, - nativeMin = Math.min, - nativeParseInt = context.parseInt, - nativeRandom = Math.random, - nativeReverse = arrayProto.reverse; - - /* Built-in method references that are verified to be native. */ - var Map = getNative(context, 'Map'), - Set = getNative(context, 'Set'), - WeakMap = getNative(context, 'WeakMap'), - nativeCreate = getNative(Object, 'create'); - - /** Used to store function metadata. */ - var metaMap = WeakMap && new WeakMap; - - /** Used to detect maps and sets. */ - var mapCtorString = Map ? fnToString.call(Map) : '', - setCtorString = Set ? fnToString.call(Set) : ''; - - /** Used to lookup unminified function names. */ - var realNames = {}; - - /*------------------------------------------------------------------------*/ - - /** - * Creates a `lodash` object which wraps `value` to enable implicit method - * chaining. Methods that operate on and return arrays, collections, and - * functions can be chained together. Methods that retrieve a single value or - * may return a primitive value will automatically end the chain sequence and - * return the unwrapped value. Otherwise, the value must be unwrapped with - * `_#value`. - * - * Explicit chaining, which must be unwrapped with `_#value` in all cases, - * may be enabled using `_.chain`. - * - * The execution of chained methods is lazy, that is, execution is deferred - * until `_#value` is implicitly or explicitly called. - * - * Lazy evaluation allows several methods to support shortcut fusion. Shortcut - * fusion is an optimization strategy which merge iteratee calls; this can help - * to avoid the creation of intermediate data structures and greatly reduce the - * number of iteratee executions. Sections of a chain sequence may qualify for - * shortcut fusion if the section is applied to an array of at least two hundred - * elements and any iteratees or predicates accept only one argument. The - * heuristic for whether a section qualifies for shortcut fusion is subject - * to change. - * - * Chaining is supported in custom builds as long as the `_#value` method is - * directly or indirectly included in the build. - * - * In addition to lodash methods, wrappers have `Array` and `String` methods. - * - * The wrapper `Array` methods are: - * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift` - * - * The wrapper `String` methods are: - * `replace` and `split` - * - * The wrapper methods that support shortcut fusion are: - * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`, - * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`, - * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray` - * - * The chainable wrapper methods are: - * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, - * `at`, `before`, `bind`, `bindAll`, `bindKey`, `chain`, `chunk`, `commit`, - * `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`, `curry`, - * `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`, `difference`, - * `differenceBy`, `differenceWith`, `drop`, `dropRight`, `dropRightWhile`, - * `dropWhile`, `fill`, `filter`, `flatten`, `flattenDeep`, `flip`, `flow`, - * `flowRight`, `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`, - * `forOwnRight`, `fromPairs`, `functions`, `functionsIn`, `groupBy`, `initial`, - * `intersection`, `intersectionBy`, `intersectionWith`, invert`, `invokeMap`, - * `iteratee`, `keyBy`, `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, - * `matches`, `matchesProperty`, `memoize`, `merge`, `mergeWith`, `method`, - * `methodOf`, `mixin`, `negate`, `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, - * `over`, `overArgs`, `overEvery`, `overSome`, `partial`, `partialRight`, - * `partition`, `pick`, `pickBy`, `plant`, `property`, `propertyOf`, `pull`, - * `pullAll`, `pullAllBy`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, - * `reject`, `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, - * `shuffle`, `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, - * `takeRight`, `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, - * `toArray`, `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, - * `unary`, `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, - * `unset`, `unshift`, `unzip`, `unzipWith`, `values`, `valuesIn`, `without`, - * `wrap`, `xor`, `xorBy`, `xorWith`, `zip`, `zipObject`, and `zipWith` - * - * The wrapper methods that are **not** chainable by default are: - * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`, - * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `deburr`, `endsWith`, `eq`, - * `escape`, `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, - * `findLast`, `findLastIndex`, `findLastKey`, `floor`, `get`, `gt`, `gte`, - * `has`, `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, - * `invoke`, `isArguments`, `isArray`, `isArrayLike`, `isArrayLikeObject`, - * `isBoolean`, `isDate`, `isElement`, `isEmpty`, `isEqual`, `isEqualWith`, - * `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`, `isMatch`, - * `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`, `isNumber`, - * `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`, `isSafeInteger`, - * `isString`, `isUndefined`, `isTypedArray`, `join`, `kebabCase`, `last`, - * `lastIndexOf`, `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, - * `mean`, `min`, `minBy`, `noConflict`, `noop`, `now`, `pad`, `padEnd`, - * `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`, `repeat`, - * `result`, `round`, `runInContext`, `sample`, `shift`, `size`, `snakeCase`, - * `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`, `sortedLastIndexBy`, - * `startCase`, `startsWith`, `subtract`, `sum`, sumBy`, `template`, `times`, - * `toLower`, `toInteger`, `toLength`, `toNumber`, `toSafeInteger`, toString`, - * `toUpper`, `trim`, `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, - * `upperCase`, `upperFirst`, `value`, and `words` - * - * @name _ - * @constructor - * @category Chain - * @param {*} value The value to wrap in a `lodash` instance. - * @returns {Object} Returns the new `lodash` wrapper instance. - * @example - * - * function square(n) { - * return n * n; - * } - * - * var wrapped = _([1, 2, 3]); - * - * // returns an unwrapped value - * wrapped.reduce(_.add); - * // => 6 - * - * // returns a wrapped value - * var squares = wrapped.map(square); - * - * _.isArray(squares); - * // => false - * - * _.isArray(squares.value()); - * // => true - */ - function lodash(value) { - if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) { - if (value instanceof LodashWrapper) { - return value; - } - if (hasOwnProperty.call(value, '__wrapped__')) { - return wrapperClone(value); - } - } - return new LodashWrapper(value); - } - - /** - * The function whose prototype all chaining wrappers inherit from. - * - * @private - */ - function baseLodash() { - // No operation performed. - } - - /** - * The base constructor for creating `lodash` wrapper objects. - * - * @private - * @param {*} value The value to wrap. - * @param {boolean} [chainAll] Enable chaining for all wrapper methods. - */ - function LodashWrapper(value, chainAll) { - this.__wrapped__ = value; - this.__actions__ = []; - this.__chain__ = !!chainAll; - this.__index__ = 0; - this.__values__ = undefined; - } - - /** - * By default, the template delimiters used by lodash are like those in - * embedded Ruby (ERB). Change the following template settings to use - * alternative delimiters. - * - * @static - * @memberOf _ - * @type Object - */ - lodash.templateSettings = { - - /** - * Used to detect `data` property values to be HTML-escaped. - * - * @memberOf _.templateSettings - * @type RegExp - */ - 'escape': reEscape, - - /** - * Used to detect code to be evaluated. - * - * @memberOf _.templateSettings - * @type RegExp - */ - 'evaluate': reEvaluate, - - /** - * Used to detect `data` property values to inject. - * - * @memberOf _.templateSettings - * @type RegExp - */ - 'interpolate': reInterpolate, - - /** - * Used to reference the data object in the template text. - * - * @memberOf _.templateSettings - * @type string - */ - 'variable': '', - - /** - * Used to import variables into the compiled template. - * - * @memberOf _.templateSettings - * @type Object - */ - 'imports': { - - /** - * A reference to the `lodash` function. - * - * @memberOf _.templateSettings.imports - * @type Function - */ - '_': lodash - } - }; - - /*------------------------------------------------------------------------*/ - - /** - * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation. - * - * @private - * @param {*} value The value to wrap. - */ - function LazyWrapper(value) { - this.__wrapped__ = value; - this.__actions__ = []; - this.__dir__ = 1; - this.__filtered__ = false; - this.__iteratees__ = []; - this.__takeCount__ = MAX_ARRAY_LENGTH; - this.__views__ = []; - } - - /** - * Creates a clone of the lazy wrapper object. - * - * @private - * @name clone - * @memberOf LazyWrapper - * @returns {Object} Returns the cloned `LazyWrapper` object. - */ - function lazyClone() { - var result = new LazyWrapper(this.__wrapped__); - result.__actions__ = copyArray(this.__actions__); - result.__dir__ = this.__dir__; - result.__filtered__ = this.__filtered__; - result.__iteratees__ = copyArray(this.__iteratees__); - result.__takeCount__ = this.__takeCount__; - result.__views__ = copyArray(this.__views__); - return result; - } - - /** - * Reverses the direction of lazy iteration. - * - * @private - * @name reverse - * @memberOf LazyWrapper - * @returns {Object} Returns the new reversed `LazyWrapper` object. - */ - function lazyReverse() { - if (this.__filtered__) { - var result = new LazyWrapper(this); - result.__dir__ = -1; - result.__filtered__ = true; - } else { - result = this.clone(); - result.__dir__ *= -1; - } - return result; - } - - /** - * Extracts the unwrapped value from its lazy wrapper. - * - * @private - * @name value - * @memberOf LazyWrapper - * @returns {*} Returns the unwrapped value. - */ - function lazyValue() { - var array = this.__wrapped__.value(), - dir = this.__dir__, - isArr = isArray(array), - isRight = dir < 0, - arrLength = isArr ? array.length : 0, - view = getView(0, arrLength, this.__views__), - start = view.start, - end = view.end, - length = end - start, - index = isRight ? end : (start - 1), - iteratees = this.__iteratees__, - iterLength = iteratees.length, - resIndex = 0, - takeCount = nativeMin(length, this.__takeCount__); - - if (!isArr || arrLength < LARGE_ARRAY_SIZE || (arrLength == length && takeCount == length)) { - return baseWrapperValue(array, this.__actions__); - } - var result = []; - - outer: - while (length-- && resIndex < takeCount) { - index += dir; - - var iterIndex = -1, - value = array[index]; - - while (++iterIndex < iterLength) { - var data = iteratees[iterIndex], - iteratee = data.iteratee, - type = data.type, - computed = iteratee(value); - - if (type == LAZY_MAP_FLAG) { - value = computed; - } else if (!computed) { - if (type == LAZY_FILTER_FLAG) { - continue outer; - } else { - break outer; - } - } - } - result[resIndex++] = value; - } - return result; - } - - /*------------------------------------------------------------------------*/ - - /** - * Creates an hash object. - * - * @private - * @returns {Object} Returns the new hash object. - */ - function Hash() {} - - /** - * Removes `key` and its value from the hash. - * - * @private - * @param {Object} hash The hash to modify. - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ - function hashDelete(hash, key) { - return hashHas(hash, key) && delete hash[key]; - } - - /** - * Gets the hash value for `key`. - * - * @private - * @param {Object} hash The hash to query. - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ - function hashGet(hash, key) { - if (nativeCreate) { - var result = hash[key]; - return result === HASH_UNDEFINED ? undefined : result; - } - return hasOwnProperty.call(hash, key) ? hash[key] : undefined; - } - - /** - * Checks if a hash value for `key` exists. - * - * @private - * @param {Object} hash The hash to query. - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ - function hashHas(hash, key) { - return nativeCreate ? hash[key] !== undefined : hasOwnProperty.call(hash, key); - } - - /** - * Sets the hash `key` to `value`. - * - * @private - * @param {Object} hash The hash to modify. - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - */ - function hashSet(hash, key, value) { - hash[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; - } - - /*------------------------------------------------------------------------*/ - - /** - * Creates a map cache object to store key-value pairs. - * - * @private - * @param {Array} [values] The values to cache. - */ - function MapCache(values) { - var index = -1, - length = values ? values.length : 0; - - this.clear(); - while (++index < length) { - var entry = values[index]; - this.set(entry[0], entry[1]); - } - } - - /** - * Removes all key-value entries from the map. - * - * @private - * @name clear - * @memberOf MapCache - */ - function mapClear() { - this.__data__ = { 'hash': new Hash, 'map': Map ? new Map : [], 'string': new Hash }; - } - - /** - * Removes `key` and its value from the map. - * - * @private - * @name delete - * @memberOf MapCache - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ - function mapDelete(key) { - var data = this.__data__; - if (isKeyable(key)) { - return hashDelete(typeof key == 'string' ? data.string : data.hash, key); - } - return Map ? data.map['delete'](key) : assocDelete(data.map, key); - } - - /** - * Gets the map value for `key`. - * - * @private - * @name get - * @memberOf MapCache - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ - function mapGet(key) { - var data = this.__data__; - if (isKeyable(key)) { - return hashGet(typeof key == 'string' ? data.string : data.hash, key); - } - return Map ? data.map.get(key) : assocGet(data.map, key); - } - - /** - * Checks if a map value for `key` exists. - * - * @private - * @name has - * @memberOf MapCache - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ - function mapHas(key) { - var data = this.__data__; - if (isKeyable(key)) { - return hashHas(typeof key == 'string' ? data.string : data.hash, key); - } - return Map ? data.map.has(key) : assocHas(data.map, key); - } - - /** - * Sets the map `key` to `value`. - * - * @private - * @name set - * @memberOf MapCache - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the map cache object. - */ - function mapSet(key, value) { - var data = this.__data__; - if (isKeyable(key)) { - hashSet(typeof key == 'string' ? data.string : data.hash, key, value); - } else if (Map) { - data.map.set(key, value); - } else { - assocSet(data.map, key, value); - } - return this; - } - - /*------------------------------------------------------------------------*/ - - /** - * - * Creates a set cache object to store unique values. - * - * @private - * @param {Array} [values] The values to cache. - */ - function SetCache(values) { - var index = -1, - length = values ? values.length : 0; - - this.__data__ = new MapCache; - while (++index < length) { - this.push(values[index]); - } - } - - /** - * Checks if `value` is in `cache`. - * - * @private - * @param {Object} cache The set cache to search. - * @param {*} value The value to search for. - * @returns {number} Returns `true` if `value` is found, else `false`. - */ - function cacheHas(cache, value) { - var map = cache.__data__; - if (isKeyable(value)) { - var data = map.__data__, - hash = typeof value == 'string' ? data.string : data.hash; - - return hash[value] === HASH_UNDEFINED; - } - return map.has(value); - } - - /** - * Adds `value` to the set cache. - * - * @private - * @name push - * @memberOf SetCache - * @param {*} value The value to cache. - */ - function cachePush(value) { - var map = this.__data__; - if (isKeyable(value)) { - var data = map.__data__, - hash = typeof value == 'string' ? data.string : data.hash; - - hash[value] = HASH_UNDEFINED; - } - else { - map.set(value, HASH_UNDEFINED); - } - } - - /*------------------------------------------------------------------------*/ - - /** - * Creates a stack cache object to store key-value pairs. - * - * @private - * @param {Array} [values] The values to cache. - */ - function Stack(values) { - var index = -1, - length = values ? values.length : 0; - - this.__data__ = { 'array': [], 'map': null }; - while (++index < length) { - var entry = values[index]; - this.set(entry[0], entry[1]); - } - } - - /** - * Removes `key` and its value from the stack. - * - * @private - * @name delete - * @memberOf Stack - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ - function stackDelete(key) { - var data = this.__data__, - array = data.array; - - return array ? assocDelete(array, key) : data.map['delete'](key); - } - - /** - * Gets the stack value for `key`. - * - * @private - * @name get - * @memberOf Stack - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ - function stackGet(key) { - var data = this.__data__, - array = data.array; - - return array ? assocGet(array, key) : data.map.get(key); - } - - /** - * Checks if a stack value for `key` exists. - * - * @private - * @name has - * @memberOf Stack - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ - function stackHas(key) { - var data = this.__data__, - array = data.array; - - return array ? assocHas(array, key) : data.map.has(key); - } - - /** - * Sets the stack `key` to `value`. - * - * @private - * @name set - * @memberOf Stack - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the stack cache object. - */ - function stackSet(key, value) { - var data = this.__data__, - array = data.array; - - if (array) { - if (array.length < (LARGE_ARRAY_SIZE - 1)) { - assocSet(array, key, value); - } else { - data.array = null; - data.map = new MapCache(array); - } - } - var map = data.map; - if (map) { - map.set(key, value); - } - return this; - } - - /*------------------------------------------------------------------------*/ - - /** - * Removes `key` and its value from the associative array. - * - * @private - * @param {Array} array The array to query. - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ - function assocDelete(array, key) { - var index = assocIndexOf(array, key); - if (index < 0) { - return false; - } - var lastIndex = array.length - 1; - if (index == lastIndex) { - array.pop(); - } else { - splice.call(array, index, 1); - } - return true; - } - - /** - * Gets the associative array value for `key`. - * - * @private - * @param {Array} array The array to query. - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ - function assocGet(array, key) { - var index = assocIndexOf(array, key); - return index < 0 ? undefined : array[index][1]; - } - - /** - * Checks if an associative array value for `key` exists. - * - * @private - * @param {Array} array The array to query. - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ - function assocHas(array, key) { - return assocIndexOf(array, key) > -1; - } - - /** - * Gets the index at which the first occurrence of `key` is found in `array` - * of key-value pairs. - * - * @private - * @param {Array} array The array to search. - * @param {*} key The key to search for. - * @returns {number} Returns the index of the matched value, else `-1`. - */ - function assocIndexOf(array, key) { - var length = array.length; - while (length--) { - if (array[length][0] === key) { - return length; - } - } - return -1; - } - - /** - * Sets the associative array `key` to `value`. - * - * @private - * @param {Array} array The array to modify. - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - */ - function assocSet(array, key, value) { - var index = assocIndexOf(array, key); - if (index < 0) { - array.push([key, value]); - } else { - array[index][1] = value; - } - } - - /*------------------------------------------------------------------------*/ - - /** - * Used by `_.defaults` to customize its `_.assignIn` use. - * - * @private - * @param {*} objValue The destination value. - * @param {*} srcValue The source value. - * @param {string} key The key of the property to assign. - * @param {Object} object The parent object of `objValue`. - * @returns {*} Returns the value to assign. - */ - function assignInDefaults(objValue, srcValue, key, object) { - if (objValue === undefined || - (objValue === objectProto[key] && !hasOwnProperty.call(object, key))) { - return srcValue; - } - return objValue; - } - - /** - * The base implementation of `_.assign` without support for multiple sources - * or `customizer` functions. - * - * @private - * @param {Object} object The destination object. - * @param {Object} source The source object. - * @returns {Object} Returns `object`. - */ - function baseAssign(object, source) { - return object && copyObject(source, keys(source), object); - } - - /** - * The base implementation of `_.at` without support for individual paths. - * - * @private - * @param {Object} object The object to iterate over. - * @param {string[]} paths The property paths of elements to pick. - * @returns {Array} Returns the new array of picked elements. - */ - function baseAt(object, paths) { - var index = -1, - isNil = object == null, - length = paths.length, - result = Array(length); - - while (++index < length) { - result[index] = isNil ? undefined : get(object, paths[index]); - } - return result; - } - - /** - * The base implementation of `_.clone` and `_.cloneDeep` which tracks - * traversed objects. - * - * @private - * @param {*} value The value to clone. - * @param {boolean} [isDeep] Specify a deep clone. - * @param {Function} [customizer] The function to customize cloning. - * @param {string} [key] The key of `value`. - * @param {Object} [object] The parent object of `value`. - * @param {Object} [stack] Tracks traversed objects and their clone counterparts. - * @returns {*} Returns the cloned value. - */ - function baseClone(value, isDeep, customizer, key, object, stack) { - var result; - if (customizer) { - result = object ? customizer(value, key, object, stack) : customizer(value); - } - if (result !== undefined) { - return result; - } - if (!isObject(value)) { - return value; - } - var isArr = isArray(value); - if (isArr) { - result = initCloneArray(value); - if (!isDeep) { - return copyArray(value, result); - } - } else { - var tag = getTag(value), - isFunc = tag == funcTag || tag == genTag; - - if (tag == objectTag || tag == argsTag || (isFunc && !object)) { - if (isHostObject(value)) { - return object ? value : {}; - } - result = initCloneObject(isFunc ? {} : value); - if (!isDeep) { - return baseAssign(result, value); - } - } else { - return cloneableTags[tag] - ? initCloneByTag(value, tag, isDeep) - : (object ? value : {}); - } - } - // Check for circular references and return its corresponding clone. - stack || (stack = new Stack); - var stacked = stack.get(value); - if (stacked) { - return stacked; - } - stack.set(value, result); - - // Recursively populate clone (susceptible to call stack limits). - (isArr ? arrayEach : baseForOwn)(value, function(subValue, key) { - result[key] = baseClone(subValue, isDeep, customizer, key, value, stack); - }); - return result; - } - - /** - * The base implementation of `_.conforms` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property predicates to conform to. - * @returns {Function} Returns the new function. - */ - function baseConforms(source) { - var props = keysIn(source), - length = props.length; - - return function(object) { - if (object == null) { - return !length; - } - var index = length; - while (index--) { - var key = props[index], - predicate = source[key], - value = object[key]; - - if ((value === undefined && !(key in Object(object))) || !predicate(value)) { - return false; - } - } - return true; - }; - } - - /** - * The base implementation of `_.create` without support for assigning - * properties to the created object. - * - * @private - * @param {Object} prototype The object to inherit from. - * @returns {Object} Returns the new object. - */ - var baseCreate = (function() { - function object() {} - return function(prototype) { - if (isObject(prototype)) { - object.prototype = prototype; - var result = new object; - object.prototype = undefined; - } - return result || {}; - }; - }()); - - /** - * The base implementation of `_.delay` and `_.defer` which accepts an array - * of `func` arguments. - * - * @private - * @param {Function} func The function to delay. - * @param {number} wait The number of milliseconds to delay invocation. - * @param {Object} args The arguments provide to `func`. - * @returns {number} Returns the timer id. - */ - function baseDelay(func, wait, args) { - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - return setTimeout(function() { func.apply(undefined, args); }, wait); - } - - /** - * The base implementation of methods like `_.difference` without support for - * excluding multiple arrays or callback shorthands. - * - * @private - * @param {Array} array The array to inspect. - * @param {Array} values The values to exclude. - * @param {Function} [iteratee] The iteratee invoked per element. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of filtered values. - */ - function baseDifference(array, values, iteratee, comparator) { - var index = -1, - includes = arrayIncludes, - isCommon = true, - length = array.length, - result = [], - valuesLength = values.length; - - if (!length) { - return result; - } - if (iteratee) { - values = arrayMap(values, baseUnary(iteratee)); - } - if (comparator) { - includes = arrayIncludesWith; - isCommon = false; - } - else if (values.length >= LARGE_ARRAY_SIZE) { - includes = cacheHas; - isCommon = false; - values = new SetCache(values); - } - outer: - while (++index < length) { - var value = array[index], - computed = iteratee ? iteratee(value) : value; - - if (isCommon && computed === computed) { - var valuesIndex = valuesLength; - while (valuesIndex--) { - if (values[valuesIndex] === computed) { - continue outer; - } - } - result.push(value); - } - else if (!includes(values, computed, comparator)) { - result.push(value); - } - } - return result; - } - - /** - * The base implementation of `_.forEach` without support for callback shorthands. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array|Object} Returns `collection`. - */ - var baseEach = createBaseEach(baseForOwn); - - /** - * The base implementation of `_.forEachRight` without support for callback shorthands. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array|Object} Returns `collection`. - */ - var baseEachRight = createBaseEach(baseForOwnRight, true); - - /** - * The base implementation of `_.every` without support for callback shorthands. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} predicate The function invoked per iteration. - * @returns {boolean} Returns `true` if all elements pass the predicate check, else `false` - */ - function baseEvery(collection, predicate) { - var result = true; - baseEach(collection, function(value, index, collection) { - result = !!predicate(value, index, collection); - return result; - }); - return result; - } - - /** - * The base implementation of `_.fill` without an iteratee call guard. - * - * @private - * @param {Array} array The array to fill. - * @param {*} value The value to fill `array` with. - * @param {number} [start=0] The start position. - * @param {number} [end=array.length] The end position. - * @returns {Array} Returns `array`. - */ - function baseFill(array, value, start, end) { - var length = array.length; - - start = toInteger(start); - if (start < 0) { - start = -start > length ? 0 : (length + start); - } - end = (end === undefined || end > length) ? length : toInteger(end); - if (end < 0) { - end += length; - } - end = start > end ? 0 : toLength(end); - while (start < end) { - array[start++] = value; - } - return array; - } - - /** - * The base implementation of `_.filter` without support for callback shorthands. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} predicate The function invoked per iteration. - * @returns {Array} Returns the new filtered array. - */ - function baseFilter(collection, predicate) { - var result = []; - baseEach(collection, function(value, index, collection) { - if (predicate(value, index, collection)) { - result.push(value); - } - }); - return result; - } - - /** - * The base implementation of `_.flatten` with support for restricting flattening. - * - * @private - * @param {Array} array The array to flatten. - * @param {boolean} [isDeep] Specify a deep flatten. - * @param {boolean} [isStrict] Restrict flattening to arrays-like objects. - * @param {Array} [result=[]] The initial result value. - * @param {Object} [stack] Tracks traversed arrays. - * @returns {Array} Returns the new flattened array. - */ - function baseFlatten(array, isDeep, isStrict, result, stack) { - result || (result = []); - - var index = -1, - length = array.length; - - while (++index < length) { - var value = array[index]; - if (isArrayLikeObject(value) && - (isStrict || isArray(value) || isArguments(value))) { - if (isDeep) { - stack || (stack = new Stack); - if (stack.get(array)) { - return result; - } - stack.set(array, true); - - // Recursively flatten arrays (susceptible to call stack limits). - baseFlatten(value, isDeep, isStrict, result, stack); - - stack['delete'](array); - } - else { - arrayPush(result, value); - } - } else if (!isStrict) { - result[result.length] = value; - } - } - return result; - } - - /** - * The base implementation of `baseForIn` and `baseForOwn` which iterates - * over `object` properties returned by `keysFunc` invoking `iteratee` for - * each property. Iteratee functions may exit iteration early by explicitly - * returning `false`. - * - * @private - * @param {Object} object The object to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @param {Function} keysFunc The function to get the keys of `object`. - * @returns {Object} Returns `object`. - */ - var baseFor = createBaseFor(); - - /** - * This function is like `baseFor` except that it iterates over properties - * in the opposite order. - * - * @private - * @param {Object} object The object to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @param {Function} keysFunc The function to get the keys of `object`. - * @returns {Object} Returns `object`. - */ - var baseForRight = createBaseFor(true); - - /** - * The base implementation of `_.forIn` without support for callback shorthands. - * - * @private - * @param {Object} object The object to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Object} Returns `object`. - */ - function baseForIn(object, iteratee) { - return object == null ? object : baseFor(object, iteratee, keysIn); - } - - /** - * The base implementation of `_.forOwn` without support for callback shorthands. - * - * @private - * @param {Object} object The object to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Object} Returns `object`. - */ - function baseForOwn(object, iteratee) { - return object && baseFor(object, iteratee, keys); - } - - /** - * The base implementation of `_.forOwnRight` without support for callback shorthands. - * - * @private - * @param {Object} object The object to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Object} Returns `object`. - */ - function baseForOwnRight(object, iteratee) { - return object && baseForRight(object, iteratee, keys); - } - - /** - * The base implementation of `_.functions` which creates an array of - * `object` function property names filtered from those provided. - * - * @private - * @param {Object} object The object to inspect. - * @param {Array} props The property names to filter. - * @returns {Array} Returns the new array of filtered property names. - */ - function baseFunctions(object, props) { - return arrayFilter(props, function(key) { - return isFunction(object[key]); - }); - } - - /** - * The base implementation of `_.get` without support for default values. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @returns {*} Returns the resolved value. - */ - function baseGet(object, path) { - path = isKey(path, object) ? [path + ''] : baseToPath(path); - - var index = 0, - length = path.length; - - while (object != null && index < length) { - object = object[path[index++]]; - } - return (index && index == length) ? object : undefined; - } - - /** - * The base implementation of `_.has` without support for deep paths. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} key The key to check. - * @returns {boolean} Returns `true` if `key` exists, else `false`. - */ - function baseHas(object, key) { - // Avoid a bug in IE 10-11 where objects with a [[Prototype]] of `null`, - // that are composed entirely of index properties, return `false` for - // `hasOwnProperty` checks of them. - return hasOwnProperty.call(object, key) || - (typeof object == 'object' && key in object && getPrototypeOf(object) === null); - } - - /** - * The base implementation of `_.hasIn` without support for deep paths. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} key The key to check. - * @returns {boolean} Returns `true` if `key` exists, else `false`. - */ - function baseHasIn(object, key) { - return key in Object(object); - } - - /** - * The base implementation of methods like `_.intersection`, without support - * for callback shorthands, that accepts an array of arrays to inspect. - * - * @private - * @param {Array} arrays The arrays to inspect. - * @param {Function} [iteratee] The iteratee invoked per element. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of shared values. - */ - function baseIntersection(arrays, iteratee, comparator) { - var includes = comparator ? arrayIncludesWith : arrayIncludes, - othLength = arrays.length, - othIndex = othLength, - caches = Array(othLength), - result = []; - - while (othIndex--) { - var array = arrays[othIndex]; - if (othIndex && iteratee) { - array = arrayMap(array, baseUnary(iteratee)); - } - caches[othIndex] = !comparator && (iteratee || array.length >= 120) - ? new SetCache(othIndex && array) - : undefined; - } - array = arrays[0]; - - var index = -1, - length = array ? array.length : 0, - seen = caches[0]; - - outer: - while (++index < length) { - var value = array[index], - computed = iteratee ? iteratee(value) : value; - - if (!(seen ? cacheHas(seen, computed) : includes(result, computed, comparator))) { - var othIndex = othLength; - while (--othIndex) { - var cache = caches[othIndex]; - if (!(cache ? cacheHas(cache, computed) : includes(arrays[othIndex], computed, comparator))) { - continue outer; - } - } - if (seen) { - seen.push(computed); - } - result.push(value); - } - } - return result; - } - - /** - * The base implementation of `_.invoke` without support for individual - * method arguments. - * - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the method to invoke. - * @param {Array} args The arguments to invoke the method with. - * @returns {*} Returns the result of the invoked method. - */ - function baseInvoke(object, path, args) { - if (!isKey(path, object)) { - path = baseToPath(path); - object = parent(object, path); - path = last(path); - } - var func = object == null ? object : object[path]; - return func == null ? undefined : apply(func, object, args); - } - - /** - * The base implementation of `_.isEqual` which supports partial comparisons - * and tracks traversed objects. - * - * @private - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @param {Function} [customizer] The function to customize comparisons. - * @param {boolean} [bitmask] The bitmask of comparison flags. - * The bitmask may be composed of the following flags: - * 1 - Unordered comparison - * 2 - Partial comparison - * @param {Object} [stack] Tracks traversed `value` and `other` objects. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - */ - function baseIsEqual(value, other, customizer, bitmask, stack) { - if (value === other) { - return true; - } - if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) { - return value !== value && other !== other; - } - return baseIsEqualDeep(value, other, baseIsEqual, customizer, bitmask, stack); - } - - /** - * A specialized version of `baseIsEqual` for arrays and objects which performs - * deep comparisons and tracks traversed objects enabling objects with circular - * references to be compared. - * - * @private - * @param {Object} object The object to compare. - * @param {Object} other The other object to compare. - * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Function} [customizer] The function to customize comparisons. - * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual` for more details. - * @param {Object} [stack] Tracks traversed `object` and `other` objects. - * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. - */ - function baseIsEqualDeep(object, other, equalFunc, customizer, bitmask, stack) { - var objIsArr = isArray(object), - othIsArr = isArray(other), - objTag = arrayTag, - othTag = arrayTag; - - if (!objIsArr) { - objTag = getTag(object); - if (objTag == argsTag) { - objTag = objectTag; - } else if (objTag != objectTag) { - objIsArr = isTypedArray(object); - } - } - if (!othIsArr) { - othTag = getTag(other); - if (othTag == argsTag) { - othTag = objectTag; - } else if (othTag != objectTag) { - othIsArr = isTypedArray(other); - } - } - var objIsObj = objTag == objectTag && !isHostObject(object), - othIsObj = othTag == objectTag && !isHostObject(other), - isSameTag = objTag == othTag; - - if (isSameTag && !(objIsArr || objIsObj)) { - return equalByTag(object, other, objTag, equalFunc, customizer, bitmask); - } - var isPartial = bitmask & PARTIAL_COMPARE_FLAG; - if (!isPartial) { - var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), - othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); - - if (objIsWrapped || othIsWrapped) { - return equalFunc(objIsWrapped ? object.value() : object, othIsWrapped ? other.value() : other, customizer, bitmask, stack); - } - } - if (!isSameTag) { - return false; - } - // Assume cyclic values are equal. - // For more information on detecting circular references see https://es5.github.io/#JO. - stack || (stack = new Stack); - var stacked = stack.get(object); - if (stacked) { - return stacked == other; - } - stack.set(object, other); - - var result = (objIsArr ? equalArrays : equalObjects)(object, other, equalFunc, customizer, bitmask, stack); - - stack['delete'](object); - return result; - } - - /** - * The base implementation of `_.isMatch` without support for callback shorthands. - * - * @private - * @param {Object} object The object to inspect. - * @param {Object} source The object of property values to match. - * @param {Array} matchData The property names, values, and compare flags to match. - * @param {Function} [customizer] The function to customize comparisons. - * @returns {boolean} Returns `true` if `object` is a match, else `false`. - */ - function baseIsMatch(object, source, matchData, customizer) { - var index = matchData.length, - length = index, - noCustomizer = !customizer; - - if (object == null) { - return !length; - } - object = Object(object); - while (index--) { - var data = matchData[index]; - if ((noCustomizer && data[2]) - ? data[1] !== object[data[0]] - : !(data[0] in object) - ) { - return false; - } - } - while (++index < length) { - data = matchData[index]; - var key = data[0], - objValue = object[key], - srcValue = data[1]; - - if (noCustomizer && data[2]) { - if (objValue === undefined && !(key in object)) { - return false; - } - } else { - var stack = new Stack, - result = customizer ? customizer(objValue, srcValue, key, object, source, stack) : undefined; - - if (!(result === undefined ? baseIsEqual(srcValue, objValue, customizer, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG, stack) : result)) { - return false; - } - } - } - return true; - } - - /** - * The base implementation of `_.iteratee`. - * - * @private - * @param {*} [value=_.identity] The value to convert to an iteratee. - * @returns {Function} Returns the iteratee. - */ - function baseIteratee(value) { - var type = typeof value; - if (type == 'function') { - return value; - } - if (value == null) { - return identity; - } - if (type == 'object') { - return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); - } - return property(value); - } - - /** - * The base implementation of `_.keys` which doesn't skip the constructor - * property of prototypes or treat sparse arrays as dense. - * - * @private - * @type Function - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - */ - function baseKeys(object) { - return nativeKeys(Object(object)); - } - - /** - * The base implementation of `_.keysIn` which doesn't skip the constructor - * property of prototypes or treat sparse arrays as dense. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - */ - function baseKeysIn(object) { - object = object == null ? object : Object(object); - - var result = []; - for (var key in object) { - result.push(key); - } - return result; - } - - // Fallback for IE < 9 with es6-shim. - if (enumerate && !propertyIsEnumerable.call({ 'valueOf': 1 }, 'valueOf')) { - baseKeysIn = function(object) { - return iteratorToArray(enumerate(object)); - }; - } - - /** - * The base implementation of `_.map` without support for callback shorthands. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns the new mapped array. - */ - function baseMap(collection, iteratee) { - var index = -1, - result = isArrayLike(collection) ? Array(collection.length) : []; - - baseEach(collection, function(value, key, collection) { - result[++index] = iteratee(value, key, collection); - }); - return result; - } - - /** - * The base implementation of `_.matches` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new function. - */ - function baseMatches(source) { - var matchData = getMatchData(source); - if (matchData.length == 1 && matchData[0][2]) { - var key = matchData[0][0], - value = matchData[0][1]; - - return function(object) { - if (object == null) { - return false; - } - return object[key] === value && - (value !== undefined || (key in Object(object))); - }; - } - return function(object) { - return object === source || baseIsMatch(object, source, matchData); - }; - } - - /** - * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. - * - * @private - * @param {string} path The path of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new function. - */ - function baseMatchesProperty(path, srcValue) { - return function(object) { - var objValue = get(object, path); - return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); - }; - } - - /** - * The base implementation of `_.merge` without support for multiple sources. - * - * @private - * @param {Object} object The destination object. - * @param {Object} source The source object. - * @param {Function} [customizer] The function to customize merged values. - * @param {Object} [stack] Tracks traversed source values and their merged counterparts. - */ - function baseMerge(object, source, customizer, stack) { - if (object === source) { - return; - } - var props = (isArray(source) || isTypedArray(source)) ? undefined : keysIn(source); - arrayEach(props || source, function(srcValue, key) { - if (props) { - key = srcValue; - srcValue = source[key]; - } - if (isObject(srcValue)) { - stack || (stack = new Stack); - baseMergeDeep(object, source, key, baseMerge, customizer, stack); - } - else { - var newValue = customizer ? customizer(object[key], srcValue, (key + ''), object, source, stack) : undefined; - if (newValue === undefined) { - newValue = srcValue; - } - assignMergeValue(object, key, newValue); - } - }); - } - - /** - * A specialized version of `baseMerge` for arrays and objects which performs - * deep merges and tracks traversed objects enabling objects with circular - * references to be merged. - * - * @private - * @param {Object} object The destination object. - * @param {Object} source The source object. - * @param {string} key The key of the value to merge. - * @param {Function} mergeFunc The function to merge values. - * @param {Function} [customizer] The function to customize assigned values. - * @param {Object} [stack] Tracks traversed source values and their merged counterparts. - */ - function baseMergeDeep(object, source, key, mergeFunc, customizer, stack) { - var oldValue = object[key], - srcValue = source[key], - stacked = stack.get(oldValue) || stack.get(srcValue); - - if (stacked) { - assignMergeValue(object, key, stacked); - return; - } - var newValue = customizer ? customizer(oldValue, srcValue, (key + ''), object, source, stack) : undefined, - isCommon = newValue === undefined; - - if (isCommon) { - newValue = srcValue; - if (isArray(srcValue) || isTypedArray(srcValue)) { - newValue = isArray(oldValue) - ? oldValue - : ((isArrayLikeObject(oldValue)) ? copyArray(oldValue) : baseClone(srcValue)); - } - else if (isPlainObject(srcValue) || isArguments(srcValue)) { - newValue = isArguments(oldValue) - ? toPlainObject(oldValue) - : (isObject(oldValue) ? oldValue : baseClone(srcValue)); - } - else { - isCommon = isFunction(srcValue); - } - } - stack.set(srcValue, newValue); - - if (isCommon) { - // Recursively merge objects and arrays (susceptible to call stack limits). - mergeFunc(newValue, srcValue, customizer, stack); - } - assignMergeValue(object, key, newValue); - } - - /** - * The base implementation of `_.orderBy` without param guards. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by. - * @param {string[]} orders The sort orders of `iteratees`. - * @returns {Array} Returns the new sorted array. - */ - function baseOrderBy(collection, iteratees, orders) { - var toIteratee = getIteratee(), - index = -1; - - iteratees = arrayMap(iteratees.length ? iteratees : Array(1), function(iteratee) { - return toIteratee(iteratee); - }); - - var result = baseMap(collection, function(value, key, collection) { - var criteria = arrayMap(iteratees, function(iteratee) { - return iteratee(value); - }); - return { 'criteria': criteria, 'index': ++index, 'value': value }; - }); - - return baseSortBy(result, function(object, other) { - return compareMultiple(object, other, orders); - }); - } - - /** - * The base implementation of `_.pick` without support for individual - * property names. - * - * @private - * @param {Object} object The source object. - * @param {string[]} props The property names to pick. - * @returns {Object} Returns the new object. - */ - function basePick(object, props) { - object = Object(object); - return arrayReduce(props, function(result, key) { - if (key in object) { - result[key] = object[key]; - } - return result; - }, {}); - } - - /** - * The base implementation of `_.pickBy` without support for callback shorthands. - * - * @private - * @param {Object} object The source object. - * @param {Function} predicate The function invoked per property. - * @returns {Object} Returns the new object. - */ - function basePickBy(object, predicate) { - var result = {}; - baseForIn(object, function(value, key) { - if (predicate(value)) { - result[key] = value; - } - }); - return result; - } - - /** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new function. - */ - function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; - } - - /** - * A specialized version of `baseProperty` which supports deep paths. - * - * @private - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - */ - function basePropertyDeep(path) { - return function(object) { - return baseGet(object, path); - }; - } - - /** - * The base implementation of `_.pullAll`. - * - * @private - * @param {Array} array The array to modify. - * @param {Array} values The values to remove. - * @returns {Array} Returns `array`. - */ - function basePullAll(array, values) { - return basePullAllBy(array, values); - } - - /** - * The base implementation of `_.pullAllBy` without support for callback - * shorthands. - * - * @private - * @param {Array} array The array to modify. - * @param {Array} values The values to remove. - * @param {Function} [iteratee] The iteratee invoked per element. - * @returns {Array} Returns `array`. - */ - function basePullAllBy(array, values, iteratee) { - var index = -1, - length = values.length, - seen = array; - - if (iteratee) { - seen = arrayMap(array, function(value) { return iteratee(value); }); - } - while (++index < length) { - var fromIndex = 0, - value = values[index], - computed = iteratee ? iteratee(value) : value; - - while ((fromIndex = baseIndexOf(seen, computed, fromIndex)) > -1) { - if (seen !== array) { - splice.call(seen, fromIndex, 1); - } - splice.call(array, fromIndex, 1); - } - } - return array; - } - - /** - * The base implementation of `_.pullAt` without support for individual - * indexes or capturing the removed elements. - * - * @private - * @param {Array} array The array to modify. - * @param {number[]} indexes The indexes of elements to remove. - * @returns {Array} Returns `array`. - */ - function basePullAt(array, indexes) { - var length = array ? indexes.length : 0, - lastIndex = length - 1; - - while (length--) { - var index = indexes[length]; - if (lastIndex == length || index != previous) { - var previous = index; - if (isIndex(index)) { - splice.call(array, index, 1); - } - else if (!isKey(index, array)) { - var path = baseToPath(index), - object = parent(array, path); - - if (object != null) { - delete object[last(path)]; - } - } - else { - delete array[index]; - } - } - } - return array; - } - - /** - * The base implementation of `_.random` without support for returning - * floating-point numbers. - * - * @private - * @param {number} min The minimum possible value. - * @param {number} max The maximum possible value. - * @returns {number} Returns the random number. - */ - function baseRandom(min, max) { - return min + nativeFloor(nativeRandom() * (max - min + 1)); - } - - /** - * The base implementation of `_.range` and `_.rangeRight`. - * - * @private - * @param {number} [start=0] The start of the range. - * @param {number} end The end of the range. - * @param {number} [step=1] The value to increment or decrement by. - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {Array} Returns the new array of numbers. - */ - function baseRange(start, end, step, fromRight) { - start = toNumber(start); - start = start === start ? start : 0; - - if (end === undefined) { - end = start; - start = 0; - } else { - end = toNumber(end) || 0; - } - step = step === undefined ? (start < end ? 1 : -1) : (toNumber(step) || 0); - - var index = -1, - length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), - result = Array(length); - - while (length--) { - result[fromRight ? length : ++index] = start; - start += step; - } - return result; - } - - /** - * The base implementation of `_.set`. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to set. - * @param {*} value The value to set. - * @param {Function} [customizer] The function to customize path creation. - * @returns {Object} Returns `object`. - */ - function baseSet(object, path, value, customizer) { - path = isKey(path, object) ? [path + ''] : baseToPath(path); - - var index = -1, - length = path.length, - lastIndex = length - 1, - nested = object; - - while (nested != null && ++index < length) { - var key = path[index]; - if (isObject(nested)) { - var newValue = value; - if (index != lastIndex) { - var oldValue = nested[key]; - newValue = customizer ? customizer(oldValue, key, nested) : undefined; - if (newValue === undefined) { - newValue = oldValue == null ? (isIndex(path[index + 1]) ? [] : {}) : oldValue; - } - } - assignValue(nested, key, newValue); - } - nested = nested[key]; - } - return object; - } - - /** - * The base implementation of `setData` without support for hot loop detection. - * - * @private - * @param {Function} func The function to associate metadata with. - * @param {*} data The metadata. - * @returns {Function} Returns `func`. - */ - var baseSetData = !metaMap ? identity : function(func, data) { - metaMap.set(func, data); - return func; - }; - - /** - * The base implementation of `_.slice` without an iteratee call guard. - * - * @private - * @param {Array} array The array to slice. - * @param {number} [start=0] The start position. - * @param {number} [end=array.length] The end position. - * @returns {Array} Returns the slice of `array`. - */ - function baseSlice(array, start, end) { - var index = -1, - length = array.length; - - start = start == null ? 0 : toInteger(start); - if (start < 0) { - start = -start > length ? 0 : (length + start); - } - end = (end === undefined || end > length) ? length : toInteger(end); - if (end < 0) { - end += length; - } - length = start > end ? 0 : ((end - start) >>> 0); - start >>>= 0; - - var result = Array(length); - while (++index < length) { - result[index] = array[index + start]; - } - return result; - } - - /** - * The base implementation of `_.some` without support for callback shorthands. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} predicate The function invoked per iteration. - * @returns {boolean} Returns `true` if any element passes the predicate check, else `false`. - */ - function baseSome(collection, predicate) { - var result; - - baseEach(collection, function(value, index, collection) { - result = predicate(value, index, collection); - return !result; - }); - return !!result; - } - - /** - * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which - * performs a binary search of `array` to determine the index at which `value` - * should be inserted into `array` in order to maintain its sort order. - * - * @private - * @param {Array} array The sorted array to inspect. - * @param {*} value The value to evaluate. - * @param {boolean} [retHighest] Specify returning the highest qualified index. - * @returns {number} Returns the index at which `value` should be inserted - * into `array`. - */ - function baseSortedIndex(array, value, retHighest) { - var low = 0, - high = array ? array.length : low; - - if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) { - while (low < high) { - var mid = (low + high) >>> 1, - computed = array[mid]; - - if ((retHighest ? (computed <= value) : (computed < value)) && computed !== null) { - low = mid + 1; - } else { - high = mid; - } - } - return high; - } - return baseSortedIndexBy(array, value, identity, retHighest); - } - - /** - * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy` - * which invokes `iteratee` for `value` and each element of `array` to compute - * their sort ranking. The iteratee is invoked with one argument; (value). - * - * @private - * @param {Array} array The sorted array to inspect. - * @param {*} value The value to evaluate. - * @param {Function} iteratee The iteratee invoked per element. - * @param {boolean} [retHighest] Specify returning the highest qualified index. - * @returns {number} Returns the index at which `value` should be inserted into `array`. - */ - function baseSortedIndexBy(array, value, iteratee, retHighest) { - value = iteratee(value); - - var low = 0, - high = array ? array.length : 0, - valIsNaN = value !== value, - valIsNull = value === null, - valIsUndef = value === undefined; - - while (low < high) { - var mid = nativeFloor((low + high) / 2), - computed = iteratee(array[mid]), - isDef = computed !== undefined, - isReflexive = computed === computed; - - if (valIsNaN) { - var setLow = isReflexive || retHighest; - } else if (valIsNull) { - setLow = isReflexive && isDef && (retHighest || computed != null); - } else if (valIsUndef) { - setLow = isReflexive && (retHighest || isDef); - } else if (computed == null) { - setLow = false; - } else { - setLow = retHighest ? (computed <= value) : (computed < value); - } - if (setLow) { - low = mid + 1; - } else { - high = mid; - } - } - return nativeMin(high, MAX_ARRAY_INDEX); - } - - /** - * The base implementation of `_.sortedUniq`. - * - * @private - * @param {Array} array The array to inspect. - * @returns {Array} Returns the new duplicate free array. - */ - function baseSortedUniq(array) { - return baseSortedUniqBy(array); - } - - /** - * The base implementation of `_.sortedUniqBy` without support for callback - * shorthands. - * - * @private - * @param {Array} array The array to inspect. - * @param {Function} [iteratee] The iteratee invoked per element. - * @returns {Array} Returns the new duplicate free array. - */ - function baseSortedUniqBy(array, iteratee) { - var index = 0, - length = array.length, - value = array[0], - computed = iteratee ? iteratee(value) : value, - seen = computed, - resIndex = 0, - result = [value]; - - while (++index < length) { - value = array[index], - computed = iteratee ? iteratee(value) : value; - - if ((seen === seen ? (seen !== computed) : (computed === computed))) { - seen = computed; - result[++resIndex] = value; - } - } - return result; - } - - /** - * The base implementation of `_.toPath` which only converts `value` to a - * path if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. - */ - function baseToPath(value) { - return isArray(value) ? value : stringToPath(value); - } - - /** - * The base implementation of `_.uniqBy` without support for callback shorthands. - * - * @private - * @param {Array} array The array to inspect. - * @param {Function} [iteratee] The iteratee invoked per element. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new duplicate free array. - */ - function baseUniq(array, iteratee, comparator) { - var index = -1, - includes = arrayIncludes, - length = array.length, - isCommon = true, - result = [], - seen = result; - - if (comparator) { - isCommon = false; - includes = arrayIncludesWith; - } - else if (length >= LARGE_ARRAY_SIZE) { - var set = iteratee ? null : createSet(array); - if (set) { - return setToArray(set); - } - isCommon = false; - includes = cacheHas; - seen = new SetCache; - } - else { - seen = iteratee ? [] : result; - } - outer: - while (++index < length) { - var value = array[index], - computed = iteratee ? iteratee(value) : value; - - if (isCommon && computed === computed) { - var seenIndex = seen.length; - while (seenIndex--) { - if (seen[seenIndex] === computed) { - continue outer; - } - } - if (iteratee) { - seen.push(computed); - } - result.push(value); - } - else if (!includes(seen, computed, comparator)) { - if (seen !== result) { - seen.push(computed); - } - result.push(value); - } - } - return result; - } - - /** - * The base implementation of `_.unset`. - * - * @private - * @param {Object} object The object to modify. - * @param {Array|string} path The path of the property to unset. - * @returns {boolean} Returns `true` if the property is deleted, else `false`. - */ - function baseUnset(object, path) { - path = isKey(path, object) ? [path + ''] : baseToPath(path); - object = parent(object, path); - var key = last(path); - return (object != null && has(object, key)) ? delete object[key] : true; - } - - /** - * The base implementation of methods like `_.dropWhile` and `_.takeWhile` - * without support for callback shorthands. - * - * @private - * @param {Array} array The array to query. - * @param {Function} predicate The function invoked per iteration. - * @param {boolean} [isDrop] Specify dropping elements instead of taking them. - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {Array} Returns the slice of `array`. - */ - function baseWhile(array, predicate, isDrop, fromRight) { - var length = array.length, - index = fromRight ? length : -1; - - while ((fromRight ? index-- : ++index < length) && - predicate(array[index], index, array)) {} - - return isDrop - ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length)) - : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index)); - } - - /** - * The base implementation of `wrapperValue` which returns the result of - * performing a sequence of actions on the unwrapped `value`, where each - * successive action is supplied the return value of the previous. - * - * @private - * @param {*} value The unwrapped value. - * @param {Array} actions Actions to peform to resolve the unwrapped value. - * @returns {*} Returns the resolved value. - */ - function baseWrapperValue(value, actions) { - var result = value; - if (result instanceof LazyWrapper) { - result = result.value(); - } - return arrayReduce(actions, function(result, action) { - return action.func.apply(action.thisArg, arrayPush([result], action.args)); - }, result); - } - - /** - * The base implementation of methods like `_.xor`, without support for - * callback shorthands, that accepts an array of arrays to inspect. - * - * @private - * @param {Array} arrays The arrays to inspect. - * @param {Function} [iteratee] The iteratee invoked per element. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of values. - */ - function baseXor(arrays, iteratee, comparator) { - var index = -1, - length = arrays.length; - - while (++index < length) { - var result = result - ? arrayPush( - baseDifference(result, arrays[index], iteratee, comparator), - baseDifference(arrays[index], result, iteratee, comparator) - ) - : arrays[index]; - } - return (result && result.length) ? baseUniq(result, iteratee, comparator) : []; - } - - /** - * Creates a clone of `buffer`. - * - * @private - * @param {ArrayBuffer} buffer The array buffer to clone. - * @returns {ArrayBuffer} Returns the cloned array buffer. - */ - function cloneBuffer(buffer) { - var Ctor = buffer.constructor, - result = new Ctor(buffer.byteLength), - view = new Uint8Array(result); - - view.set(new Uint8Array(buffer)); - return result; - } - - /** - * Creates a clone of `map`. - * - * @private - * @param {Object} map The map to clone. - * @returns {Object} Returns the cloned map. - */ - function cloneMap(map) { - var Ctor = map.constructor; - return arrayReduce(mapToArray(map), addMapEntry, new Ctor); - } - - /** - * Creates a clone of `regexp`. - * - * @private - * @param {Object} regexp The regexp to clone. - * @returns {Object} Returns the cloned regexp. - */ - function cloneRegExp(regexp) { - var Ctor = regexp.constructor, - result = new Ctor(regexp.source, reFlags.exec(regexp)); - - result.lastIndex = regexp.lastIndex; - return result; - } - - /** - * Creates a clone of `set`. - * - * @private - * @param {Object} set The set to clone. - * @returns {Object} Returns the cloned set. - */ - function cloneSet(set) { - var Ctor = set.constructor; - return arrayReduce(setToArray(set), addSetEntry, new Ctor); - } - - /** - * Creates a clone of `typedArray`. - * - * @private - * @param {Object} typedArray The typed array to clone. - * @param {boolean} [isDeep] Specify a deep clone. - * @returns {Object} Returns the cloned typed array. - */ - function cloneTypedArray(typedArray, isDeep) { - var buffer = typedArray.buffer, - Ctor = typedArray.constructor; - - return new Ctor(isDeep ? cloneBuffer(buffer) : buffer, typedArray.byteOffset, typedArray.length); - } - - /** - * Creates an array that is the composition of partially applied arguments, - * placeholders, and provided arguments into a single array of arguments. - * - * @private - * @param {Array|Object} args The provided arguments. - * @param {Array} partials The arguments to prepend to those provided. - * @param {Array} holders The `partials` placeholder indexes. - * @returns {Array} Returns the new array of composed arguments. - */ - function composeArgs(args, partials, holders) { - var holdersLength = holders.length, - argsIndex = -1, - argsLength = nativeMax(args.length - holdersLength, 0), - leftIndex = -1, - leftLength = partials.length, - result = Array(leftLength + argsLength); - - while (++leftIndex < leftLength) { - result[leftIndex] = partials[leftIndex]; - } - while (++argsIndex < holdersLength) { - result[holders[argsIndex]] = args[argsIndex]; - } - while (argsLength--) { - result[leftIndex++] = args[argsIndex++]; - } - return result; - } - - /** - * This function is like `composeArgs` except that the arguments composition - * is tailored for `_.partialRight`. - * - * @private - * @param {Array|Object} args The provided arguments. - * @param {Array} partials The arguments to append to those provided. - * @param {Array} holders The `partials` placeholder indexes. - * @returns {Array} Returns the new array of composed arguments. - */ - function composeArgsRight(args, partials, holders) { - var holdersIndex = -1, - holdersLength = holders.length, - argsIndex = -1, - argsLength = nativeMax(args.length - holdersLength, 0), - rightIndex = -1, - rightLength = partials.length, - result = Array(argsLength + rightLength); - - while (++argsIndex < argsLength) { - result[argsIndex] = args[argsIndex]; - } - var offset = argsIndex; - while (++rightIndex < rightLength) { - result[offset + rightIndex] = partials[rightIndex]; - } - while (++holdersIndex < holdersLength) { - result[offset + holders[holdersIndex]] = args[argsIndex++]; - } - return result; - } - - /** - * Creates a function like `_.groupBy`. - * - * @private - * @param {Function} setter The function to set keys and values of the accumulator object. - * @param {Function} [initializer] The function to initialize the accumulator object. - * @returns {Function} Returns the new aggregator function. - */ - function createAggregator(setter, initializer) { - return function(collection, iteratee) { - var result = initializer ? initializer() : {}; - iteratee = getIteratee(iteratee); - - if (isArray(collection)) { - var index = -1, - length = collection.length; - - while (++index < length) { - var value = collection[index]; - setter(result, value, iteratee(value), collection); - } - } else { - baseEach(collection, function(value, key, collection) { - setter(result, value, iteratee(value), collection); - }); - } - return result; - }; - } - - /** - * Creates a function like `_.assign`. - * - * @private - * @param {Function} assigner The function to assign values. - * @returns {Function} Returns the new assigner function. - */ - function createAssigner(assigner) { - return rest(function(object, sources) { - var index = -1, - length = object == null ? 0 : sources.length, - customizer = length > 1 ? sources[length - 1] : undefined, - guard = length > 2 ? sources[2] : undefined; - - customizer = typeof customizer == 'function' ? (length--, customizer) : undefined; - if (guard && isIterateeCall(sources[0], sources[1], guard)) { - customizer = length < 3 ? undefined : customizer; - length = 1; - } - object = Object(object); - while (++index < length) { - var source = sources[index]; - if (source) { - assigner(object, source, customizer); - } - } - return object; - }); - } - - /** - * Creates a `baseEach` or `baseEachRight` function. - * - * @private - * @param {Function} eachFunc The function to iterate over a collection. - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {Function} Returns the new base function. - */ - function createBaseEach(eachFunc, fromRight) { - return function(collection, iteratee) { - if (collection == null) { - return collection; - } - if (!isArrayLike(collection)) { - return eachFunc(collection, iteratee); - } - var length = collection.length, - index = fromRight ? length : -1, - iterable = Object(collection); - - while ((fromRight ? index-- : ++index < length)) { - if (iteratee(iterable[index], index, iterable) === false) { - break; - } - } - return collection; - }; - } - - /** - * Creates a base function for methods like `_.forIn`. - * - * @private - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {Function} Returns the new base function. - */ - function createBaseFor(fromRight) { - return function(object, iteratee, keysFunc) { - var index = -1, - iterable = Object(object), - props = keysFunc(object), - length = props.length; - - while (length--) { - var key = props[fromRight ? length : ++index]; - if (iteratee(iterable[key], key, iterable) === false) { - break; - } - } - return object; - }; - } - - /** - * Creates a function that wraps `func` to invoke it with the optional `this` - * binding of `thisArg`. - * - * @private - * @param {Function} func The function to wrap. - * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper` for more details. - * @param {*} [thisArg] The `this` binding of `func`. - * @returns {Function} Returns the new wrapped function. - */ - function createBaseWrapper(func, bitmask, thisArg) { - var isBind = bitmask & BIND_FLAG, - Ctor = createCtorWrapper(func); - - function wrapper() { - var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; - return fn.apply(isBind ? thisArg : this, arguments); - } - return wrapper; - } - - /** - * Creates a function like `_.lowerFirst`. - * - * @private - * @param {string} methodName The name of the `String` case method to use. - * @returns {Function} Returns the new function. - */ - function createCaseFirst(methodName) { - return function(string) { - string = toString(string); - - var strSymbols = reHasComplexSymbol.test(string) ? stringToArray(string) : undefined, - chr = strSymbols ? strSymbols[0] : string.charAt(0), - trailing = strSymbols ? strSymbols.slice(1).join('') : string.slice(1); - - return chr[methodName]() + trailing; - }; - } - - /** - * Creates a function like `_.camelCase`. - * - * @private - * @param {Function} callback The function to combine each word. - * @returns {Function} Returns the new compounder function. - */ - function createCompounder(callback) { - return function(string) { - return arrayReduce(words(deburr(string)), callback, ''); - }; - } - - /** - * Creates a function that produces an instance of `Ctor` regardless of - * whether it was invoked as part of a `new` expression or by `call` or `apply`. - * - * @private - * @param {Function} Ctor The constructor to wrap. - * @returns {Function} Returns the new wrapped function. - */ - function createCtorWrapper(Ctor) { - return function() { - // Use a `switch` statement to work with class constructors. - // See http://ecma-international.org/ecma-262/6.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist - // for more details. - var args = arguments; - switch (args.length) { - case 0: return new Ctor; - case 1: return new Ctor(args[0]); - case 2: return new Ctor(args[0], args[1]); - case 3: return new Ctor(args[0], args[1], args[2]); - case 4: return new Ctor(args[0], args[1], args[2], args[3]); - case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]); - case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]); - case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]); - } - var thisBinding = baseCreate(Ctor.prototype), - result = Ctor.apply(thisBinding, args); - - // Mimic the constructor's `return` behavior. - // See https://es5.github.io/#x13.2.2 for more details. - return isObject(result) ? result : thisBinding; - }; - } - - /** - * Creates a function that wraps `func` to enable currying. - * - * @private - * @param {Function} func The function to wrap. - * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper` for more details. - * @param {number} arity The arity of `func`. - * @returns {Function} Returns the new wrapped function. - */ - function createCurryWrapper(func, bitmask, arity) { - var Ctor = createCtorWrapper(func); - - function wrapper() { - var length = arguments.length, - index = length, - args = Array(length), - fn = (this && this !== root && this instanceof wrapper) ? Ctor : func, - placeholder = wrapper.placeholder; - - while (index--) { - args[index] = arguments[index]; - } - var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder) - ? [] - : replaceHolders(args, placeholder); - - length -= holders.length; - return length < arity - ? createRecurryWrapper(func, bitmask, createHybridWrapper, placeholder, undefined, args, holders, undefined, undefined, arity - length) - : apply(fn, this, args); - } - return wrapper; - } - - /** - * Creates a `_.flow` or `_.flowRight` function. - * - * @private - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {Function} Returns the new flow function. - */ - function createFlow(fromRight) { - return rest(function(funcs) { - funcs = baseFlatten(funcs); - - var length = funcs.length, - index = length, - prereq = LodashWrapper.prototype.thru; - - if (fromRight) { - funcs.reverse(); - } - while (index--) { - var func = funcs[index]; - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - if (prereq && !wrapper && getFuncName(func) == 'wrapper') { - var wrapper = new LodashWrapper([], true); - } - } - index = wrapper ? index : length; - while (++index < length) { - func = funcs[index]; - - var funcName = getFuncName(func), - data = funcName == 'wrapper' ? getData(func) : undefined; - - if (data && isLaziable(data[0]) && data[1] == (ARY_FLAG | CURRY_FLAG | PARTIAL_FLAG | REARG_FLAG) && !data[4].length && data[9] == 1) { - wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]); - } else { - wrapper = (func.length == 1 && isLaziable(func)) ? wrapper[funcName]() : wrapper.thru(func); - } - } - return function() { - var args = arguments, - value = args[0]; - - if (wrapper && args.length == 1 && isArray(value) && value.length >= LARGE_ARRAY_SIZE) { - return wrapper.plant(value).value(); - } - var index = 0, - result = length ? funcs[index].apply(this, args) : value; - - while (++index < length) { - result = funcs[index].call(this, result); - } - return result; - }; - }); - } - - /** - * Creates a function that wraps `func` to invoke it with optional `this` - * binding of `thisArg`, partial application, and currying. - * - * @private - * @param {Function|string} func The function or method name to wrap. - * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper` for more details. - * @param {*} [thisArg] The `this` binding of `func`. - * @param {Array} [partials] The arguments to prepend to those provided to the new function. - * @param {Array} [holders] The `partials` placeholder indexes. - * @param {Array} [partialsRight] The arguments to append to those provided to the new function. - * @param {Array} [holdersRight] The `partialsRight` placeholder indexes. - * @param {Array} [argPos] The argument positions of the new function. - * @param {number} [ary] The arity cap of `func`. - * @param {number} [arity] The arity of `func`. - * @returns {Function} Returns the new wrapped function. - */ - function createHybridWrapper(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) { - var isAry = bitmask & ARY_FLAG, - isBind = bitmask & BIND_FLAG, - isBindKey = bitmask & BIND_KEY_FLAG, - isCurry = bitmask & CURRY_FLAG, - isCurryRight = bitmask & CURRY_RIGHT_FLAG, - isFlip = bitmask & FLIP_FLAG, - Ctor = isBindKey ? undefined : createCtorWrapper(func); - - function wrapper() { - var length = arguments.length, - index = length, - args = Array(length); - - while (index--) { - args[index] = arguments[index]; - } - if (partials) { - args = composeArgs(args, partials, holders); - } - if (partialsRight) { - args = composeArgsRight(args, partialsRight, holdersRight); - } - if (isCurry || isCurryRight) { - var placeholder = wrapper.placeholder, - argsHolders = replaceHolders(args, placeholder); - - length -= argsHolders.length; - if (length < arity) { - return createRecurryWrapper(func, bitmask, createHybridWrapper, placeholder, thisArg, args, argsHolders, argPos, ary, arity - length); - } - } - var thisBinding = isBind ? thisArg : this, - fn = isBindKey ? thisBinding[func] : func; - - if (argPos) { - args = reorder(args, argPos); - } else if (isFlip && args.length > 1) { - args.reverse(); - } - if (isAry && ary < args.length) { - args.length = ary; - } - if (this && this !== root && this instanceof wrapper) { - fn = Ctor || createCtorWrapper(fn); - } - return fn.apply(thisBinding, args); - } - return wrapper; - } - - /** - * Creates a function like `_.over`. - * - * @private - * @param {Function} arrayFunc The function to iterate over iteratees. - * @returns {Function} Returns the new invoker function. - */ - function createOver(arrayFunc) { - return rest(function(iteratees) { - iteratees = arrayMap(baseFlatten(iteratees), getIteratee()); - return rest(function(args) { - var thisArg = this; - return arrayFunc(iteratees, function(iteratee) { - return apply(iteratee, thisArg, args); - }); - }); - }); - } - - /** - * Creates the padding for `string` based on `length`. The `chars` string - * is truncated if the number of characters exceeds `length`. - * - * @private - * @param {string} string The string to create padding for. - * @param {number} [length=0] The padding length. - * @param {string} [chars=' '] The string used as padding. - * @returns {string} Returns the padding for `string`. - */ - function createPadding(string, length, chars) { - length = toInteger(length); - - var strLength = stringSize(string); - if (!length || strLength >= length) { - return ''; - } - var padLength = length - strLength; - chars = chars === undefined ? ' ' : (chars + ''); - - var result = repeat(chars, nativeCeil(padLength / stringSize(chars))); - return reHasComplexSymbol.test(chars) - ? stringToArray(result).slice(0, padLength).join('') - : result.slice(0, padLength); - } - - /** - * Creates a function that wraps `func` to invoke it with the optional `this` - * binding of `thisArg` and the `partials` prepended to those provided to - * the wrapper. - * - * @private - * @param {Function} func The function to wrap. - * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper` for more details. - * @param {*} thisArg The `this` binding of `func`. - * @param {Array} partials The arguments to prepend to those provided to the new function. - * @returns {Function} Returns the new wrapped function. - */ - function createPartialWrapper(func, bitmask, thisArg, partials) { - var isBind = bitmask & BIND_FLAG, - Ctor = createCtorWrapper(func); - - function wrapper() { - var argsIndex = -1, - argsLength = arguments.length, - leftIndex = -1, - leftLength = partials.length, - args = Array(leftLength + argsLength), - fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; - - while (++leftIndex < leftLength) { - args[leftIndex] = partials[leftIndex]; - } - while (argsLength--) { - args[leftIndex++] = arguments[++argsIndex]; - } - return apply(fn, isBind ? thisArg : this, args); - } - return wrapper; - } - - /** - * Creates a function that wraps `func` to continue currying. - * - * @private - * @param {Function} func The function to wrap. - * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper` for more details. - * @param {Function} wrapFunc The function to create the `func` wrapper. - * @param {*} placeholder The placeholder to replace. - * @param {*} [thisArg] The `this` binding of `func`. - * @param {Array} [partials] The arguments to prepend to those provided to the new function. - * @param {Array} [holders] The `partials` placeholder indexes. - * @param {Array} [argPos] The argument positions of the new function. - * @param {number} [ary] The arity cap of `func`. - * @param {number} [arity] The arity of `func`. - * @returns {Function} Returns the new wrapped function. - */ - function createRecurryWrapper(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) { - var isCurry = bitmask & CURRY_FLAG, - newArgPos = argPos ? copyArray(argPos) : undefined, - newsHolders = isCurry ? holders : undefined, - newHoldersRight = isCurry ? undefined : holders, - newPartials = isCurry ? partials : undefined, - newPartialsRight = isCurry ? undefined : partials; - - arity = arity == undefined ? arity : nativeMax(arity, 0); - bitmask |= (isCurry ? PARTIAL_FLAG : PARTIAL_RIGHT_FLAG); - bitmask &= ~(isCurry ? PARTIAL_RIGHT_FLAG : PARTIAL_FLAG); - - if (!(bitmask & CURRY_BOUND_FLAG)) { - bitmask &= ~(BIND_FLAG | BIND_KEY_FLAG); - } - var newData = [func, bitmask, thisArg, newPartials, newsHolders, newPartialsRight, newHoldersRight, newArgPos, ary, arity], - result = wrapFunc.apply(undefined, newData); - - if (isLaziable(func)) { - setData(result, newData); - } - result.placeholder = placeholder; - return result; - } - - /** - * Creates a function like `_.round`. - * - * @private - * @param {string} methodName The name of the `Math` method to use when rounding. - * @returns {Function} Returns the new round function. - */ - function createRound(methodName) { - var func = Math[methodName]; - return function(number, precision) { - number = toNumber(number); - precision = toInteger(precision); - if (precision) { - // Shift with exponential notation to avoid floating-point issues. - // See [MDN](https://mdn.io/round#Examples) for more details. - var pair = (toString(number) + 'e').split('e'), - value = func(pair[0] + 'e' + (+pair[1] + precision)); - - pair = (toString(value) + 'e').split('e'); - return +(pair[0] + 'e' + (+pair[1] - precision)); - } - return func(number); - }; - } - - /** - * Creates a set of `values`. - * - * @private - * @param {Array} values The values to add to the set. - * @returns {Object} Returns the new set. - */ - var createSet = !(Set && new Set([1, 2]).size === 2) ? noop : function(values) { - return new Set(values); - }; - - /** - * Creates a function that either curries or invokes `func` with optional - * `this` binding and partially applied arguments. - * - * @private - * @param {Function|string} func The function or method name to wrap. - * @param {number} bitmask The bitmask of wrapper flags. - * The bitmask may be composed of the following flags: - * 1 - `_.bind` - * 2 - `_.bindKey` - * 4 - `_.curry` or `_.curryRight` of a bound function - * 8 - `_.curry` - * 16 - `_.curryRight` - * 32 - `_.partial` - * 64 - `_.partialRight` - * 128 - `_.rearg` - * 256 - `_.ary` - * @param {*} [thisArg] The `this` binding of `func`. - * @param {Array} [partials] The arguments to be partially applied. - * @param {Array} [holders] The `partials` placeholder indexes. - * @param {Array} [argPos] The argument positions of the new function. - * @param {number} [ary] The arity cap of `func`. - * @param {number} [arity] The arity of `func`. - * @returns {Function} Returns the new wrapped function. - */ - function createWrapper(func, bitmask, thisArg, partials, holders, argPos, ary, arity) { - var isBindKey = bitmask & BIND_KEY_FLAG; - if (!isBindKey && typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - var length = partials ? partials.length : 0; - if (!length) { - bitmask &= ~(PARTIAL_FLAG | PARTIAL_RIGHT_FLAG); - partials = holders = undefined; - } - ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0); - arity = arity === undefined ? arity : toInteger(arity); - length -= holders ? holders.length : 0; - - if (bitmask & PARTIAL_RIGHT_FLAG) { - var partialsRight = partials, - holdersRight = holders; - - partials = holders = undefined; - } - var data = isBindKey ? undefined : getData(func), - newData = [func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity]; - - if (data) { - mergeData(newData, data); - } - func = newData[0]; - bitmask = newData[1]; - thisArg = newData[2]; - partials = newData[3]; - holders = newData[4]; - arity = newData[9] = newData[9] == null - ? (isBindKey ? 0 : func.length) - : nativeMax(newData[9] - length, 0); - - if (!arity && bitmask & (CURRY_FLAG | CURRY_RIGHT_FLAG)) { - bitmask &= ~(CURRY_FLAG | CURRY_RIGHT_FLAG); - } - if (!bitmask || bitmask == BIND_FLAG) { - var result = createBaseWrapper(func, bitmask, thisArg); - } else if (bitmask == CURRY_FLAG || bitmask == CURRY_RIGHT_FLAG) { - result = createCurryWrapper(func, bitmask, arity); - } else if ((bitmask == PARTIAL_FLAG || bitmask == (BIND_FLAG | PARTIAL_FLAG)) && !holders.length) { - result = createPartialWrapper(func, bitmask, thisArg, partials); - } else { - result = createHybridWrapper.apply(undefined, newData); - } - var setter = data ? baseSetData : setData; - return setter(result, newData); - } - - /** - * A specialized version of `baseIsEqualDeep` for arrays with support for - * partial deep comparisons. - * - * @private - * @param {Array} array The array to compare. - * @param {Array} other The other array to compare. - * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Function} [customizer] The function to customize comparisons. - * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual` for more details. - * @param {Object} [stack] Tracks traversed `array` and `other` objects. - * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. - */ - function equalArrays(array, other, equalFunc, customizer, bitmask, stack) { - var index = -1, - isPartial = bitmask & PARTIAL_COMPARE_FLAG, - isUnordered = bitmask & UNORDERED_COMPARE_FLAG, - arrLength = array.length, - othLength = other.length; - - if (arrLength != othLength && !(isPartial && othLength > arrLength)) { - return false; - } - // Ignore non-index properties. - while (++index < arrLength) { - var arrValue = array[index], - othValue = other[index]; - - if (customizer) { - var result = isPartial - ? customizer(othValue, arrValue, index, other, array, stack) - : customizer(arrValue, othValue, index, array, other, stack); - } - if (result !== undefined) { - if (result) { - continue; - } - return false; - } - // Recursively compare arrays (susceptible to call stack limits). - if (isUnordered) { - if (!arraySome(other, function(othValue) { - return arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack); - })) { - return false; - } - } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) { - return false; - } - } - return true; - } - - /** - * A specialized version of `baseIsEqualDeep` for comparing objects of - * the same `toStringTag`. - * - * **Note:** This function only supports comparing values with tags of - * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. - * - * @private - * @param {Object} object The object to compare. - * @param {Object} other The other object to compare. - * @param {string} tag The `toStringTag` of the objects to compare. - * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Function} [customizer] The function to customize comparisons. - * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual` for more details. - * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. - */ - function equalByTag(object, other, tag, equalFunc, customizer, bitmask) { - switch (tag) { - case boolTag: - case dateTag: - // Coerce dates and booleans to numbers, dates to milliseconds and booleans - // to `1` or `0` treating invalid dates coerced to `NaN` as not equal. - return +object == +other; - - case errorTag: - return object.name == other.name && object.message == other.message; - - case numberTag: - // Treat `NaN` vs. `NaN` as equal. - return (object != +object) ? other != +other : object == +other; - - case regexpTag: - case stringTag: - // Coerce regexes to strings and treat strings primitives and string - // objects as equal. See https://es5.github.io/#x15.10.6.4 for more details. - return object == (other + ''); - - case mapTag: - var convert = mapToArray; - - case setTag: - var isPartial = bitmask & PARTIAL_COMPARE_FLAG; - convert || (convert = setToArray); - - // Recursively compare objects (susceptible to call stack limits). - return (isPartial || object.size == other.size) && - equalFunc(convert(object), convert(other), customizer, bitmask | UNORDERED_COMPARE_FLAG); - } - return false; - } - - /** - * A specialized version of `baseIsEqualDeep` for objects with support for - * partial deep comparisons. - * - * @private - * @param {Object} object The object to compare. - * @param {Object} other The other object to compare. - * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Function} [customizer] The function to customize comparisons. - * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual` for more details. - * @param {Object} [stack] Tracks traversed `object` and `other` objects. - * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. - */ - function equalObjects(object, other, equalFunc, customizer, bitmask, stack) { - var isPartial = bitmask & PARTIAL_COMPARE_FLAG, - isUnordered = bitmask & UNORDERED_COMPARE_FLAG, - objProps = keys(object), - objLength = objProps.length, - othProps = keys(other), - othLength = othProps.length; - - if (objLength != othLength && !isPartial) { - return false; - } - var index = objLength; - while (index--) { - var key = objProps[index]; - if (!(isPartial ? key in other : baseHas(other, key)) || - !(isUnordered || key == othProps[index])) { - return false; - } - } - var skipCtor = isPartial; - while (++index < objLength) { - key = objProps[index]; - var objValue = object[key], - othValue = other[key]; - - if (customizer) { - var result = isPartial - ? customizer(othValue, objValue, key, other, object, stack) - : customizer(objValue, othValue, key, object, other, stack); - } - // Recursively compare objects (susceptible to call stack limits). - if (!(result === undefined - ? (objValue === othValue || equalFunc(objValue, othValue, customizer, bitmask, stack)) - : result - )) { - return false; - } - skipCtor || (skipCtor = key == 'constructor'); - } - if (!skipCtor) { - var objCtor = object.constructor, - othCtor = other.constructor; - - // Non `Object` object instances with different constructors are not equal. - if (objCtor != othCtor && - ('constructor' in object && 'constructor' in other) && - !(typeof objCtor == 'function' && objCtor instanceof objCtor && - typeof othCtor == 'function' && othCtor instanceof othCtor)) { - return false; - } - } - return true; - } - - /** - * Gets metadata for `func`. - * - * @private - * @param {Function} func The function to query. - * @returns {*} Returns the metadata for `func`. - */ - var getData = !metaMap ? noop : function(func) { - return metaMap.get(func); - }; - - /** - * Gets the name of `func`. - * - * @private - * @param {Function} func The function to query. - * @returns {string} Returns the function name. - */ - function getFuncName(func) { - var result = (func.name + ''), - array = realNames[result], - length = array ? array.length : 0; - - while (length--) { - var data = array[length], - otherFunc = data.func; - if (otherFunc == null || otherFunc == func) { - return data.name; - } - } - return result; - } - - /** - * Gets the appropriate "iteratee" function. If the `_.iteratee` method is - * customized this function returns the custom method, otherwise it returns - * `baseIteratee`. If arguments are provided the chosen function is invoked - * with them and its result is returned. - * - * @private - * @param {*} [value] The value to convert to an iteratee. - * @param {number} [arity] The arity of the created iteratee. - * @returns {Function} Returns the chosen function or its result. - */ - function getIteratee() { - var result = lodash.iteratee || iteratee; - result = result === iteratee ? baseIteratee : result; - return arguments.length ? result(arguments[0], arguments[1]) : result; - } - - /** - * Gets the "length" property value of `object`. - * - * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) - * that affects Safari on at least iOS 8.1-8.3 ARM64. - * - * @private - * @param {Object} object The object to query. - * @returns {*} Returns the "length" value. - */ - var getLength = baseProperty('length'); - - /** - * Gets the property names, values, and compare flags of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the match data of `object`. - */ - function getMatchData(object) { - var result = toPairs(object), - length = result.length; - - while (length--) { - result[length][2] = isStrictComparable(result[length][1]); - } - return result; - } - - /** - * Gets the native function at `key` of `object`. - * - * @private - * @param {Object} object The object to query. - * @param {string} key The key of the method to get. - * @returns {*} Returns the function if it's native, else `undefined`. - */ - function getNative(object, key) { - var value = object == null ? undefined : object[key]; - return isNative(value) ? value : undefined; - } - - /** - * Gets the `toStringTag` of `value`. - * - * @private - * @param {*} value The value to query. - * @returns {string} Returns the `toStringTag`. - */ - function getTag(value) { - return objToString.call(value); - } - - // Fallback for IE 11 providing `toStringTag` values for maps and sets. - if ((Map && getTag(new Map) != mapTag) || (Set && getTag(new Set) != setTag)) { - getTag = function(value) { - var result = objToString.call(value), - Ctor = result == objectTag ? value.constructor : null, - ctorString = typeof Ctor == 'function' ? fnToString.call(Ctor) : ''; - - if (ctorString) { - if (ctorString == mapCtorString) { - return mapTag; - } - if (ctorString == setCtorString) { - return setTag; - } - } - return result; - }; - } - - /** - * Gets the view, applying any `transforms` to the `start` and `end` positions. - * - * @private - * @param {number} start The start of the view. - * @param {number} end The end of the view. - * @param {Array} transforms The transformations to apply to the view. - * @returns {Object} Returns an object containing the `start` and `end` - * positions of the view. - */ - function getView(start, end, transforms) { - var index = -1, - length = transforms.length; - - while (++index < length) { - var data = transforms[index], - size = data.size; - - switch (data.type) { - case 'drop': start += size; break; - case 'dropRight': end -= size; break; - case 'take': end = nativeMin(end, start + size); break; - case 'takeRight': start = nativeMax(start, end - size); break; - } - } - return { 'start': start, 'end': end }; - } - - /** - * Checks if `path` exists on `object`. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path to check. - * @param {Function} hasFunc The function to check properties. - * @returns {boolean} Returns `true` if `path` exists, else `false`. - */ - function hasPath(object, path, hasFunc) { - if (object == null) { - return false; - } - var result = hasFunc(object, path); - if (!result && !isKey(path)) { - path = baseToPath(path); - object = parent(object, path); - if (object != null) { - path = last(path); - result = hasFunc(object, path); - } - } - return result || (isLength(object && object.length) && isIndex(path, object.length) && - (isArray(object) || isString(object) || isArguments(object))); - } - - /** - * Initializes an array clone. - * - * @private - * @param {Array} array The array to clone. - * @returns {Array} Returns the initialized clone. - */ - function initCloneArray(array) { - var length = array.length, - result = new array.constructor(length); - - // Add array properties assigned by `RegExp#exec`. - if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) { - result.index = array.index; - result.input = array.input; - } - return result; - } - - /** - * Initializes an object clone. - * - * @private - * @param {Object} object The object to clone. - * @returns {Object} Returns the initialized clone. - */ - function initCloneObject(object) { - var Ctor = object.constructor; - return (typeof Ctor == 'function' && Ctor instanceof Ctor) ? new Ctor : {}; - } - - /** - * Initializes an object clone based on its `toStringTag`. - * - * **Note:** This function only supports cloning values with tags of - * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. - * - * @private - * @param {Object} object The object to clone. - * @param {string} tag The `toStringTag` of the object to clone. - * @param {boolean} [isDeep] Specify a deep clone. - * @returns {Object} Returns the initialized clone. - */ - function initCloneByTag(object, tag, isDeep) { - var Ctor = object.constructor; - switch (tag) { - case arrayBufferTag: - return cloneBuffer(object); - - case boolTag: - case dateTag: - return new Ctor(+object); - - case float32Tag: case float64Tag: - case int8Tag: case int16Tag: case int32Tag: - case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag: - return cloneTypedArray(object, isDeep); - - case mapTag: - return cloneMap(object); - - case numberTag: - case stringTag: - return new Ctor(object); - - case setTag: - return cloneSet(object); - - case regexpTag: - return cloneRegExp(object); - } - } - - /** - * Creates an array of index keys for `object` values of arrays, - * `arguments` objects, and strings, otherwise `null` is returned. - * - * @private - * @param {Object} object The object to query. - * @returns {Array|null} Returns index keys, else `null`. - */ - function indexKeys(object) { - var length = object ? object.length : undefined; - return (isLength(length) && (isArray(object) || isString(object) || isArguments(object))) - ? baseTimes(length, String) - : null; - } - - /** - * Checks if the provided arguments are from an iteratee call. - * - * @private - * @param {*} value The potential iteratee value argument. - * @param {*} index The potential iteratee index or key argument. - * @param {*} object The potential iteratee object argument. - * @returns {boolean} Returns `true` if the arguments are from an iteratee call, else `false`. - */ - function isIterateeCall(value, index, object) { - if (!isObject(object)) { - return false; - } - var type = typeof index; - if (type == 'number' - ? (isArrayLike(object) && isIndex(index, object.length)) - : (type == 'string' && index in object)) { - var other = object[index]; - return value === value ? (value === other) : (other !== other); - } - return false; - } - - /** - * Checks if `value` is a property name and not a property path. - * - * @private - * @param {*} value The value to check. - * @param {Object} [object] The object to query keys on. - * @returns {boolean} Returns `true` if `value` is a property name, else `false`. - */ - function isKey(value, object) { - if (typeof value == 'number') { - return true; - } - return !isArray(value) && - (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object))); - } - - /** - * Checks if `value` is suitable for use as unique object key. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is suitable, else `false`. - */ - function isKeyable(value) { - var type = typeof value; - return type == 'number' || type == 'boolean' || - (type == 'string' && value !== '__proto__') || value == null; - } - - /** - * Checks if `func` has a lazy counterpart. - * - * @private - * @param {Function} func The function to check. - * @returns {boolean} Returns `true` if `func` has a lazy counterpart, else `false`. - */ - function isLaziable(func) { - var funcName = getFuncName(func), - other = lodash[funcName]; - - if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) { - return false; - } - if (func === other) { - return true; - } - var data = getData(other); - return !!data && func === data[0]; - } - - /** - * Checks if `value` is likely a prototype object. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. - */ - function isPrototype(value) { - var Ctor = value && value.constructor, - proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto; - - return value === proto; - } - - /** - * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` if suitable for strict - * equality comparisons, else `false`. - */ - function isStrictComparable(value) { - return value === value && !isObject(value); - } - - /** - * Merges the function metadata of `source` into `data`. - * - * Merging metadata reduces the number of wrappers used to invoke a function. - * This is possible because methods like `_.bind`, `_.curry`, and `_.partial` - * may be applied regardless of execution order. Methods like `_.ary` and `_.rearg` - * modify function arguments, making the order in which they are executed important, - * preventing the merging of metadata. However, we make an exception for a safe - * common case where curried functions have `_.ary` and or `_.rearg` applied. - * - * @private - * @param {Array} data The destination metadata. - * @param {Array} source The source metadata. - * @returns {Array} Returns `data`. - */ - function mergeData(data, source) { - var bitmask = data[1], - srcBitmask = source[1], - newBitmask = bitmask | srcBitmask, - isCommon = newBitmask < ARY_FLAG; - - var isCombo = - (srcBitmask == ARY_FLAG && (bitmask == CURRY_FLAG)) || - (srcBitmask == ARY_FLAG && (bitmask == REARG_FLAG) && (data[7].length <= source[8])) || - (srcBitmask == (ARY_FLAG | REARG_FLAG) && (source[7].length <= source[8]) && (bitmask == CURRY_FLAG)); - - // Exit early if metadata can't be merged. - if (!(isCommon || isCombo)) { - return data; - } - // Use source `thisArg` if available. - if (srcBitmask & BIND_FLAG) { - data[2] = source[2]; - // Set when currying a bound function. - newBitmask |= (bitmask & BIND_FLAG) ? 0 : CURRY_BOUND_FLAG; - } - // Compose partial arguments. - var value = source[3]; - if (value) { - var partials = data[3]; - data[3] = partials ? composeArgs(partials, value, source[4]) : copyArray(value); - data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : copyArray(source[4]); - } - // Compose partial right arguments. - value = source[5]; - if (value) { - partials = data[5]; - data[5] = partials ? composeArgsRight(partials, value, source[6]) : copyArray(value); - data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : copyArray(source[6]); - } - // Use source `argPos` if available. - value = source[7]; - if (value) { - data[7] = copyArray(value); - } - // Use source `ary` if it's smaller. - if (srcBitmask & ARY_FLAG) { - data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]); - } - // Use source `arity` if one is not provided. - if (data[9] == null) { - data[9] = source[9]; - } - // Use source `func` and merge bitmasks. - data[0] = source[0]; - data[1] = newBitmask; - - return data; - } - - /** - * Used by `_.defaultsDeep` to customize its `_.merge` use. - * - * @private - * @param {*} objValue The destination value. - * @param {*} srcValue The source value. - * @param {string} key The key of the property to merge. - * @param {Object} object The parent object of `objValue`. - * @param {Object} source The parent object of `srcValue`. - * @param {Object} [stack] Tracks traversed source values and their merged counterparts. - * @returns {*} Returns the value to assign. - */ - function mergeDefaults(objValue, srcValue, key, object, source, stack) { - if (isObject(objValue) && isObject(srcValue)) { - stack.set(srcValue, objValue); - baseMerge(objValue, srcValue, mergeDefaults, stack); - } - return objValue === undefined ? baseClone(srcValue) : objValue; - } - - /** - * Gets the parent value at `path` of `object`. - * - * @private - * @param {Object} object The object to query. - * @param {Array} path The path to get the parent value of. - * @returns {*} Returns the parent value. - */ - function parent(object, path) { - return path.length == 1 ? object : get(object, baseSlice(path, 0, -1)); - } - - /** - * Reorder `array` according to the specified indexes where the element at - * the first index is assigned as the first element, the element at - * the second index is assigned as the second element, and so on. - * - * @private - * @param {Array} array The array to reorder. - * @param {Array} indexes The arranged array indexes. - * @returns {Array} Returns `array`. - */ - function reorder(array, indexes) { - var arrLength = array.length, - length = nativeMin(indexes.length, arrLength), - oldArray = copyArray(array); - - while (length--) { - var index = indexes[length]; - array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined; - } - return array; - } - - /** - * Sets metadata for `func`. - * - * **Note:** If this function becomes hot, i.e. is invoked a lot in a short - * period of time, it will trip its breaker and transition to an identity function - * to avoid garbage collection pauses in V8. See [V8 issue 2070](https://code.google.com/p/v8/issues/detail?id=2070) - * for more details. - * - * @private - * @param {Function} func The function to associate metadata with. - * @param {*} data The metadata. - * @returns {Function} Returns `func`. - */ - var setData = (function() { - var count = 0, - lastCalled = 0; - - return function(key, value) { - var stamp = now(), - remaining = HOT_SPAN - (stamp - lastCalled); - - lastCalled = stamp; - if (remaining > 0) { - if (++count >= HOT_COUNT) { - return key; - } - } else { - count = 0; - } - return baseSetData(key, value); - }; - }()); - - /** - * Converts `string` to a property path array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. - */ - function stringToPath(string) { - var result = []; - toString(string).replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; - } - - /** - * Converts `value` to an array-like object if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the array-like object. - */ - function toArrayLikeObject(value) { - return isArrayLikeObject(value) ? value : []; - } - - /** - * Converts `value` to a function if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Function} Returns the function. - */ - function toFunction(value) { - return typeof value == 'function' ? value : identity; - } - - /** - * Creates a clone of `wrapper`. - * - * @private - * @param {Object} wrapper The wrapper to clone. - * @returns {Object} Returns the cloned wrapper. - */ - function wrapperClone(wrapper) { - if (wrapper instanceof LazyWrapper) { - return wrapper.clone(); - } - var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__); - result.__actions__ = copyArray(wrapper.__actions__); - result.__index__ = wrapper.__index__; - result.__values__ = wrapper.__values__; - return result; - } - - /*------------------------------------------------------------------------*/ - - /** - * Creates an array of elements split into groups the length of `size`. - * If `collection` can't be split evenly, the final chunk will be the remaining - * elements. - * - * @static - * @memberOf _ - * @category Array - * @param {Array} array The array to process. - * @param {number} [size=0] The length of each chunk. - * @returns {Array} Returns the new array containing chunks. - * @example - * - * _.chunk(['a', 'b', 'c', 'd'], 2); - * // => [['a', 'b'], ['c', 'd']] - * - * _.chunk(['a', 'b', 'c', 'd'], 3); - * // => [['a', 'b', 'c'], ['d']] - */ - function chunk(array, size) { - size = nativeMax(toInteger(size), 0); - - var length = array ? array.length : 0; - if (!length || size < 1) { - return []; - } - var index = 0, - resIndex = -1, - result = Array(nativeCeil(length / size)); - - while (index < length) { - result[++resIndex] = baseSlice(array, index, (index += size)); - } - return result; - } - - /** - * Creates an array with all falsey values removed. The values `false`, `null`, - * `0`, `""`, `undefined`, and `NaN` are falsey. - * - * @static - * @memberOf _ - * @category Array - * @param {Array} array The array to compact. - * @returns {Array} Returns the new array of filtered values. - * @example - * - * _.compact([0, 1, false, 2, '', 3]); - * // => [1, 2, 3] - */ - function compact(array) { - var index = -1, - length = array ? array.length : 0, - resIndex = -1, - result = []; - - while (++index < length) { - var value = array[index]; - if (value) { - result[++resIndex] = value; - } - } - return result; - } - - /** - * Creates a new array concatenating `array` with any additional arrays - * and/or values. - * - * @static - * @memberOf _ - * @category Array - * @param {Array} array The array to concatenate. - * @param {...*} [values] The values to concatenate. - * @returns {Array} Returns the new concatenated array. - * @example - * - * var array = [1]; - * var other = _.concat(array, 2, [3], [[4]]); - * - * console.log(other); - * // => [1, 2, 3, [4]] - * - * console.log(array); - * // => [1] - */ - var concat = rest(function(array, values) { - values = baseFlatten(values); - return arrayConcat(isArray(array) ? array : [Object(array)], values); - }); - - /** - * Creates an array of unique `array` values not included in the other - * provided arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) - * for equality comparisons. - * - * @static - * @memberOf _ - * @category Array - * @param {Array} array The array to inspect. - * @param {...Array} [values] The values to exclude. - * @returns {Array} Returns the new array of filtered values. - * @example - * - * _.difference([3, 2, 1], [4, 2]); - * // => [3, 1] - */ - var difference = rest(function(array, values) { - return isArrayLikeObject(array) - ? baseDifference(array, baseFlatten(values, false, true)) - : []; - }); - - /** - * This method is like `_.difference` except that it accepts `iteratee` which - * is invoked for each element of `array` and `values` to generate the criterion - * by which uniqueness is computed. The iteratee is invoked with one argument: (value). - * - * @static - * @memberOf _ - * @category Array - * @param {Array} array The array to inspect. - * @param {...Array} [values] The values to exclude. - * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. - * @returns {Array} Returns the new array of filtered values. - * @example - * - * _.differenceBy([3.1, 2.2, 1.3], [4.4, 2.5], Math.floor); - * // => [3.1, 1.3] - * - * // using the `_.property` callback shorthand - * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x'); - * // => [{ 'x': 2 }] - */ - var differenceBy = rest(function(array, values) { - var iteratee = last(values); - if (isArrayLikeObject(iteratee)) { - iteratee = undefined; - } - return isArrayLikeObject(array) - ? baseDifference(array, baseFlatten(values, false, true), getIteratee(iteratee)) - : []; - }); - - /** - * This method is like `_.difference` except that it accepts `comparator` - * which is invoked to compare elements of `array` to `values`. The comparator - * is invoked with two arguments: (arrVal, othVal). - * - * @static - * @memberOf _ - * @category Array - * @param {Array} array The array to inspect. - * @param {...Array} [values] The values to exclude. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of filtered values. - * @example - * - * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; - * - * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual); - * // => [{ 'x': 2, 'y': 1 }] - */ - var differenceWith = rest(function(array, values) { - var comparator = last(values); - if (isArrayLikeObject(comparator)) { - comparator = undefined; - } - return isArrayLikeObject(array) - ? baseDifference(array, baseFlatten(values, false, true), undefined, comparator) - : []; - }); - - /** - * Creates a slice of `array` with `n` elements dropped from the beginning. - * - * @static - * @memberOf _ - * @category Array - * @param {Array} array The array to query. - * @param {number} [n=1] The number of elements to drop. - * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. - * @returns {Array} Returns the slice of `array`. - * @example - * - * _.drop([1, 2, 3]); - * // => [2, 3] - * - * _.drop([1, 2, 3], 2); - * // => [3] - * - * _.drop([1, 2, 3], 5); - * // => [] - * - * _.drop([1, 2, 3], 0); - * // => [1, 2, 3] - */ - function drop(array, n, guard) { - if (!(array && array.length)) { - return []; - } - n = (guard || n === undefined) ? 1 : n; - return baseSlice(array, n < 0 ? 0 : n); - } - - /** - * Creates a slice of `array` with `n` elements dropped from the end. - * - * @static - * @memberOf _ - * @category Array - * @param {Array} array The array to query. - * @param {number} [n=1] The number of elements to drop. - * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. - * @returns {Array} Returns the slice of `array`. - * @example - * - * _.dropRight([1, 2, 3]); - * // => [1, 2] - * - * _.dropRight([1, 2, 3], 2); - * // => [1] - * - * _.dropRight([1, 2, 3], 5); - * // => [] - * - * _.dropRight([1, 2, 3], 0); - * // => [1, 2, 3] - */ - function dropRight(array, n, guard) { - var length = array ? array.length : 0; - if (!length) { - return []; - } - n = (guard || n === undefined) ? 1 : toInteger(n); - n = length - n; - return baseSlice(array, 0, n < 0 ? 0 : n); - } - - /** - * Creates a slice of `array` excluding elements dropped from the end. - * Elements are dropped until `predicate` returns falsey. The predicate is - * invoked with three arguments: (value, index, array). - * - * @static - * @memberOf _ - * @category Array - * @param {Array} array The array to query. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. - * @returns {Array} Returns the slice of `array`. - * @example - * - * var resolve = _.partial(_.map, _, 'user'); - * - * var users = [ - * { 'user': 'barney', 'active': true }, - * { 'user': 'fred', 'active': false }, - * { 'user': 'pebbles', 'active': false } - * ]; - * - * resolve( _.dropRightWhile(users, function(o) { return !o.active; }) ); - * // => ['barney'] - * - * // using the `_.matches` callback shorthand - * resolve( _.dropRightWhile(users, { 'user': 'pebbles', 'active': false }) ); - * // => ['barney', 'fred'] - * - * // using the `_.matchesProperty` callback shorthand - * resolve( _.dropRightWhile(users, ['active', false]) ); - * // => ['barney'] - * - * // using the `_.property` callback shorthand - * resolve( _.dropRightWhile(users, 'active') ); - * // => ['barney', 'fred', 'pebbles'] - */ - function dropRightWhile(array, predicate) { - return (array && array.length) - ? baseWhile(array, getIteratee(predicate, 3), true, true) - : []; - } - - /** - * Creates a slice of `array` excluding elements dropped from the beginning. - * Elements are dropped until `predicate` returns falsey. The predicate is - * invoked with three arguments: (value, index, array). - * - * @static - * @memberOf _ - * @category Array - * @param {Array} array The array to query. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. - * @returns {Array} Returns the slice of `array`. - * @example - * - * var resolve = _.partial(_.map, _, 'user'); - * - * var users = [ - * { 'user': 'barney', 'active': false }, - * { 'user': 'fred', 'active': false }, - * { 'user': 'pebbles', 'active': true } - * ]; - * - * resolve( _.dropWhile(users, function(o) { return !o.active; }) ); - * // => ['pebbles'] - * - * // using the `_.matches` callback shorthand - * resolve( _.dropWhile(users, { 'user': 'barney', 'active': false }) ); - * // => ['fred', 'pebbles'] - * - * // using the `_.matchesProperty` callback shorthand - * resolve( _.dropWhile(users, ['active', false]) ); - * // => ['pebbles'] - * - * // using the `_.property` callback shorthand - * resolve( _.dropWhile(users, 'active') ); - * // => ['barney', 'fred', 'pebbles'] - */ - function dropWhile(array, predicate) { - return (array && array.length) - ? baseWhile(array, getIteratee(predicate, 3), true) - : []; - } - - /** - * Fills elements of `array` with `value` from `start` up to, but not - * including, `end`. - * - * **Note:** This method mutates `array`. - * - * @static - * @memberOf _ - * @category Array - * @param {Array} array The array to fill. - * @param {*} value The value to fill `array` with. - * @param {number} [start=0] The start position. - * @param {number} [end=array.length] The end position. - * @returns {Array} Returns `array`. - * @example - * - * var array = [1, 2, 3]; - * - * _.fill(array, 'a'); - * console.log(array); - * // => ['a', 'a', 'a'] - * - * _.fill(Array(3), 2); - * // => [2, 2, 2] - * - * _.fill([4, 6, 8, 10], '*', 1, 3); - * // => [4, '*', '*', 10] - */ - function fill(array, value, start, end) { - var length = array ? array.length : 0; - if (!length) { - return []; - } - if (start && typeof start != 'number' && isIterateeCall(array, value, start)) { - start = 0; - end = length; - } - return baseFill(array, value, start, end); - } - - /** - * This method is like `_.find` except that it returns the index of the first - * element `predicate` returns truthy for instead of the element itself. - * - * @static - * @memberOf _ - * @category Array - * @param {Array} array The array to search. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. - * @returns {number} Returns the index of the found element, else `-1`. - * @example - * - * var users = [ - * { 'user': 'barney', 'active': false }, - * { 'user': 'fred', 'active': false }, - * { 'user': 'pebbles', 'active': true } - * ]; - * - * _.findIndex(users, function(o) { return o.user == 'barney'; }); - * // => 0 - * - * // using the `_.matches` callback shorthand - * _.findIndex(users, { 'user': 'fred', 'active': false }); - * // => 1 - * - * // using the `_.matchesProperty` callback shorthand - * _.findIndex(users, ['active', false]); - * // => 0 - * - * // using the `_.property` callback shorthand - * _.findIndex(users, 'active'); - * // => 2 - */ - function findIndex(array, predicate) { - return (array && array.length) - ? baseFindIndex(array, getIteratee(predicate, 3)) - : -1; - } - - /** - * This method is like `_.findIndex` except that it iterates over elements - * of `collection` from right to left. - * - * @static - * @memberOf _ - * @category Array - * @param {Array} array The array to search. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. - * @returns {number} Returns the index of the found element, else `-1`. - * @example - * - * var users = [ - * { 'user': 'barney', 'active': true }, - * { 'user': 'fred', 'active': false }, - * { 'user': 'pebbles', 'active': false } - * ]; - * - * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; }); - * // => 2 - * - * // using the `_.matches` callback shorthand - * _.findLastIndex(users, { 'user': 'barney', 'active': true }); - * // => 0 - * - * // using the `_.matchesProperty` callback shorthand - * _.findLastIndex(users, ['active', false]); - * // => 2 - * - * // using the `_.property` callback shorthand - * _.findLastIndex(users, 'active'); - * // => 0 - */ - function findLastIndex(array, predicate) { - return (array && array.length) - ? baseFindIndex(array, getIteratee(predicate, 3), true) - : -1; - } - - /** - * Creates an array of flattened values by running each element in `array` - * through `iteratee` and concating its result to the other mapped values. - * The iteratee is invoked with three arguments: (value, index|key, array). - * - * @static - * @memberOf _ - * @category Array - * @param {Array} array The array to iterate over. - * @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration. - * @returns {Array} Returns the new array. - * @example - * - * function duplicate(n) { - * return [n, n]; - * } - * - * _.flatMap([1, 2], duplicate); - * // => [1, 1, 2, 2] - */ - function flatMap(array, iteratee) { - var length = array ? array.length : 0; - return length ? baseFlatten(arrayMap(array, getIteratee(iteratee, 3))) : []; - } - - /** - * Flattens `array` a single level. - * - * @static - * @memberOf _ - * @category Array - * @param {Array} array The array to flatten. - * @returns {Array} Returns the new flattened array. - * @example - * - * _.flatten([1, [2, 3, [4]]]); - * // => [1, 2, 3, [4]] - */ - function flatten(array) { - var length = array ? array.length : 0; - return length ? baseFlatten(array) : []; - } - - /** - * This method is like `_.flatten` except that it recursively flattens `array`. - * - * @static - * @memberOf _ - * @category Array - * @param {Array} array The array to recursively flatten. - * @returns {Array} Returns the new flattened array. - * @example - * - * _.flattenDeep([1, [2, 3, [4]]]); - * // => [1, 2, 3, 4] - */ - function flattenDeep(array) { - var length = array ? array.length : 0; - return length ? baseFlatten(array, true) : []; - } - - /** - * The inverse of `_.toPairs`; this method returns an object composed - * from key-value `pairs`. - * - * @static - * @memberOf _ - * @category Array - * @param {Array} pairs The key-value pairs. - * @returns {Object} Returns the new object. - * @example - * - * _.fromPairs([['fred', 30], ['barney', 40]]); - * // => { 'fred': 30, 'barney': 40 } - */ - function fromPairs(pairs) { - var index = -1, - length = pairs ? pairs.length : 0, - result = {}; - - while (++index < length) { - var pair = pairs[index]; - baseSet(result, pair[0], pair[1]); - } - return result; - } - - /** - * Gets the first element of `array`. - * - * @static - * @memberOf _ - * @alias first - * @category Array - * @param {Array} array The array to query. - * @returns {*} Returns the first element of `array`. - * @example - * - * _.head([1, 2, 3]); - * // => 1 - * - * _.head([]); - * // => undefined - */ - function head(array) { - return array ? array[0] : undefined; - } - - /** - * Gets the index at which the first occurrence of `value` is found in `array` - * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) - * for equality comparisons. If `fromIndex` is negative, it's used as the offset - * from the end of `array`. If `array` is sorted providing `true` for `fromIndex` - * performs a faster binary search. - * - * @static - * @memberOf _ - * @category Array - * @param {Array} array The array to search. - * @param {*} value The value to search for. - * @param {number} [fromIndex=0] The index to search from. - * @returns {number} Returns the index of the matched value, else `-1`. - * @example - * - * _.indexOf([1, 2, 1, 2], 2); - * // => 1 - * - * // using `fromIndex` - * _.indexOf([1, 2, 1, 2], 2, 2); - * // => 3 - */ - function indexOf(array, value, fromIndex) { - var length = array ? array.length : 0; - if (!length) { - return -1; - } - fromIndex = toInteger(fromIndex); - if (fromIndex < 0) { - fromIndex = nativeMax(length + fromIndex, 0); - } - return baseIndexOf(array, value, fromIndex); - } - - /** - * Gets all but the last element of `array`. - * - * @static - * @memberOf _ - * @category Array - * @param {Array} array The array to query. - * @returns {Array} Returns the slice of `array`. - * @example - * - * _.initial([1, 2, 3]); - * // => [1, 2] - */ - function initial(array) { - return dropRight(array, 1); - } - - /** - * Creates an array of unique values that are included in all of the provided - * arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) - * for equality comparisons. - * - * @static - * @memberOf _ - * @category Array - * @param {...Array} [arrays] The arrays to inspect. - * @returns {Array} Returns the new array of shared values. - * @example - * _.intersection([2, 1], [4, 2], [1, 2]); - * // => [2] - */ - var intersection = rest(function(arrays) { - var mapped = arrayMap(arrays, toArrayLikeObject); - return (mapped.length && mapped[0] === arrays[0]) - ? baseIntersection(mapped) - : []; - }); - - /** - * This method is like `_.intersection` except that it accepts `iteratee` - * which is invoked for each element of each `arrays` to generate the criterion - * by which uniqueness is computed. The iteratee is invoked with one argument: (value). - * - * @static - * @memberOf _ - * @category Array - * @param {...Array} [arrays] The arrays to inspect. - * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. - * @returns {Array} Returns the new array of shared values. - * @example - * - * _.intersectionBy([2.1, 1.2], [4.3, 2.4], Math.floor); - * // => [2.1] - * - * // using the `_.property` callback shorthand - * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); - * // => [{ 'x': 1 }] - */ - var intersectionBy = rest(function(arrays) { - var iteratee = last(arrays), - mapped = arrayMap(arrays, toArrayLikeObject); - - if (iteratee === last(mapped)) { - iteratee = undefined; - } else { - mapped.pop(); - } - return (mapped.length && mapped[0] === arrays[0]) - ? baseIntersection(mapped, getIteratee(iteratee)) - : []; - }); - - /** - * This method is like `_.intersection` except that it accepts `comparator` - * which is invoked to compare elements of `arrays`. The comparator is invoked - * with two arguments: (arrVal, othVal). - * - * @static - * @memberOf _ - * @category Array - * @param {...Array} [arrays] The arrays to inspect. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of shared values. - * @example - * - * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; - * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; - * - * _.intersectionWith(objects, others, _.isEqual); - * // => [{ 'x': 1, 'y': 2 }] - */ - var intersectionWith = rest(function(arrays) { - var comparator = last(arrays), - mapped = arrayMap(arrays, toArrayLikeObject); - - if (comparator === last(mapped)) { - comparator = undefined; - } else { - mapped.pop(); - } - return (mapped.length && mapped[0] === arrays[0]) - ? baseIntersection(mapped, undefined, comparator) - : []; - }); - - /** - * Converts all elements in `array` into a string separated by `separator`. - * - * @static - * @memberOf _ - * @category Array - * @param {Array} array The array to convert. - * @param {string} [separator=','] The element separator. - * @returns {string} Returns the joined string. - * @example - * - * _.join(['a', 'b', 'c'], '~'); - * // => 'a~b~c' - */ - function join(array, separator) { - return array ? nativeJoin.call(array, separator) : ''; - } - - /** - * Gets the last element of `array`. - * - * @static - * @memberOf _ - * @category Array - * @param {Array} array The array to query. - * @returns {*} Returns the last element of `array`. - * @example - * - * _.last([1, 2, 3]); - * // => 3 - */ - function last(array) { - var length = array ? array.length : 0; - return length ? array[length - 1] : undefined; - } - - /** - * This method is like `_.indexOf` except that it iterates over elements of - * `array` from right to left. - * - * @static - * @memberOf _ - * @category Array - * @param {Array} array The array to search. - * @param {*} value The value to search for. - * @param {number} [fromIndex=array.length-1] The index to search from. - * @returns {number} Returns the index of the matched value, else `-1`. - * @example - * - * _.lastIndexOf([1, 2, 1, 2], 2); - * // => 3 - * - * // using `fromIndex` - * _.lastIndexOf([1, 2, 1, 2], 2, 2); - * // => 1 - */ - function lastIndexOf(array, value, fromIndex) { - var length = array ? array.length : 0; - if (!length) { - return -1; - } - var index = length; - if (fromIndex !== undefined) { - index = toInteger(fromIndex); - index = (index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1)) + 1; - } - if (value !== value) { - return indexOfNaN(array, index, true); - } - while (index--) { - if (array[index] === value) { - return index; - } - } - return -1; - } - - /** - * Removes all provided values from `array` using - * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) - * for equality comparisons. - * - * **Note:** Unlike `_.without`, this method mutates `array`. - * - * @static - * @memberOf _ - * @category Array - * @param {Array} array The array to modify. - * @param {...*} [values] The values to remove. - * @returns {Array} Returns `array`. - * @example - * - * var array = [1, 2, 3, 1, 2, 3]; - * - * _.pull(array, 2, 3); - * console.log(array); - * // => [1, 1] - */ - var pull = rest(pullAll); - - /** - * This method is like `_.pull` except that it accepts an array of values to remove. - * - * **Note:** Unlike `_.difference`, this method mutates `array`. - * - * @static - * @memberOf _ - * @category Array - * @param {Array} array The array to modify. - * @param {Array} values The values to remove. - * @returns {Array} Returns `array`. - * @example - * - * var array = [1, 2, 3, 1, 2, 3]; - * - * _.pull(array, [2, 3]); - * console.log(array); - * // => [1, 1] - */ - function pullAll(array, values) { - return (array && array.length && values && values.length) - ? basePullAll(array, values) - : array; - } - - /** - * This method is like `_.pullAll` except that it accepts `iteratee` which is - * invoked for each element of `array` and `values` to to generate the criterion - * by which uniqueness is computed. The iteratee is invoked with one argument: (value). - * - * **Note:** Unlike `_.differenceBy`, this method mutates `array`. - * - * @static - * @memberOf _ - * @category Array - * @param {Array} array The array to modify. - * @param {Array} values The values to remove. - * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. - * @returns {Array} Returns `array`. - * @example - * - * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; - * - * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); - * console.log(array); - * // => [{ 'x': 2 }] - */ - function pullAllBy(array, values, iteratee) { - return (array && array.length && values && values.length) - ? basePullAllBy(array, values, getIteratee(iteratee)) - : array; - } - - /** - * Removes elements from `array` corresponding to `indexes` and returns an - * array of removed elements. - * - * **Note:** Unlike `_.at`, this method mutates `array`. - * - * @static - * @memberOf _ - * @category Array - * @param {Array} array The array to modify. - * @param {...(number|number[])} [indexes] The indexes of elements to remove, - * specified individually or in arrays. - * @returns {Array} Returns the new array of removed elements. - * @example - * - * var array = [5, 10, 15, 20]; - * var evens = _.pullAt(array, 1, 3); - * - * console.log(array); - * // => [5, 15] - * - * console.log(evens); - * // => [10, 20] - */ - var pullAt = rest(function(array, indexes) { - indexes = arrayMap(baseFlatten(indexes), String); - - var result = baseAt(array, indexes); - basePullAt(array, indexes.sort(compareAscending)); - return result; - }); - - /** - * Removes all elements from `array` that `predicate` returns truthy for - * and returns an array of the removed elements. The predicate is invoked with - * three arguments: (value, index, array). - * - * **Note:** Unlike `_.filter`, this method mutates `array`. - * - * @static - * @memberOf _ - * @category Array - * @param {Array} array The array to modify. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. - * @returns {Array} Returns the new array of removed elements. - * @example - * - * var array = [1, 2, 3, 4]; - * var evens = _.remove(array, function(n) { - * return n % 2 == 0; - * }); - * - * console.log(array); - * // => [1, 3] - * - * console.log(evens); - * // => [2, 4] - */ - function remove(array, predicate) { - var result = []; - if (!(array && array.length)) { - return result; - } - var index = -1, - indexes = [], - length = array.length; - - predicate = getIteratee(predicate, 3); - while (++index < length) { - var value = array[index]; - if (predicate(value, index, array)) { - result.push(value); - indexes.push(index); - } - } - basePullAt(array, indexes); - return result; - } - - /** - * Reverses `array` so that the first element becomes the last, the second - * element becomes the second to last, and so on. - * - * **Note:** This method mutates `array` and is based on - * [`Array#reverse`](https://mdn.io/Array/reverse). - * - * @memberOf _ - * @category Array - * @returns {Array} Returns `array`. - * @example - * - * var array = [1, 2, 3]; - * - * _.reverse(array); - * // => [3, 2, 1] - * - * console.log(array); - * // => [3, 2, 1] - */ - function reverse(array) { - return array ? nativeReverse.call(array) : array; - } - - /** - * Creates a slice of `array` from `start` up to, but not including, `end`. - * - * **Note:** This method is used instead of [`Array#slice`](https://mdn.io/Array/slice) - * to ensure dense arrays are returned. - * - * @static - * @memberOf _ - * @category Array - * @param {Array} array The array to slice. - * @param {number} [start=0] The start position. - * @param {number} [end=array.length] The end position. - * @returns {Array} Returns the slice of `array`. - */ - function slice(array, start, end) { - var length = array ? array.length : 0; - if (!length) { - return []; - } - if (end && typeof end != 'number' && isIterateeCall(array, start, end)) { - start = 0; - end = length; - } - return baseSlice(array, start, end); - } - - /** - * Uses a binary search to determine the lowest index at which `value` should - * be inserted into `array` in order to maintain its sort order. - * - * @static - * @memberOf _ - * @category Array - * @param {Array} array The sorted array to inspect. - * @param {*} value The value to evaluate. - * @returns {number} Returns the index at which `value` should be inserted into `array`. - * @example - * - * _.sortedIndex([30, 50], 40); - * // => 1 - * - * _.sortedIndex([4, 5], 4); - * // => 0 - */ - function sortedIndex(array, value) { - return baseSortedIndex(array, value); - } - - /** - * This method is like `_.sortedIndex` except that it accepts `iteratee` - * which is invoked for `value` and each element of `array` to compute their - * sort ranking. The iteratee is invoked with one argument: (value). - * - * @static - * @memberOf _ - * @category Array - * @param {Array} array The sorted array to inspect. - * @param {*} value The value to evaluate. - * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. - * @returns {number} Returns the index at which `value` should be inserted into `array`. - * @example - * - * var dict = { 'thirty': 30, 'forty': 40, 'fifty': 50 }; - * - * _.sortedIndexBy(['thirty', 'fifty'], 'forty', _.propertyOf(dict)); - * // => 1 - * - * // using the `_.property` callback shorthand - * _.sortedIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x'); - * // => 0 - */ - function sortedIndexBy(array, value, iteratee) { - return baseSortedIndexBy(array, value, getIteratee(iteratee)); - } - - /** - * This method is like `_.indexOf` except that it performs a binary - * search on a sorted `array`. - * - * @static - * @memberOf _ - * @category Array - * @param {Array} array The array to search. - * @param {*} value The value to search for. - * @returns {number} Returns the index of the matched value, else `-1`. - * @example - * - * _.sortedIndexOf([1, 1, 2, 2], 2); - * // => 2 - */ - function sortedIndexOf(array, value) { - var length = array ? array.length : 0; - if (length) { - var index = baseSortedIndex(array, value); - if (index < length && - (value === value ? (value === array[index]) : (array[index] !== array[index]))) { - return index; - } - } - return -1; - } - - /** - * This method is like `_.sortedIndex` except that it returns the highest - * index at which `value` should be inserted into `array` in order to - * maintain its sort order. - * - * @static - * @memberOf _ - * @category Array - * @param {Array} array The sorted array to inspect. - * @param {*} value The value to evaluate. - * @returns {number} Returns the index at which `value` should be inserted into `array`. - * @example - * - * _.sortedLastIndex([4, 5], 4); - * // => 1 - */ - function sortedLastIndex(array, value) { - return baseSortedIndex(array, value, true); - } - - /** - * This method is like `_.sortedLastIndex` except that it accepts `iteratee` - * which is invoked for `value` and each element of `array` to compute their - * sort ranking. The iteratee is invoked with one argument: (value). - * - * @static - * @memberOf _ - * @category Array - * @param {Array} array The sorted array to inspect. - * @param {*} value The value to evaluate. - * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. - * @returns {number} Returns the index at which `value` should be inserted into `array`. - * @example - * - * // using the `_.property` callback shorthand - * _.sortedLastIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x'); - * // => 1 - */ - function sortedLastIndexBy(array, value, iteratee) { - return baseSortedIndexBy(array, value, getIteratee(iteratee), true); - } - - /** - * This method is like `_.lastIndexOf` except that it performs a binary - * search on a sorted `array`. - * - * @static - * @memberOf _ - * @category Array - * @param {Array} array The array to search. - * @param {*} value The value to search for. - * @returns {number} Returns the index of the matched value, else `-1`. - * @example - * - * _.sortedLastIndexOf([1, 1, 2, 2], 2); - * // => 3 - */ - function sortedLastIndexOf(array, value) { - var length = array ? array.length : 0; - if (length) { - var index = baseSortedIndex(array, value, true) - 1, - other = array[index]; - - if (value === value ? (value === other) : (other !== other)) { - return index; - } - } - return -1; - } - - /** - * This method is like `_.uniq` except that it's designed and optimized - * for sorted arrays. - * - * @static - * @memberOf _ - * @category Array - * @param {Array} array The array to inspect. - * @returns {Array} Returns the new duplicate free array. - * @example - * - * _.sortedUniq([1, 1, 2]); - * // => [1, 2] - */ - function sortedUniq(array) { - return (array && array.length) - ? baseSortedUniq(array) - : []; - } - - /** - * This method is like `_.uniqBy` except that it's designed and optimized - * for sorted arrays. - * - * @static - * @memberOf _ - * @category Array - * @param {Array} array The array to inspect. - * @param {Function} [iteratee] The iteratee invoked per element. - * @returns {Array} Returns the new duplicate free array. - * @example - * - * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor); - * // => [1.1, 2.2] - */ - function sortedUniqBy(array, iteratee) { - return (array && array.length) - ? baseSortedUniqBy(array, getIteratee(iteratee)) - : []; - } - - /** - * Gets all but the first element of `array`. - * - * @static - * @memberOf _ - * @category Array - * @param {Array} array The array to query. - * @returns {Array} Returns the slice of `array`. - * @example - * - * _.tail([1, 2, 3]); - * // => [2, 3] - */ - function tail(array) { - return drop(array, 1); - } - - /** - * Creates a slice of `array` with `n` elements taken from the beginning. - * - * @static - * @memberOf _ - * @category Array - * @param {Array} array The array to query. - * @param {number} [n=1] The number of elements to take. - * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. - * @returns {Array} Returns the slice of `array`. - * @example - * - * _.take([1, 2, 3]); - * // => [1] - * - * _.take([1, 2, 3], 2); - * // => [1, 2] - * - * _.take([1, 2, 3], 5); - * // => [1, 2, 3] - * - * _.take([1, 2, 3], 0); - * // => [] - */ - function take(array, n, guard) { - if (!(array && array.length)) { - return []; - } - n = (guard || n === undefined) ? 1 : n; - return baseSlice(array, 0, n < 0 ? 0 : n); - } - - /** - * Creates a slice of `array` with `n` elements taken from the end. - * - * @static - * @memberOf _ - * @category Array - * @param {Array} array The array to query. - * @param {number} [n=1] The number of elements to take. - * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. - * @returns {Array} Returns the slice of `array`. - * @example - * - * _.takeRight([1, 2, 3]); - * // => [3] - * - * _.takeRight([1, 2, 3], 2); - * // => [2, 3] - * - * _.takeRight([1, 2, 3], 5); - * // => [1, 2, 3] - * - * _.takeRight([1, 2, 3], 0); - * // => [] - */ - function takeRight(array, n, guard) { - var length = array ? array.length : 0; - if (!length) { - return []; - } - n = (guard || n === undefined) ? 1 : toInteger(n); - n = length - n; - return baseSlice(array, n < 0 ? 0 : n); - } - - /** - * Creates a slice of `array` with elements taken from the end. Elements are - * taken until `predicate` returns falsey. The predicate is invoked with three - * arguments: (value, index, array). - * - * @static - * @memberOf _ - * @category Array - * @param {Array} array The array to query. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. - * @returns {Array} Returns the slice of `array`. - * @example - * - * var resolve = _.partial(_.map, _, 'user'); - * - * var users = [ - * { 'user': 'barney', 'active': true }, - * { 'user': 'fred', 'active': false }, - * { 'user': 'pebbles', 'active': false } - * ]; - * - * resolve( _.takeRightWhile(users, function(o) { return !o.active; }) ); - * // => ['fred', 'pebbles'] - * - * // using the `_.matches` callback shorthand - * resolve( _.takeRightWhile(users, { 'user': 'pebbles', 'active': false }) ); - * // => ['pebbles'] - * - * // using the `_.matchesProperty` callback shorthand - * resolve( _.takeRightWhile(users, ['active', false]) ); - * // => ['fred', 'pebbles'] - * - * // using the `_.property` callback shorthand - * resolve( _.takeRightWhile(users, 'active') ); - * // => [] - */ - function takeRightWhile(array, predicate) { - return (array && array.length) - ? baseWhile(array, getIteratee(predicate, 3), false, true) - : []; - } - - /** - * Creates a slice of `array` with elements taken from the beginning. Elements - * are taken until `predicate` returns falsey. The predicate is invoked with - * three arguments: (value, index, array). - * - * @static - * @memberOf _ - * @category Array - * @param {Array} array The array to query. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. - * @returns {Array} Returns the slice of `array`. - * @example - * - * var resolve = _.partial(_.map, _, 'user'); - * - * var users = [ - * { 'user': 'barney', 'active': false }, - * { 'user': 'fred', 'active': false}, - * { 'user': 'pebbles', 'active': true } - * ]; - * - * resolve( _.takeWhile(users, function(o) { return !o.active; }) ); - * // => ['barney', 'fred'] - * - * // using the `_.matches` callback shorthand - * resolve( _.takeWhile(users, { 'user': 'barney', 'active': false }) ); - * // => ['barney'] - * - * // using the `_.matchesProperty` callback shorthand - * resolve( _.takeWhile(users, ['active', false]) ); - * // => ['barney', 'fred'] - * - * // using the `_.property` callback shorthand - * resolve( _.takeWhile(users, 'active') ); - * // => [] - */ - function takeWhile(array, predicate) { - return (array && array.length) - ? baseWhile(array, getIteratee(predicate, 3)) - : []; - } - - /** - * Creates an array of unique values, in order, from all of the provided arrays - * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) - * for equality comparisons. - * - * @static - * @memberOf _ - * @category Array - * @param {...Array} [arrays] The arrays to inspect. - * @returns {Array} Returns the new array of combined values. - * @example - * - * _.union([2, 1], [4, 2], [1, 2]); - * // => [2, 1, 4] - */ - var union = rest(function(arrays) { - return baseUniq(baseFlatten(arrays, false, true)); - }); - - /** - * This method is like `_.union` except that it accepts `iteratee` which is - * invoked for each element of each `arrays` to generate the criterion by which - * uniqueness is computed. The iteratee is invoked with one argument: (value). - * - * @static - * @memberOf _ - * @category Array - * @param {...Array} [arrays] The arrays to inspect. - * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. - * @returns {Array} Returns the new array of combined values. - * @example - * - * _.unionBy([2.1, 1.2], [4.3, 2.4], Math.floor); - * // => [2.1, 1.2, 4.3] - * - * // using the `_.property` callback shorthand - * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); - * // => [{ 'x': 1 }, { 'x': 2 }] - */ - var unionBy = rest(function(arrays) { - var iteratee = last(arrays); - if (isArrayLikeObject(iteratee)) { - iteratee = undefined; - } - return baseUniq(baseFlatten(arrays, false, true), getIteratee(iteratee)); - }); - - /** - * This method is like `_.union` except that it accepts `comparator` which - * is invoked to compare elements of `arrays`. The comparator is invoked - * with two arguments: (arrVal, othVal). - * - * @static - * @memberOf _ - * @category Array - * @param {...Array} [arrays] The arrays to inspect. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of combined values. - * @example - * - * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; - * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; - * - * _.unionWith(objects, others, _.isEqual); - * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] - */ - var unionWith = rest(function(arrays) { - var comparator = last(arrays); - if (isArrayLikeObject(comparator)) { - comparator = undefined; - } - return baseUniq(baseFlatten(arrays, false, true), undefined, comparator); - }); - - /** - * Creates a duplicate-free version of an array, using - * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) - * for equality comparisons, in which only the first occurrence of each element - * is kept. - * - * @static - * @memberOf _ - * @category Array - * @param {Array} array The array to inspect. - * @returns {Array} Returns the new duplicate free array. - * @example - * - * _.uniq([2, 1, 2]); - * // => [2, 1] - */ - function uniq(array) { - return (array && array.length) - ? baseUniq(array) - : []; - } - - /** - * This method is like `_.uniq` except that it accepts `iteratee` which is - * invoked for each element in `array` to generate the criterion by which - * uniqueness is computed. The iteratee is invoked with one argument: (value). - * - * @static - * @memberOf _ - * @category Array - * @param {Array} array The array to inspect. - * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. - * @returns {Array} Returns the new duplicate free array. - * @example - * - * _.uniqBy([2.1, 1.2, 2.3], Math.floor); - * // => [2.1, 1.2] - * - * // using the `_.property` callback shorthand - * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); - * // => [{ 'x': 1 }, { 'x': 2 }] - */ - function uniqBy(array, iteratee) { - return (array && array.length) - ? baseUniq(array, getIteratee(iteratee)) - : []; - } - - /** - * This method is like `_.uniq` except that it accepts `comparator` which - * is invoked to compare elements of `array`. The comparator is invoked with - * two arguments: (arrVal, othVal). - * - * @static - * @memberOf _ - * @category Array - * @param {Array} array The array to inspect. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new duplicate free array. - * @example - * - * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }]; - * - * _.uniqWith(objects, _.isEqual); - * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }] - */ - function uniqWith(array, comparator) { - return (array && array.length) - ? baseUniq(array, undefined, comparator) - : []; - } - - /** - * This method is like `_.zip` except that it accepts an array of grouped - * elements and creates an array regrouping the elements to their pre-zip - * configuration. - * - * @static - * @memberOf _ - * @category Array - * @param {Array} array The array of grouped elements to process. - * @returns {Array} Returns the new array of regrouped elements. - * @example - * - * var zipped = _.zip(['fred', 'barney'], [30, 40], [true, false]); - * // => [['fred', 30, true], ['barney', 40, false]] - * - * _.unzip(zipped); - * // => [['fred', 'barney'], [30, 40], [true, false]] - */ - function unzip(array) { - if (!(array && array.length)) { - return []; - } - var length = 0; - array = arrayFilter(array, function(group) { - if (isArrayLikeObject(group)) { - length = nativeMax(group.length, length); - return true; - } - }); - return baseTimes(length, function(index) { - return arrayMap(array, baseProperty(index)); - }); - } - - /** - * This method is like `_.unzip` except that it accepts `iteratee` to specify - * how regrouped values should be combined. The iteratee is invoked with four - * arguments: (accumulator, value, index, group). The first element of each - * group is used as the initial `accumulator` value. - * - * @static - * @memberOf _ - * @category Array - * @param {Array} array The array of grouped elements to process. - * @param {Function} [iteratee=_.identity] The function to combine regrouped values. - * @returns {Array} Returns the new array of regrouped elements. - * @example - * - * var zipped = _.zip([1, 2], [10, 20], [100, 200]); - * // => [[1, 10, 100], [2, 20, 200]] - * - * _.unzipWith(zipped, _.add); - * // => [3, 30, 300] - */ - function unzipWith(array, iteratee) { - if (!(array && array.length)) { - return []; - } - var result = unzip(array); - if (iteratee == null) { - return result; - } - return arrayMap(result, function(group) { - return arrayReduce(group, iteratee, undefined, true); - }); - } - - /** - * Creates an array excluding all provided values using - * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) - * for equality comparisons. - * - * @static - * @memberOf _ - * @category Array - * @param {Array} array The array to filter. - * @param {...*} [values] The values to exclude. - * @returns {Array} Returns the new array of filtered values. - * @example - * - * _.without([1, 2, 1, 3], 1, 2); - * // => [3] - */ - var without = rest(function(array, values) { - return isArrayLikeObject(array) - ? baseDifference(array, values) - : []; - }); - - /** - * Creates an array of unique values that is the [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference) - * of the provided arrays. - * - * @static - * @memberOf _ - * @category Array - * @param {...Array} [arrays] The arrays to inspect. - * @returns {Array} Returns the new array of values. - * @example - * - * _.xor([2, 1], [4, 2]); - * // => [1, 4] - */ - var xor = rest(function(arrays) { - return baseXor(arrayFilter(arrays, isArrayLikeObject)); - }); - - /** - * This method is like `_.xor` except that it accepts `iteratee` which is - * invoked for each element of each `arrays` to generate the criterion by which - * uniqueness is computed. The iteratee is invoked with one argument: (value). - * - * @static - * @memberOf _ - * @category Array - * @param {...Array} [arrays] The arrays to inspect. - * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. - * @returns {Array} Returns the new array of values. - * @example - * - * _.xorBy([2.1, 1.2], [4.3, 2.4], Math.floor); - * // => [1.2, 4.3] - * - * // using the `_.property` callback shorthand - * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); - * // => [{ 'x': 2 }] - */ - var xorBy = rest(function(arrays) { - var iteratee = last(arrays); - if (isArrayLikeObject(iteratee)) { - iteratee = undefined; - } - return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee)); - }); - - /** - * This method is like `_.xor` except that it accepts `comparator` which is - * invoked to compare elements of `arrays`. The comparator is invoked with - * two arguments: (arrVal, othVal). - * - * @static - * @memberOf _ - * @category Array - * @param {...Array} [arrays] The arrays to inspect. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of values. - * @example - * - * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; - * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; - * - * _.xorWith(objects, others, _.isEqual); - * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] - */ - var xorWith = rest(function(arrays) { - var comparator = last(arrays); - if (isArrayLikeObject(comparator)) { - comparator = undefined; - } - return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator); - }); - - /** - * Creates an array of grouped elements, the first of which contains the first - * elements of the given arrays, the second of which contains the second elements - * of the given arrays, and so on. - * - * @static - * @memberOf _ - * @category Array - * @param {...Array} [arrays] The arrays to process. - * @returns {Array} Returns the new array of grouped elements. - * @example - * - * _.zip(['fred', 'barney'], [30, 40], [true, false]); - * // => [['fred', 30, true], ['barney', 40, false]] - */ - var zip = rest(unzip); - - /** - * This method is like `_.fromPairs` except that it accepts two arrays, - * one of property names and one of corresponding values. - * - * @static - * @memberOf _ - * @category Array - * @param {Array} [props=[]] The property names. - * @param {Array} [values=[]] The property values. - * @returns {Object} Returns the new object. - * @example - * - * _.zipObject(['fred', 'barney'], [30, 40]); - * // => { 'fred': 30, 'barney': 40 } - */ - function zipObject(props, values) { - var index = -1, - length = props ? props.length : 0, - valsLength = values ? values.length : 0, - result = {}; - - while (++index < length) { - baseSet(result, props[index], index < valsLength ? values[index] : undefined); - } - return result; - } - - /** - * This method is like `_.zip` except that it accepts `iteratee` to specify - * how grouped values should be combined. The iteratee is invoked with four - * arguments: (accumulator, value, index, group). The first element of each - * group is used as the initial `accumulator` value. - * - * @static - * @memberOf _ - * @category Array - * @param {...Array} [arrays] The arrays to process. - * @param {Function} [iteratee=_.identity] The function to combine grouped values. - * @returns {Array} Returns the new array of grouped elements. - * @example - * - * _.zipWith([1, 2], [10, 20], [100, 200], _.add); - * // => [111, 222] - */ - var zipWith = rest(function(arrays) { - var length = arrays.length, - iteratee = length > 1 ? arrays[length - 1] : undefined; - - iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined; - return unzipWith(arrays, iteratee); - }); - - /*------------------------------------------------------------------------*/ - - /** - * Creates a `lodash` object that wraps `value` with explicit method chaining enabled. - * The result of such method chaining must be unwrapped with `_#value`. - * - * @static - * @memberOf _ - * @category Chain - * @param {*} value The value to wrap. - * @returns {Object} Returns the new `lodash` wrapper instance. - * @example - * - * var users = [ - * { 'user': 'barney', 'age': 36 }, - * { 'user': 'fred', 'age': 40 }, - * { 'user': 'pebbles', 'age': 1 } - * ]; - * - * var youngest = _ - * .chain(users) - * .sortBy('age') - * .map(function(o) { - * return o.user + ' is ' + o.age; - * }) - * .head() - * .value(); - * // => 'pebbles is 1' - */ - function chain(value) { - var result = lodash(value); - result.__chain__ = true; - return result; - } - - /** - * This method invokes `interceptor` and returns `value`. The interceptor is - * invoked with one argument; (value). The purpose of this method is to "tap into" - * a method chain in order to perform operations on intermediate results within - * the chain. - * - * @static - * @memberOf _ - * @category Chain - * @param {*} value The value to provide to `interceptor`. - * @param {Function} interceptor The function to invoke. - * @returns {*} Returns `value`. - * @example - * - * _([1, 2, 3]) - * .tap(function(array) { - * array.pop(); - * }) - * .reverse() - * .value(); - * // => [2, 1] - */ - function tap(value, interceptor) { - interceptor(value); - return value; - } - - /** - * This method is like `_.tap` except that it returns the result of `interceptor`. - * - * @static - * @memberOf _ - * @category Chain - * @param {*} value The value to provide to `interceptor`. - * @param {Function} interceptor The function to invoke. - * @returns {*} Returns the result of `interceptor`. - * @example - * - * _(' abc ') - * .chain() - * .trim() - * .thru(function(value) { - * return [value]; - * }) - * .value(); - * // => ['abc'] - */ - function thru(value, interceptor) { - return interceptor(value); - } - - /** - * This method is the wrapper version of `_.at`. - * - * @name at - * @memberOf _ - * @category Chain - * @param {...(string|string[])} [paths] The property paths of elements to pick, - * specified individually or in arrays. - * @returns {Object} Returns the new `lodash` wrapper instance. - * @example - * - * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] }; - * - * _(object).at(['a[0].b.c', 'a[1]']).value(); - * // => [3, 4] - * - * _(['a', 'b', 'c']).at(0, 2).value(); - * // => ['a', 'c'] - */ - var wrapperAt = rest(function(paths) { - paths = baseFlatten(paths); - var length = paths.length, - start = length ? paths[0] : 0, - value = this.__wrapped__, - interceptor = function(object) { return baseAt(object, paths); }; - - if (length > 1 || this.__actions__.length || !(value instanceof LazyWrapper) || !isIndex(start)) { - return this.thru(interceptor); - } - value = value.slice(start, +start + (length ? 1 : 0)); - value.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined }); - return new LodashWrapper(value, this.__chain__).thru(function(array) { - if (length && !array.length) { - array.push(undefined); - } - return array; - }); - }); - - /** - * Enables explicit method chaining on the wrapper object. - * - * @name chain - * @memberOf _ - * @category Chain - * @returns {Object} Returns the new `lodash` wrapper instance. - * @example - * - * var users = [ - * { 'user': 'barney', 'age': 36 }, - * { 'user': 'fred', 'age': 40 } - * ]; - * - * // without explicit chaining - * _(users).head(); - * // => { 'user': 'barney', 'age': 36 } - * - * // with explicit chaining - * _(users) - * .chain() - * .head() - * .pick('user') - * .value(); - * // => { 'user': 'barney' } - */ - function wrapperChain() { - return chain(this); - } - - /** - * Executes the chained sequence and returns the wrapped result. - * - * @name commit - * @memberOf _ - * @category Chain - * @returns {Object} Returns the new `lodash` wrapper instance. - * @example - * - * var array = [1, 2]; - * var wrapped = _(array).push(3); - * - * console.log(array); - * // => [1, 2] - * - * wrapped = wrapped.commit(); - * console.log(array); - * // => [1, 2, 3] - * - * wrapped.last(); - * // => 3 - * - * console.log(array); - * // => [1, 2, 3] - */ - function wrapperCommit() { - return new LodashWrapper(this.value(), this.__chain__); - } - - /** - * This method is the wrapper version of `_.flatMap`. - * - * @static - * @memberOf _ - * @category Chain - * @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration. - * @returns {Object} Returns the new `lodash` wrapper instance. - * @example - * - * function duplicate(n) { - * return [n, n]; - * } - * - * _([1, 2]).flatMap(duplicate).value(); - * // => [1, 1, 2, 2] - */ - function wrapperFlatMap(iteratee) { - return this.map(iteratee).flatten(); - } - - /** - * Gets the next value on a wrapped object following the - * [iterator protocol](https://mdn.io/iteration_protocols#iterator). - * - * @name next - * @memberOf _ - * @category Chain - * @returns {Object} Returns the next iterator value. - * @example - * - * var wrapped = _([1, 2]); - * - * wrapped.next(); - * // => { 'done': false, 'value': 1 } - * - * wrapped.next(); - * // => { 'done': false, 'value': 2 } - * - * wrapped.next(); - * // => { 'done': true, 'value': undefined } - */ - function wrapperNext() { - if (this.__values__ === undefined) { - this.__values__ = toArray(this.value()); - } - var done = this.__index__ >= this.__values__.length, - value = done ? undefined : this.__values__[this.__index__++]; - - return { 'done': done, 'value': value }; - } - - /** - * Enables the wrapper to be iterable. - * - * @name Symbol.iterator - * @memberOf _ - * @category Chain - * @returns {Object} Returns the wrapper object. - * @example - * - * var wrapped = _([1, 2]); - * - * wrapped[Symbol.iterator]() === wrapped; - * // => true - * - * Array.from(wrapped); - * // => [1, 2] - */ - function wrapperToIterator() { - return this; - } - - /** - * Creates a clone of the chained sequence planting `value` as the wrapped value. - * - * @name plant - * @memberOf _ - * @category Chain - * @param {*} value The value to plant. - * @returns {Object} Returns the new `lodash` wrapper instance. - * @example - * - * function square(n) { - * return n * n; - * } - * - * var wrapped = _([1, 2]).map(square); - * var other = wrapped.plant([3, 4]); - * - * other.value(); - * // => [9, 16] - * - * wrapped.value(); - * // => [1, 4] - */ - function wrapperPlant(value) { - var result, - parent = this; - - while (parent instanceof baseLodash) { - var clone = wrapperClone(parent); - clone.__index__ = 0; - clone.__values__ = undefined; - if (result) { - previous.__wrapped__ = clone; - } else { - result = clone; - } - var previous = clone; - parent = parent.__wrapped__; - } - previous.__wrapped__ = value; - return result; - } - - /** - * This method is the wrapper version of `_.reverse`. - * - * **Note:** This method mutates the wrapped array. - * - * @name reverse - * @memberOf _ - * @category Chain - * @returns {Object} Returns the new `lodash` wrapper instance. - * @example - * - * var array = [1, 2, 3]; - * - * _(array).reverse().value() - * // => [3, 2, 1] - * - * console.log(array); - * // => [3, 2, 1] - */ - function wrapperReverse() { - var value = this.__wrapped__; - if (value instanceof LazyWrapper) { - var wrapped = value; - if (this.__actions__.length) { - wrapped = new LazyWrapper(this); - } - wrapped = wrapped.reverse(); - wrapped.__actions__.push({ 'func': thru, 'args': [reverse], 'thisArg': undefined }); - return new LodashWrapper(wrapped, this.__chain__); - } - return this.thru(reverse); - } - - /** - * Executes the chained sequence to extract the unwrapped value. - * - * @name value - * @memberOf _ - * @alias run, toJSON, valueOf - * @category Chain - * @returns {*} Returns the resolved unwrapped value. - * @example - * - * _([1, 2, 3]).value(); - * // => [1, 2, 3] - */ - function wrapperValue() { - return baseWrapperValue(this.__wrapped__, this.__actions__); - } - - /*------------------------------------------------------------------------*/ - - /** - * Creates an object composed of keys generated from the results of running - * each element of `collection` through `iteratee`. The corresponding value - * of each key is the number of times the key was returned by `iteratee`. - * The iteratee is invoked with one argument: (value). - * - * @static - * @memberOf _ - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. - * @returns {Object} Returns the composed aggregate object. - * @example - * - * _.countBy([6.1, 4.2, 6.3], Math.floor); - * // => { '4': 1, '6': 2 } - * - * _.countBy(['one', 'two', 'three'], 'length'); - * // => { '3': 2, '5': 1 } - */ - var countBy = createAggregator(function(result, value, key) { - hasOwnProperty.call(result, key) ? ++result[key] : (result[key] = 1); - }); - - /** - * Checks if `predicate` returns truthy for **all** elements of `collection`. - * Iteration is stopped once `predicate` returns falsey. The predicate is - * invoked with three arguments: (value, index|key, collection). - * - * @static - * @memberOf _ - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. - * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. - * @returns {boolean} Returns `true` if all elements pass the predicate check, else `false`. - * @example - * - * _.every([true, 1, null, 'yes'], Boolean); - * // => false - * - * var users = [ - * { 'user': 'barney', 'active': false }, - * { 'user': 'fred', 'active': false } - * ]; - * - * // using the `_.matches` callback shorthand - * _.every(users, { 'user': 'barney', 'active': false }); - * // => false - * - * // using the `_.matchesProperty` callback shorthand - * _.every(users, ['active', false]); - * // => true - * - * // using the `_.property` callback shorthand - * _.every(users, 'active'); - * // => false - */ - function every(collection, predicate, guard) { - var func = isArray(collection) ? arrayEvery : baseEvery; - if (guard && isIterateeCall(collection, predicate, guard)) { - predicate = undefined; - } - return func(collection, getIteratee(predicate, 3)); - } - - /** - * Iterates over elements of `collection`, returning an array of all elements - * `predicate` returns truthy for. The predicate is invoked with three arguments: - * (value, index|key, collection). - * - * @static - * @memberOf _ - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. - * @returns {Array} Returns the new filtered array. - * @example - * - * var resolve = _.partial(_.map, _, 'user'); - * - * var users = [ - * { 'user': 'barney', 'age': 36, 'active': true }, - * { 'user': 'fred', 'age': 40, 'active': false } - * ]; - * - * resolve( _.filter(users, function(o) { return !o.active; }) ); - * // => ['fred'] - * - * // using the `_.matches` callback shorthand - * resolve( _.filter(users, { 'age': 36, 'active': true }) ); - * // => ['barney'] - * - * // using the `_.matchesProperty` callback shorthand - * resolve( _.filter(users, ['active', false]) ); - * // => ['fred'] - * - * // using the `_.property` callback shorthand - * resolve( _.filter(users, 'active') ); - * // => ['barney'] - */ - function filter(collection, predicate) { - var func = isArray(collection) ? arrayFilter : baseFilter; - return func(collection, getIteratee(predicate, 3)); - } - - /** - * Iterates over elements of `collection`, returning the first element - * `predicate` returns truthy for. The predicate is invoked with three arguments: - * (value, index|key, collection). - * - * @static - * @memberOf _ - * @category Collection - * @param {Array|Object} collection The collection to search. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. - * @returns {*} Returns the matched element, else `undefined`. - * @example - * - * var resolve = _.partial(_.result, _, 'user'); - * - * var users = [ - * { 'user': 'barney', 'age': 36, 'active': true }, - * { 'user': 'fred', 'age': 40, 'active': false }, - * { 'user': 'pebbles', 'age': 1, 'active': true } - * ]; - * - * resolve( _.find(users, function(o) { return o.age < 40; }) ); - * // => 'barney' - * - * // using the `_.matches` callback shorthand - * resolve( _.find(users, { 'age': 1, 'active': true }) ); - * // => 'pebbles' - * - * // using the `_.matchesProperty` callback shorthand - * resolve( _.find(users, ['active', false]) ); - * // => 'fred' - * - * // using the `_.property` callback shorthand - * resolve( _.find(users, 'active') ); - * // => 'barney' - */ - function find(collection, predicate) { - predicate = getIteratee(predicate, 3); - if (isArray(collection)) { - var index = baseFindIndex(collection, predicate); - return index > -1 ? collection[index] : undefined; - } - return baseFind(collection, predicate, baseEach); - } - - /** - * This method is like `_.find` except that it iterates over elements of - * `collection` from right to left. - * - * @static - * @memberOf _ - * @category Collection - * @param {Array|Object} collection The collection to search. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. - * @returns {*} Returns the matched element, else `undefined`. - * @example - * - * _.findLast([1, 2, 3, 4], function(n) { - * return n % 2 == 1; - * }); - * // => 3 - */ - function findLast(collection, predicate) { - predicate = getIteratee(predicate, 3); - if (isArray(collection)) { - var index = baseFindIndex(collection, predicate, true); - return index > -1 ? collection[index] : undefined; - } - return baseFind(collection, predicate, baseEachRight); - } - - /** - * Iterates over elements of `collection` invoking `iteratee` for each element. - * The iteratee is invoked with three arguments: (value, index|key, collection). - * Iteratee functions may exit iteration early by explicitly returning `false`. - * - * **Note:** As with other "Collections" methods, objects with a "length" property - * are iterated like arrays. To avoid this behavior use `_.forIn` or `_.forOwn` - * for object iteration. - * - * @static - * @memberOf _ - * @alias each - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Array|Object} Returns `collection`. - * @example - * - * _([1, 2]).forEach(function(value) { - * console.log(value); - * }); - * // => logs `1` then `2` - * - * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) { - * console.log(key); - * }); - * // => logs 'a' then 'b' (iteration order is not guaranteed) - */ - function forEach(collection, iteratee) { - return (typeof iteratee == 'function' && isArray(collection)) - ? arrayEach(collection, iteratee) - : baseEach(collection, toFunction(iteratee)); - } - - /** - * This method is like `_.forEach` except that it iterates over elements of - * `collection` from right to left. - * - * @static - * @memberOf _ - * @alias eachRight - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Array|Object} Returns `collection`. - * @example - * - * _.forEachRight([1, 2], function(value) { - * console.log(value); - * }); - * // => logs `2` then `1` - */ - function forEachRight(collection, iteratee) { - return (typeof iteratee == 'function' && isArray(collection)) - ? arrayEachRight(collection, iteratee) - : baseEachRight(collection, toFunction(iteratee)); - } - - /** - * Creates an object composed of keys generated from the results of running - * each element of `collection` through `iteratee`. The corresponding value - * of each key is an array of the elements responsible for generating the key. - * The iteratee is invoked with one argument: (value). - * - * @static - * @memberOf _ - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. - * @returns {Object} Returns the composed aggregate object. - * @example - * - * _.groupBy([6.1, 4.2, 6.3], Math.floor); - * // => { '4': [4.2], '6': [6.1, 6.3] } - * - * // using the `_.property` callback shorthand - * _.groupBy(['one', 'two', 'three'], 'length'); - * // => { '3': ['one', 'two'], '5': ['three'] } - */ - var groupBy = createAggregator(function(result, value, key) { - if (hasOwnProperty.call(result, key)) { - result[key].push(value); - } else { - result[key] = [value]; - } - }); - - /** - * Checks if `value` is in `collection`. If `collection` is a string it's checked - * for a substring of `value`, otherwise [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) - * is used for equality comparisons. If `fromIndex` is negative, it's used as - * the offset from the end of `collection`. - * - * @static - * @memberOf _ - * @category Collection - * @param {Array|Object|string} collection The collection to search. - * @param {*} value The value to search for. - * @param {number} [fromIndex=0] The index to search from. - * @param- {Object} [guard] Enables use as an iteratee for functions like `_.reduce`. - * @returns {boolean} Returns `true` if `value` is found, else `false`. - * @example - * - * _.includes([1, 2, 3], 1); - * // => true - * - * _.includes([1, 2, 3], 1, 2); - * // => false - * - * _.includes({ 'user': 'fred', 'age': 40 }, 'fred'); - * // => true - * - * _.includes('pebbles', 'eb'); - * // => true - */ - function includes(collection, value, fromIndex, guard) { - collection = isArrayLike(collection) ? collection : values(collection); - fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0; - - var length = collection.length; - if (fromIndex < 0) { - fromIndex = nativeMax(length + fromIndex, 0); - } - return isString(collection) - ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1) - : (!!length && baseIndexOf(collection, value, fromIndex) > -1); - } - - /** - * Invokes the method at `path` of each element in `collection`, returning - * an array of the results of each invoked method. Any additional arguments - * are provided to each invoked method. If `methodName` is a function it's - * invoked for, and `this` bound to, each element in `collection`. - * - * @static - * @memberOf _ - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Array|Function|string} path The path of the method to invoke or - * the function invoked per iteration. - * @param {...*} [args] The arguments to invoke each method with. - * @returns {Array} Returns the array of results. - * @example - * - * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort'); - * // => [[1, 5, 7], [1, 2, 3]] - * - * _.invokeMap([123, 456], String.prototype.split, ''); - * // => [['1', '2', '3'], ['4', '5', '6']] - */ - var invokeMap = rest(function(collection, path, args) { - var index = -1, - isFunc = typeof path == 'function', - isProp = isKey(path), - result = isArrayLike(collection) ? Array(collection.length) : []; - - baseEach(collection, function(value) { - var func = isFunc ? path : ((isProp && value != null) ? value[path] : undefined); - result[++index] = func ? apply(func, value, args) : baseInvoke(value, path, args); - }); - return result; - }); - - /** - * Creates an object composed of keys generated from the results of running - * each element of `collection` through `iteratee`. The corresponding value - * of each key is the last element responsible for generating the key. The - * iteratee is invoked with one argument: (value). - * - * @static - * @memberOf _ - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. - * @returns {Object} Returns the composed aggregate object. - * @example - * - * var keyData = [ - * { 'dir': 'left', 'code': 97 }, - * { 'dir': 'right', 'code': 100 } - * ]; - * - * _.keyBy(keyData, 'dir'); - * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } } - * - * _.keyBy(keyData, function(o) { - * return String.fromCharCode(o.code); - * }); - * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } } - */ - var keyBy = createAggregator(function(result, value, key) { - result[key] = value; - }); - - /** - * Creates an array of values by running each element in `collection` through - * `iteratee`. The iteratee is invoked with three arguments: - * (value, index|key, collection). - * - * Many lodash methods are guarded to work as iteratees for methods like - * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`. - * - * The guarded methods are: - * `ary`, `curry`, `curryRight`, `drop`, `dropRight`, `every`, `fill`, - * `invert`, `parseInt`, `random`, `range`, `rangeRight`, `slice`, `some`, - * `sortBy`, `take`, `takeRight`, `template`, `trim`, `trimEnd`, `trimStart`, - * and `words` - * - * @static - * @memberOf _ - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration. - * @returns {Array} Returns the new mapped array. - * @example - * - * function square(n) { - * return n * n; - * } - * - * _.map([1, 2], square); - * // => [3, 6] - * - * _.map({ 'a': 1, 'b': 2 }, square); - * // => [3, 6] (iteration order is not guaranteed) - * - * var users = [ - * { 'user': 'barney' }, - * { 'user': 'fred' } - * ]; - * - * // using the `_.property` callback shorthand - * _.map(users, 'user'); - * // => ['barney', 'fred'] - */ - function map(collection, iteratee) { - var func = isArray(collection) ? arrayMap : baseMap; - return func(collection, getIteratee(iteratee, 3)); - } - - /** - * This method is like `_.sortBy` except that it allows specifying the sort - * orders of the iteratees to sort by. If `orders` is unspecified, all values - * are sorted in ascending order. Otherwise, specify an order of "desc" for - * descending or "asc" for ascending sort order of corresponding values. - * - * @static - * @memberOf _ - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function[]|Object[]|string[]} [iteratees=[_.identity]] The iteratees to sort by. - * @param {string[]} [orders] The sort orders of `iteratees`. - * @param- {Object} [guard] Enables use as an iteratee for functions like `_.reduce`. - * @returns {Array} Returns the new sorted array. - * @example - * - * var resolve = _.partial(_.map, _, _.values); - * - * var users = [ - * { 'user': 'fred', 'age': 48 }, - * { 'user': 'barney', 'age': 34 }, - * { 'user': 'fred', 'age': 42 }, - * { 'user': 'barney', 'age': 36 } - * ]; - * - * // sort by `user` in ascending order and by `age` in descending order - * resolve( _.orderBy(users, ['user', 'age'], ['asc', 'desc']) ); - * // => [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] - */ - function orderBy(collection, iteratees, orders, guard) { - if (collection == null) { - return []; - } - if (!isArray(iteratees)) { - iteratees = iteratees == null ? [] : [iteratees]; - } - orders = guard ? undefined : orders; - if (!isArray(orders)) { - orders = orders == null ? [] : [orders]; - } - return baseOrderBy(collection, iteratees, orders); - } - - /** - * Creates an array of elements split into two groups, the first of which - * contains elements `predicate` returns truthy for, while the second of which - * contains elements `predicate` returns falsey for. The predicate is invoked - * with three arguments: (value, index|key, collection). - * - * @static - * @memberOf _ - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. - * @returns {Array} Returns the array of grouped elements. - * @example - * - * var resolve = function(result) { - * return _.map(result, function(array) { return _.map(array, 'user'); }); - * }; - * - * var users = [ - * { 'user': 'barney', 'age': 36, 'active': false }, - * { 'user': 'fred', 'age': 40, 'active': true }, - * { 'user': 'pebbles', 'age': 1, 'active': false } - * ]; - * - * resolve( _.partition(users, function(o) { return o.active; }) ); - * // => [['fred'], ['barney', 'pebbles']] - * - * // using the `_.matches` callback shorthand - * resolve( _.partition(users, { 'age': 1, 'active': false }) ); - * // => [['pebbles'], ['barney', 'fred']] - * - * // using the `_.matchesProperty` callback shorthand - * resolve( _.partition(users, ['active', false]) ); - * // => [['barney', 'pebbles'], ['fred']] - * - * // using the `_.property` callback shorthand - * resolve( _.partition(users, 'active') ); - * // => [['fred'], ['barney', 'pebbles']] - */ - var partition = createAggregator(function(result, value, key) { - result[key ? 0 : 1].push(value); - }, function() { return [[], []]; }); - - /** - * Reduces `collection` to a value which is the accumulated result of running - * each element in `collection` through `iteratee`, where each successive - * invocation is supplied the return value of the previous. If `accumulator` - * is not provided the first element of `collection` is used as the initial - * value. The iteratee is invoked with four arguments: - * (accumulator, value, index|key, collection). - * - * Many lodash methods are guarded to work as iteratees for methods like - * `_.reduce`, `_.reduceRight`, and `_.transform`. - * - * The guarded methods are: - * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`, - * and `sortBy` - * - * @static - * @memberOf _ - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @param {*} [accumulator] The initial value. - * @returns {*} Returns the accumulated value. - * @example - * - * _.reduce([1, 2], function(sum, n) { - * return sum + n; - * }); - * // => 3 - * - * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) { - * (result[value] || (result[value] = [])).push(key); - * return result; - * }, {}); - * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed) - */ - function reduce(collection, iteratee, accumulator) { - var func = isArray(collection) ? arrayReduce : baseReduce, - initFromCollection = arguments.length < 3; - - return func(collection, getIteratee(iteratee, 4), accumulator, initFromCollection, baseEach); - } - - /** - * This method is like `_.reduce` except that it iterates over elements of - * `collection` from right to left. - * - * @static - * @memberOf _ - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @param {*} [accumulator] The initial value. - * @returns {*} Returns the accumulated value. - * @example - * - * var array = [[0, 1], [2, 3], [4, 5]]; - * - * _.reduceRight(array, function(flattened, other) { - * return flattened.concat(other); - * }, []); - * // => [4, 5, 2, 3, 0, 1] - */ - function reduceRight(collection, iteratee, accumulator) { - var func = isArray(collection) ? arrayReduceRight : baseReduce, - initFromCollection = arguments.length < 3; - - return func(collection, getIteratee(iteratee, 4), accumulator, initFromCollection, baseEachRight); - } - - /** - * The opposite of `_.filter`; this method returns the elements of `collection` - * that `predicate` does **not** return truthy for. - * - * @static - * @memberOf _ - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. - * @returns {Array} Returns the new filtered array. - * @example - * - * var resolve = _.partial(_.map, _, 'user'); - * - * var users = [ - * { 'user': 'barney', 'age': 36, 'active': false }, - * { 'user': 'fred', 'age': 40, 'active': true } - * ]; - * - * resolve( _.reject(users, function(o) { return !o.active; }) ); - * // => ['fred'] - * - * // using the `_.matches` callback shorthand - * resolve( _.reject(users, { 'age': 40, 'active': true }) ); - * // => ['barney'] - * - * // using the `_.matchesProperty` callback shorthand - * resolve( _.reject(users, ['active', false]) ); - * // => ['fred'] - * - * // using the `_.property` callback shorthand - * resolve( _.reject(users, 'active') ); - * // => ['barney'] - */ - function reject(collection, predicate) { - var func = isArray(collection) ? arrayFilter : baseFilter; - predicate = getIteratee(predicate, 3); - return func(collection, function(value, index, collection) { - return !predicate(value, index, collection); - }); - } - - /** - * Gets a random element from `collection`. - * - * @static - * @memberOf _ - * @category Collection - * @param {Array|Object} collection The collection to sample. - * @returns {*} Returns the random element. - * @example - * - * _.sample([1, 2, 3, 4]); - * // => 2 - */ - function sample(collection) { - var array = isArrayLike(collection) ? collection : values(collection), - length = array.length; - - return length > 0 ? array[baseRandom(0, length - 1)] : undefined; - } - - /** - * Gets `n` random elements from `collection`. - * - * @static - * @memberOf _ - * @category Collection - * @param {Array|Object} collection The collection to sample. - * @param {number} [n=0] The number of elements to sample. - * @returns {Array} Returns the random elements. - * @example - * - * _.sampleSize([1, 2, 3, 4], 2); - * // => [3, 1] - */ - function sampleSize(collection, n) { - var index = -1, - result = toArray(collection), - length = result.length, - lastIndex = length - 1; - - n = clamp(toInteger(n), 0, length); - while (++index < n) { - var rand = baseRandom(index, lastIndex), - value = result[rand]; - - result[rand] = result[index]; - result[index] = value; - } - result.length = n; - return result; - } - - /** - * Creates an array of shuffled values, using a version of the - * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle). - * - * @static - * @memberOf _ - * @category Collection - * @param {Array|Object} collection The collection to shuffle. - * @returns {Array} Returns the new shuffled array. - * @example - * - * _.shuffle([1, 2, 3, 4]); - * // => [4, 1, 3, 2] - */ - function shuffle(collection) { - return sampleSize(collection, MAX_ARRAY_LENGTH); - } - - /** - * Gets the size of `collection` by returning its length for array-like - * values or the number of own enumerable properties for objects. - * - * @static - * @memberOf _ - * @category Collection - * @param {Array|Object} collection The collection to inspect. - * @returns {number} Returns the collection size. - * @example - * - * _.size([1, 2, 3]); - * // => 3 - * - * _.size({ 'a': 1, 'b': 2 }); - * // => 2 - * - * _.size('pebbles'); - * // => 7 - */ - function size(collection) { - if (collection == null) { - return 0; - } - if (isArrayLike(collection)) { - var result = collection.length; - return (result && isString(collection)) ? stringSize(collection) : result; - } - return keys(collection).length; - } - - /** - * Checks if `predicate` returns truthy for **any** element of `collection`. - * Iteration is stopped once `predicate` returns truthy. The predicate is - * invoked with three arguments: (value, index|key, collection). - * - * @static - * @memberOf _ - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. - * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. - * @returns {boolean} Returns `true` if any element passes the predicate check, else `false`. - * @example - * - * _.some([null, 0, 'yes', false], Boolean); - * // => true - * - * var users = [ - * { 'user': 'barney', 'active': true }, - * { 'user': 'fred', 'active': false } - * ]; - * - * // using the `_.matches` callback shorthand - * _.some(users, { 'user': 'barney', 'active': false }); - * // => false - * - * // using the `_.matchesProperty` callback shorthand - * _.some(users, ['active', false]); - * // => true - * - * // using the `_.property` callback shorthand - * _.some(users, 'active'); - * // => true - */ - function some(collection, predicate, guard) { - var func = isArray(collection) ? arraySome : baseSome; - if (guard && isIterateeCall(collection, predicate, guard)) { - predicate = undefined; - } - return func(collection, getIteratee(predicate, 3)); - } - - /** - * Creates an array of elements, sorted in ascending order by the results of - * running each element in a collection through each iteratee. This method - * performs a stable sort, that is, it preserves the original sort order of - * equal elements. The iteratees are invoked with one argument: (value). - * - * @static - * @memberOf _ - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {...(Function|Function[]|Object|Object[]|string|string[])} [iteratees=[_.identity]] - * The iteratees to sort by, specified individually or in arrays. - * @returns {Array} Returns the new sorted array. - * @example - * - * var resolve = _.partial(_.map, _, _.values); - * - * var users = [ - * { 'user': 'fred', 'age': 48 }, - * { 'user': 'barney', 'age': 36 }, - * { 'user': 'fred', 'age': 42 }, - * { 'user': 'barney', 'age': 34 } - * ]; - * - * resolve( _.sortBy(users, function(o) { return o.user; }) ); - * // => // => [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] - * - * resolve( _.sortBy(users, ['user', 'age']) ); - * // => [['barney', 34], ['barney', 36], ['fred', 42], ['fred', 48]] - * - * resolve( _.sortBy(users, 'user', function(o) { - * return Math.floor(o.age / 10); - * }) ); - * // => [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] - */ - var sortBy = rest(function(collection, iteratees) { - if (collection == null) { - return []; - } - var length = iteratees.length; - if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) { - iteratees = []; - } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) { - iteratees.length = 1; - } - return baseOrderBy(collection, baseFlatten(iteratees), []); - }); - - /*------------------------------------------------------------------------*/ - - /** - * Gets the timestamp of the number of milliseconds that have elapsed since - * the Unix epoch (1 January 1970 00:00:00 UTC). - * - * @static - * @memberOf _ - * @type Function - * @category Date - * @returns {number} Returns the timestamp. - * @example - * - * _.defer(function(stamp) { - * console.log(_.now() - stamp); - * }, _.now()); - * // => logs the number of milliseconds it took for the deferred function to be invoked - */ - var now = Date.now; - - /*------------------------------------------------------------------------*/ - - /** - * The opposite of `_.before`; this method creates a function that invokes - * `func` once it's called `n` or more times. - * - * @static - * @memberOf _ - * @category Function - * @param {number} n The number of calls before `func` is invoked. - * @param {Function} func The function to restrict. - * @returns {Function} Returns the new restricted function. - * @example - * - * var saves = ['profile', 'settings']; - * - * var done = _.after(saves.length, function() { - * console.log('done saving!'); - * }); - * - * _.forEach(saves, function(type) { - * asyncSave({ 'type': type, 'complete': done }); - * }); - * // => logs 'done saving!' after the two async saves have completed - */ - function after(n, func) { - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - n = toInteger(n); - return function() { - if (--n < 1) { - return func.apply(this, arguments); - } - }; - } - - /** - * Creates a function that accepts up to `n` arguments, ignoring any - * additional arguments. - * - * @static - * @memberOf _ - * @category Function - * @param {Function} func The function to cap arguments for. - * @param {number} [n=func.length] The arity cap. - * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. - * @returns {Function} Returns the new function. - * @example - * - * _.map(['6', '8', '10'], _.ary(parseInt, 1)); - * // => [6, 8, 10] - */ - function ary(func, n, guard) { - n = guard ? undefined : n; - n = (func && n == null) ? func.length : n; - return createWrapper(func, ARY_FLAG, undefined, undefined, undefined, undefined, n); - } - - /** - * Creates a function that invokes `func`, with the `this` binding and arguments - * of the created function, while it's called less than `n` times. Subsequent - * calls to the created function return the result of the last `func` invocation. - * - * @static - * @memberOf _ - * @category Function - * @param {number} n The number of calls at which `func` is no longer invoked. - * @param {Function} func The function to restrict. - * @returns {Function} Returns the new restricted function. - * @example - * - * jQuery(element).on('click', _.before(5, addContactToList)); - * // => allows adding up to 4 contacts to the list - */ - function before(n, func) { - var result; - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - n = toInteger(n); - return function() { - if (--n > 0) { - result = func.apply(this, arguments); - } - if (n <= 1) { - func = undefined; - } - return result; - }; - } - - /** - * Creates a function that invokes `func` with the `this` binding of `thisArg` - * and prepends any additional `_.bind` arguments to those provided to the - * bound function. - * - * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds, - * may be used as a placeholder for partially applied arguments. - * - * **Note:** Unlike native `Function#bind` this method doesn't set the "length" - * property of bound functions. - * - * @static - * @memberOf _ - * @category Function - * @param {Function} func The function to bind. - * @param {*} thisArg The `this` binding of `func`. - * @param {...*} [partials] The arguments to be partially applied. - * @returns {Function} Returns the new bound function. - * @example - * - * var greet = function(greeting, punctuation) { - * return greeting + ' ' + this.user + punctuation; - * }; - * - * var object = { 'user': 'fred' }; - * - * var bound = _.bind(greet, object, 'hi'); - * bound('!'); - * // => 'hi fred!' - * - * // using placeholders - * var bound = _.bind(greet, object, _, '!'); - * bound('hi'); - * // => 'hi fred!' - */ - var bind = rest(function(func, thisArg, partials) { - var bitmask = BIND_FLAG; - if (partials.length) { - var holders = replaceHolders(partials, bind.placeholder); - bitmask |= PARTIAL_FLAG; - } - return createWrapper(func, bitmask, thisArg, partials, holders); - }); - - /** - * Binds methods of an object to the object itself, overwriting the existing - * method. - * - * **Note:** This method doesn't set the "length" property of bound functions. - * - * @static - * @memberOf _ - * @category Function - * @param {Object} object The object to bind and assign the bound methods to. - * @param {...(string|string[])} methodNames The object method names to bind, - * specified individually or in arrays. - * @returns {Object} Returns `object`. - * @example - * - * var view = { - * 'label': 'docs', - * 'onClick': function() { - * console.log('clicked ' + this.label); - * } - * }; - * - * _.bindAll(view, 'onClick'); - * jQuery(element).on('click', view.onClick); - * // => logs 'clicked docs' when clicked - */ - var bindAll = rest(function(object, methodNames) { - arrayEach(baseFlatten(methodNames), function(key) { - object[key] = bind(object[key], object); - }); - return object; - }); - - /** - * Creates a function that invokes the method at `object[key]` and prepends - * any additional `_.bindKey` arguments to those provided to the bound function. - * - * This method differs from `_.bind` by allowing bound functions to reference - * methods that may be redefined or don't yet exist. - * See [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern) - * for more details. - * - * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic - * builds, may be used as a placeholder for partially applied arguments. - * - * @static - * @memberOf _ - * @category Function - * @param {Object} object The object to invoke the method on. - * @param {string} key The key of the method. - * @param {...*} [partials] The arguments to be partially applied. - * @returns {Function} Returns the new bound function. - * @example - * - * var object = { - * 'user': 'fred', - * 'greet': function(greeting, punctuation) { - * return greeting + ' ' + this.user + punctuation; - * } - * }; - * - * var bound = _.bindKey(object, 'greet', 'hi'); - * bound('!'); - * // => 'hi fred!' - * - * object.greet = function(greeting, punctuation) { - * return greeting + 'ya ' + this.user + punctuation; - * }; - * - * bound('!'); - * // => 'hiya fred!' - * - * // using placeholders - * var bound = _.bindKey(object, 'greet', _, '!'); - * bound('hi'); - * // => 'hiya fred!' - */ - var bindKey = rest(function(object, key, partials) { - var bitmask = BIND_FLAG | BIND_KEY_FLAG; - if (partials.length) { - var holders = replaceHolders(partials, bindKey.placeholder); - bitmask |= PARTIAL_FLAG; - } - return createWrapper(key, bitmask, object, partials, holders); - }); - - /** - * Creates a function that accepts arguments of `func` and either invokes - * `func` returning its result, if at least `arity` number of arguments have - * been provided, or returns a function that accepts the remaining `func` - * arguments, and so on. The arity of `func` may be specified if `func.length` - * is not sufficient. - * - * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds, - * may be used as a placeholder for provided arguments. - * - * **Note:** This method doesn't set the "length" property of curried functions. - * - * @static - * @memberOf _ - * @category Function - * @param {Function} func The function to curry. - * @param {number} [arity=func.length] The arity of `func`. - * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. - * @returns {Function} Returns the new curried function. - * @example - * - * var abc = function(a, b, c) { - * return [a, b, c]; - * }; - * - * var curried = _.curry(abc); - * - * curried(1)(2)(3); - * // => [1, 2, 3] - * - * curried(1, 2)(3); - * // => [1, 2, 3] - * - * curried(1, 2, 3); - * // => [1, 2, 3] - * - * // using placeholders - * curried(1)(_, 3)(2); - * // => [1, 2, 3] - */ - function curry(func, arity, guard) { - arity = guard ? undefined : arity; - var result = createWrapper(func, CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity); - result.placeholder = curry.placeholder; - return result; - } - - /** - * This method is like `_.curry` except that arguments are applied to `func` - * in the manner of `_.partialRight` instead of `_.partial`. - * - * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic - * builds, may be used as a placeholder for provided arguments. - * - * **Note:** This method doesn't set the "length" property of curried functions. - * - * @static - * @memberOf _ - * @category Function - * @param {Function} func The function to curry. - * @param {number} [arity=func.length] The arity of `func`. - * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. - * @returns {Function} Returns the new curried function. - * @example - * - * var abc = function(a, b, c) { - * return [a, b, c]; - * }; - * - * var curried = _.curryRight(abc); - * - * curried(3)(2)(1); - * // => [1, 2, 3] - * - * curried(2, 3)(1); - * // => [1, 2, 3] - * - * curried(1, 2, 3); - * // => [1, 2, 3] - * - * // using placeholders - * curried(3)(1, _)(2); - * // => [1, 2, 3] - */ - function curryRight(func, arity, guard) { - arity = guard ? undefined : arity; - var result = createWrapper(func, CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity); - result.placeholder = curryRight.placeholder; - return result; - } - - /** - * Creates a debounced function that delays invoking `func` until after `wait` - * milliseconds have elapsed since the last time the debounced function was - * invoked. The debounced function comes with a `cancel` method to cancel - * delayed `func` invocations and a `flush` method to immediately invoke them. - * Provide an options object to indicate whether `func` should be invoked on - * the leading and/or trailing edge of the `wait` timeout. The `func` is invoked - * with the last arguments provided to the debounced function. Subsequent calls - * to the debounced function return the result of the last `func` invocation. - * - * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked - * on the trailing edge of the timeout only if the the debounced function is - * invoked more than once during the `wait` timeout. - * - * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation) - * for details over the differences between `_.debounce` and `_.throttle`. - * - * @static - * @memberOf _ - * @category Function - * @param {Function} func The function to debounce. - * @param {number} [wait=0] The number of milliseconds to delay. - * @param {Object} [options] The options object. - * @param {boolean} [options.leading=false] Specify invoking on the leading - * edge of the timeout. - * @param {number} [options.maxWait] The maximum time `func` is allowed to be - * delayed before it's invoked. - * @param {boolean} [options.trailing=true] Specify invoking on the trailing - * edge of the timeout. - * @returns {Function} Returns the new debounced function. - * @example - * - * // avoid costly calculations while the window size is in flux - * jQuery(window).on('resize', _.debounce(calculateLayout, 150)); - * - * // invoke `sendMail` when clicked, debouncing subsequent calls - * jQuery(element).on('click', _.debounce(sendMail, 300, { - * 'leading': true, - * 'trailing': false - * })); - * - * // ensure `batchLog` is invoked once after 1 second of debounced calls - * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 }); - * var source = new EventSource('/stream'); - * jQuery(source).on('message', debounced); - * - * // cancel a trailing debounced invocation - * jQuery(window).on('popstate', debounced.cancel); - */ - function debounce(func, wait, options) { - var args, - maxTimeoutId, - result, - stamp, - thisArg, - timeoutId, - trailingCall, - lastCalled = 0, - leading = false, - maxWait = false, - trailing = true; - - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - wait = toNumber(wait) || 0; - if (isObject(options)) { - leading = !!options.leading; - maxWait = 'maxWait' in options && nativeMax(toNumber(options.maxWait) || 0, wait); - trailing = 'trailing' in options ? !!options.trailing : trailing; - } - - function cancel() { - if (timeoutId) { - clearTimeout(timeoutId); - } - if (maxTimeoutId) { - clearTimeout(maxTimeoutId); - } - lastCalled = 0; - args = maxTimeoutId = thisArg = timeoutId = trailingCall = undefined; - } - - function complete(isCalled, id) { - if (id) { - clearTimeout(id); - } - maxTimeoutId = timeoutId = trailingCall = undefined; - if (isCalled) { - lastCalled = now(); - result = func.apply(thisArg, args); - if (!timeoutId && !maxTimeoutId) { - args = thisArg = undefined; - } - } - } - - function delayed() { - var remaining = wait - (now() - stamp); - if (remaining <= 0 || remaining > wait) { - complete(trailingCall, maxTimeoutId); - } else { - timeoutId = setTimeout(delayed, remaining); - } - } - - function flush() { - if ((timeoutId && trailingCall) || (maxTimeoutId && trailing)) { - result = func.apply(thisArg, args); - } - cancel(); - return result; - } - - function maxDelayed() { - complete(trailing, timeoutId); - } - - function debounced() { - args = arguments; - stamp = now(); - thisArg = this; - trailingCall = trailing && (timeoutId || !leading); - - if (maxWait === false) { - var leadingCall = leading && !timeoutId; - } else { - if (!maxTimeoutId && !leading) { - lastCalled = stamp; - } - var remaining = maxWait - (stamp - lastCalled), - isCalled = remaining <= 0 || remaining > maxWait; - - if (isCalled) { - if (maxTimeoutId) { - maxTimeoutId = clearTimeout(maxTimeoutId); - } - lastCalled = stamp; - result = func.apply(thisArg, args); - } - else if (!maxTimeoutId) { - maxTimeoutId = setTimeout(maxDelayed, remaining); - } - } - if (isCalled && timeoutId) { - timeoutId = clearTimeout(timeoutId); - } - else if (!timeoutId && wait !== maxWait) { - timeoutId = setTimeout(delayed, wait); - } - if (leadingCall) { - isCalled = true; - result = func.apply(thisArg, args); - } - if (isCalled && !timeoutId && !maxTimeoutId) { - args = thisArg = undefined; - } - return result; - } - debounced.cancel = cancel; - debounced.flush = flush; - return debounced; - } - - /** - * Defers invoking the `func` until the current call stack has cleared. Any - * additional arguments are provided to `func` when it's invoked. - * - * @static - * @memberOf _ - * @category Function - * @param {Function} func The function to defer. - * @param {...*} [args] The arguments to invoke `func` with. - * @returns {number} Returns the timer id. - * @example - * - * _.defer(function(text) { - * console.log(text); - * }, 'deferred'); - * // logs 'deferred' after one or more milliseconds - */ - var defer = rest(function(func, args) { - return baseDelay(func, 1, args); - }); - - /** - * Invokes `func` after `wait` milliseconds. Any additional arguments are - * provided to `func` when it's invoked. - * - * @static - * @memberOf _ - * @category Function - * @param {Function} func The function to delay. - * @param {number} wait The number of milliseconds to delay invocation. - * @param {...*} [args] The arguments to invoke `func` with. - * @returns {number} Returns the timer id. - * @example - * - * _.delay(function(text) { - * console.log(text); - * }, 1000, 'later'); - * // => logs 'later' after one second - */ - var delay = rest(function(func, wait, args) { - return baseDelay(func, toNumber(wait) || 0, args); - }); - - /** - * Creates a function that invokes `func` with arguments reversed. - * - * @static - * @memberOf _ - * @category Function - * @param {Function} func The function to flip arguments for. - * @returns {Function} Returns the new function. - * @example - * - * var flipped = _.flip(function() { - * return _.toArray(arguments); - * }); - * - * flipped('a', 'b', 'c', 'd'); - * // => ['d', 'c', 'b', 'a'] - */ - function flip(func) { - return createWrapper(func, FLIP_FLAG); - } - - /** - * Creates a function that memoizes the result of `func`. If `resolver` is - * provided it determines the cache key for storing the result based on the - * arguments provided to the memoized function. By default, the first argument - * provided to the memoized function is used as the map cache key. The `func` - * is invoked with the `this` binding of the memoized function. - * - * **Note:** The cache is exposed as the `cache` property on the memoized - * function. Its creation may be customized by replacing the `_.memoize.Cache` - * constructor with one whose instances implement the [`Map`](http://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-map-prototype-object) - * method interface of `delete`, `get`, `has`, and `set`. - * - * @static - * @memberOf _ - * @category Function - * @param {Function} func The function to have its output memoized. - * @param {Function} [resolver] The function to resolve the cache key. - * @returns {Function} Returns the new memoizing function. - * @example - * - * var object = { 'a': 1, 'b': 2 }; - * var other = { 'c': 3, 'd': 4 }; - * - * var values = _.memoize(_.values); - * values(object); - * // => [1, 2] - * - * values(other); - * // => [3, 4] - * - * object.a = 2; - * values(object); - * // => [1, 2] - * - * // modifying the result cache - * values.cache.set(object, ['a', 'b']); - * values(object); - * // => ['a', 'b'] - * - * // replacing `_.memoize.Cache` - * _.memoize.Cache = WeakMap; - */ - function memoize(func, resolver) { - if (typeof func != 'function' || (resolver && typeof resolver != 'function')) { - throw new TypeError(FUNC_ERROR_TEXT); - } - var memoized = function() { - var args = arguments, - key = resolver ? resolver.apply(this, args) : args[0], - cache = memoized.cache; - - if (cache.has(key)) { - return cache.get(key); - } - var result = func.apply(this, args); - memoized.cache = cache.set(key, result); - return result; - }; - memoized.cache = new memoize.Cache; - return memoized; - } - - /** - * Creates a function that negates the result of the predicate `func`. The - * `func` predicate is invoked with the `this` binding and arguments of the - * created function. - * - * @static - * @memberOf _ - * @category Function - * @param {Function} predicate The predicate to negate. - * @returns {Function} Returns the new function. - * @example - * - * function isEven(n) { - * return n % 2 == 0; - * } - * - * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven)); - * // => [1, 3, 5] - */ - function negate(predicate) { - if (typeof predicate != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - return function() { - return !predicate.apply(this, arguments); - }; - } - - /** - * Creates a function that is restricted to invoking `func` once. Repeat calls - * to the function return the value of the first invocation. The `func` is - * invoked with the `this` binding and arguments of the created function. - * - * @static - * @memberOf _ - * @category Function - * @param {Function} func The function to restrict. - * @returns {Function} Returns the new restricted function. - * @example - * - * var initialize = _.once(createApplication); - * initialize(); - * initialize(); - * // `initialize` invokes `createApplication` once - */ - function once(func) { - return before(2, func); - } - - /** - * Creates a function that invokes `func` with arguments transformed by - * corresponding `transforms`. - * - * @static - * @memberOf _ - * @category Function - * @param {Function} func The function to wrap. - * @param {...(Function|Function[])} [transforms] The functions to transform - * arguments, specified individually or in arrays. - * @returns {Function} Returns the new function. - * @example - * - * function doubled(n) { - * return n * 2; - * } - * - * function square(n) { - * return n * n; - * } - * - * var func = _.overArgs(function(x, y) { - * return [x, y]; - * }, square, doubled); - * - * func(9, 3); - * // => [81, 6] - * - * func(10, 5); - * // => [100, 10] - */ - var overArgs = rest(function(func, transforms) { - transforms = arrayMap(baseFlatten(transforms), getIteratee()); - - var funcsLength = transforms.length; - return rest(function(args) { - var index = -1, - length = nativeMin(args.length, funcsLength); - - while (++index < length) { - args[index] = transforms[index].call(this, args[index]); - } - return apply(func, this, args); - }); - }); - - /** - * Creates a function that invokes `func` with `partial` arguments prepended - * to those provided to the new function. This method is like `_.bind` except - * it does **not** alter the `this` binding. - * - * The `_.partial.placeholder` value, which defaults to `_` in monolithic - * builds, may be used as a placeholder for partially applied arguments. - * - * **Note:** This method doesn't set the "length" property of partially - * applied functions. - * - * @static - * @memberOf _ - * @category Function - * @param {Function} func The function to partially apply arguments to. - * @param {...*} [partials] The arguments to be partially applied. - * @returns {Function} Returns the new partially applied function. - * @example - * - * var greet = function(greeting, name) { - * return greeting + ' ' + name; - * }; - * - * var sayHelloTo = _.partial(greet, 'hello'); - * sayHelloTo('fred'); - * // => 'hello fred' - * - * // using placeholders - * var greetFred = _.partial(greet, _, 'fred'); - * greetFred('hi'); - * // => 'hi fred' - */ - var partial = rest(function(func, partials) { - var holders = replaceHolders(partials, partial.placeholder); - return createWrapper(func, PARTIAL_FLAG, undefined, partials, holders); - }); - - /** - * This method is like `_.partial` except that partially applied arguments - * are appended to those provided to the new function. - * - * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic - * builds, may be used as a placeholder for partially applied arguments. - * - * **Note:** This method doesn't set the "length" property of partially - * applied functions. - * - * @static - * @memberOf _ - * @category Function - * @param {Function} func The function to partially apply arguments to. - * @param {...*} [partials] The arguments to be partially applied. - * @returns {Function} Returns the new partially applied function. - * @example - * - * var greet = function(greeting, name) { - * return greeting + ' ' + name; - * }; - * - * var greetFred = _.partialRight(greet, 'fred'); - * greetFred('hi'); - * // => 'hi fred' - * - * // using placeholders - * var sayHelloTo = _.partialRight(greet, 'hello', _); - * sayHelloTo('fred'); - * // => 'hello fred' - */ - var partialRight = rest(function(func, partials) { - var holders = replaceHolders(partials, partialRight.placeholder); - return createWrapper(func, PARTIAL_RIGHT_FLAG, undefined, partials, holders); - }); - - /** - * Creates a function that invokes `func` with arguments arranged according - * to the specified indexes where the argument value at the first index is - * provided as the first argument, the argument value at the second index is - * provided as the second argument, and so on. - * - * @static - * @memberOf _ - * @category Function - * @param {Function} func The function to rearrange arguments for. - * @param {...(number|number[])} indexes The arranged argument indexes, - * specified individually or in arrays. - * @returns {Function} Returns the new function. - * @example - * - * var rearged = _.rearg(function(a, b, c) { - * return [a, b, c]; - * }, 2, 0, 1); - * - * rearged('b', 'c', 'a') - * // => ['a', 'b', 'c'] - */ - var rearg = rest(function(func, indexes) { - return createWrapper(func, REARG_FLAG, undefined, undefined, undefined, baseFlatten(indexes)); - }); - - /** - * Creates a function that invokes `func` with the `this` binding of the - * created function and arguments from `start` and beyond provided as an array. - * - * **Note:** This method is based on the [rest parameter](https://mdn.io/rest_parameters). - * - * @static - * @memberOf _ - * @category Function - * @param {Function} func The function to apply a rest parameter to. - * @param {number} [start=func.length-1] The start position of the rest parameter. - * @returns {Function} Returns the new function. - * @example - * - * var say = _.rest(function(what, names) { - * return what + ' ' + _.initial(names).join(', ') + - * (_.size(names) > 1 ? ', & ' : '') + _.last(names); - * }); - * - * say('hello', 'fred', 'barney', 'pebbles'); - * // => 'hello fred, barney, & pebbles' - */ - function rest(func, start) { - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - start = nativeMax(start === undefined ? (func.length - 1) : toInteger(start), 0); - return function() { - var args = arguments, - index = -1, - length = nativeMax(args.length - start, 0), - array = Array(length); - - while (++index < length) { - array[index] = args[start + index]; - } - switch (start) { - case 0: return func.call(this, array); - case 1: return func.call(this, args[0], array); - case 2: return func.call(this, args[0], args[1], array); - } - var otherArgs = Array(start + 1); - index = -1; - while (++index < start) { - otherArgs[index] = args[index]; - } - otherArgs[start] = array; - return apply(func, this, otherArgs); - }; - } - - /** - * Creates a function that invokes `func` with the `this` binding of the created - * function and an array of arguments much like [`Function#apply`](https://es5.github.io/#x15.3.4.3). - * - * **Note:** This method is based on the [spread operator](https://mdn.io/spread_operator). - * - * @static - * @memberOf _ - * @category Function - * @param {Function} func The function to spread arguments over. - * @returns {Function} Returns the new function. - * @example - * - * var say = _.spread(function(who, what) { - * return who + ' says ' + what; - * }); - * - * say(['fred', 'hello']); - * // => 'fred says hello' - * - * // with a Promise - * var numbers = Promise.all([ - * Promise.resolve(40), - * Promise.resolve(36) - * ]); - * - * numbers.then(_.spread(function(x, y) { - * return x + y; - * })); - * // => a Promise of 76 - */ - function spread(func) { - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - return function(array) { - return apply(func, this, array); - }; - } - - /** - * Creates a throttled function that only invokes `func` at most once per - * every `wait` milliseconds. The throttled function comes with a `cancel` - * method to cancel delayed `func` invocations and a `flush` method to - * immediately invoke them. Provide an options object to indicate whether - * `func` should be invoked on the leading and/or trailing edge of the `wait` - * timeout. The `func` is invoked with the last arguments provided to the - * throttled function. Subsequent calls to the throttled function return the - * result of the last `func` invocation. - * - * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked - * on the trailing edge of the timeout only if the the throttled function is - * invoked more than once during the `wait` timeout. - * - * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation) - * for details over the differences between `_.throttle` and `_.debounce`. - * - * @static - * @memberOf _ - * @category Function - * @param {Function} func The function to throttle. - * @param {number} [wait=0] The number of milliseconds to throttle invocations to. - * @param {Object} [options] The options object. - * @param {boolean} [options.leading=true] Specify invoking on the leading - * edge of the timeout. - * @param {boolean} [options.trailing=true] Specify invoking on the trailing - * edge of the timeout. - * @returns {Function} Returns the new throttled function. - * @example - * - * // avoid excessively updating the position while scrolling - * jQuery(window).on('scroll', _.throttle(updatePosition, 100)); - * - * // invoke `renewToken` when the click event is fired, but not more than once every 5 minutes - * var throttled = _.throttle(renewToken, 300000, { 'trailing': false }); - * jQuery(element).on('click', throttled); - * - * // cancel a trailing throttled invocation - * jQuery(window).on('popstate', throttled.cancel); - */ - function throttle(func, wait, options) { - var leading = true, - trailing = true; - - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - if (isObject(options)) { - leading = 'leading' in options ? !!options.leading : leading; - trailing = 'trailing' in options ? !!options.trailing : trailing; - } - return debounce(func, wait, { 'leading': leading, 'maxWait': wait, 'trailing': trailing }); - } - - /** - * Creates a function that accepts up to one argument, ignoring any - * additional arguments. - * - * @static - * @memberOf _ - * @category Function - * @param {Function} func The function to cap arguments for. - * @returns {Function} Returns the new function. - * @example - * - * _.map(['6', '8', '10'], _.unary(parseInt)); - * // => [6, 8, 10] - */ - function unary(func) { - return ary(func, 1); - } - - /** - * Creates a function that provides `value` to the wrapper function as its - * first argument. Any additional arguments provided to the function are - * appended to those provided to the wrapper function. The wrapper is invoked - * with the `this` binding of the created function. - * - * @static - * @memberOf _ - * @category Function - * @param {*} value The value to wrap. - * @param {Function} wrapper The wrapper function. - * @returns {Function} Returns the new function. - * @example - * - * var p = _.wrap(_.escape, function(func, text) { - * return '

    ' + func(text) + '

    '; - * }); - * - * p('fred, barney, & pebbles'); - * // => '

    fred, barney, & pebbles

    ' - */ - function wrap(value, wrapper) { - wrapper = wrapper == null ? identity : wrapper; - return partial(wrapper, value); - } - - /*------------------------------------------------------------------------*/ - - /** - * Creates a shallow clone of `value`. - * - * **Note:** This method is loosely based on the - * [structured clone algorithm](http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm). - * The enumerable properties of `arguments` objects and objects created by - * constructors other than `Object` are cloned to plain `Object` objects. An - * empty object is returned for uncloneable values such as functions, DOM nodes, - * Maps, Sets, and WeakMaps. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to clone. - * @returns {*} Returns the cloned value. - * @example - * - * var users = [ - * { 'user': 'barney' }, - * { 'user': 'fred' } - * ]; - * - * var shallow = _.clone(users); - * console.log(shallow[0] === users[0]); - * // => true - */ - function clone(value) { - return baseClone(value); - } - - /** - * This method is like `_.clone` except that it accepts `customizer` which - * is invoked to produce the cloned value. If `customizer` returns `undefined` - * cloning is handled by the method instead. The `customizer` is invoked with - * up to five arguments; (value [, index|key, object, stack]). - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to clone. - * @param {Function} [customizer] The function to customize cloning. - * @returns {*} Returns the cloned value. - * @example - * - * function customizer(value) { - * if (_.isElement(value)) { - * return value.cloneNode(false); - * } - * } - * - * var el = _.clone(document.body, customizer); - * - * console.log(el === document.body); - * // => false - * console.log(el.nodeName); - * // => BODY - * console.log(el.childNodes.length); - * // => 0 - */ - function cloneWith(value, customizer) { - return baseClone(value, false, customizer); - } - - /** - * This method is like `_.clone` except that it recursively clones `value`. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to recursively clone. - * @returns {*} Returns the deep cloned value. - * @example - * - * var users = [ - * { 'user': 'barney' }, - * { 'user': 'fred' } - * ]; - * - * var deep = _.cloneDeep(users); - * console.log(deep[0] === users[0]); - * // => false - */ - function cloneDeep(value) { - return baseClone(value, true); - } - - /** - * This method is like `_.cloneWith` except that it recursively clones `value`. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to recursively clone. - * @param {Function} [customizer] The function to customize cloning. - * @returns {*} Returns the deep cloned value. - * @example - * - * function customizer(value) { - * if (_.isElement(value)) { - * return value.cloneNode(true); - * } - * } - * - * var el = _.cloneDeep(document.body, customizer); - * - * console.log(el === document.body); - * // => false - * console.log(el.nodeName); - * // => BODY - * console.log(el.childNodes.length); - * // => 20 - */ - function cloneDeepWith(value, customizer) { - return baseClone(value, true, customizer); - } - - /** - * Performs a [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) - * comparison between two values to determine if they are equivalent. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - * @example - * - * var object = { 'user': 'fred' }; - * var other = { 'user': 'fred' }; - * - * _.eq(object, object); - * // => true - * - * _.eq(object, other); - * // => false - * - * _.eq('a', 'a'); - * // => true - * - * _.eq('a', Object('a')); - * // => false - * - * _.eq(NaN, NaN); - * // => true - */ - function eq(value, other) { - return value === other || (value !== value && other !== other); - } - - /** - * Checks if `value` is greater than `other`. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if `value` is greater than `other`, else `false`. - * @example - * - * _.gt(3, 1); - * // => true - * - * _.gt(3, 3); - * // => false - * - * _.gt(1, 3); - * // => false - */ - function gt(value, other) { - return value > other; - } - - /** - * Checks if `value` is greater than or equal to `other`. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if `value` is greater than or equal to `other`, else `false`. - * @example - * - * _.gte(3, 1); - * // => true - * - * _.gte(3, 3); - * // => true - * - * _.gte(1, 3); - * // => false - */ - function gte(value, other) { - return value >= other; - } - - /** - * Checks if `value` is likely an `arguments` object. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isArguments(function() { return arguments; }()); - * // => true - * - * _.isArguments([1, 2, 3]); - * // => false - */ - function isArguments(value) { - // Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode. - return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') && - (!propertyIsEnumerable.call(value, 'callee') || objToString.call(value) == argsTag); - } - - /** - * Checks if `value` is classified as an `Array` object. - * - * @static - * @memberOf _ - * @type Function - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isArray([1, 2, 3]); - * // => true - * - * _.isArray(document.body.children); - * // => false - * - * _.isArray('abc'); - * // => false - * - * _.isArray(_.noop); - * // => false - */ - var isArray = Array.isArray; - - /** - * Checks if `value` is array-like. A value is considered array-like if it's - * not a function and has a `value.length` that's an integer greater than or - * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. - * - * @static - * @memberOf _ - * @type Function - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is array-like, else `false`. - * @example - * - * _.isArrayLike([1, 2, 3]); - * // => true - * - * _.isArrayLike(document.body.children); - * // => true - * - * _.isArrayLike('abc'); - * // => true - * - * _.isArrayLike(_.noop); - * // => false - */ - function isArrayLike(value) { - return value != null && - !(typeof value == 'function' && isFunction(value)) && isLength(getLength(value)); - } - - /** - * This method is like `_.isArrayLike` except that it also checks if `value` - * is an object. - * - * @static - * @memberOf _ - * @type Function - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an array-like object, else `false`. - * @example - * - * _.isArrayLikeObject([1, 2, 3]); - * // => true - * - * _.isArrayLikeObject(document.body.children); - * // => true - * - * _.isArrayLikeObject('abc'); - * // => false - * - * _.isArrayLikeObject(_.noop); - * // => false - */ - function isArrayLikeObject(value) { - return isObjectLike(value) && isArrayLike(value); - } - - /** - * Checks if `value` is classified as a boolean primitive or object. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isBoolean(false); - * // => true - * - * _.isBoolean(null); - * // => false - */ - function isBoolean(value) { - return value === true || value === false || - (isObjectLike(value) && objToString.call(value) == boolTag); - } - - /** - * Checks if `value` is classified as a `Date` object. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isDate(new Date); - * // => true - * - * _.isDate('Mon April 23 2012'); - * // => false - */ - function isDate(value) { - return isObjectLike(value) && objToString.call(value) == dateTag; - } - - /** - * Checks if `value` is likely a DOM element. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`. - * @example - * - * _.isElement(document.body); - * // => true - * - * _.isElement(''); - * // => false - */ - function isElement(value) { - return !!value && value.nodeType === 1 && isObjectLike(value) && !isPlainObject(value); - } - - /** - * Checks if `value` is empty. A value is considered empty unless it's an - * `arguments` object, array, string, or jQuery-like collection with a length - * greater than `0` or an object with own enumerable properties. - * - * @static - * @memberOf _ - * @category Lang - * @param {Array|Object|string} value The value to inspect. - * @returns {boolean} Returns `true` if `value` is empty, else `false`. - * @example - * - * _.isEmpty(null); - * // => true - * - * _.isEmpty(true); - * // => true - * - * _.isEmpty(1); - * // => true - * - * _.isEmpty([1, 2, 3]); - * // => false - * - * _.isEmpty({ 'a': 1 }); - * // => false - */ - function isEmpty(value) { - return (!isObjectLike(value) || isFunction(value.splice)) - ? !size(value) - : !keys(value).length; - } - - /** - * Performs a deep comparison between two values to determine if they are - * equivalent. - * - * **Note:** This method supports comparing arrays, booleans, `Date` objects, - * numbers, `Object` objects, regexes, and strings. Objects are compared by - * their own, not inherited, enumerable properties. Functions and DOM nodes - * are **not** supported. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - * @example - * - * var object = { 'user': 'fred' }; - * var other = { 'user': 'fred' }; - * - * _.isEqual(object, other); - * // => true - * - * object === other; - * // => false - */ - function isEqual(value, other) { - return baseIsEqual(value, other); - } - - /** - * This method is like `_.isEqual` except that it accepts `customizer` which is - * invoked to compare values. If `customizer` returns `undefined` comparisons are - * handled by the method instead. The `customizer` is invoked with up to seven arguments: - * (objValue, othValue [, index|key, object, other, stack]). - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @param {Function} [customizer] The function to customize comparisons. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - * @example - * - * function isGreeting(value) { - * return /^h(?:i|ello)$/.test(value); - * } - * - * function customizer(objValue, othValue) { - * if (isGreeting(objValue) && isGreeting(othValue)) { - * return true; - * } - * } - * - * var array = ['hello', 'goodbye']; - * var other = ['hi', 'goodbye']; - * - * _.isEqualWith(array, other, customizer); - * // => true - */ - function isEqualWith(value, other, customizer) { - customizer = typeof customizer == 'function' ? customizer : undefined; - var result = customizer ? customizer(value, other) : undefined; - return result === undefined ? baseIsEqual(value, other, customizer) : !!result; - } - - /** - * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`, - * `SyntaxError`, `TypeError`, or `URIError` object. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an error object, else `false`. - * @example - * - * _.isError(new Error); - * // => true - * - * _.isError(Error); - * // => false - */ - function isError(value) { - return isObjectLike(value) && - typeof value.message == 'string' && objToString.call(value) == errorTag; - } - - /** - * Checks if `value` is a finite primitive number. - * - * **Note:** This method is based on [`Number.isFinite`](https://mdn.io/Number/isFinite). - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a finite number, else `false`. - * @example - * - * _.isFinite(3); - * // => true - * - * _.isFinite(Number.MAX_VALUE); - * // => true - * - * _.isFinite(3.14); - * // => true - * - * _.isFinite(Infinity); - * // => false - */ - function isFinite(value) { - return typeof value == 'number' && nativeIsFinite(value); - } - - /** - * Checks if `value` is classified as a `Function` object. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isFunction(_); - * // => true - * - * _.isFunction(/abc/); - * // => false - */ - function isFunction(value) { - // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 8 which returns 'object' for typed array constructors, and - // PhantomJS 1.9 which returns 'function' for `NodeList` instances. - var tag = isObject(value) ? objToString.call(value) : ''; - return tag == funcTag || tag == genTag; - } - - /** - * Checks if `value` is an integer. - * - * **Note:** This method is based on [`Number.isInteger`](https://mdn.io/Number/isInteger). - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an integer, else `false`. - * @example - * - * _.isInteger(3); - * // => true - * - * _.isInteger(Number.MIN_VALUE); - * // => false - * - * _.isInteger(Infinity); - * // => false - * - * _.isInteger('3'); - * // => false - */ - function isInteger(value) { - return typeof value == 'number' && value == toInteger(value); - } - - /** - * Checks if `value` is a valid array-like length. - * - * **Note:** This function is loosely based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. - * @example - * - * _.isLength(3); - * // => true - * - * _.isLength(Number.MIN_VALUE); - * // => false - * - * _.isLength(Infinity); - * // => false - * - * _.isLength('3'); - * // => false - */ - function isLength(value) { - return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; - } - - /** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ - function isObject(value) { - // Avoid a V8 JIT bug in Chrome 19-20. - // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); - } - - /** - * Checks if `value` is object-like. A value is object-like if it's not `null` - * and has a `typeof` result of "object". - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is object-like, else `false`. - * @example - * - * _.isObjectLike({}); - * // => true - * - * _.isObjectLike([1, 2, 3]); - * // => true - * - * _.isObjectLike(_.noop); - * // => false - * - * _.isObjectLike(null); - * // => false - */ - function isObjectLike(value) { - return !!value && typeof value == 'object'; - } - - /** - * Performs a deep comparison between `object` and `source` to determine if - * `object` contains equivalent property values. - * - * **Note:** This method supports comparing properties of arrays, booleans, - * `Date` objects, numbers, `Object` objects, regexes, and strings. Functions - * and DOM nodes are **not** supported. Provide a customizer function to extend - * support for comparing other values. - * - * @static - * @memberOf _ - * @category Lang - * @param {Object} object The object to inspect. - * @param {Object} source The object of property values to match. - * @returns {boolean} Returns `true` if `object` is a match, else `false`. - * @example - * - * var object = { 'user': 'fred', 'age': 40 }; - * - * _.isMatch(object, { 'age': 40 }); - * // => true - * - * _.isMatch(object, { 'age': 36 }); - * // => false - */ - function isMatch(object, source) { - return object === source || baseIsMatch(object, source, getMatchData(source)); - } - - /** - * This method is like `_.isMatch` except that it accepts `customizer` which - * is invoked to compare values. If `customizer` returns `undefined` comparisons - * are handled by the method instead. The `customizer` is invoked with three - * arguments: (objValue, srcValue, index|key, object, source). - * - * @static - * @memberOf _ - * @category Lang - * @param {Object} object The object to inspect. - * @param {Object} source The object of property values to match. - * @param {Function} [customizer] The function to customize comparisons. - * @returns {boolean} Returns `true` if `object` is a match, else `false`. - * @example - * - * function isGreeting(value) { - * return /^h(?:i|ello)$/.test(value); - * } - * - * function customizer(objValue, srcValue) { - * if (isGreeting(objValue) && isGreeting(srcValue)) { - * return true; - * } - * } - * - * var object = { 'greeting': 'hello' }; - * var source = { 'greeting': 'hi' }; - * - * _.isMatchWith(object, source, customizer); - * // => true - */ - function isMatchWith(object, source, customizer) { - customizer = typeof customizer == 'function' ? customizer : undefined; - return baseIsMatch(object, source, getMatchData(source), customizer); - } - - /** - * Checks if `value` is `NaN`. - * - * **Note:** This method is not the same as [`isNaN`](https://es5.github.io/#x15.1.2.4) - * which returns `true` for `undefined` and other non-numeric values. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. - * @example - * - * _.isNaN(NaN); - * // => true - * - * _.isNaN(new Number(NaN)); - * // => true - * - * isNaN(undefined); - * // => true - * - * _.isNaN(undefined); - * // => false - */ - function isNaN(value) { - // An `NaN` primitive is the only value that is not equal to itself. - // Perform the `toStringTag` check first to avoid errors with some ActiveX objects in IE. - return isNumber(value) && value != +value; - } - - /** - * Checks if `value` is a native function. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a native function, else `false`. - * @example - * - * _.isNative(Array.prototype.push); - * // => true - * - * _.isNative(_); - * // => false - */ - function isNative(value) { - if (value == null) { - return false; - } - if (isFunction(value)) { - return reIsNative.test(fnToString.call(value)); - } - return isObjectLike(value) && - (isHostObject(value) ? reIsNative : reIsHostCtor).test(value); - } - - /** - * Checks if `value` is `null`. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is `null`, else `false`. - * @example - * - * _.isNull(null); - * // => true - * - * _.isNull(void 0); - * // => false - */ - function isNull(value) { - return value === null; - } - - /** - * Checks if `value` is `null` or `undefined`. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is nullish, else `false`. - * @example - * - * _.isNil(null); - * // => true - * - * _.isNil(void 0); - * // => true - * - * _.isNil(NaN); - * // => false - */ - function isNil(value) { - return value == null; - } - - /** - * Checks if `value` is classified as a `Number` primitive or object. - * - * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are classified - * as numbers, use the `_.isFinite` method. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isNumber(3); - * // => true - * - * _.isNumber(Number.MIN_VALUE); - * // => true - * - * _.isNumber(Infinity); - * // => true - * - * _.isNumber('3'); - * // => false - */ - function isNumber(value) { - return typeof value == 'number' || - (isObjectLike(value) && objToString.call(value) == numberTag); - } - - /** - * Checks if `value` is a plain object, that is, an object created by the - * `Object` constructor or one with a `[[Prototype]]` of `null`. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. - * @example - * - * function Foo() { - * this.a = 1; - * } - * - * _.isPlainObject(new Foo); - * // => false - * - * _.isPlainObject([1, 2, 3]); - * // => false - * - * _.isPlainObject({ 'x': 0, 'y': 0 }); - * // => true - * - * _.isPlainObject(Object.create(null)); - * // => true - */ - function isPlainObject(value) { - if (!isObjectLike(value) || objToString.call(value) != objectTag || isHostObject(value)) { - return false; - } - var proto = objectProto; - if (typeof value.constructor == 'function') { - proto = getPrototypeOf(value); - } - if (proto === null) { - return true; - } - var Ctor = proto.constructor; - return (typeof Ctor == 'function' && - Ctor instanceof Ctor && fnToString.call(Ctor) == objCtorString); - } - - /** - * Checks if `value` is classified as a `RegExp` object. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isRegExp(/abc/); - * // => true - * - * _.isRegExp('/abc/'); - * // => false - */ - function isRegExp(value) { - return isObject(value) && objToString.call(value) == regexpTag; - } - - /** - * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754 - * double precision number which isn't the result of a rounded unsafe integer. - * - * **Note:** This method is based on [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger). - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`. - * @example - * - * _.isSafeInteger(3); - * // => true - * - * _.isSafeInteger(Number.MIN_VALUE); - * // => false - * - * _.isSafeInteger(Infinity); - * // => false - * - * _.isSafeInteger('3'); - * // => false - */ - function isSafeInteger(value) { - return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER; - } - - /** - * Checks if `value` is classified as a `String` primitive or object. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isString('abc'); - * // => true - * - * _.isString(1); - * // => false - */ - function isString(value) { - return typeof value == 'string' || - (!isArray(value) && isObjectLike(value) && objToString.call(value) == stringTag); - } - - /** - * Checks if `value` is classified as a typed array. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isTypedArray(new Uint8Array); - * // => true - * - * _.isTypedArray([]); - * // => false - */ - function isTypedArray(value) { - return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objToString.call(value)]; - } - - /** - * Checks if `value` is `undefined`. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`. - * @example - * - * _.isUndefined(void 0); - * // => true - * - * _.isUndefined(null); - * // => false - */ - function isUndefined(value) { - return value === undefined; - } - - /** - * Checks if `value` is less than `other`. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if `value` is less than `other`, else `false`. - * @example - * - * _.lt(1, 3); - * // => true - * - * _.lt(3, 3); - * // => false - * - * _.lt(3, 1); - * // => false - */ - function lt(value, other) { - return value < other; - } - - /** - * Checks if `value` is less than or equal to `other`. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if `value` is less than or equal to `other`, else `false`. - * @example - * - * _.lte(1, 3); - * // => true - * - * _.lte(3, 3); - * // => true - * - * _.lte(3, 1); - * // => false - */ - function lte(value, other) { - return value <= other; - } - - /** - * Converts `value` to an array. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to convert. - * @returns {Array} Returns the converted array. - * @example - * - * (function() { - * return _.toArray(arguments).slice(1); - * }(1, 2, 3)); - * // => [2, 3] - */ - function toArray(value) { - if (!value) { - return []; - } - if (isArrayLike(value)) { - return isString(value) ? stringToArray(value) : copyArray(value); - } - if (iteratorSymbol && value[iteratorSymbol]) { - return iteratorToArray(value[iteratorSymbol]()); - } - var tag = getTag(value), - func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values); - - return func(value); - } - - /** - * Converts `value` to an integer. - * - * **Note:** This function is loosely based on [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger). - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to convert. - * @returns {number} Returns the converted integer. - * @example - * - * _.toInteger(3); - * // => 3 - * - * _.toInteger(Number.MIN_VALUE); - * // => 0 - * - * _.toInteger(Infinity); - * // => 1.7976931348623157e+308 - * - * _.toInteger('3'); - * // => 3 - */ - function toInteger(value) { - if (!value) { - return value === 0 ? value : 0; - } - value = toNumber(value); - if (value === INFINITY || value === -INFINITY) { - var sign = (value < 0 ? -1 : 1); - return sign * MAX_INTEGER; - } - var remainder = value % 1; - return value === value ? (remainder ? value - remainder : value) : 0; - } - - /** - * Converts `value` to an integer suitable for use as the length of an - * array-like object. - * - * **Note:** This method is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to convert. - * @return {number} Returns the converted integer. - * @example - * - * _.toLength(3); - * // => 3 - * - * _.toLength(Number.MIN_VALUE); - * // => 0 - * - * _.toLength(Infinity); - * // => 4294967295 - * - * _.toLength('3'); - * // => 3 - */ - function toLength(value) { - if (!value) { - return 0; - } - return clamp(toInteger(value), 0, MAX_ARRAY_LENGTH); - } - - /** - * Converts `value` to a number. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to process. - * @returns {number} Returns the number. - * @example - * - * _.toNumber(3); - * // => 3 - * - * _.toNumber(Number.MIN_VALUE); - * // => 5e-324 - * - * _.toNumber(Infinity); - * // => Infinity - * - * _.toNumber('3'); - * // => 3 - */ - function toNumber(value) { - if (!value) { - return value === 0 ? value : +value; - } - if (isObject(value)) { - var other = isFunction(value.valueOf) ? value.valueOf() : value; - value = isObject(other) ? (other + '') : other; - } - if (typeof value == 'number' || !isString(value)) { - return +value; - } - value = baseTrim(value); - var isBinary = reIsBinary.test(value); - return (isBinary || reIsOctal.test(value)) - ? nativeParseInt(value.slice(2), isBinary ? 2 : 8) - : (reIsBadHex.test(value) ? NAN : +value); - } - - /** - * Converts `value` to a plain object flattening inherited enumerable - * properties of `value` to own properties of the plain object. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to convert. - * @returns {Object} Returns the converted plain object. - * @example - * - * function Foo() { - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.assign({ 'a': 1 }, new Foo); - * // => { 'a': 1, 'b': 2 } - * - * _.assign({ 'a': 1 }, _.toPlainObject(new Foo)); - * // => { 'a': 1, 'b': 2, 'c': 3 } - */ - function toPlainObject(value) { - return copyObject(value, keysIn(value)); - } - - /** - * Converts `value` to a safe integer. A safe integer can be compared and - * represented correctly. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to convert. - * @returns {number} Returns the converted integer. - * @example - * - * _.toSafeInteger(3); - * // => 3 - * - * _.toSafeInteger(Number.MIN_VALUE); - * // => 0 - * - * _.toSafeInteger(Infinity); - * // => 9007199254740991 - * - * _.toSafeInteger('3'); - * // => 3 - */ - function toSafeInteger(value) { - if (!value) { - return value === 0 ? value : 0; - } - return clamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER); - } - - /** - * Converts `value` to a string if it's not one. An empty string is returned - * for `null` and `undefined` values. The sign of `-0` is preserved. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to process. - * @returns {string} Returns the string. - * @example - * - * _.toString(null); - * // => '' - * - * _.toString(-0); - * // => '-0' - * - * _.toString([1, 2, 3]); - * // => '1,2,3' - */ - function toString(value) { - // Exit early for strings to avoid a performance hit in some environments. - if (typeof value == 'string') { - return value; - } - var result = value == null ? '' : (value + ''); - return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; - } - - /*------------------------------------------------------------------------*/ - - /** - * Assigns own enumerable properties of source objects to the destination - * object. Source objects are applied from left to right. Subsequent sources - * overwrite property assignments of previous sources. - * - * **Note:** This method mutates `object` and is loosely based on - * [`Object.assign`](https://mdn.io/Object/assign). - * - * @static - * @memberOf _ - * @category Object - * @param {Object} object The destination object. - * @param {...Object} [sources] The source objects. - * @returns {Object} Returns `object`. - * @example - * - * function Foo() { - * this.c = 3; - * } - * - * function Bar() { - * this.e = 5; - * } - * - * Foo.prototype.d = 4; - * Bar.prototype.f = 6; - * - * _.assign({ 'a': 1 }, new Foo, new Bar); - * // => { 'a': 1, 'c': 3, 'e': 5 } - */ - var assign = createAssigner(function(object, source) { - copyObject(source, keys(source), object); - }); - - /** - * This method is like `_.assign` except that it iterates over own and - * inherited source properties. - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @alias extend - * @category Object - * @param {Object} object The destination object. - * @param {...Object} [sources] The source objects. - * @returns {Object} Returns `object`. - * @example - * - * function Foo() { - * this.b = 2; - * } - * - * function Bar() { - * this.d = 4; - * } - * - * Foo.prototype.c = 3; - * Bar.prototype.e = 5; - * - * _.assignIn({ 'a': 1 }, new Foo, new Bar); - * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5 } - */ - var assignIn = createAssigner(function(object, source) { - copyObject(source, keysIn(source), object); - }); - - /** - * This method is like `_.assignIn` except that it accepts `customizer` which - * is invoked to produce the assigned values. If `customizer` returns `undefined` - * assignment is handled by the method instead. The `customizer` is invoked - * with five arguments: (objValue, srcValue, key, object, source). - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @alias extendWith - * @category Object - * @param {Object} object The destination object. - * @param {...Object} sources The source objects. - * @param {Function} [customizer] The function to customize assigned values. - * @returns {Object} Returns `object`. - * @example - * - * function customizer(objValue, srcValue) { - * return _.isUndefined(objValue) ? srcValue : objValue; - * } - * - * var defaults = _.partialRight(_.assignInWith, customizer); - * - * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); - * // => { 'a': 1, 'b': 2 } - */ - var assignInWith = createAssigner(function(object, source, customizer) { - copyObjectWith(source, keysIn(source), object, customizer); - }); - - /** - * This method is like `_.assign` except that it accepts `customizer` which - * is invoked to produce the assigned values. If `customizer` returns `undefined` - * assignment is handled by the method instead. The `customizer` is invoked - * with five arguments: (objValue, srcValue, key, object, source). - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @category Object - * @param {Object} object The destination object. - * @param {...Object} sources The source objects. - * @param {Function} [customizer] The function to customize assigned values. - * @returns {Object} Returns `object`. - * @example - * - * function customizer(objValue, srcValue) { - * return _.isUndefined(objValue) ? srcValue : objValue; - * } - * - * var defaults = _.partialRight(_.assignWith, customizer); - * - * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); - * // => { 'a': 1, 'b': 2 } - */ - var assignWith = createAssigner(function(object, source, customizer) { - copyObjectWith(source, keys(source), object, customizer); - }); - - /** - * Creates an array of values corresponding to `paths` of `object`. - * - * @static - * @memberOf _ - * @category Object - * @param {Object} object The object to iterate over. - * @param {...(string|string[])} [paths] The property paths of elements to pick, - * specified individually or in arrays. - * @returns {Array} Returns the new array of picked elements. - * @example - * - * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] }; - * - * _.at(object, ['a[0].b.c', 'a[1]']); - * // => [3, 4] - * - * _.at(['a', 'b', 'c'], 0, 2); - * // => ['a', 'c'] - */ - var at = rest(function(object, paths) { - return baseAt(object, baseFlatten(paths)); - }); - - /** - * Creates an object that inherits from the `prototype` object. If a `properties` - * object is provided its own enumerable properties are assigned to the created object. - * - * @static - * @memberOf _ - * @category Object - * @param {Object} prototype The object to inherit from. - * @param {Object} [properties] The properties to assign to the object. - * @returns {Object} Returns the new object. - * @example - * - * function Shape() { - * this.x = 0; - * this.y = 0; - * } - * - * function Circle() { - * Shape.call(this); - * } - * - * Circle.prototype = _.create(Shape.prototype, { - * 'constructor': Circle - * }); - * - * var circle = new Circle; - * circle instanceof Circle; - * // => true - * - * circle instanceof Shape; - * // => true - */ - function create(prototype, properties) { - var result = baseCreate(prototype); - return properties ? baseAssign(result, properties) : result; - } - - /** - * Assigns own and inherited enumerable properties of source objects to the - * destination object for all destination properties that resolve to `undefined`. - * Source objects are applied from left to right. Once a property is set, - * additional values of the same property are ignored. - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @category Object - * @param {Object} object The destination object. - * @param {...Object} [sources] The source objects. - * @returns {Object} Returns `object`. - * @example - * - * _.defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' }); - * // => { 'user': 'barney', 'age': 36 } - */ - var defaults = rest(function(args) { - args.push(undefined, assignInDefaults); - return apply(assignInWith, undefined, args); - }); - - /** - * This method is like `_.defaults` except that it recursively assigns - * default properties. - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @category Object - * @param {Object} object The destination object. - * @param {...Object} [sources] The source objects. - * @returns {Object} Returns `object`. - * @example - * - * _.defaultsDeep({ 'user': { 'name': 'barney' } }, { 'user': { 'name': 'fred', 'age': 36 } }); - * // => { 'user': { 'name': 'barney', 'age': 36 } } - * - */ - var defaultsDeep = rest(function(args) { - args.push(undefined, mergeDefaults); - return apply(mergeWith, undefined, args); - }); - - /** - * This method is like `_.find` except that it returns the key of the first - * element `predicate` returns truthy for instead of the element itself. - * - * @static - * @memberOf _ - * @category Object - * @param {Object} object The object to search. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. - * @returns {string|undefined} Returns the key of the matched element, else `undefined`. - * @example - * - * var users = { - * 'barney': { 'age': 36, 'active': true }, - * 'fred': { 'age': 40, 'active': false }, - * 'pebbles': { 'age': 1, 'active': true } - * }; - * - * _.findKey(users, function(o) { return o.age < 40; }); - * // => 'barney' (iteration order is not guaranteed) - * - * // using the `_.matches` callback shorthand - * _.findKey(users, { 'age': 1, 'active': true }); - * // => 'pebbles' - * - * // using the `_.matchesProperty` callback shorthand - * _.findKey(users, ['active', false]); - * // => 'fred' - * - * // using the `_.property` callback shorthand - * _.findKey(users, 'active'); - * // => 'barney' - */ - function findKey(object, predicate) { - return baseFind(object, getIteratee(predicate, 3), baseForOwn, true); - } - - /** - * This method is like `_.findKey` except that it iterates over elements of - * a collection in the opposite order. - * - * @static - * @memberOf _ - * @category Object - * @param {Object} object The object to search. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. - * @returns {string|undefined} Returns the key of the matched element, else `undefined`. - * @example - * - * var users = { - * 'barney': { 'age': 36, 'active': true }, - * 'fred': { 'age': 40, 'active': false }, - * 'pebbles': { 'age': 1, 'active': true } - * }; - * - * _.findLastKey(users, function(o) { return o.age < 40; }); - * // => returns 'pebbles' assuming `_.findKey` returns 'barney' - * - * // using the `_.matches` callback shorthand - * _.findLastKey(users, { 'age': 36, 'active': true }); - * // => 'barney' - * - * // using the `_.matchesProperty` callback shorthand - * _.findLastKey(users, ['active', false]); - * // => 'fred' - * - * // using the `_.property` callback shorthand - * _.findLastKey(users, 'active'); - * // => 'pebbles' - */ - function findLastKey(object, predicate) { - return baseFind(object, getIteratee(predicate, 3), baseForOwnRight, true); - } - - /** - * Iterates over own and inherited enumerable properties of an object invoking - * `iteratee` for each property. The iteratee is invoked with three arguments: - * (value, key, object). Iteratee functions may exit iteration early by explicitly - * returning `false`. - * - * @static - * @memberOf _ - * @category Object - * @param {Object} object The object to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Object} Returns `object`. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.forIn(new Foo, function(value, key) { - * console.log(key); - * }); - * // => logs 'a', 'b', then 'c' (iteration order is not guaranteed) - */ - function forIn(object, iteratee) { - return object == null ? object : baseFor(object, toFunction(iteratee), keysIn); - } - - /** - * This method is like `_.forIn` except that it iterates over properties of - * `object` in the opposite order. - * - * @static - * @memberOf _ - * @category Object - * @param {Object} object The object to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Object} Returns `object`. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.forInRight(new Foo, function(value, key) { - * console.log(key); - * }); - * // => logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c' - */ - function forInRight(object, iteratee) { - return object == null ? object : baseForRight(object, toFunction(iteratee), keysIn); - } - - /** - * Iterates over own enumerable properties of an object invoking `iteratee` - * for each property. The iteratee is invoked with three arguments: - * (value, key, object). Iteratee functions may exit iteration early by - * explicitly returning `false`. - * - * @static - * @memberOf _ - * @category Object - * @param {Object} object The object to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Object} Returns `object`. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.forOwn(new Foo, function(value, key) { - * console.log(key); - * }); - * // => logs 'a' then 'b' (iteration order is not guaranteed) - */ - function forOwn(object, iteratee) { - return object && baseForOwn(object, toFunction(iteratee)); - } - - /** - * This method is like `_.forOwn` except that it iterates over properties of - * `object` in the opposite order. - * - * @static - * @memberOf _ - * @category Object - * @param {Object} object The object to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Object} Returns `object`. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.forOwnRight(new Foo, function(value, key) { - * console.log(key); - * }); - * // => logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b' - */ - function forOwnRight(object, iteratee) { - return object && baseForOwnRight(object, toFunction(iteratee)); - } - - /** - * Creates an array of function property names from own enumerable properties - * of `object`. - * - * @static - * @memberOf _ - * @category Object - * @param {Object} object The object to inspect. - * @returns {Array} Returns the new array of property names. - * @example - * - * function Foo() { - * this.a = _.constant('a'); - * this.b = _.constant('b'); - * } - * - * Foo.prototype.c = _.constant('c'); - * - * _.functions(new Foo); - * // => ['a', 'b'] - */ - function functions(object) { - return object == null ? [] : baseFunctions(object, keys(object)); - } - - /** - * Creates an array of function property names from own and inherited - * enumerable properties of `object`. - * - * @static - * @memberOf _ - * @category Object - * @param {Object} object The object to inspect. - * @returns {Array} Returns the new array of property names. - * @example - * - * function Foo() { - * this.a = _.constant('a'); - * this.b = _.constant('b'); - * } - * - * Foo.prototype.c = _.constant('c'); - * - * _.functionsIn(new Foo); - * // => ['a', 'b', 'c'] - */ - function functionsIn(object) { - return object == null ? [] : baseFunctions(object, keysIn(object)); - } - - /** - * Gets the value at `path` of `object`. If the resolved value is - * `undefined` the `defaultValue` is used in its place. - * - * @static - * @memberOf _ - * @category Object - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @param {*} [defaultValue] The value returned if the resolved value is `undefined`. - * @returns {*} Returns the resolved value. - * @example - * - * var object = { 'a': [{ 'b': { 'c': 3 } }] }; - * - * _.get(object, 'a[0].b.c'); - * // => 3 - * - * _.get(object, ['a', '0', 'b', 'c']); - * // => 3 - * - * _.get(object, 'a.b.c', 'default'); - * // => 'default' - */ - function get(object, path, defaultValue) { - var result = object == null ? undefined : baseGet(object, path); - return result === undefined ? defaultValue : result; - } - - /** - * Checks if `path` is a direct property of `object`. - * - * @static - * @memberOf _ - * @category Object - * @param {Object} object The object to query. - * @param {Array|string} path The path to check. - * @returns {boolean} Returns `true` if `path` exists, else `false`. - * @example - * - * var object = { 'a': { 'b': { 'c': 3 } } }; - * var other = _.create({ 'a': _.create({ 'b': _.create({ 'c': 3 }) }) }); - * - * _.has(object, 'a'); - * // => true - * - * _.has(object, 'a.b.c'); - * // => true - * - * _.has(object, ['a', 'b', 'c']); - * // => true - * - * _.has(other, 'a'); - * // => false - */ - function has(object, path) { - return hasPath(object, path, baseHas); - } - - /** - * Checks if `path` is a direct or inherited property of `object`. - * - * @static - * @memberOf _ - * @category Object - * @param {Object} object The object to query. - * @param {Array|string} path The path to check. - * @returns {boolean} Returns `true` if `path` exists, else `false`. - * @example - * - * var object = _.create({ 'a': _.create({ 'b': _.create({ 'c': 3 }) }) }); - * - * _.hasIn(object, 'a'); - * // => true - * - * _.hasIn(object, 'a.b.c'); - * // => true - * - * _.hasIn(object, ['a', 'b', 'c']); - * // => true - * - * _.hasIn(object, 'b'); - * // => false - */ - function hasIn(object, path) { - return hasPath(object, path, baseHasIn); - } - - /** - * Creates an object composed of the inverted keys and values of `object`. - * If `object` contains duplicate values, subsequent values overwrite property - * assignments of previous values unless `multiVal` is `true`. - * - * @static - * @memberOf _ - * @category Object - * @param {Object} object The object to invert. - * @param {boolean} [multiVal] Allow multiple values per key. - * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. - * @returns {Object} Returns the new inverted object. - * @example - * - * var object = { 'a': 1, 'b': 2, 'c': 1 }; - * - * _.invert(object); - * // => { '1': 'c', '2': 'b' } - * - * // with `multiVal` - * _.invert(object, true); - * // => { '1': ['a', 'c'], '2': ['b'] } - */ - function invert(object, multiVal, guard) { - return arrayReduce(keys(object), function(result, key) { - var value = object[key]; - if (multiVal && !guard) { - if (hasOwnProperty.call(result, value)) { - result[value].push(key); - } else { - result[value] = [key]; - } - } - else { - result[value] = key; - } - return result; - }, {}); - } - - /** - * Invokes the method at `path` of `object`. - * - * @static - * @memberOf _ - * @category Object - * @param {Object} object The object to query. - * @param {Array|string} path The path of the method to invoke. - * @param {...*} [args] The arguments to invoke the method with. - * @returns {*} Returns the result of the invoked method. - * @example - * - * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] }; - * - * _.invoke(object, 'a[0].b.c.slice', 1, 3); - * // => [2, 3] - */ - var invoke = rest(baseInvoke); - - /** - * Creates an array of the own enumerable property names of `object`. - * - * **Note:** Non-object values are coerced to objects. See the - * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys) - * for more details. - * - * @static - * @memberOf _ - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.keys(new Foo); - * // => ['a', 'b'] (iteration order is not guaranteed) - * - * _.keys('hi'); - * // => ['0', '1'] - */ - function keys(object) { - var isProto = isPrototype(object); - if (!(isProto || isArrayLike(object))) { - return baseKeys(object); - } - var indexes = indexKeys(object), - skipIndexes = !!indexes, - result = indexes || [], - length = result.length; - - for (var key in object) { - if (baseHas(object, key) && - !(skipIndexes && (key == 'length' || isIndex(key, length))) && - !(isProto && key == 'constructor')) { - result.push(key); - } - } - return result; - } - - /** - * Creates an array of the own and inherited enumerable property names of `object`. - * - * **Note:** Non-object values are coerced to objects. - * - * @static - * @memberOf _ - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.keysIn(new Foo); - * // => ['a', 'b', 'c'] (iteration order is not guaranteed) - */ - function keysIn(object) { - var index = -1, - isProto = isPrototype(object), - props = baseKeysIn(object), - propsLength = props.length, - indexes = indexKeys(object), - skipIndexes = !!indexes, - result = indexes || [], - length = result.length; - - while (++index < propsLength) { - var key = props[index]; - if (!(skipIndexes && (key == 'length' || isIndex(key, length))) && - !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { - result.push(key); - } - } - return result; - } - - /** - * The opposite of `_.mapValues`; this method creates an object with the - * same values as `object` and keys generated by running each own enumerable - * property of `object` through `iteratee`. - * - * @static - * @memberOf _ - * @category Object - * @param {Object} object The object to iterate over. - * @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration. - * @returns {Object} Returns the new mapped object. - * @example - * - * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) { - * return key + value; - * }); - * // => { 'a1': 1, 'b2': 2 } - */ - function mapKeys(object, iteratee) { - var result = {}; - iteratee = getIteratee(iteratee, 3); - - baseForOwn(object, function(value, key, object) { - result[iteratee(value, key, object)] = value; - }); - return result; - } - - /** - * Creates an object with the same keys as `object` and values generated by - * running each own enumerable property of `object` through `iteratee`. The - * iteratee function is invoked with three arguments: (value, key, object). - * - * @static - * @memberOf _ - * @category Object - * @param {Object} object The object to iterate over. - * @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration. - * @returns {Object} Returns the new mapped object. - * @example - * - * var users = { - * 'fred': { 'user': 'fred', 'age': 40 }, - * 'pebbles': { 'user': 'pebbles', 'age': 1 } - * }; - * - * _.mapValues(users, function(o) { return o.age; }); - * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) - * - * // using the `_.property` callback shorthand - * _.mapValues(users, 'age'); - * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) - */ - function mapValues(object, iteratee) { - var result = {}; - iteratee = getIteratee(iteratee, 3); - - baseForOwn(object, function(value, key, object) { - result[key] = iteratee(value, key, object); - }); - return result; - } - - /** - * Recursively merges own and inherited enumerable properties of source - * objects into the destination object, skipping source properties that resolve - * to `undefined`. Array and plain object properties are merged recursively. - * Other objects and value types are overriden by assignment. Source objects - * are applied from left to right. Subsequent sources overwrite property - * assignments of previous sources. - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @category Object - * @param {Object} object The destination object. - * @param {...Object} [sources] The source objects. - * @returns {Object} Returns `object`. - * @example - * - * var users = { - * 'data': [{ 'user': 'barney' }, { 'user': 'fred' }] - * }; - * - * var ages = { - * 'data': [{ 'age': 36 }, { 'age': 40 }] - * }; - * - * _.merge(users, ages); - * // => { 'data': [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 40 }] } - */ - var merge = createAssigner(function(object, source) { - baseMerge(object, source); - }); - - /** - * This method is like `_.merge` except that it accepts `customizer` which - * is invoked to produce the merged values of the destination and source - * properties. If `customizer` returns `undefined` merging is handled by the - * method instead. The `customizer` is invoked with seven arguments: - * (objValue, srcValue, key, object, source, stack). - * - * @static - * @memberOf _ - * @category Object - * @param {Object} object The destination object. - * @param {...Object} sources The source objects. - * @param {Function} customizer The function to customize assigned values. - * @returns {Object} Returns `object`. - * @example - * - * function customizer(objValue, srcValue) { - * if (_.isArray(objValue)) { - * return objValue.concat(srcValue); - * } - * } - * - * var object = { - * 'fruits': ['apple'], - * 'vegetables': ['beet'] - * }; - * - * var other = { - * 'fruits': ['banana'], - * 'vegetables': ['carrot'] - * }; - * - * _.mergeWith(object, other, customizer); - * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot'] } - */ - var mergeWith = createAssigner(function(object, source, customizer) { - baseMerge(object, source, customizer); - }); - - /** - * The opposite of `_.pick`; this method creates an object composed of the - * own and inherited enumerable properties of `object` that are not omitted. - * - * @static - * @memberOf _ - * @category Object - * @param {Object} object The source object. - * @param {...(string|string[])} [props] The property names to omit, specified - * individually or in arrays.. - * @returns {Object} Returns the new object. - * @example - * - * var object = { 'user': 'fred', 'age': 40 }; - * - * _.omit(object, 'user'); - * // => { 'age': 40 } - */ - var omit = rest(function(object, props) { - if (object == null) { - return {}; - } - props = arrayMap(baseFlatten(props), String); - return basePick(object, baseDifference(keysIn(object), props)); - }); - - /** - * The opposite of `_.pickBy`; this method creates an object composed of the - * own and inherited enumerable properties of `object` that `predicate` - * doesn't return truthy for. - * - * @static - * @memberOf _ - * @category Object - * @param {Object} object The source object. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per property. - * @returns {Object} Returns the new object. - * @example - * - * var object = { 'user': 'fred', 'age': 40 }; - * - * _.omitBy(object, _.isNumber); - * // => { 'user': 'fred' } - */ - function omitBy(object, predicate) { - predicate = getIteratee(predicate); - return basePickBy(object, function(value) { - return !predicate(value); - }); - } - - /** - * Creates an object composed of the picked `object` properties. - * - * @static - * @memberOf _ - * @category Object - * @param {Object} object The source object. - * @param {...(string|string[])} [props] The property names to pick, specified - * individually or in arrays. - * @returns {Object} Returns the new object. - * @example - * - * var object = { 'user': 'fred', 'age': 40 }; - * - * _.pick(object, 'user'); - * // => { 'user': 'fred' } - */ - var pick = rest(function(object, props) { - return object == null ? {} : basePick(object, baseFlatten(props)); - }); - - /** - * Creates an object composed of the `object` properties `predicate` returns - * truthy for. The predicate is invoked with one argument: (value). - * - * @static - * @memberOf _ - * @category Object - * @param {Object} object The source object. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per property. - * @returns {Object} Returns the new object. - * @example - * - * var object = { 'user': 'fred', 'age': 40 }; - * - * _.pickBy(object, _.isNumber); - * // => { 'age': 40 } - */ - function pickBy(object, predicate) { - return object == null ? {} : basePickBy(object, getIteratee(predicate)); - } - - /** - * This method is like `_.get` except that if the resolved value is a function - * it's invoked with the `this` binding of its parent object and its result - * is returned. - * - * @static - * @memberOf _ - * @category Object - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to resolve. - * @param {*} [defaultValue] The value returned if the resolved value is `undefined`. - * @returns {*} Returns the resolved value. - * @example - * - * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] }; - * - * _.result(object, 'a[0].b.c1'); - * // => 3 - * - * _.result(object, 'a[0].b.c2'); - * // => 4 - * - * _.result(object, 'a[0].b.c3', 'default'); - * // => 'default' - * - * _.result(object, 'a[0].b.c3', _.constant('default')); - * // => 'default' - */ - function result(object, path, defaultValue) { - if (!isKey(path, object)) { - path = baseToPath(path); - var result = get(object, path); - object = parent(object, path); - } else { - result = object == null ? undefined : object[path]; - } - if (result === undefined) { - result = defaultValue; - } - return isFunction(result) ? result.call(object) : result; - } - - /** - * Sets the value at `path` of `object`. If a portion of `path` doesn't exist - * it's created. Arrays are created for missing index properties while objects - * are created for all other missing properties. Use `_.setWith` to customize - * `path` creation. - * - * @static - * @memberOf _ - * @category Object - * @param {Object} object The object to modify. - * @param {Array|string} path The path of the property to set. - * @param {*} value The value to set. - * @returns {Object} Returns `object`. - * @example - * - * var object = { 'a': [{ 'b': { 'c': 3 } }] }; - * - * _.set(object, 'a[0].b.c', 4); - * console.log(object.a[0].b.c); - * // => 4 - * - * _.set(object, 'x[0].y.z', 5); - * console.log(object.x[0].y.z); - * // => 5 - */ - function set(object, path, value) { - return object == null ? object : baseSet(object, path, value); - } - - /** - * This method is like `_.set` except that it accepts `customizer` which is - * invoked to produce the objects of `path`. If `customizer` returns `undefined` - * path creation is handled by the method instead. The `customizer` is invoked - * with three arguments: (nsValue, key, nsObject). - * - * @static - * @memberOf _ - * @category Object - * @param {Object} object The object to modify. - * @param {Array|string} path The path of the property to set. - * @param {*} value The value to set. - * @param {Function} [customizer] The function to customize assigned values. - * @returns {Object} Returns `object`. - * @example - * - * _.setWith({ '0': { 'length': 2 } }, '[0][1][2]', 3, Object); - * // => { '0': { '1': { '2': 3 }, 'length': 2 } } - */ - function setWith(object, path, value, customizer) { - customizer = typeof customizer == 'function' ? customizer : undefined; - return object == null ? object : baseSet(object, path, value, customizer); - } - - /** - * Creates an array of own enumerable key-value pairs for `object`. - * - * @static - * @memberOf _ - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the new array of key-value pairs. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.toPairs(new Foo); - * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed) - */ - function toPairs(object) { - return baseToPairs(object, keys(object)); - } - - /** - * Creates an array of own and inherited enumerable key-value pairs for `object`. - * - * @static - * @memberOf _ - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the new array of key-value pairs. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.toPairsIn(new Foo); - * // => [['a', 1], ['b', 2], ['c', 1]] (iteration order is not guaranteed) - */ - function toPairsIn(object) { - return baseToPairs(object, keysIn(object)); - } - - /** - * An alternative to `_.reduce`; this method transforms `object` to a new - * `accumulator` object which is the result of running each of its own enumerable - * properties through `iteratee`, with each invocation potentially mutating - * the `accumulator` object. The iteratee is invoked with four arguments: - * (accumulator, value, key, object). Iteratee functions may exit iteration - * early by explicitly returning `false`. - * - * @static - * @memberOf _ - * @category Object - * @param {Array|Object} object The object to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @param {*} [accumulator] The custom accumulator value. - * @returns {*} Returns the accumulated value. - * @example - * - * _.transform([2, 3, 4], function(result, n) { - * result.push(n *= n); - * return n % 2 == 0; - * }); - * // => [4, 9] - * - * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) { - * (result[value] || (result[value] = [])).push(key); - * }); - * // => { '1': ['a', 'c'], '2': ['b'] } - */ - function transform(object, iteratee, accumulator) { - var isArr = isArray(object) || isTypedArray(object); - iteratee = getIteratee(iteratee, 4); - - if (accumulator == null) { - if (isArr || isObject(object)) { - var Ctor = object.constructor; - if (isArr) { - accumulator = isArray(object) ? new Ctor : []; - } else { - accumulator = baseCreate(isFunction(Ctor) ? Ctor.prototype : undefined); - } - } else { - accumulator = {}; - } - } - (isArr ? arrayEach : baseForOwn)(object, function(value, index, object) { - return iteratee(accumulator, value, index, object); - }); - return accumulator; - } - - /** - * Removes the property at `path` of `object`. - * - * @static - * @memberOf _ - * @category Object - * @param {Object} object The object to modify. - * @param {Array|string} path The path of the property to unset. - * @returns {boolean} Returns `true` if the property is deleted, else `false`. - * @example - * - * var object = { 'a': [{ 'b': { 'c': 7 } }] }; - * _.unset(object, 'a[0].b.c'); - * // => true - * - * console.log(object); - * // => { 'a': [{ 'b': {} }] }; - * - * _.unset(object, 'a[0].b.c'); - * // => true - * - * console.log(object); - * // => { 'a': [{ 'b': {} }] }; - */ - function unset(object, path) { - return object == null ? true : baseUnset(object, path); - } - - /** - * Creates an array of the own enumerable property values of `object`. - * - * **Note:** Non-object values are coerced to objects. - * - * @static - * @memberOf _ - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property values. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.values(new Foo); - * // => [1, 2] (iteration order is not guaranteed) - * - * _.values('hi'); - * // => ['h', 'i'] - */ - function values(object) { - return object ? baseValues(object, keys(object)) : []; - } - - /** - * Creates an array of the own and inherited enumerable property values of `object`. - * - * **Note:** Non-object values are coerced to objects. - * - * @static - * @memberOf _ - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property values. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.valuesIn(new Foo); - * // => [1, 2, 3] (iteration order is not guaranteed) - */ - function valuesIn(object) { - return object == null ? baseValues(object, keysIn(object)) : []; - } - - /*------------------------------------------------------------------------*/ - - /** - * Returns a number whose value is limited to the given range specified - * by `min` and `max`. - * - * @static - * @memberOf _ - * @category Number - * @param {number} number The number whose value is to be limited. - * @param {number} [min] The minimum possible value. - * @param {number} max The maximum possible value. - * @returns {number} A number in the range [min, max]. - * @example - * - * _.clamp(-10, -5, 5); - * // => -5 - * - * _.clamp(10, -5, 5); - * // => 5 - */ - function clamp(number, min, max) { - number = toNumber(number); - if (number === number) { - if (max === undefined) { - max = min; - min = undefined; - } - if (max !== undefined) { - max = toNumber(max); - max = max === max ? max : 0; - number = number <= max ? number : max; - } - if (min !== undefined) { - min = toNumber(min); - min = min === min ? min : 0; - number = number >= min ? number : min; - } - } - return number; - } - - /** - * Checks if `n` is between `start` and up to but not including, `end`. If - * `end` is not specified it's set to `start` with `start` then set to `0`. - * If `start` is greater than `end` the params are swapped to support - * negative ranges. - * - * @static - * @memberOf _ - * @category Number - * @param {number} number The number to check. - * @param {number} [start=0] The start of the range. - * @param {number} end The end of the range. - * @returns {boolean} Returns `true` if `number` is in the range, else `false`. - * @example - * - * _.inRange(3, 2, 4); - * // => true - * - * _.inRange(4, 8); - * // => true - * - * _.inRange(4, 2); - * // => false - * - * _.inRange(2, 2); - * // => false - * - * _.inRange(1.2, 2); - * // => true - * - * _.inRange(5.2, 4); - * // => false - * - * _.inRange(-3, -2, -6); - * // => true - */ - function inRange(number, start, end) { - start = toNumber(start) || 0; - if (end === undefined) { - end = start; - start = 0; - } else { - end = toNumber(end) || 0; - } - number = toNumber(number); - return number >= nativeMin(start, end) && number < nativeMax(start, end); - } - - /** - * Produces a random number between `min` and `max` (inclusive). If only one - * argument is provided a number between `0` and the given number is returned. - * If `floating` is `true`, or either `min` or `max` are floats, a - * floating-point number is returned instead of an integer. - * - * **Note:** JavaScript follows the IEEE-754 standard for resolving - * floating-point values which can produce unexpected results. - * - * @static - * @memberOf _ - * @category Number - * @param {number} [min=0] The minimum possible value. - * @param {number} [max=1] The maximum possible value. - * @param {boolean} [floating] Specify returning a floating-point number. - * @returns {number} Returns the random number. - * @example - * - * _.random(0, 5); - * // => an integer between 0 and 5 - * - * _.random(5); - * // => also an integer between 0 and 5 - * - * _.random(5, true); - * // => a floating-point number between 0 and 5 - * - * _.random(1.2, 5.2); - * // => a floating-point number between 1.2 and 5.2 - */ - function random(min, max, floating) { - if (floating && typeof floating != 'boolean' && isIterateeCall(min, max, floating)) { - max = floating = undefined; - } - if (floating === undefined) { - if (typeof max == 'boolean') { - floating = max; - max = undefined; - } - else if (typeof min == 'boolean') { - floating = min; - min = undefined; - } - } - if (min === undefined && max === undefined) { - min = 0; - max = 1; - } - else { - min = toNumber(min) || 0; - if (max === undefined) { - max = min; - min = 0; - } else { - max = toNumber(max) || 0; - } - } - if (min > max) { - var temp = min; - min = max; - max = temp; - } - if (floating || min % 1 || max % 1) { - var rand = nativeRandom(); - return nativeMin(min + (rand * (max - min + parseFloat('1e-' + ((rand + '').length - 1)))), max); - } - return baseRandom(min, max); - } - - /*------------------------------------------------------------------------*/ - - /** - * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase). - * - * @static - * @memberOf _ - * @category String - * @param {string} [string=''] The string to convert. - * @returns {string} Returns the camel cased string. - * @example - * - * _.camelCase('Foo Bar'); - * // => 'fooBar' - * - * _.camelCase('--foo-bar'); - * // => 'fooBar' - * - * _.camelCase('__foo_bar__'); - * // => 'fooBar' - */ - var camelCase = createCompounder(function(result, word, index) { - word = word.toLowerCase(); - return result + (index ? capitalize(word) : word); - }); - - /** - * Converts the first character of `string` to upper case and the remaining - * to lower case. - * - * @static - * @memberOf _ - * @category String - * @param {string} [string=''] The string to capitalize. - * @returns {string} Returns the capitalized string. - * @example - * - * _.capitalize('FRED'); - * // => 'Fred' - */ - function capitalize(string) { - return upperFirst(toString(string).toLowerCase()); - } - - /** - * Deburrs `string` by converting [latin-1 supplementary letters](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table) - * to basic latin letters and removing [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). - * - * @static - * @memberOf _ - * @category String - * @param {string} [string=''] The string to deburr. - * @returns {string} Returns the deburred string. - * @example - * - * _.deburr('déjà vu'); - * // => 'deja vu' - */ - function deburr(string) { - string = toString(string); - return string && string.replace(reLatin1, deburrLetter).replace(reComboMark, ''); - } - - /** - * Checks if `string` ends with the given target string. - * - * @static - * @memberOf _ - * @category String - * @param {string} [string=''] The string to search. - * @param {string} [target] The string to search for. - * @param {number} [position=string.length] The position to search from. - * @returns {boolean} Returns `true` if `string` ends with `target`, else `false`. - * @example - * - * _.endsWith('abc', 'c'); - * // => true - * - * _.endsWith('abc', 'b'); - * // => false - * - * _.endsWith('abc', 'b', 2); - * // => true - */ - function endsWith(string, target, position) { - string = toString(string); - target = typeof target == 'string' ? target : (target + ''); - - var length = string.length; - position = position === undefined - ? length - : clamp(toInteger(position), 0, length); - - position -= target.length; - return position >= 0 && string.indexOf(target, position) == position; - } - - /** - * Converts the characters "&", "<", ">", '"', "'", and "\`" in `string` to - * their corresponding HTML entities. - * - * **Note:** No other characters are escaped. To escape additional - * characters use a third-party library like [_he_](https://mths.be/he). - * - * Though the ">" character is escaped for symmetry, characters like - * ">" and "/" don't need escaping in HTML and have no special meaning - * unless they're part of a tag or unquoted attribute value. - * See [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands) - * (under "semi-related fun fact") for more details. - * - * Backticks are escaped because in IE < 9, they can break out of - * attribute values or HTML comments. See [#59](https://html5sec.org/#59), - * [#102](https://html5sec.org/#102), [#108](https://html5sec.org/#108), and - * [#133](https://html5sec.org/#133) of the [HTML5 Security Cheatsheet](https://html5sec.org/) - * for more details. - * - * When working with HTML you should always [quote attribute values](http://wonko.com/post/html-escaping) - * to reduce XSS vectors. - * - * @static - * @memberOf _ - * @category String - * @param {string} [string=''] The string to escape. - * @returns {string} Returns the escaped string. - * @example - * - * _.escape('fred, barney, & pebbles'); - * // => 'fred, barney, & pebbles' - */ - function escape(string) { - string = toString(string); - return (string && reHasUnescapedHtml.test(string)) - ? string.replace(reUnescapedHtml, escapeHtmlChar) - : string; - } - - /** - * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+", - * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`. - * - * @static - * @memberOf _ - * @category String - * @param {string} [string=''] The string to escape. - * @returns {string} Returns the escaped string. - * @example - * - * _.escapeRegExp('[lodash](https://lodash.com/)'); - * // => '\[lodash\]\(https://lodash\.com/\)' - */ - function escapeRegExp(string) { - string = toString(string); - return (string && reHasRegExpChar.test(string)) - ? string.replace(reRegExpChar, '\\$&') - : string; - } - - /** - * Converts `string` to [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles). - * - * @static - * @memberOf _ - * @category String - * @param {string} [string=''] The string to convert. - * @returns {string} Returns the kebab cased string. - * @example - * - * _.kebabCase('Foo Bar'); - * // => 'foo-bar' - * - * _.kebabCase('fooBar'); - * // => 'foo-bar' - * - * _.kebabCase('__foo_bar__'); - * // => 'foo-bar' - */ - var kebabCase = createCompounder(function(result, word, index) { - return result + (index ? '-' : '') + word.toLowerCase(); - }); - - /** - * Converts `string`, as space separated words, to lower case. - * - * @static - * @memberOf _ - * @category String - * @param {string} [string=''] The string to convert. - * @returns {string} Returns the lower cased string. - * @example - * - * _.lowerCase('--Foo-Bar'); - * // => 'foo bar' - * - * _.lowerCase('fooBar'); - * // => 'foo bar' - * - * _.lowerCase('__FOO_BAR__'); - * // => 'foo bar' - */ - var lowerCase = createCompounder(function(result, word, index) { - return result + (index ? ' ' : '') + word.toLowerCase(); - }); - - /** - * Converts the first character of `string` to lower case. - * - * @static - * @memberOf _ - * @category String - * @param {string} [string=''] The string to convert. - * @returns {string} Returns the converted string. - * @example - * - * _.lowerFirst('Fred'); - * // => 'fred' - * - * _.lowerFirst('FRED'); - * // => 'fRED' - */ - var lowerFirst = createCaseFirst('toLowerCase'); - - /** - * Converts the first character of `string` to upper case. - * - * @static - * @memberOf _ - * @category String - * @param {string} [string=''] The string to convert. - * @returns {string} Returns the converted string. - * @example - * - * _.upperFirst('fred'); - * // => 'Fred' - * - * _.upperFirst('FRED'); - * // => 'FRED' - */ - var upperFirst = createCaseFirst('toUpperCase'); - - /** - * Pads `string` on the left and right sides if it's shorter than `length`. - * Padding characters are truncated if they can't be evenly divided by `length`. - * - * @static - * @memberOf _ - * @category String - * @param {string} [string=''] The string to pad. - * @param {number} [length=0] The padding length. - * @param {string} [chars=' '] The string used as padding. - * @returns {string} Returns the padded string. - * @example - * - * _.pad('abc', 8); - * // => ' abc ' - * - * _.pad('abc', 8, '_-'); - * // => '_-abc_-_' - * - * _.pad('abc', 3); - * // => 'abc' - */ - function pad(string, length, chars) { - string = toString(string); - length = toInteger(length); - - var strLength = stringSize(string); - if (!length || strLength >= length) { - return string; - } - var mid = (length - strLength) / 2, - leftLength = nativeFloor(mid), - rightLength = nativeCeil(mid); - - return createPadding('', leftLength, chars) + string + createPadding('', rightLength, chars); - } - - /** - * Pads `string` on the right side if it's shorter than `length`. Padding - * characters are truncated if they exceed `length`. - * - * @static - * @memberOf _ - * @category String - * @param {string} [string=''] The string to pad. - * @param {number} [length=0] The padding length. - * @param {string} [chars=' '] The string used as padding. - * @returns {string} Returns the padded string. - * @example - * - * _.padEnd('abc', 6); - * // => 'abc ' - * - * _.padEnd('abc', 6, '_-'); - * // => 'abc_-_' - * - * _.padEnd('abc', 3); - * // => 'abc' - */ - function padEnd(string, length, chars) { - string = toString(string); - return string + createPadding(string, length, chars); - } - - /** - * Pads `string` on the left side if it's shorter than `length`. Padding - * characters are truncated if they exceed `length`. - * - * @static - * @memberOf _ - * @category String - * @param {string} [string=''] The string to pad. - * @param {number} [length=0] The padding length. - * @param {string} [chars=' '] The string used as padding. - * @returns {string} Returns the padded string. - * @example - * - * _.padStart('abc', 6); - * // => ' abc' - * - * _.padStart('abc', 6, '_-'); - * // => '_-_abc' - * - * _.padStart('abc', 3); - * // => 'abc' - */ - function padStart(string, length, chars) { - string = toString(string); - return createPadding(string, length, chars) + string; - } - - /** - * Converts `string` to an integer of the specified radix. If `radix` is - * `undefined` or `0`, a `radix` of `10` is used unless `value` is a hexadecimal, - * in which case a `radix` of `16` is used. - * - * **Note:** This method aligns with the [ES5 implementation](https://es5.github.io/#E) - * of `parseInt`. - * - * @static - * @memberOf _ - * @category String - * @param {string} string The string to convert. - * @param {number} [radix] The radix to interpret `value` by. - * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. - * @returns {number} Returns the converted integer. - * @example - * - * _.parseInt('08'); - * // => 8 - * - * _.map(['6', '08', '10'], _.parseInt); - * // => [6, 8, 10] - */ - function parseInt(string, radix, guard) { - // Chrome fails to trim leading whitespace characters. - // See https://code.google.com/p/v8/issues/detail?id=3109 for more details. - if (guard || radix == null) { - radix = 0; - } else if (radix) { - radix = +radix; - } - string = baseTrim(toString(string)); - return nativeParseInt(string, radix || (reHasHexPrefix.test(string) ? 16 : 10)); - } - - /** - * Repeats the given string `n` times. - * - * @static - * @memberOf _ - * @category String - * @param {string} [string=''] The string to repeat. - * @param {number} [n=0] The number of times to repeat the string. - * @returns {string} Returns the repeated string. - * @example - * - * _.repeat('*', 3); - * // => '***' - * - * _.repeat('abc', 2); - * // => 'abcabc' - * - * _.repeat('abc', 0); - * // => '' - */ - function repeat(string, n) { - string = toString(string); - n = toInteger(n); - - var result = ''; - if (!string || n < 1 || n > MAX_SAFE_INTEGER) { - return result; - } - // Leverage the exponentiation by squaring algorithm for a faster repeat. - // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details. - do { - if (n % 2) { - result += string; - } - n = nativeFloor(n / 2); - string += string; - } while (n); - - return result; - } - - /** - * Replaces matches for `pattern` in `string` with `replacement`. - * - * **Note:** This method is based on [`String#replace`](https://mdn.io/String/replace). - * - * @static - * @memberOf _ - * @category String - * @param {string} [string=''] The string to modify. - * @param {RegExp|string} pattern The pattern to replace. - * @param {Function|string} replacement The match replacement. - * @returns {string} Returns the modified string. - * @example - * - * _.replace('Hi Fred', 'Fred', 'Barney'); - * // => 'Hi Barney' - */ - function replace() { - var args = arguments, - string = toString(args[0]); - - return args.length < 3 ? string : string.replace(args[1], args[2]); - } - - /** - * Converts `string` to [snake case](https://en.wikipedia.org/wiki/Snake_case). - * - * @static - * @memberOf _ - * @category String - * @param {string} [string=''] The string to convert. - * @returns {string} Returns the snake cased string. - * @example - * - * _.snakeCase('Foo Bar'); - * // => 'foo_bar' - * - * _.snakeCase('fooBar'); - * // => 'foo_bar' - * - * _.snakeCase('--foo-bar'); - * // => 'foo_bar' - */ - var snakeCase = createCompounder(function(result, word, index) { - return result + (index ? '_' : '') + word.toLowerCase(); - }); - - /** - * Splits `string` by `separator`. - * - * **Note:** This method is based on [`String#split`](https://mdn.io/String/split). - * - * @static - * @memberOf _ - * @category String - * @param {string} [string=''] The string to split. - * @param {RegExp|string} separator The separator pattern to split by. - * @param {number} [limit] The length to truncate results to. - * @returns {Array} Returns the new array of string segments. - * @example - * - * _.split('a-b-c', '-', 2); - * // => ['a', 'b'] - */ - function split(string, separator, limit) { - return toString(string).split(separator, limit); - } - - /** - * Converts `string` to [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage). - * - * @static - * @memberOf _ - * @category String - * @param {string} [string=''] The string to convert. - * @returns {string} Returns the start cased string. - * @example - * - * _.startCase('--foo-bar'); - * // => 'Foo Bar' - * - * _.startCase('fooBar'); - * // => 'Foo Bar' - * - * _.startCase('__foo_bar__'); - * // => 'Foo Bar' - */ - var startCase = createCompounder(function(result, word, index) { - return result + (index ? ' ' : '') + capitalize(word); - }); - - /** - * Checks if `string` starts with the given target string. - * - * @static - * @memberOf _ - * @category String - * @param {string} [string=''] The string to search. - * @param {string} [target] The string to search for. - * @param {number} [position=0] The position to search from. - * @returns {boolean} Returns `true` if `string` starts with `target`, else `false`. - * @example - * - * _.startsWith('abc', 'a'); - * // => true - * - * _.startsWith('abc', 'b'); - * // => false - * - * _.startsWith('abc', 'b', 1); - * // => true - */ - function startsWith(string, target, position) { - string = toString(string); - position = clamp(toInteger(position), 0, string.length); - return string.lastIndexOf(target, position) == position; - } - - /** - * Creates a compiled template function that can interpolate data properties - * in "interpolate" delimiters, HTML-escape interpolated data properties in - * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data - * properties may be accessed as free variables in the template. If a setting - * object is provided it takes precedence over `_.templateSettings` values. - * - * **Note:** In the development build `_.template` utilizes - * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) - * for easier debugging. - * - * For more information on precompiling templates see - * [lodash's custom builds documentation](https://lodash.com/custom-builds). - * - * For more information on Chrome extension sandboxes see - * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval). - * - * @static - * @memberOf _ - * @category String - * @param {string} [string=''] The template string. - * @param {Object} [options] The options object. - * @param {RegExp} [options.escape] The HTML "escape" delimiter. - * @param {RegExp} [options.evaluate] The "evaluate" delimiter. - * @param {Object} [options.imports] An object to import into the template as free variables. - * @param {RegExp} [options.interpolate] The "interpolate" delimiter. - * @param {string} [options.sourceURL] The sourceURL of the template's compiled source. - * @param {string} [options.variable] The data object variable name. - * @param- {Object} [otherOptions] Enables the legacy `options` param signature. - * @returns {Function} Returns the compiled template function. - * @example - * - * // using the "interpolate" delimiter to create a compiled template - * var compiled = _.template('hello <%= user %>!'); - * compiled({ 'user': 'fred' }); - * // => 'hello fred!' - * - * // using the HTML "escape" delimiter to escape data property values - * var compiled = _.template('<%- value %>'); - * compiled({ 'value': '\n
    " } ,{ "href":"/differenceBy", - "html":"

    differenceBy source npm

    \n
    _.differenceBy(array, [values], [iteratee=_.identity])
    \n\n

    这个方法类似 _.difference,除了它接受一个 iteratee 调用每一个数组和值。iteratee 会传入一个参数:(value)。

    \n
    \n\n

    参数

    \n
      \n
    1. array (Array)

      需要处理的数组

      \n
    2. \n
    3. [values] (...Array)

      用于对比差异的数组

      \n
    4. \n
    5. [iteratee=_.identity] (Function|Object|string)

      这个函数会调用每一个元素

      \n
    6. \n
    \n

    返回值 (Array)

    \n

    返回一个差异化后的新数组

    \n
    \n

    示例

    \n
    _.differenceBy([3.1, 2.2, 1.3], [4.4, 2.5], Math.floor);\n// => [3.1, 1.3]\n\n// 使用了 `_.property` 的回调结果\n_.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');\n// => [{ 'x': 2 }]\n
    \n
    \n
    \n\n
    " } + "html":"

    differenceBy source npm

    \n
    _.differenceBy(array, [values], [iteratee=_.identity])
    \n\n

    这个方法类似 _.difference,除了它接受一个 iteratee 调用每一个数组和值。iteratee 会传入一个参数:(value)。

    \n
    \n\n

    参数

    \n
      \n
    1. array (Array)

      需要处理的数组

      \n
    2. \n
    3. [values] (...Array)

      用于对比差异的数组

      \n
    4. \n
    5. [iteratee=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

      \n
    6. \n
    \n

    返回值 (Array)

    \n

    返回一个差异化后的新数组

    \n
    \n

    示例

    \n
    _.differenceBy([3.1, 2.2, 1.3], [4.4, 2.5], Math.floor);\n// => [3.1, 1.3]\n\n// 使用了 `_.property` 的回调结果\n_.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');\n// => [{ 'x': 2 }]\n
    \n
    \n
    \n\n
    " } ,{ "href":"/differenceWith", - "html":"

    differenceWith source npm

    \n
    _.differenceWith(array, [values], [comparator])
    \n\n

    这个方法类似 _.difference,除了它接受一个 comparator 调用每一个数组元素的值。 comparator 会传入2个参数:(arrVal, othVal)。

    \n
    \n\n

    参数

    \n
      \n
    1. array (Array)

      需要处理的数组

      \n
    2. \n
    3. [values] (...Array)

      用于对比差异的数组

      \n
    4. \n
    5. [comparator] (Function)

      这个函数会调用每一个元素

      \n
    6. \n
    \n

    返回值 (Array)

    \n

    返回一个差异化后的新数组

    \n
    \n

    示例

    \n
    var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];\n\n_.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);\n// => [{ 'x': 2, 'y': 1 }]\n
    \n
    \n
    \n\n
    " } + "html":"

    differenceWith source npm

    \n
    _.differenceWith(array, [values], [comparator])
    \n\n

    这个方法类似 _.difference,除了它接受一个 comparator 调用每一个数组元素的值。 comparator 会传入2个参数:(arrVal, othVal)。

    \n
    \n\n

    参数

    \n
      \n
    1. array (Array)

      需要处理的数组

      \n
    2. \n
    3. [values] (...Array)

      用于对比差异的数组

      \n
    4. \n
    5. [comparator] (Function)

      这个函数会处理每一个元素

      \n
    6. \n
    \n

    返回值 (Array)

    \n

    返回一个差异化后的新数组

    \n
    \n

    示例

    \n
    var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];\n\n_.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);\n// => [{ 'x': 2, 'y': 1 }]\n
    \n
    \n
    \n\n
    " } ,{ "href":"/drop", "html":"

    drop source npm

    \n
    _.drop(array, [n=1])
    \n\n

    裁剪数组中的前 N 个数组,返回剩余的部分。

    \n
    \n\n

    参数

    \n
      \n
    1. array (Array)

      需要处理的数组

      \n
    2. \n
    3. [n=1] (number)

      裁剪的个数

      \n
    4. \n
    \n

    返回值 (Array)

    \n

    返回数组的剩余的部分。

    \n
    \n

    示例

    \n
    _.drop([1, 2, 3]);\n// => [2, 3]\n\n_.drop([1, 2, 3], 2);\n// => [3]\n\n_.drop([1, 2, 3], 5);\n// => []\n\n_.drop([1, 2, 3], 0);\n// => [1, 2, 3]\n
    \n
    \n
    \n\n
    " } ,{ "href":"/dropRight", @@ -47,9 +47,9 @@ ,{ "href":"/intersection", "html":"

    intersection source npm

    \n
    _.intersection([arrays])
    \n\n

    创建一个包含所有使用 SameValueZero 进行等值比较后筛选的唯一值数组。

    \n
    \n\n

    参数

    \n
      \n
    1. [arrays] (...Array)

      需要处理的数组队列

      \n
    2. \n
    \n

    返回值 (Array)

    \n

    返回数组中所有数组共享元素的新数组

    \n
    \n

    示例

    \n
    _.intersection([2, 1], [4, 2], [1, 2]);\n// => [2]\n
    \n
    \n
    \n\n
    " } ,{ "href":"/intersectionBy", - "html":"

    intersectionBy source npm

    \n
    _.intersectionBy([arrays], [iteratee=_.identity])
    \n\n

    这个方法类似 _.intersection,除了它接受一个 iteratee 调用每一个数组和值。iteratee 会传入一个参数:(value)

    \n
    \n\n

    参数

    \n
      \n
    1. [arrays] (...Array)

      需要检索的数组

      \n
    2. \n
    3. [iteratee=_.identity] (Function|Object|string)

      这个函数会调用每一个元素

      \n
    4. \n
    \n

    返回值 (Array)

    \n

    返回数组中共享元素的新数组

    \n
    \n

    示例

    \n
    _.intersectionBy([2.1, 1.2], [4.3, 2.4], Math.floor);\n// => [2.1]\n\n// 使用了 `_.property` 的回调结果\n_.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');\n// => [{ 'x': 1 }]\n
    \n
    \n
    \n\n
    " } + "html":"

    intersectionBy source npm

    \n
    _.intersectionBy([arrays], [iteratee=_.identity])
    \n\n

    这个方法类似 _.intersection,除了它接受一个 iteratee 调用每一个数组和值。iteratee 会传入一个参数:(value)

    \n
    \n\n

    参数

    \n
      \n
    1. [arrays] (...Array)

      需要检索的数组

      \n
    2. \n
    3. [iteratee=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

      \n
    4. \n
    \n

    返回值 (Array)

    \n

    返回数组中共享元素的新数组

    \n
    \n

    示例

    \n
    _.intersectionBy([2.1, 1.2], [4.3, 2.4], Math.floor);\n// => [2.1]\n\n// 使用了 `_.property` 的回调结果\n_.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');\n// => [{ 'x': 1 }]\n
    \n
    \n
    \n\n
    " } ,{ "href":"/intersectionWith", - "html":"

    intersectionWith source npm

    \n
    _.intersectionWith([arrays], [comparator])
    \n\n

    这个方法类似 _.intersection,除了它接受一个 comparator 调用每一个数组和值。iteratee 会传入2个参数:((arrVal, othVal)

    \n
    \n\n

    参数

    \n
      \n
    1. [arrays] (...Array)

      需要检索的数组

      \n
    2. \n
    3. [comparator] (Function)

      这个函数会调用每一个元素

      \n
    4. \n
    \n

    返回值 (Array)

    \n

    返回数组中共享元素的新数组

    \n
    \n

    示例

    \n
    var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];\nvar others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];\n\n_.intersectionWith(objects, others, _.isEqual);\n// => [{ 'x': 1, 'y': 2 }]\n
    \n
    \n
    \n\n
    " } + "html":"

    intersectionWith source npm

    \n
    _.intersectionWith([arrays], [comparator])
    \n\n

    这个方法类似 _.intersection,除了它接受一个 comparator 调用每一个数组和值。iteratee 会传入2个参数:((arrVal, othVal)

    \n
    \n\n

    参数

    \n
      \n
    1. [arrays] (...Array)

      需要检索的数组

      \n
    2. \n
    3. [comparator] (Function)

      这个函数会处理每一个元素

      \n
    4. \n
    \n

    返回值 (Array)

    \n

    返回数组中共享元素的新数组

    \n
    \n

    示例

    \n
    var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];\nvar others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];\n\n_.intersectionWith(objects, others, _.isEqual);\n// => [{ 'x': 1, 'y': 2 }]\n
    \n
    \n
    \n\n
    " } ,{ "href":"/join", "html":"

    join source npm

    \n
    _.join(array, [separator=','])
    \n\n

    将数组中的所有元素转换为由 separator 分隔的字符串。

    \n
    \n\n

    参数

    \n
      \n
    1. array (Array)

      需要转换的数组

      \n
    2. \n
    3. [separator=','] (string)

      分隔符

      \n
    4. \n
    \n

    返回值 (string)

    \n

    返回连接好的字符串

    \n
    \n

    示例

    \n
    _.join(['a', 'b', 'c'], '~');\n// => 'a~b~c'\n
    \n
    \n
    \n\n
    " } ,{ "href":"/last", @@ -63,29 +63,29 @@ ,{ "href":"/pullAll", "html":"

    pullAll source npm

    \n
    _.pullAll(array, values)
    \n\n

    这个方式类似 _.pull,除了它接受数组形式的一系列值。\n
    \n
    \n注意: 不同于 _.difference,这个方法会改变数组。

    \n
    \n\n

    参数

    \n
      \n
    1. array (Array)

      需要调整的数组

      \n
    2. \n
    3. values (Array)

      要移除的值

      \n
    4. \n
    \n

    返回值 (Array)

    \n

    返回数组本身

    \n
    \n

    示例

    \n
    var array = [1, 2, 3, 1, 2, 3];\n\n_.pull(array, [2, 3]);\nconsole.log(array);\n// => [1, 1]\n
    \n
    \n
    \n\n
    " } ,{ "href":"/pullAllBy", - "html":"

    pullAllBy source npm

    \n
    _.pullAllBy(array, values, [iteratee=_.identity])
    \n\n

    这个方法类似 _.pullAll,除了它接受一个 comparator 调用每一个数组元素的值。 comparator 会传入一个参数:(value)。\n
    \n
    \n注意: 不同于 _.differenceBy,这个方法会改变数组。

    \n
    \n\n

    参数

    \n
      \n
    1. array (Array)

      需要调整的数组

      \n
    2. \n
    3. values (Array)

      要移除的值

      \n
    4. \n
    5. [iteratee=_.identity] (Function|Object|string)

      这个函数会调用每一个元素

      \n
    6. \n
    \n

    返回值 (Array)

    \n

    返回数组本身

    \n
    \n

    示例

    \n
    var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];\n\n_.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');\nconsole.log(array);\n// => [{ 'x': 2 }]\n
    \n
    \n
    \n\n
    " } + "html":"

    pullAllBy source npm

    \n
    _.pullAllBy(array, values, [iteratee=_.identity])
    \n\n

    这个方法类似 _.pullAll,除了它接受一个 comparator 调用每一个数组元素的值。 comparator 会传入一个参数:(value)。\n
    \n
    \n注意: 不同于 _.differenceBy,这个方法会改变数组。

    \n
    \n\n

    参数

    \n
      \n
    1. array (Array)

      需要调整的数组

      \n
    2. \n
    3. values (Array)

      要移除的值

      \n
    4. \n
    5. [iteratee=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

      \n
    6. \n
    \n

    返回值 (Array)

    \n

    返回数组本身

    \n
    \n

    示例

    \n
    var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];\n\n_.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');\nconsole.log(array);\n// => [{ 'x': 2 }]\n
    \n
    \n
    \n\n
    " } ,{ "href":"/pullAt", "html":"

    pullAt source npm

    \n
    _.pullAt(array, [indexes])
    \n\n

    根据给的 indexes 移除对应的数组元素并返回被移除的元素。\n
    \n
    \n注意: 不同于 _.at,这个方法会改变数组。

    \n
    \n\n

    参数

    \n
      \n
    1. array (Array)

      需要调整的数组

      \n
    2. \n
    3. [indexes] (...(number|number[])

      indexes 可以是特殊的数组队列,或者个别的单个或多个参数

      \n
    4. \n
    \n

    返回值 (Array)

    \n

    返回被移除的元素数组

    \n
    \n

    示例

    \n
    var array = [5, 10, 15, 20];\nvar evens = _.pullAt(array, 1, 3);\n\nconsole.log(array);\n// => [5, 15]\n\nconsole.log(evens);\n// => [10, 20]\n
    \n
    \n
    \n\n
    " } ,{ "href":"/remove", - "html":"

    remove source npm

    \n
    _.remove(array, [predicate=_.identity])
    \n\n

    移除经过 predicate 处理为真值的元素,并返回被移除的元素。predicate 会传入3个参数:(value, index, array)\n
    \n
    \n注意: Unlike _.filter,这个方法会改变数组。

    \n
    \n\n

    参数

    \n
      \n
    1. array (Array)

      需要调整的数组

      \n
    2. \n
    3. [predicate=_.identity] (Function|Object|string)

      这个函数会调用每一个元素

      \n
    4. \n
    \n

    返回值 (Array)

    \n

    返回被移除的元素的数组

    \n
    \n

    示例

    \n
    var array = [1, 2, 3, 4];\nvar evens = _.remove(array, function(n) {\n  return n % 2 == 0;\n});\n\nconsole.log(array);\n// => [1, 3]\n\nconsole.log(evens);\n// => [2, 4]\n
    \n
    \n
    \n\n
    " } + "html":"

    remove source npm

    \n
    _.remove(array, [predicate=_.identity])
    \n\n

    移除经过 predicate 处理为真值的元素,并返回被移除的元素。predicate 会传入3个参数:(value, index, array)\n
    \n
    \n注意: Unlike _.filter,这个方法会改变数组。

    \n
    \n\n

    参数

    \n
      \n
    1. array (Array)

      需要调整的数组

      \n
    2. \n
    3. [predicate=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

      \n
    4. \n
    \n

    返回值 (Array)

    \n

    返回被移除的元素的数组

    \n
    \n

    示例

    \n
    var array = [1, 2, 3, 4];\nvar evens = _.remove(array, function(n) {\n  return n % 2 == 0;\n});\n\nconsole.log(array);\n// => [1, 3]\n\nconsole.log(evens);\n// => [2, 4]\n
    \n
    \n
    \n\n
    " } ,{ "href":"/slice", "html":"

    slice source npm

    \n
    _.slice(array, [start=0], [end=array.length])
    \n\n

    创建一个裁剪后的数组,从 start 到 end 的位置,但不包括 end 本身的位置。\n
    \n
    \n注意: 这个方法用于代替 Array#slice\n来确保数组正确返回

    \n
    \n\n

    参数

    \n
      \n
    1. array (Array)

      需要裁剪的数组

      \n
    2. \n
    3. [start=0] (number)

      开始位置

      \n
    4. \n
    5. [end=array.length] (number)

      结束位置

      \n
    6. \n
    \n

    返回值 (Array)

    \n

    返回裁剪后的数组

    \n
    \n
    \n\n
    " } ,{ "href":"/sortedIndex", "html":"

    sortedIndex source npm

    \n
    _.sortedIndex(array, value)
    \n\n

    使用二进制的方式检索来决定 value 应该插入在数组中位置。它的 index 应该尽可能的小以保证数组的排序。

    \n
    \n\n

    参数

    \n
      \n
    1. array (Array)

      需要检索的已排序数组

      \n
    2. \n
    3. value (*)

      要评估位置的值

      \n
    4. \n
    \n

    返回值 (number)

    \n

    返回 value 应该在数组中插入的 index。

    \n
    \n

    示例

    \n
    _.sortedIndex([30, 50], 40);\n// => 1\n\n_.sortedIndex([4, 5], 4);\n// => 0\n
    \n
    \n
    \n\n
    " } ,{ "href":"/sortedIndexBy", - "html":"

    sortedIndexBy source npm

    \n
    _.sortedIndexBy(array, value, [iteratee=_.identity])
    \n\n

    这个方法类似 _.sortedIndex,除了它接受一个 iteratee 调用每一个数组和值来计算排序。iteratee 会传入一个参数:(value)。

    \n
    \n\n

    参数

    \n
      \n
    1. array (Array)

      需要检索的已排序数组

      \n
    2. \n
    3. value (*)

      要评估位置的值

      \n
    4. \n
    5. [iteratee=_.identity] (Function|Object|string)

      这个函数会调用每一个元素

      \n
    6. \n
    \n

    返回值 (number)

    \n

    返回 value 应该在数组中插入的 index。

    \n
    \n

    示例

    \n
    var dict = { 'thirty': 30, 'forty': 40, 'fifty': 50 };\n\n_.sortedIndexBy(['thirty', 'fifty'], 'forty', _.propertyOf(dict));\n// => 1\n\n// 使用了 `_.property` 回调结果\n_.sortedIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x');\n// => 0\n
    \n
    \n
    \n\n
    " } + "html":"

    sortedIndexBy source npm

    \n
    _.sortedIndexBy(array, value, [iteratee=_.identity])
    \n\n

    这个方法类似 _.sortedIndex,除了它接受一个 iteratee 调用每一个数组和值来计算排序。iteratee 会传入一个参数:(value)。

    \n
    \n\n

    参数

    \n
      \n
    1. array (Array)

      需要检索的已排序数组

      \n
    2. \n
    3. value (*)

      要评估位置的值

      \n
    4. \n
    5. [iteratee=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

      \n
    6. \n
    \n

    返回值 (number)

    \n

    返回 value 应该在数组中插入的 index。

    \n
    \n

    示例

    \n
    var dict = { 'thirty': 30, 'forty': 40, 'fifty': 50 };\n\n_.sortedIndexBy(['thirty', 'fifty'], 'forty', _.propertyOf(dict));\n// => 1\n\n// 使用了 `_.property` 回调结果\n_.sortedIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x');\n// => 0\n
    \n
    \n
    \n\n
    " } ,{ "href":"/sortedIndexOf", "html":"

    sortedIndexOf source npm

    \n
    _.sortedIndexOf(array, value)
    \n\n

    这个方法类似 _.indexOf,除了它是执行二进制来检索已经排序的数组的。

    \n
    \n\n

    参数

    \n
      \n
    1. array (Array)

      需要检索的数组

      \n
    2. \n
    3. value (*)

      要评估位置的值

      \n
    4. \n
    \n

    返回值 (number)

    \n

    返回匹配值的 index ,否则返回 -1.

    \n
    \n

    示例

    \n
    _.sortedIndexOf([1, 1, 2, 2], 2);\n// => 2\n
    \n
    \n
    \n\n
    " } ,{ "href":"/sortedLastIndex", "html":"

    sortedLastIndex source npm

    \n
    _.sortedLastIndex(array, value)
    \n\n

    这个方法类似 _.sortedIndex,除了它返回在 value 中尽可能大的 index 位置。

    \n
    \n\n

    参数

    \n
      \n
    1. array (Array)

      需要检索的已排序数组

      \n
    2. \n
    3. value (*)

      要评估位置的值

      \n
    4. \n
    \n

    返回值 (number)

    \n

    返回 value 应该在数组中插入的 index。

    \n
    \n

    示例

    \n
    _.sortedLastIndex([4, 5], 4);\n// => 1\n
    \n
    \n
    \n\n
    " } ,{ "href":"/sortedLastIndexBy", - "html":"

    sortedLastIndexBy source npm

    \n
    _.sortedLastIndexBy(array, value, [iteratee=_.identity])
    \n\n

    这个方法类似 _.sortedLastIndex,除了它接受一个 iteratee 调用每一个数组和值来计算排序。iteratee 会传入一个参数:(value)。

    \n
    \n\n

    参数

    \n
      \n
    1. array (Array)

      需要检索的已排序数组

      \n
    2. \n
    3. value (*)

      要评估位置的值

      \n
    4. \n
    5. [iteratee=_.identity] (Function|Object|string)

      这个函数会调用每一个元素

      \n
    6. \n
    \n

    返回值 (number)

    \n

    返回 value 应该在数组中插入的 index。

    \n
    \n

    示例

    \n
    // 使用了 `_.property` 的回调结果\n_.sortedLastIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x');\n// => 1\n
    \n
    \n
    \n\n
    " } + "html":"

    sortedLastIndexBy source npm

    \n
    _.sortedLastIndexBy(array, value, [iteratee=_.identity])
    \n\n

    这个方法类似 _.sortedLastIndex,除了它接受一个 iteratee 调用每一个数组和值来计算排序。iteratee 会传入一个参数:(value)。

    \n
    \n\n

    参数

    \n
      \n
    1. array (Array)

      需要检索的已排序数组

      \n
    2. \n
    3. value (*)

      要评估位置的值

      \n
    4. \n
    5. [iteratee=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

      \n
    6. \n
    \n

    返回值 (number)

    \n

    返回 value 应该在数组中插入的 index。

    \n
    \n

    示例

    \n
    // 使用了 `_.property` 的回调结果\n_.sortedLastIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x');\n// => 1\n
    \n
    \n
    \n\n
    " } ,{ "href":"/sortedLastIndexOf", "html":"

    sortedLastIndexOf source npm

    \n
    _.sortedLastIndexOf(array, value)
    \n\n

    这个方法类似 _.lastIndexOf,除了它是执行二进制来检索已经排序的数组的。

    \n
    \n\n

    参数

    \n
      \n
    1. array (Array)

      需要检索的数组

      \n
    2. \n
    3. value (*)

      要评估位置的值

      \n
    4. \n
    \n

    返回值 (number)

    \n

    返回匹配值的 index ,否则返回 -1.

    \n
    \n

    示例

    \n
    _.sortedLastIndexOf([1, 1, 2, 2], 2);\n// => 3\n
    \n
    \n
    \n\n
    " } ,{ "href":"/sortedUniq", "html":"

    sortedUniq source npm

    \n
    _.sortedUniq(array)
    \n\n

    这个方法类似 _.uniq,除了它会排序并优化数组。

    \n
    \n\n

    参数

    \n
      \n
    1. array (Array)

      要调整的数组

      \n
    2. \n
    \n

    返回值 (Array)

    \n

    返回一个不重复的数组

    \n
    \n

    示例

    \n
    _.sortedUniq([1, 1, 2]);\n// => [1, 2]\n
    \n
    \n
    \n\n
    " } ,{ "href":"/sortedUniqBy", - "html":"

    sortedUniqBy source npm

    \n
    _.sortedUniqBy(array, [iteratee])
    \n\n

    这个方法类似 _.uniqBy,除了它接受一个 iteratee 调用每一个数组和值来排序并优化数组。

    \n
    \n\n

    参数

    \n
      \n
    1. array (Array)

      要调整的数组

      \n
    2. \n
    3. [iteratee] (Function)

      这个函数会调用每一个元素

      \n
    4. \n
    \n

    返回值 (Array)

    \n

    返回一个不重复的数组

    \n
    \n

    示例

    \n
    _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);\n// => [1.1, 2.2]\n
    \n
    \n
    \n\n
    " } + "html":"

    sortedUniqBy source npm

    \n
    _.sortedUniqBy(array, [iteratee])
    \n\n

    这个方法类似 _.uniqBy,除了它接受一个 iteratee 调用每一个数组和值来排序并优化数组。

    \n
    \n\n

    参数

    \n
      \n
    1. array (Array)

      要调整的数组

      \n
    2. \n
    3. [iteratee] (Function)

      这个函数会处理每一个元素

      \n
    4. \n
    \n

    返回值 (Array)

    \n

    返回一个不重复的数组

    \n
    \n

    示例

    \n
    _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);\n// => [1.1, 2.2]\n
    \n
    \n
    \n\n
    " } ,{ "href":"/tail", "html":"

    tail source npm

    \n
    _.tail(array)
    \n\n

    获取数组中除了第一个元素的剩余数组

    \n
    \n\n

    参数

    \n
      \n
    1. array (Array)

      要检索的数组

      \n
    2. \n
    \n

    返回值 (Array)

    \n

    返回数组中除了第一个元素的剩余数组

    \n
    \n

    示例

    \n
    _.tail([1, 2, 3]);\n// => [2, 3]\n
    \n
    \n
    \n\n
    " } ,{ "href":"/take", @@ -93,21 +93,21 @@ ,{ "href":"/takeRight", "html":"

    takeRight source npm

    \n
    _.takeRight(array, [n=1])
    \n\n

    从数组的结束元素开始提取 N 个数组

    \n
    \n\n

    参数

    \n
      \n
    1. array (Array)

      需要处理的数组

      \n
    2. \n
    3. [n=1] (number)

      要提取的个数

      \n
    4. \n
    \n

    返回值 (Array)

    \n

    返回提取的元素数组

    \n
    \n

    示例

    \n
    _.takeRight([1, 2, 3]);\n// => [3]\n\n_.takeRight([1, 2, 3], 2);\n// => [2, 3]\n\n_.takeRight([1, 2, 3], 5);\n// => [1, 2, 3]\n\n_.takeRight([1, 2, 3], 0);\n// => []\n
    \n
    \n
    \n\n
    " } ,{ "href":"/takeRightWhile", - "html":"

    takeRightWhile source npm

    \n
    _.takeRightWhile(array, [predicate=_.identity])
    \n\n

    从数组的最右边开始提取数组,直到 predicate 返回假值。predicate 会传入三个参数:(value, index, array)。

    \n
    \n\n

    参数

    \n
      \n
    1. array (Array)

      需要处理的数组

      \n
    2. \n
    3. [predicate=_.identity] (Function|Object|string)

      这个函数会调用每一个元素

      \n
    4. \n
    \n

    返回值 (Array)

    \n

    返回提取的元素数组

    \n
    \n

    示例

    \n
    var resolve = _.partial(_.map, _, 'user');\n\nvar users = [\n  { 'user': 'barney',  'active': true },\n  { 'user': 'fred',    'active': false },\n  { 'user': 'pebbles', 'active': false }\n];\n\nresolve( _.takeRightWhile(users, function(o) { return !o.active; }) );\n// => ['fred', 'pebbles']\n\n// 使用了 `_.matches` 的回调结果\nresolve( _.takeRightWhile(users, { 'user': 'pebbles', 'active': false }) );\n// => ['pebbles']\n\n// 使用了 `_.matchesProperty` 的回调结果\nresolve( _.takeRightWhile(users, ['active', false]) );\n// => ['fred', 'pebbles']\n\n// 使用了 `_.property` 的回调结果\nresolve( _.takeRightWhile(users, 'active') );\n// => []\n
    \n
    \n
    \n\n
    " } + "html":"

    takeRightWhile source npm

    \n
    _.takeRightWhile(array, [predicate=_.identity])
    \n\n

    从数组的最右边开始提取数组,直到 predicate 返回假值。predicate 会传入三个参数:(value, index, array)。

    \n
    \n\n

    参数

    \n
      \n
    1. array (Array)

      需要处理的数组

      \n
    2. \n
    3. [predicate=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

      \n
    4. \n
    \n

    返回值 (Array)

    \n

    返回提取的元素数组

    \n
    \n

    示例

    \n
    var resolve = _.partial(_.map, _, 'user');\n\nvar users = [\n  { 'user': 'barney',  'active': true },\n  { 'user': 'fred',    'active': false },\n  { 'user': 'pebbles', 'active': false }\n];\n\nresolve( _.takeRightWhile(users, function(o) { return !o.active; }) );\n// => ['fred', 'pebbles']\n\n// 使用了 `_.matches` 的回调结果\nresolve( _.takeRightWhile(users, { 'user': 'pebbles', 'active': false }) );\n// => ['pebbles']\n\n// 使用了 `_.matchesProperty` 的回调结果\nresolve( _.takeRightWhile(users, ['active', false]) );\n// => ['fred', 'pebbles']\n\n// 使用了 `_.property` 的回调结果\nresolve( _.takeRightWhile(users, 'active') );\n// => []\n
    \n
    \n
    \n\n
    " } ,{ "href":"/takeWhile", - "html":"

    takeWhile source npm

    \n
    _.takeWhile(array, [predicate=_.identity])
    \n\n

    从数组的开始提取数组,直到 predicate 返回假值。predicate 会传入三个参数:(value, index, array)。

    \n
    \n\n

    参数

    \n
      \n
    1. array (Array)

      需要处理的数组

      \n
    2. \n
    3. [predicate=_.identity] (Function|Object|string)

      这个函数会调用每一个元素

      \n
    4. \n
    \n

    返回值 (Array)

    \n

    返回提取的元素数组

    \n
    \n

    示例

    \n
    var resolve = _.partial(_.map, _, 'user');\n\nvar users = [\n  { 'user': 'barney',  'active': false },\n  { 'user': 'fred',    'active': false},\n  { 'user': 'pebbles', 'active': true }\n];\n\nresolve( _.takeWhile(users, function(o) { return !o.active; }) );\n// => ['barney', 'fred']\n\n// 使用了 `_.matches` 的回调结果\nresolve( _.takeWhile(users, { 'user': 'barney', 'active': false }) );\n// => ['barney']\n\n// 使用了 `_.matchesProperty` 的回调结果\nresolve( _.takeWhile(users, ['active', false]) );\n// => ['barney', 'fred']\n\n// 使用了 `_.property` 的回调结果\nresolve( _.takeWhile(users, 'active') );\n// => []\n
    \n
    \n
    \n\n
    " } + "html":"

    takeWhile source npm

    \n
    _.takeWhile(array, [predicate=_.identity])
    \n\n

    从数组的开始提取数组,直到 predicate 返回假值。predicate 会传入三个参数:(value, index, array)。

    \n
    \n\n

    参数

    \n
      \n
    1. array (Array)

      需要处理的数组

      \n
    2. \n
    3. [predicate=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

      \n
    4. \n
    \n

    返回值 (Array)

    \n

    返回提取的元素数组

    \n
    \n

    示例

    \n
    var resolve = _.partial(_.map, _, 'user');\n\nvar users = [\n  { 'user': 'barney',  'active': false },\n  { 'user': 'fred',    'active': false},\n  { 'user': 'pebbles', 'active': true }\n];\n\nresolve( _.takeWhile(users, function(o) { return !o.active; }) );\n// => ['barney', 'fred']\n\n// 使用了 `_.matches` 的回调结果\nresolve( _.takeWhile(users, { 'user': 'barney', 'active': false }) );\n// => ['barney']\n\n// 使用了 `_.matchesProperty` 的回调结果\nresolve( _.takeWhile(users, ['active', false]) );\n// => ['barney', 'fred']\n\n// 使用了 `_.property` 的回调结果\nresolve( _.takeWhile(users, 'active') );\n// => []\n
    \n
    \n
    \n\n
    " } ,{ "href":"/union", "html":"

    union source npm

    \n
    _.union([arrays])
    \n\n

    创建顺序排列的唯一值组成的数组。所有值经过 SameValueZero 等值比较。

    \n
    \n\n

    参数

    \n
      \n
    1. [arrays] (...Array)

      需要处理的数组队列

      \n
    2. \n
    \n

    返回值 (Array)

    \n

    返回处理好的数组

    \n
    \n

    示例

    \n
    _.union([2, 1], [4, 2], [1, 2]);\n// => [2, 1, 4]\n
    \n
    \n
    \n\n
    " } ,{ "href":"/unionBy", - "html":"

    unionBy source npm

    \n
    _.unionBy([arrays], [iteratee=_.identity])
    \n\n

    这个方法类似 _.union,除了它接受一个 iteratee 调用每一个数组和值。iteratee 会传入一个参数:(value)。

    \n
    \n\n

    参数

    \n
      \n
    1. [arrays] (...Array)

      需要处理的数组队列

      \n
    2. \n
    3. [iteratee=_.identity] (Function|Object|string)

      这个函数会调用每一个元素

      \n
    4. \n
    \n

    返回值 (Array)

    \n

    返回处理好的数组

    \n
    \n

    示例

    \n
    _.unionBy([2.1, 1.2], [4.3, 2.4], Math.floor);\n// => [2.1, 1.2, 4.3]\n\n// 使用了 `_.property` 的回调结果\n_.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');\n// => [{ 'x': 1 }, { 'x': 2 }]\n
    \n
    \n
    \n\n
    " } + "html":"

    unionBy source npm

    \n
    _.unionBy([arrays], [iteratee=_.identity])
    \n\n

    这个方法类似 _.union,除了它接受一个 iteratee 调用每一个数组和值。iteratee 会传入一个参数:(value)。

    \n
    \n\n

    参数

    \n
      \n
    1. [arrays] (...Array)

      需要处理的数组队列

      \n
    2. \n
    3. [iteratee=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

      \n
    4. \n
    \n

    返回值 (Array)

    \n

    返回处理好的数组

    \n
    \n

    示例

    \n
    _.unionBy([2.1, 1.2], [4.3, 2.4], Math.floor);\n// => [2.1, 1.2, 4.3]\n\n// 使用了 `_.property` 的回调结果\n_.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');\n// => [{ 'x': 1 }, { 'x': 2 }]\n
    \n
    \n
    \n\n
    " } ,{ "href":"/unionWith", - "html":"

    unionWith source npm

    \n
    _.unionWith([arrays], [comparator])
    \n\n

    这个方法类似 _.union,\n除了它接受一个 comparator 调用每一个数组元素的值。 comparator 会传入2个参数:(arrVal, othVal)。

    \n
    \n\n

    参数

    \n
      \n
    1. [arrays] (...Array)

      需要处理的数组队列

      \n
    2. \n
    3. [comparator] (Function)

      这个函数会调用每一个元素

      \n
    4. \n
    \n

    返回值 (Array)

    \n

    返回处理好的数组

    \n
    \n

    示例

    \n
    var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];\nvar others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];\n\n_.unionWith(objects, others, _.isEqual);\n// => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]\n
    \n
    \n
    \n\n
    " } + "html":"

    unionWith source npm

    \n
    _.unionWith([arrays], [comparator])
    \n\n

    这个方法类似 _.union,\n除了它接受一个 comparator 调用每一个数组元素的值。 comparator 会传入2个参数:(arrVal, othVal)。

    \n
    \n\n

    参数

    \n
      \n
    1. [arrays] (...Array)

      需要处理的数组队列

      \n
    2. \n
    3. [comparator] (Function)

      这个函数会处理每一个元素

      \n
    4. \n
    \n

    返回值 (Array)

    \n

    返回处理好的数组

    \n
    \n

    示例

    \n
    var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];\nvar others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];\n\n_.unionWith(objects, others, _.isEqual);\n// => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]\n
    \n
    \n
    \n\n
    " } ,{ "href":"/uniq", "html":"

    uniq source npm

    \n
    _.uniq(array)
    \n\n

    创建一个不重复的数组副本。使用了 SameValueZero 等值比较。只有首次出现的元素才会被保留。

    \n
    \n\n

    参数

    \n
      \n
    1. array (Array)

      需要处理的数组

      \n
    2. \n
    \n

    返回值 (Array)

    \n

    返回不重复的数组

    \n
    \n

    示例

    \n
    _.uniq([2, 1, 2]);\n// => [2, 1]\n
    \n
    \n
    \n\n
    " } ,{ "href":"/uniqBy", - "html":"

    uniqBy source npm

    \n
    _.uniqBy(array, [iteratee=_.identity])
    \n\n

    这个方法类似 _.uniq,除了它接受一个 iteratee 调用每一个数组和值来计算唯一性。iteratee 会传入一个参数:(value)。

    \n
    \n\n

    参数

    \n
      \n
    1. array (Array)

      需要处理的数组

      \n
    2. \n
    3. [iteratee=_.identity] (Function|Object|string)

      这个函数会调用每一个元素

      \n
    4. \n
    \n

    返回值 (Array)

    \n

    返回不重复的数组

    \n
    \n

    示例

    \n
    _.uniqBy([2.1, 1.2, 2.3], Math.floor);\n// => [2.1, 1.2]\n\n// 使用了 `_.property` 的回调结果\n_.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');\n// => [{ 'x': 1 }, { 'x': 2 }]\n
    \n
    \n
    \n\n
    " } + "html":"

    uniqBy source npm

    \n
    _.uniqBy(array, [iteratee=_.identity])
    \n\n

    这个方法类似 _.uniq,除了它接受一个 iteratee 调用每一个数组和值来计算唯一性。iteratee 会传入一个参数:(value)。

    \n
    \n\n

    参数

    \n
      \n
    1. array (Array)

      需要处理的数组

      \n
    2. \n
    3. [iteratee=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

      \n
    4. \n
    \n

    返回值 (Array)

    \n

    返回不重复的数组

    \n
    \n

    示例

    \n
    _.uniqBy([2.1, 1.2, 2.3], Math.floor);\n// => [2.1, 1.2]\n\n// 使用了 `_.property` 的回调结果\n_.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');\n// => [{ 'x': 1 }, { 'x': 2 }]\n
    \n
    \n
    \n\n
    " } ,{ "href":"/uniqWith", - "html":"

    uniqWith source npm

    \n
    _.uniqWith(array, [comparator])
    \n\n

    这个方法类似 _.uniq,除了它接受一个 comparator 来比较计算唯一性。 comparator 会传入2个参数:(arrVal, othVal)

    \n
    \n\n

    参数

    \n
      \n
    1. array (Array)

      需要处理的数组

      \n
    2. \n
    3. [comparator] (Function)

      这个函数会调用每一个元素

      \n
    4. \n
    \n

    返回值 (Array)

    \n

    返回不重复的数组

    \n
    \n

    示例

    \n
    var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 },  { 'x': 1, 'y': 2 }];\n\n_.uniqWith(objects, _.isEqual);\n// => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]\n
    \n
    \n
    \n\n
    " } + "html":"

    uniqWith source npm

    \n
    _.uniqWith(array, [comparator])
    \n\n

    这个方法类似 _.uniq,除了它接受一个 comparator 来比较计算唯一性。 comparator 会传入2个参数:(arrVal, othVal)

    \n
    \n\n

    参数

    \n
      \n
    1. array (Array)

      需要处理的数组

      \n
    2. \n
    3. [comparator] (Function)

      这个函数会处理每一个元素

      \n
    4. \n
    \n

    返回值 (Array)

    \n

    返回不重复的数组

    \n
    \n

    示例

    \n
    var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 },  { 'x': 1, 'y': 2 }];\n\n_.uniqWith(objects, _.isEqual);\n// => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]\n
    \n
    \n
    \n\n
    " } ,{ "href":"/unzip", "html":"

    unzip source npm

    \n
    _.unzip(array)
    \n\n

    这个方法类似 _.zip,除了它接收一个打包后的数组并且还原为打包前的状态。

    \n
    \n\n

    参数

    \n
      \n
    1. array (Array)

      需要解包的已打包数组

      \n
    2. \n
    \n

    返回值 (Array)

    \n

    返回一个解包后的数组

    \n
    \n

    示例

    \n
    var zipped = _.zip(['fred', 'barney'], [30, 40], [true, false]);\n// => [['fred', 30, true], ['barney', 40, false]]\n\n_.unzip(zipped);\n// => [['fred', 'barney'], [30, 40], [true, false]]\n
    \n
    \n
    \n\n
    " } ,{ "href":"/unzipWith", @@ -117,9 +117,9 @@ ,{ "href":"/xor", "html":"

    xor source npm

    \n
    _.xor([arrays])
    \n\n

    创建一个包含了所有唯一值的数组。使用了 symmetric difference 等值比较。

    \n
    \n\n

    参数

    \n
      \n
    1. [arrays] (...Array)

      要处理的数组

      \n
    2. \n
    \n

    返回值 (Array)

    \n

    包含了所有唯一值的新数组

    \n
    \n

    示例

    \n
    _.xor([2, 1], [4, 2]);\n// => [1, 4]\n
    \n
    \n
    \n\n
    " } ,{ "href":"/xorBy", - "html":"

    xorBy source npm

    \n
    _.xorBy([arrays], [iteratee=_.identity])
    \n\n

    这个方法类似 _.xor,除了它接受一个 iteratee 调用每一个数组和值。iteratee 会传入一个参数:(value)。

    \n
    \n\n

    参数

    \n
      \n
    1. [arrays] (...Array)

      要处理的数组

      \n
    2. \n
    3. [iteratee=_.identity] (Function|Object|string)

      这个函数会调用每一个元素

      \n
    4. \n
    \n

    返回值 (Array)

    \n

    包含了所有唯一值的新数组

    \n
    \n

    示例

    \n
    _.xorBy([2.1, 1.2], [4.3, 2.4], Math.floor);\n// => [1.2, 4.3]\n\n// 使用了 `_.property` 的回调结果\n_.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');\n// => [{ 'x': 2 }]\n
    \n
    \n
    \n\n
    " } + "html":"

    xorBy source npm

    \n
    _.xorBy([arrays], [iteratee=_.identity])
    \n\n

    这个方法类似 _.xor,除了它接受一个 iteratee 调用每一个数组和值。iteratee 会传入一个参数:(value)。

    \n
    \n\n

    参数

    \n
      \n
    1. [arrays] (...Array)

      要处理的数组

      \n
    2. \n
    3. [iteratee=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

      \n
    4. \n
    \n

    返回值 (Array)

    \n

    包含了所有唯一值的新数组

    \n
    \n

    示例

    \n
    _.xorBy([2.1, 1.2], [4.3, 2.4], Math.floor);\n// => [1.2, 4.3]\n\n// 使用了 `_.property` 的回调结果\n_.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');\n// => [{ 'x': 2 }]\n
    \n
    \n
    \n\n
    " } ,{ "href":"/xorWith", - "html":"

    xorWith source npm

    \n
    _.xorWith([arrays], [comparator])
    \n\n

    这个方法类似 _.xor,除了它接受一个 comparator 调用每一个数组元素的值。 comparator 会传入2个参数:(arrVal, othVal)。

    \n
    \n\n

    参数

    \n
      \n
    1. [arrays] (...Array)

      要处理的数组

      \n
    2. \n
    3. [comparator] (Function)

      这个函数会调用每一个元素

      \n
    4. \n
    \n

    返回值 (Array)

    \n

    包含了所有唯一值的新数组

    \n
    \n

    示例

    \n
    var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];\nvar others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];\n\n_.xorWith(objects, others, _.isEqual);\n// => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]\n
    \n
    \n
    \n\n
    " } + "html":"

    xorWith source npm

    \n
    _.xorWith([arrays], [comparator])
    \n\n

    这个方法类似 _.xor,除了它接受一个 comparator 调用每一个数组元素的值。 comparator 会传入2个参数:(arrVal, othVal)。

    \n
    \n\n

    参数

    \n
      \n
    1. [arrays] (...Array)

      要处理的数组

      \n
    2. \n
    3. [comparator] (Function)

      这个函数会处理每一个元素

      \n
    4. \n
    \n

    返回值 (Array)

    \n

    包含了所有唯一值的新数组

    \n
    \n

    示例

    \n
    var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];\nvar others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];\n\n_.xorWith(objects, others, _.isEqual);\n// => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]\n
    \n
    \n
    \n\n
    " } ,{ "href":"/zip", "html":"

    zip source npm

    \n
    _.zip([arrays])
    \n\n

    创建一个打包所有元素后的数组。第一个元素包含所有提供数组的第一个元素,第二个包含所有提供数组的第二个元素,以此类推。

    \n
    \n\n

    参数

    \n
      \n
    1. [arrays] (...Array)

      要处理的数组队列

      \n
    2. \n
    \n

    返回值 (Array)

    \n

    返回一个打包后的数组

    \n
    \n

    示例

    \n
    _.zip(['fred', 'barney'], [30, 40], [true, false]);\n// => [['fred', 30, true], ['barney', 40, false]]\n
    \n
    \n
    \n\n
    " } ,{ "href":"/zipObject", @@ -149,309 +149,309 @@ ,{ "href":"/thru", "html":"

    thru source

    \n
    _.thru(value, interceptor)
    \n\n

    这个方法类似 _.tap, 除了它返回 interceptor 的返回结果

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      提供给 interceptor 的值

      \n
    2. \n
    3. interceptor (Function)

      调用函数

      \n
    4. \n
    \n

    返回值 (*)

    \n

    返回 interceptor 的返回结果

    \n
    \n

    示例

    \n
    _('  abc  ')\n .chain()\n .trim()\n .thru(function(value) {\n   return [value];\n })\n .value();\n// => ['abc']\n
    \n
    \n
    \n\n
    " } ,{ "href":"/wrapperFlatMap", - "html":"

    wrapperFlatMap source

    \n
    _.wrapperFlatMap([iteratee=_.identity])
    \n\n

    这个方法是 _.flatMap 的包装版本。

    \n
    \n\n

    参数

    \n
      \n
    1. [iteratee=_.identity] (Function|Object|string)

      这个函数会调用每一个元素

      \n
    2. \n
    \n

    返回值 (Object)

    \n

    返回 lodash 的包装实例

    \n
    \n

    示例

    \n
    function duplicate(n) {\n  return [n, n];\n}\n\n_([1, 2]).flatMap(duplicate).value();\n// => [1, 1, 2, 2]\n
    \n
    \n
    \n\n
    " } + "html":"

    wrapperFlatMap source

    \n
    _.wrapperFlatMap([iteratee=_.identity])
    \n\n

    这个方法是 _.flatMap 的包装版本。

    \n
    \n\n

    参数

    \n
      \n
    1. [iteratee=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

      \n
    2. \n
    \n

    返回值 (Object)

    \n

    返回 lodash 的包装实例

    \n
    \n

    示例

    \n
    function duplicate(n) {\n  return [n, n];\n}\n\n_([1, 2]).flatMap(duplicate).value();\n// => [1, 1, 2, 2]\n
    \n
    \n
    \n\n
    " } ,{ "href":"/countBy", - "html":"

    countBy source npm

    \n
    _.countBy(collection, [iteratee=_.identity])
    \n\n

    Creates an object composed of keys generated from the results of running\neach element of collection through iteratee. The corresponding value\nof each key is the number of times the key was returned by iteratee.\nThe iteratee is invoked with one argument: (value).

    \n
    \n\n

    参数

    \n
      \n
    1. collection (Array|Object)

      The collection to iterate over.

      \n
    2. \n
    3. [iteratee=_.identity] (Function|Object|string)

      这个函数会调用每一个元素

      \n
    4. \n
    \n

    返回值 (Object)

    \n

    Returns the composed aggregate object.

    \n
    \n

    示例

    \n
    _.countBy([6.1, 4.2, 6.3], Math.floor);\n// => { '4': 1, '6': 2 }\n\n_.countBy(['one', 'two', 'three'], 'length');\n// => { '3': 2, '5': 1 }\n
    \n
    \n
    \n\n
    " } + "html":"

    countBy source npm

    \n
    _.countBy(collection, [iteratee=_.identity])
    \n\n

    创建一个组成对象,key是经过 iteratee 处理的集合的结果,value 是处理结果的次数。 iteratee 会传入一个参数:(value)。

    \n
    \n\n

    参数

    \n
      \n
    1. collection (Array|Object)

      需要遍历的集合

      \n
    2. \n
    3. [iteratee=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

      \n
    4. \n
    \n

    返回值 (Object)

    \n

    返回一个组成汇总的对象

    \n
    \n

    示例

    \n
    _.countBy([6.1, 4.2, 6.3], Math.floor);\n// => { '4': 1, '6': 2 }\n\n_.countBy(['one', 'two', 'three'], 'length');\n// => { '3': 2, '5': 1 }\n
    \n
    \n
    \n\n
    " } ,{ "href":"/every", - "html":"

    every source npm

    \n
    _.every(collection, [predicate=_.identity])
    \n\n

    Checks if predicate returns truthy for all elements of collection.\nIteration is stopped once predicate returns falsey. The predicate is\ninvoked with three arguments: (value, index|key, collection).

    \n
    \n\n

    参数

    \n
      \n
    1. collection (Array|Object)

      The collection to iterate over.

      \n
    2. \n
    3. [predicate=_.identity] (Function|Object|string)

      The function invoked per iteration.

      \n
    4. \n
    \n

    返回值 (boolean)

    \n

    Returns true if all elements pass the predicate check, else false.

    \n
    \n

    示例

    \n
    _.every([true, 1, null, 'yes'], Boolean);\n// => false\n\nvar users = [\n  { 'user': 'barney', 'active': false },\n  { 'user': 'fred',   'active': false }\n];\n\n// 使用了 `_.matches` 的回调结果\n_.every(users, { 'user': 'barney', 'active': false });\n// => false\n\n// 使用了 `_.matchesProperty` 的回调结果\n_.every(users, ['active', false]);\n// => true\n\n// 使用了 `_.property` 的回调结果\n_.every(users, 'active');\n// => false\n
    \n
    \n
    \n\n
    " } + "html":"

    every source npm

    \n
    _.every(collection, [predicate=_.identity])
    \n\n

    通过 predicate 检查集合中的元素是否都返回 真值,只要 predicate 返回一次假值,遍历就停止,并返回 false。
    predicate 会传入3个参数:(value, index|key, collection)

    \n
    \n\n

    参数

    \n
      \n
    1. collection (Array|Object)

      需要遍历的集合

      \n
    2. \n
    3. [predicate=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

      \n
    4. \n
    \n

    返回值 (boolean)

    \n

    返回 true,如果所有元素经 predicate 检查都为真值,否则返回 false。

    \n
    \n

    示例

    \n
    _.every([true, 1, null, 'yes'], Boolean);\n// => false\n\nvar users = [\n  { 'user': 'barney', 'active': false },\n  { 'user': 'fred',   'active': false }\n];\n\n// 使用了 `_.matches` 的回调结果\n_.every(users, { 'user': 'barney', 'active': false });\n// => false\n\n// 使用了 `_.matchesProperty` 的回调结果\n_.every(users, ['active', false]);\n// => true\n\n// 使用了 `_.property` 的回调结果\n_.every(users, 'active');\n// => false\n
    \n
    \n
    \n\n
    " } ,{ "href":"/filter", - "html":"

    filter source npm

    \n
    _.filter(collection, [predicate=_.identity])
    \n\n

    Iterates over elements of collection, returning an array of all elements\npredicate returns truthy for. The predicate is invoked with three arguments:
    \n(value, index|key, collection).

    \n
    \n\n

    参数

    \n
      \n
    1. collection (Array|Object)

      The collection to iterate over.

      \n
    2. \n
    3. [predicate=_.identity] (Function|Object|string)

      The function invoked per iteration.

      \n
    4. \n
    \n

    返回值 (Array)

    \n

    Returns the new filtered array.

    \n
    \n

    示例

    \n
    var resolve = _.partial(_.map, _, 'user');\n\nvar users = [\n  { 'user': 'barney', 'age': 36, 'active': true },\n  { 'user': 'fred',   'age': 40, 'active': false }\n];\n\nresolve( _.filter(users, function(o) { return !o.active; }) );\n// => ['fred']\n\n// 使用了 `_.matches` 的回调结果\nresolve( _.filter(users, { 'age': 36, 'active': true }) );\n// => ['barney']\n\n// 使用了 `_.matchesProperty` 的回调结果\nresolve( _.filter(users, ['active', false]) );\n// => ['fred']\n\n// 使用了 `_.property` 的回调结果\nresolve( _.filter(users, 'active') );\n// => ['barney']\n
    \n
    \n
    \n\n
    " } + "html":"

    filter source npm

    \n
    _.filter(collection, [predicate=_.identity])
    \n\n

    遍历集合中的元素,筛选出一个经过 predicate 检查结果为真值的数组,predicate 会传入3个参数:(value, index|key, collection)。

    \n
    \n\n

    参数

    \n
      \n
    1. collection (Array|Object)

      需要遍历的集合

      \n
    2. \n
    3. [predicate=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

      \n
    4. \n
    \n

    返回值 (Array)

    \n

    返回筛选结果的新数组

    \n
    \n

    示例

    \n
    var resolve = _.partial(_.map, _, 'user');\n\nvar users = [\n  { 'user': 'barney', 'age': 36, 'active': true },\n  { 'user': 'fred',   'age': 40, 'active': false }\n];\n\nresolve( _.filter(users, function(o) { return !o.active; }) );\n// => ['fred']\n\n// 使用了 `_.matches` 的回调结果\nresolve( _.filter(users, { 'age': 36, 'active': true }) );\n// => ['barney']\n\n// 使用了 `_.matchesProperty` 的回调结果\nresolve( _.filter(users, ['active', false]) );\n// => ['fred']\n\n// 使用了 `_.property` 的回调结果\nresolve( _.filter(users, 'active') );\n// => ['barney']\n
    \n
    \n
    \n\n
    " } ,{ "href":"/find", - "html":"

    find source npm

    \n
    _.find(collection, [predicate=_.identity])
    \n\n

    Iterates over elements of collection, returning the first element\npredicate returns truthy for. The predicate is invoked with three arguments:
    \n(value, index|key, collection).

    \n
    \n\n

    参数

    \n
      \n
    1. collection (Array|Object)

      The collection to search.

      \n
    2. \n
    3. [predicate=_.identity] (Function|Object|string)

      The function invoked per iteration.

      \n
    4. \n
    \n

    返回值 (*)

    \n

    Returns the matched element, else undefined.

    \n
    \n

    示例

    \n
    var resolve = _.partial(_.result, _, 'user');\n\nvar users = [\n  { 'user': 'barney',  'age': 36, 'active': true },\n  { 'user': 'fred',    'age': 40, 'active': false },\n  { 'user': 'pebbles', 'age': 1,  'active': true }\n];\n\nresolve( _.find(users, function(o) { return o.age < 40; }) );\n// => 'barney'\n\n// 使用了 `_.matches` 的回调结果\nresolve( _.find(users, { 'age': 1, 'active': true }) );\n// => 'pebbles'\n\n// 使用了 `_.matchesProperty` 的回调结果\nresolve( _.find(users, ['active', false]) );\n// => 'fred'\n\n// 使用了 `_.property` 的回调结果\nresolve( _.find(users, 'active') );\n// => 'barney'\n
    \n
    \n
    \n\n
    " } + "html":"

    find source npm

    \n
    _.find(collection, [predicate=_.identity])
    \n\n

    遍历集合中的元素,返回最先经 predicate 检查为真值的元素。 predicate 会传入3个元素:(value, index|key, collection)。

    \n
    \n\n

    参数

    \n
      \n
    1. collection (Array|Object)

      要检索的集合

      \n
    2. \n
    3. [predicate=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

      \n
    4. \n
    \n

    返回值 (*)

    \n

    返回匹配元素,否则返回 undefined

    \n
    \n

    示例

    \n
    var resolve = _.partial(_.result, _, 'user');\n\nvar users = [\n  { 'user': 'barney',  'age': 36, 'active': true },\n  { 'user': 'fred',    'age': 40, 'active': false },\n  { 'user': 'pebbles', 'age': 1,  'active': true }\n];\n\nresolve( _.find(users, function(o) { return o.age < 40; }) );\n// => 'barney'\n\n// 使用了 `_.matches` 的回调结果\nresolve( _.find(users, { 'age': 1, 'active': true }) );\n// => 'pebbles'\n\n// 使用了 `_.matchesProperty` 的回调结果\nresolve( _.find(users, ['active', false]) );\n// => 'fred'\n\n// 使用了 `_.property` 的回调结果\nresolve( _.find(users, 'active') );\n// => 'barney'\n
    \n
    \n
    \n\n
    " } ,{ "href":"/findLast", - "html":"

    findLast source npm

    \n
    _.findLast(collection, [predicate=_.identity])
    \n\n

    This method is like _.find except that it iterates over elements of\ncollection from right to left.

    \n
    \n\n

    参数

    \n
      \n
    1. collection (Array|Object)

      The collection to search.

      \n
    2. \n
    3. [predicate=_.identity] (Function|Object|string)

      The function invoked per iteration.

      \n
    4. \n
    \n

    返回值 (*)

    \n

    Returns the matched element, else undefined.

    \n
    \n

    示例

    \n
    _.findLast([1, 2, 3, 4], function(n) {\n  return n % 2 == 1;\n});\n// => 3\n
    \n
    \n
    \n\n
    " } + "html":"

    findLast source npm

    \n
    _.findLast(collection, [predicate=_.identity])
    \n\n

    这个方法类似 _.find,除了它是从右至左遍历集合的。

    \n
    \n\n

    参数

    \n
      \n
    1. collection (Array|Object)

      要检索的集合

      \n
    2. \n
    3. [predicate=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

      \n
    4. \n
    \n

    返回值 (*)

    \n

    返回匹配元素,否则返回 undefined

    \n
    \n

    示例

    \n
    _.findLast([1, 2, 3, 4], function(n) {\n  return n % 2 == 1;\n});\n// => 3\n
    \n
    \n
    \n\n
    " } ,{ "href":"/forEach", - "html":"

    forEach each source npm

    \n
    _.forEach(collection, [iteratee=_.identity])
    \n\n

    Iterates over elements of collection invoking iteratee for each element.\nThe iteratee is invoked with three arguments: (value, index|key, collection).\nIteratee functions may exit iteration early by explicitly returning false.\n
    \n
    \n注意: As with other "Collections" methods, objects with a "length" property\nare iterated like arrays. To avoid this behavior use _.forIn or _.forOwn\nfor object iteration.

    \n
    \n\n

    参数

    \n
      \n
    1. collection (Array|Object)

      The collection to iterate over.

      \n
    2. \n
    3. [iteratee=_.identity] (Function)

      The function invoked per iteration.

      \n
    4. \n
    \n

    返回值 (Array|Object)

    \n

    Returns collection.

    \n
    \n

    示例

    \n
    _([1, 2]).forEach(function(value) {\n  console.log(value);\n});\n// => logs `1` then `2`\n\n_.forEach({ 'a': 1, 'b': 2 }, function(value, key) {\n  console.log(key);\n});\n// => logs 'a' then 'b' (iteration order is not guaranteed)\n
    \n
    \n
    \n\n
    " } + "html":"

    forEach each source npm

    \n
    _.forEach(collection, [iteratee=_.identity])
    \n\n

    调用 iteratee 遍历集合中的元素,iteratee 会传入3个参数:(value, index|key, collection)。\n如果显式的返回 false ,iteratee 会提前退出。\n
    \n
    \n注意: 与其他集合方法一样,对象的 length 属性也会被遍历,避免这种情况,可以用 _.forIn 或者 _.forOwn 代替。

    \n
    \n\n

    参数

    \n
      \n
    1. collection (Array|Object)

      需要遍历的集合

      \n
    2. \n
    3. [iteratee=_.identity] (Function)

      这个函数会处理每一个元素

      \n
    4. \n
    \n

    返回值 (Array|Object)

    \n

    返回集合

    \n
    \n

    示例

    \n
    _([1, 2]).forEach(function(value) {\n  console.log(value);\n});\n// => 输出 `1` 和 `2`\n\n_.forEach({ 'a': 1, 'b': 2 }, function(value, key) {\n  console.log(key);\n});\n// => 输出 'a' 和 'b' (不保证遍历的顺序)\n
    \n
    \n
    \n\n
    " } ,{ "href":"/forEachRight", - "html":"

    forEachRight eachRight source npm

    \n
    _.forEachRight(collection, [iteratee=_.identity])
    \n\n

    This method is like _.forEach except that it iterates over elements of\ncollection from right to left.

    \n
    \n\n

    参数

    \n
      \n
    1. collection (Array|Object)

      The collection to iterate over.

      \n
    2. \n
    3. [iteratee=_.identity] (Function)

      The function invoked per iteration.

      \n
    4. \n
    \n

    返回值 (Array|Object)

    \n

    Returns collection.

    \n
    \n

    示例

    \n
    _.forEachRight([1, 2], function(value) {\n  console.log(value);\n});\n// => logs `2` then `1`\n
    \n
    \n
    \n\n
    " } + "html":"

    forEachRight eachRight source npm

    \n
    _.forEachRight(collection, [iteratee=_.identity])
    \n\n

    这个方法类似 _.forEach,除了它是从右到左遍历的集合中的元素的。

    \n
    \n\n

    参数

    \n
      \n
    1. collection (Array|Object)

      需要遍历的集合

      \n
    2. \n
    3. [iteratee=_.identity] (Function)

      这个函数会处理每一个元素

      \n
    4. \n
    \n

    返回值 (Array|Object)

    \n

    返回集合

    \n
    \n

    示例

    \n
    _.forEachRight([1, 2], function(value) {\n  console.log(value);\n});\n// => 输出 `2` 和 `1`\n
    \n
    \n
    \n\n
    " } ,{ "href":"/groupBy", - "html":"

    groupBy source npm

    \n
    _.groupBy(collection, [iteratee=_.identity])
    \n\n

    Creates an object composed of keys generated from the results of running\neach element of collection through iteratee. The corresponding value\nof each key is an array of the elements responsible for generating the key.\nThe iteratee is invoked with one argument: (value).

    \n
    \n\n

    参数

    \n
      \n
    1. collection (Array|Object)

      The collection to iterate over.

      \n
    2. \n
    3. [iteratee=_.identity] (Function|Object|string)

      这个函数会调用每一个元素

      \n
    4. \n
    \n

    返回值 (Object)

    \n

    Returns the composed aggregate object.

    \n
    \n

    示例

    \n
    _.groupBy([6.1, 4.2, 6.3], Math.floor);\n// => { '4': [4.2], '6': [6.1, 6.3] }\n\n// 使用了 `_.property` 的回调结果\n_.groupBy(['one', 'two', 'three'], 'length');\n// => { '3': ['one', 'two'], '5': ['three'] }\n
    \n
    \n
    \n\n
    " } + "html":"

    groupBy source npm

    \n
    _.groupBy(collection, [iteratee=_.identity])
    \n\n

    创建一个对象组成,key 是经 iteratee 处理的结果, value 是产生 key 的元素数组。 iteratee 会传入1个参数:(value)。

    \n
    \n\n

    参数

    \n
      \n
    1. collection (Array|Object)

      需要遍历的集合

      \n
    2. \n
    3. [iteratee=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

      \n
    4. \n
    \n

    返回值 (Object)

    \n

    返回一个组成汇总的对象

    \n
    \n

    示例

    \n
    _.groupBy([6.1, 4.2, 6.3], Math.floor);\n// => { '4': [4.2], '6': [6.1, 6.3] }\n\n// 使用了 `_.property` 的回调结果\n_.groupBy(['one', 'two', 'three'], 'length');\n// => { '3': ['one', 'two'], '5': ['three'] }\n
    \n
    \n
    \n\n
    " } ,{ "href":"/includes", - "html":"

    includes source npm

    \n
    _.includes(collection, value, [fromIndex=0])
    \n\n

    Checks if value is in collection. If collection is a string it's checked\nfor a substring of value, otherwise SameValueZero\nis used for equality comparisons. If fromIndex is negative, it's used as\nthe offset from the end of collection.

    \n
    \n\n

    参数

    \n
      \n
    1. collection (Array|Object|string)

      The collection to search.

      \n
    2. \n
    3. value (*)

      The value to search for.

      \n
    4. \n
    5. [fromIndex=0] (number)

      The index to search from.

      \n
    6. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is found, else false.

    \n
    \n

    示例

    \n
    _.includes([1, 2, 3], 1);\n// => true\n\n_.includes([1, 2, 3], 1, 2);\n// => false\n\n_.includes({ 'user': 'fred', 'age': 40 }, 'fred');\n// => true\n\n_.includes('pebbles', 'eb');\n// => true\n
    \n
    \n
    \n\n
    " } + "html":"

    includes source npm

    \n
    _.includes(collection, value, [fromIndex=0])
    \n\n

    检查 值 是否在 集合中,如果集合是字符串,那么检查 值 是否在字符串中。\n其他情况用 SameValueZero 等值比较。\n如果指定 fromIndex 是负数,从结尾开始检索。

    \n
    \n\n

    参数

    \n
      \n
    1. collection (Array|Object|string)

      要检索的集合

      \n
    2. \n
    3. value (*)

      要检索的值

      \n
    4. \n
    5. [fromIndex=0] (number)

      要检索的 index 位置

      \n
    6. \n
    \n

    返回值 (boolean)

    \n

    如果找到 value 返回 ture, 否则返回 false。

    \n
    \n

    示例

    \n
    _.includes([1, 2, 3], 1);\n// => true\n\n_.includes([1, 2, 3], 1, 2);\n// => false\n\n_.includes({ 'user': 'fred', 'age': 40 }, 'fred');\n// => true\n\n_.includes('pebbles', 'eb');\n// => true\n
    \n
    \n
    \n\n
    " } ,{ "href":"/invokeMap", - "html":"

    invokeMap source npm

    \n
    _.invokeMap(collection, path, [args])
    \n\n

    Invokes the method at path of each element in collection, returning\nan array of the results of each invoked method. Any additional arguments\nare provided to each invoked method. If methodName is a function it's\ninvoked for, and this bound to, each element in collection.

    \n
    \n\n

    参数

    \n
      \n
    1. collection (Array|Object)

      The collection to iterate over.

      \n
    2. \n
    3. path (Array|Function|string)

      The path of the method to invoke or the function invoked per iteration.

      \n
    4. \n
    5. [args] (...*)

      The arguments to invoke each method with.

      \n
    6. \n
    \n

    返回值 (Array)

    \n

    Returns the array of results.

    \n
    \n

    示例

    \n
    _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');\n// => [[1, 5, 7], [1, 2, 3]]\n\n_.invokeMap([123, 456], String.prototype.split, '');\n// => [['1', '2', '3'], ['4', '5', '6']]\n
    \n
    \n
    \n\n
    " } + "html":"

    invokeMap source npm

    \n
    _.invokeMap(collection, path, [args])
    \n\n

    调用 path 的方法处理集合中的每一个元素,返回处理的数组。\n如何附加的参数会传入到调用方法中。如果方法名是个函数,集合中的每个元素都会被调用到。

    \n
    \n\n

    参数

    \n
      \n
    1. collection (Array|Object)

      需要遍历的集合

      \n
    2. \n
    3. path (Array|Function|string)

      要调用的方法名 或者 这个函数会处理每一个元素

      \n
    4. \n
    5. [args] (...*)

      The arguments to invoke each method with.

      \n
    6. \n
    \n

    返回值 (Array)

    \n

    返回数组结果

    \n
    \n

    示例

    \n
    _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');\n// => [[1, 5, 7], [1, 2, 3]]\n\n_.invokeMap([123, 456], String.prototype.split, '');\n// => [['1', '2', '3'], ['4', '5', '6']]\n
    \n
    \n
    \n\n
    " } ,{ "href":"/keyBy", - "html":"

    keyBy source npm

    \n
    _.keyBy(collection, [iteratee=_.identity])
    \n\n

    Creates an object composed of keys generated from the results of running\neach element of collection through iteratee. The corresponding value\nof each key is the last element responsible for generating the key. The\niteratee is invoked with one argument: (value).

    \n
    \n\n

    参数

    \n
      \n
    1. collection (Array|Object)

      The collection to iterate over.

      \n
    2. \n
    3. [iteratee=_.identity] (Function|Object|string)

      这个函数会调用每一个元素

      \n
    4. \n
    \n

    返回值 (Object)

    \n

    Returns the composed aggregate object.

    \n
    \n

    示例

    \n
    var keyData = [\n  { 'dir': 'left', 'code': 97 },\n  { 'dir': 'right', 'code': 100 }\n];\n\n_.keyBy(keyData, 'dir');\n// => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }\n\n_.keyBy(keyData, function(o) {\n  return String.fromCharCode(o.code);\n});\n// => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }\n
    \n
    \n
    \n\n
    " } + "html":"

    keyBy source npm

    \n
    _.keyBy(collection, [iteratee=_.identity])
    \n\n

    创建一个对象组成。key 是经 iteratee 处理的结果,value 是产生key的元素。\niteratee 会传入1个参数:(value)。

    \n
    \n\n

    参数

    \n
      \n
    1. collection (Array|Object)

      需要遍历的集合

      \n
    2. \n
    3. [iteratee=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

      \n
    4. \n
    \n

    返回值 (Object)

    \n

    返回一个组成汇总的对象

    \n
    \n

    示例

    \n
    var keyData = [\n  { 'dir': 'left', 'code': 97 },\n  { 'dir': 'right', 'code': 100 }\n];\n\n_.keyBy(keyData, 'dir');\n// => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }\n\n_.keyBy(keyData, function(o) {\n  return String.fromCharCode(o.code);\n});\n// => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }\n
    \n
    \n
    \n\n
    " } ,{ "href":"/map", - "html":"

    map source npm

    \n
    _.map(collection, [iteratee=_.identity])
    \n\n

    Creates an array of values by running each element in collection through\niteratee. The iteratee is invoked with three arguments:
    \n(value, index|key, collection).\n
    \n
    \nMany lodash methods are guarded to work as iteratees for methods like\n_.every, _.filter, _.map, _.mapValues, _.reject, and _.some.\n
    \n
    \nThe guarded methods are:
    \nary, curry, curryRight, drop, dropRight, every, fill,\ninvert, parseInt, random, range, rangeRight, slice, some,\nsortBy, take, takeRight, template, trim, trimEnd, trimStart,\nand words

    \n
    \n\n

    参数

    \n
      \n
    1. collection (Array|Object)

      The collection to iterate over.

      \n
    2. \n
    3. [iteratee=_.identity] (Function|Object|string)

      The function invoked per iteration.

      \n
    4. \n
    \n

    返回值 (Array)

    \n

    Returns the new mapped array.

    \n
    \n

    示例

    \n
    function square(n) {\n  return n * n;\n}\n\n_.map([1, 2], square);\n// => [3, 6]\n\n_.map({ 'a': 1, 'b': 2 }, square);\n// => [3, 6] (iteration order is not guaranteed)\n\nvar users = [\n  { 'user': 'barney' },\n  { 'user': 'fred' }\n];\n\n// 使用了 `_.property` 的回调结果\n_.map(users, 'user');\n// => ['barney', 'fred']\n
    \n
    \n
    \n\n
    " } + "html":"

    map source npm

    \n
    _.map(collection, [iteratee=_.identity])
    \n\n

    创建一个经过 iteratee 处理的集合中每一个元素的结果数组。\niteratee 会传入3个参数:(value, index|key, collection)。\n
    \n
    \n有许多 lodash 的方法以 iteratees 的身份守护其工作,例如:\n_.every, _.filter, _.map, _.mapValues, _.reject, 以及 _.some\n
    \n
    \n被守护的有:
    \nary, curry, curryRight, drop, dropRight, every, fill,\ninvert, parseInt, random, range, rangeRight, slice, some,\nsortBy, take, takeRight, template, trim, trimEnd, trimStart,\n以及 words

    \n
    \n\n

    参数

    \n
      \n
    1. collection (Array|Object)

      需要遍历的集合

      \n
    2. \n
    3. [iteratee=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

      \n
    4. \n
    \n

    返回值 (Array)

    \n

    返回映射后的新数组

    \n
    \n

    示例

    \n
    function square(n) {\n  return n * n;\n}\n\n_.map([1, 2], square);\n// => [3, 6]\n\n_.map({ 'a': 1, 'b': 2 }, square);\n// => [3, 6] (无法保证遍历的顺序)\n\nvar users = [\n  { 'user': 'barney' },\n  { 'user': 'fred' }\n];\n\n// 使用了 `_.property` 的回调结果\n_.map(users, 'user');\n// => ['barney', 'fred']\n
    \n
    \n
    \n\n
    " } ,{ "href":"/orderBy", - "html":"

    orderBy source npm

    \n
    _.orderBy(collection, [iteratees=[_.identity]], [orders])
    \n\n

    This method is like _.sortBy except that it allows specifying the sort\norders of the iteratees to sort by. If orders is unspecified, all values\nare sorted in ascending order. Otherwise, specify an order of "desc" for\ndescending or "asc" for ascending sort order of corresponding values.

    \n
    \n\n

    参数

    \n
      \n
    1. collection (Array|Object)

      The collection to iterate over.

      \n
    2. \n
    3. [iteratees=[_.identity]] (Function[]|Object[]|string[])

      The iteratees to sort by.

      \n
    4. \n
    5. [orders] (string[])

      The sort orders of iteratees.

      \n
    6. \n
    \n

    返回值 (Array)

    \n

    Returns the new sorted array.

    \n
    \n

    示例

    \n
    var resolve = _.partial(_.map, _, _.values);\n\nvar users = [\n  { 'user': 'fred',   'age': 48 },\n  { 'user': 'barney', 'age': 34 },\n  { 'user': 'fred',   'age': 42 },\n  { 'user': 'barney', 'age': 36 }\n];\n\n// sort by `user` in ascending order and by `age` in descending order\nresolve( _.orderBy(users, ['user', 'age'], ['asc', 'desc']) );\n// => [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]]\n
    \n
    \n
    \n\n
    " } + "html":"

    orderBy source npm

    \n
    _.orderBy(collection, [iteratees=[_.identity]], [orders])
    \n\n

    这个方法类似 _.sortBy,除了它允许以 iteratees 来指定排序规则。\n如果没指定 orders,所有值以升序排序。\n其他情况,指定 "desc" 降序,指定 "asc" 升序其对应值。

    \n
    \n\n

    参数

    \n
      \n
    1. collection (Array|Object)

      需要遍历的集合

      \n
    2. \n
    3. [iteratees=[_.identity]] (Function[]|Object[]|string[])

      通过 iteratees 决定排序

      \n
    4. \n
    5. [orders] (string[])

      决定 iteratees 的排序方法

      \n
    6. \n
    \n

    返回值 (Array)

    \n

    排序排序后的新数组

    \n
    \n

    示例

    \n
    var resolve = _.partial(_.map, _, _.values);\n\nvar users = [\n  { 'user': 'fred',   'age': 48 },\n  { 'user': 'barney', 'age': 34 },\n  { 'user': 'fred',   'age': 42 },\n  { 'user': 'barney', 'age': 36 }\n];\n\n// 以 `user` 升序排序 再 以 `age` 降序排序。\nresolve( _.orderBy(users, ['user', 'age'], ['asc', 'desc']) );\n// => [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]]\n
    \n
    \n
    \n\n
    " } ,{ "href":"/partition", - "html":"

    partition source npm

    \n
    _.partition(collection, [predicate=_.identity])
    \n\n

    Creates an array of elements split into two groups, the first of which\ncontains elements predicate returns truthy for, while the second of which\ncontains elements predicate returns falsey for. The predicate is invoked\nwith three arguments: (value, index|key, collection).

    \n
    \n\n

    参数

    \n
      \n
    1. collection (Array|Object)

      The collection to iterate over.

      \n
    2. \n
    3. [predicate=_.identity] (Function|Object|string)

      The function invoked per iteration.

      \n
    4. \n
    \n

    返回值 (Array)

    \n

    Returns the array of grouped elements.

    \n
    \n

    示例

    \n
    var resolve = function(result) {\n  return _.map(result, function(array) { return _.map(array, 'user'); });\n};\n\nvar users = [\n  { 'user': 'barney',  'age': 36, 'active': false },\n  { 'user': 'fred',    'age': 40, 'active': true },\n  { 'user': 'pebbles', 'age': 1,  'active': false }\n];\n\nresolve( _.partition(users, function(o) { return o.active; }) );\n// => [['fred'], ['barney', 'pebbles']]\n\n// 使用了 `_.matches` 的回调结果\nresolve( _.partition(users, { 'age': 1, 'active': false }) );\n// => [['pebbles'], ['barney', 'fred']]\n\n// 使用了 `_.matchesProperty` 的回调结果\nresolve( _.partition(users, ['active', false]) );\n// => [['barney', 'pebbles'], ['fred']]\n\n// 使用了 `_.property` 的回调结果\nresolve( _.partition(users, 'active') );\n// => [['fred'], ['barney', 'pebbles']]\n
    \n
    \n
    \n\n
    " } + "html":"

    partition source npm

    \n
    _.partition(collection, [predicate=_.identity])
    \n\n

    Creates an array of elements split into two groups, the first of which\ncontains elements predicate returns truthy for, while the second of which\ncontains elements predicate returns falsey for. The predicate is invoked\nwith three arguments: (value, index|key, collection).

    \n
    \n\n

    参数

    \n
      \n
    1. collection (Array|Object)

      需要遍历的集合

      \n
    2. \n
    3. [predicate=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

      \n
    4. \n
    \n

    返回值 (Array)

    \n

    Returns the array of grouped elements.

    \n
    \n

    示例

    \n
    var resolve = function(result) {\n  return _.map(result, function(array) { return _.map(array, 'user'); });\n};\n\nvar users = [\n  { 'user': 'barney',  'age': 36, 'active': false },\n  { 'user': 'fred',    'age': 40, 'active': true },\n  { 'user': 'pebbles', 'age': 1,  'active': false }\n];\n\nresolve( _.partition(users, function(o) { return o.active; }) );\n// => [['fred'], ['barney', 'pebbles']]\n\n// 使用了 `_.matches` 的回调结果\nresolve( _.partition(users, { 'age': 1, 'active': false }) );\n// => [['pebbles'], ['barney', 'fred']]\n\n// 使用了 `_.matchesProperty` 的回调结果\nresolve( _.partition(users, ['active', false]) );\n// => [['barney', 'pebbles'], ['fred']]\n\n// 使用了 `_.property` 的回调结果\nresolve( _.partition(users, 'active') );\n// => [['fred'], ['barney', 'pebbles']]\n
    \n
    \n
    \n\n
    " } ,{ "href":"/reduce", - "html":"

    reduce source npm

    \n
    _.reduce(collection, [iteratee=_.identity], [accumulator])
    \n\n

    Reduces collection to a value which is the accumulated result of running\neach element in collection through iteratee, where each successive\ninvocation is supplied the return value of the previous. If accumulator\nis not provided the first element of collection is used as the initial\nvalue. The iteratee is invoked with four arguments:
    \n(accumulator, value, index|key, collection).\n
    \n
    \nMany lodash methods are guarded to work as iteratees for methods like\n_.reduce, _.reduceRight, and _.transform.\n
    \n
    \nThe guarded methods are:
    \nassign, defaults, defaultsDeep, includes, merge, orderBy,\nand sortBy

    \n
    \n\n

    参数

    \n
      \n
    1. collection (Array|Object)

      The collection to iterate over.

      \n
    2. \n
    3. [iteratee=_.identity] (Function)

      The function invoked per iteration.

      \n
    4. \n
    5. [accumulator] (*)

      The initial value.

      \n
    6. \n
    \n

    返回值 (*)

    \n

    Returns the accumulated value.

    \n
    \n

    示例

    \n
    _.reduce([1, 2], function(sum, n) {\n  return sum + n;\n});\n// => 3\n\n_.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {\n  (result[value] || (result[value] = [])).push(key);\n  return result;\n}, {});\n// => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)\n
    \n
    \n
    \n\n
    " } + "html":"

    reduce source npm

    \n
    _.reduce(collection, [iteratee=_.identity], [accumulator])
    \n\n

    Reduces collection to a value which is the accumulated result of running\neach element in collection through iteratee, where each successive\ninvocation is supplied the return value of the previous. If accumulator\nis not provided the first element of collection is used as the initial\nvalue. The iteratee is invoked with four arguments:
    \n(accumulator, value, index|key, collection).\n
    \n
    \nMany lodash methods are guarded to work as iteratees for methods like\n_.reduce, _.reduceRight, and _.transform.\n
    \n
    \nThe guarded methods are:
    \nassign, defaults, defaultsDeep, includes, merge, orderBy,\nand sortBy

    \n
    \n\n

    参数

    \n
      \n
    1. collection (Array|Object)

      需要遍历的集合

      \n
    2. \n
    3. [iteratee=_.identity] (Function)

      这个函数会处理每一个元素

      \n
    4. \n
    5. [accumulator] (*)

      The initial value.

      \n
    6. \n
    \n

    返回值 (*)

    \n

    Returns the accumulated value.

    \n
    \n

    示例

    \n
    _.reduce([1, 2], function(sum, n) {\n  return sum + n;\n});\n// => 3\n\n_.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {\n  (result[value] || (result[value] = [])).push(key);\n  return result;\n}, {});\n// => { '1': ['a', 'c'], '2': ['b'] } (无法保证遍历的顺序)\n
    \n
    \n
    \n\n
    " } ,{ "href":"/reduceRight", - "html":"

    reduceRight source npm

    \n
    _.reduceRight(collection, [iteratee=_.identity], [accumulator])
    \n\n

    This method is like _.reduce except that it iterates over elements of\ncollection from right to left.

    \n
    \n\n

    参数

    \n
      \n
    1. collection (Array|Object)

      The collection to iterate over.

      \n
    2. \n
    3. [iteratee=_.identity] (Function)

      The function invoked per iteration.

      \n
    4. \n
    5. [accumulator] (*)

      The initial value.

      \n
    6. \n
    \n

    返回值 (*)

    \n

    Returns the accumulated value.

    \n
    \n

    示例

    \n
    var array = [[0, 1], [2, 3], [4, 5]];\n\n_.reduceRight(array, function(flattened, other) {\n  return flattened.concat(other);\n}, []);\n// => [4, 5, 2, 3, 0, 1]\n
    \n
    \n
    \n\n
    " } + "html":"

    reduceRight source npm

    \n
    _.reduceRight(collection, [iteratee=_.identity], [accumulator])
    \n\n

    This method is like _.reduce except that it iterates over elements of\ncollection from right to left.

    \n
    \n\n

    参数

    \n
      \n
    1. collection (Array|Object)

      需要遍历的集合

      \n
    2. \n
    3. [iteratee=_.identity] (Function)

      这个函数会处理每一个元素

      \n
    4. \n
    5. [accumulator] (*)

      The initial value.

      \n
    6. \n
    \n

    返回值 (*)

    \n

    Returns the accumulated value.

    \n
    \n

    示例

    \n
    var array = [[0, 1], [2, 3], [4, 5]];\n\n_.reduceRight(array, function(flattened, other) {\n  return flattened.concat(other);\n}, []);\n// => [4, 5, 2, 3, 0, 1]\n
    \n
    \n
    \n\n
    " } ,{ "href":"/reject", - "html":"

    reject source npm

    \n
    _.reject(collection, [predicate=_.identity])
    \n\n

    The opposite of _.filter; this method returns the elements of collection\nthat predicate does not return truthy for.

    \n
    \n\n

    参数

    \n
      \n
    1. collection (Array|Object)

      The collection to iterate over.

      \n
    2. \n
    3. [predicate=_.identity] (Function|Object|string)

      The function invoked per iteration.

      \n
    4. \n
    \n

    返回值 (Array)

    \n

    Returns the new filtered array.

    \n
    \n

    示例

    \n
    var resolve = _.partial(_.map, _, 'user');\n\nvar users = [\n  { 'user': 'barney', 'age': 36, 'active': false },\n  { 'user': 'fred',   'age': 40, 'active': true }\n];\n\nresolve( _.reject(users, function(o) { return !o.active; }) );\n// => ['fred']\n\n// 使用了 `_.matches` 的回调结果\nresolve( _.reject(users, { 'age': 40, 'active': true }) );\n// => ['barney']\n\n// 使用了 `_.matchesProperty` 的回调结果\nresolve( _.reject(users, ['active', false]) );\n// => ['fred']\n\n// 使用了 `_.property` 的回调结果\nresolve( _.reject(users, 'active') );\n// => ['barney']\n
    \n
    \n
    \n\n
    " } + "html":"

    reject source npm

    \n
    _.reject(collection, [predicate=_.identity])
    \n\n

    The opposite of _.filter; this method returns the elements of collection\nthat predicate does not return truthy for.

    \n
    \n\n

    参数

    \n
      \n
    1. collection (Array|Object)

      需要遍历的集合

      \n
    2. \n
    3. [predicate=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

      \n
    4. \n
    \n

    返回值 (Array)

    \n

    Returns the new filtered array.

    \n
    \n

    示例

    \n
    var resolve = _.partial(_.map, _, 'user');\n\nvar users = [\n  { 'user': 'barney', 'age': 36, 'active': false },\n  { 'user': 'fred',   'age': 40, 'active': true }\n];\n\nresolve( _.reject(users, function(o) { return !o.active; }) );\n// => ['fred']\n\n// 使用了 `_.matches` 的回调结果\nresolve( _.reject(users, { 'age': 40, 'active': true }) );\n// => ['barney']\n\n// 使用了 `_.matchesProperty` 的回调结果\nresolve( _.reject(users, ['active', false]) );\n// => ['fred']\n\n// 使用了 `_.property` 的回调结果\nresolve( _.reject(users, 'active') );\n// => ['barney']\n
    \n
    \n
    \n\n
    " } ,{ "href":"/sample", - "html":"

    sample source npm

    \n
    _.sample(collection)
    \n\n

    Gets a random element from collection.

    \n
    \n\n

    参数

    \n
      \n
    1. collection (Array|Object)

      The collection to sample.

      \n
    2. \n
    \n

    返回值 (*)

    \n

    Returns the random element.

    \n
    \n

    示例

    \n
    _.sample([1, 2, 3, 4]);\n// => 2\n
    \n
    \n
    \n\n
    " } + "html":"

    sample source npm

    \n
    _.sample(collection)
    \n\n

    Gets a random element from collection.

    \n
    \n\n

    参数

    \n
      \n
    1. collection (Array|Object)

      The collection to sample.

      \n
    2. \n
    \n

    返回值 (*)

    \n

    Returns the random element.

    \n
    \n

    示例

    \n
    _.sample([1, 2, 3, 4]);\n// => 2\n
    \n
    \n
    \n\n
    " } ,{ "href":"/sampleSize", - "html":"

    sampleSize source npm

    \n
    _.sampleSize(collection, [n=0])
    \n\n

    Gets n random elements from collection.

    \n
    \n\n

    参数

    \n
      \n
    1. collection (Array|Object)

      The collection to sample.

      \n
    2. \n
    3. [n=0] (number)

      The number of elements to sample.

      \n
    4. \n
    \n

    返回值 (Array)

    \n

    Returns the random elements.

    \n
    \n

    示例

    \n
    _.sampleSize([1, 2, 3, 4], 2);\n// => [3, 1]\n
    \n
    \n
    \n\n
    " } + "html":"

    sampleSize source npm

    \n
    _.sampleSize(collection, [n=0])
    \n\n

    Gets n random elements from collection.

    \n
    \n\n

    参数

    \n
      \n
    1. collection (Array|Object)

      The collection to sample.

      \n
    2. \n
    3. [n=0] (number)

      The number of elements to sample.

      \n
    4. \n
    \n

    返回值 (Array)

    \n

    Returns the random elements.

    \n
    \n

    示例

    \n
    _.sampleSize([1, 2, 3, 4], 2);\n// => [3, 1]\n
    \n
    \n
    \n\n
    " } ,{ "href":"/shuffle", - "html":"

    shuffle source npm

    \n
    _.shuffle(collection)
    \n\n

    Creates an array of shuffled values, using a version of the\nFisher-Yates shuffle.

    \n
    \n\n

    参数

    \n
      \n
    1. collection (Array|Object)

      The collection to shuffle.

      \n
    2. \n
    \n

    返回值 (Array)

    \n

    Returns the new shuffled array.

    \n
    \n

    示例

    \n
    _.shuffle([1, 2, 3, 4]);\n// => [4, 1, 3, 2]\n
    \n
    \n
    \n\n
    " } + "html":"

    shuffle source npm

    \n
    _.shuffle(collection)
    \n\n

    Creates an array of shuffled values, using a version of the\nFisher-Yates shuffle.

    \n
    \n\n

    参数

    \n
      \n
    1. collection (Array|Object)

      The collection to shuffle.

      \n
    2. \n
    \n

    返回值 (Array)

    \n

    Returns the new shuffled array.

    \n
    \n

    示例

    \n
    _.shuffle([1, 2, 3, 4]);\n// => [4, 1, 3, 2]\n
    \n
    \n
    \n\n
    " } ,{ "href":"/size", - "html":"

    size source npm

    \n
    _.size(collection)
    \n\n

    Gets the size of collection by returning its length for array-like\nvalues or the number of own enumerable properties for objects.

    \n
    \n\n

    参数

    \n
      \n
    1. collection (Array|Object)

      The collection to inspect.

      \n
    2. \n
    \n

    返回值 (number)

    \n

    Returns the collection size.

    \n
    \n

    示例

    \n
    _.size([1, 2, 3]);\n// => 3\n\n_.size({ 'a': 1, 'b': 2 });\n// => 2\n\n_.size('pebbles');\n// => 7\n
    \n
    \n
    \n\n
    " } + "html":"

    size source npm

    \n
    _.size(collection)
    \n\n

    Gets the size of collection by returning its length for array-like\nvalues or the number of own enumerable properties for objects.

    \n
    \n\n

    参数

    \n
      \n
    1. collection (Array|Object)

      The collection to inspect.

      \n
    2. \n
    \n

    返回值 (number)

    \n

    Returns the collection size.

    \n
    \n

    示例

    \n
    _.size([1, 2, 3]);\n// => 3\n\n_.size({ 'a': 1, 'b': 2 });\n// => 2\n\n_.size('pebbles');\n// => 7\n
    \n
    \n
    \n\n
    " } ,{ "href":"/some", - "html":"

    some source npm

    \n
    _.some(collection, [predicate=_.identity])
    \n\n

    Checks if predicate returns truthy for any element of collection.\nIteration is stopped once predicate returns truthy. The predicate is\ninvoked with three arguments: (value, index|key, collection).

    \n
    \n\n

    参数

    \n
      \n
    1. collection (Array|Object)

      The collection to iterate over.

      \n
    2. \n
    3. [predicate=_.identity] (Function|Object|string)

      The function invoked per iteration.

      \n
    4. \n
    \n

    返回值 (boolean)

    \n

    Returns true if any element passes the predicate check, else false.

    \n
    \n

    示例

    \n
    _.some([null, 0, 'yes', false], Boolean);\n// => true\n\nvar users = [\n  { 'user': 'barney', 'active': true },\n  { 'user': 'fred',   'active': false }\n];\n\n// 使用了 `_.matches` 的回调结果\n_.some(users, { 'user': 'barney', 'active': false });\n// => false\n\n// 使用了 `_.matchesProperty` 的回调结果\n_.some(users, ['active', false]);\n// => true\n\n// 使用了 `_.property` 的回调结果\n_.some(users, 'active');\n// => true\n
    \n
    \n
    \n\n
    " } + "html":"

    some source npm

    \n
    _.some(collection, [predicate=_.identity])
    \n\n

    Checks if predicate returns truthy for any element of collection.\nIteration is stopped once predicate returns truthy. The predicate is\ninvoked with three arguments: (value, index|key, collection).

    \n
    \n\n

    参数

    \n
      \n
    1. collection (Array|Object)

      需要遍历的集合

      \n
    2. \n
    3. [predicate=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

      \n
    4. \n
    \n

    返回值 (boolean)

    \n

    Returns true if any element passes the predicate check, else false.

    \n
    \n

    示例

    \n
    _.some([null, 0, 'yes', false], Boolean);\n// => true\n\nvar users = [\n  { 'user': 'barney', 'active': true },\n  { 'user': 'fred',   'active': false }\n];\n\n// 使用了 `_.matches` 的回调结果\n_.some(users, { 'user': 'barney', 'active': false });\n// => false\n\n// 使用了 `_.matchesProperty` 的回调结果\n_.some(users, ['active', false]);\n// => true\n\n// 使用了 `_.property` 的回调结果\n_.some(users, 'active');\n// => true\n
    \n
    \n
    \n\n
    " } ,{ "href":"/sortBy", - "html":"

    sortBy source npm

    \n
    _.sortBy(collection, [iteratees=[_.identity]])
    \n\n

    Creates an array of elements, sorted in ascending order by the results of\nrunning each element in a collection through each iteratee. This method\nperforms a stable sort, that is, it preserves the original sort order of\nequal elements. The iteratees are invoked with one argument: (value).

    \n
    \n\n

    参数

    \n
      \n
    1. collection (Array|Object)

      The collection to iterate over.

      \n
    2. \n
    3. [iteratees=[_.identity]] (...(Function|Function[]|Object|Object[]|string|string[])

      The iteratees to sort by, specified individually or in arrays.

      \n
    4. \n
    \n

    返回值 (Array)

    \n

    Returns the new sorted array.

    \n
    \n

    示例

    \n
    var resolve = _.partial(_.map, _, _.values);\n\nvar users = [\n  { 'user': 'fred',   'age': 48 },\n  { 'user': 'barney', 'age': 36 },\n  { 'user': 'fred',   'age': 42 },\n  { 'user': 'barney', 'age': 34 }\n];\n\nresolve( _.sortBy(users, function(o) { return o.user; }) );\n// => // => [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]]\n\nresolve( _.sortBy(users, ['user', 'age']) );\n// => [['barney', 34], ['barney', 36], ['fred', 42], ['fred', 48]]\n\nresolve( _.sortBy(users, 'user', function(o) {\n  return Math.floor(o.age / 10);\n}) );\n// => [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]]\n
    \n
    \n
    \n\n
    " } + "html":"

    sortBy source npm

    \n
    _.sortBy(collection, [iteratees=[_.identity]])
    \n\n

    Creates an array of elements, sorted in ascending order by the results of\nrunning each element in a collection through each iteratee. This method\nperforms a stable sort, that is, it preserves the original sort order of\nequal elements. The iteratees are invoked with one argument: (value).

    \n
    \n\n

    参数

    \n
      \n
    1. collection (Array|Object)

      需要遍历的集合

      \n
    2. \n
    3. [iteratees=[_.identity]] (...(Function|Function[]|Object|Object[]|string|string[])

      The iteratees to sort by, specified individually or in arrays.

      \n
    4. \n
    \n

    返回值 (Array)

    \n

    Returns the new sorted array.

    \n
    \n

    示例

    \n
    var resolve = _.partial(_.map, _, _.values);\n\nvar users = [\n  { 'user': 'fred',   'age': 48 },\n  { 'user': 'barney', 'age': 36 },\n  { 'user': 'fred',   'age': 42 },\n  { 'user': 'barney', 'age': 34 }\n];\n\nresolve( _.sortBy(users, function(o) { return o.user; }) );\n// => // => [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]]\n\nresolve( _.sortBy(users, ['user', 'age']) );\n// => [['barney', 34], ['barney', 36], ['fred', 42], ['fred', 48]]\n\nresolve( _.sortBy(users, 'user', function(o) {\n  return Math.floor(o.age / 10);\n}) );\n// => [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]]\n
    \n
    \n
    \n\n
    " } ,{ "href":"/now", - "html":"

    now source npm

    \n
    _.now()
    \n\n

    Gets the timestamp of the number of milliseconds that have elapsed since\nthe Unix epoch (1 January 1970 00:00:00 UTC).

    \n
    \n\n

    返回值 (number)

    \n

    Returns the timestamp.

    \n
    \n

    示例

    \n
    _.defer(function(stamp) {\n  console.log(_.now() - stamp);\n}, _.now());\n// => logs the number of milliseconds it took for the deferred function to be invoked\n
    \n
    \n
    \n\n
    " } + "html":"

    now source npm

    \n
    _.now()
    \n\n

    Gets the timestamp of the number of milliseconds that have elapsed since\nthe Unix epoch (1 January 1970 00:00:00 UTC).

    \n
    \n\n

    返回值 (number)

    \n

    Returns the timestamp.

    \n
    \n

    示例

    \n
    _.defer(function(stamp) {\n  console.log(_.now() - stamp);\n}, _.now());\n// => logs the number of milliseconds it took for the deferred function to be invoked\n
    \n
    \n
    \n\n
    " } ,{ "href":"/after", - "html":"

    after source npm

    \n
    _.after(n, func)
    \n\n

    The opposite of _.before; this method creates a function that invokes\nfunc once it's called n or more times.

    \n
    \n\n

    参数

    \n
      \n
    1. n (number)

      The number of calls before func is invoked.

      \n
    2. \n
    3. func (Function)

      The function to restrict.

      \n
    4. \n
    \n

    返回值 (Function)

    \n

    Returns the new restricted function.

    \n
    \n

    示例

    \n
    var saves = ['profile', 'settings'];\n\nvar done = _.after(saves.length, function() {\n  console.log('done saving!');\n});\n\n_.forEach(saves, function(type) {\n  asyncSave({ 'type': type, 'complete': done });\n});\n// => logs 'done saving!' after the two async saves have completed\n
    \n
    \n
    \n\n
    " } + "html":"

    after source npm

    \n
    _.after(n, func)
    \n\n

    The opposite of _.before; this method creates a function that invokes\nfunc once it's called n or more times.

    \n
    \n\n

    参数

    \n
      \n
    1. n (number)

      The number of calls before func is invoked.

      \n
    2. \n
    3. func (Function)

      The function to restrict.

      \n
    4. \n
    \n

    返回值 (Function)

    \n

    Returns the new restricted function.

    \n
    \n

    示例

    \n
    var saves = ['profile', 'settings'];\n\nvar done = _.after(saves.length, function() {\n  console.log('done saving!');\n});\n\n_.forEach(saves, function(type) {\n  asyncSave({ 'type': type, 'complete': done });\n});\n// => logs 'done saving!' after the two async saves have completed\n
    \n
    \n
    \n\n
    " } ,{ "href":"/ary", - "html":"

    ary source npm

    \n
    _.ary(func, [n=func.length])
    \n\n

    Creates a function that accepts up to n arguments, ignoring any\nadditional arguments.

    \n
    \n\n

    参数

    \n
      \n
    1. func (Function)

      The function to cap arguments for.

      \n
    2. \n
    3. [n=func.length] (number)

      The arity cap.

      \n
    4. \n
    \n

    返回值 (Function)

    \n

    Returns the new function.

    \n
    \n

    示例

    \n
    _.map(['6', '8', '10'], _.ary(parseInt, 1));\n// => [6, 8, 10]\n
    \n
    \n
    \n\n
    " } + "html":"

    ary source npm

    \n
    _.ary(func, [n=func.length])
    \n\n

    Creates a function that accepts up to n arguments, ignoring any\nadditional arguments.

    \n
    \n\n

    参数

    \n
      \n
    1. func (Function)

      The function to cap arguments for.

      \n
    2. \n
    3. [n=func.length] (number)

      The arity cap.

      \n
    4. \n
    \n

    返回值 (Function)

    \n

    Returns the new function.

    \n
    \n

    示例

    \n
    _.map(['6', '8', '10'], _.ary(parseInt, 1));\n// => [6, 8, 10]\n
    \n
    \n
    \n\n
    " } ,{ "href":"/before", - "html":"

    before source npm

    \n
    _.before(n, func)
    \n\n

    Creates a function that invokes func, with the this binding and arguments\nof the created function, while it's called less than n times. Subsequent\ncalls to the created function return the result of the last func invocation.

    \n
    \n\n

    参数

    \n
      \n
    1. n (number)

      The number of calls at which func is no longer invoked.

      \n
    2. \n
    3. func (Function)

      The function to restrict.

      \n
    4. \n
    \n

    返回值 (Function)

    \n

    Returns the new restricted function.

    \n
    \n

    示例

    \n
    jQuery(element).on('click', _.before(5, addContactToList));\n// => allows adding up to 4 contacts to the list\n
    \n
    \n
    \n\n
    " } + "html":"

    before source npm

    \n
    _.before(n, func)
    \n\n

    Creates a function that invokes func, with the this binding and arguments\nof the created function, while it's called less than n times. Subsequent\ncalls to the created function return the result of the last func invocation.

    \n
    \n\n

    参数

    \n
      \n
    1. n (number)

      The number of calls at which func is no longer invoked.

      \n
    2. \n
    3. func (Function)

      The function to restrict.

      \n
    4. \n
    \n

    返回值 (Function)

    \n

    Returns the new restricted function.

    \n
    \n

    示例

    \n
    jQuery(element).on('click', _.before(5, addContactToList));\n// => allows adding up to 4 contacts to the list\n
    \n
    \n
    \n\n
    " } ,{ "href":"/bind", - "html":"

    bind source npm

    \n
    _.bind(func, thisArg, [partials])
    \n\n

    Creates a function that invokes func with the this binding of thisArg\nand prepends any additional _.bind arguments to those provided to the\nbound function.\n
    \n
    \nThe _.bind.placeholder value, which defaults to _ in monolithic builds,\nmay be used as a placeholder for partially applied arguments.\n
    \n
    \n注意: Unlike native Function#bind this method doesn't set the "length"\nproperty of bound functions.

    \n
    \n\n

    参数

    \n
      \n
    1. func (Function)

      The function to bind.

      \n
    2. \n
    3. thisArg (*)

      The this binding of func.

      \n
    4. \n
    5. [partials] (...*)

      The arguments to be partially applied.

      \n
    6. \n
    \n

    返回值 (Function)

    \n

    Returns the new bound function.

    \n
    \n

    示例

    \n
    var greet = function(greeting, punctuation) {\n  return greeting + ' ' + this.user + punctuation;\n};\n\nvar object = { 'user': 'fred' };\n\nvar bound = _.bind(greet, object, 'hi');\nbound('!');\n// => 'hi fred!'\n\n// using placeholders\nvar bound = _.bind(greet, object, _, '!');\nbound('hi');\n// => 'hi fred!'\n
    \n
    \n
    \n\n
    " } + "html":"

    bind source npm

    \n
    _.bind(func, thisArg, [partials])
    \n\n

    Creates a function that invokes func with the this binding of thisArg\nand prepends any additional _.bind arguments to those provided to the\nbound function.\n
    \n
    \nThe _.bind.placeholder value, which defaults to _ in monolithic builds,\nmay be used as a placeholder for partially applied arguments.\n
    \n
    \n注意: Unlike native Function#bind this method doesn't set the "length"\nproperty of bound functions.

    \n
    \n\n

    参数

    \n
      \n
    1. func (Function)

      The function to bind.

      \n
    2. \n
    3. thisArg (*)

      The this binding of func.

      \n
    4. \n
    5. [partials] (...*)

      The arguments to be partially applied.

      \n
    6. \n
    \n

    返回值 (Function)

    \n

    Returns the new bound function.

    \n
    \n

    示例

    \n
    var greet = function(greeting, punctuation) {\n  return greeting + ' ' + this.user + punctuation;\n};\n\nvar object = { 'user': 'fred' };\n\nvar bound = _.bind(greet, object, 'hi');\nbound('!');\n// => 'hi fred!'\n\n// using placeholders\nvar bound = _.bind(greet, object, _, '!');\nbound('hi');\n// => 'hi fred!'\n
    \n
    \n
    \n\n
    " } ,{ "href":"/bindKey", - "html":"

    bindKey source npm

    \n
    _.bindKey(object, key, [partials])
    \n\n

    Creates a function that invokes the method at object[key] and prepends\nany additional _.bindKey arguments to those provided to the bound function.\n
    \n
    \nThis method differs from _.bind by allowing bound functions to reference\nmethods that may be redefined or don't yet exist.\nSee Peter Michaux's article\nfor more details.\n
    \n
    \nThe _.bindKey.placeholder value, which defaults to _ in monolithic\nbuilds, may be used as a placeholder for partially applied arguments.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to invoke the method on.

      \n
    2. \n
    3. key (string)

      The key of the method.

      \n
    4. \n
    5. [partials] (...*)

      The arguments to be partially applied.

      \n
    6. \n
    \n

    返回值 (Function)

    \n

    Returns the new bound function.

    \n
    \n

    示例

    \n
    var object = {\n  'user': 'fred',\n  'greet': function(greeting, punctuation) {\n    return greeting + ' ' + this.user + punctuation;\n  }\n};\n\nvar bound = _.bindKey(object, 'greet', 'hi');\nbound('!');\n// => 'hi fred!'\n\nobject.greet = function(greeting, punctuation) {\n  return greeting + 'ya ' + this.user + punctuation;\n};\n\nbound('!');\n// => 'hiya fred!'\n\n// using placeholders\nvar bound = _.bindKey(object, 'greet', _, '!');\nbound('hi');\n// => 'hiya fred!'\n
    \n
    \n
    \n\n
    " } + "html":"

    bindKey source npm

    \n
    _.bindKey(object, key, [partials])
    \n\n

    Creates a function that invokes the method at object[key] and prepends\nany additional _.bindKey arguments to those provided to the bound function.\n
    \n
    \nThis method differs from _.bind by allowing bound functions to reference\nmethods that may be redefined or don't yet exist.\nSee Peter Michaux's article\nfor more details.\n
    \n
    \nThe _.bindKey.placeholder value, which defaults to _ in monolithic\nbuilds, may be used as a placeholder for partially applied arguments.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to invoke the method on.

      \n
    2. \n
    3. key (string)

      The key of the method.

      \n
    4. \n
    5. [partials] (...*)

      The arguments to be partially applied.

      \n
    6. \n
    \n

    返回值 (Function)

    \n

    Returns the new bound function.

    \n
    \n

    示例

    \n
    var object = {\n  'user': 'fred',\n  'greet': function(greeting, punctuation) {\n    return greeting + ' ' + this.user + punctuation;\n  }\n};\n\nvar bound = _.bindKey(object, 'greet', 'hi');\nbound('!');\n// => 'hi fred!'\n\nobject.greet = function(greeting, punctuation) {\n  return greeting + 'ya ' + this.user + punctuation;\n};\n\nbound('!');\n// => 'hiya fred!'\n\n// using placeholders\nvar bound = _.bindKey(object, 'greet', _, '!');\nbound('hi');\n// => 'hiya fred!'\n
    \n
    \n
    \n\n
    " } ,{ "href":"/curry", - "html":"

    curry source npm

    \n
    _.curry(func, [arity=func.length])
    \n\n

    Creates a function that accepts arguments of func and either invokes\nfunc returning its result, if at least arity number of arguments have\nbeen provided, or returns a function that accepts the remaining func\narguments, and so on. The arity of func may be specified if func.length\nis not sufficient.\n
    \n
    \nThe _.curry.placeholder value, which defaults to _ in monolithic builds,\nmay be used as a placeholder for provided arguments.\n
    \n
    \n注意: This method doesn't set the "length" property of curried functions.

    \n
    \n\n

    参数

    \n
      \n
    1. func (Function)

      The function to curry.

      \n
    2. \n
    3. [arity=func.length] (number)

      The arity of func.

      \n
    4. \n
    \n

    返回值 (Function)

    \n

    Returns the new curried function.

    \n
    \n

    示例

    \n
    var abc = function(a, b, c) {\n  return [a, b, c];\n};\n\nvar curried = _.curry(abc);\n\ncurried(1)(2)(3);\n// => [1, 2, 3]\n\ncurried(1, 2)(3);\n// => [1, 2, 3]\n\ncurried(1, 2, 3);\n// => [1, 2, 3]\n\n// using placeholders\ncurried(1)(_, 3)(2);\n// => [1, 2, 3]\n
    \n
    \n
    \n\n
    " } + "html":"

    curry source npm

    \n
    _.curry(func, [arity=func.length])
    \n\n

    Creates a function that accepts arguments of func and either invokes\nfunc returning its result, if at least arity number of arguments have\nbeen provided, or returns a function that accepts the remaining func\narguments, and so on. The arity of func may be specified if func.length\nis not sufficient.\n
    \n
    \nThe _.curry.placeholder value, which defaults to _ in monolithic builds,\nmay be used as a placeholder for provided arguments.\n
    \n
    \n注意: This method doesn't set the "length" property of curried functions.

    \n
    \n\n

    参数

    \n
      \n
    1. func (Function)

      The function to curry.

      \n
    2. \n
    3. [arity=func.length] (number)

      The arity of func.

      \n
    4. \n
    \n

    返回值 (Function)

    \n

    Returns the new curried function.

    \n
    \n

    示例

    \n
    var abc = function(a, b, c) {\n  return [a, b, c];\n};\n\nvar curried = _.curry(abc);\n\ncurried(1)(2)(3);\n// => [1, 2, 3]\n\ncurried(1, 2)(3);\n// => [1, 2, 3]\n\ncurried(1, 2, 3);\n// => [1, 2, 3]\n\n// using placeholders\ncurried(1)(_, 3)(2);\n// => [1, 2, 3]\n
    \n
    \n
    \n\n
    " } ,{ "href":"/curryRight", - "html":"

    curryRight source npm

    \n
    _.curryRight(func, [arity=func.length])
    \n\n

    This method is like _.curry except that arguments are applied to func\nin the manner of _.partialRight instead of _.partial.\n
    \n
    \nThe _.curryRight.placeholder value, which defaults to _ in monolithic\nbuilds, may be used as a placeholder for provided arguments.\n
    \n
    \n注意: This method doesn't set the "length" property of curried functions.

    \n
    \n\n

    参数

    \n
      \n
    1. func (Function)

      The function to curry.

      \n
    2. \n
    3. [arity=func.length] (number)

      The arity of func.

      \n
    4. \n
    \n

    返回值 (Function)

    \n

    Returns the new curried function.

    \n
    \n

    示例

    \n
    var abc = function(a, b, c) {\n  return [a, b, c];\n};\n\nvar curried = _.curryRight(abc);\n\ncurried(3)(2)(1);\n// => [1, 2, 3]\n\ncurried(2, 3)(1);\n// => [1, 2, 3]\n\ncurried(1, 2, 3);\n// => [1, 2, 3]\n\n// using placeholders\ncurried(3)(1, _)(2);\n// => [1, 2, 3]\n
    \n
    \n
    \n\n
    " } + "html":"

    curryRight source npm

    \n
    _.curryRight(func, [arity=func.length])
    \n\n

    This method is like _.curry except that arguments are applied to func\nin the manner of _.partialRight instead of _.partial.\n
    \n
    \nThe _.curryRight.placeholder value, which defaults to _ in monolithic\nbuilds, may be used as a placeholder for provided arguments.\n
    \n
    \n注意: This method doesn't set the "length" property of curried functions.

    \n
    \n\n

    参数

    \n
      \n
    1. func (Function)

      The function to curry.

      \n
    2. \n
    3. [arity=func.length] (number)

      The arity of func.

      \n
    4. \n
    \n

    返回值 (Function)

    \n

    Returns the new curried function.

    \n
    \n

    示例

    \n
    var abc = function(a, b, c) {\n  return [a, b, c];\n};\n\nvar curried = _.curryRight(abc);\n\ncurried(3)(2)(1);\n// => [1, 2, 3]\n\ncurried(2, 3)(1);\n// => [1, 2, 3]\n\ncurried(1, 2, 3);\n// => [1, 2, 3]\n\n// using placeholders\ncurried(3)(1, _)(2);\n// => [1, 2, 3]\n
    \n
    \n
    \n\n
    " } ,{ "href":"/debounce", - "html":"

    debounce source npm

    \n
    _.debounce(func, [wait=0], [options])
    \n\n

    Creates a debounced function that delays invoking func until after wait\nmilliseconds have elapsed since the last time the debounced function was\ninvoked. The debounced function comes with a cancel method to cancel\ndelayed func invocations and a flush method to immediately invoke them.\nProvide an options object to indicate whether func should be invoked on\nthe leading and/or trailing edge of the wait timeout. The func is invoked\nwith the last arguments provided to the debounced function. Subsequent calls\nto the debounced function return the result of the last func invocation.\n
    \n
    \n注意: If leading and trailing options are true, func is invoked\non the trailing edge of the timeout only if the the debounced function is\ninvoked more than once during the wait timeout.\n
    \n
    \nSee David Corbacho's article\nfor details over the differences between _.debounce and _.throttle.

    \n
    \n\n

    参数

    \n
      \n
    1. func (Function)

      The function to debounce.

      \n
    2. \n
    3. [wait=0] (number)

      The number of milliseconds to delay.

      \n
    4. \n
    5. [options] (Object)

      The options object.

      \n
    6. \n
    7. [options.leading=false] (boolean)

      Specify invoking on the leading edge of the timeout.

      \n
    8. \n
    9. [options.maxWait] (number)

      The maximum time func is allowed to be delayed before it's invoked.

      \n
    10. \n
    11. [options.trailing=true] (boolean)

      Specify invoking on the trailing edge of the timeout.

      \n
    12. \n
    \n

    返回值 (Function)

    \n

    Returns the new debounced function.

    \n
    \n

    示例

    \n
    // avoid costly calculations while the window size is in flux\njQuery(window).on('resize', _.debounce(calculateLayout, 150));\n\n// invoke `sendMail` when clicked, debouncing subsequent calls\njQuery(element).on('click', _.debounce(sendMail, 300, {\n  'leading': true,\n  'trailing': false\n}));\n\n// ensure `batchLog` is invoked once after 1 second of debounced calls\nvar debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\nvar source = new EventSource('/stream');\njQuery(source).on('message', debounced);\n\n// cancel a trailing debounced invocation\njQuery(window).on('popstate', debounced.cancel);\n
    \n
    \n
    \n\n
    " } + "html":"

    debounce source npm

    \n
    _.debounce(func, [wait=0], [options])
    \n\n

    Creates a debounced function that delays invoking func until after wait\nmilliseconds have elapsed since the last time the debounced function was\ninvoked. The debounced function comes with a cancel method to cancel\ndelayed func invocations and a flush method to immediately invoke them.\nProvide an options object to indicate whether func should be invoked on\nthe leading and/or trailing edge of the wait timeout. The func is invoked\nwith the last arguments provided to the debounced function. Subsequent calls\nto the debounced function return the result of the last func invocation.\n
    \n
    \n注意: If leading and trailing options are true, func is invoked\non the trailing edge of the timeout only if the the debounced function is\ninvoked more than once during the wait timeout.\n
    \n
    \nSee David Corbacho's article\nfor details over the differences between _.debounce and _.throttle.

    \n
    \n\n

    参数

    \n
      \n
    1. func (Function)

      The function to debounce.

      \n
    2. \n
    3. [wait=0] (number)

      The number of milliseconds to delay.

      \n
    4. \n
    5. [options] (Object)

      The options object.

      \n
    6. \n
    7. [options.leading=false] (boolean)

      Specify invoking on the leading edge of the timeout.

      \n
    8. \n
    9. [options.maxWait] (number)

      The maximum time func is allowed to be delayed before it's invoked.

      \n
    10. \n
    11. [options.trailing=true] (boolean)

      Specify invoking on the trailing edge of the timeout.

      \n
    12. \n
    \n

    返回值 (Function)

    \n

    Returns the new debounced function.

    \n
    \n

    示例

    \n
    // avoid costly calculations while the window size is in flux\njQuery(window).on('resize', _.debounce(calculateLayout, 150));\n\n// invoke `sendMail` when clicked, debouncing subsequent calls\njQuery(element).on('click', _.debounce(sendMail, 300, {\n  'leading': true,\n  'trailing': false\n}));\n\n// ensure `batchLog` is invoked once after 1 second of debounced calls\nvar debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\nvar source = new EventSource('/stream');\njQuery(source).on('message', debounced);\n\n// cancel a trailing debounced invocation\njQuery(window).on('popstate', debounced.cancel);\n
    \n
    \n
    \n\n
    " } ,{ "href":"/defer", - "html":"

    defer source npm

    \n
    _.defer(func, [args])
    \n\n

    Defers invoking the func until the current call stack has cleared. Any\nadditional arguments are provided to func when it's invoked.

    \n
    \n\n

    参数

    \n
      \n
    1. func (Function)

      The function to defer.

      \n
    2. \n
    3. [args] (...*)

      The arguments to invoke func with.

      \n
    4. \n
    \n

    返回值 (number)

    \n

    Returns the timer id.

    \n
    \n

    示例

    \n
    _.defer(function(text) {\n  console.log(text);\n}, 'deferred');\n// logs 'deferred' after one or more milliseconds\n
    \n
    \n
    \n\n
    " } + "html":"

    defer source npm

    \n
    _.defer(func, [args])
    \n\n

    Defers invoking the func until the current call stack has cleared. Any\nadditional arguments are provided to func when it's invoked.

    \n
    \n\n

    参数

    \n
      \n
    1. func (Function)

      The function to defer.

      \n
    2. \n
    3. [args] (...*)

      The arguments to invoke func with.

      \n
    4. \n
    \n

    返回值 (number)

    \n

    Returns the timer id.

    \n
    \n

    示例

    \n
    _.defer(function(text) {\n  console.log(text);\n}, 'deferred');\n// logs 'deferred' after one or more milliseconds\n
    \n
    \n
    \n\n
    " } ,{ "href":"/delay", - "html":"

    delay source npm

    \n
    _.delay(func, wait, [args])
    \n\n

    Invokes func after wait milliseconds. Any additional arguments are\nprovided to func when it's invoked.

    \n
    \n\n

    参数

    \n
      \n
    1. func (Function)

      The function to delay.

      \n
    2. \n
    3. wait (number)

      The number of milliseconds to delay invocation.

      \n
    4. \n
    5. [args] (...*)

      The arguments to invoke func with.

      \n
    6. \n
    \n

    返回值 (number)

    \n

    Returns the timer id.

    \n
    \n

    示例

    \n
    _.delay(function(text) {\n  console.log(text);\n}, 1000, 'later');\n// => logs 'later' after one second\n
    \n
    \n
    \n\n
    " } + "html":"

    delay source npm

    \n
    _.delay(func, wait, [args])
    \n\n

    Invokes func after wait milliseconds. Any additional arguments are\nprovided to func when it's invoked.

    \n
    \n\n

    参数

    \n
      \n
    1. func (Function)

      The function to delay.

      \n
    2. \n
    3. wait (number)

      The number of milliseconds to delay invocation.

      \n
    4. \n
    5. [args] (...*)

      The arguments to invoke func with.

      \n
    6. \n
    \n

    返回值 (number)

    \n

    Returns the timer id.

    \n
    \n

    示例

    \n
    _.delay(function(text) {\n  console.log(text);\n}, 1000, 'later');\n// => logs 'later' after one second\n
    \n
    \n
    \n\n
    " } ,{ "href":"/flip", - "html":"

    flip source npm

    \n
    _.flip(func)
    \n\n

    Creates a function that invokes func with arguments reversed.

    \n
    \n\n

    参数

    \n
      \n
    1. func (Function)

      The function to flip arguments for.

      \n
    2. \n
    \n

    返回值 (Function)

    \n

    Returns the new function.

    \n
    \n

    示例

    \n
    var flipped = _.flip(function() {\n  return _.toArray(arguments);\n});\n\nflipped('a', 'b', 'c', 'd');\n// => ['d', 'c', 'b', 'a']\n
    \n
    \n
    \n\n
    " } + "html":"

    flip source npm

    \n
    _.flip(func)
    \n\n

    Creates a function that invokes func with arguments reversed.

    \n
    \n\n

    参数

    \n
      \n
    1. func (Function)

      The function to flip arguments for.

      \n
    2. \n
    \n

    返回值 (Function)

    \n

    Returns the new function.

    \n
    \n

    示例

    \n
    var flipped = _.flip(function() {\n  return _.toArray(arguments);\n});\n\nflipped('a', 'b', 'c', 'd');\n// => ['d', 'c', 'b', 'a']\n
    \n
    \n
    \n\n
    " } ,{ "href":"/memoize", - "html":"

    memoize source npm

    \n
    _.memoize(func, [resolver])
    \n\n

    Creates a function that memoizes the result of func. If resolver is\nprovided it determines the cache key for storing the result based on the\narguments provided to the memoized function. By default, the first argument\nprovided to the memoized function is used as the map cache key. The func\nis invoked with the this binding of the memoized function.\n
    \n
    \n注意: The cache is exposed as the cache property on the memoized\nfunction. Its creation may be customized by replacing the _.memoize.Cache\nconstructor with one whose instances implement the Map\nmethod interface of delete, get, has, and set.

    \n
    \n\n

    参数

    \n
      \n
    1. func (Function)

      The function to have its output memoized.

      \n
    2. \n
    3. [resolver] (Function)

      The function to resolve the cache key.

      \n
    4. \n
    \n

    返回值 (Function)

    \n

    Returns the new memoizing function.

    \n
    \n

    示例

    \n
    var object = { 'a': 1, 'b': 2 };\nvar other = { 'c': 3, 'd': 4 };\n\nvar values = _.memoize(_.values);\nvalues(object);\n// => [1, 2]\n\nvalues(other);\n// => [3, 4]\n\nobject.a = 2;\nvalues(object);\n// => [1, 2]\n\n// modifying the result cache\nvalues.cache.set(object, ['a', 'b']);\nvalues(object);\n// => ['a', 'b']\n\n// replacing `_.memoize.Cache`\n_.memoize.Cache = WeakMap;\n
    \n
    \n
    \n\n
    " } + "html":"

    memoize source npm

    \n
    _.memoize(func, [resolver])
    \n\n

    Creates a function that memoizes the result of func. If resolver is\nprovided it determines the cache key for storing the result based on the\narguments provided to the memoized function. By default, the first argument\nprovided to the memoized function is used as the map cache key. The func\nis invoked with the this binding of the memoized function.\n
    \n
    \n注意: The cache is exposed as the cache property on the memoized\nfunction. Its creation may be customized by replacing the _.memoize.Cache\nconstructor with one whose instances implement the Map\nmethod interface of delete, get, has, and set.

    \n
    \n\n

    参数

    \n
      \n
    1. func (Function)

      The function to have its output memoized.

      \n
    2. \n
    3. [resolver] (Function)

      The function to resolve the cache key.

      \n
    4. \n
    \n

    返回值 (Function)

    \n

    Returns the new memoizing function.

    \n
    \n

    示例

    \n
    var object = { 'a': 1, 'b': 2 };\nvar other = { 'c': 3, 'd': 4 };\n\nvar values = _.memoize(_.values);\nvalues(object);\n// => [1, 2]\n\nvalues(other);\n// => [3, 4]\n\nobject.a = 2;\nvalues(object);\n// => [1, 2]\n\n// modifying the result cache\nvalues.cache.set(object, ['a', 'b']);\nvalues(object);\n// => ['a', 'b']\n\n// replacing `_.memoize.Cache`\n_.memoize.Cache = WeakMap;\n
    \n
    \n
    \n\n
    " } ,{ "href":"/negate", - "html":"

    negate source npm

    \n
    _.negate(predicate)
    \n\n

    Creates a function that negates the result of the predicate func. The\nfunc predicate is invoked with the this binding and arguments of the\ncreated function.

    \n
    \n\n

    参数

    \n
      \n
    1. predicate (Function)

      The predicate to negate.

      \n
    2. \n
    \n

    返回值 (Function)

    \n

    Returns the new function.

    \n
    \n

    示例

    \n
    function isEven(n) {\n  return n % 2 == 0;\n}\n\n_.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));\n// => [1, 3, 5]\n
    \n
    \n
    \n\n
    " } + "html":"

    negate source npm

    \n
    _.negate(predicate)
    \n\n

    Creates a function that negates the result of the predicate func. The\nfunc predicate is invoked with the this binding and arguments of the\ncreated function.

    \n
    \n\n

    参数

    \n
      \n
    1. predicate (Function)

      The predicate to negate.

      \n
    2. \n
    \n

    返回值 (Function)

    \n

    Returns the new function.

    \n
    \n

    示例

    \n
    function isEven(n) {\n  return n % 2 == 0;\n}\n\n_.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));\n// => [1, 3, 5]\n
    \n
    \n
    \n\n
    " } ,{ "href":"/once", - "html":"

    once source npm

    \n
    _.once(func)
    \n\n

    Creates a function that is restricted to invoking func once. Repeat calls\nto the function return the value of the first invocation. The func is\ninvoked with the this binding and arguments of the created function.

    \n
    \n\n

    参数

    \n
      \n
    1. func (Function)

      The function to restrict.

      \n
    2. \n
    \n

    返回值 (Function)

    \n

    Returns the new restricted function.

    \n
    \n

    示例

    \n
    var initialize = _.once(createApplication);\ninitialize();\ninitialize();\n// `initialize` invokes `createApplication` once\n
    \n
    \n
    \n\n
    " } + "html":"

    once source npm

    \n
    _.once(func)
    \n\n

    Creates a function that is restricted to invoking func once. Repeat calls\nto the function return the value of the first invocation. The func is\ninvoked with the this binding and arguments of the created function.

    \n
    \n\n

    参数

    \n
      \n
    1. func (Function)

      The function to restrict.

      \n
    2. \n
    \n

    返回值 (Function)

    \n

    Returns the new restricted function.

    \n
    \n

    示例

    \n
    var initialize = _.once(createApplication);\ninitialize();\ninitialize();\n// `initialize` invokes `createApplication` once\n
    \n
    \n
    \n\n
    " } ,{ "href":"/overArgs", - "html":"

    overArgs source npm

    \n
    _.overArgs(func, [transforms])
    \n\n

    Creates a function that invokes func with arguments transformed by\ncorresponding transforms.

    \n
    \n\n

    参数

    \n
      \n
    1. func (Function)

      The function to wrap.

      \n
    2. \n
    3. [transforms] (...(Function|Function[])

      The functions to transform arguments, specified individually or in arrays.

      \n
    4. \n
    \n

    返回值 (Function)

    \n

    Returns the new function.

    \n
    \n

    示例

    \n
    function doubled(n) {\n  return n * 2;\n}\n\nfunction square(n) {\n  return n * n;\n}\n\nvar func = _.overArgs(function(x, y) {\n  return [x, y];\n}, square, doubled);\n\nfunc(9, 3);\n// => [81, 6]\n\nfunc(10, 5);\n// => [100, 10]\n
    \n
    \n
    \n\n
    " } + "html":"

    overArgs source npm

    \n
    _.overArgs(func, [transforms])
    \n\n

    Creates a function that invokes func with arguments transformed by\ncorresponding transforms.

    \n
    \n\n

    参数

    \n
      \n
    1. func (Function)

      The function to wrap.

      \n
    2. \n
    3. [transforms] (...(Function|Function[])

      The functions to transform arguments, specified individually or in arrays.

      \n
    4. \n
    \n

    返回值 (Function)

    \n

    Returns the new function.

    \n
    \n

    示例

    \n
    function doubled(n) {\n  return n * 2;\n}\n\nfunction square(n) {\n  return n * n;\n}\n\nvar func = _.overArgs(function(x, y) {\n  return [x, y];\n}, square, doubled);\n\nfunc(9, 3);\n// => [81, 6]\n\nfunc(10, 5);\n// => [100, 10]\n
    \n
    \n
    \n\n
    " } ,{ "href":"/partial", - "html":"

    partial source npm

    \n
    _.partial(func, [partials])
    \n\n

    Creates a function that invokes func with partial arguments prepended\nto those provided to the new function. This method is like _.bind except\nit does not alter the this binding.\n
    \n
    \nThe _.partial.placeholder value, which defaults to _ in monolithic\nbuilds, may be used as a placeholder for partially applied arguments.\n
    \n
    \n注意: This method doesn't set the "length" property of partially\napplied functions.

    \n
    \n\n

    参数

    \n
      \n
    1. func (Function)

      The function to partially apply arguments to.

      \n
    2. \n
    3. [partials] (...*)

      The arguments to be partially applied.

      \n
    4. \n
    \n

    返回值 (Function)

    \n

    Returns the new partially applied function.

    \n
    \n

    示例

    \n
    var greet = function(greeting, name) {\n  return greeting + ' ' + name;\n};\n\nvar sayHelloTo = _.partial(greet, 'hello');\nsayHelloTo('fred');\n// => 'hello fred'\n\n// using placeholders\nvar greetFred = _.partial(greet, _, 'fred');\ngreetFred('hi');\n// => 'hi fred'\n
    \n
    \n
    \n\n
    " } + "html":"

    partial source npm

    \n
    _.partial(func, [partials])
    \n\n

    Creates a function that invokes func with partial arguments prepended\nto those provided to the new function. This method is like _.bind except\nit does not alter the this binding.\n
    \n
    \nThe _.partial.placeholder value, which defaults to _ in monolithic\nbuilds, may be used as a placeholder for partially applied arguments.\n
    \n
    \n注意: This method doesn't set the "length" property of partially\napplied functions.

    \n
    \n\n

    参数

    \n
      \n
    1. func (Function)

      The function to partially apply arguments to.

      \n
    2. \n
    3. [partials] (...*)

      The arguments to be partially applied.

      \n
    4. \n
    \n

    返回值 (Function)

    \n

    Returns the new partially applied function.

    \n
    \n

    示例

    \n
    var greet = function(greeting, name) {\n  return greeting + ' ' + name;\n};\n\nvar sayHelloTo = _.partial(greet, 'hello');\nsayHelloTo('fred');\n// => 'hello fred'\n\n// using placeholders\nvar greetFred = _.partial(greet, _, 'fred');\ngreetFred('hi');\n// => 'hi fred'\n
    \n
    \n
    \n\n
    " } ,{ "href":"/partialRight", - "html":"

    partialRight source npm

    \n
    _.partialRight(func, [partials])
    \n\n

    This method is like _.partial except that partially applied arguments\nare appended to those provided to the new function.\n
    \n
    \nThe _.partialRight.placeholder value, which defaults to _ in monolithic\nbuilds, may be used as a placeholder for partially applied arguments.\n
    \n
    \n注意: This method doesn't set the "length" property of partially\napplied functions.

    \n
    \n\n

    参数

    \n
      \n
    1. func (Function)

      The function to partially apply arguments to.

      \n
    2. \n
    3. [partials] (...*)

      The arguments to be partially applied.

      \n
    4. \n
    \n

    返回值 (Function)

    \n

    Returns the new partially applied function.

    \n
    \n

    示例

    \n
    var greet = function(greeting, name) {\n  return greeting + ' ' + name;\n};\n\nvar greetFred = _.partialRight(greet, 'fred');\ngreetFred('hi');\n// => 'hi fred'\n\n// using placeholders\nvar sayHelloTo = _.partialRight(greet, 'hello', _);\nsayHelloTo('fred');\n// => 'hello fred'\n
    \n
    \n
    \n\n
    " } + "html":"

    partialRight source npm

    \n
    _.partialRight(func, [partials])
    \n\n

    This method is like _.partial except that partially applied arguments\nare appended to those provided to the new function.\n
    \n
    \nThe _.partialRight.placeholder value, which defaults to _ in monolithic\nbuilds, may be used as a placeholder for partially applied arguments.\n
    \n
    \n注意: This method doesn't set the "length" property of partially\napplied functions.

    \n
    \n\n

    参数

    \n
      \n
    1. func (Function)

      The function to partially apply arguments to.

      \n
    2. \n
    3. [partials] (...*)

      The arguments to be partially applied.

      \n
    4. \n
    \n

    返回值 (Function)

    \n

    Returns the new partially applied function.

    \n
    \n

    示例

    \n
    var greet = function(greeting, name) {\n  return greeting + ' ' + name;\n};\n\nvar greetFred = _.partialRight(greet, 'fred');\ngreetFred('hi');\n// => 'hi fred'\n\n// using placeholders\nvar sayHelloTo = _.partialRight(greet, 'hello', _);\nsayHelloTo('fred');\n// => 'hello fred'\n
    \n
    \n
    \n\n
    " } ,{ "href":"/rearg", - "html":"

    rearg source npm

    \n
    _.rearg(func, indexes)
    \n\n

    Creates a function that invokes func with arguments arranged according\nto the specified indexes where the argument value at the first index is\nprovided as the first argument, the argument value at the second index is\nprovided as the second argument, and so on.

    \n
    \n\n

    参数

    \n
      \n
    1. func (Function)

      The function to rearrange arguments for.

      \n
    2. \n
    3. indexes (...(number|number[])

      The arranged argument indexes, specified individually or in arrays.

      \n
    4. \n
    \n

    返回值 (Function)

    \n

    Returns the new function.

    \n
    \n

    示例

    \n
    var rearged = _.rearg(function(a, b, c) {\n  return [a, b, c];\n}, 2, 0, 1);\n\nrearged('b', 'c', 'a')\n// => ['a', 'b', 'c']\n
    \n
    \n
    \n\n
    " } + "html":"

    rearg source npm

    \n
    _.rearg(func, indexes)
    \n\n

    Creates a function that invokes func with arguments arranged according\nto the specified indexes where the argument value at the first index is\nprovided as the first argument, the argument value at the second index is\nprovided as the second argument, and so on.

    \n
    \n\n

    参数

    \n
      \n
    1. func (Function)

      The function to rearrange arguments for.

      \n
    2. \n
    3. indexes (...(number|number[])

      The arranged argument indexes, specified individually or in arrays.

      \n
    4. \n
    \n

    返回值 (Function)

    \n

    Returns the new function.

    \n
    \n

    示例

    \n
    var rearged = _.rearg(function(a, b, c) {\n  return [a, b, c];\n}, 2, 0, 1);\n\nrearged('b', 'c', 'a')\n// => ['a', 'b', 'c']\n
    \n
    \n
    \n\n
    " } ,{ "href":"/rest", - "html":"

    rest source npm

    \n
    _.rest(func, [start=func.length-1])
    \n\n

    Creates a function that invokes func with the this binding of the\ncreated function and arguments from start and beyond provided as an array.\n
    \n
    \n注意: This method is based on the rest parameter.

    \n
    \n\n

    参数

    \n
      \n
    1. func (Function)

      The function to apply a rest parameter to.

      \n
    2. \n
    3. [start=func.length-1] (number)

      The start position of the rest parameter.

      \n
    4. \n
    \n

    返回值 (Function)

    \n

    Returns the new function.

    \n
    \n

    示例

    \n
    var say = _.rest(function(what, names) {\n  return what + ' ' + _.initial(names).join(', ') +\n    (_.size(names) > 1 ? ', & ' : '') + _.last(names);\n});\n\nsay('hello', 'fred', 'barney', 'pebbles');\n// => 'hello fred, barney, & pebbles'\n
    \n
    \n
    \n\n
    " } + "html":"

    rest source npm

    \n
    _.rest(func, [start=func.length-1])
    \n\n

    Creates a function that invokes func with the this binding of the\ncreated function and arguments from start and beyond provided as an array.\n
    \n
    \n注意: This method is based on the rest parameter.

    \n
    \n\n

    参数

    \n
      \n
    1. func (Function)

      The function to apply a rest parameter to.

      \n
    2. \n
    3. [start=func.length-1] (number)

      The start position of the rest parameter.

      \n
    4. \n
    \n

    返回值 (Function)

    \n

    Returns the new function.

    \n
    \n

    示例

    \n
    var say = _.rest(function(what, names) {\n  return what + ' ' + _.initial(names).join(', ') +\n    (_.size(names) > 1 ? ', & ' : '') + _.last(names);\n});\n\nsay('hello', 'fred', 'barney', 'pebbles');\n// => 'hello fred, barney, & pebbles'\n
    \n
    \n
    \n\n
    " } ,{ "href":"/spread", - "html":"

    spread source npm

    \n
    _.spread(func)
    \n\n

    Creates a function that invokes func with the this binding of the created\nfunction and an array of arguments much like Function#apply.\n
    \n
    \n注意: This method is based on the spread operator.

    \n
    \n\n

    参数

    \n
      \n
    1. func (Function)

      The function to spread arguments over.

      \n
    2. \n
    \n

    返回值 (Function)

    \n

    Returns the new function.

    \n
    \n

    示例

    \n
    var say = _.spread(function(who, what) {\n  return who + ' says ' + what;\n});\n\nsay(['fred', 'hello']);\n// => 'fred says hello'\n\n// with a Promise\nvar numbers = Promise.all([\n  Promise.resolve(40),\n  Promise.resolve(36)\n]);\n\nnumbers.then(_.spread(function(x, y) {\n  return x + y;\n}));\n// => a Promise of 76\n
    \n
    \n
    \n\n
    " } + "html":"

    spread source npm

    \n
    _.spread(func)
    \n\n

    Creates a function that invokes func with the this binding of the created\nfunction and an array of arguments much like Function#apply.\n
    \n
    \n注意: This method is based on the spread operator.

    \n
    \n\n

    参数

    \n
      \n
    1. func (Function)

      The function to spread arguments over.

      \n
    2. \n
    \n

    返回值 (Function)

    \n

    Returns the new function.

    \n
    \n

    示例

    \n
    var say = _.spread(function(who, what) {\n  return who + ' says ' + what;\n});\n\nsay(['fred', 'hello']);\n// => 'fred says hello'\n\n// with a Promise\nvar numbers = Promise.all([\n  Promise.resolve(40),\n  Promise.resolve(36)\n]);\n\nnumbers.then(_.spread(function(x, y) {\n  return x + y;\n}));\n// => a Promise of 76\n
    \n
    \n
    \n\n
    " } ,{ "href":"/throttle", - "html":"

    throttle source npm

    \n
    _.throttle(func, [wait=0], [options])
    \n\n

    Creates a throttled function that only invokes func at most once per\nevery wait milliseconds. The throttled function comes with a cancel\nmethod to cancel delayed func invocations and a flush method to\nimmediately invoke them. Provide an options object to indicate whether\nfunc should be invoked on the leading and/or trailing edge of the wait\ntimeout. The func is invoked with the last arguments provided to the\nthrottled function. Subsequent calls to the throttled function return the\nresult of the last func invocation.\n
    \n
    \n注意: If leading and trailing options are true, func is invoked\non the trailing edge of the timeout only if the the throttled function is\ninvoked more than once during the wait timeout.\n
    \n
    \nSee David Corbacho's article\nfor details over the differences between _.throttle and _.debounce.

    \n
    \n\n

    参数

    \n
      \n
    1. func (Function)

      The function to throttle.

      \n
    2. \n
    3. [wait=0] (number)

      The number of milliseconds to throttle invocations to.

      \n
    4. \n
    5. [options] (Object)

      The options object.

      \n
    6. \n
    7. [options.leading=true] (boolean)

      Specify invoking on the leading edge of the timeout.

      \n
    8. \n
    9. [options.trailing=true] (boolean)

      Specify invoking on the trailing edge of the timeout.

      \n
    10. \n
    \n

    返回值 (Function)

    \n

    Returns the new throttled function.

    \n
    \n

    示例

    \n
    // avoid excessively updating the position while scrolling\njQuery(window).on('scroll', _.throttle(updatePosition, 100));\n\n// invoke `renewToken` when the click event is fired, but not more than once every 5 minutes\nvar throttled = _.throttle(renewToken, 300000, { 'trailing': false });\njQuery(element).on('click', throttled);\n\n// cancel a trailing throttled invocation\njQuery(window).on('popstate', throttled.cancel);\n
    \n
    \n
    \n\n
    " } + "html":"

    throttle source npm

    \n
    _.throttle(func, [wait=0], [options])
    \n\n

    Creates a throttled function that only invokes func at most once per\nevery wait milliseconds. The throttled function comes with a cancel\nmethod to cancel delayed func invocations and a flush method to\nimmediately invoke them. Provide an options object to indicate whether\nfunc should be invoked on the leading and/or trailing edge of the wait\ntimeout. The func is invoked with the last arguments provided to the\nthrottled function. Subsequent calls to the throttled function return the\nresult of the last func invocation.\n
    \n
    \n注意: If leading and trailing options are true, func is invoked\non the trailing edge of the timeout only if the the throttled function is\ninvoked more than once during the wait timeout.\n
    \n
    \nSee David Corbacho's article\nfor details over the differences between _.throttle and _.debounce.

    \n
    \n\n

    参数

    \n
      \n
    1. func (Function)

      The function to throttle.

      \n
    2. \n
    3. [wait=0] (number)

      The number of milliseconds to throttle invocations to.

      \n
    4. \n
    5. [options] (Object)

      The options object.

      \n
    6. \n
    7. [options.leading=true] (boolean)

      Specify invoking on the leading edge of the timeout.

      \n
    8. \n
    9. [options.trailing=true] (boolean)

      Specify invoking on the trailing edge of the timeout.

      \n
    10. \n
    \n

    返回值 (Function)

    \n

    Returns the new throttled function.

    \n
    \n

    示例

    \n
    // avoid excessively updating the position while scrolling\njQuery(window).on('scroll', _.throttle(updatePosition, 100));\n\n// invoke `renewToken` when the click event is fired, but not more than once every 5 minutes\nvar throttled = _.throttle(renewToken, 300000, { 'trailing': false });\njQuery(element).on('click', throttled);\n\n// cancel a trailing throttled invocation\njQuery(window).on('popstate', throttled.cancel);\n
    \n
    \n
    \n\n
    " } ,{ "href":"/unary", - "html":"

    unary source npm

    \n
    _.unary(func)
    \n\n

    Creates a function that accepts up to one argument, ignoring any\nadditional arguments.

    \n
    \n\n

    参数

    \n
      \n
    1. func (Function)

      The function to cap arguments for.

      \n
    2. \n
    \n

    返回值 (Function)

    \n

    Returns the new function.

    \n
    \n

    示例

    \n
    _.map(['6', '8', '10'], _.unary(parseInt));\n// => [6, 8, 10]\n
    \n
    \n
    \n\n
    " } + "html":"

    unary source npm

    \n
    _.unary(func)
    \n\n

    Creates a function that accepts up to one argument, ignoring any\nadditional arguments.

    \n
    \n\n

    参数

    \n
      \n
    1. func (Function)

      The function to cap arguments for.

      \n
    2. \n
    \n

    返回值 (Function)

    \n

    Returns the new function.

    \n
    \n

    示例

    \n
    _.map(['6', '8', '10'], _.unary(parseInt));\n// => [6, 8, 10]\n
    \n
    \n
    \n\n
    " } ,{ "href":"/wrap", - "html":"

    wrap source npm

    \n
    _.wrap(value, wrapper)
    \n\n

    Creates a function that provides value to the wrapper function as its\nfirst argument. Any additional arguments provided to the function are\nappended to those provided to the wrapper function. The wrapper is invoked\nwith the this binding of the created function.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to wrap.

      \n
    2. \n
    3. wrapper (Function)

      The wrapper function.

      \n
    4. \n
    \n

    返回值 (Function)

    \n

    Returns the new function.

    \n
    \n

    示例

    \n
    var p = _.wrap(_.escape, function(func, text) {\n  return '<p>' + func(text) + '</p>';\n});\n\np('fred, barney, & pebbles');\n// => '<p>fred, barney, &amp; pebbles</p>'\n
    \n
    \n
    \n\n
    " } + "html":"

    wrap source npm

    \n
    _.wrap(value, wrapper)
    \n\n

    Creates a function that provides value to the wrapper function as its\nfirst argument. Any additional arguments provided to the function are\nappended to those provided to the wrapper function. The wrapper is invoked\nwith the this binding of the created function.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to wrap.

      \n
    2. \n
    3. wrapper (Function)

      The wrapper function.

      \n
    4. \n
    \n

    返回值 (Function)

    \n

    Returns the new function.

    \n
    \n

    示例

    \n
    var p = _.wrap(_.escape, function(func, text) {\n  return '<p>' + func(text) + '</p>';\n});\n\np('fred, barney, & pebbles');\n// => '<p>fred, barney, &amp; pebbles</p>'\n
    \n
    \n
    \n\n
    " } ,{ "href":"/clone", - "html":"

    clone source npm

    \n
    _.clone(value)
    \n\n

    Creates a shallow clone of value.\n
    \n
    \n注意: This method is loosely based on the\nstructured clone algorithm\nand supports cloning arrays, array buffers, booleans, date objects, maps,\nnumbers, Object objects, regexes, sets, strings, symbols, and typed\narrays. The own enumerable properties of arguments objects are cloned\nas plain objects. An empty object is returned for uncloneable values such\nas error objects, functions, DOM nodes, and WeakMaps.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to clone.

      \n
    2. \n
    \n

    返回值 (*)

    \n

    Returns the cloned value.

    \n
    \n

    示例

    \n
    var users = [\n  { 'user': 'barney' },\n  { 'user': 'fred' }\n];\n\nvar shallow = _.clone(users);\nconsole.log(shallow[0] === users[0]);\n// => true\n
    \n
    \n
    \n\n
    " } + "html":"

    clone source npm

    \n
    _.clone(value)
    \n\n

    Creates a shallow clone of value.\n
    \n
    \n注意: This method is loosely based on the\nstructured clone algorithm\nand supports cloning arrays, array buffers, booleans, date objects, maps,\nnumbers, Object objects, regexes, sets, strings, symbols, and typed\narrays. The own enumerable properties of arguments objects are cloned\nas plain objects. An empty object is returned for uncloneable values such\nas error objects, functions, DOM nodes, and WeakMaps.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to clone.

      \n
    2. \n
    \n

    返回值 (*)

    \n

    Returns the cloned value.

    \n
    \n

    示例

    \n
    var users = [\n  { 'user': 'barney' },\n  { 'user': 'fred' }\n];\n\nvar shallow = _.clone(users);\nconsole.log(shallow[0] === users[0]);\n// => true\n
    \n
    \n
    \n\n
    " } ,{ "href":"/cloneDeep", - "html":"

    cloneDeep source npm

    \n
    _.cloneDeep(value)
    \n\n

    This method is like _.clone except that it recursively clones value.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to recursively clone.

      \n
    2. \n
    \n

    返回值 (*)

    \n

    Returns the deep cloned value.

    \n
    \n

    示例

    \n
    var users = [\n  { 'user': 'barney' },\n  { 'user': 'fred' }\n];\n\nvar deep = _.cloneDeep(users);\nconsole.log(deep[0] === users[0]);\n// => false\n
    \n
    \n
    \n\n
    " } + "html":"

    cloneDeep source npm

    \n
    _.cloneDeep(value)
    \n\n

    This method is like _.clone except that it recursively clones value.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to recursively clone.

      \n
    2. \n
    \n

    返回值 (*)

    \n

    Returns the deep cloned value.

    \n
    \n

    示例

    \n
    var users = [\n  { 'user': 'barney' },\n  { 'user': 'fred' }\n];\n\nvar deep = _.cloneDeep(users);\nconsole.log(deep[0] === users[0]);\n// => false\n
    \n
    \n
    \n\n
    " } ,{ "href":"/cloneDeepWith", - "html":"

    cloneDeepWith source npm

    \n
    _.cloneDeepWith(value, [customizer])
    \n\n

    This method is like _.cloneWith except that it recursively clones value.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to recursively clone.

      \n
    2. \n
    3. [customizer] (Function)

      The function to customize cloning.

      \n
    4. \n
    \n

    返回值 (*)

    \n

    Returns the deep cloned value.

    \n
    \n

    示例

    \n
    function customizer(value) {\n  if (_.isElement(value)) {\n    return value.cloneNode(true);\n  }\n}\n\nvar el = _.cloneDeep(document.body, customizer);\n\nconsole.log(el === document.body);\n// => false\nconsole.log(el.nodeName);\n// => BODY\nconsole.log(el.childNodes.length);\n// => 20\n
    \n
    \n
    \n\n
    " } + "html":"

    cloneDeepWith source npm

    \n
    _.cloneDeepWith(value, [customizer])
    \n\n

    This method is like _.cloneWith except that it recursively clones value.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to recursively clone.

      \n
    2. \n
    3. [customizer] (Function)

      The function to customize cloning.

      \n
    4. \n
    \n

    返回值 (*)

    \n

    Returns the deep cloned value.

    \n
    \n

    示例

    \n
    function customizer(value) {\n  if (_.isElement(value)) {\n    return value.cloneNode(true);\n  }\n}\n\nvar el = _.cloneDeep(document.body, customizer);\n\nconsole.log(el === document.body);\n// => false\nconsole.log(el.nodeName);\n// => BODY\nconsole.log(el.childNodes.length);\n// => 20\n
    \n
    \n
    \n\n
    " } ,{ "href":"/cloneWith", - "html":"

    cloneWith source npm

    \n
    _.cloneWith(value, [customizer])
    \n\n

    This method is like _.clone except that it accepts customizer which\nis invoked to produce the cloned value. If customizer returns undefined\ncloning is handled by the method instead. The customizer is invoked with\nup to five arguments; (value [, index|key, object, stack]).

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to clone.

      \n
    2. \n
    3. [customizer] (Function)

      The function to customize cloning.

      \n
    4. \n
    \n

    返回值 (*)

    \n

    Returns the cloned value.

    \n
    \n

    示例

    \n
    function customizer(value) {\n  if (_.isElement(value)) {\n    return value.cloneNode(false);\n  }\n}\n\nvar el = _.clone(document.body, customizer);\n\nconsole.log(el === document.body);\n// => false\nconsole.log(el.nodeName);\n// => BODY\nconsole.log(el.childNodes.length);\n// => 0\n
    \n
    \n
    \n\n
    " } + "html":"

    cloneWith source npm

    \n
    _.cloneWith(value, [customizer])
    \n\n

    This method is like _.clone except that it accepts customizer which\nis invoked to produce the cloned value. If customizer returns undefined\ncloning is handled by the method instead. The customizer is invoked with\nup to five arguments; (value [, index|key, object, stack]).

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to clone.

      \n
    2. \n
    3. [customizer] (Function)

      The function to customize cloning.

      \n
    4. \n
    \n

    返回值 (*)

    \n

    Returns the cloned value.

    \n
    \n

    示例

    \n
    function customizer(value) {\n  if (_.isElement(value)) {\n    return value.cloneNode(false);\n  }\n}\n\nvar el = _.clone(document.body, customizer);\n\nconsole.log(el === document.body);\n// => false\nconsole.log(el.nodeName);\n// => BODY\nconsole.log(el.childNodes.length);\n// => 0\n
    \n
    \n
    \n\n
    " } ,{ "href":"/eq", - "html":"

    eq source npm

    \n
    _.eq(value, other)
    \n\n

    Performs a SameValueZero\ncomparison between two values to determine if they are equivalent.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to compare.

      \n
    2. \n
    3. other (*)

      The other value to compare.

      \n
    4. \n
    \n

    返回值 (boolean)

    \n

    Returns true if the values are equivalent, else false.

    \n
    \n

    示例

    \n
    var object = { 'user': 'fred' };\nvar other = { 'user': 'fred' };\n\n_.eq(object, object);\n// => true\n\n_.eq(object, other);\n// => false\n\n_.eq('a', 'a');\n// => true\n\n_.eq('a', Object('a'));\n// => false\n\n_.eq(NaN, NaN);\n// => true\n
    \n
    \n
    \n\n
    " } + "html":"

    eq source npm

    \n
    _.eq(value, other)
    \n\n

    Performs a SameValueZero\ncomparison between two values to determine if they are equivalent.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to compare.

      \n
    2. \n
    3. other (*)

      The other value to compare.

      \n
    4. \n
    \n

    返回值 (boolean)

    \n

    Returns true if the values are equivalent, else false.

    \n
    \n

    示例

    \n
    var object = { 'user': 'fred' };\nvar other = { 'user': 'fred' };\n\n_.eq(object, object);\n// => true\n\n_.eq(object, other);\n// => false\n\n_.eq('a', 'a');\n// => true\n\n_.eq('a', Object('a'));\n// => false\n\n_.eq(NaN, NaN);\n// => true\n
    \n
    \n
    \n\n
    " } ,{ "href":"/gt", - "html":"

    gt source npm

    \n
    _.gt(value, other)
    \n\n

    Checks if value is greater than other.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to compare.

      \n
    2. \n
    3. other (*)

      The other value to compare.

      \n
    4. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is greater than other, else false.

    \n
    \n

    示例

    \n
    _.gt(3, 1);\n// => true\n\n_.gt(3, 3);\n// => false\n\n_.gt(1, 3);\n// => false\n
    \n
    \n
    \n\n
    " } + "html":"

    gt source npm

    \n
    _.gt(value, other)
    \n\n

    Checks if value is greater than other.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to compare.

      \n
    2. \n
    3. other (*)

      The other value to compare.

      \n
    4. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is greater than other, else false.

    \n
    \n

    示例

    \n
    _.gt(3, 1);\n// => true\n\n_.gt(3, 3);\n// => false\n\n_.gt(1, 3);\n// => false\n
    \n
    \n
    \n\n
    " } ,{ "href":"/gte", - "html":"

    gte source npm

    \n
    _.gte(value, other)
    \n\n

    Checks if value is greater than or equal to other.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to compare.

      \n
    2. \n
    3. other (*)

      The other value to compare.

      \n
    4. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is greater than or equal to other, else false.

    \n
    \n

    示例

    \n
    _.gte(3, 1);\n// => true\n\n_.gte(3, 3);\n// => true\n\n_.gte(1, 3);\n// => false\n
    \n
    \n
    \n\n
    " } + "html":"

    gte source npm

    \n
    _.gte(value, other)
    \n\n

    Checks if value is greater than or equal to other.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to compare.

      \n
    2. \n
    3. other (*)

      The other value to compare.

      \n
    4. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is greater than or equal to other, else false.

    \n
    \n

    示例

    \n
    _.gte(3, 1);\n// => true\n\n_.gte(3, 3);\n// => true\n\n_.gte(1, 3);\n// => false\n
    \n
    \n
    \n\n
    " } ,{ "href":"/isArguments", - "html":"

    isArguments source npm

    \n
    _.isArguments(value)
    \n\n

    Checks if value is likely an arguments object.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to check.

      \n
    2. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is correctly classified, else false.

    \n
    \n

    示例

    \n
    _.isArguments(function() { return arguments; }());\n// => true\n\n_.isArguments([1, 2, 3]);\n// => false\n
    \n
    \n
    \n\n
    " } + "html":"

    isArguments source npm

    \n
    _.isArguments(value)
    \n\n

    Checks if value is likely an arguments object.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to check.

      \n
    2. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is correctly classified, else false.

    \n
    \n

    示例

    \n
    _.isArguments(function() { return arguments; }());\n// => true\n\n_.isArguments([1, 2, 3]);\n// => false\n
    \n
    \n
    \n\n
    " } ,{ "href":"/isArray", - "html":"

    isArray source npm

    \n
    _.isArray(value)
    \n\n

    Checks if value is classified as an Array object.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to check.

      \n
    2. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is correctly classified, else false.

    \n
    \n

    示例

    \n
    _.isArray([1, 2, 3]);\n// => true\n\n_.isArray(document.body.children);\n// => false\n\n_.isArray('abc');\n// => false\n\n_.isArray(_.noop);\n// => false\n
    \n
    \n
    \n\n
    " } + "html":"

    isArray source npm

    \n
    _.isArray(value)
    \n\n

    Checks if value is classified as an Array object.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to check.

      \n
    2. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is correctly classified, else false.

    \n
    \n

    示例

    \n
    _.isArray([1, 2, 3]);\n// => true\n\n_.isArray(document.body.children);\n// => false\n\n_.isArray('abc');\n// => false\n\n_.isArray(_.noop);\n// => false\n
    \n
    \n
    \n\n
    " } ,{ "href":"/isArrayLike", - "html":"

    isArrayLike source npm

    \n
    _.isArrayLike(value)
    \n\n

    Checks if value is array-like. A value is considered array-like if it's\nnot a function and has a value.length that's an integer greater than or\nequal to 0 and less than or equal to Number.MAX_SAFE_INTEGER.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to check.

      \n
    2. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is array-like, else false.

    \n
    \n

    示例

    \n
    _.isArrayLike([1, 2, 3]);\n// => true\n\n_.isArrayLike(document.body.children);\n// => true\n\n_.isArrayLike('abc');\n// => true\n\n_.isArrayLike(_.noop);\n// => false\n
    \n
    \n
    \n\n
    " } + "html":"

    isArrayLike source npm

    \n
    _.isArrayLike(value)
    \n\n

    Checks if value is array-like. A value is considered array-like if it's\nnot a function and has a value.length that's an integer greater than or\nequal to 0 and less than or equal to Number.MAX_SAFE_INTEGER.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to check.

      \n
    2. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is array-like, else false.

    \n
    \n

    示例

    \n
    _.isArrayLike([1, 2, 3]);\n// => true\n\n_.isArrayLike(document.body.children);\n// => true\n\n_.isArrayLike('abc');\n// => true\n\n_.isArrayLike(_.noop);\n// => false\n
    \n
    \n
    \n\n
    " } ,{ "href":"/isArrayLikeObject", - "html":"

    isArrayLikeObject source npm

    \n
    _.isArrayLikeObject(value)
    \n\n

    This method is like _.isArrayLike except that it also checks if value\nis an object.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to check.

      \n
    2. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is an array-like object, else false.

    \n
    \n

    示例

    \n
    _.isArrayLikeObject([1, 2, 3]);\n// => true\n\n_.isArrayLikeObject(document.body.children);\n// => true\n\n_.isArrayLikeObject('abc');\n// => false\n\n_.isArrayLikeObject(_.noop);\n// => false\n
    \n
    \n
    \n\n
    " } + "html":"

    isArrayLikeObject source npm

    \n
    _.isArrayLikeObject(value)
    \n\n

    This method is like _.isArrayLike except that it also checks if value\nis an object.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to check.

      \n
    2. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is an array-like object, else false.

    \n
    \n

    示例

    \n
    _.isArrayLikeObject([1, 2, 3]);\n// => true\n\n_.isArrayLikeObject(document.body.children);\n// => true\n\n_.isArrayLikeObject('abc');\n// => false\n\n_.isArrayLikeObject(_.noop);\n// => false\n
    \n
    \n
    \n\n
    " } ,{ "href":"/isBoolean", - "html":"

    isBoolean source npm

    \n
    _.isBoolean(value)
    \n\n

    Checks if value is classified as a boolean primitive or object.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to check.

      \n
    2. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is correctly classified, else false.

    \n
    \n

    示例

    \n
    _.isBoolean(false);\n// => true\n\n_.isBoolean(null);\n// => false\n
    \n
    \n
    \n\n
    " } + "html":"

    isBoolean source npm

    \n
    _.isBoolean(value)
    \n\n

    Checks if value is classified as a boolean primitive or object.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to check.

      \n
    2. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is correctly classified, else false.

    \n
    \n

    示例

    \n
    _.isBoolean(false);\n// => true\n\n_.isBoolean(null);\n// => false\n
    \n
    \n
    \n\n
    " } ,{ "href":"/isDate", - "html":"

    isDate source npm

    \n
    _.isDate(value)
    \n\n

    Checks if value is classified as a Date object.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to check.

      \n
    2. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is correctly classified, else false.

    \n
    \n

    示例

    \n
    _.isDate(new Date);\n// => true\n\n_.isDate('Mon April 23 2012');\n// => false\n
    \n
    \n
    \n\n
    " } + "html":"

    isDate source npm

    \n
    _.isDate(value)
    \n\n

    Checks if value is classified as a Date object.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to check.

      \n
    2. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is correctly classified, else false.

    \n
    \n

    示例

    \n
    _.isDate(new Date);\n// => true\n\n_.isDate('Mon April 23 2012');\n// => false\n
    \n
    \n
    \n\n
    " } ,{ "href":"/isElement", - "html":"

    isElement source npm

    \n
    _.isElement(value)
    \n\n

    Checks if value is likely a DOM element.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to check.

      \n
    2. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is a DOM element, else false.

    \n
    \n

    示例

    \n
    _.isElement(document.body);\n// => true\n\n_.isElement('<body>');\n// => false\n
    \n
    \n
    \n\n
    " } + "html":"

    isElement source npm

    \n
    _.isElement(value)
    \n\n

    Checks if value is likely a DOM element.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to check.

      \n
    2. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is a DOM element, else false.

    \n
    \n

    示例

    \n
    _.isElement(document.body);\n// => true\n\n_.isElement('<body>');\n// => false\n
    \n
    \n
    \n\n
    " } ,{ "href":"/isEmpty", - "html":"

    isEmpty source npm

    \n
    _.isEmpty(value)
    \n\n

    Checks if value is empty. A value is considered empty unless it's an\narguments object, array, string, or jQuery-like collection with a length\ngreater than 0 or an object with own enumerable properties.

    \n
    \n\n

    参数

    \n
      \n
    1. value (Array|Object|string)

      The value to inspect.

      \n
    2. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is empty, else false.

    \n
    \n

    示例

    \n
    _.isEmpty(null);\n// => true\n\n_.isEmpty(true);\n// => true\n\n_.isEmpty(1);\n// => true\n\n_.isEmpty([1, 2, 3]);\n// => false\n\n_.isEmpty({ 'a': 1 });\n// => false\n
    \n
    \n
    \n\n
    " } + "html":"

    isEmpty source npm

    \n
    _.isEmpty(value)
    \n\n

    Checks if value is empty. A value is considered empty unless it's an\narguments object, array, string, or jQuery-like collection with a length\ngreater than 0 or an object with own enumerable properties.

    \n
    \n\n

    参数

    \n
      \n
    1. value (Array|Object|string)

      The value to inspect.

      \n
    2. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is empty, else false.

    \n
    \n

    示例

    \n
    _.isEmpty(null);\n// => true\n\n_.isEmpty(true);\n// => true\n\n_.isEmpty(1);\n// => true\n\n_.isEmpty([1, 2, 3]);\n// => false\n\n_.isEmpty({ 'a': 1 });\n// => false\n
    \n
    \n
    \n\n
    " } ,{ "href":"/isEqual", - "html":"

    isEqual source npm

    \n
    _.isEqual(value, other)
    \n\n

    Performs a deep comparison between two values to determine if they are\nequivalent.\n
    \n
    \n注意: This method supports comparing arrays, array buffers, booleans,\ndate objects, error objects, maps, numbers, Object objects, regexes,\nsets, strings, symbols, and typed arrays. Object objects are compared\nby their own, not inherited, enumerable properties. Functions and DOM\nnodes are not supported.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to compare.

      \n
    2. \n
    3. other (*)

      The other value to compare.

      \n
    4. \n
    \n

    返回值 (boolean)

    \n

    Returns true if the values are equivalent, else false.

    \n
    \n

    示例

    \n
    var object = { 'user': 'fred' };\nvar other = { 'user': 'fred' };\n\n_.isEqual(object, other);\n// => true\n\nobject === other;\n// => false\n
    \n
    \n
    \n\n
    " } + "html":"

    isEqual source npm

    \n
    _.isEqual(value, other)
    \n\n

    Performs a deep comparison between two values to determine if they are\nequivalent.\n
    \n
    \n注意: This method supports comparing arrays, array buffers, booleans,\ndate objects, error objects, maps, numbers, Object objects, regexes,\nsets, strings, symbols, and typed arrays. Object objects are compared\nby their own, not inherited, enumerable properties. Functions and DOM\nnodes are not supported.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to compare.

      \n
    2. \n
    3. other (*)

      The other value to compare.

      \n
    4. \n
    \n

    返回值 (boolean)

    \n

    Returns true if the values are equivalent, else false.

    \n
    \n

    示例

    \n
    var object = { 'user': 'fred' };\nvar other = { 'user': 'fred' };\n\n_.isEqual(object, other);\n// => true\n\nobject === other;\n// => false\n
    \n
    \n
    \n\n
    " } ,{ "href":"/isEqualWith", - "html":"

    isEqualWith source npm

    \n
    _.isEqualWith(value, other, [customizer])
    \n\n

    This method is like _.isEqual except that it accepts customizer which is\ninvoked to compare values. If customizer returns undefined comparisons are\nhandled by the method instead. The customizer is invoked with up to seven arguments:
    \n(objValue, othValue [, index|key, object, other, stack]).

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to compare.

      \n
    2. \n
    3. other (*)

      The other value to compare.

      \n
    4. \n
    5. [customizer] (Function)

      The function to customize comparisons.

      \n
    6. \n
    \n

    返回值 (boolean)

    \n

    Returns true if the values are equivalent, else false.

    \n
    \n

    示例

    \n
    function isGreeting(value) {\n  return /^h(?:i|ello)$/.test(value);\n}\n\nfunction customizer(objValue, othValue) {\n  if (isGreeting(objValue) && isGreeting(othValue)) {\n    return true;\n  }\n}\n\nvar array = ['hello', 'goodbye'];\nvar other = ['hi', 'goodbye'];\n\n_.isEqualWith(array, other, customizer);\n// => true\n
    \n
    \n
    \n\n
    " } + "html":"

    isEqualWith source npm

    \n
    _.isEqualWith(value, other, [customizer])
    \n\n

    This method is like _.isEqual except that it accepts customizer which is\ninvoked to compare values. If customizer returns undefined comparisons are\nhandled by the method instead. The customizer is invoked with up to seven arguments:
    \n(objValue, othValue [, index|key, object, other, stack]).

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to compare.

      \n
    2. \n
    3. other (*)

      The other value to compare.

      \n
    4. \n
    5. [customizer] (Function)

      The function to customize comparisons.

      \n
    6. \n
    \n

    返回值 (boolean)

    \n

    Returns true if the values are equivalent, else false.

    \n
    \n

    示例

    \n
    function isGreeting(value) {\n  return /^h(?:i|ello)$/.test(value);\n}\n\nfunction customizer(objValue, othValue) {\n  if (isGreeting(objValue) && isGreeting(othValue)) {\n    return true;\n  }\n}\n\nvar array = ['hello', 'goodbye'];\nvar other = ['hi', 'goodbye'];\n\n_.isEqualWith(array, other, customizer);\n// => true\n
    \n
    \n
    \n\n
    " } ,{ "href":"/isError", - "html":"

    isError source npm

    \n
    _.isError(value)
    \n\n

    Checks if value is an Error, EvalError, RangeError, ReferenceError,\nSyntaxError, TypeError, or URIError object.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to check.

      \n
    2. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is an error object, else false.

    \n
    \n

    示例

    \n
    _.isError(new Error);\n// => true\n\n_.isError(Error);\n// => false\n
    \n
    \n
    \n\n
    " } + "html":"

    isError source npm

    \n
    _.isError(value)
    \n\n

    Checks if value is an Error, EvalError, RangeError, ReferenceError,\nSyntaxError, TypeError, or URIError object.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to check.

      \n
    2. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is an error object, else false.

    \n
    \n

    示例

    \n
    _.isError(new Error);\n// => true\n\n_.isError(Error);\n// => false\n
    \n
    \n
    \n\n
    " } ,{ "href":"/isFinite", - "html":"

    isFinite source npm

    \n
    _.isFinite(value)
    \n\n

    Checks if value is a finite primitive number.\n
    \n
    \n注意: This method is based on Number.isFinite.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to check.

      \n
    2. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is a finite number, else false.

    \n
    \n

    示例

    \n
    _.isFinite(3);\n// => true\n\n_.isFinite(Number.MAX_VALUE);\n// => true\n\n_.isFinite(3.14);\n// => true\n\n_.isFinite(Infinity);\n// => false\n
    \n
    \n
    \n\n
    " } + "html":"

    isFinite source npm

    \n
    _.isFinite(value)
    \n\n

    Checks if value is a finite primitive number.\n
    \n
    \n注意: This method is based on Number.isFinite.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to check.

      \n
    2. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is a finite number, else false.

    \n
    \n

    示例

    \n
    _.isFinite(3);\n// => true\n\n_.isFinite(Number.MAX_VALUE);\n// => true\n\n_.isFinite(3.14);\n// => true\n\n_.isFinite(Infinity);\n// => false\n
    \n
    \n
    \n\n
    " } ,{ "href":"/isFunction", - "html":"

    isFunction source npm

    \n
    _.isFunction(value)
    \n\n

    Checks if value is classified as a Function object.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to check.

      \n
    2. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is correctly classified, else false.

    \n
    \n

    示例

    \n
    _.isFunction(_);\n// => true\n\n_.isFunction(/abc/);\n// => false\n
    \n
    \n
    \n\n
    " } + "html":"

    isFunction source npm

    \n
    _.isFunction(value)
    \n\n

    Checks if value is classified as a Function object.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to check.

      \n
    2. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is correctly classified, else false.

    \n
    \n

    示例

    \n
    _.isFunction(_);\n// => true\n\n_.isFunction(/abc/);\n// => false\n
    \n
    \n
    \n\n
    " } ,{ "href":"/isInteger", - "html":"

    isInteger source npm

    \n
    _.isInteger(value)
    \n\n

    Checks if value is an integer.\n
    \n
    \n注意: This method is based on Number.isInteger.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to check.

      \n
    2. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is an integer, else false.

    \n
    \n

    示例

    \n
    _.isInteger(3);\n// => true\n\n_.isInteger(Number.MIN_VALUE);\n// => false\n\n_.isInteger(Infinity);\n// => false\n\n_.isInteger('3');\n// => false\n
    \n
    \n
    \n\n
    " } + "html":"

    isInteger source npm

    \n
    _.isInteger(value)
    \n\n

    Checks if value is an integer.\n
    \n
    \n注意: This method is based on Number.isInteger.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to check.

      \n
    2. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is an integer, else false.

    \n
    \n

    示例

    \n
    _.isInteger(3);\n// => true\n\n_.isInteger(Number.MIN_VALUE);\n// => false\n\n_.isInteger(Infinity);\n// => false\n\n_.isInteger('3');\n// => false\n
    \n
    \n
    \n\n
    " } ,{ "href":"/isLength", - "html":"

    isLength source npm

    \n
    _.isLength(value)
    \n\n

    Checks if value is a valid array-like length.\n
    \n
    \n注意: This function is loosely based on ToLength.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to check.

      \n
    2. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is a valid length, else false.

    \n
    \n

    示例

    \n
    _.isLength(3);\n// => true\n\n_.isLength(Number.MIN_VALUE);\n// => false\n\n_.isLength(Infinity);\n// => false\n\n_.isLength('3');\n// => false\n
    \n
    \n
    \n\n
    " } + "html":"

    isLength source npm

    \n
    _.isLength(value)
    \n\n

    Checks if value is a valid array-like length.\n
    \n
    \n注意: This function is loosely based on ToLength.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to check.

      \n
    2. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is a valid length, else false.

    \n
    \n

    示例

    \n
    _.isLength(3);\n// => true\n\n_.isLength(Number.MIN_VALUE);\n// => false\n\n_.isLength(Infinity);\n// => false\n\n_.isLength('3');\n// => false\n
    \n
    \n
    \n\n
    " } ,{ "href":"/isMatch", - "html":"

    isMatch source npm

    \n
    _.isMatch(object, source)
    \n\n

    Performs a deep comparison between object and source to determine if\nobject contains equivalent property values.\n
    \n
    \n注意: This method supports comparing the same values as _.isEqual.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to inspect.

      \n
    2. \n
    3. source (Object)

      The object of property values to match.

      \n
    4. \n
    \n

    返回值 (boolean)

    \n

    Returns true if object is a match, else false.

    \n
    \n

    示例

    \n
    var object = { 'user': 'fred', 'age': 40 };\n\n_.isMatch(object, { 'age': 40 });\n// => true\n\n_.isMatch(object, { 'age': 36 });\n// => false\n
    \n
    \n
    \n\n
    " } + "html":"

    isMatch source npm

    \n
    _.isMatch(object, source)
    \n\n

    Performs a deep comparison between object and source to determine if\nobject contains equivalent property values.\n
    \n
    \n注意: This method supports comparing the same values as _.isEqual.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to inspect.

      \n
    2. \n
    3. source (Object)

      The object of property values to match.

      \n
    4. \n
    \n

    返回值 (boolean)

    \n

    Returns true if object is a match, else false.

    \n
    \n

    示例

    \n
    var object = { 'user': 'fred', 'age': 40 };\n\n_.isMatch(object, { 'age': 40 });\n// => true\n\n_.isMatch(object, { 'age': 36 });\n// => false\n
    \n
    \n
    \n\n
    " } ,{ "href":"/isMatchWith", - "html":"

    isMatchWith source npm

    \n
    _.isMatchWith(object, source, [customizer])
    \n\n

    This method is like _.isMatch except that it accepts customizer which\nis invoked to compare values. If customizer returns undefined comparisons\nare handled by the method instead. The customizer is invoked with three\narguments: (objValue, srcValue, index|key, object, source).

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to inspect.

      \n
    2. \n
    3. source (Object)

      The object of property values to match.

      \n
    4. \n
    5. [customizer] (Function)

      The function to customize comparisons.

      \n
    6. \n
    \n

    返回值 (boolean)

    \n

    Returns true if object is a match, else false.

    \n
    \n

    示例

    \n
    function isGreeting(value) {\n  return /^h(?:i|ello)$/.test(value);\n}\n\nfunction customizer(objValue, srcValue) {\n  if (isGreeting(objValue) && isGreeting(srcValue)) {\n    return true;\n  }\n}\n\nvar object = { 'greeting': 'hello' };\nvar source = { 'greeting': 'hi' };\n\n_.isMatchWith(object, source, customizer);\n// => true\n
    \n
    \n
    \n\n
    " } + "html":"

    isMatchWith source npm

    \n
    _.isMatchWith(object, source, [customizer])
    \n\n

    This method is like _.isMatch except that it accepts customizer which\nis invoked to compare values. If customizer returns undefined comparisons\nare handled by the method instead. The customizer is invoked with three\narguments: (objValue, srcValue, index|key, object, source).

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to inspect.

      \n
    2. \n
    3. source (Object)

      The object of property values to match.

      \n
    4. \n
    5. [customizer] (Function)

      The function to customize comparisons.

      \n
    6. \n
    \n

    返回值 (boolean)

    \n

    Returns true if object is a match, else false.

    \n
    \n

    示例

    \n
    function isGreeting(value) {\n  return /^h(?:i|ello)$/.test(value);\n}\n\nfunction customizer(objValue, srcValue) {\n  if (isGreeting(objValue) && isGreeting(srcValue)) {\n    return true;\n  }\n}\n\nvar object = { 'greeting': 'hello' };\nvar source = { 'greeting': 'hi' };\n\n_.isMatchWith(object, source, customizer);\n// => true\n
    \n
    \n
    \n\n
    " } ,{ "href":"/isNaN", - "html":"

    isNaN source npm

    \n
    _.isNaN(value)
    \n\n

    Checks if value is NaN.\n
    \n
    \n注意: This method is not the same as isNaN\nwhich returns true for undefined and other non-numeric values.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to check.

      \n
    2. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is NaN, else false.

    \n
    \n

    示例

    \n
    _.isNaN(NaN);\n// => true\n\n_.isNaN(new Number(NaN));\n// => true\n\nisNaN(undefined);\n// => true\n\n_.isNaN(undefined);\n// => false\n
    \n
    \n
    \n\n
    " } + "html":"

    isNaN source npm

    \n
    _.isNaN(value)
    \n\n

    Checks if value is NaN.\n
    \n
    \n注意: This method is not the same as isNaN\nwhich returns true for undefined and other non-numeric values.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to check.

      \n
    2. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is NaN, else false.

    \n
    \n

    示例

    \n
    _.isNaN(NaN);\n// => true\n\n_.isNaN(new Number(NaN));\n// => true\n\nisNaN(undefined);\n// => true\n\n_.isNaN(undefined);\n// => false\n
    \n
    \n
    \n\n
    " } ,{ "href":"/isNative", - "html":"

    isNative source npm

    \n
    _.isNative(value)
    \n\n

    Checks if value is a native function.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to check.

      \n
    2. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is a native function, else false.

    \n
    \n

    示例

    \n
    _.isNative(Array.prototype.push);\n// => true\n\n_.isNative(_);\n// => false\n
    \n
    \n
    \n\n
    " } + "html":"

    isNative source npm

    \n
    _.isNative(value)
    \n\n

    Checks if value is a native function.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to check.

      \n
    2. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is a native function, else false.

    \n
    \n

    示例

    \n
    _.isNative(Array.prototype.push);\n// => true\n\n_.isNative(_);\n// => false\n
    \n
    \n
    \n\n
    " } ,{ "href":"/isNil", - "html":"

    isNil source npm

    \n
    _.isNil(value)
    \n\n

    Checks if value is null or undefined.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to check.

      \n
    2. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is nullish, else false.

    \n
    \n

    示例

    \n
    _.isNil(null);\n// => true\n\n_.isNil(void 0);\n// => true\n\n_.isNil(NaN);\n// => false\n
    \n
    \n
    \n\n
    " } + "html":"

    isNil source npm

    \n
    _.isNil(value)
    \n\n

    Checks if value is null or undefined.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to check.

      \n
    2. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is nullish, else false.

    \n
    \n

    示例

    \n
    _.isNil(null);\n// => true\n\n_.isNil(void 0);\n// => true\n\n_.isNil(NaN);\n// => false\n
    \n
    \n
    \n\n
    " } ,{ "href":"/isNull", - "html":"

    isNull source npm

    \n
    _.isNull(value)
    \n\n

    Checks if value is null.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to check.

      \n
    2. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is null, else false.

    \n
    \n

    示例

    \n
    _.isNull(null);\n// => true\n\n_.isNull(void 0);\n// => false\n
    \n
    \n
    \n\n
    " } + "html":"

    isNull source npm

    \n
    _.isNull(value)
    \n\n

    Checks if value is null.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to check.

      \n
    2. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is null, else false.

    \n
    \n

    示例

    \n
    _.isNull(null);\n// => true\n\n_.isNull(void 0);\n// => false\n
    \n
    \n
    \n\n
    " } ,{ "href":"/isNumber", - "html":"

    isNumber source npm

    \n
    _.isNumber(value)
    \n\n

    Checks if value is classified as a Number primitive or object.\n
    \n
    \n注意: To exclude Infinity, -Infinity, and NaN, which are classified\nas numbers, use the _.isFinite method.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to check.

      \n
    2. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is correctly classified, else false.

    \n
    \n

    示例

    \n
    _.isNumber(3);\n// => true\n\n_.isNumber(Number.MIN_VALUE);\n// => true\n\n_.isNumber(Infinity);\n// => true\n\n_.isNumber('3');\n// => false\n
    \n
    \n
    \n\n
    " } + "html":"

    isNumber source npm

    \n
    _.isNumber(value)
    \n\n

    Checks if value is classified as a Number primitive or object.\n
    \n
    \n注意: To exclude Infinity, -Infinity, and NaN, which are classified\nas numbers, use the _.isFinite method.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to check.

      \n
    2. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is correctly classified, else false.

    \n
    \n

    示例

    \n
    _.isNumber(3);\n// => true\n\n_.isNumber(Number.MIN_VALUE);\n// => true\n\n_.isNumber(Infinity);\n// => true\n\n_.isNumber('3');\n// => false\n
    \n
    \n
    \n\n
    " } ,{ "href":"/isObject", - "html":"

    isObject source npm

    \n
    _.isObject(value)
    \n\n

    Checks if value is the language type of Object.\n(e.g. arrays, functions, objects, regexes, new Number(0), and new String(''))

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to check.

      \n
    2. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is an object, else false.

    \n
    \n

    示例

    \n
    _.isObject({});\n// => true\n\n_.isObject([1, 2, 3]);\n// => true\n\n_.isObject(_.noop);\n// => true\n\n_.isObject(null);\n// => false\n
    \n
    \n
    \n\n
    " } + "html":"

    isObject source npm

    \n
    _.isObject(value)
    \n\n

    Checks if value is the language type of Object.\n(e.g. arrays, functions, objects, regexes, new Number(0), and new String(''))

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to check.

      \n
    2. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is an object, else false.

    \n
    \n

    示例

    \n
    _.isObject({});\n// => true\n\n_.isObject([1, 2, 3]);\n// => true\n\n_.isObject(_.noop);\n// => true\n\n_.isObject(null);\n// => false\n
    \n
    \n
    \n\n
    " } ,{ "href":"/isObjectLike", - "html":"

    isObjectLike source npm

    \n
    _.isObjectLike(value)
    \n\n

    Checks if value is object-like. A value is object-like if it's not null\nand has a typeof result of "object".

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to check.

      \n
    2. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is object-like, else false.

    \n
    \n

    示例

    \n
    _.isObjectLike({});\n// => true\n\n_.isObjectLike([1, 2, 3]);\n// => true\n\n_.isObjectLike(_.noop);\n// => false\n\n_.isObjectLike(null);\n// => false\n
    \n
    \n
    \n\n
    " } + "html":"

    isObjectLike source npm

    \n
    _.isObjectLike(value)
    \n\n

    Checks if value is object-like. A value is object-like if it's not null\nand has a typeof result of "object".

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to check.

      \n
    2. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is object-like, else false.

    \n
    \n

    示例

    \n
    _.isObjectLike({});\n// => true\n\n_.isObjectLike([1, 2, 3]);\n// => true\n\n_.isObjectLike(_.noop);\n// => false\n\n_.isObjectLike(null);\n// => false\n
    \n
    \n
    \n\n
    " } ,{ "href":"/isPlainObject", - "html":"

    isPlainObject source npm

    \n
    _.isPlainObject(value)
    \n\n

    Checks if value is a plain object, that is, an object created by the\nObject constructor or one with a [[Prototype]] of null.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to check.

      \n
    2. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is a plain object, else false.

    \n
    \n

    示例

    \n
    function Foo() {\n  this.a = 1;\n}\n\n_.isPlainObject(new Foo);\n// => false\n\n_.isPlainObject([1, 2, 3]);\n// => false\n\n_.isPlainObject({ 'x': 0, 'y': 0 });\n// => true\n\n_.isPlainObject(Object.create(null));\n// => true\n
    \n
    \n
    \n\n
    " } + "html":"

    isPlainObject source npm

    \n
    _.isPlainObject(value)
    \n\n

    Checks if value is a plain object, that is, an object created by the\nObject constructor or one with a [[Prototype]] of null.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to check.

      \n
    2. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is a plain object, else false.

    \n
    \n

    示例

    \n
    function Foo() {\n  this.a = 1;\n}\n\n_.isPlainObject(new Foo);\n// => false\n\n_.isPlainObject([1, 2, 3]);\n// => false\n\n_.isPlainObject({ 'x': 0, 'y': 0 });\n// => true\n\n_.isPlainObject(Object.create(null));\n// => true\n
    \n
    \n
    \n\n
    " } ,{ "href":"/isRegExp", - "html":"

    isRegExp source npm

    \n
    _.isRegExp(value)
    \n\n

    Checks if value is classified as a RegExp object.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to check.

      \n
    2. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is correctly classified, else false.

    \n
    \n

    示例

    \n
    _.isRegExp(/abc/);\n// => true\n\n_.isRegExp('/abc/');\n// => false\n
    \n
    \n
    \n\n
    " } + "html":"

    isRegExp source npm

    \n
    _.isRegExp(value)
    \n\n

    Checks if value is classified as a RegExp object.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to check.

      \n
    2. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is correctly classified, else false.

    \n
    \n

    示例

    \n
    _.isRegExp(/abc/);\n// => true\n\n_.isRegExp('/abc/');\n// => false\n
    \n
    \n
    \n\n
    " } ,{ "href":"/isSafeInteger", - "html":"

    isSafeInteger source npm

    \n
    _.isSafeInteger(value)
    \n\n

    Checks if value is a safe integer. An integer is safe if it's an IEEE-754\ndouble precision number which isn't the result of a rounded unsafe integer.\n
    \n
    \n注意: This method is based on Number.isSafeInteger.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to check.

      \n
    2. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is a safe integer, else false.

    \n
    \n

    示例

    \n
    _.isSafeInteger(3);\n// => true\n\n_.isSafeInteger(Number.MIN_VALUE);\n// => false\n\n_.isSafeInteger(Infinity);\n// => false\n\n_.isSafeInteger('3');\n// => false\n
    \n
    \n
    \n\n
    " } + "html":"

    isSafeInteger source npm

    \n
    _.isSafeInteger(value)
    \n\n

    Checks if value is a safe integer. An integer is safe if it's an IEEE-754\ndouble precision number which isn't the result of a rounded unsafe integer.\n
    \n
    \n注意: This method is based on Number.isSafeInteger.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to check.

      \n
    2. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is a safe integer, else false.

    \n
    \n

    示例

    \n
    _.isSafeInteger(3);\n// => true\n\n_.isSafeInteger(Number.MIN_VALUE);\n// => false\n\n_.isSafeInteger(Infinity);\n// => false\n\n_.isSafeInteger('3');\n// => false\n
    \n
    \n
    \n\n
    " } ,{ "href":"/isString", - "html":"

    isString source npm

    \n
    _.isString(value)
    \n\n

    Checks if value is classified as a String primitive or object.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to check.

      \n
    2. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is correctly classified, else false.

    \n
    \n

    示例

    \n
    _.isString('abc');\n// => true\n\n_.isString(1);\n// => false\n
    \n
    \n
    \n\n
    " } + "html":"

    isString source npm

    \n
    _.isString(value)
    \n\n

    Checks if value is classified as a String primitive or object.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to check.

      \n
    2. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is correctly classified, else false.

    \n
    \n

    示例

    \n
    _.isString('abc');\n// => true\n\n_.isString(1);\n// => false\n
    \n
    \n
    \n\n
    " } ,{ "href":"/isSymbol", - "html":"

    isSymbol source npm

    \n
    _.isSymbol(value)
    \n\n

    Checks if value is classified as a Symbol primitive or object.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to check.

      \n
    2. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is correctly classified, else false.

    \n
    \n

    示例

    \n
    _.isSymbol(Symbol.iterator);\n// => true\n\n_.isSymbol('abc');\n// => false\n
    \n
    \n
    \n\n
    " } + "html":"

    isSymbol source npm

    \n
    _.isSymbol(value)
    \n\n

    Checks if value is classified as a Symbol primitive or object.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to check.

      \n
    2. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is correctly classified, else false.

    \n
    \n

    示例

    \n
    _.isSymbol(Symbol.iterator);\n// => true\n\n_.isSymbol('abc');\n// => false\n
    \n
    \n
    \n\n
    " } ,{ "href":"/isTypedArray", - "html":"

    isTypedArray source npm

    \n
    _.isTypedArray(value)
    \n\n

    Checks if value is classified as a typed array.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to check.

      \n
    2. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is correctly classified, else false.

    \n
    \n

    示例

    \n
    _.isTypedArray(new Uint8Array);\n// => true\n\n_.isTypedArray([]);\n// => false\n
    \n
    \n
    \n\n
    " } + "html":"

    isTypedArray source npm

    \n
    _.isTypedArray(value)
    \n\n

    Checks if value is classified as a typed array.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to check.

      \n
    2. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is correctly classified, else false.

    \n
    \n

    示例

    \n
    _.isTypedArray(new Uint8Array);\n// => true\n\n_.isTypedArray([]);\n// => false\n
    \n
    \n
    \n\n
    " } ,{ "href":"/isUndefined", - "html":"

    isUndefined source npm

    \n
    _.isUndefined(value)
    \n\n

    Checks if value is undefined.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to check.

      \n
    2. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is undefined, else false.

    \n
    \n

    示例

    \n
    _.isUndefined(void 0);\n// => true\n\n_.isUndefined(null);\n// => false\n
    \n
    \n
    \n\n
    " } + "html":"

    isUndefined source npm

    \n
    _.isUndefined(value)
    \n\n

    Checks if value is undefined.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to check.

      \n
    2. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is undefined, else false.

    \n
    \n

    示例

    \n
    _.isUndefined(void 0);\n// => true\n\n_.isUndefined(null);\n// => false\n
    \n
    \n
    \n\n
    " } ,{ "href":"/lt", - "html":"

    lt source npm

    \n
    _.lt(value, other)
    \n\n

    Checks if value is less than other.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to compare.

      \n
    2. \n
    3. other (*)

      The other value to compare.

      \n
    4. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is less than other, else false.

    \n
    \n

    示例

    \n
    _.lt(1, 3);\n// => true\n\n_.lt(3, 3);\n// => false\n\n_.lt(3, 1);\n// => false\n
    \n
    \n
    \n\n
    " } + "html":"

    lt source npm

    \n
    _.lt(value, other)
    \n\n

    Checks if value is less than other.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to compare.

      \n
    2. \n
    3. other (*)

      The other value to compare.

      \n
    4. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is less than other, else false.

    \n
    \n

    示例

    \n
    _.lt(1, 3);\n// => true\n\n_.lt(3, 3);\n// => false\n\n_.lt(3, 1);\n// => false\n
    \n
    \n
    \n\n
    " } ,{ "href":"/lte", - "html":"

    lte source npm

    \n
    _.lte(value, other)
    \n\n

    Checks if value is less than or equal to other.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to compare.

      \n
    2. \n
    3. other (*)

      The other value to compare.

      \n
    4. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is less than or equal to other, else false.

    \n
    \n

    示例

    \n
    _.lte(1, 3);\n// => true\n\n_.lte(3, 3);\n// => true\n\n_.lte(3, 1);\n// => false\n
    \n
    \n
    \n\n
    " } + "html":"

    lte source npm

    \n
    _.lte(value, other)
    \n\n

    Checks if value is less than or equal to other.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to compare.

      \n
    2. \n
    3. other (*)

      The other value to compare.

      \n
    4. \n
    \n

    返回值 (boolean)

    \n

    Returns true if value is less than or equal to other, else false.

    \n
    \n

    示例

    \n
    _.lte(1, 3);\n// => true\n\n_.lte(3, 3);\n// => true\n\n_.lte(3, 1);\n// => false\n
    \n
    \n
    \n\n
    " } ,{ "href":"/toArray", - "html":"

    toArray source npm

    \n
    _.toArray(value)
    \n\n

    Converts value to an array.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to convert.

      \n
    2. \n
    \n

    返回值 (Array)

    \n

    Returns the converted array.

    \n
    \n

    示例

    \n
    (function() {\n  return _.toArray(arguments).slice(1);\n}(1, 2, 3));\n// => [2, 3]\n
    \n
    \n
    \n\n
    " } + "html":"

    toArray source npm

    \n
    _.toArray(value)
    \n\n

    Converts value to an array.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to convert.

      \n
    2. \n
    \n

    返回值 (Array)

    \n

    Returns the converted array.

    \n
    \n

    示例

    \n
    (function() {\n  return _.toArray(arguments).slice(1);\n}(1, 2, 3));\n// => [2, 3]\n
    \n
    \n
    \n\n
    " } ,{ "href":"/toInteger", - "html":"

    toInteger source npm

    \n
    _.toInteger(value)
    \n\n

    Converts value to an integer.\n
    \n
    \n注意: This function is loosely based on ToInteger.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to convert.

      \n
    2. \n
    \n

    返回值 (number)

    \n

    Returns the converted integer.

    \n
    \n

    示例

    \n
    _.toInteger(3);\n// => 3\n\n_.toInteger(Number.MIN_VALUE);\n// => 0\n\n_.toInteger(Infinity);\n// => 1.7976931348623157e+308\n\n_.toInteger('3');\n// => 3\n
    \n
    \n
    \n\n
    " } + "html":"

    toInteger source npm

    \n
    _.toInteger(value)
    \n\n

    Converts value to an integer.\n
    \n
    \n注意: This function is loosely based on ToInteger.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to convert.

      \n
    2. \n
    \n

    返回值 (number)

    \n

    Returns the converted integer.

    \n
    \n

    示例

    \n
    _.toInteger(3);\n// => 3\n\n_.toInteger(Number.MIN_VALUE);\n// => 0\n\n_.toInteger(Infinity);\n// => 1.7976931348623157e+308\n\n_.toInteger('3');\n// => 3\n
    \n
    \n
    \n\n
    " } ,{ "href":"/toLength", - "html":"

    toLength source npm

    \n
    _.toLength(value)
    \n\n

    Converts value to an integer suitable for use as the length of an\narray-like object.\n
    \n
    \n注意: This method is based on ToLength.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to convert.

      \n
    2. \n
    \n

    示例

    \n
    _.toLength(3);\n// => 3\n\n_.toLength(Number.MIN_VALUE);\n// => 0\n\n_.toLength(Infinity);\n// => 4294967295\n\n_.toLength('3');\n// => 3\n
    \n
    \n
    \n\n
    " } + "html":"

    toLength source npm

    \n
    _.toLength(value)
    \n\n

    Converts value to an integer suitable for use as the length of an\narray-like object.\n
    \n
    \n注意: This method is based on ToLength.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to convert.

      \n
    2. \n
    \n

    示例

    \n
    _.toLength(3);\n// => 3\n\n_.toLength(Number.MIN_VALUE);\n// => 0\n\n_.toLength(Infinity);\n// => 4294967295\n\n_.toLength('3');\n// => 3\n
    \n
    \n
    \n\n
    " } ,{ "href":"/toNumber", - "html":"

    toNumber source npm

    \n
    _.toNumber(value)
    \n\n

    Converts value to a number.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to process.

      \n
    2. \n
    \n

    返回值 (number)

    \n

    Returns the number.

    \n
    \n

    示例

    \n
    _.toNumber(3);\n// => 3\n\n_.toNumber(Number.MIN_VALUE);\n// => 5e-324\n\n_.toNumber(Infinity);\n// => Infinity\n\n_.toNumber('3');\n// => 3\n
    \n
    \n
    \n\n
    " } + "html":"

    toNumber source npm

    \n
    _.toNumber(value)
    \n\n

    Converts value to a number.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to process.

      \n
    2. \n
    \n

    返回值 (number)

    \n

    Returns the number.

    \n
    \n

    示例

    \n
    _.toNumber(3);\n// => 3\n\n_.toNumber(Number.MIN_VALUE);\n// => 5e-324\n\n_.toNumber(Infinity);\n// => Infinity\n\n_.toNumber('3');\n// => 3\n
    \n
    \n
    \n\n
    " } ,{ "href":"/toPlainObject", - "html":"

    toPlainObject source npm

    \n
    _.toPlainObject(value)
    \n\n

    Converts value to a plain object flattening inherited enumerable\nproperties of value to own properties of the plain object.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to convert.

      \n
    2. \n
    \n

    返回值 (Object)

    \n

    Returns the converted plain object.

    \n
    \n

    示例

    \n
    function Foo() {\n  this.b = 2;\n}\n\nFoo.prototype.c = 3;\n\n_.assign({ 'a': 1 }, new Foo);\n// => { 'a': 1, 'b': 2 }\n\n_.assign({ 'a': 1 }, _.toPlainObject(new Foo));\n// => { 'a': 1, 'b': 2, 'c': 3 }\n
    \n
    \n
    \n\n
    " } + "html":"

    toPlainObject source npm

    \n
    _.toPlainObject(value)
    \n\n

    Converts value to a plain object flattening inherited enumerable\nproperties of value to own properties of the plain object.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to convert.

      \n
    2. \n
    \n

    返回值 (Object)

    \n

    Returns the converted plain object.

    \n
    \n

    示例

    \n
    function Foo() {\n  this.b = 2;\n}\n\nFoo.prototype.c = 3;\n\n_.assign({ 'a': 1 }, new Foo);\n// => { 'a': 1, 'b': 2 }\n\n_.assign({ 'a': 1 }, _.toPlainObject(new Foo));\n// => { 'a': 1, 'b': 2, 'c': 3 }\n
    \n
    \n
    \n\n
    " } ,{ "href":"/toSafeInteger", - "html":"

    toSafeInteger source npm

    \n
    _.toSafeInteger(value)
    \n\n

    Converts value to a safe integer. A safe integer can be compared and\nrepresented correctly.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to convert.

      \n
    2. \n
    \n

    返回值 (number)

    \n

    Returns the converted integer.

    \n
    \n

    示例

    \n
    _.toSafeInteger(3);\n// => 3\n\n_.toSafeInteger(Number.MIN_VALUE);\n// => 0\n\n_.toSafeInteger(Infinity);\n// => 9007199254740991\n\n_.toSafeInteger('3');\n// => 3\n
    \n
    \n
    \n\n
    " } + "html":"

    toSafeInteger source npm

    \n
    _.toSafeInteger(value)
    \n\n

    Converts value to a safe integer. A safe integer can be compared and\nrepresented correctly.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to convert.

      \n
    2. \n
    \n

    返回值 (number)

    \n

    Returns the converted integer.

    \n
    \n

    示例

    \n
    _.toSafeInteger(3);\n// => 3\n\n_.toSafeInteger(Number.MIN_VALUE);\n// => 0\n\n_.toSafeInteger(Infinity);\n// => 9007199254740991\n\n_.toSafeInteger('3');\n// => 3\n
    \n
    \n
    \n\n
    " } ,{ "href":"/toString", - "html":"

    toString source npm

    \n
    _.toString(value)
    \n\n

    Converts value to a string if it's not one. An empty string is returned\nfor null and undefined values. The sign of -0 is preserved.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to process.

      \n
    2. \n
    \n

    返回值 (string)

    \n

    Returns the string.

    \n
    \n

    示例

    \n
    _.toString(null);\n// => ''\n\n_.toString(-0);\n// => '-0'\n\n_.toString([1, 2, 3]);\n// => '1,2,3'\n
    \n
    \n
    \n\n
    " } + "html":"

    toString source npm

    \n
    _.toString(value)
    \n\n

    Converts value to a string if it's not one. An empty string is returned\nfor null and undefined values. The sign of -0 is preserved.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to process.

      \n
    2. \n
    \n

    返回值 (string)

    \n

    Returns the string.

    \n
    \n

    示例

    \n
    _.toString(null);\n// => ''\n\n_.toString(-0);\n// => '-0'\n\n_.toString([1, 2, 3]);\n// => '1,2,3'\n
    \n
    \n
    \n\n
    " } ,{ "href":"/add", - "html":"

    add source npm

    \n
    _.add(augend, addend)
    \n\n

    Adds two numbers.

    \n
    \n\n

    参数

    \n
      \n
    1. augend (number)

      The first number in an addition.

      \n
    2. \n
    3. addend (number)

      The second number in an addition.

      \n
    4. \n
    \n

    返回值 (number)

    \n

    Returns the total.

    \n
    \n

    示例

    \n
    _.add(6, 4);\n// => 10\n
    \n
    \n
    \n\n
    " } + "html":"

    add source npm

    \n
    _.add(augend, addend)
    \n\n

    Adds two numbers.

    \n
    \n\n

    参数

    \n
      \n
    1. augend (number)

      The first number in an addition.

      \n
    2. \n
    3. addend (number)

      The second number in an addition.

      \n
    4. \n
    \n

    返回值 (number)

    \n

    Returns the total.

    \n
    \n

    示例

    \n
    _.add(6, 4);\n// => 10\n
    \n
    \n
    \n\n
    " } ,{ "href":"/ceil", - "html":"

    ceil source npm

    \n
    _.ceil(number, [precision=0])
    \n\n

    Computes number rounded up to precision.

    \n
    \n\n

    参数

    \n
      \n
    1. number (number)

      The number to round up.

      \n
    2. \n
    3. [precision=0] (number)

      The precision to round up to.

      \n
    4. \n
    \n

    返回值 (number)

    \n

    Returns the rounded up number.

    \n
    \n

    示例

    \n
    _.ceil(4.006);\n// => 5\n\n_.ceil(6.004, 2);\n// => 6.01\n\n_.ceil(6040, -2);\n// => 6100\n
    \n
    \n
    \n\n
    " } + "html":"

    ceil source npm

    \n
    _.ceil(number, [precision=0])
    \n\n

    Computes number rounded up to precision.

    \n
    \n\n

    参数

    \n
      \n
    1. number (number)

      The number to round up.

      \n
    2. \n
    3. [precision=0] (number)

      The precision to round up to.

      \n
    4. \n
    \n

    返回值 (number)

    \n

    Returns the rounded up number.

    \n
    \n

    示例

    \n
    _.ceil(4.006);\n// => 5\n\n_.ceil(6.004, 2);\n// => 6.01\n\n_.ceil(6040, -2);\n// => 6100\n
    \n
    \n
    \n\n
    " } ,{ "href":"/floor", - "html":"

    floor source npm

    \n
    _.floor(number, [precision=0])
    \n\n

    Computes number rounded down to precision.

    \n
    \n\n

    参数

    \n
      \n
    1. number (number)

      The number to round down.

      \n
    2. \n
    3. [precision=0] (number)

      The precision to round down to.

      \n
    4. \n
    \n

    返回值 (number)

    \n

    Returns the rounded down number.

    \n
    \n

    示例

    \n
    _.floor(4.006);\n// => 4\n\n_.floor(0.046, 2);\n// => 0.04\n\n_.floor(4060, -2);\n// => 4000\n
    \n
    \n
    \n\n
    " } + "html":"

    floor source npm

    \n
    _.floor(number, [precision=0])
    \n\n

    Computes number rounded down to precision.

    \n
    \n\n

    参数

    \n
      \n
    1. number (number)

      The number to round down.

      \n
    2. \n
    3. [precision=0] (number)

      The precision to round down to.

      \n
    4. \n
    \n

    返回值 (number)

    \n

    Returns the rounded down number.

    \n
    \n

    示例

    \n
    _.floor(4.006);\n// => 4\n\n_.floor(0.046, 2);\n// => 0.04\n\n_.floor(4060, -2);\n// => 4000\n
    \n
    \n
    \n\n
    " } ,{ "href":"/max", - "html":"

    max source npm

    \n
    _.max(array)
    \n\n

    Computes the maximum value of array. If array is empty or falsey\nundefined is returned.

    \n
    \n\n

    参数

    \n
      \n
    1. array (Array)

      The array to iterate over.

      \n
    2. \n
    \n

    返回值 (*)

    \n

    Returns the maximum value.

    \n
    \n

    示例

    \n
    _.max([4, 2, 8, 6]);\n// => 8\n\n_.max([]);\n// => undefined\n
    \n
    \n
    \n\n
    " } + "html":"

    max source npm

    \n
    _.max(array)
    \n\n

    Computes the maximum value of array. If array is empty or falsey\nundefined is returned.

    \n
    \n\n

    参数

    \n
      \n
    1. array (Array)

      The array to iterate over.

      \n
    2. \n
    \n

    返回值 (*)

    \n

    Returns the maximum value.

    \n
    \n

    示例

    \n
    _.max([4, 2, 8, 6]);\n// => 8\n\n_.max([]);\n// => undefined\n
    \n
    \n
    \n\n
    " } ,{ "href":"/maxBy", - "html":"

    maxBy source npm

    \n
    _.maxBy(array, [iteratee=_.identity])
    \n\n

    This method is like _.max except that it accepts iteratee which is\ninvoked for each element in array to generate the criterion by which\nthe value is ranked. The iteratee is invoked with one argument: (value).

    \n
    \n\n

    参数

    \n
      \n
    1. array (Array)

      The array to iterate over.

      \n
    2. \n
    3. [iteratee=_.identity] (Function|Object|string)

      这个函数会调用每一个元素

      \n
    4. \n
    \n

    返回值 (*)

    \n

    Returns the maximum value.

    \n
    \n

    示例

    \n
    var users = [\n  { 'user': 'barney', 'age': 36 },\n  { 'user': 'fred',   'age': 40 }\n];\n\n_.maxBy(users, function(o) { return o.age; });\n// => { 'user': 'fred', 'age': 40 }\n\n// 使用了 `_.property` 的回调结果\n_.maxBy(users, 'age');\n// => { 'user': 'fred', 'age': 40 }\n
    \n
    \n
    \n\n
    " } + "html":"

    maxBy source npm

    \n
    _.maxBy(array, [iteratee=_.identity])
    \n\n

    This method is like _.max except that it accepts iteratee which is\ninvoked for each element in array to generate the criterion by which\nthe value is ranked. The iteratee 会传入1个参数:(value)。

    \n
    \n\n

    参数

    \n
      \n
    1. array (Array)

      The array to iterate over.

      \n
    2. \n
    3. [iteratee=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

      \n
    4. \n
    \n

    返回值 (*)

    \n

    Returns the maximum value.

    \n
    \n

    示例

    \n
    var users = [\n  { 'user': 'barney', 'age': 36 },\n  { 'user': 'fred',   'age': 40 }\n];\n\n_.maxBy(users, function(o) { return o.age; });\n// => { 'user': 'fred', 'age': 40 }\n\n// 使用了 `_.property` 的回调结果\n_.maxBy(users, 'age');\n// => { 'user': 'fred', 'age': 40 }\n
    \n
    \n
    \n\n
    " } ,{ "href":"/mean", - "html":"

    mean source npm

    \n
    _.mean(array)
    \n\n

    Computes the mean of the values in array.

    \n
    \n\n

    参数

    \n
      \n
    1. array (Array)

      The array to iterate over.

      \n
    2. \n
    \n

    返回值 (number)

    \n

    Returns the mean.

    \n
    \n

    示例

    \n
    _.mean([4, 2, 8, 6]);\n// => 5\n
    \n
    \n
    \n\n
    " } + "html":"

    mean source npm

    \n
    _.mean(array)
    \n\n

    Computes the mean of the values in array.

    \n
    \n\n

    参数

    \n
      \n
    1. array (Array)

      The array to iterate over.

      \n
    2. \n
    \n

    返回值 (number)

    \n

    Returns the mean.

    \n
    \n

    示例

    \n
    _.mean([4, 2, 8, 6]);\n// => 5\n
    \n
    \n
    \n\n
    " } ,{ "href":"/min", - "html":"

    min source npm

    \n
    _.min(array)
    \n\n

    Computes the minimum value of array. If array is empty or falsey\nundefined is returned.

    \n
    \n\n

    参数

    \n
      \n
    1. array (Array)

      The array to iterate over.

      \n
    2. \n
    \n

    返回值 (*)

    \n

    Returns the minimum value.

    \n
    \n

    示例

    \n
    _.min([4, 2, 8, 6]);\n// => 2\n\n_.min([]);\n// => undefined\n
    \n
    \n
    \n\n
    " } + "html":"

    min source npm

    \n
    _.min(array)
    \n\n

    Computes the minimum value of array. If array is empty or falsey\nundefined is returned.

    \n
    \n\n

    参数

    \n
      \n
    1. array (Array)

      The array to iterate over.

      \n
    2. \n
    \n

    返回值 (*)

    \n

    Returns the minimum value.

    \n
    \n

    示例

    \n
    _.min([4, 2, 8, 6]);\n// => 2\n\n_.min([]);\n// => undefined\n
    \n
    \n
    \n\n
    " } ,{ "href":"/minBy", - "html":"

    minBy source npm

    \n
    _.minBy(array, [iteratee=_.identity])
    \n\n

    This method is like _.min except that it accepts iteratee which is\ninvoked for each element in array to generate the criterion by which\nthe value is ranked. The iteratee is invoked with one argument: (value).

    \n
    \n\n

    参数

    \n
      \n
    1. array (Array)

      The array to iterate over.

      \n
    2. \n
    3. [iteratee=_.identity] (Function|Object|string)

      这个函数会调用每一个元素

      \n
    4. \n
    \n

    返回值 (*)

    \n

    Returns the minimum value.

    \n
    \n

    示例

    \n
    var users = [\n  { 'user': 'barney', 'age': 36 },\n  { 'user': 'fred',   'age': 40 }\n];\n\n_.minBy(users, function(o) { return o.age; });\n// => { 'user': 'barney', 'age': 36 }\n\n// 使用了 `_.property` 的回调结果\n_.minBy(users, 'age');\n// => { 'user': 'barney', 'age': 36 }\n
    \n
    \n
    \n\n
    " } + "html":"

    minBy source npm

    \n
    _.minBy(array, [iteratee=_.identity])
    \n\n

    This method is like _.min except that it accepts iteratee which is\ninvoked for each element in array to generate the criterion by which\nthe value is ranked. The iteratee 会传入1个参数:(value)。

    \n
    \n\n

    参数

    \n
      \n
    1. array (Array)

      The array to iterate over.

      \n
    2. \n
    3. [iteratee=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

      \n
    4. \n
    \n

    返回值 (*)

    \n

    Returns the minimum value.

    \n
    \n

    示例

    \n
    var users = [\n  { 'user': 'barney', 'age': 36 },\n  { 'user': 'fred',   'age': 40 }\n];\n\n_.minBy(users, function(o) { return o.age; });\n// => { 'user': 'barney', 'age': 36 }\n\n// 使用了 `_.property` 的回调结果\n_.minBy(users, 'age');\n// => { 'user': 'barney', 'age': 36 }\n
    \n
    \n
    \n\n
    " } ,{ "href":"/round", - "html":"

    round source npm

    \n
    _.round(number, [precision=0])
    \n\n

    Computes number rounded to precision.

    \n
    \n\n

    参数

    \n
      \n
    1. number (number)

      The number to round.

      \n
    2. \n
    3. [precision=0] (number)

      The precision to round to.

      \n
    4. \n
    \n

    返回值 (number)

    \n

    Returns the rounded number.

    \n
    \n

    示例

    \n
    _.round(4.006);\n// => 4\n\n_.round(4.006, 2);\n// => 4.01\n\n_.round(4060, -2);\n// => 4100\n
    \n
    \n
    \n\n
    " } + "html":"

    round source npm

    \n
    _.round(number, [precision=0])
    \n\n

    Computes number rounded to precision.

    \n
    \n\n

    参数

    \n
      \n
    1. number (number)

      The number to round.

      \n
    2. \n
    3. [precision=0] (number)

      The precision to round to.

      \n
    4. \n
    \n

    返回值 (number)

    \n

    Returns the rounded number.

    \n
    \n

    示例

    \n
    _.round(4.006);\n// => 4\n\n_.round(4.006, 2);\n// => 4.01\n\n_.round(4060, -2);\n// => 4100\n
    \n
    \n
    \n\n
    " } ,{ "href":"/subtract", - "html":"

    subtract source npm

    \n
    _.subtract(minuend, subtrahend)
    \n\n

    Subtract two numbers.

    \n
    \n\n

    参数

    \n
      \n
    1. minuend (number)

      The first number in a subtraction.

      \n
    2. \n
    3. subtrahend (number)

      The second number in a subtraction.

      \n
    4. \n
    \n

    返回值 (number)

    \n

    Returns the difference.

    \n
    \n

    示例

    \n
    _.subtract(6, 4);\n// => 2\n
    \n
    \n
    \n\n
    " } + "html":"

    subtract source npm

    \n
    _.subtract(minuend, subtrahend)
    \n\n

    Subtract two numbers.

    \n
    \n\n

    参数

    \n
      \n
    1. minuend (number)

      The first number in a subtraction.

      \n
    2. \n
    3. subtrahend (number)

      The second number in a subtraction.

      \n
    4. \n
    \n

    返回值 (number)

    \n

    Returns the difference.

    \n
    \n

    示例

    \n
    _.subtract(6, 4);\n// => 2\n
    \n
    \n
    \n\n
    " } ,{ "href":"/sum", - "html":"

    sum source npm

    \n
    _.sum(array)
    \n\n

    Computes the sum of the values in array.

    \n
    \n\n

    参数

    \n
      \n
    1. array (Array)

      The array to iterate over.

      \n
    2. \n
    \n

    返回值 (number)

    \n

    Returns the sum.

    \n
    \n

    示例

    \n
    _.sum([4, 2, 8, 6]);\n// => 20\n
    \n
    \n
    \n\n
    " } + "html":"

    sum source npm

    \n
    _.sum(array)
    \n\n

    Computes the sum of the values in array.

    \n
    \n\n

    参数

    \n
      \n
    1. array (Array)

      The array to iterate over.

      \n
    2. \n
    \n

    返回值 (number)

    \n

    Returns the sum.

    \n
    \n

    示例

    \n
    _.sum([4, 2, 8, 6]);\n// => 20\n
    \n
    \n
    \n\n
    " } ,{ "href":"/sumBy", - "html":"

    sumBy source npm

    \n
    _.sumBy(array, [iteratee=_.identity])
    \n\n

    This method is like _.sum except that it accepts iteratee which is\ninvoked for each element in array to generate the value to be summed.\nThe iteratee is invoked with one argument: (value).

    \n
    \n\n

    参数

    \n
      \n
    1. array (Array)

      The array to iterate over.

      \n
    2. \n
    3. [iteratee=_.identity] (Function|Object|string)

      这个函数会调用每一个元素

      \n
    4. \n
    \n

    返回值 (number)

    \n

    Returns the sum.

    \n
    \n

    示例

    \n
    var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];\n\n_.sumBy(objects, function(o) { return o.n; });\n// => 20\n\n// 使用了 `_.property` 的回调结果\n_.sumBy(objects, 'n');\n// => 20\n
    \n
    \n
    \n\n
    " } + "html":"

    sumBy source npm

    \n
    _.sumBy(array, [iteratee=_.identity])
    \n\n

    This method is like _.sum except that it accepts iteratee which is\ninvoked for each element in array to generate the value to be summed.\nThe iteratee 会传入1个参数:(value)。

    \n
    \n\n

    参数

    \n
      \n
    1. array (Array)

      The array to iterate over.

      \n
    2. \n
    3. [iteratee=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

      \n
    4. \n
    \n

    返回值 (number)

    \n

    Returns the sum.

    \n
    \n

    示例

    \n
    var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];\n\n_.sumBy(objects, function(o) { return o.n; });\n// => 20\n\n// 使用了 `_.property` 的回调结果\n_.sumBy(objects, 'n');\n// => 20\n
    \n
    \n
    \n\n
    " } ,{ "href":"/stringSize", "html":"

    stringSize source

    \n
    stringSize(string)
    \n\n

    Gets the number of symbols in string.

    \n
    \n\n

    参数

    \n
      \n
    1. string (string)

      The string to inspect.

      \n
    2. \n
    \n

    返回值 (number)

    \n

    Returns the string size.

    \n
    \n
    \n\n
    " } ,{ "href":"/templateSettings-imports-_", "html":"

    templateSettings.imports._ source

    \n
    _.templateSettings.imports._
    \n\n

    A reference to the lodash function.

    \n
    \n\n
    \n\n
    " } ,{ "href":"/clamp", - "html":"

    clamp source npm

    \n
    _.clamp(number, [min], max)
    \n\n

    Returns a number whose value is limited to the given range specified\nby min and max.

    \n
    \n\n

    参数

    \n
      \n
    1. number (number)

      The number whose value is to be limited.

      \n
    2. \n
    3. [min] (number)

      The minimum possible value.

      \n
    4. \n
    5. max (number)

      The maximum possible value.

      \n
    6. \n
    \n

    返回值 (number)

    \n

    A number in the range [min, max].

    \n
    \n

    示例

    \n
    _.clamp(-10, -5, 5);\n// => -5\n\n_.clamp(10, -5, 5);\n// => 5\n
    \n
    \n
    \n\n
    " } + "html":"

    clamp source npm

    \n
    _.clamp(number, [min], max)
    \n\n

    Returns a number whose value is limited to the given range specified\nby min and max.

    \n
    \n\n

    参数

    \n
      \n
    1. number (number)

      The number whose value is to be limited.

      \n
    2. \n
    3. [min] (number)

      The minimum possible value.

      \n
    4. \n
    5. max (number)

      The maximum possible value.

      \n
    6. \n
    \n

    返回值 (number)

    \n

    A number in the range [min, max].

    \n
    \n

    示例

    \n
    _.clamp(-10, -5, 5);\n// => -5\n\n_.clamp(10, -5, 5);\n// => 5\n
    \n
    \n
    \n\n
    " } ,{ "href":"/inRange", - "html":"

    inRange source npm

    \n
    _.inRange(number, [start=0], end)
    \n\n

    Checks if n is between start and up to but not including, end. If\nend is not specified it's set to start with start then set to 0.\nIf start is greater than end the params are swapped to support\nnegative ranges.

    \n
    \n\n

    参数

    \n
      \n
    1. number (number)

      The number to check.

      \n
    2. \n
    3. [start=0] (number)

      The start of the range.

      \n
    4. \n
    5. end (number)

      The end of the range.

      \n
    6. \n
    \n

    返回值 (boolean)

    \n

    Returns true if number is in the range, else false.

    \n
    \n

    示例

    \n
    _.inRange(3, 2, 4);\n// => true\n\n_.inRange(4, 8);\n// => true\n\n_.inRange(4, 2);\n// => false\n\n_.inRange(2, 2);\n// => false\n\n_.inRange(1.2, 2);\n// => true\n\n_.inRange(5.2, 4);\n// => false\n\n_.inRange(-3, -2, -6);\n// => true\n
    \n
    \n
    \n\n
    " } + "html":"

    inRange source npm

    \n
    _.inRange(number, [start=0], end)
    \n\n

    Checks if n is between start and up to but not including, end. If\nend is not specified it's set to start with start then set to 0.\nIf start is greater than end the params are swapped to support\nnegative ranges.

    \n
    \n\n

    参数

    \n
      \n
    1. number (number)

      The number to check.

      \n
    2. \n
    3. [start=0] (number)

      The start of the range.

      \n
    4. \n
    5. end (number)

      The end of the range.

      \n
    6. \n
    \n

    返回值 (boolean)

    \n

    Returns true if number is in the range, else false.

    \n
    \n

    示例

    \n
    _.inRange(3, 2, 4);\n// => true\n\n_.inRange(4, 8);\n// => true\n\n_.inRange(4, 2);\n// => false\n\n_.inRange(2, 2);\n// => false\n\n_.inRange(1.2, 2);\n// => true\n\n_.inRange(5.2, 4);\n// => false\n\n_.inRange(-3, -2, -6);\n// => true\n
    \n
    \n
    \n\n
    " } ,{ "href":"/random", - "html":"

    random source npm

    \n
    _.random([min=0], [max=1], [floating])
    \n\n

    Produces a random number between min and max (inclusive). If only one\nargument is provided a number between 0 and the given number is returned.\nIf floating is true, or either min or max are floats, a\nfloating-point number is returned instead of an integer.\n
    \n
    \n注意: JavaScript follows the IEEE-754 standard for resolving\nfloating-point values which can produce unexpected results.

    \n
    \n\n

    参数

    \n
      \n
    1. [min=0] (number)

      The minimum possible value.

      \n
    2. \n
    3. [max=1] (number)

      The maximum possible value.

      \n
    4. \n
    5. [floating] (boolean)

      Specify returning a floating-point number.

      \n
    6. \n
    \n

    返回值 (number)

    \n

    Returns the random number.

    \n
    \n

    示例

    \n
    _.random(0, 5);\n// => an integer between 0 and 5\n\n_.random(5);\n// => also an integer between 0 and 5\n\n_.random(5, true);\n// => a floating-point number between 0 and 5\n\n_.random(1.2, 5.2);\n// => a floating-point number between 1.2 and 5.2\n
    \n
    \n
    \n\n
    " } + "html":"

    random source npm

    \n
    _.random([min=0], [max=1], [floating])
    \n\n

    Produces a random number between min and max (inclusive). If only one\nargument is provided a number between 0 and the given number is returned.\nIf floating is true, or either min or max are floats, a\nfloating-point number is returned instead of an integer.\n
    \n
    \n注意: JavaScript follows the IEEE-754 standard for resolving\nfloating-point values which can produce unexpected results.

    \n
    \n\n

    参数

    \n
      \n
    1. [min=0] (number)

      The minimum possible value.

      \n
    2. \n
    3. [max=1] (number)

      The maximum possible value.

      \n
    4. \n
    5. [floating] (boolean)

      Specify returning a floating-point number.

      \n
    6. \n
    \n

    返回值 (number)

    \n

    Returns the random number.

    \n
    \n

    示例

    \n
    _.random(0, 5);\n// => an integer between 0 and 5\n\n_.random(5);\n// => also an integer between 0 and 5\n\n_.random(5, true);\n// => a floating-point number between 0 and 5\n\n_.random(1.2, 5.2);\n// => a floating-point number between 1.2 and 5.2\n
    \n
    \n
    \n\n
    " } ,{ "href":"/assign", - "html":"

    assign source npm

    \n
    _.assign(object, [sources])
    \n\n

    Assigns own enumerable properties of source objects to the destination\nobject. Source objects are applied from left to right. Subsequent sources\noverwrite property assignments of previous sources.\n
    \n
    \n注意: This method mutates object and is loosely based on\nObject.assign.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The destination object.

      \n
    2. \n
    3. [sources] (...Object)

      The source objects.

      \n
    4. \n
    \n

    返回值 (Object)

    \n

    Returns object.

    \n
    \n

    示例

    \n
    function Foo() {\n  this.c = 3;\n}\n\nfunction Bar() {\n  this.e = 5;\n}\n\nFoo.prototype.d = 4;\nBar.prototype.f = 6;\n\n_.assign({ 'a': 1 }, new Foo, new Bar);\n// => { 'a': 1, 'c': 3, 'e': 5 }\n
    \n
    \n
    \n\n
    " } + "html":"

    assign source npm

    \n
    _.assign(object, [sources])
    \n\n

    Assigns own enumerable properties of source objects to the destination\nobject. Source objects are applied from left to right. Subsequent sources\noverwrite property assignments of previous sources.\n
    \n
    \n注意: This method mutates object and is loosely based on\nObject.assign.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The destination object.

      \n
    2. \n
    3. [sources] (...Object)

      The source objects.

      \n
    4. \n
    \n

    返回值 (Object)

    \n

    Returns object.

    \n
    \n

    示例

    \n
    function Foo() {\n  this.c = 3;\n}\n\nfunction Bar() {\n  this.e = 5;\n}\n\nFoo.prototype.d = 4;\nBar.prototype.f = 6;\n\n_.assign({ 'a': 1 }, new Foo, new Bar);\n// => { 'a': 1, 'c': 3, 'e': 5 }\n
    \n
    \n
    \n\n
    " } ,{ "href":"/assignIn", - "html":"

    assignIn extend source npm

    \n
    _.assignIn(object, [sources])
    \n\n

    This method is like _.assign except that it iterates over own and\ninherited source properties.\n
    \n
    \n注意: This method mutates object.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The destination object.

      \n
    2. \n
    3. [sources] (...Object)

      The source objects.

      \n
    4. \n
    \n

    返回值 (Object)

    \n

    Returns object.

    \n
    \n

    示例

    \n
    function Foo() {\n  this.b = 2;\n}\n\nfunction Bar() {\n  this.d = 4;\n}\n\nFoo.prototype.c = 3;\nBar.prototype.e = 5;\n\n_.assignIn({ 'a': 1 }, new Foo, new Bar);\n// => { 'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5 }\n
    \n
    \n
    \n\n
    " } + "html":"

    assignIn extend source npm

    \n
    _.assignIn(object, [sources])
    \n\n

    This method is like _.assign except that it iterates over own and\ninherited source properties.\n
    \n
    \n注意: This method mutates object.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The destination object.

      \n
    2. \n
    3. [sources] (...Object)

      The source objects.

      \n
    4. \n
    \n

    返回值 (Object)

    \n

    Returns object.

    \n
    \n

    示例

    \n
    function Foo() {\n  this.b = 2;\n}\n\nfunction Bar() {\n  this.d = 4;\n}\n\nFoo.prototype.c = 3;\nBar.prototype.e = 5;\n\n_.assignIn({ 'a': 1 }, new Foo, new Bar);\n// => { 'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5 }\n
    \n
    \n
    \n\n
    " } ,{ "href":"/assignInWith", - "html":"

    assignInWith extendWith source npm

    \n
    _.assignInWith(object, sources, [customizer])
    \n\n

    This method is like _.assignIn except that it accepts customizer which\nis invoked to produce the assigned values. If customizer returns undefined\nassignment is handled by the method instead. The customizer is invoked\nwith five arguments: (objValue, srcValue, key, object, source).\n
    \n
    \n注意: This method mutates object.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The destination object.

      \n
    2. \n
    3. sources (...Object)

      The source objects.

      \n
    4. \n
    5. [customizer] (Function)

      The function to customize assigned values.

      \n
    6. \n
    \n

    返回值 (Object)

    \n

    Returns object.

    \n
    \n

    示例

    \n
    function customizer(objValue, srcValue) {\n  return _.isUndefined(objValue) ? srcValue : objValue;\n}\n\nvar defaults = _.partialRight(_.assignInWith, customizer);\n\ndefaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });\n// => { 'a': 1, 'b': 2 }\n
    \n
    \n
    \n\n
    " } + "html":"

    assignInWith extendWith source npm

    \n
    _.assignInWith(object, sources, [customizer])
    \n\n

    This method is like _.assignIn except that it accepts customizer which\nis invoked to produce the assigned values. If customizer returns undefined\nassignment is handled by the method instead. The customizer is invoked\nwith five arguments: (objValue, srcValue, key, object, source).\n
    \n
    \n注意: This method mutates object.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The destination object.

      \n
    2. \n
    3. sources (...Object)

      The source objects.

      \n
    4. \n
    5. [customizer] (Function)

      The function to customize assigned values.

      \n
    6. \n
    \n

    返回值 (Object)

    \n

    Returns object.

    \n
    \n

    示例

    \n
    function customizer(objValue, srcValue) {\n  return _.isUndefined(objValue) ? srcValue : objValue;\n}\n\nvar defaults = _.partialRight(_.assignInWith, customizer);\n\ndefaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });\n// => { 'a': 1, 'b': 2 }\n
    \n
    \n
    \n\n
    " } ,{ "href":"/assignWith", - "html":"

    assignWith source npm

    \n
    _.assignWith(object, sources, [customizer])
    \n\n

    This method is like _.assign except that it accepts customizer which\nis invoked to produce the assigned values. If customizer returns undefined\nassignment is handled by the method instead. The customizer is invoked\nwith five arguments: (objValue, srcValue, key, object, source).\n
    \n
    \n注意: This method mutates object.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The destination object.

      \n
    2. \n
    3. sources (...Object)

      The source objects.

      \n
    4. \n
    5. [customizer] (Function)

      The function to customize assigned values.

      \n
    6. \n
    \n

    返回值 (Object)

    \n

    Returns object.

    \n
    \n

    示例

    \n
    function customizer(objValue, srcValue) {\n  return _.isUndefined(objValue) ? srcValue : objValue;\n}\n\nvar defaults = _.partialRight(_.assignWith, customizer);\n\ndefaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });\n// => { 'a': 1, 'b': 2 }\n
    \n
    \n
    \n\n
    " } + "html":"

    assignWith source npm

    \n
    _.assignWith(object, sources, [customizer])
    \n\n

    This method is like _.assign except that it accepts customizer which\nis invoked to produce the assigned values. If customizer returns undefined\nassignment is handled by the method instead. The customizer is invoked\nwith five arguments: (objValue, srcValue, key, object, source).\n
    \n
    \n注意: This method mutates object.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The destination object.

      \n
    2. \n
    3. sources (...Object)

      The source objects.

      \n
    4. \n
    5. [customizer] (Function)

      The function to customize assigned values.

      \n
    6. \n
    \n

    返回值 (Object)

    \n

    Returns object.

    \n
    \n

    示例

    \n
    function customizer(objValue, srcValue) {\n  return _.isUndefined(objValue) ? srcValue : objValue;\n}\n\nvar defaults = _.partialRight(_.assignWith, customizer);\n\ndefaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });\n// => { 'a': 1, 'b': 2 }\n
    \n
    \n
    \n\n
    " } ,{ "href":"/at", - "html":"

    at source npm

    \n
    _.at(object, [paths])
    \n\n

    Creates an array of values corresponding to paths of object.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to iterate over.

      \n
    2. \n
    3. [paths] (...(string|string[])

      The property paths of elements to pick, specified individually or in arrays.

      \n
    4. \n
    \n

    返回值 (Array)

    \n

    Returns the new array of picked elements.

    \n
    \n

    示例

    \n
    var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };\n\n_.at(object, ['a[0].b.c', 'a[1]']);\n// => [3, 4]\n\n_.at(['a', 'b', 'c'], 0, 2);\n// => ['a', 'c']\n
    \n
    \n
    \n\n
    " } + "html":"

    at source npm

    \n
    _.at(object, [paths])
    \n\n

    Creates an array of values corresponding to paths of object.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to iterate over.

      \n
    2. \n
    3. [paths] (...(string|string[])

      The property paths of elements to pick, specified individually or in arrays.

      \n
    4. \n
    \n

    返回值 (Array)

    \n

    Returns the new array of picked elements.

    \n
    \n

    示例

    \n
    var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };\n\n_.at(object, ['a[0].b.c', 'a[1]']);\n// => [3, 4]\n\n_.at(['a', 'b', 'c'], 0, 2);\n// => ['a', 'c']\n
    \n
    \n
    \n\n
    " } ,{ "href":"/create", - "html":"

    create source npm

    \n
    _.create(prototype, [properties])
    \n\n

    Creates an object that inherits from the prototype object. If a properties\nobject is provided its own enumerable properties are assigned to the created object.

    \n
    \n\n

    参数

    \n
      \n
    1. prototype (Object)

      The object to inherit from.

      \n
    2. \n
    3. [properties] (Object)

      The properties to assign to the object.

      \n
    4. \n
    \n

    返回值 (Object)

    \n

    Returns the new object.

    \n
    \n

    示例

    \n
    function Shape() {\n  this.x = 0;\n  this.y = 0;\n}\n\nfunction Circle() {\n  Shape.call(this);\n}\n\nCircle.prototype = _.create(Shape.prototype, {\n  'constructor': Circle\n});\n\nvar circle = new Circle;\ncircle instanceof Circle;\n// => true\n\ncircle instanceof Shape;\n// => true\n
    \n
    \n
    \n\n
    " } + "html":"

    create source npm

    \n
    _.create(prototype, [properties])
    \n\n

    Creates an object that inherits from the prototype object. If a properties\nobject is provided its own enumerable properties are assigned to the created object.

    \n
    \n\n

    参数

    \n
      \n
    1. prototype (Object)

      The object to inherit from.

      \n
    2. \n
    3. [properties] (Object)

      The properties to assign to the object.

      \n
    4. \n
    \n

    返回值 (Object)

    \n

    Returns the new object.

    \n
    \n

    示例

    \n
    function Shape() {\n  this.x = 0;\n  this.y = 0;\n}\n\nfunction Circle() {\n  Shape.call(this);\n}\n\nCircle.prototype = _.create(Shape.prototype, {\n  'constructor': Circle\n});\n\nvar circle = new Circle;\ncircle instanceof Circle;\n// => true\n\ncircle instanceof Shape;\n// => true\n
    \n
    \n
    \n\n
    " } ,{ "href":"/defaults", - "html":"

    defaults source npm

    \n
    _.defaults(object, [sources])
    \n\n

    Assigns own and inherited enumerable properties of source objects to the\ndestination object for all destination properties that resolve to undefined.\nSource objects are applied from left to right. Once a property is set,\nadditional values of the same property are ignored.\n
    \n
    \n注意: This method mutates object.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The destination object.

      \n
    2. \n
    3. [sources] (...Object)

      The source objects.

      \n
    4. \n
    \n

    返回值 (Object)

    \n

    Returns object.

    \n
    \n

    示例

    \n
    _.defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' });\n// => { 'user': 'barney', 'age': 36 }\n
    \n
    \n
    \n\n
    " } + "html":"

    defaults source npm

    \n
    _.defaults(object, [sources])
    \n\n

    Assigns own and inherited enumerable properties of source objects to the\ndestination object for all destination properties that resolve to undefined.\nSource objects are applied from left to right. Once a property is set,\nadditional values of the same property are ignored.\n
    \n
    \n注意: This method mutates object.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The destination object.

      \n
    2. \n
    3. [sources] (...Object)

      The source objects.

      \n
    4. \n
    \n

    返回值 (Object)

    \n

    Returns object.

    \n
    \n

    示例

    \n
    _.defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' });\n// => { 'user': 'barney', 'age': 36 }\n
    \n
    \n
    \n\n
    " } ,{ "href":"/defaultsDeep", - "html":"

    defaultsDeep source npm

    \n
    _.defaultsDeep(object, [sources])
    \n\n

    This method is like _.defaults except that it recursively assigns\ndefault properties.\n
    \n
    \n注意: This method mutates object.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The destination object.

      \n
    2. \n
    3. [sources] (...Object)

      The source objects.

      \n
    4. \n
    \n

    返回值 (Object)

    \n

    Returns object.

    \n
    \n

    示例

    \n
    _.defaultsDeep({ 'user': { 'name': 'barney' } }, { 'user': { 'name': 'fred', 'age': 36 } });\n// => { 'user': { 'name': 'barney', 'age': 36 } }\n
    \n
    \n
    \n\n
    " } + "html":"

    defaultsDeep source npm

    \n
    _.defaultsDeep(object, [sources])
    \n\n

    This method is like _.defaults except that it recursively assigns\ndefault properties.\n
    \n
    \n注意: This method mutates object.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The destination object.

      \n
    2. \n
    3. [sources] (...Object)

      The source objects.

      \n
    4. \n
    \n

    返回值 (Object)

    \n

    Returns object.

    \n
    \n

    示例

    \n
    _.defaultsDeep({ 'user': { 'name': 'barney' } }, { 'user': { 'name': 'fred', 'age': 36 } });\n// => { 'user': { 'name': 'barney', 'age': 36 } }\n
    \n
    \n
    \n\n
    " } ,{ "href":"/findKey", - "html":"

    findKey source npm

    \n
    _.findKey(object, [predicate=_.identity])
    \n\n

    This method is like _.find except that it returns the key of the first\nelement predicate returns truthy for instead of the element itself.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to search.

      \n
    2. \n
    3. [predicate=_.identity] (Function|Object|string)

      The function invoked per iteration.

      \n
    4. \n
    \n

    返回值 (string|undefined)

    \n

    Returns the key of the matched element, else undefined.

    \n
    \n

    示例

    \n
    var users = {\n  'barney':  { 'age': 36, 'active': true },\n  'fred':    { 'age': 40, 'active': false },\n  'pebbles': { 'age': 1,  'active': true }\n};\n\n_.findKey(users, function(o) { return o.age < 40; });\n// => 'barney' (iteration order is not guaranteed)\n\n// 使用了 `_.matches` 的回调结果\n_.findKey(users, { 'age': 1, 'active': true });\n// => 'pebbles'\n\n// 使用了 `_.matchesProperty` 的回调结果\n_.findKey(users, ['active', false]);\n// => 'fred'\n\n// 使用了 `_.property` 的回调结果\n_.findKey(users, 'active');\n// => 'barney'\n
    \n
    \n
    \n\n
    " } + "html":"

    findKey source npm

    \n
    _.findKey(object, [predicate=_.identity])
    \n\n

    This method is like _.find except that it returns the key of the first\nelement predicate returns truthy for instead of the element itself.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to search.

      \n
    2. \n
    3. [predicate=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

      \n
    4. \n
    \n

    返回值 (string|undefined)

    \n

    Returns the key of the matched element, else undefined.

    \n
    \n

    示例

    \n
    var users = {\n  'barney':  { 'age': 36, 'active': true },\n  'fred':    { 'age': 40, 'active': false },\n  'pebbles': { 'age': 1,  'active': true }\n};\n\n_.findKey(users, function(o) { return o.age < 40; });\n// => 'barney' (无法保证遍历的顺序)\n\n// 使用了 `_.matches` 的回调结果\n_.findKey(users, { 'age': 1, 'active': true });\n// => 'pebbles'\n\n// 使用了 `_.matchesProperty` 的回调结果\n_.findKey(users, ['active', false]);\n// => 'fred'\n\n// 使用了 `_.property` 的回调结果\n_.findKey(users, 'active');\n// => 'barney'\n
    \n
    \n
    \n\n
    " } ,{ "href":"/findLastKey", - "html":"

    findLastKey source npm

    \n
    _.findLastKey(object, [predicate=_.identity])
    \n\n

    This method is like _.findKey except that it iterates over elements of\na collection in the opposite order.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to search.

      \n
    2. \n
    3. [predicate=_.identity] (Function|Object|string)

      The function invoked per iteration.

      \n
    4. \n
    \n

    返回值 (string|undefined)

    \n

    Returns the key of the matched element, else undefined.

    \n
    \n

    示例

    \n
    var users = {\n  'barney':  { 'age': 36, 'active': true },\n  'fred':    { 'age': 40, 'active': false },\n  'pebbles': { 'age': 1,  'active': true }\n};\n\n_.findLastKey(users, function(o) { return o.age < 40; });\n// => returns 'pebbles' assuming `_.findKey` returns 'barney'\n\n// 使用了 `_.matches` 的回调结果\n_.findLastKey(users, { 'age': 36, 'active': true });\n// => 'barney'\n\n// 使用了 `_.matchesProperty` 的回调结果\n_.findLastKey(users, ['active', false]);\n// => 'fred'\n\n// 使用了 `_.property` 的回调结果\n_.findLastKey(users, 'active');\n// => 'pebbles'\n
    \n
    \n
    \n\n
    " } + "html":"

    findLastKey source npm

    \n
    _.findLastKey(object, [predicate=_.identity])
    \n\n

    This method is like _.findKey except that it iterates over elements of\na collection in the opposite order.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to search.

      \n
    2. \n
    3. [predicate=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

      \n
    4. \n
    \n

    返回值 (string|undefined)

    \n

    Returns the key of the matched element, else undefined.

    \n
    \n

    示例

    \n
    var users = {\n  'barney':  { 'age': 36, 'active': true },\n  'fred':    { 'age': 40, 'active': false },\n  'pebbles': { 'age': 1,  'active': true }\n};\n\n_.findLastKey(users, function(o) { return o.age < 40; });\n// => returns 'pebbles' assuming `_.findKey` returns 'barney'\n\n// 使用了 `_.matches` 的回调结果\n_.findLastKey(users, { 'age': 36, 'active': true });\n// => 'barney'\n\n// 使用了 `_.matchesProperty` 的回调结果\n_.findLastKey(users, ['active', false]);\n// => 'fred'\n\n// 使用了 `_.property` 的回调结果\n_.findLastKey(users, 'active');\n// => 'pebbles'\n
    \n
    \n
    \n\n
    " } ,{ "href":"/forIn", - "html":"

    forIn source npm

    \n
    _.forIn(object, [iteratee=_.identity])
    \n\n

    Iterates over own and inherited enumerable properties of an object invoking\niteratee for each property. The iteratee is invoked with three arguments:
    \n(value, key, object). Iteratee functions may exit iteration early by explicitly\nreturning false.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to iterate over.

      \n
    2. \n
    3. [iteratee=_.identity] (Function)

      The function invoked per iteration.

      \n
    4. \n
    \n

    返回值 (Object)

    \n

    Returns object.

    \n
    \n

    示例

    \n
    function Foo() {\n  this.a = 1;\n  this.b = 2;\n}\n\nFoo.prototype.c = 3;\n\n_.forIn(new Foo, function(value, key) {\n  console.log(key);\n});\n// => logs 'a', 'b', then 'c' (iteration order is not guaranteed)\n
    \n
    \n
    \n\n
    " } + "html":"

    forIn source npm

    \n
    _.forIn(object, [iteratee=_.identity])
    \n\n

    Iterates over own and inherited enumerable properties of an object invoking\niteratee for each property. The iteratee is invoked with three arguments:
    \n(value, key, object). Iteratee functions may exit iteration early by explicitly\nreturning false.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to iterate over.

      \n
    2. \n
    3. [iteratee=_.identity] (Function)

      这个函数会处理每一个元素

      \n
    4. \n
    \n

    返回值 (Object)

    \n

    Returns object.

    \n
    \n

    示例

    \n
    function Foo() {\n  this.a = 1;\n  this.b = 2;\n}\n\nFoo.prototype.c = 3;\n\n_.forIn(new Foo, function(value, key) {\n  console.log(key);\n});\n// => logs 'a', 'b', then 'c' (无法保证遍历的顺序)\n
    \n
    \n
    \n\n
    " } ,{ "href":"/forInRight", - "html":"

    forInRight source npm

    \n
    _.forInRight(object, [iteratee=_.identity])
    \n\n

    This method is like _.forIn except that it iterates over properties of\nobject in the opposite order.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to iterate over.

      \n
    2. \n
    3. [iteratee=_.identity] (Function)

      The function invoked per iteration.

      \n
    4. \n
    \n

    返回值 (Object)

    \n

    Returns object.

    \n
    \n

    示例

    \n
    function Foo() {\n  this.a = 1;\n  this.b = 2;\n}\n\nFoo.prototype.c = 3;\n\n_.forInRight(new Foo, function(value, key) {\n  console.log(key);\n});\n// => logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'\n
    \n
    \n
    \n\n
    " } + "html":"

    forInRight source npm

    \n
    _.forInRight(object, [iteratee=_.identity])
    \n\n

    This method is like _.forIn except that it iterates over properties of\nobject in the opposite order.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to iterate over.

      \n
    2. \n
    3. [iteratee=_.identity] (Function)

      这个函数会处理每一个元素

      \n
    4. \n
    \n

    返回值 (Object)

    \n

    Returns object.

    \n
    \n

    示例

    \n
    function Foo() {\n  this.a = 1;\n  this.b = 2;\n}\n\nFoo.prototype.c = 3;\n\n_.forInRight(new Foo, function(value, key) {\n  console.log(key);\n});\n// => logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'\n
    \n
    \n
    \n\n
    " } ,{ "href":"/forOwn", - "html":"

    forOwn source npm

    \n
    _.forOwn(object, [iteratee=_.identity])
    \n\n

    Iterates over own enumerable properties of an object invoking iteratee\nfor each property. The iteratee is invoked with three arguments:
    \n(value, key, object). Iteratee functions may exit iteration early by\nexplicitly returning false.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to iterate over.

      \n
    2. \n
    3. [iteratee=_.identity] (Function)

      The function invoked per iteration.

      \n
    4. \n
    \n

    返回值 (Object)

    \n

    Returns object.

    \n
    \n

    示例

    \n
    function Foo() {\n  this.a = 1;\n  this.b = 2;\n}\n\nFoo.prototype.c = 3;\n\n_.forOwn(new Foo, function(value, key) {\n  console.log(key);\n});\n// => logs 'a' then 'b' (iteration order is not guaranteed)\n
    \n
    \n
    \n\n
    " } + "html":"

    forOwn source npm

    \n
    _.forOwn(object, [iteratee=_.identity])
    \n\n

    Iterates over own enumerable properties of an object invoking iteratee\nfor each property. The iteratee is invoked with three arguments:
    \n(value, key, object). Iteratee functions may exit iteration early by\nexplicitly returning false.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to iterate over.

      \n
    2. \n
    3. [iteratee=_.identity] (Function)

      这个函数会处理每一个元素

      \n
    4. \n
    \n

    返回值 (Object)

    \n

    Returns object.

    \n
    \n

    示例

    \n
    function Foo() {\n  this.a = 1;\n  this.b = 2;\n}\n\nFoo.prototype.c = 3;\n\n_.forOwn(new Foo, function(value, key) {\n  console.log(key);\n});\n// => logs 'a' then 'b' (无法保证遍历的顺序)\n
    \n
    \n
    \n\n
    " } ,{ "href":"/forOwnRight", - "html":"

    forOwnRight source npm

    \n
    _.forOwnRight(object, [iteratee=_.identity])
    \n\n

    This method is like _.forOwn except that it iterates over properties of\nobject in the opposite order.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to iterate over.

      \n
    2. \n
    3. [iteratee=_.identity] (Function)

      The function invoked per iteration.

      \n
    4. \n
    \n

    返回值 (Object)

    \n

    Returns object.

    \n
    \n

    示例

    \n
    function Foo() {\n  this.a = 1;\n  this.b = 2;\n}\n\nFoo.prototype.c = 3;\n\n_.forOwnRight(new Foo, function(value, key) {\n  console.log(key);\n});\n// => logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'\n
    \n
    \n
    \n\n
    " } + "html":"

    forOwnRight source npm

    \n
    _.forOwnRight(object, [iteratee=_.identity])
    \n\n

    This method is like _.forOwn except that it iterates over properties of\nobject in the opposite order.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to iterate over.

      \n
    2. \n
    3. [iteratee=_.identity] (Function)

      这个函数会处理每一个元素

      \n
    4. \n
    \n

    返回值 (Object)

    \n

    Returns object.

    \n
    \n

    示例

    \n
    function Foo() {\n  this.a = 1;\n  this.b = 2;\n}\n\nFoo.prototype.c = 3;\n\n_.forOwnRight(new Foo, function(value, key) {\n  console.log(key);\n});\n// => logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'\n
    \n
    \n
    \n\n
    " } ,{ "href":"/functions", - "html":"

    functions source npm

    \n
    _.functions(object)
    \n\n

    Creates an array of function property names from own enumerable properties\nof object.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to inspect.

      \n
    2. \n
    \n

    返回值 (Array)

    \n

    Returns the new array of property names.

    \n
    \n

    示例

    \n
    function Foo() {\n  this.a = _.constant('a');\n  this.b = _.constant('b');\n}\n\nFoo.prototype.c = _.constant('c');\n\n_.functions(new Foo);\n// => ['a', 'b']\n
    \n
    \n
    \n\n
    " } + "html":"

    functions source npm

    \n
    _.functions(object)
    \n\n

    Creates an array of function property names from own enumerable properties\nof object.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to inspect.

      \n
    2. \n
    \n

    返回值 (Array)

    \n

    Returns the new array of property names.

    \n
    \n

    示例

    \n
    function Foo() {\n  this.a = _.constant('a');\n  this.b = _.constant('b');\n}\n\nFoo.prototype.c = _.constant('c');\n\n_.functions(new Foo);\n// => ['a', 'b']\n
    \n
    \n
    \n\n
    " } ,{ "href":"/functionsIn", - "html":"

    functionsIn source npm

    \n
    _.functionsIn(object)
    \n\n

    Creates an array of function property names from own and inherited\nenumerable properties of object.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to inspect.

      \n
    2. \n
    \n

    返回值 (Array)

    \n

    Returns the new array of property names.

    \n
    \n

    示例

    \n
    function Foo() {\n  this.a = _.constant('a');\n  this.b = _.constant('b');\n}\n\nFoo.prototype.c = _.constant('c');\n\n_.functionsIn(new Foo);\n// => ['a', 'b', 'c']\n
    \n
    \n
    \n\n
    " } + "html":"

    functionsIn source npm

    \n
    _.functionsIn(object)
    \n\n

    Creates an array of function property names from own and inherited\nenumerable properties of object.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to inspect.

      \n
    2. \n
    \n

    返回值 (Array)

    \n

    Returns the new array of property names.

    \n
    \n

    示例

    \n
    function Foo() {\n  this.a = _.constant('a');\n  this.b = _.constant('b');\n}\n\nFoo.prototype.c = _.constant('c');\n\n_.functionsIn(new Foo);\n// => ['a', 'b', 'c']\n
    \n
    \n
    \n\n
    " } ,{ "href":"/get", - "html":"

    get source npm

    \n
    _.get(object, path, [defaultValue])
    \n\n

    Gets the value at path of object. If the resolved value is\nundefined the defaultValue is used in its place.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to query.

      \n
    2. \n
    3. path (Array|string)

      The path of the property to get.

      \n
    4. \n
    5. [defaultValue] (*)

      The value returned if the resolved value is undefined.

      \n
    6. \n
    \n

    返回值 (*)

    \n

    Returns the resolved value.

    \n
    \n

    示例

    \n
    var object = { 'a': [{ 'b': { 'c': 3 } }] };\n\n_.get(object, 'a[0].b.c');\n// => 3\n\n_.get(object, ['a', '0', 'b', 'c']);\n// => 3\n\n_.get(object, 'a.b.c', 'default');\n// => 'default'\n
    \n
    \n
    \n\n
    " } + "html":"

    get source npm

    \n
    _.get(object, path, [defaultValue])
    \n\n

    Gets the value at path of object. If the resolved value is\nundefined the defaultValue is used in its place.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to query.

      \n
    2. \n
    3. path (Array|string)

      The path of the property to get.

      \n
    4. \n
    5. [defaultValue] (*)

      The value returned if the resolved value is undefined.

      \n
    6. \n
    \n

    返回值 (*)

    \n

    Returns the resolved value.

    \n
    \n

    示例

    \n
    var object = { 'a': [{ 'b': { 'c': 3 } }] };\n\n_.get(object, 'a[0].b.c');\n// => 3\n\n_.get(object, ['a', '0', 'b', 'c']);\n// => 3\n\n_.get(object, 'a.b.c', 'default');\n// => 'default'\n
    \n
    \n
    \n\n
    " } ,{ "href":"/has", - "html":"

    has source npm

    \n
    _.has(object, path)
    \n\n

    Checks if path is a direct property of object.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to query.

      \n
    2. \n
    3. path (Array|string)

      The path to check.

      \n
    4. \n
    \n

    返回值 (boolean)

    \n

    Returns true if path exists, else false.

    \n
    \n

    示例

    \n
    var object = { 'a': { 'b': { 'c': 3 } } };\nvar other = _.create({ 'a': _.create({ 'b': _.create({ 'c': 3 }) }) });\n\n_.has(object, 'a');\n// => true\n\n_.has(object, 'a.b.c');\n// => true\n\n_.has(object, ['a', 'b', 'c']);\n// => true\n\n_.has(other, 'a');\n// => false\n
    \n
    \n
    \n\n
    " } + "html":"

    has source npm

    \n
    _.has(object, path)
    \n\n

    Checks if path is a direct property of object.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to query.

      \n
    2. \n
    3. path (Array|string)

      The path to check.

      \n
    4. \n
    \n

    返回值 (boolean)

    \n

    Returns true if path exists, else false.

    \n
    \n

    示例

    \n
    var object = { 'a': { 'b': { 'c': 3 } } };\nvar other = _.create({ 'a': _.create({ 'b': _.create({ 'c': 3 }) }) });\n\n_.has(object, 'a');\n// => true\n\n_.has(object, 'a.b.c');\n// => true\n\n_.has(object, ['a', 'b', 'c']);\n// => true\n\n_.has(other, 'a');\n// => false\n
    \n
    \n
    \n\n
    " } ,{ "href":"/hasIn", - "html":"

    hasIn source npm

    \n
    _.hasIn(object, path)
    \n\n

    Checks if path is a direct or inherited property of object.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to query.

      \n
    2. \n
    3. path (Array|string)

      The path to check.

      \n
    4. \n
    \n

    返回值 (boolean)

    \n

    Returns true if path exists, else false.

    \n
    \n

    示例

    \n
    var object = _.create({ 'a': _.create({ 'b': _.create({ 'c': 3 }) }) });\n\n_.hasIn(object, 'a');\n// => true\n\n_.hasIn(object, 'a.b.c');\n// => true\n\n_.hasIn(object, ['a', 'b', 'c']);\n// => true\n\n_.hasIn(object, 'b');\n// => false\n
    \n
    \n
    \n\n
    " } + "html":"

    hasIn source npm

    \n
    _.hasIn(object, path)
    \n\n

    Checks if path is a direct or inherited property of object.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to query.

      \n
    2. \n
    3. path (Array|string)

      The path to check.

      \n
    4. \n
    \n

    返回值 (boolean)

    \n

    Returns true if path exists, else false.

    \n
    \n

    示例

    \n
    var object = _.create({ 'a': _.create({ 'b': _.create({ 'c': 3 }) }) });\n\n_.hasIn(object, 'a');\n// => true\n\n_.hasIn(object, 'a.b.c');\n// => true\n\n_.hasIn(object, ['a', 'b', 'c']);\n// => true\n\n_.hasIn(object, 'b');\n// => false\n
    \n
    \n
    \n\n
    " } ,{ "href":"/invert", - "html":"

    invert source npm

    \n
    _.invert(object, [multiVal])
    \n\n

    Creates an object composed of the inverted keys and values of object.\nIf object contains duplicate values, subsequent values overwrite property\nassignments of previous values unless multiVal is true.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to invert.

      \n
    2. \n
    3. [multiVal] (boolean)

      Allow multiple values per key.

      \n
    4. \n
    \n

    返回值 (Object)

    \n

    Returns the new inverted object.

    \n
    \n

    示例

    \n
    var object = { 'a': 1, 'b': 2, 'c': 1 };\n\n_.invert(object);\n// => { '1': 'c', '2': 'b' }\n\n// with `multiVal`\n_.invert(object, true);\n// => { '1': ['a', 'c'], '2': ['b'] }\n
    \n
    \n
    \n\n
    " } + "html":"

    invert source npm

    \n
    _.invert(object, [multiVal])
    \n\n

    Creates an object composed of the inverted keys and values of object.\nIf object contains duplicate values, subsequent values overwrite property\nassignments of previous values unless multiVal is true.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to invert.

      \n
    2. \n
    3. [multiVal] (boolean)

      Allow multiple values per key.

      \n
    4. \n
    \n

    返回值 (Object)

    \n

    Returns the new inverted object.

    \n
    \n

    示例

    \n
    var object = { 'a': 1, 'b': 2, 'c': 1 };\n\n_.invert(object);\n// => { '1': 'c', '2': 'b' }\n\n// with `multiVal`\n_.invert(object, true);\n// => { '1': ['a', 'c'], '2': ['b'] }\n
    \n
    \n
    \n\n
    " } ,{ "href":"/invoke", - "html":"

    invoke source npm

    \n
    _.invoke(object, path, [args])
    \n\n

    Invokes the method at path of object.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to query.

      \n
    2. \n
    3. path (Array|string)

      The path of the method to invoke.

      \n
    4. \n
    5. [args] (...*)

      The arguments to invoke the method with.

      \n
    6. \n
    \n

    返回值 (*)

    \n

    Returns the result of the invoked method.

    \n
    \n

    示例

    \n
    var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };\n\n_.invoke(object, 'a[0].b.c.slice', 1, 3);\n// => [2, 3]\n
    \n
    \n
    \n\n
    " } + "html":"

    invoke source npm

    \n
    _.invoke(object, path, [args])
    \n\n

    Invokes the method at path of object.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to query.

      \n
    2. \n
    3. path (Array|string)

      The path of the method to invoke.

      \n
    4. \n
    5. [args] (...*)

      The arguments to invoke the method with.

      \n
    6. \n
    \n

    返回值 (*)

    \n

    Returns the result of the invoked method.

    \n
    \n

    示例

    \n
    var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };\n\n_.invoke(object, 'a[0].b.c.slice', 1, 3);\n// => [2, 3]\n
    \n
    \n
    \n\n
    " } ,{ "href":"/keys", - "html":"

    keys source npm

    \n
    _.keys(object)
    \n\n

    Creates an array of the own enumerable property names of object.\n
    \n
    \n注意: Non-object values are coerced to objects. See the\nES spec\nfor more details.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to query.

      \n
    2. \n
    \n

    返回值 (Array)

    \n

    Returns the array of property names.

    \n
    \n

    示例

    \n
    function Foo() {\n  this.a = 1;\n  this.b = 2;\n}\n\nFoo.prototype.c = 3;\n\n_.keys(new Foo);\n// => ['a', 'b'] (iteration order is not guaranteed)\n\n_.keys('hi');\n// => ['0', '1']\n
    \n
    \n
    \n\n
    " } + "html":"

    keys source npm

    \n
    _.keys(object)
    \n\n

    Creates an array of the own enumerable property names of object.\n
    \n
    \n注意: Non-object values are coerced to objects. See the\nES spec\nfor more details.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to query.

      \n
    2. \n
    \n

    返回值 (Array)

    \n

    Returns the array of property names.

    \n
    \n

    示例

    \n
    function Foo() {\n  this.a = 1;\n  this.b = 2;\n}\n\nFoo.prototype.c = 3;\n\n_.keys(new Foo);\n// => ['a', 'b'] (无法保证遍历的顺序)\n\n_.keys('hi');\n// => ['0', '1']\n
    \n
    \n
    \n\n
    " } ,{ "href":"/keysIn", - "html":"

    keysIn source npm

    \n
    _.keysIn(object)
    \n\n

    Creates an array of the own and inherited enumerable property names of object.\n
    \n
    \n注意: Non-object values are coerced to objects.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to query.

      \n
    2. \n
    \n

    返回值 (Array)

    \n

    Returns the array of property names.

    \n
    \n

    示例

    \n
    function Foo() {\n  this.a = 1;\n  this.b = 2;\n}\n\nFoo.prototype.c = 3;\n\n_.keysIn(new Foo);\n// => ['a', 'b', 'c'] (iteration order is not guaranteed)\n
    \n
    \n
    \n\n
    " } + "html":"

    keysIn source npm

    \n
    _.keysIn(object)
    \n\n

    Creates an array of the own and inherited enumerable property names of object.\n
    \n
    \n注意: Non-object values are coerced to objects.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to query.

      \n
    2. \n
    \n

    返回值 (Array)

    \n

    Returns the array of property names.

    \n
    \n

    示例

    \n
    function Foo() {\n  this.a = 1;\n  this.b = 2;\n}\n\nFoo.prototype.c = 3;\n\n_.keysIn(new Foo);\n// => ['a', 'b', 'c'] (无法保证遍历的顺序)\n
    \n
    \n
    \n\n
    " } ,{ "href":"/mapKeys", - "html":"

    mapKeys source npm

    \n
    _.mapKeys(object, [iteratee=_.identity])
    \n\n

    The opposite of _.mapValues; this method creates an object with the\nsame values as object and keys generated by running each own enumerable\nproperty of object through iteratee.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to iterate over.

      \n
    2. \n
    3. [iteratee=_.identity] (Function|Object|string)

      The function invoked per iteration.

      \n
    4. \n
    \n

    返回值 (Object)

    \n

    Returns the new mapped object.

    \n
    \n

    示例

    \n
    _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {\n  return key + value;\n});\n// => { 'a1': 1, 'b2': 2 }\n
    \n
    \n
    \n\n
    " } + "html":"

    mapKeys source npm

    \n
    _.mapKeys(object, [iteratee=_.identity])
    \n\n

    The opposite of _.mapValues; this method creates an object with the\nsame values as object and keys generated by running each own enumerable\nproperty of object through iteratee.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to iterate over.

      \n
    2. \n
    3. [iteratee=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

      \n
    4. \n
    \n

    返回值 (Object)

    \n

    Returns the new mapped object.

    \n
    \n

    示例

    \n
    _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {\n  return key + value;\n});\n// => { 'a1': 1, 'b2': 2 }\n
    \n
    \n
    \n\n
    " } ,{ "href":"/mapValues", - "html":"

    mapValues source npm

    \n
    _.mapValues(object, [iteratee=_.identity])
    \n\n

    Creates an object with the same keys as object and values generated by\nrunning each own enumerable property of object through iteratee. The\niteratee function is invoked with three arguments: (value, key, object).

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to iterate over.

      \n
    2. \n
    3. [iteratee=_.identity] (Function|Object|string)

      The function invoked per iteration.

      \n
    4. \n
    \n

    返回值 (Object)

    \n

    Returns the new mapped object.

    \n
    \n

    示例

    \n
    var users = {\n  'fred':    { 'user': 'fred',    'age': 40 },\n  'pebbles': { 'user': 'pebbles', 'age': 1 }\n};\n\n_.mapValues(users, function(o) { return o.age; });\n// => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)\n\n// 使用了 `_.property` 的回调结果\n_.mapValues(users, 'age');\n// => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)\n
    \n
    \n
    \n\n
    " } + "html":"

    mapValues source npm

    \n
    _.mapValues(object, [iteratee=_.identity])
    \n\n

    Creates an object with the same keys as object and values generated by\nrunning each own enumerable property of object through iteratee. The\niteratee function is invoked with three arguments: (value, key, object).

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to iterate over.

      \n
    2. \n
    3. [iteratee=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

      \n
    4. \n
    \n

    返回值 (Object)

    \n

    Returns the new mapped object.

    \n
    \n

    示例

    \n
    var users = {\n  'fred':    { 'user': 'fred',    'age': 40 },\n  'pebbles': { 'user': 'pebbles', 'age': 1 }\n};\n\n_.mapValues(users, function(o) { return o.age; });\n// => { 'fred': 40, 'pebbles': 1 } (无法保证遍历的顺序)\n\n// 使用了 `_.property` 的回调结果\n_.mapValues(users, 'age');\n// => { 'fred': 40, 'pebbles': 1 } (无法保证遍历的顺序)\n
    \n
    \n
    \n\n
    " } ,{ "href":"/merge", - "html":"

    merge source npm

    \n
    _.merge(object, [sources])
    \n\n

    Recursively merges own and inherited enumerable properties of source\nobjects into the destination object, skipping source properties that resolve\nto undefined. Array and plain object properties are merged recursively.\nOther objects and value types are overridden by assignment. Source objects\nare applied from left to right. Subsequent sources overwrite property\nassignments of previous sources.\n
    \n
    \n注意: This method mutates object.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The destination object.

      \n
    2. \n
    3. [sources] (...Object)

      The source objects.

      \n
    4. \n
    \n

    返回值 (Object)

    \n

    Returns object.

    \n
    \n

    示例

    \n
    var users = {\n  'data': [{ 'user': 'barney' }, { 'user': 'fred' }]\n};\n\nvar ages = {\n  'data': [{ 'age': 36 }, { 'age': 40 }]\n};\n\n_.merge(users, ages);\n// => { 'data': [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 40 }] }\n
    \n
    \n
    \n\n
    " } + "html":"

    merge source npm

    \n
    _.merge(object, [sources])
    \n\n

    Recursively merges own and inherited enumerable properties of source\nobjects into the destination object, skipping source properties that resolve\nto undefined. Array and plain object properties are merged recursively.\nOther objects and value types are overridden by assignment. Source objects\nare applied from left to right. Subsequent sources overwrite property\nassignments of previous sources.\n
    \n
    \n注意: This method mutates object.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The destination object.

      \n
    2. \n
    3. [sources] (...Object)

      The source objects.

      \n
    4. \n
    \n

    返回值 (Object)

    \n

    Returns object.

    \n
    \n

    示例

    \n
    var users = {\n  'data': [{ 'user': 'barney' }, { 'user': 'fred' }]\n};\n\nvar ages = {\n  'data': [{ 'age': 36 }, { 'age': 40 }]\n};\n\n_.merge(users, ages);\n// => { 'data': [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 40 }] }\n
    \n
    \n
    \n\n
    " } ,{ "href":"/mergeWith", - "html":"

    mergeWith source npm

    \n
    _.mergeWith(object, sources, customizer)
    \n\n

    This method is like _.merge except that it accepts customizer which\nis invoked to produce the merged values of the destination and source\nproperties. If customizer returns undefined merging is handled by the\nmethod instead. The customizer is invoked with seven arguments:
    \n(objValue, srcValue, key, object, source, stack).

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The destination object.

      \n
    2. \n
    3. sources (...Object)

      The source objects.

      \n
    4. \n
    5. customizer (Function)

      The function to customize assigned values.

      \n
    6. \n
    \n

    返回值 (Object)

    \n

    Returns object.

    \n
    \n

    示例

    \n
    function customizer(objValue, srcValue) {\n  if (_.isArray(objValue)) {\n    return objValue.concat(srcValue);\n  }\n}\n\nvar object = {\n  'fruits': ['apple'],\n  'vegetables': ['beet']\n};\n\nvar other = {\n  'fruits': ['banana'],\n  'vegetables': ['carrot']\n};\n\n_.mergeWith(object, other, customizer);\n// => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot'] }\n
    \n
    \n
    \n\n
    " } + "html":"

    mergeWith source npm

    \n
    _.mergeWith(object, sources, customizer)
    \n\n

    This method is like _.merge except that it accepts customizer which\nis invoked to produce the merged values of the destination and source\nproperties. If customizer returns undefined merging is handled by the\nmethod instead. The customizer is invoked with seven arguments:
    \n(objValue, srcValue, key, object, source, stack).

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The destination object.

      \n
    2. \n
    3. sources (...Object)

      The source objects.

      \n
    4. \n
    5. customizer (Function)

      The function to customize assigned values.

      \n
    6. \n
    \n

    返回值 (Object)

    \n

    Returns object.

    \n
    \n

    示例

    \n
    function customizer(objValue, srcValue) {\n  if (_.isArray(objValue)) {\n    return objValue.concat(srcValue);\n  }\n}\n\nvar object = {\n  'fruits': ['apple'],\n  'vegetables': ['beet']\n};\n\nvar other = {\n  'fruits': ['banana'],\n  'vegetables': ['carrot']\n};\n\n_.mergeWith(object, other, customizer);\n// => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot'] }\n
    \n
    \n
    \n\n
    " } ,{ "href":"/omit", - "html":"

    omit source npm

    \n
    _.omit(object, [props])
    \n\n

    The opposite of _.pick; this method creates an object composed of the\nown and inherited enumerable properties of object that are not omitted.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The source object.

      \n
    2. \n
    3. [props] (...(string|string[])

      The property names to omit, specified individually or in arrays..

      \n
    4. \n
    \n

    返回值 (Object)

    \n

    Returns the new object.

    \n
    \n

    示例

    \n
    var object = { 'user': 'fred', 'age': 40 };\n\n_.omit(object, 'user');\n// => { 'age': 40 }\n
    \n
    \n
    \n\n
    " } + "html":"

    omit source npm

    \n
    _.omit(object, [props])
    \n\n

    The opposite of _.pick; this method creates an object composed of the\nown and inherited enumerable properties of object that are not omitted.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The source object.

      \n
    2. \n
    3. [props] (...(string|string[])

      The property names to omit, specified individually or in arrays..

      \n
    4. \n
    \n

    返回值 (Object)

    \n

    Returns the new object.

    \n
    \n

    示例

    \n
    var object = { 'user': 'fred', 'age': 40 };\n\n_.omit(object, 'user');\n// => { 'age': 40 }\n
    \n
    \n
    \n\n
    " } ,{ "href":"/omitBy", - "html":"

    omitBy source npm

    \n
    _.omitBy(object, [predicate=_.identity])
    \n\n

    The opposite of _.pickBy; this method creates an object composed of the\nown and inherited enumerable properties of object that predicate\ndoesn't return truthy for.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The source object.

      \n
    2. \n
    3. [predicate=_.identity] (Function|Object|string)

      The function invoked per property.

      \n
    4. \n
    \n

    返回值 (Object)

    \n

    Returns the new object.

    \n
    \n

    示例

    \n
    var object = { 'user': 'fred', 'age': 40 };\n\n_.omitBy(object, _.isNumber);\n// => { 'user': 'fred' }\n
    \n
    \n
    \n\n
    " } + "html":"

    omitBy source npm

    \n
    _.omitBy(object, [predicate=_.identity])
    \n\n

    The opposite of _.pickBy; this method creates an object composed of the\nown and inherited enumerable properties of object that predicate\ndoesn't return truthy for.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The source object.

      \n
    2. \n
    3. [predicate=_.identity] (Function|Object|string)

      The function invoked per property.

      \n
    4. \n
    \n

    返回值 (Object)

    \n

    Returns the new object.

    \n
    \n

    示例

    \n
    var object = { 'user': 'fred', 'age': 40 };\n\n_.omitBy(object, _.isNumber);\n// => { 'user': 'fred' }\n
    \n
    \n
    \n\n
    " } ,{ "href":"/pick", - "html":"

    pick source npm

    \n
    _.pick(object, [props])
    \n\n

    Creates an object composed of the picked object properties.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The source object.

      \n
    2. \n
    3. [props] (...(string|string[])

      The property names to pick, specified individually or in arrays.

      \n
    4. \n
    \n

    返回值 (Object)

    \n

    Returns the new object.

    \n
    \n

    示例

    \n
    var object = { 'user': 'fred', 'age': 40 };\n\n_.pick(object, 'user');\n// => { 'user': 'fred' }\n
    \n
    \n
    \n\n
    " } + "html":"

    pick source npm

    \n
    _.pick(object, [props])
    \n\n

    Creates an object composed of the picked object properties.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The source object.

      \n
    2. \n
    3. [props] (...(string|string[])

      The property names to pick, specified individually or in arrays.

      \n
    4. \n
    \n

    返回值 (Object)

    \n

    Returns the new object.

    \n
    \n

    示例

    \n
    var object = { 'user': 'fred', 'age': 40 };\n\n_.pick(object, 'user');\n// => { 'user': 'fred' }\n
    \n
    \n
    \n\n
    " } ,{ "href":"/pickBy", - "html":"

    pickBy source npm

    \n
    _.pickBy(object, [predicate=_.identity])
    \n\n

    Creates an object composed of the object properties predicate returns\ntruthy for. The predicate is invoked with one argument: (value).

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The source object.

      \n
    2. \n
    3. [predicate=_.identity] (Function|Object|string)

      The function invoked per property.

      \n
    4. \n
    \n

    返回值 (Object)

    \n

    Returns the new object.

    \n
    \n

    示例

    \n
    var object = { 'user': 'fred', 'age': 40 };\n\n_.pickBy(object, _.isNumber);\n// => { 'age': 40 }\n
    \n
    \n
    \n\n
    " } + "html":"

    pickBy source npm

    \n
    _.pickBy(object, [predicate=_.identity])
    \n\n

    Creates an object composed of the object properties predicate returns\ntruthy for. The predicate is invoked with one argument: (value).

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The source object.

      \n
    2. \n
    3. [predicate=_.identity] (Function|Object|string)

      The function invoked per property.

      \n
    4. \n
    \n

    返回值 (Object)

    \n

    Returns the new object.

    \n
    \n

    示例

    \n
    var object = { 'user': 'fred', 'age': 40 };\n\n_.pickBy(object, _.isNumber);\n// => { 'age': 40 }\n
    \n
    \n
    \n\n
    " } ,{ "href":"/result", - "html":"

    result source npm

    \n
    _.result(object, path, [defaultValue])
    \n\n

    This method is like _.get except that if the resolved value is a function\nit's invoked with the this binding of its parent object and its result\nis returned.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to query.

      \n
    2. \n
    3. path (Array|string)

      The path of the property to resolve.

      \n
    4. \n
    5. [defaultValue] (*)

      The value returned if the resolved value is undefined.

      \n
    6. \n
    \n

    返回值 (*)

    \n

    Returns the resolved value.

    \n
    \n

    示例

    \n
    var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };\n\n_.result(object, 'a[0].b.c1');\n// => 3\n\n_.result(object, 'a[0].b.c2');\n// => 4\n\n_.result(object, 'a[0].b.c3', 'default');\n// => 'default'\n\n_.result(object, 'a[0].b.c3', _.constant('default'));\n// => 'default'\n
    \n
    \n
    \n\n
    " } + "html":"

    result source npm

    \n
    _.result(object, path, [defaultValue])
    \n\n

    This method is like _.get except that if the resolved value is a function\nit's invoked with the this binding of its parent object and its result\nis returned.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to query.

      \n
    2. \n
    3. path (Array|string)

      The path of the property to resolve.

      \n
    4. \n
    5. [defaultValue] (*)

      The value returned if the resolved value is undefined.

      \n
    6. \n
    \n

    返回值 (*)

    \n

    Returns the resolved value.

    \n
    \n

    示例

    \n
    var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };\n\n_.result(object, 'a[0].b.c1');\n// => 3\n\n_.result(object, 'a[0].b.c2');\n// => 4\n\n_.result(object, 'a[0].b.c3', 'default');\n// => 'default'\n\n_.result(object, 'a[0].b.c3', _.constant('default'));\n// => 'default'\n
    \n
    \n
    \n\n
    " } ,{ "href":"/set", - "html":"

    set source npm

    \n
    _.set(object, path, value)
    \n\n

    Sets the value at path of object. If a portion of path doesn't exist\nit's created. Arrays are created for missing index properties while objects\nare created for all other missing properties. Use _.setWith to customize\npath creation.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to modify.

      \n
    2. \n
    3. path (Array|string)

      The path of the property to set.

      \n
    4. \n
    5. value (*)

      The value to set.

      \n
    6. \n
    \n

    返回值 (Object)

    \n

    Returns object.

    \n
    \n

    示例

    \n
    var object = { 'a': [{ 'b': { 'c': 3 } }] };\n\n_.set(object, 'a[0].b.c', 4);\nconsole.log(object.a[0].b.c);\n// => 4\n\n_.set(object, 'x[0].y.z', 5);\nconsole.log(object.x[0].y.z);\n// => 5\n
    \n
    \n
    \n\n
    " } + "html":"

    set source npm

    \n
    _.set(object, path, value)
    \n\n

    Sets the value at path of object. If a portion of path doesn't exist\nit's created. Arrays are created for missing index properties while objects\nare created for all other missing properties. Use _.setWith to customize\npath creation.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to modify.

      \n
    2. \n
    3. path (Array|string)

      The path of the property to set.

      \n
    4. \n
    5. value (*)

      The value to set.

      \n
    6. \n
    \n

    返回值 (Object)

    \n

    Returns object.

    \n
    \n

    示例

    \n
    var object = { 'a': [{ 'b': { 'c': 3 } }] };\n\n_.set(object, 'a[0].b.c', 4);\nconsole.log(object.a[0].b.c);\n// => 4\n\n_.set(object, 'x[0].y.z', 5);\nconsole.log(object.x[0].y.z);\n// => 5\n
    \n
    \n
    \n\n
    " } ,{ "href":"/setWith", - "html":"

    setWith source npm

    \n
    _.setWith(object, path, value, [customizer])
    \n\n

    This method is like _.set except that it accepts customizer which is\ninvoked to produce the objects of path. If customizer returns undefined\npath creation is handled by the method instead. The customizer is invoked\nwith three arguments: (nsValue, key, nsObject).

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to modify.

      \n
    2. \n
    3. path (Array|string)

      The path of the property to set.

      \n
    4. \n
    5. value (*)

      The value to set.

      \n
    6. \n
    7. [customizer] (Function)

      The function to customize assigned values.

      \n
    8. \n
    \n

    返回值 (Object)

    \n

    Returns object.

    \n
    \n

    示例

    \n
    _.setWith({ '0': { 'length': 2 } }, '[0][1][2]', 3, Object);\n// => { '0': { '1': { '2': 3 }, 'length': 2 } }\n
    \n
    \n
    \n\n
    " } + "html":"

    setWith source npm

    \n
    _.setWith(object, path, value, [customizer])
    \n\n

    This method is like _.set except that it accepts customizer which is\ninvoked to produce the objects of path. If customizer returns undefined\npath creation is handled by the method instead. The customizer is invoked\nwith three arguments: (nsValue, key, nsObject).

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to modify.

      \n
    2. \n
    3. path (Array|string)

      The path of the property to set.

      \n
    4. \n
    5. value (*)

      The value to set.

      \n
    6. \n
    7. [customizer] (Function)

      The function to customize assigned values.

      \n
    8. \n
    \n

    返回值 (Object)

    \n

    Returns object.

    \n
    \n

    示例

    \n
    _.setWith({ '0': { 'length': 2 } }, '[0][1][2]', 3, Object);\n// => { '0': { '1': { '2': 3 }, 'length': 2 } }\n
    \n
    \n
    \n\n
    " } ,{ "href":"/toPairs", - "html":"

    toPairs source npm

    \n
    _.toPairs(object)
    \n\n

    Creates an array of own enumerable key-value pairs for object.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to query.

      \n
    2. \n
    \n

    返回值 (Array)

    \n

    Returns the new array of key-value pairs.

    \n
    \n

    示例

    \n
    function Foo() {\n  this.a = 1;\n  this.b = 2;\n}\n\nFoo.prototype.c = 3;\n\n_.toPairs(new Foo);\n// => [['a', 1], ['b', 2]] (iteration order is not guaranteed)\n
    \n
    \n
    \n\n
    " } + "html":"

    toPairs source npm

    \n
    _.toPairs(object)
    \n\n

    Creates an array of own enumerable key-value pairs for object.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to query.

      \n
    2. \n
    \n

    返回值 (Array)

    \n

    Returns the new array of key-value pairs.

    \n
    \n

    示例

    \n
    function Foo() {\n  this.a = 1;\n  this.b = 2;\n}\n\nFoo.prototype.c = 3;\n\n_.toPairs(new Foo);\n// => [['a', 1], ['b', 2]] (无法保证遍历的顺序)\n
    \n
    \n
    \n\n
    " } ,{ "href":"/toPairsIn", - "html":"

    toPairsIn source npm

    \n
    _.toPairsIn(object)
    \n\n

    Creates an array of own and inherited enumerable key-value pairs for object.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to query.

      \n
    2. \n
    \n

    返回值 (Array)

    \n

    Returns the new array of key-value pairs.

    \n
    \n

    示例

    \n
    function Foo() {\n  this.a = 1;\n  this.b = 2;\n}\n\nFoo.prototype.c = 3;\n\n_.toPairsIn(new Foo);\n// => [['a', 1], ['b', 2], ['c', 1]] (iteration order is not guaranteed)\n
    \n
    \n
    \n\n
    " } + "html":"

    toPairsIn source npm

    \n
    _.toPairsIn(object)
    \n\n

    Creates an array of own and inherited enumerable key-value pairs for object.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to query.

      \n
    2. \n
    \n

    返回值 (Array)

    \n

    Returns the new array of key-value pairs.

    \n
    \n

    示例

    \n
    function Foo() {\n  this.a = 1;\n  this.b = 2;\n}\n\nFoo.prototype.c = 3;\n\n_.toPairsIn(new Foo);\n// => [['a', 1], ['b', 2], ['c', 1]] (无法保证遍历的顺序)\n
    \n
    \n
    \n\n
    " } ,{ "href":"/transform", - "html":"

    transform source npm

    \n
    _.transform(object, [iteratee=_.identity], [accumulator])
    \n\n

    An alternative to _.reduce; this method transforms object to a new\naccumulator object which is the result of running each of its own enumerable\nproperties through iteratee, with each invocation potentially mutating\nthe accumulator object. The iteratee is invoked with four arguments:
    \n(accumulator, value, key, object). Iteratee functions may exit iteration\nearly by explicitly returning false.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Array|Object)

      The object to iterate over.

      \n
    2. \n
    3. [iteratee=_.identity] (Function)

      The function invoked per iteration.

      \n
    4. \n
    5. [accumulator] (*)

      The custom accumulator value.

      \n
    6. \n
    \n

    返回值 (*)

    \n

    Returns the accumulated value.

    \n
    \n

    示例

    \n
    _.transform([2, 3, 4], function(result, n) {\n  result.push(n *= n);\n  return n % 2 == 0;\n});\n// => [4, 9]\n\n_.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {\n  (result[value] || (result[value] = [])).push(key);\n});\n// => { '1': ['a', 'c'], '2': ['b'] }\n
    \n
    \n
    \n\n
    " } + "html":"

    transform source npm

    \n
    _.transform(object, [iteratee=_.identity], [accumulator])
    \n\n

    An alternative to _.reduce; this method transforms object to a new\naccumulator object which is the result of running each of its own enumerable\nproperties through iteratee, with each invocation potentially mutating\nthe accumulator object. The iteratee is invoked with four arguments:
    \n(accumulator, value, key, object). Iteratee functions may exit iteration\nearly by explicitly returning false.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Array|Object)

      The object to iterate over.

      \n
    2. \n
    3. [iteratee=_.identity] (Function)

      这个函数会处理每一个元素

      \n
    4. \n
    5. [accumulator] (*)

      The custom accumulator value.

      \n
    6. \n
    \n

    返回值 (*)

    \n

    Returns the accumulated value.

    \n
    \n

    示例

    \n
    _.transform([2, 3, 4], function(result, n) {\n  result.push(n *= n);\n  return n % 2 == 0;\n});\n// => [4, 9]\n\n_.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {\n  (result[value] || (result[value] = [])).push(key);\n});\n// => { '1': ['a', 'c'], '2': ['b'] }\n
    \n
    \n
    \n\n
    " } ,{ "href":"/unset", - "html":"

    unset source npm

    \n
    _.unset(object, path)
    \n\n

    Removes the property at path of object.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to modify.

      \n
    2. \n
    3. path (Array|string)

      The path of the property to unset.

      \n
    4. \n
    \n

    返回值 (boolean)

    \n

    Returns true if the property is deleted, else false.

    \n
    \n

    示例

    \n
    var object = { 'a': [{ 'b': { 'c': 7 } }] };\n_.unset(object, 'a[0].b.c');\n// => true\n\nconsole.log(object);\n// => { 'a': [{ 'b': {} }] };\n\n_.unset(object, 'a[0].b.c');\n// => true\n\nconsole.log(object);\n// => { 'a': [{ 'b': {} }] };\n
    \n
    \n
    \n\n
    " } + "html":"

    unset source npm

    \n
    _.unset(object, path)
    \n\n

    Removes the property at path of object.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to modify.

      \n
    2. \n
    3. path (Array|string)

      The path of the property to unset.

      \n
    4. \n
    \n

    返回值 (boolean)

    \n

    Returns true if the property is deleted, else false.

    \n
    \n

    示例

    \n
    var object = { 'a': [{ 'b': { 'c': 7 } }] };\n_.unset(object, 'a[0].b.c');\n// => true\n\nconsole.log(object);\n// => { 'a': [{ 'b': {} }] };\n\n_.unset(object, 'a[0].b.c');\n// => true\n\nconsole.log(object);\n// => { 'a': [{ 'b': {} }] };\n
    \n
    \n
    \n\n
    " } ,{ "href":"/values", - "html":"

    values source npm

    \n
    _.values(object)
    \n\n

    Creates an array of the own enumerable property values of object.\n
    \n
    \n注意: Non-object values are coerced to objects.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to query.

      \n
    2. \n
    \n

    返回值 (Array)

    \n

    Returns the array of property values.

    \n
    \n

    示例

    \n
    function Foo() {\n  this.a = 1;\n  this.b = 2;\n}\n\nFoo.prototype.c = 3;\n\n_.values(new Foo);\n// => [1, 2] (iteration order is not guaranteed)\n\n_.values('hi');\n// => ['h', 'i']\n
    \n
    \n
    \n\n
    " } + "html":"

    values source npm

    \n
    _.values(object)
    \n\n

    Creates an array of the own enumerable property values of object.\n
    \n
    \n注意: Non-object values are coerced to objects.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to query.

      \n
    2. \n
    \n

    返回值 (Array)

    \n

    Returns the array of property values.

    \n
    \n

    示例

    \n
    function Foo() {\n  this.a = 1;\n  this.b = 2;\n}\n\nFoo.prototype.c = 3;\n\n_.values(new Foo);\n// => [1, 2] (无法保证遍历的顺序)\n\n_.values('hi');\n// => ['h', 'i']\n
    \n
    \n
    \n\n
    " } ,{ "href":"/valuesIn", - "html":"

    valuesIn source npm

    \n
    _.valuesIn(object)
    \n\n

    Creates an array of the own and inherited enumerable property values of object.\n
    \n
    \n注意: Non-object values are coerced to objects.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to query.

      \n
    2. \n
    \n

    返回值 (Array)

    \n

    Returns the array of property values.

    \n
    \n

    示例

    \n
    function Foo() {\n  this.a = 1;\n  this.b = 2;\n}\n\nFoo.prototype.c = 3;\n\n_.valuesIn(new Foo);\n// => [1, 2, 3] (iteration order is not guaranteed)\n
    \n
    \n
    \n\n
    " } + "html":"

    valuesIn source npm

    \n
    _.valuesIn(object)
    \n\n

    Creates an array of the own and inherited enumerable property values of object.\n
    \n
    \n注意: Non-object values are coerced to objects.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to query.

      \n
    2. \n
    \n

    返回值 (Array)

    \n

    Returns the array of property values.

    \n
    \n

    示例

    \n
    function Foo() {\n  this.a = 1;\n  this.b = 2;\n}\n\nFoo.prototype.c = 3;\n\n_.valuesIn(new Foo);\n// => [1, 2, 3] (无法保证遍历的顺序)\n
    \n
    \n
    \n\n
    " } ,{ "href":"/templateSettings", "html":"

    templateSettings source npm

    \n
    _.templateSettings
    \n\n

    (Object): By default, the template delimiters used by lodash are like those in\nembedded Ruby (ERB). Change the following template settings to use\nalternative delimiters.

    \n
    \n\n
    \n\n
    " } ,{ "href":"/templateSettings-escape", @@ -465,121 +465,121 @@ ,{ "href":"/templateSettings-variable", "html":"

    templateSettings.variable source

    \n
    _.templateSettings.variable
    \n\n

    (string): Used to reference the data object in the template text.

    \n
    \n\n
    \n\n
    " } ,{ "href":"/VERSION", - "html":"

    VERSION source

    \n
    _.VERSION
    \n\n

    (string): The semantic version number.

    \n
    \n\n
    \n\n
    " } + "html":"

    VERSION source

    \n
    _.VERSION
    \n\n

    (string): The semantic version number.

    \n
    \n\n
    \n\n
    " } ,{ "href":"/camelCase", - "html":"

    camelCase source npm

    \n
    _.camelCase([string=''])
    \n\n

    Converts string to camel case.

    \n
    \n\n

    参数

    \n
      \n
    1. [string=''] (string)

      The string to convert.

      \n
    2. \n
    \n

    返回值 (string)

    \n

    Returns the camel cased string.

    \n
    \n

    示例

    \n
    _.camelCase('Foo Bar');\n// => 'fooBar'\n\n_.camelCase('--foo-bar');\n// => 'fooBar'\n\n_.camelCase('__foo_bar__');\n// => 'fooBar'\n
    \n
    \n
    \n\n
    " } + "html":"

    camelCase source npm

    \n
    _.camelCase([string=''])
    \n\n

    Converts string to camel case.

    \n
    \n\n

    参数

    \n
      \n
    1. [string=''] (string)

      The string to convert.

      \n
    2. \n
    \n

    返回值 (string)

    \n

    Returns the camel cased string.

    \n
    \n

    示例

    \n
    _.camelCase('Foo Bar');\n// => 'fooBar'\n\n_.camelCase('--foo-bar');\n// => 'fooBar'\n\n_.camelCase('__foo_bar__');\n// => 'fooBar'\n
    \n
    \n
    \n\n
    " } ,{ "href":"/capitalize", - "html":"

    capitalize source npm

    \n
    _.capitalize([string=''])
    \n\n

    Converts the first character of string to upper case and the remaining\nto lower case.

    \n
    \n\n

    参数

    \n
      \n
    1. [string=''] (string)

      The string to capitalize.

      \n
    2. \n
    \n

    返回值 (string)

    \n

    Returns the capitalized string.

    \n
    \n

    示例

    \n
    _.capitalize('FRED');\n// => 'Fred'\n
    \n
    \n
    \n\n
    " } + "html":"

    capitalize source npm

    \n
    _.capitalize([string=''])
    \n\n

    Converts the first character of string to upper case and the remaining\nto lower case.

    \n
    \n\n

    参数

    \n
      \n
    1. [string=''] (string)

      The string to capitalize.

      \n
    2. \n
    \n

    返回值 (string)

    \n

    Returns the capitalized string.

    \n
    \n

    示例

    \n
    _.capitalize('FRED');\n// => 'Fred'\n
    \n
    \n
    \n\n
    " } ,{ "href":"/deburr", - "html":"

    deburr source npm

    \n
    _.deburr([string=''])
    \n\n

    Deburrs string by converting latin-1 supplementary letters#Character_table)\nto basic latin letters and removing combining diacritical marks.

    \n
    \n\n

    参数

    \n
      \n
    1. [string=''] (string)

      The string to deburr.

      \n
    2. \n
    \n

    返回值 (string)

    \n

    Returns the deburred string.

    \n
    \n

    示例

    \n
    _.deburr('déjà vu');\n// => 'deja vu'\n
    \n
    \n
    \n\n
    " } + "html":"

    deburr source npm

    \n
    _.deburr([string=''])
    \n\n

    Deburrs string by converting latin-1 supplementary letters#Character_table)\nto basic latin letters and removing combining diacritical marks.

    \n
    \n\n

    参数

    \n
      \n
    1. [string=''] (string)

      The string to deburr.

      \n
    2. \n
    \n

    返回值 (string)

    \n

    Returns the deburred string.

    \n
    \n

    示例

    \n
    _.deburr('déjà vu');\n// => 'deja vu'\n
    \n
    \n
    \n\n
    " } ,{ "href":"/endsWith", - "html":"

    endsWith source npm

    \n
    _.endsWith([string=''], [target], [position=string.length])
    \n\n

    Checks if string ends with the given target string.

    \n
    \n\n

    参数

    \n
      \n
    1. [string=''] (string)

      The string to search.

      \n
    2. \n
    3. [target] (string)

      The string to search for.

      \n
    4. \n
    5. [position=string.length] (number)

      The position to search from.

      \n
    6. \n
    \n

    返回值 (boolean)

    \n

    Returns true if string ends with target, else false.

    \n
    \n

    示例

    \n
    _.endsWith('abc', 'c');\n// => true\n\n_.endsWith('abc', 'b');\n// => false\n\n_.endsWith('abc', 'b', 2);\n// => true\n
    \n
    \n
    \n\n
    " } + "html":"

    endsWith source npm

    \n
    _.endsWith([string=''], [target], [position=string.length])
    \n\n

    Checks if string ends with the given target string.

    \n
    \n\n

    参数

    \n
      \n
    1. [string=''] (string)

      The string to search.

      \n
    2. \n
    3. [target] (string)

      The string to search for.

      \n
    4. \n
    5. [position=string.length] (number)

      The position to search from.

      \n
    6. \n
    \n

    返回值 (boolean)

    \n

    Returns true if string ends with target, else false.

    \n
    \n

    示例

    \n
    _.endsWith('abc', 'c');\n// => true\n\n_.endsWith('abc', 'b');\n// => false\n\n_.endsWith('abc', 'b', 2);\n// => true\n
    \n
    \n
    \n\n
    " } ,{ "href":"/escape", - "html":"

    escape source npm

    \n
    _.escape([string=''])
    \n\n

    Converts the characters "&", "<", ">", '"', "'", and "`" in string to\ntheir corresponding HTML entities.\n
    \n
    \n注意: No other characters are escaped. To escape additional\ncharacters use a third-party library like he.\n
    \n
    \nThough the ">" character is escaped for symmetry, characters like\n">" and "/" don't need escaping in HTML and have no special meaning\nunless they're part of a tag or unquoted attribute value.\nSee Mathias Bynens's article\n(under "semi-related fun fact") for more details.\n
    \n
    \nBackticks are escaped because in IE < 9, they can break out of\nattribute values or HTML comments. See #59,\n#102, #108, and\n#133 of the HTML5 Security Cheatsheet\nfor more details.\n
    \n
    \nWhen working with HTML you should always quote attribute values\nto reduce XSS vectors.

    \n
    \n\n

    参数

    \n
      \n
    1. [string=''] (string)

      The string to escape.

      \n
    2. \n
    \n

    返回值 (string)

    \n

    Returns the escaped string.

    \n
    \n

    示例

    \n
    _.escape('fred, barney, & pebbles');\n// => 'fred, barney, &amp; pebbles'\n
    \n
    \n
    \n\n
    " } + "html":"

    escape source npm

    \n
    _.escape([string=''])
    \n\n

    Converts the characters "&", "<", ">", '"', "'", and "`" in string to\ntheir corresponding HTML entities.\n
    \n
    \n注意: No other characters are escaped. To escape additional\ncharacters use a third-party library like he.\n
    \n
    \nThough the ">" character is escaped for symmetry, characters like\n">" and "/" don't need escaping in HTML and have no special meaning\nunless they're part of a tag or unquoted attribute value.\nSee Mathias Bynens's article\n(under "semi-related fun fact") for more details.\n
    \n
    \nBackticks are escaped because in IE < 9, they can break out of\nattribute values or HTML comments. See #59,\n#102, #108, and\n#133 of the HTML5 Security Cheatsheet\nfor more details.\n
    \n
    \nWhen working with HTML you should always quote attribute values\nto reduce XSS vectors.

    \n
    \n\n

    参数

    \n
      \n
    1. [string=''] (string)

      The string to escape.

      \n
    2. \n
    \n

    返回值 (string)

    \n

    Returns the escaped string.

    \n
    \n

    示例

    \n
    _.escape('fred, barney, & pebbles');\n// => 'fred, barney, &amp; pebbles'\n
    \n
    \n
    \n\n
    " } ,{ "href":"/escapeRegExp", - "html":"

    escapeRegExp source npm

    \n
    _.escapeRegExp([string=''])
    \n\n

    Escapes the RegExp special characters "^", "$", "\\", ".", "*", "+",\n"?", "(", ")", "[", "]", "{", "}", and "|" in string.

    \n
    \n\n

    参数

    \n
      \n
    1. [string=''] (string)

      The string to escape.

      \n
    2. \n
    \n

    返回值 (string)

    \n

    Returns the escaped string.

    \n
    \n

    示例

    \n
    _.escapeRegExp('[lodash](https://lodash.com/)');\n// => '\\[lodash\\]\\(https://lodash\\.com/\\)'\n
    \n
    \n
    \n\n
    " } + "html":"

    escapeRegExp source npm

    \n
    _.escapeRegExp([string=''])
    \n\n

    Escapes the RegExp special characters "^", "$", "\\", ".", "*", "+",\n"?", "(", ")", "[", "]", "{", "}", and "|" in string.

    \n
    \n\n

    参数

    \n
      \n
    1. [string=''] (string)

      The string to escape.

      \n
    2. \n
    \n

    返回值 (string)

    \n

    Returns the escaped string.

    \n
    \n

    示例

    \n
    _.escapeRegExp('[lodash](https://lodash.com/)');\n// => '\\[lodash\\]\\(https://lodash\\.com/\\)'\n
    \n
    \n
    \n\n
    " } ,{ "href":"/kebabCase", - "html":"

    kebabCase source npm

    \n
    _.kebabCase([string=''])
    \n\n

    Converts string to kebab case.

    \n
    \n\n

    参数

    \n
      \n
    1. [string=''] (string)

      The string to convert.

      \n
    2. \n
    \n

    返回值 (string)

    \n

    Returns the kebab cased string.

    \n
    \n

    示例

    \n
    _.kebabCase('Foo Bar');\n// => 'foo-bar'\n\n_.kebabCase('fooBar');\n// => 'foo-bar'\n\n_.kebabCase('__foo_bar__');\n// => 'foo-bar'\n
    \n
    \n
    \n\n
    " } + "html":"

    kebabCase source npm

    \n
    _.kebabCase([string=''])
    \n\n

    Converts string to kebab case.

    \n
    \n\n

    参数

    \n
      \n
    1. [string=''] (string)

      The string to convert.

      \n
    2. \n
    \n

    返回值 (string)

    \n

    Returns the kebab cased string.

    \n
    \n

    示例

    \n
    _.kebabCase('Foo Bar');\n// => 'foo-bar'\n\n_.kebabCase('fooBar');\n// => 'foo-bar'\n\n_.kebabCase('__foo_bar__');\n// => 'foo-bar'\n
    \n
    \n
    \n\n
    " } ,{ "href":"/lowerCase", - "html":"

    lowerCase source npm

    \n
    _.lowerCase([string=''])
    \n\n

    Converts string, as space separated words, to lower case.

    \n
    \n\n

    参数

    \n
      \n
    1. [string=''] (string)

      The string to convert.

      \n
    2. \n
    \n

    返回值 (string)

    \n

    Returns the lower cased string.

    \n
    \n

    示例

    \n
    _.lowerCase('--Foo-Bar');\n// => 'foo bar'\n\n_.lowerCase('fooBar');\n// => 'foo bar'\n\n_.lowerCase('__FOO_BAR__');\n// => 'foo bar'\n
    \n
    \n
    \n\n
    " } + "html":"

    lowerCase source npm

    \n
    _.lowerCase([string=''])
    \n\n

    Converts string, as space separated words, to lower case.

    \n
    \n\n

    参数

    \n
      \n
    1. [string=''] (string)

      The string to convert.

      \n
    2. \n
    \n

    返回值 (string)

    \n

    Returns the lower cased string.

    \n
    \n

    示例

    \n
    _.lowerCase('--Foo-Bar');\n// => 'foo bar'\n\n_.lowerCase('fooBar');\n// => 'foo bar'\n\n_.lowerCase('__FOO_BAR__');\n// => 'foo bar'\n
    \n
    \n
    \n\n
    " } ,{ "href":"/lowerFirst", - "html":"

    lowerFirst source npm

    \n
    _.lowerFirst([string=''])
    \n\n

    Converts the first character of string to lower case.

    \n
    \n\n

    参数

    \n
      \n
    1. [string=''] (string)

      The string to convert.

      \n
    2. \n
    \n

    返回值 (string)

    \n

    Returns the converted string.

    \n
    \n

    示例

    \n
    _.lowerFirst('Fred');\n// => 'fred'\n\n_.lowerFirst('FRED');\n// => 'fRED'\n
    \n
    \n
    \n\n
    " } + "html":"

    lowerFirst source npm

    \n
    _.lowerFirst([string=''])
    \n\n

    Converts the first character of string to lower case.

    \n
    \n\n

    参数

    \n
      \n
    1. [string=''] (string)

      The string to convert.

      \n
    2. \n
    \n

    返回值 (string)

    \n

    Returns the converted string.

    \n
    \n

    示例

    \n
    _.lowerFirst('Fred');\n// => 'fred'\n\n_.lowerFirst('FRED');\n// => 'fRED'\n
    \n
    \n
    \n\n
    " } ,{ "href":"/pad", - "html":"

    pad source npm

    \n
    _.pad([string=''], [length=0], [chars=' '])
    \n\n

    Pads string on the left and right sides if it's shorter than length.\nPadding characters are truncated if they can't be evenly divided by length.

    \n
    \n\n

    参数

    \n
      \n
    1. [string=''] (string)

      The string to pad.

      \n
    2. \n
    3. [length=0] (number)

      The padding length.

      \n
    4. \n
    5. [chars=' '] (string)

      The string used as padding.

      \n
    6. \n
    \n

    返回值 (string)

    \n

    Returns the padded string.

    \n
    \n

    示例

    \n
    _.pad('abc', 8);\n// => '  abc   '\n\n_.pad('abc', 8, '_-');\n// => '_-abc_-_'\n\n_.pad('abc', 3);\n// => 'abc'\n
    \n
    \n
    \n\n
    " } + "html":"

    pad source npm

    \n
    _.pad([string=''], [length=0], [chars=' '])
    \n\n

    Pads string on the left and right sides if it's shorter than length.\nPadding characters are truncated if they can't be evenly divided by length.

    \n
    \n\n

    参数

    \n
      \n
    1. [string=''] (string)

      The string to pad.

      \n
    2. \n
    3. [length=0] (number)

      The padding length.

      \n
    4. \n
    5. [chars=' '] (string)

      The string used as padding.

      \n
    6. \n
    \n

    返回值 (string)

    \n

    Returns the padded string.

    \n
    \n

    示例

    \n
    _.pad('abc', 8);\n// => '  abc   '\n\n_.pad('abc', 8, '_-');\n// => '_-abc_-_'\n\n_.pad('abc', 3);\n// => 'abc'\n
    \n
    \n
    \n\n
    " } ,{ "href":"/padEnd", - "html":"

    padEnd source npm

    \n
    _.padEnd([string=''], [length=0], [chars=' '])
    \n\n

    Pads string on the right side if it's shorter than length. Padding\ncharacters are truncated if they exceed length.

    \n
    \n\n

    参数

    \n
      \n
    1. [string=''] (string)

      The string to pad.

      \n
    2. \n
    3. [length=0] (number)

      The padding length.

      \n
    4. \n
    5. [chars=' '] (string)

      The string used as padding.

      \n
    6. \n
    \n

    返回值 (string)

    \n

    Returns the padded string.

    \n
    \n

    示例

    \n
    _.padEnd('abc', 6);\n// => 'abc   '\n\n_.padEnd('abc', 6, '_-');\n// => 'abc_-_'\n\n_.padEnd('abc', 3);\n// => 'abc'\n
    \n
    \n
    \n\n
    " } + "html":"

    padEnd source npm

    \n
    _.padEnd([string=''], [length=0], [chars=' '])
    \n\n

    Pads string on the right side if it's shorter than length. Padding\ncharacters are truncated if they exceed length.

    \n
    \n\n

    参数

    \n
      \n
    1. [string=''] (string)

      The string to pad.

      \n
    2. \n
    3. [length=0] (number)

      The padding length.

      \n
    4. \n
    5. [chars=' '] (string)

      The string used as padding.

      \n
    6. \n
    \n

    返回值 (string)

    \n

    Returns the padded string.

    \n
    \n

    示例

    \n
    _.padEnd('abc', 6);\n// => 'abc   '\n\n_.padEnd('abc', 6, '_-');\n// => 'abc_-_'\n\n_.padEnd('abc', 3);\n// => 'abc'\n
    \n
    \n
    \n\n
    " } ,{ "href":"/padStart", - "html":"

    padStart source npm

    \n
    _.padStart([string=''], [length=0], [chars=' '])
    \n\n

    Pads string on the left side if it's shorter than length. Padding\ncharacters are truncated if they exceed length.

    \n
    \n\n

    参数

    \n
      \n
    1. [string=''] (string)

      The string to pad.

      \n
    2. \n
    3. [length=0] (number)

      The padding length.

      \n
    4. \n
    5. [chars=' '] (string)

      The string used as padding.

      \n
    6. \n
    \n

    返回值 (string)

    \n

    Returns the padded string.

    \n
    \n

    示例

    \n
    _.padStart('abc', 6);\n// => '   abc'\n\n_.padStart('abc', 6, '_-');\n// => '_-_abc'\n\n_.padStart('abc', 3);\n// => 'abc'\n
    \n
    \n
    \n\n
    " } + "html":"

    padStart source npm

    \n
    _.padStart([string=''], [length=0], [chars=' '])
    \n\n

    Pads string on the left side if it's shorter than length. Padding\ncharacters are truncated if they exceed length.

    \n
    \n\n

    参数

    \n
      \n
    1. [string=''] (string)

      The string to pad.

      \n
    2. \n
    3. [length=0] (number)

      The padding length.

      \n
    4. \n
    5. [chars=' '] (string)

      The string used as padding.

      \n
    6. \n
    \n

    返回值 (string)

    \n

    Returns the padded string.

    \n
    \n

    示例

    \n
    _.padStart('abc', 6);\n// => '   abc'\n\n_.padStart('abc', 6, '_-');\n// => '_-_abc'\n\n_.padStart('abc', 3);\n// => 'abc'\n
    \n
    \n
    \n\n
    " } ,{ "href":"/parseInt", - "html":"

    parseInt source npm

    \n
    _.parseInt(string, [radix])
    \n\n

    Converts string to an integer of the specified radix. If radix is\nundefined or 0, a radix of 10 is used unless value is a hexadecimal,\nin which case a radix of 16 is used.\n
    \n
    \n注意: This method aligns with the ES5 implementation\nof parseInt.

    \n
    \n\n

    参数

    \n
      \n
    1. string (string)

      The string to convert.

      \n
    2. \n
    3. [radix] (number)

      The radix to interpret value by.

      \n
    4. \n
    \n

    返回值 (number)

    \n

    Returns the converted integer.

    \n
    \n

    示例

    \n
    _.parseInt('08');\n// => 8\n\n_.map(['6', '08', '10'], _.parseInt);\n// => [6, 8, 10]\n
    \n
    \n
    \n\n
    " } + "html":"

    parseInt source npm

    \n
    _.parseInt(string, [radix])
    \n\n

    Converts string to an integer of the specified radix. If radix is\nundefined or 0, a radix of 10 is used unless value is a hexadecimal,\nin which case a radix of 16 is used.\n
    \n
    \n注意: This method aligns with the ES5 implementation\nof parseInt.

    \n
    \n\n

    参数

    \n
      \n
    1. string (string)

      The string to convert.

      \n
    2. \n
    3. [radix] (number)

      The radix to interpret value by.

      \n
    4. \n
    \n

    返回值 (number)

    \n

    Returns the converted integer.

    \n
    \n

    示例

    \n
    _.parseInt('08');\n// => 8\n\n_.map(['6', '08', '10'], _.parseInt);\n// => [6, 8, 10]\n
    \n
    \n
    \n\n
    " } ,{ "href":"/repeat", - "html":"

    repeat source npm

    \n
    _.repeat([string=''], [n=0])
    \n\n

    Repeats the given string n times.

    \n
    \n\n

    参数

    \n
      \n
    1. [string=''] (string)

      The string to repeat.

      \n
    2. \n
    3. [n=0] (number)

      The number of times to repeat the string.

      \n
    4. \n
    \n

    返回值 (string)

    \n

    Returns the repeated string.

    \n
    \n

    示例

    \n
    _.repeat('*', 3);\n// => '***'\n\n_.repeat('abc', 2);\n// => 'abcabc'\n\n_.repeat('abc', 0);\n// => ''\n
    \n
    \n
    \n\n
    " } + "html":"

    repeat source npm

    \n
    _.repeat([string=''], [n=0])
    \n\n

    Repeats the given string n times.

    \n
    \n\n

    参数

    \n
      \n
    1. [string=''] (string)

      The string to repeat.

      \n
    2. \n
    3. [n=0] (number)

      The number of times to repeat the string.

      \n
    4. \n
    \n

    返回值 (string)

    \n

    Returns the repeated string.

    \n
    \n

    示例

    \n
    _.repeat('*', 3);\n// => '***'\n\n_.repeat('abc', 2);\n// => 'abcabc'\n\n_.repeat('abc', 0);\n// => ''\n
    \n
    \n
    \n\n
    " } ,{ "href":"/replace", - "html":"

    replace source npm

    \n
    _.replace([string=''], pattern, replacement)
    \n\n

    Replaces matches for pattern in string with replacement.\n
    \n
    \n注意: This method is based on String#replace.

    \n
    \n\n

    参数

    \n
      \n
    1. [string=''] (string)

      The string to modify.

      \n
    2. \n
    3. pattern (RegExp|string)

      The pattern to replace.

      \n
    4. \n
    5. replacement (Function|string)

      The match replacement.

      \n
    6. \n
    \n

    返回值 (string)

    \n

    Returns the modified string.

    \n
    \n

    示例

    \n
    _.replace('Hi Fred', 'Fred', 'Barney');\n// => 'Hi Barney'\n
    \n
    \n
    \n\n
    " } + "html":"

    replace source npm

    \n
    _.replace([string=''], pattern, replacement)
    \n\n

    Replaces matches for pattern in string with replacement.\n
    \n
    \n注意: This method is based on String#replace.

    \n
    \n\n

    参数

    \n
      \n
    1. [string=''] (string)

      The string to modify.

      \n
    2. \n
    3. pattern (RegExp|string)

      The pattern to replace.

      \n
    4. \n
    5. replacement (Function|string)

      The match replacement.

      \n
    6. \n
    \n

    返回值 (string)

    \n

    Returns the modified string.

    \n
    \n

    示例

    \n
    _.replace('Hi Fred', 'Fred', 'Barney');\n// => 'Hi Barney'\n
    \n
    \n
    \n\n
    " } ,{ "href":"/snakeCase", - "html":"

    snakeCase source npm

    \n
    _.snakeCase([string=''])
    \n\n

    Converts string to snake case.

    \n
    \n\n

    参数

    \n
      \n
    1. [string=''] (string)

      The string to convert.

      \n
    2. \n
    \n

    返回值 (string)

    \n

    Returns the snake cased string.

    \n
    \n

    示例

    \n
    _.snakeCase('Foo Bar');\n// => 'foo_bar'\n\n_.snakeCase('fooBar');\n// => 'foo_bar'\n\n_.snakeCase('--foo-bar');\n// => 'foo_bar'\n
    \n
    \n
    \n\n
    " } + "html":"

    snakeCase source npm

    \n
    _.snakeCase([string=''])
    \n\n

    Converts string to snake case.

    \n
    \n\n

    参数

    \n
      \n
    1. [string=''] (string)

      The string to convert.

      \n
    2. \n
    \n

    返回值 (string)

    \n

    Returns the snake cased string.

    \n
    \n

    示例

    \n
    _.snakeCase('Foo Bar');\n// => 'foo_bar'\n\n_.snakeCase('fooBar');\n// => 'foo_bar'\n\n_.snakeCase('--foo-bar');\n// => 'foo_bar'\n
    \n
    \n
    \n\n
    " } ,{ "href":"/split", - "html":"

    split source npm

    \n
    _.split([string=''], separator, [limit])
    \n\n

    Splits string by separator.\n
    \n
    \n注意: This method is based on String#split.

    \n
    \n\n

    参数

    \n
      \n
    1. [string=''] (string)

      The string to split.

      \n
    2. \n
    3. separator (RegExp|string)

      The separator pattern to split by.

      \n
    4. \n
    5. [limit] (number)

      The length to truncate results to.

      \n
    6. \n
    \n

    返回值 (Array)

    \n

    Returns the new array of string segments.

    \n
    \n

    示例

    \n
    _.split('a-b-c', '-', 2);\n// => ['a', 'b']\n
    \n
    \n
    \n\n
    " } + "html":"

    split source npm

    \n
    _.split([string=''], separator, [limit])
    \n\n

    Splits string by separator.\n
    \n
    \n注意: This method is based on String#split.

    \n
    \n\n

    参数

    \n
      \n
    1. [string=''] (string)

      The string to split.

      \n
    2. \n
    3. separator (RegExp|string)

      The separator pattern to split by.

      \n
    4. \n
    5. [limit] (number)

      The length to truncate results to.

      \n
    6. \n
    \n

    返回值 (Array)

    \n

    Returns the new array of string segments.

    \n
    \n

    示例

    \n
    _.split('a-b-c', '-', 2);\n// => ['a', 'b']\n
    \n
    \n
    \n\n
    " } ,{ "href":"/startCase", - "html":"

    startCase source npm

    \n
    _.startCase([string=''])
    \n\n

    Converts string to start case.

    \n
    \n\n

    参数

    \n
      \n
    1. [string=''] (string)

      The string to convert.

      \n
    2. \n
    \n

    返回值 (string)

    \n

    Returns the start cased string.

    \n
    \n

    示例

    \n
    _.startCase('--foo-bar');\n// => 'Foo Bar'\n\n_.startCase('fooBar');\n// => 'Foo Bar'\n\n_.startCase('__foo_bar__');\n// => 'Foo Bar'\n
    \n
    \n
    \n\n
    " } + "html":"

    startCase source npm

    \n
    _.startCase([string=''])
    \n\n

    Converts string to start case.

    \n
    \n\n

    参数

    \n
      \n
    1. [string=''] (string)

      The string to convert.

      \n
    2. \n
    \n

    返回值 (string)

    \n

    Returns the start cased string.

    \n
    \n

    示例

    \n
    _.startCase('--foo-bar');\n// => 'Foo Bar'\n\n_.startCase('fooBar');\n// => 'Foo Bar'\n\n_.startCase('__foo_bar__');\n// => 'Foo Bar'\n
    \n
    \n
    \n\n
    " } ,{ "href":"/startsWith", - "html":"

    startsWith source npm

    \n
    _.startsWith([string=''], [target], [position=0])
    \n\n

    Checks if string starts with the given target string.

    \n
    \n\n

    参数

    \n
      \n
    1. [string=''] (string)

      The string to search.

      \n
    2. \n
    3. [target] (string)

      The string to search for.

      \n
    4. \n
    5. [position=0] (number)

      The position to search from.

      \n
    6. \n
    \n

    返回值 (boolean)

    \n

    Returns true if string starts with target, else false.

    \n
    \n

    示例

    \n
    _.startsWith('abc', 'a');\n// => true\n\n_.startsWith('abc', 'b');\n// => false\n\n_.startsWith('abc', 'b', 1);\n// => true\n
    \n
    \n
    \n\n
    " } + "html":"

    startsWith source npm

    \n
    _.startsWith([string=''], [target], [position=0])
    \n\n

    Checks if string starts with the given target string.

    \n
    \n\n

    参数

    \n
      \n
    1. [string=''] (string)

      The string to search.

      \n
    2. \n
    3. [target] (string)

      The string to search for.

      \n
    4. \n
    5. [position=0] (number)

      The position to search from.

      \n
    6. \n
    \n

    返回值 (boolean)

    \n

    Returns true if string starts with target, else false.

    \n
    \n

    示例

    \n
    _.startsWith('abc', 'a');\n// => true\n\n_.startsWith('abc', 'b');\n// => false\n\n_.startsWith('abc', 'b', 1);\n// => true\n
    \n
    \n
    \n\n
    " } ,{ "href":"/template", - "html":"

    template source npm

    \n
    _.template([string=''], [options])
    \n\n

    Creates a compiled template function that can interpolate data properties\nin "interpolate" delimiters, HTML-escape interpolated data properties in\n"escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data\nproperties may be accessed as free variables in the template. If a setting\nobject is provided it takes precedence over _.templateSettings values.\n
    \n
    \n注意: In the development build _.template utilizes\nsourceURLs\nfor easier debugging.\n
    \n
    \nFor more information on precompiling templates see\nlodash's custom builds documentation.\n
    \n
    \nFor more information on Chrome extension sandboxes see\nChrome's extensions documentation.

    \n
    \n\n

    参数

    \n
      \n
    1. [string=''] (string)

      The template string.

      \n
    2. \n
    3. [options] (Object)

      The options object.

      \n
    4. \n
    5. [options.escape] (RegExp)

      The HTML "escape" delimiter.

      \n
    6. \n
    7. [options.evaluate] (RegExp)

      The "evaluate" delimiter.

      \n
    8. \n
    9. [options.imports] (Object)

      An object to import into the template as free variables.

      \n
    10. \n
    11. [options.interpolate] (RegExp)

      The "interpolate" delimiter.

      \n
    12. \n
    13. [options.sourceURL] (string)

      The sourceURL of the template's compiled source.

      \n
    14. \n
    15. [options.variable] (string)

      The data object variable name.

      \n
    16. \n
    \n

    返回值 (Function)

    \n

    Returns the compiled template function.

    \n
    \n

    示例

    \n
    // using the \"interpolate\" delimiter to create a compiled template\nvar compiled = _.template('hello <%= user %>!');\ncompiled({ 'user': 'fred' });\n// => 'hello fred!'\n\n// using the HTML \"escape\" delimiter to escape data property values\nvar compiled = _.template('<b><%- value %></b>');\ncompiled({ 'value': '<script>' });\n// => '<b>&lt;script&gt;</b>'\n\n// using the \"evaluate\" delimiter to execute JavaScript and generate HTML\nvar compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');\ncompiled({ 'users': ['fred', 'barney'] });\n// => '<li>fred</li><li>barney</li>'\n\n// using the internal `print` function in \"evaluate\" delimiters\nvar compiled = _.template('<% print(\"hello \" + user); %>!');\ncompiled({ 'user': 'barney' });\n// => 'hello barney!'\n\n// using the ES delimiter as an alternative to the default \"interpolate\" delimiter\nvar compiled = _.template('hello ${ user }!');\ncompiled({ 'user': 'pebbles' });\n// => 'hello pebbles!'\n\n// using custom template delimiters\n_.templateSettings.interpolate = /{{([\\s\\S]+?)}}/g;\nvar compiled = _.template('hello {{ user }}!');\ncompiled({ 'user': 'mustache' });\n// => 'hello mustache!'\n\n// using backslashes to treat delimiters as plain text\nvar compiled = _.template('<%= \"\\\\<%- value %\\\\>\" %>');\ncompiled({ 'value': 'ignored' });\n// => '<%- value %>'\n\n// using the `imports` option to import `jQuery` as `jq`\nvar text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';\nvar compiled = _.template(text, { 'imports': { 'jq': jQuery } });\ncompiled({ 'users': ['fred', 'barney'] });\n// => '<li>fred</li><li>barney</li>'\n\n// using the `sourceURL` option to specify a custom sourceURL for the template\nvar compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });\ncompiled(data);\n// => find the source of \"greeting.jst\" under the Sources tab or Resources panel of the web inspector\n\n// using the `variable` option to ensure a with-statement isn't used in the compiled template\nvar compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });\ncompiled.source;\n// => function(data) {\n//   var __t, __p = '';\n//   __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';\n//   return __p;\n// }\n\n// using the `source` property to inline compiled templates for meaningful\n// line numbers in error messages and a stack trace\nfs.writeFileSync(path.join(cwd, 'jst.js'), '\\\n  var JST = {\\\n    \"main\": ' + _.template(mainText).source + '\\\n  };\\\n');\n
    \n
    \n
    \n\n
    " } + "html":"

    template source npm

    \n
    _.template([string=''], [options])
    \n\n

    Creates a compiled template function that can interpolate data properties\nin "interpolate" delimiters, HTML-escape interpolated data properties in\n"escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data\nproperties may be accessed as free variables in the template. If a setting\nobject is provided it takes precedence over _.templateSettings values.\n
    \n
    \n注意: In the development build _.template utilizes\nsourceURLs\nfor easier debugging.\n
    \n
    \nFor more information on precompiling templates see\nlodash's custom builds documentation.\n
    \n
    \nFor more information on Chrome extension sandboxes see\nChrome's extensions documentation.

    \n
    \n\n

    参数

    \n
      \n
    1. [string=''] (string)

      The template string.

      \n
    2. \n
    3. [options] (Object)

      The options object.

      \n
    4. \n
    5. [options.escape] (RegExp)

      The HTML "escape" delimiter.

      \n
    6. \n
    7. [options.evaluate] (RegExp)

      The "evaluate" delimiter.

      \n
    8. \n
    9. [options.imports] (Object)

      An object to import into the template as free variables.

      \n
    10. \n
    11. [options.interpolate] (RegExp)

      The "interpolate" delimiter.

      \n
    12. \n
    13. [options.sourceURL] (string)

      The sourceURL of the template's compiled source.

      \n
    14. \n
    15. [options.variable] (string)

      The data object variable name.

      \n
    16. \n
    \n

    返回值 (Function)

    \n

    Returns the compiled template function.

    \n
    \n

    示例

    \n
    // using the \"interpolate\" delimiter to create a compiled template\nvar compiled = _.template('hello <%= user %>!');\ncompiled({ 'user': 'fred' });\n// => 'hello fred!'\n\n// using the HTML \"escape\" delimiter to escape data property values\nvar compiled = _.template('<b><%- value %></b>');\ncompiled({ 'value': '<script>' });\n// => '<b>&lt;script&gt;</b>'\n\n// using the \"evaluate\" delimiter to execute JavaScript and generate HTML\nvar compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');\ncompiled({ 'users': ['fred', 'barney'] });\n// => '<li>fred</li><li>barney</li>'\n\n// using the internal `print` function in \"evaluate\" delimiters\nvar compiled = _.template('<% print(\"hello \" + user); %>!');\ncompiled({ 'user': 'barney' });\n// => 'hello barney!'\n\n// using the ES delimiter as an alternative to the default \"interpolate\" delimiter\nvar compiled = _.template('hello ${ user }!');\ncompiled({ 'user': 'pebbles' });\n// => 'hello pebbles!'\n\n// using custom template delimiters\n_.templateSettings.interpolate = /{{([\\s\\S]+?)}}/g;\nvar compiled = _.template('hello {{ user }}!');\ncompiled({ 'user': 'mustache' });\n// => 'hello mustache!'\n\n// using backslashes to treat delimiters as plain text\nvar compiled = _.template('<%= \"\\\\<%- value %\\\\>\" %>');\ncompiled({ 'value': 'ignored' });\n// => '<%- value %>'\n\n// using the `imports` option to import `jQuery` as `jq`\nvar text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';\nvar compiled = _.template(text, { 'imports': { 'jq': jQuery } });\ncompiled({ 'users': ['fred', 'barney'] });\n// => '<li>fred</li><li>barney</li>'\n\n// using the `sourceURL` option to specify a custom sourceURL for the template\nvar compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });\ncompiled(data);\n// => find the source of \"greeting.jst\" under the Sources tab or Resources panel of the web inspector\n\n// using the `variable` option to ensure a with-statement isn't used in the compiled template\nvar compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });\ncompiled.source;\n// => function(data) {\n//   var __t, __p = '';\n//   __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';\n//   return __p;\n// }\n\n// using the `source` property to inline compiled templates for meaningful\n// line numbers in error messages and a stack trace\nfs.writeFileSync(path.join(cwd, 'jst.js'), '\\\n  var JST = {\\\n    \"main\": ' + _.template(mainText).source + '\\\n  };\\\n');\n
    \n
    \n
    \n\n
    " } ,{ "href":"/toLower", - "html":"

    toLower source npm

    \n
    _.toLower([string=''])
    \n\n

    Converts string, as a whole, to lower case.

    \n
    \n\n

    参数

    \n
      \n
    1. [string=''] (string)

      The string to convert.

      \n
    2. \n
    \n

    返回值 (string)

    \n

    Returns the lower cased string.

    \n
    \n

    示例

    \n
    _.toLower('--Foo-Bar');\n// => '--foo-bar'\n\n_.toLower('fooBar');\n// => 'foobar'\n\n_.toLower('__FOO_BAR__');\n// => '__foo_bar__'\n
    \n
    \n
    \n\n
    " } + "html":"

    toLower source npm

    \n
    _.toLower([string=''])
    \n\n

    Converts string, as a whole, to lower case.

    \n
    \n\n

    参数

    \n
      \n
    1. [string=''] (string)

      The string to convert.

      \n
    2. \n
    \n

    返回值 (string)

    \n

    Returns the lower cased string.

    \n
    \n

    示例

    \n
    _.toLower('--Foo-Bar');\n// => '--foo-bar'\n\n_.toLower('fooBar');\n// => 'foobar'\n\n_.toLower('__FOO_BAR__');\n// => '__foo_bar__'\n
    \n
    \n
    \n\n
    " } ,{ "href":"/toUpper", - "html":"

    toUpper source npm

    \n
    _.toUpper([string=''])
    \n\n

    Converts string, as a whole, to upper case.

    \n
    \n\n

    参数

    \n
      \n
    1. [string=''] (string)

      The string to convert.

      \n
    2. \n
    \n

    返回值 (string)

    \n

    Returns the upper cased string.

    \n
    \n

    示例

    \n
    _.toUpper('--foo-bar');\n// => '--FOO-BAR'\n\n_.toUpper('fooBar');\n// => 'FOOBAR'\n\n_.toUpper('__foo_bar__');\n// => '__FOO_BAR__'\n
    \n
    \n
    \n\n
    " } + "html":"

    toUpper source npm

    \n
    _.toUpper([string=''])
    \n\n

    Converts string, as a whole, to upper case.

    \n
    \n\n

    参数

    \n
      \n
    1. [string=''] (string)

      The string to convert.

      \n
    2. \n
    \n

    返回值 (string)

    \n

    Returns the upper cased string.

    \n
    \n

    示例

    \n
    _.toUpper('--foo-bar');\n// => '--FOO-BAR'\n\n_.toUpper('fooBar');\n// => 'FOOBAR'\n\n_.toUpper('__foo_bar__');\n// => '__FOO_BAR__'\n
    \n
    \n
    \n\n
    " } ,{ "href":"/trim", - "html":"

    trim source npm

    \n
    _.trim([string=''], [chars=whitespace])
    \n\n

    Removes leading and trailing whitespace or specified characters from string.

    \n
    \n\n

    参数

    \n
      \n
    1. [string=''] (string)

      The string to trim.

      \n
    2. \n
    3. [chars=whitespace] (string)

      The characters to trim.

      \n
    4. \n
    \n

    返回值 (string)

    \n

    Returns the trimmed string.

    \n
    \n

    示例

    \n
    _.trim('  abc  ');\n// => 'abc'\n\n_.trim('-_-abc-_-', '_-');\n// => 'abc'\n\n_.map(['  foo  ', '  bar  '], _.trim);\n// => ['foo', 'bar']\n
    \n
    \n
    \n\n
    " } + "html":"

    trim source npm

    \n
    _.trim([string=''], [chars=whitespace])
    \n\n

    Removes leading and trailing whitespace or specified characters from string.

    \n
    \n\n

    参数

    \n
      \n
    1. [string=''] (string)

      The string to trim.

      \n
    2. \n
    3. [chars=whitespace] (string)

      The characters to trim.

      \n
    4. \n
    \n

    返回值 (string)

    \n

    Returns the trimmed string.

    \n
    \n

    示例

    \n
    _.trim('  abc  ');\n// => 'abc'\n\n_.trim('-_-abc-_-', '_-');\n// => 'abc'\n\n_.map(['  foo  ', '  bar  '], _.trim);\n// => ['foo', 'bar']\n
    \n
    \n
    \n\n
    " } ,{ "href":"/trimEnd", - "html":"

    trimEnd source npm

    \n
    _.trimEnd([string=''], [chars=whitespace])
    \n\n

    Removes trailing whitespace or specified characters from string.

    \n
    \n\n

    参数

    \n
      \n
    1. [string=''] (string)

      The string to trim.

      \n
    2. \n
    3. [chars=whitespace] (string)

      The characters to trim.

      \n
    4. \n
    \n

    返回值 (string)

    \n

    Returns the trimmed string.

    \n
    \n

    示例

    \n
    _.trimEnd('  abc  ');\n// => '  abc'\n\n_.trimEnd('-_-abc-_-', '_-');\n// => '-_-abc'\n
    \n
    \n
    \n\n
    " } + "html":"

    trimEnd source npm

    \n
    _.trimEnd([string=''], [chars=whitespace])
    \n\n

    Removes trailing whitespace or specified characters from string.

    \n
    \n\n

    参数

    \n
      \n
    1. [string=''] (string)

      The string to trim.

      \n
    2. \n
    3. [chars=whitespace] (string)

      The characters to trim.

      \n
    4. \n
    \n

    返回值 (string)

    \n

    Returns the trimmed string.

    \n
    \n

    示例

    \n
    _.trimEnd('  abc  ');\n// => '  abc'\n\n_.trimEnd('-_-abc-_-', '_-');\n// => '-_-abc'\n
    \n
    \n
    \n\n
    " } ,{ "href":"/trimStart", - "html":"

    trimStart source npm

    \n
    _.trimStart([string=''], [chars=whitespace])
    \n\n

    Removes leading whitespace or specified characters from string.

    \n
    \n\n

    参数

    \n
      \n
    1. [string=''] (string)

      The string to trim.

      \n
    2. \n
    3. [chars=whitespace] (string)

      The characters to trim.

      \n
    4. \n
    \n

    返回值 (string)

    \n

    Returns the trimmed string.

    \n
    \n

    示例

    \n
    _.trimStart('  abc  ');\n// => 'abc  '\n\n_.trimStart('-_-abc-_-', '_-');\n// => 'abc-_-'\n
    \n
    \n
    \n\n
    " } + "html":"

    trimStart source npm

    \n
    _.trimStart([string=''], [chars=whitespace])
    \n\n

    Removes leading whitespace or specified characters from string.

    \n
    \n\n

    参数

    \n
      \n
    1. [string=''] (string)

      The string to trim.

      \n
    2. \n
    3. [chars=whitespace] (string)

      The characters to trim.

      \n
    4. \n
    \n

    返回值 (string)

    \n

    Returns the trimmed string.

    \n
    \n

    示例

    \n
    _.trimStart('  abc  ');\n// => 'abc  '\n\n_.trimStart('-_-abc-_-', '_-');\n// => 'abc-_-'\n
    \n
    \n
    \n\n
    " } ,{ "href":"/truncate", - "html":"

    truncate source npm

    \n
    _.truncate([string=''], [options])
    \n\n

    Truncates string if it's longer than the given maximum string length.\nThe last characters of the truncated string are replaced with the omission\nstring which defaults to "...".

    \n
    \n\n

    参数

    \n
      \n
    1. [string=''] (string)

      The string to truncate.

      \n
    2. \n
    3. [options] (Object)

      The options object.

      \n
    4. \n
    5. [options.length=30] (number)

      The maximum string length.

      \n
    6. \n
    7. [options.omission='...'] (string)

      The string to indicate text is omitted.

      \n
    8. \n
    9. [options.separator] (RegExp|string)

      The separator pattern to truncate to.

      \n
    10. \n
    \n

    返回值 (string)

    \n

    Returns the truncated string.

    \n
    \n

    示例

    \n
    _.truncate('hi-diddly-ho there, neighborino');\n// => 'hi-diddly-ho there, neighbo...'\n\n_.truncate('hi-diddly-ho there, neighborino', {\n  'length': 24,\n  'separator': ' '\n});\n// => 'hi-diddly-ho there,...'\n\n_.truncate('hi-diddly-ho there, neighborino', {\n  'length': 24,\n  'separator': /,? +/\n});\n// => 'hi-diddly-ho there...'\n\n_.truncate('hi-diddly-ho there, neighborino', {\n  'omission': ' [...]'\n});\n// => 'hi-diddly-ho there, neig [...]'\n
    \n
    \n
    \n\n
    " } + "html":"

    truncate source npm

    \n
    _.truncate([string=''], [options])
    \n\n

    Truncates string if it's longer than the given maximum string length.\nThe last characters of the truncated string are replaced with the omission\nstring which defaults to "...".

    \n
    \n\n

    参数

    \n
      \n
    1. [string=''] (string)

      The string to truncate.

      \n
    2. \n
    3. [options] (Object)

      The options object.

      \n
    4. \n
    5. [options.length=30] (number)

      The maximum string length.

      \n
    6. \n
    7. [options.omission='...'] (string)

      The string to indicate text is omitted.

      \n
    8. \n
    9. [options.separator] (RegExp|string)

      The separator pattern to truncate to.

      \n
    10. \n
    \n

    返回值 (string)

    \n

    Returns the truncated string.

    \n
    \n

    示例

    \n
    _.truncate('hi-diddly-ho there, neighborino');\n// => 'hi-diddly-ho there, neighbo...'\n\n_.truncate('hi-diddly-ho there, neighborino', {\n  'length': 24,\n  'separator': ' '\n});\n// => 'hi-diddly-ho there,...'\n\n_.truncate('hi-diddly-ho there, neighborino', {\n  'length': 24,\n  'separator': /,? +/\n});\n// => 'hi-diddly-ho there...'\n\n_.truncate('hi-diddly-ho there, neighborino', {\n  'omission': ' [...]'\n});\n// => 'hi-diddly-ho there, neig [...]'\n
    \n
    \n
    \n\n
    " } ,{ "href":"/unescape", - "html":"

    unescape source npm

    \n
    _.unescape([string=''])
    \n\n

    The inverse of _.escape; this method converts the HTML entities\n&amp;, &lt;, &gt;, &quot;, &#39;, and &#96; in string to their\ncorresponding characters.\n
    \n
    \n注意: No other HTML entities are unescaped. To unescape additional HTML\nentities use a third-party library like he.

    \n
    \n\n

    参数

    \n
      \n
    1. [string=''] (string)

      The string to unescape.

      \n
    2. \n
    \n

    返回值 (string)

    \n

    Returns the unescaped string.

    \n
    \n

    示例

    \n
    _.unescape('fred, barney, &amp; pebbles');\n// => 'fred, barney, & pebbles'\n
    \n
    \n
    \n\n
    " } + "html":"

    unescape source npm

    \n
    _.unescape([string=''])
    \n\n

    The inverse of _.escape; this method converts the HTML entities\n&amp;, &lt;, &gt;, &quot;, &#39;, and &#96; in string to their\ncorresponding characters.\n
    \n
    \n注意: No other HTML entities are unescaped. To unescape additional HTML\nentities use a third-party library like he.

    \n
    \n\n

    参数

    \n
      \n
    1. [string=''] (string)

      The string to unescape.

      \n
    2. \n
    \n

    返回值 (string)

    \n

    Returns the unescaped string.

    \n
    \n

    示例

    \n
    _.unescape('fred, barney, &amp; pebbles');\n// => 'fred, barney, & pebbles'\n
    \n
    \n
    \n\n
    " } ,{ "href":"/upperCase", - "html":"

    upperCase source npm

    \n
    _.upperCase([string=''])
    \n\n

    Converts string, as space separated words, to upper case.

    \n
    \n\n

    参数

    \n
      \n
    1. [string=''] (string)

      The string to convert.

      \n
    2. \n
    \n

    返回值 (string)

    \n

    Returns the upper cased string.

    \n
    \n

    示例

    \n
    _.upperCase('--foo-bar');\n// => 'FOO BAR'\n\n_.upperCase('fooBar');\n// => 'FOO BAR'\n\n_.upperCase('__foo_bar__');\n// => 'FOO BAR'\n
    \n
    \n
    \n\n
    " } + "html":"

    upperCase source npm

    \n
    _.upperCase([string=''])
    \n\n

    Converts string, as space separated words, to upper case.

    \n
    \n\n

    参数

    \n
      \n
    1. [string=''] (string)

      The string to convert.

      \n
    2. \n
    \n

    返回值 (string)

    \n

    Returns the upper cased string.

    \n
    \n

    示例

    \n
    _.upperCase('--foo-bar');\n// => 'FOO BAR'\n\n_.upperCase('fooBar');\n// => 'FOO BAR'\n\n_.upperCase('__foo_bar__');\n// => 'FOO BAR'\n
    \n
    \n
    \n\n
    " } ,{ "href":"/upperFirst", - "html":"

    upperFirst source npm

    \n
    _.upperFirst([string=''])
    \n\n

    Converts the first character of string to upper case.

    \n
    \n\n

    参数

    \n
      \n
    1. [string=''] (string)

      The string to convert.

      \n
    2. \n
    \n

    返回值 (string)

    \n

    Returns the converted string.

    \n
    \n

    示例

    \n
    _.upperFirst('fred');\n// => 'Fred'\n\n_.upperFirst('FRED');\n// => 'FRED'\n
    \n
    \n
    \n\n
    " } + "html":"

    upperFirst source npm

    \n
    _.upperFirst([string=''])
    \n\n

    Converts the first character of string to upper case.

    \n
    \n\n

    参数

    \n
      \n
    1. [string=''] (string)

      The string to convert.

      \n
    2. \n
    \n

    返回值 (string)

    \n

    Returns the converted string.

    \n
    \n

    示例

    \n
    _.upperFirst('fred');\n// => 'Fred'\n\n_.upperFirst('FRED');\n// => 'FRED'\n
    \n
    \n
    \n\n
    " } ,{ "href":"/words", - "html":"

    words source npm

    \n
    _.words([string=''], [pattern])
    \n\n

    Splits string into an array of its words.

    \n
    \n\n

    参数

    \n
      \n
    1. [string=''] (string)

      The string to inspect.

      \n
    2. \n
    3. [pattern] (RegExp|string)

      The pattern to match words.

      \n
    4. \n
    \n

    返回值 (Array)

    \n

    Returns the words of string.

    \n
    \n

    示例

    \n
    _.words('fred, barney, & pebbles');\n// => ['fred', 'barney', 'pebbles']\n\n_.words('fred, barney, & pebbles', /[^, ]+/g);\n// => ['fred', 'barney', '&', 'pebbles']\n
    \n
    \n
    \n\n
    " } + "html":"

    words source npm

    \n
    _.words([string=''], [pattern])
    \n\n

    Splits string into an array of its words.

    \n
    \n\n

    参数

    \n
      \n
    1. [string=''] (string)

      The string to inspect.

      \n
    2. \n
    3. [pattern] (RegExp|string)

      The pattern to match words.

      \n
    4. \n
    \n

    返回值 (Array)

    \n

    Returns the words of string.

    \n
    \n

    示例

    \n
    _.words('fred, barney, & pebbles');\n// => ['fred', 'barney', 'pebbles']\n\n_.words('fred, barney, & pebbles', /[^, ]+/g);\n// => ['fred', 'barney', '&', 'pebbles']\n
    \n
    \n
    \n\n
    " } ,{ "href":"/attempt", - "html":"

    attempt source npm

    \n
    _.attempt(func)
    \n\n

    Attempts to invoke func, returning either the result or the caught error\nobject. Any additional arguments are provided to func when it's invoked.

    \n
    \n\n

    参数

    \n
      \n
    1. func (Function)

      The function to attempt.

      \n
    2. \n
    \n

    返回值 (*)

    \n

    Returns the func result or error object.

    \n
    \n

    示例

    \n
    // avoid throwing errors for invalid selectors\nvar elements = _.attempt(function(selector) {\n  return document.querySelectorAll(selector);\n}, '>_>');\n\nif (_.isError(elements)) {\n  elements = [];\n}\n
    \n
    \n
    \n\n
    " } + "html":"

    attempt source npm

    \n
    _.attempt(func)
    \n\n

    Attempts to invoke func, returning either the result or the caught error\nobject. Any additional arguments are provided to func when it's invoked.

    \n
    \n\n

    参数

    \n
      \n
    1. func (Function)

      The function to attempt.

      \n
    2. \n
    \n

    返回值 (*)

    \n

    Returns the func result or error object.

    \n
    \n

    示例

    \n
    // avoid throwing errors for invalid selectors\nvar elements = _.attempt(function(selector) {\n  return document.querySelectorAll(selector);\n}, '>_>');\n\nif (_.isError(elements)) {\n  elements = [];\n}\n
    \n
    \n
    \n\n
    " } ,{ "href":"/bindAll", - "html":"

    bindAll source npm

    \n
    _.bindAll(object, methodNames)
    \n\n

    Binds methods of an object to the object itself, overwriting the existing\nmethod.\n
    \n
    \n注意: This method doesn't set the "length" property of bound functions.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to bind and assign the bound methods to.

      \n
    2. \n
    3. methodNames (...(string|string[])

      The object method names to bind, specified individually or in arrays.

      \n
    4. \n
    \n

    返回值 (Object)

    \n

    Returns object.

    \n
    \n

    示例

    \n
    var view = {\n  'label': 'docs',\n  'onClick': function() {\n    console.log('clicked ' + this.label);\n  }\n};\n\n_.bindAll(view, 'onClick');\njQuery(element).on('click', view.onClick);\n// => logs 'clicked docs' when clicked\n
    \n
    \n
    \n\n
    " } + "html":"

    bindAll source npm

    \n
    _.bindAll(object, methodNames)
    \n\n

    Binds methods of an object to the object itself, overwriting the existing\nmethod.\n
    \n
    \n注意: This method doesn't set the "length" property of bound functions.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to bind and assign the bound methods to.

      \n
    2. \n
    3. methodNames (...(string|string[])

      The object method names to bind, specified individually or in arrays.

      \n
    4. \n
    \n

    返回值 (Object)

    \n

    Returns object.

    \n
    \n

    示例

    \n
    var view = {\n  'label': 'docs',\n  'onClick': function() {\n    console.log('clicked ' + this.label);\n  }\n};\n\n_.bindAll(view, 'onClick');\njQuery(element).on('click', view.onClick);\n// => logs 'clicked docs' when clicked\n
    \n
    \n
    \n\n
    " } ,{ "href":"/cond", - "html":"

    cond source npm

    \n
    _.cond(pairs)
    \n\n

    Creates a function that iterates over pairs invoking the corresponding\nfunction of the first predicate to return truthy. The predicate-function\npairs are invoked with the this binding and arguments of the created\nfunction.

    \n
    \n\n

    参数

    \n
      \n
    1. pairs (Array)

      The predicate-function pairs.

      \n
    2. \n
    \n

    返回值 (Function)

    \n

    Returns the new function.

    \n
    \n

    示例

    \n
    var func = _.cond([\n  [_.matches({ 'a': 1 }),           _.constant('matches A')],\n  [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],\n  [_.constant(true),                _.constant('no match')]\n])\n\nfunc({ 'a': 1, 'b': 2 });\n// => 'matches A'\n\nfunc({ 'a': 0, 'b': 1 });\n// => 'matches B'\n\nfunc({ 'a': '1', 'b': '2' });\n// => 'no match'\n
    \n
    \n
    \n\n
    " } + "html":"

    cond source npm

    \n
    _.cond(pairs)
    \n\n

    Creates a function that iterates over pairs invoking the corresponding\nfunction of the first predicate to return truthy. The predicate-function\npairs are invoked with the this binding and arguments of the created\nfunction.

    \n
    \n\n

    参数

    \n
      \n
    1. pairs (Array)

      The predicate-function pairs.

      \n
    2. \n
    \n

    返回值 (Function)

    \n

    Returns the new function.

    \n
    \n

    示例

    \n
    var func = _.cond([\n  [_.matches({ 'a': 1 }),           _.constant('matches A')],\n  [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],\n  [_.constant(true),                _.constant('no match')]\n])\n\nfunc({ 'a': 1, 'b': 2 });\n// => 'matches A'\n\nfunc({ 'a': 0, 'b': 1 });\n// => 'matches B'\n\nfunc({ 'a': '1', 'b': '2' });\n// => 'no match'\n
    \n
    \n
    \n\n
    " } ,{ "href":"/conforms", - "html":"

    conforms source npm

    \n
    _.conforms(source)
    \n\n

    Creates a function that invokes the predicate properties of source with\nthe corresponding property values of a given object, returning true if\nall predicates return truthy, else false.

    \n
    \n\n

    参数

    \n
      \n
    1. source (Object)

      The object of property predicates to conform to.

      \n
    2. \n
    \n

    返回值 (Function)

    \n

    Returns the new function.

    \n
    \n

    示例

    \n
    var users = [\n  { 'user': 'barney', 'age': 36 },\n  { 'user': 'fred',   'age': 40 }\n];\n\n_.filter(users, _.conforms({ 'age': _.partial(_.gt, _, 38) }));\n// => [{ 'user': 'fred', 'age': 40 }]\n
    \n
    \n
    \n\n
    " } + "html":"

    conforms source npm

    \n
    _.conforms(source)
    \n\n

    Creates a function that invokes the predicate properties of source with\nthe corresponding property values of a given object, returning true if\nall predicates return truthy, else false.

    \n
    \n\n

    参数

    \n
      \n
    1. source (Object)

      The object of property predicates to conform to.

      \n
    2. \n
    \n

    返回值 (Function)

    \n

    Returns the new function.

    \n
    \n

    示例

    \n
    var users = [\n  { 'user': 'barney', 'age': 36 },\n  { 'user': 'fred',   'age': 40 }\n];\n\n_.filter(users, _.conforms({ 'age': _.partial(_.gt, _, 38) }));\n// => [{ 'user': 'fred', 'age': 40 }]\n
    \n
    \n
    \n\n
    " } ,{ "href":"/constant", - "html":"

    constant source npm

    \n
    _.constant(value)
    \n\n

    Creates a function that returns value.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to return from the new function.

      \n
    2. \n
    \n

    返回值 (Function)

    \n

    Returns the new function.

    \n
    \n

    示例

    \n
    var object = { 'user': 'fred' };\nvar getter = _.constant(object);\n\ngetter() === object;\n// => true\n
    \n
    \n
    \n\n
    " } + "html":"

    constant source npm

    \n
    _.constant(value)
    \n\n

    Creates a function that returns value.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to return from the new function.

      \n
    2. \n
    \n

    返回值 (Function)

    \n

    Returns the new function.

    \n
    \n

    示例

    \n
    var object = { 'user': 'fred' };\nvar getter = _.constant(object);\n\ngetter() === object;\n// => true\n
    \n
    \n
    \n\n
    " } ,{ "href":"/flow", - "html":"

    flow source npm

    \n
    _.flow([funcs])
    \n\n

    Creates a function that returns the result of invoking the provided\nfunctions with the this binding of the created function, where each\nsuccessive invocation is supplied the return value of the previous.

    \n
    \n\n

    参数

    \n
      \n
    1. [funcs] (...(Function|Function[])

      Functions to invoke.

      \n
    2. \n
    \n

    返回值 (Function)

    \n

    Returns the new function.

    \n
    \n

    示例

    \n
    function square(n) {\n  return n * n;\n}\n\nvar addSquare = _.flow(_.add, square);\naddSquare(1, 2);\n// => 9\n
    \n
    \n
    \n\n
    " } + "html":"

    flow source npm

    \n
    _.flow([funcs])
    \n\n

    Creates a function that returns the result of invoking the provided\nfunctions with the this binding of the created function, where each\nsuccessive invocation is supplied the return value of the previous.

    \n
    \n\n

    参数

    \n
      \n
    1. [funcs] (...(Function|Function[])

      Functions to invoke.

      \n
    2. \n
    \n

    返回值 (Function)

    \n

    Returns the new function.

    \n
    \n

    示例

    \n
    function square(n) {\n  return n * n;\n}\n\nvar addSquare = _.flow(_.add, square);\naddSquare(1, 2);\n// => 9\n
    \n
    \n
    \n\n
    " } ,{ "href":"/flowRight", - "html":"

    flowRight source npm

    \n
    _.flowRight([funcs])
    \n\n

    This method is like _.flow except that it creates a function that\ninvokes the provided functions from right to left.

    \n
    \n\n

    参数

    \n
      \n
    1. [funcs] (...(Function|Function[])

      Functions to invoke.

      \n
    2. \n
    \n

    返回值 (Function)

    \n

    Returns the new function.

    \n
    \n

    示例

    \n
    function square(n) {\n  return n * n;\n}\n\nvar addSquare = _.flowRight(square, _.add);\naddSquare(1, 2);\n// => 9\n
    \n
    \n
    \n\n
    " } + "html":"

    flowRight source npm

    \n
    _.flowRight([funcs])
    \n\n

    This method is like _.flow except that it creates a function that\ninvokes the provided functions from right to left.

    \n
    \n\n

    参数

    \n
      \n
    1. [funcs] (...(Function|Function[])

      Functions to invoke.

      \n
    2. \n
    \n

    返回值 (Function)

    \n

    Returns the new function.

    \n
    \n

    示例

    \n
    function square(n) {\n  return n * n;\n}\n\nvar addSquare = _.flowRight(square, _.add);\naddSquare(1, 2);\n// => 9\n
    \n
    \n
    \n\n
    " } ,{ "href":"/identity", - "html":"

    identity source npm

    \n
    _.identity(value)
    \n\n

    This method returns the first argument provided to it.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      Any value.

      \n
    2. \n
    \n

    返回值 (*)

    \n

    Returns value.

    \n
    \n

    示例

    \n
    var object = { 'user': 'fred' };\n\n_.identity(object) === object;\n// => true\n
    \n
    \n
    \n\n
    " } + "html":"

    identity source npm

    \n
    _.identity(value)
    \n\n

    This method returns the first argument provided to it.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      Any value.

      \n
    2. \n
    \n

    返回值 (*)

    \n

    Returns value.

    \n
    \n

    示例

    \n
    var object = { 'user': 'fred' };\n\n_.identity(object) === object;\n// => true\n
    \n
    \n
    \n\n
    " } ,{ "href":"/iteratee", - "html":"

    iteratee source npm

    \n
    _.iteratee([func=_.identity])
    \n\n

    Creates a function that invokes func with the arguments of the created\nfunction. If func is a property name the created callback returns the\nproperty value for a given element. If func is an object the created\ncallback returns true for elements that contain the equivalent object properties, otherwise it returns false.

    \n
    \n\n

    参数

    \n
      \n
    1. [func=_.identity] (*)

      The value to convert to a callback.

      \n
    2. \n
    \n

    返回值 (Function)

    \n

    Returns the callback.

    \n
    \n

    示例

    \n
    var users = [\n  { 'user': 'barney', 'age': 36 },\n  { 'user': 'fred',   'age': 40 }\n];\n\n// wrap to create custom callback shorthands\n_.iteratee = _.wrap(_.iteratee, function(callback, func, thisArg) {\n  var match = /^(.+?)__([gl]t)(.+)$/.exec(func);\n  if (!match) {\n    return callback(func, thisArg);\n  }\n  return function(object) {\n    return match[2] == 'gt'\n      ? object[match[1]] > match[3]\n      : object[match[1]] < match[3];\n  };\n});\n\n_.filter(users, 'age__gt36');\n// => [{ 'user': 'fred', 'age': 40 }]\n
    \n
    \n
    \n\n
    " } + "html":"

    iteratee source npm

    \n
    _.iteratee([func=_.identity])
    \n\n

    Creates a function that invokes func with the arguments of the created\nfunction. If func is a property name the created callback returns the\nproperty value for a given element. If func is an object the created\ncallback returns true for elements that contain the equivalent object properties, otherwise it returns false.

    \n
    \n\n

    参数

    \n
      \n
    1. [func=_.identity] (*)

      The value to convert to a callback.

      \n
    2. \n
    \n

    返回值 (Function)

    \n

    Returns the callback.

    \n
    \n

    示例

    \n
    var users = [\n  { 'user': 'barney', 'age': 36 },\n  { 'user': 'fred',   'age': 40 }\n];\n\n// wrap to create custom callback shorthands\n_.iteratee = _.wrap(_.iteratee, function(callback, func, thisArg) {\n  var match = /^(.+?)__([gl]t)(.+)$/.exec(func);\n  if (!match) {\n    return callback(func, thisArg);\n  }\n  return function(object) {\n    return match[2] == 'gt'\n      ? object[match[1]] > match[3]\n      : object[match[1]] < match[3];\n  };\n});\n\n_.filter(users, 'age__gt36');\n// => [{ 'user': 'fred', 'age': 40 }]\n
    \n
    \n
    \n\n
    " } ,{ "href":"/matches", - "html":"

    matches source npm

    \n
    _.matches(source)
    \n\n

    Creates a function that performs a deep partial comparison between a given\nobject and source, returning true if the given object has equivalent\nproperty values, else false.\n
    \n
    \n注意: This method supports comparing the same values as _.isEqual.

    \n
    \n\n

    参数

    \n
      \n
    1. source (Object)

      The object of property values to match.

      \n
    2. \n
    \n

    返回值 (Function)

    \n

    Returns the new function.

    \n
    \n

    示例

    \n
    var users = [\n  { 'user': 'barney', 'age': 36, 'active': true },\n  { 'user': 'fred',   'age': 40, 'active': false }\n];\n\n_.filter(users, _.matches({ 'age': 40, 'active': false }));\n// => [{ 'user': 'fred', 'age': 40, 'active': false }]\n
    \n
    \n
    \n\n
    " } + "html":"

    matches source npm

    \n
    _.matches(source)
    \n\n

    Creates a function that performs a deep partial comparison between a given\nobject and source, returning true if the given object has equivalent\nproperty values, else false.\n
    \n
    \n注意: This method supports comparing the same values as _.isEqual.

    \n
    \n\n

    参数

    \n
      \n
    1. source (Object)

      The object of property values to match.

      \n
    2. \n
    \n

    返回值 (Function)

    \n

    Returns the new function.

    \n
    \n

    示例

    \n
    var users = [\n  { 'user': 'barney', 'age': 36, 'active': true },\n  { 'user': 'fred',   'age': 40, 'active': false }\n];\n\n_.filter(users, _.matches({ 'age': 40, 'active': false }));\n// => [{ 'user': 'fred', 'age': 40, 'active': false }]\n
    \n
    \n
    \n\n
    " } ,{ "href":"/matchesProperty", - "html":"

    matchesProperty source npm

    \n
    _.matchesProperty(path, srcValue)
    \n\n

    Creates a function that performs a deep partial comparison between the\nvalue at path of a given object to srcValue, returning true if the\nobject value is equivalent, else false.\n
    \n
    \n注意: This method supports comparing the same values as _.isEqual.

    \n
    \n\n

    参数

    \n
      \n
    1. path (Array|string)

      The path of the property to get.

      \n
    2. \n
    3. srcValue (*)

      The value to match.

      \n
    4. \n
    \n

    返回值 (Function)

    \n

    Returns the new function.

    \n
    \n

    示例

    \n
    var users = [\n  { 'user': 'barney' },\n  { 'user': 'fred' }\n];\n\n_.find(users, _.matchesProperty('user', 'fred'));\n// => { 'user': 'fred' }\n
    \n
    \n
    \n\n
    " } + "html":"

    matchesProperty source npm

    \n
    _.matchesProperty(path, srcValue)
    \n\n

    Creates a function that performs a deep partial comparison between the\nvalue at path of a given object to srcValue, returning true if the\nobject value is equivalent, else false.\n
    \n
    \n注意: This method supports comparing the same values as _.isEqual.

    \n
    \n\n

    参数

    \n
      \n
    1. path (Array|string)

      The path of the property to get.

      \n
    2. \n
    3. srcValue (*)

      The value to match.

      \n
    4. \n
    \n

    返回值 (Function)

    \n

    Returns the new function.

    \n
    \n

    示例

    \n
    var users = [\n  { 'user': 'barney' },\n  { 'user': 'fred' }\n];\n\n_.find(users, _.matchesProperty('user', 'fred'));\n// => { 'user': 'fred' }\n
    \n
    \n
    \n\n
    " } ,{ "href":"/method", - "html":"

    method source npm

    \n
    _.method(path, [args])
    \n\n

    Creates a function that invokes the method at path of a given object.\nAny additional arguments are provided to the invoked method.

    \n
    \n\n

    参数

    \n
      \n
    1. path (Array|string)

      The path of the method to invoke.

      \n
    2. \n
    3. [args] (...*)

      The arguments to invoke the method with.

      \n
    4. \n
    \n

    返回值 (Function)

    \n

    Returns the new function.

    \n
    \n

    示例

    \n
    var objects = [\n  { 'a': { 'b': { 'c': _.constant(2) } } },\n  { 'a': { 'b': { 'c': _.constant(1) } } }\n];\n\n_.map(objects, _.method('a.b.c'));\n// => [2, 1]\n\n_.invokeMap(_.sortBy(objects, _.method(['a', 'b', 'c'])), 'a.b.c');\n// => [1, 2]\n
    \n
    \n
    \n\n
    " } + "html":"

    method source npm

    \n
    _.method(path, [args])
    \n\n

    Creates a function that invokes the method at path of a given object.\nAny additional arguments are provided to the invoked method.

    \n
    \n\n

    参数

    \n
      \n
    1. path (Array|string)

      The path of the method to invoke.

      \n
    2. \n
    3. [args] (...*)

      The arguments to invoke the method with.

      \n
    4. \n
    \n

    返回值 (Function)

    \n

    Returns the new function.

    \n
    \n

    示例

    \n
    var objects = [\n  { 'a': { 'b': { 'c': _.constant(2) } } },\n  { 'a': { 'b': { 'c': _.constant(1) } } }\n];\n\n_.map(objects, _.method('a.b.c'));\n// => [2, 1]\n\n_.invokeMap(_.sortBy(objects, _.method(['a', 'b', 'c'])), 'a.b.c');\n// => [1, 2]\n
    \n
    \n
    \n\n
    " } ,{ "href":"/methodOf", - "html":"

    methodOf source npm

    \n
    _.methodOf(object, [args])
    \n\n

    The opposite of _.method; this method creates a function that invokes\nthe method at a given path of object. Any additional arguments are\nprovided to the invoked method.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to query.

      \n
    2. \n
    3. [args] (...*)

      The arguments to invoke the method with.

      \n
    4. \n
    \n

    返回值 (Function)

    \n

    Returns the new function.

    \n
    \n

    示例

    \n
    var array = _.times(3, _.constant),\n    object = { 'a': array, 'b': array, 'c': array };\n\n_.map(['a[2]', 'c[0]'], _.methodOf(object));\n// => [2, 0]\n\n_.map([['a', '2'], ['c', '0']], _.methodOf(object));\n// => [2, 0]\n
    \n
    \n
    \n\n
    " } + "html":"

    methodOf source npm

    \n
    _.methodOf(object, [args])
    \n\n

    The opposite of _.method; this method creates a function that invokes\nthe method at a given path of object. Any additional arguments are\nprovided to the invoked method.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to query.

      \n
    2. \n
    3. [args] (...*)

      The arguments to invoke the method with.

      \n
    4. \n
    \n

    返回值 (Function)

    \n

    Returns the new function.

    \n
    \n

    示例

    \n
    var array = _.times(3, _.constant),\n    object = { 'a': array, 'b': array, 'c': array };\n\n_.map(['a[2]', 'c[0]'], _.methodOf(object));\n// => [2, 0]\n\n_.map([['a', '2'], ['c', '0']], _.methodOf(object));\n// => [2, 0]\n
    \n
    \n
    \n\n
    " } ,{ "href":"/mixin", - "html":"

    mixin source npm

    \n
    _.mixin([object=lodash], source, [options])
    \n\n

    Adds all own enumerable function properties of a source object to the\ndestination object. If object is a function then methods are added to\nits prototype as well.\n
    \n
    \n注意: Use _.runInContext to create a pristine lodash function to\navoid conflicts caused by modifying the original.

    \n
    \n\n

    参数

    \n
      \n
    1. [object=lodash] (Function|Object)

      The destination object.

      \n
    2. \n
    3. source (Object)

      The object of functions to add.

      \n
    4. \n
    5. [options] (Object)

      The options object.

      \n
    6. \n
    7. [options.chain=true] (boolean)

      Specify whether the functions added are chainable.

      \n
    8. \n
    \n

    返回值 (Function|Object)

    \n

    Returns object.

    \n
    \n

    示例

    \n
    function vowels(string) {\n  return _.filter(string, function(v) {\n    return /[aeiou]/i.test(v);\n  });\n}\n\n_.mixin({ 'vowels': vowels });\n_.vowels('fred');\n// => ['e']\n\n_('fred').vowels().value();\n// => ['e']\n\n_.mixin({ 'vowels': vowels }, { 'chain': false });\n_('fred').vowels();\n// => ['e']\n
    \n
    \n
    \n\n
    " } + "html":"

    mixin source npm

    \n
    _.mixin([object=lodash], source, [options])
    \n\n

    Adds all own enumerable function properties of a source object to the\ndestination object. If object is a function then methods are added to\nits prototype as well.\n
    \n
    \n注意: Use _.runInContext to create a pristine lodash function to\navoid conflicts caused by modifying the original.

    \n
    \n\n

    参数

    \n
      \n
    1. [object=lodash] (Function|Object)

      The destination object.

      \n
    2. \n
    3. source (Object)

      The object of functions to add.

      \n
    4. \n
    5. [options] (Object)

      The options object.

      \n
    6. \n
    7. [options.chain=true] (boolean)

      Specify whether the functions added are chainable.

      \n
    8. \n
    \n

    返回值 (Function|Object)

    \n

    Returns object.

    \n
    \n

    示例

    \n
    function vowels(string) {\n  return _.filter(string, function(v) {\n    return /[aeiou]/i.test(v);\n  });\n}\n\n_.mixin({ 'vowels': vowels });\n_.vowels('fred');\n// => ['e']\n\n_('fred').vowels().value();\n// => ['e']\n\n_.mixin({ 'vowels': vowels }, { 'chain': false });\n_('fred').vowels();\n// => ['e']\n
    \n
    \n
    \n\n
    " } ,{ "href":"/noConflict", - "html":"

    noConflict source npm

    \n
    _.noConflict()
    \n\n

    Reverts the _ variable to its previous value and returns a reference to\nthe lodash function.

    \n
    \n\n

    返回值 (Function)

    \n

    Returns the lodash function.

    \n
    \n

    示例

    \n
    var lodash = _.noConflict();\n
    \n
    \n
    \n\n
    " } + "html":"

    noConflict source npm

    \n
    _.noConflict()
    \n\n

    Reverts the _ variable to its previous value and returns a reference to\nthe lodash function.

    \n
    \n\n

    返回值 (Function)

    \n

    Returns the lodash function.

    \n
    \n

    示例

    \n
    var lodash = _.noConflict();\n
    \n
    \n
    \n\n
    " } ,{ "href":"/noop", - "html":"

    noop source npm

    \n
    _.noop()
    \n\n

    A no-operation function that returns undefined regardless of the\narguments it receives.

    \n
    \n\n

    示例

    \n
    var object = { 'user': 'fred' };\n\n_.noop(object) === undefined;\n// => true\n
    \n
    \n
    \n\n
    " } + "html":"

    noop source npm

    \n
    _.noop()
    \n\n

    A no-operation function that returns undefined regardless of the\narguments it receives.

    \n
    \n\n

    示例

    \n
    var object = { 'user': 'fred' };\n\n_.noop(object) === undefined;\n// => true\n
    \n
    \n
    \n\n
    " } ,{ "href":"/nthArg", - "html":"

    nthArg source npm

    \n
    _.nthArg([n=0])
    \n\n

    Creates a function that returns its nth argument.

    \n
    \n\n

    参数

    \n
      \n
    1. [n=0] (number)

      The index of the argument to return.

      \n
    2. \n
    \n

    返回值 (Function)

    \n

    Returns the new function.

    \n
    \n

    示例

    \n
    var func = _.nthArg(1);\n\nfunc('a', 'b', 'c');\n// => 'b'\n
    \n
    \n
    \n\n
    " } + "html":"

    nthArg source npm

    \n
    _.nthArg([n=0])
    \n\n

    Creates a function that returns its nth argument.

    \n
    \n\n

    参数

    \n
      \n
    1. [n=0] (number)

      The index of the argument to return.

      \n
    2. \n
    \n

    返回值 (Function)

    \n

    Returns the new function.

    \n
    \n

    示例

    \n
    var func = _.nthArg(1);\n\nfunc('a', 'b', 'c');\n// => 'b'\n
    \n
    \n
    \n\n
    " } ,{ "href":"/over", - "html":"

    over source npm

    \n
    _.over(iteratees)
    \n\n

    Creates a function that invokes iteratees with the arguments provided\nto the created function and returns their results.

    \n
    \n\n

    参数

    \n
      \n
    1. iteratees (...(Function|Function[])

      The iteratees to invoke.

      \n
    2. \n
    \n

    返回值 (Function)

    \n

    Returns the new function.

    \n
    \n

    示例

    \n
    var func = _.over(Math.max, Math.min);\n\nfunc(1, 2, 3, 4);\n// => [4, 1]\n
    \n
    \n
    \n\n
    " } + "html":"

    over source npm

    \n
    _.over(iteratees)
    \n\n

    Creates a function that invokes iteratees with the arguments provided\nto the created function and returns their results.

    \n
    \n\n

    参数

    \n
      \n
    1. iteratees (...(Function|Function[])

      The iteratees to invoke.

      \n
    2. \n
    \n

    返回值 (Function)

    \n

    Returns the new function.

    \n
    \n

    示例

    \n
    var func = _.over(Math.max, Math.min);\n\nfunc(1, 2, 3, 4);\n// => [4, 1]\n
    \n
    \n
    \n\n
    " } ,{ "href":"/overEvery", - "html":"

    overEvery source npm

    \n
    _.overEvery(predicates)
    \n\n

    Creates a function that checks if all of the predicates return\ntruthy when invoked with the arguments provided to the created function.

    \n
    \n\n

    参数

    \n
      \n
    1. predicates (...(Function|Function[])

      The predicates to check.

      \n
    2. \n
    \n

    返回值 (Function)

    \n

    Returns the new function.

    \n
    \n

    示例

    \n
    var func = _.overEvery(Boolean, isFinite);\n\nfunc('1');\n// => true\n\nfunc(null);\n// => false\n\nfunc(NaN);\n// => false\n
    \n
    \n
    \n\n
    " } + "html":"

    overEvery source npm

    \n
    _.overEvery(predicates)
    \n\n

    Creates a function that checks if all of the predicates return\ntruthy when invoked with the arguments provided to the created function.

    \n
    \n\n

    参数

    \n
      \n
    1. predicates (...(Function|Function[])

      The predicates to check.

      \n
    2. \n
    \n

    返回值 (Function)

    \n

    Returns the new function.

    \n
    \n

    示例

    \n
    var func = _.overEvery(Boolean, isFinite);\n\nfunc('1');\n// => true\n\nfunc(null);\n// => false\n\nfunc(NaN);\n// => false\n
    \n
    \n
    \n\n
    " } ,{ "href":"/overSome", - "html":"

    overSome source npm

    \n
    _.overSome(predicates)
    \n\n

    Creates a function that checks if any of the predicates return\ntruthy when invoked with the arguments provided to the created function.

    \n
    \n\n

    参数

    \n
      \n
    1. predicates (...(Function|Function[])

      The predicates to check.

      \n
    2. \n
    \n

    返回值 (Function)

    \n

    Returns the new function.

    \n
    \n

    示例

    \n
    var func = _.overSome(Boolean, isFinite);\n\nfunc('1');\n// => true\n\nfunc(null);\n// => true\n\nfunc(NaN);\n// => false\n
    \n
    \n
    \n\n
    " } + "html":"

    overSome source npm

    \n
    _.overSome(predicates)
    \n\n

    Creates a function that checks if any of the predicates return\ntruthy when invoked with the arguments provided to the created function.

    \n
    \n\n

    参数

    \n
      \n
    1. predicates (...(Function|Function[])

      The predicates to check.

      \n
    2. \n
    \n

    返回值 (Function)

    \n

    Returns the new function.

    \n
    \n

    示例

    \n
    var func = _.overSome(Boolean, isFinite);\n\nfunc('1');\n// => true\n\nfunc(null);\n// => true\n\nfunc(NaN);\n// => false\n
    \n
    \n
    \n\n
    " } ,{ "href":"/property", - "html":"

    property source npm

    \n
    _.property(path)
    \n\n

    Creates a function that returns the value at path of a given object.

    \n
    \n\n

    参数

    \n
      \n
    1. path (Array|string)

      The path of the property to get.

      \n
    2. \n
    \n

    返回值 (Function)

    \n

    Returns the new function.

    \n
    \n

    示例

    \n
    var objects = [\n  { 'a': { 'b': { 'c': 2 } } },\n  { 'a': { 'b': { 'c': 1 } } }\n];\n\n_.map(objects, _.property('a.b.c'));\n// => [2, 1]\n\n_.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c');\n// => [1, 2]\n
    \n
    \n
    \n\n
    " } + "html":"

    property source npm

    \n
    _.property(path)
    \n\n

    Creates a function that returns the value at path of a given object.

    \n
    \n\n

    参数

    \n
      \n
    1. path (Array|string)

      The path of the property to get.

      \n
    2. \n
    \n

    返回值 (Function)

    \n

    Returns the new function.

    \n
    \n

    示例

    \n
    var objects = [\n  { 'a': { 'b': { 'c': 2 } } },\n  { 'a': { 'b': { 'c': 1 } } }\n];\n\n_.map(objects, _.property('a.b.c'));\n// => [2, 1]\n\n_.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c');\n// => [1, 2]\n
    \n
    \n
    \n\n
    " } ,{ "href":"/propertyOf", - "html":"

    propertyOf source npm

    \n
    _.propertyOf(object)
    \n\n

    The opposite of _.property; this method creates a function that returns\nthe value at a given path of object.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to query.

      \n
    2. \n
    \n

    返回值 (Function)

    \n

    Returns the new function.

    \n
    \n

    示例

    \n
    var array = [0, 1, 2],\n    object = { 'a': array, 'b': array, 'c': array };\n\n_.map(['a[2]', 'c[0]'], _.propertyOf(object));\n// => [2, 0]\n\n_.map([['a', '2'], ['c', '0']], _.propertyOf(object));\n// => [2, 0]\n
    \n
    \n
    \n\n
    " } + "html":"

    propertyOf source npm

    \n
    _.propertyOf(object)
    \n\n

    The opposite of _.property; this method creates a function that returns\nthe value at a given path of object.

    \n
    \n\n

    参数

    \n
      \n
    1. object (Object)

      The object to query.

      \n
    2. \n
    \n

    返回值 (Function)

    \n

    Returns the new function.

    \n
    \n

    示例

    \n
    var array = [0, 1, 2],\n    object = { 'a': array, 'b': array, 'c': array };\n\n_.map(['a[2]', 'c[0]'], _.propertyOf(object));\n// => [2, 0]\n\n_.map([['a', '2'], ['c', '0']], _.propertyOf(object));\n// => [2, 0]\n
    \n
    \n
    \n\n
    " } ,{ "href":"/range", - "html":"

    range source npm

    \n
    _.range([start=0], end, [step=1])
    \n\n

    Creates an array of numbers (positive and/or negative) progressing from\nstart up to, but not including, end. A step of -1 is used if a negative\nstart is specified without an end or step. If end is not specified\nit's set to start with start then set to 0. If end is less than\nstart a zero-length range is created unless a negative step is specified.\n
    \n
    \n注意: JavaScript follows the IEEE-754 standard for resolving\nfloating-point values which can produce unexpected results.

    \n
    \n\n

    参数

    \n
      \n
    1. [start=0] (number)

      The start of the range.

      \n
    2. \n
    3. end (number)

      The end of the range.

      \n
    4. \n
    5. [step=1] (number)

      The value to increment or decrement by.

      \n
    6. \n
    \n

    返回值 (Array)

    \n

    Returns the new array of numbers.

    \n
    \n

    示例

    \n
    _.range(4);\n// => [0, 1, 2, 3]\n\n_.range(-4);\n// => [0, -1, -2, -3]\n\n_.range(1, 5);\n// => [1, 2, 3, 4]\n\n_.range(0, 20, 5);\n// => [0, 5, 10, 15]\n\n_.range(0, -4, -1);\n// => [0, -1, -2, -3]\n\n_.range(1, 4, 0);\n// => [1, 1, 1]\n\n_.range(0);\n// => []\n
    \n
    \n
    \n\n
    " } + "html":"

    range source npm

    \n
    _.range([start=0], end, [step=1])
    \n\n

    Creates an array of numbers (positive and/or negative) progressing from\nstart up to, but not including, end. A step of -1 is used if a negative\nstart is specified without an end or step. If end is not specified\nit's set to start with start then set to 0. If end is less than\nstart a zero-length range is created unless a negative step is specified.\n
    \n
    \n注意: JavaScript follows the IEEE-754 standard for resolving\nfloating-point values which can produce unexpected results.

    \n
    \n\n

    参数

    \n
      \n
    1. [start=0] (number)

      The start of the range.

      \n
    2. \n
    3. end (number)

      The end of the range.

      \n
    4. \n
    5. [step=1] (number)

      The value to increment or decrement by.

      \n
    6. \n
    \n

    返回值 (Array)

    \n

    Returns the new array of numbers.

    \n
    \n

    示例

    \n
    _.range(4);\n// => [0, 1, 2, 3]\n\n_.range(-4);\n// => [0, -1, -2, -3]\n\n_.range(1, 5);\n// => [1, 2, 3, 4]\n\n_.range(0, 20, 5);\n// => [0, 5, 10, 15]\n\n_.range(0, -4, -1);\n// => [0, -1, -2, -3]\n\n_.range(1, 4, 0);\n// => [1, 1, 1]\n\n_.range(0);\n// => []\n
    \n
    \n
    \n\n
    " } ,{ "href":"/rangeRight", - "html":"

    rangeRight source npm

    \n
    _.rangeRight([start=0], end, [step=1])
    \n\n

    This method is like _.range except that it populates values in\ndescending order.

    \n
    \n\n

    参数

    \n
      \n
    1. [start=0] (number)

      The start of the range.

      \n
    2. \n
    3. end (number)

      The end of the range.

      \n
    4. \n
    5. [step=1] (number)

      The value to increment or decrement by.

      \n
    6. \n
    \n

    返回值 (Array)

    \n

    Returns the new array of numbers.

    \n
    \n

    示例

    \n
    _.rangeRight(4);\n// => [3, 2, 1, 0]\n\n_.rangeRight(-4);\n// => [-3, -2, -1, 0]\n\n_.rangeRight(1, 5);\n// => [4, 3, 2, 1]\n\n_.rangeRight(0, 20, 5);\n// => [15, 10, 5, 0]\n\n_.rangeRight(0, -4, -1);\n// => [-3, -2, -1, 0]\n\n_.rangeRight(1, 4, 0);\n// => [1, 1, 1]\n\n_.rangeRight(0);\n// => []\n
    \n
    \n
    \n\n
    " } + "html":"

    rangeRight source npm

    \n
    _.rangeRight([start=0], end, [step=1])
    \n\n

    This method is like _.range except that it populates values in\ndescending order.

    \n
    \n\n

    参数

    \n
      \n
    1. [start=0] (number)

      The start of the range.

      \n
    2. \n
    3. end (number)

      The end of the range.

      \n
    4. \n
    5. [step=1] (number)

      The value to increment or decrement by.

      \n
    6. \n
    \n

    返回值 (Array)

    \n

    Returns the new array of numbers.

    \n
    \n

    示例

    \n
    _.rangeRight(4);\n// => [3, 2, 1, 0]\n\n_.rangeRight(-4);\n// => [-3, -2, -1, 0]\n\n_.rangeRight(1, 5);\n// => [4, 3, 2, 1]\n\n_.rangeRight(0, 20, 5);\n// => [15, 10, 5, 0]\n\n_.rangeRight(0, -4, -1);\n// => [-3, -2, -1, 0]\n\n_.rangeRight(1, 4, 0);\n// => [1, 1, 1]\n\n_.rangeRight(0);\n// => []\n
    \n
    \n
    \n\n
    " } ,{ "href":"/runInContext", "html":"

    runInContext source npm

    \n
    _.runInContext([context=root])
    \n\n

    Create a new pristine lodash function using the context object.

    \n
    \n\n

    参数

    \n
      \n
    1. [context=root] (Object)

      The context object.

      \n
    2. \n
    \n

    返回值 (Function)

    \n

    Returns a new lodash function.

    \n
    \n

    示例

    \n
    _.mixin({ 'foo': _.constant('foo') });\n\nvar lodash = _.runInContext();\nlodash.mixin({ 'bar': lodash.constant('bar') });\n\n_.isFunction(_.foo);\n// => true\n_.isFunction(_.bar);\n// => false\n\nlodash.isFunction(lodash.foo);\n// => false\nlodash.isFunction(lodash.bar);\n// => true\n\n// using `context` to mock `Date#getTime` use in `_.now`\nvar mock = _.runInContext({\n  'Date': function() {\n    return { 'getTime': getTimeMock };\n  }\n});\n\n// or creating a suped-up `defer` in Node.js\nvar defer = _.runInContext({ 'setTimeout': setImmediate }).defer;\n
    \n
    \n
    \n\n
    " } ,{ "href":"/times", - "html":"

    times source npm

    \n
    _.times(n, [iteratee=_.identity])
    \n\n

    Invokes the iteratee function n times, returning an array of the results\nof each invocation. The iteratee is invoked with one argument; (index).

    \n
    \n\n

    参数

    \n
      \n
    1. n (number)

      The number of times to invoke iteratee.

      \n
    2. \n
    3. [iteratee=_.identity] (Function)

      The function invoked per iteration.

      \n
    4. \n
    \n

    返回值 (Array)

    \n

    Returns the array of results.

    \n
    \n

    示例

    \n
    _.times(3, String);\n// => ['0', '1', '2']\n\n _.times(4, _.constant(true));\n// => [true, true, true, true]\n
    \n
    \n
    \n\n
    " } + "html":"

    times source npm

    \n
    _.times(n, [iteratee=_.identity])
    \n\n

    Invokes the iteratee function n times, returning an array of the results\nof each invocation. The iteratee is invoked with one argument; (index).

    \n
    \n\n

    参数

    \n
      \n
    1. n (number)

      The number of times to invoke iteratee.

      \n
    2. \n
    3. [iteratee=_.identity] (Function)

      这个函数会处理每一个元素

      \n
    4. \n
    \n

    返回值 (Array)

    \n

    Returns the array of results.

    \n
    \n

    示例

    \n
    _.times(3, String);\n// => ['0', '1', '2']\n\n _.times(4, _.constant(true));\n// => [true, true, true, true]\n
    \n
    \n
    \n\n
    " } ,{ "href":"/toPath", - "html":"

    toPath source npm

    \n
    _.toPath(value)
    \n\n

    Converts value to a property path array.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to convert.

      \n
    2. \n
    \n

    返回值 (Array)

    \n

    Returns the new property path array.

    \n
    \n

    示例

    \n
    _.toPath('a.b.c');\n// => ['a', 'b', 'c']\n\n_.toPath('a[0].b.c');\n// => ['a', '0', 'b', 'c']\n\nvar path = ['a', 'b', 'c'],\n    newPath = _.toPath(path);\n\nconsole.log(newPath);\n// => ['a', 'b', 'c']\n\nconsole.log(path === newPath);\n// => false\n
    \n
    \n
    \n\n
    " } + "html":"

    toPath source npm

    \n
    _.toPath(value)
    \n\n

    Converts value to a property path array.

    \n
    \n\n

    参数

    \n
      \n
    1. value (*)

      The value to convert.

      \n
    2. \n
    \n

    返回值 (Array)

    \n

    Returns the new property path array.

    \n
    \n

    示例

    \n
    _.toPath('a.b.c');\n// => ['a', 'b', 'c']\n\n_.toPath('a[0].b.c');\n// => ['a', '0', 'b', 'c']\n\nvar path = ['a', 'b', 'c'],\n    newPath = _.toPath(path);\n\nconsole.log(newPath);\n// => ['a', 'b', 'c']\n\nconsole.log(path === newPath);\n// => false\n
    \n
    \n
    \n\n
    " } ,{ "href":"/uniqueId", - "html":"

    uniqueId source npm

    \n
    _.uniqueId([prefix])
    \n\n

    Generates a unique ID. If prefix is provided the ID is appended to it.

    \n
    \n\n

    参数

    \n
      \n
    1. [prefix] (string)

      The value to prefix the ID with.

      \n
    2. \n
    \n

    返回值 (string)

    \n

    Returns the unique ID.

    \n
    \n

    示例

    \n
    _.uniqueId('contact_');\n// => 'contact_104'\n\n_.uniqueId();\n// => '105'\n
    \n
    \n
    \n\n
    " } + "html":"

    uniqueId source npm

    \n
    _.uniqueId([prefix])
    \n\n

    Generates a unique ID. If prefix is provided the ID is appended to it.

    \n
    \n\n

    参数

    \n
      \n
    1. [prefix] (string)

      The value to prefix the ID with.

      \n
    2. \n
    \n

    返回值 (string)

    \n

    Returns the unique ID.

    \n
    \n

    示例

    \n
    _.uniqueId('contact_');\n// => 'contact_104'\n\n_.uniqueId();\n// => '105'\n
    \n
    \n
    \n\n
    " } ] \ No newline at end of file diff --git a/parseInt.html b/parseInt.html index a6070a8..22b445c 100644 --- a/parseInt.html +++ b/parseInt.html @@ -392,7 +392,7 @@
    -

    parseInt source npm

    +

    parseInt source npm

    _.parseInt(string, [radix])

    Converts string to an integer of the specified radix. If radix is diff --git a/partial.html b/partial.html index 7b4a7e5..79b53de 100644 --- a/partial.html +++ b/partial.html @@ -392,7 +392,7 @@

    -

    partial source npm

    +

    partial source npm

    _.partial(func, [partials])

    Creates a function that invokes func with partial arguments prepended diff --git a/partialRight.html b/partialRight.html index da556e7..1d8a9fa 100644 --- a/partialRight.html +++ b/partialRight.html @@ -392,7 +392,7 @@

    -

    partialRight source npm

    +

    partialRight source npm

    _.partialRight(func, [partials])

    This method is like _.partial except that partially applied arguments diff --git a/partition.html b/partition.html index 0645bd0..c4b3307 100644 --- a/partition.html +++ b/partition.html @@ -392,7 +392,7 @@

    -

    partition source npm

    +

    partition source npm

    _.partition(collection, [predicate=_.identity])

    Creates an array of elements split into two groups, the first of which @@ -403,9 +403,9 @@

    参数

      -
    1. collection (Array|Object)

      The collection to iterate over.

      +
    2. collection (Array|Object)

      需要遍历的集合

    3. -
    4. [predicate=_.identity] (Function|Object|string)

      The function invoked per iteration.

      +
    5. [predicate=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

    返回值 (Array)

    diff --git a/pick.html b/pick.html index 2ac7029..f9d53d3 100644 --- a/pick.html +++ b/pick.html @@ -392,7 +392,7 @@
    -

    pick source npm

    +

    pick source npm

    _.pick(object, [props])

    Creates an object composed of the picked object properties.

    diff --git a/pickBy.html b/pickBy.html index 64aa818..20a0ed4 100644 --- a/pickBy.html +++ b/pickBy.html @@ -392,7 +392,7 @@
    -

    pickBy source npm

    +

    pickBy source npm

    _.pickBy(object, [predicate=_.identity])

    Creates an object composed of the object properties predicate returns diff --git a/property.html b/property.html index 9104c10..14437dd 100644 --- a/property.html +++ b/property.html @@ -392,7 +392,7 @@

    -

    property source npm

    +

    property source npm

    _.property(path)

    Creates a function that returns the value at path of a given object.

    diff --git a/propertyOf.html b/propertyOf.html index 5231b13..42b0b2a 100644 --- a/propertyOf.html +++ b/propertyOf.html @@ -392,7 +392,7 @@
    -

    propertyOf source npm

    +

    propertyOf source npm

    _.propertyOf(object)

    The opposite of _.property; this method creates a function that returns diff --git a/pullAllBy.html b/pullAllBy.html index fd84ab8..47f558b 100644 --- a/pullAllBy.html +++ b/pullAllBy.html @@ -407,7 +407,7 @@

    参数

  • values (Array)

    要移除的值

  • -
  • [iteratee=_.identity] (Function|Object|string)

    这个函数会调用每一个元素

    +
  • [iteratee=_.identity] (Function|Object|string)

    这个函数会处理每一个元素

  • 返回值 (Array)

    diff --git a/random.html b/random.html index 235aaba..77b5378 100644 --- a/random.html +++ b/random.html @@ -392,7 +392,7 @@
    -

    random source npm

    +

    random source npm

    _.random([min=0], [max=1], [floating])

    Produces a random number between min and max (inclusive). If only one diff --git a/range.html b/range.html index 535cf1d..f710d5d 100644 --- a/range.html +++ b/range.html @@ -392,7 +392,7 @@

    -

    range source npm

    +

    range source npm

    _.range([start=0], end, [step=1])

    Creates an array of numbers (positive and/or negative) progressing from diff --git a/rangeRight.html b/rangeRight.html index 4737e0a..855c713 100644 --- a/rangeRight.html +++ b/rangeRight.html @@ -392,7 +392,7 @@

    -

    rangeRight source npm

    +

    rangeRight source npm

    _.rangeRight([start=0], end, [step=1])

    This method is like _.range except that it populates values in diff --git a/rearg.html b/rearg.html index 4fd3dd7..f266bb3 100644 --- a/rearg.html +++ b/rearg.html @@ -392,7 +392,7 @@

    -

    rearg source npm

    +

    rearg source npm

    _.rearg(func, indexes)

    Creates a function that invokes func with arguments arranged according diff --git a/reduce.html b/reduce.html index 8ceb6cc..e15701b 100644 --- a/reduce.html +++ b/reduce.html @@ -392,7 +392,7 @@

    -

    reduce source npm

    +

    reduce source npm

    _.reduce(collection, [iteratee=_.identity], [accumulator])

    Reduces collection to a value which is the accumulated result of running @@ -414,9 +414,9 @@

    参数

      -
    1. collection (Array|Object)

      The collection to iterate over.

      +
    2. collection (Array|Object)

      需要遍历的集合

    3. -
    4. [iteratee=_.identity] (Function)

      The function invoked per iteration.

      +
    5. [iteratee=_.identity] (Function)

      这个函数会处理每一个元素

    6. [accumulator] (*)

      The initial value.

    7. @@ -434,7 +434,7 @@

      示例

      (result[value] || (result[value] = [])).push(key); return result; }, {}); -// => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed) +// => { '1': ['a', 'c'], '2': ['b'] } (无法保证遍历的顺序)
    diff --git a/reduceRight.html b/reduceRight.html index 4218074..eeea626 100644 --- a/reduceRight.html +++ b/reduceRight.html @@ -392,7 +392,7 @@
    -

    reduceRight source npm

    +

    reduceRight source npm

    _.reduceRight(collection, [iteratee=_.identity], [accumulator])

    This method is like _.reduce except that it iterates over elements of @@ -401,9 +401,9 @@

    参数

      -
    1. collection (Array|Object)

      The collection to iterate over.

      +
    2. collection (Array|Object)

      需要遍历的集合

    3. -
    4. [iteratee=_.identity] (Function)

      The function invoked per iteration.

      +
    5. [iteratee=_.identity] (Function)

      这个函数会处理每一个元素

    6. [accumulator] (*)

      The initial value.

    7. diff --git a/reject.html b/reject.html index 09bc878..8a81ba4 100644 --- a/reject.html +++ b/reject.html @@ -392,7 +392,7 @@
      -

      reject source npm

      +

      reject source npm

      _.reject(collection, [predicate=_.identity])

      The opposite of _.filter; this method returns the elements of collection @@ -401,9 +401,9 @@

      参数

        -
      1. collection (Array|Object)

        The collection to iterate over.

        +
      2. collection (Array|Object)

        需要遍历的集合

      3. -
      4. [predicate=_.identity] (Function|Object|string)

        The function invoked per iteration.

        +
      5. [predicate=_.identity] (Function|Object|string)

        这个函数会处理每一个元素

      返回值 (Array)

      diff --git a/remove.html b/remove.html index 6d21f3e..3449a15 100644 --- a/remove.html +++ b/remove.html @@ -405,7 +405,7 @@

      参数

      1. array (Array)

        需要调整的数组

      2. -
      3. [predicate=_.identity] (Function|Object|string)

        这个函数会调用每一个元素

        +
      4. [predicate=_.identity] (Function|Object|string)

        这个函数会处理每一个元素

      返回值 (Array)

      diff --git a/repeat.html b/repeat.html index 951d1b0..9067c10 100644 --- a/repeat.html +++ b/repeat.html @@ -392,7 +392,7 @@
      -

      repeat source npm

      +

      repeat source npm

      _.repeat([string=''], [n=0])

      Repeats the given string n times.

      diff --git a/replace.html b/replace.html index a374fde..3dc26f9 100644 --- a/replace.html +++ b/replace.html @@ -392,7 +392,7 @@
      -

      replace source npm

      +

      replace source npm

      _.replace([string=''], pattern, replacement)

      Replaces matches for pattern in string with replacement. diff --git a/rest.html b/rest.html index cf63ed4..6d9aa4a 100644 --- a/rest.html +++ b/rest.html @@ -392,7 +392,7 @@

      -

      rest source npm

      +

      rest source npm

      _.rest(func, [start=func.length-1])

      Creates a function that invokes func with the this binding of the diff --git a/result.html b/result.html index d9331f8..0788368 100644 --- a/result.html +++ b/result.html @@ -392,7 +392,7 @@

      -

      result source npm

      +

      result source npm

      _.result(object, path, [defaultValue])

      This method is like _.get except that if the resolved value is a function diff --git a/round.html b/round.html index a07f568..402fd1e 100644 --- a/round.html +++ b/round.html @@ -392,7 +392,7 @@

      -

      round source npm

      +

      round source npm

      _.round(number, [precision=0])

      Computes number rounded to precision.

      diff --git a/sample.html b/sample.html index 19a597e..f4aca78 100644 --- a/sample.html +++ b/sample.html @@ -392,7 +392,7 @@
      -

      sample source npm

      +

      sample source npm

      _.sample(collection)

      Gets a random element from collection.

      diff --git a/sampleSize.html b/sampleSize.html index 085dbe0..2ac3490 100644 --- a/sampleSize.html +++ b/sampleSize.html @@ -392,7 +392,7 @@
      -

      sampleSize source npm

      +

      sampleSize source npm

      _.sampleSize(collection, [n=0])

      Gets n random elements from collection.

      diff --git a/set.html b/set.html index c06603d..260a603 100644 --- a/set.html +++ b/set.html @@ -392,7 +392,7 @@
      -

      set source npm

      +

      set source npm

      _.set(object, path, value)

      Sets the value at path of object. If a portion of path doesn't exist diff --git a/setWith.html b/setWith.html index 59f77f0..e89d3d8 100644 --- a/setWith.html +++ b/setWith.html @@ -392,7 +392,7 @@

      -

      setWith source npm

      +

      setWith source npm

      _.setWith(object, path, value, [customizer])

      This method is like _.set except that it accepts customizer which is diff --git a/shuffle.html b/shuffle.html index 1486002..65320c2 100644 --- a/shuffle.html +++ b/shuffle.html @@ -392,7 +392,7 @@

      -

      shuffle source npm

      +

      shuffle source npm

      _.shuffle(collection)

      Creates an array of shuffled values, using a version of the diff --git a/size.html b/size.html index 037c8b9..e682721 100644 --- a/size.html +++ b/size.html @@ -392,7 +392,7 @@

      -

      size source npm

      +

      size source npm

      _.size(collection)

      Gets the size of collection by returning its length for array-like diff --git a/snakeCase.html b/snakeCase.html index 76310ce..a60fa05 100644 --- a/snakeCase.html +++ b/snakeCase.html @@ -392,7 +392,7 @@

      -

      snakeCase source npm

      +

      snakeCase source npm

      _.snakeCase([string=''])

      Converts string to snake case.

      diff --git a/some.html b/some.html index 29f7ae3..fbe1524 100644 --- a/some.html +++ b/some.html @@ -392,7 +392,7 @@
      -

      some source npm

      +

      some source npm

      _.some(collection, [predicate=_.identity])

      Checks if predicate returns truthy for any element of collection. @@ -402,9 +402,9 @@

      参数

        -
      1. collection (Array|Object)

        The collection to iterate over.

        +
      2. collection (Array|Object)

        需要遍历的集合

      3. -
      4. [predicate=_.identity] (Function|Object|string)

        The function invoked per iteration.

        +
      5. [predicate=_.identity] (Function|Object|string)

        这个函数会处理每一个元素

      返回值 (boolean)

      diff --git a/sortBy.html b/sortBy.html index 2a64c1e..6319c21 100644 --- a/sortBy.html +++ b/sortBy.html @@ -392,7 +392,7 @@
      -

      sortBy source npm

      +

      sortBy source npm

      _.sortBy(collection, [iteratees=[_.identity]])

      Creates an array of elements, sorted in ascending order by the results of @@ -403,7 +403,7 @@

      参数

        -
      1. collection (Array|Object)

        The collection to iterate over.

        +
      2. collection (Array|Object)

        需要遍历的集合

      3. [iteratees=[_.identity]] (...(Function|Function[]|Object|Object[]|string|string[])

        The iteratees to sort by, specified individually or in arrays.

      4. diff --git a/sortedIndexBy.html b/sortedIndexBy.html index 0eb19f8..cff4a0e 100644 --- a/sortedIndexBy.html +++ b/sortedIndexBy.html @@ -404,7 +404,7 @@

        参数

    8. value (*)

      要评估位置的值

    9. -
    10. [iteratee=_.identity] (Function|Object|string)

      这个函数会调用每一个元素

      +
    11. [iteratee=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

    返回值 (number)

    diff --git a/sortedLastIndexBy.html b/sortedLastIndexBy.html index c1c116b..ed5b8ca 100644 --- a/sortedLastIndexBy.html +++ b/sortedLastIndexBy.html @@ -404,7 +404,7 @@

    参数

  • value (*)

    要评估位置的值

  • -
  • [iteratee=_.identity] (Function|Object|string)

    这个函数会调用每一个元素

    +
  • [iteratee=_.identity] (Function|Object|string)

    这个函数会处理每一个元素

  • 返回值 (number)

    diff --git a/sortedUniqBy.html b/sortedUniqBy.html index 26dbc19..9b90ace 100644 --- a/sortedUniqBy.html +++ b/sortedUniqBy.html @@ -402,7 +402,7 @@

    参数

    1. array (Array)

      要调整的数组

    2. -
    3. [iteratee] (Function)

      这个函数会调用每一个元素

      +
    4. [iteratee] (Function)

      这个函数会处理每一个元素

    返回值 (Array)

    diff --git a/split.html b/split.html index e246c42..78f9ac7 100644 --- a/split.html +++ b/split.html @@ -392,7 +392,7 @@
    -

    split source npm

    +

    split source npm

    _.split([string=''], separator, [limit])

    Splits string by separator. diff --git a/spread.html b/spread.html index e71f3d9..d0fd18c 100644 --- a/spread.html +++ b/spread.html @@ -392,7 +392,7 @@

    -

    spread source npm

    +

    spread source npm

    _.spread(func)

    Creates a function that invokes func with the this binding of the created diff --git a/startCase.html b/startCase.html index f6f8f5e..6994e81 100644 --- a/startCase.html +++ b/startCase.html @@ -392,7 +392,7 @@

    -

    startCase source npm

    +

    startCase source npm

    _.startCase([string=''])

    Converts string to start case.

    diff --git a/startsWith.html b/startsWith.html index 1d85f71..6485c7a 100644 --- a/startsWith.html +++ b/startsWith.html @@ -392,7 +392,7 @@
    -

    startsWith source npm

    +

    startsWith source npm

    _.startsWith([string=''], [target], [position=0])

    Checks if string starts with the given target string.

    diff --git a/subtract.html b/subtract.html index cfd4f1c..e851fbc 100644 --- a/subtract.html +++ b/subtract.html @@ -392,7 +392,7 @@
    -

    subtract source npm

    +

    subtract source npm

    _.subtract(minuend, subtrahend)

    Subtract two numbers.

    diff --git a/sum.html b/sum.html index 51f221e..1f91aa4 100644 --- a/sum.html +++ b/sum.html @@ -392,7 +392,7 @@
    -

    sum source npm

    +

    sum source npm

    _.sum(array)

    Computes the sum of the values in array.

    diff --git a/sumBy.html b/sumBy.html index 2c06f74..ec2a457 100644 --- a/sumBy.html +++ b/sumBy.html @@ -392,19 +392,19 @@
    -

    sumBy source npm

    +

    sumBy source npm

    _.sumBy(array, [iteratee=_.identity])

    This method is like _.sum except that it accepts iteratee which is invoked for each element in array to generate the value to be summed. -The iteratee is invoked with one argument: (value).

    +The iteratee 会传入1个参数:(value)。

    参数

    1. array (Array)

      The array to iterate over.

    2. -
    3. [iteratee=_.identity] (Function|Object|string)

      这个函数会调用每一个元素

      +
    4. [iteratee=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

    返回值 (number)

    diff --git a/takeRightWhile.html b/takeRightWhile.html index 763373a..8b82205 100644 --- a/takeRightWhile.html +++ b/takeRightWhile.html @@ -402,7 +402,7 @@

    参数

    1. array (Array)

      需要处理的数组

    2. -
    3. [predicate=_.identity] (Function|Object|string)

      这个函数会调用每一个元素

      +
    4. [predicate=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

    返回值 (Array)

    diff --git a/takeWhile.html b/takeWhile.html index 179e461..d49bd33 100644 --- a/takeWhile.html +++ b/takeWhile.html @@ -402,7 +402,7 @@

    参数

    1. array (Array)

      需要处理的数组

    2. -
    3. [predicate=_.identity] (Function|Object|string)

      这个函数会调用每一个元素

      +
    4. [predicate=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

    返回值 (Array)

    diff --git a/template.html b/template.html index fb96889..52ec915 100644 --- a/template.html +++ b/template.html @@ -392,7 +392,7 @@
    -

    template source npm

    +

    template source npm

    _.template([string=''], [options])

    Creates a compiled template function that can interpolate data properties diff --git a/throttle.html b/throttle.html index 8c856cd..1d270aa 100644 --- a/throttle.html +++ b/throttle.html @@ -392,7 +392,7 @@

    -

    throttle source npm

    +

    throttle source npm

    _.throttle(func, [wait=0], [options])

    Creates a throttled function that only invokes func at most once per diff --git a/times.html b/times.html index accb2a4..a5d0752 100644 --- a/times.html +++ b/times.html @@ -392,7 +392,7 @@

    -

    times source npm

    +

    times source npm

    _.times(n, [iteratee=_.identity])

    Invokes the iteratee function n times, returning an array of the results @@ -403,7 +403,7 @@

    参数

    1. n (number)

      The number of times to invoke iteratee.

    2. -
    3. [iteratee=_.identity] (Function)

      The function invoked per iteration.

      +
    4. [iteratee=_.identity] (Function)

      这个函数会处理每一个元素

    返回值 (Array)

    diff --git a/toArray.html b/toArray.html index 88e946b..4af50d9 100644 --- a/toArray.html +++ b/toArray.html @@ -392,7 +392,7 @@
    -

    toArray source npm

    +

    toArray source npm

    _.toArray(value)

    Converts value to an array.

    diff --git a/toInteger.html b/toInteger.html index a417bc8..7d2f186 100644 --- a/toInteger.html +++ b/toInteger.html @@ -392,7 +392,7 @@
    -

    toInteger source npm

    +

    toInteger source npm

    _.toInteger(value)

    Converts value to an integer. diff --git a/toLength.html b/toLength.html index a1f8cdd..4a8bdf7 100644 --- a/toLength.html +++ b/toLength.html @@ -392,7 +392,7 @@

    -

    toLength source npm

    +

    toLength source npm

    _.toLength(value)

    Converts value to an integer suitable for use as the length of an diff --git a/toLower.html b/toLower.html index 9c2767b..5263846 100644 --- a/toLower.html +++ b/toLower.html @@ -392,7 +392,7 @@

    -

    toLower source npm

    +

    toLower source npm

    _.toLower([string=''])

    Converts string, as a whole, to lower case.

    diff --git a/toNumber.html b/toNumber.html index 1043ee0..32ce45a 100644 --- a/toNumber.html +++ b/toNumber.html @@ -392,7 +392,7 @@
    -

    toNumber source npm

    +

    toNumber source npm

    _.toNumber(value)

    Converts value to a number.

    diff --git a/toPairs.html b/toPairs.html index c646100..41f8803 100644 --- a/toPairs.html +++ b/toPairs.html @@ -392,7 +392,7 @@
    -

    toPairs source npm

    +

    toPairs source npm

    _.toPairs(object)

    Creates an array of own enumerable key-value pairs for object.

    @@ -415,7 +415,7 @@

    示例

    Foo.prototype.c = 3; _.toPairs(new Foo); -// => [['a', 1], ['b', 2]] (iteration order is not guaranteed) +// => [['a', 1], ['b', 2]] (无法保证遍历的顺序)
    diff --git a/toPairsIn.html b/toPairsIn.html index 916ef99..d425d13 100644 --- a/toPairsIn.html +++ b/toPairsIn.html @@ -392,7 +392,7 @@
    -

    toPairsIn source npm

    +

    toPairsIn source npm

    _.toPairsIn(object)

    Creates an array of own and inherited enumerable key-value pairs for object.

    @@ -415,7 +415,7 @@

    示例

    Foo.prototype.c = 3; _.toPairsIn(new Foo); -// => [['a', 1], ['b', 2], ['c', 1]] (iteration order is not guaranteed) +// => [['a', 1], ['b', 2], ['c', 1]] (无法保证遍历的顺序)
    diff --git a/toPath.html b/toPath.html index 9dde960..f074aba 100644 --- a/toPath.html +++ b/toPath.html @@ -392,7 +392,7 @@
    -

    toPath source npm

    +

    toPath source npm

    _.toPath(value)

    Converts value to a property path array.

    diff --git a/toPlainObject.html b/toPlainObject.html index e129229..d8eb7f6 100644 --- a/toPlainObject.html +++ b/toPlainObject.html @@ -392,7 +392,7 @@
    -

    toPlainObject source npm

    +

    toPlainObject source npm

    _.toPlainObject(value)

    Converts value to a plain object flattening inherited enumerable diff --git a/toSafeInteger.html b/toSafeInteger.html index bf76368..cdaef2c 100644 --- a/toSafeInteger.html +++ b/toSafeInteger.html @@ -392,7 +392,7 @@

    -

    toSafeInteger source npm

    +

    toSafeInteger source npm

    _.toSafeInteger(value)

    Converts value to a safe integer. A safe integer can be compared and diff --git a/toString.html b/toString.html index 464faa6..bdd255d 100644 --- a/toString.html +++ b/toString.html @@ -392,7 +392,7 @@

    -

    toString source npm

    +

    toString source npm

    _.toString(value)

    Converts value to a string if it's not one. An empty string is returned diff --git a/toUpper.html b/toUpper.html index 8698a55..5d99243 100644 --- a/toUpper.html +++ b/toUpper.html @@ -392,7 +392,7 @@

    -

    toUpper source npm

    +

    toUpper source npm

    _.toUpper([string=''])

    Converts string, as a whole, to upper case.

    diff --git a/transform.html b/transform.html index b0affdd..eb7ddf5 100644 --- a/transform.html +++ b/transform.html @@ -392,7 +392,7 @@
    -

    transform source npm

    +

    transform source npm

    _.transform(object, [iteratee=_.identity], [accumulator])

    An alternative to _.reduce; this method transforms object to a new @@ -407,7 +407,7 @@

    参数

    1. object (Array|Object)

      The object to iterate over.

    2. -
    3. [iteratee=_.identity] (Function)

      The function invoked per iteration.

      +
    4. [iteratee=_.identity] (Function)

      这个函数会处理每一个元素

    5. [accumulator] (*)

      The custom accumulator value.

    6. diff --git a/trim.html b/trim.html index 53f8211..219925f 100644 --- a/trim.html +++ b/trim.html @@ -392,7 +392,7 @@
      -

      trim source npm

      +

      trim source npm

      _.trim([string=''], [chars=whitespace])

      Removes leading and trailing whitespace or specified characters from string.

      diff --git a/trimEnd.html b/trimEnd.html index afc85bd..f8c7f68 100644 --- a/trimEnd.html +++ b/trimEnd.html @@ -392,7 +392,7 @@
      -

      trimEnd source npm

      +

      trimEnd source npm

      _.trimEnd([string=''], [chars=whitespace])

      Removes trailing whitespace or specified characters from string.

      diff --git a/trimStart.html b/trimStart.html index 61b6646..8dfac1d 100644 --- a/trimStart.html +++ b/trimStart.html @@ -392,7 +392,7 @@
      -

      trimStart source npm

      +

      trimStart source npm

      _.trimStart([string=''], [chars=whitespace])

      Removes leading whitespace or specified characters from string.

      diff --git a/truncate.html b/truncate.html index 4997cf1..08b12f6 100644 --- a/truncate.html +++ b/truncate.html @@ -392,7 +392,7 @@
      -

      truncate source npm

      +

      truncate source npm

      _.truncate([string=''], [options])

      Truncates string if it's longer than the given maximum string length. diff --git a/unary.html b/unary.html index 81f9e56..10ad89c 100644 --- a/unary.html +++ b/unary.html @@ -392,7 +392,7 @@

      -

      unary source npm

      +

      unary source npm

      _.unary(func)

      Creates a function that accepts up to one argument, ignoring any diff --git a/unescape.html b/unescape.html index ee3c2ce..400e688 100644 --- a/unescape.html +++ b/unescape.html @@ -392,7 +392,7 @@

      -

      unescape source npm

      +

      unescape source npm

      _.unescape([string=''])

      The inverse of _.escape; this method converts the HTML entities diff --git a/unionBy.html b/unionBy.html index f8ab89f..de78f37 100644 --- a/unionBy.html +++ b/unionBy.html @@ -402,7 +402,7 @@

      参数

      1. [arrays] (...Array)

        需要处理的数组队列

      2. -
      3. [iteratee=_.identity] (Function|Object|string)

        这个函数会调用每一个元素

        +
      4. [iteratee=_.identity] (Function|Object|string)

        这个函数会处理每一个元素

      返回值 (Array)

      diff --git a/unionWith.html b/unionWith.html index f82f7ae..085ba1b 100644 --- a/unionWith.html +++ b/unionWith.html @@ -403,7 +403,7 @@

      参数

      1. [arrays] (...Array)

        需要处理的数组队列

      2. -
      3. [comparator] (Function)

        这个函数会调用每一个元素

        +
      4. [comparator] (Function)

        这个函数会处理每一个元素

      返回值 (Array)

      diff --git a/uniqBy.html b/uniqBy.html index 329d180..6dba29f 100644 --- a/uniqBy.html +++ b/uniqBy.html @@ -402,7 +402,7 @@

      参数

      1. array (Array)

        需要处理的数组

      2. -
      3. [iteratee=_.identity] (Function|Object|string)

        这个函数会调用每一个元素

        +
      4. [iteratee=_.identity] (Function|Object|string)

        这个函数会处理每一个元素

      返回值 (Array)

      diff --git a/uniqWith.html b/uniqWith.html index 72e6213..2c1f511 100644 --- a/uniqWith.html +++ b/uniqWith.html @@ -402,7 +402,7 @@

      参数

      1. array (Array)

        需要处理的数组

      2. -
      3. [comparator] (Function)

        这个函数会调用每一个元素

        +
      4. [comparator] (Function)

        这个函数会处理每一个元素

      返回值 (Array)

      diff --git a/uniqueId.html b/uniqueId.html index a91bfb7..2735566 100644 --- a/uniqueId.html +++ b/uniqueId.html @@ -392,7 +392,7 @@
      -

      uniqueId source npm

      +

      uniqueId source npm

      _.uniqueId([prefix])

      Generates a unique ID. If prefix is provided the ID is appended to it.

      diff --git a/unset.html b/unset.html index ab65e0e..2cc644b 100644 --- a/unset.html +++ b/unset.html @@ -392,7 +392,7 @@
      -

      unset source npm

      +

      unset source npm

      _.unset(object, path)

      Removes the property at path of object.

      diff --git a/upperCase.html b/upperCase.html index 816f211..0da9860 100644 --- a/upperCase.html +++ b/upperCase.html @@ -392,7 +392,7 @@
      -

      upperCase source npm

      +

      upperCase source npm

      _.upperCase([string=''])

      Converts string, as space separated words, to upper case.

      diff --git a/upperFirst.html b/upperFirst.html index 112d5e5..05414c3 100644 --- a/upperFirst.html +++ b/upperFirst.html @@ -392,7 +392,7 @@
      -

      upperFirst source npm

      +

      upperFirst source npm

      _.upperFirst([string=''])

      Converts the first character of string to upper case.

      diff --git a/values.html b/values.html index 3fb0b77..3db88e9 100644 --- a/values.html +++ b/values.html @@ -392,7 +392,7 @@
      -

      values source npm

      +

      values source npm

      _.values(object)

      Creates an array of the own enumerable property values of object. @@ -418,7 +418,7 @@

      示例

      Foo.prototype.c = 3; _.values(new Foo); -// => [1, 2] (iteration order is not guaranteed) +// => [1, 2] (无法保证遍历的顺序) _.values('hi'); // => ['h', 'i'] diff --git a/valuesIn.html b/valuesIn.html index 6cc4d68..da43b62 100644 --- a/valuesIn.html +++ b/valuesIn.html @@ -392,7 +392,7 @@
      -

      valuesIn source npm

      +

      valuesIn source npm

      _.valuesIn(object)

      Creates an array of the own and inherited enumerable property values of object. @@ -418,7 +418,7 @@

      示例

      Foo.prototype.c = 3; _.valuesIn(new Foo); -// => [1, 2, 3] (iteration order is not guaranteed) +// => [1, 2, 3] (无法保证遍历的顺序)
    diff --git a/words.html b/words.html index 843a770..33f9dd1 100644 --- a/words.html +++ b/words.html @@ -392,7 +392,7 @@
    -

    words source npm

    +

    words source npm

    _.words([string=''], [pattern])

    Splits string into an array of its words.

    diff --git a/wrap.html b/wrap.html index 7b83110..379e446 100644 --- a/wrap.html +++ b/wrap.html @@ -392,7 +392,7 @@
    -

    wrap source npm

    +

    wrap source npm

    _.wrap(value, wrapper)

    Creates a function that provides value to the wrapper function as its diff --git a/wrapperFlatMap.html b/wrapperFlatMap.html index 25da726..25ee0a3 100644 --- a/wrapperFlatMap.html +++ b/wrapperFlatMap.html @@ -400,7 +400,7 @@

    参数

      -
    1. [iteratee=_.identity] (Function|Object|string)

      这个函数会调用每一个元素

      +
    2. [iteratee=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

    返回值 (Object)

    diff --git a/xorBy.html b/xorBy.html index e99eb0e..604c909 100644 --- a/xorBy.html +++ b/xorBy.html @@ -402,7 +402,7 @@

    参数

    1. [arrays] (...Array)

      要处理的数组

    2. -
    3. [iteratee=_.identity] (Function|Object|string)

      这个函数会调用每一个元素

      +
    4. [iteratee=_.identity] (Function|Object|string)

      这个函数会处理每一个元素

    返回值 (Array)

    diff --git a/xorWith.html b/xorWith.html index 2d80713..06a1bfd 100644 --- a/xorWith.html +++ b/xorWith.html @@ -402,7 +402,7 @@

    参数

    1. [arrays] (...Array)

      要处理的数组

    2. -
    3. [comparator] (Function)

      这个函数会调用每一个元素

      +
    4. [comparator] (Function)

      这个函数会处理每一个元素

    返回值 (Array)