8000 Bump to v4.0.0. · lodash/lodash@0646bac · GitHub
[go: up one dir, main page]

Skip to content

Commit 0646bac

Browse files
committed
Bump to v4.0.0.
1 parent 4ef16c9 commit 0646bac

File tree

665 files changed

+24828
-19696
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

665 files changed

+24828
-19696
lines changed

LICENSE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
2-
Based on Underscore.js, copyright 2009-2015 Jeremy Ashkenas,
1+
Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/>
2+
Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas,
33
DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
44

55
Permission is hereby granted, free of charge, to any person obtaining

README.md

Lines changed: 11 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
# lodash v3.10.1
1+
# lodash v4.0.0
22

3-
The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash](https://lodash.com/) exported as [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) modules.
3+
The [lodash](https://lodash.com/) library exported as [Node.js](https://nodejs.org/) modules.
44

55
Generated using [lodash-cli](https://www.npmjs.com/package/lodash-cli):
66
```bash
7-
$ lodash modularize modern exports=node -o ./
8-
$ lodash modern -d -o ./index.js
7+
$ lodash modularize exports=node -o ./
8+
$ lodash -d -o ./lodash.js
99
```
1010

1111
## Installation
@@ -17,18 +17,18 @@ $ {sudo -H} npm i -g npm
1717
$ npm i --save lodash
1818
```
1919

20-
In Node.js/io.js:
20+
In Node.js:
2121

2222
```js
2323
// load the modern build
2424
var _ = require('lodash');
2525
// or a method category
2626
var array = require('lodash/array');
2727
// or a method (great for smaller builds with browserify/webpack)
28-
var chunk = require('lodash/array/chunk');
28+
var chunk = require('lodash/chunk');
2929
```
3030

31-
See the [package source](https://github.com/lodash/lodash/tree/3.10.1-npm) for more details.
31+
See the [package source](https://github.com/lodash/lodash/tree/4.0.0-npm) for more details.
3232

3333
**Note:**<br>
3434
Don’t assign values to the [special variable](http://nodejs.org/api/repl.html#repl_repl_features) `_` when in the REPL.<br>
@@ -38,9 +38,9 @@ Install [n_](https://www.npmjs.com/package/n_) for a REPL that includes lodash b
3838

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

41-
* npm packages for [modern](https://www.npmjs.com/package/lodash), [compatibility](https://www.npmjs.com/package/lodash-compat), & [per method](https://www.npmjs.com/browse/keyword/lodash-modularized) builds
42-
* AMD modules for [modern](https://github.com/lodash/lodash/tree/3.10.1-amd) & [compatibility](https://github.com/lodash/lodash-compat/tree/3.10.1-amd) builds
43-
* ES modules for the [modern](https://github.com/lodash/lodash/tree/3.10.1-es) build
41+
* [lodash](https://www.npmjs.com/package/lodash) & [per method](https://www.npmjs.com/browse/keyword/lodash-modularized) packages
42+
* [lodash-amd](https://www.npmjs.com/package/lodash-amd)
43+
* [lodash-es](https://www.npmjs.com/package/lodash-es)
4444

4545
## Further Reading
4646

@@ -50,72 +50,7 @@ lodash is also available in a variety of other builds & module formats.
5050
* [Roadmap](https://github.com/lodash/lodash/wiki/Roadmap)
5151
* [More Resources](https://github.com/lodash/lodash/wiki/Resources)
5252

53-
## Features
54-
55-
* ~100% [code coverage](https://coveralls.io/r/lodash)
56-
* Follows [semantic versioning](http://semver.org/) for releases
57-
* [Lazily evaluated](http://filimanjaro.com/blog/2014/introducing-lazy-evaluation/) chaining
58-
* [_(…)](https://lodash.com/docs#_) supports implicit chaining
59-
* [_.ary](https://lodash.com/docs#ary) & [_.rearg](https://lodash.com/docs#rearg) to change function argument limits & order
60-
* [_.at](https://lodash.com/docs#at) for cherry-picking collection values
61-
* [_.attempt](https://lodash.com/docs#attempt) to execute functions which may error without a try-catch
62-
* [_.before](https://lodash.com/docs#before) to complement [_.after](https://lodash.com/docs#after)
63-
* [_.bindKey](https://lodash.com/docs#bindKey) for binding [*“lazy”*](http://michaux.ca/articles/lazy-function-definition-pattern) defined methods
64-
* [_.chunk](https://lodash.com/docs#chunk) for splitting an array into chunks of a given size
65-
* [_.clone](https://lodash.com/docs#clone) supports shallow cloning of `Date` & `RegExp` objects
66-
* [_.cloneDeep](https://lodash.com/docs#cloneDeep) for deep cloning arrays & objects
67-
* [_.curry](https://lodash.com/docs#curry) & [_.curryRight](https://lodash.com/docs#curryRight) for creating [curried](http://hughfdjackson.com/javascript/why-curry-helps/) functions
68-
* [_.debounce](https://lodash.com/docs#debounce) & [_.throttle](https://lodash.com/docs#throttle) are cancelable & accept options for more control
69-
* [_.defaultsDeep](https://lodash.com/docs#defaultsDeep) for recursively assigning default properties
70-
* [_.fill](https://lodash.com/docs#fill) to fill arrays with values
71-
* [_.findKey](https://lodash.com/docs#findKey) for finding keys
72-
* [_.flow](https://lodash.com/docs#flow) to complement [_.flowRight](https://lodash.com/docs#flowRight) (a.k.a `_.compose`)
73-
* [_.forEach](https://lodash.com/docs#forEach) supports exiting early
74-
* [_.forIn](https://lodash.com/docs#forIn) for iterating all enumerable properties
75-
* [_.forOwn](https://lodash.com/docs#forOwn) for iterating own properties
76-
* [_.get](https://lodash.com/docs#get) & [_.set](https://lodash.com/docs#set) for deep property getting & setting
77-
* [_.gt](https://lodash.com/docs#gt), [_.gte](https://lodash.com/docs#gte), [_.lt](https://lodash.com/docs#lt), & [_.lte](https://lodash.com/docs#lte) relational methods
78-
* [_.inRange](https://lodash.com/docs#inRange) for checking whether a number is within a given range
79-
* [_.isNative](https://lodash.com/docs#isNative) to check for native functions
80-
* [_.isPlainObject](https://lodash.com/docs#isPlainObject) & [_.toPlainObject](https://lodash.com/docs#toPlainObject) to check for & convert to `Object` objects
81-
* [_.isTypedArray](https://lodash.com/docs#isTypedArray) to check for typed arrays
82-
* [_.mapKeys](https://lodash.com/docs#mapKeys) for mapping keys to an object
83-
* [_.matches](https://lodash.com/docs#matches) supports deep object comparisons
84-
* [_.matchesProperty](https://lodash.com/docs#matchesProperty) to complement [_.matches](https://lodash.com/docs#matches) & [_.property](https://lodash.com/docs#property)
85-
* [_.merge](https://lodash.com/docs#merge) for a deep [_.extend](https://lodash.com/docs#extend)
86-
* [_.method](https://lodash.com/docs#method) & [_.methodOf](https://lodash.com/docs#methodOf) to create functions that invoke methods
87-
* [_.modArgs](https://lodash.com/docs#modArgs) for more advanced functional composition
88-
* [_.parseInt](https://lodash.com/docs#parseInt) for consistent cross-environment behavior
89-
* [_.pull](https://lodash.com/docs#pull), [_.pullAt](https://lodash.com/docs#pullAt), & [_.remove](https://lodash.com/docs#remove) for mutating arrays
90-
* [_.random](https://lodash.com/docs#random) supports returning floating-point numbers
91-
* [_.restParam](https://lodash.com/docs#restParam) & [_.spread](https://lodash.com/docs#spread) for applying rest parameters & spreading arguments to functions
92-
* [_.runInContext](https://lodash.com/docs#runInContext) for collisionless mixins & easier mocking
93-
* [_.slice](https://lodash.com/docs#slice) for creating subsets of array-like values
94-
* [_.sortByAll](https://lodash.com/docs#sortByAll) & [_.sortByOrder](https://lodash.com/docs#sortByOrder) for sorting by multiple properties & orders
95-
* [_.support](https://lodash.com/docs#support) for flagging environment features
96-
* [_.template](https://lodash.com/docs#template) supports [*“imports”*](https://lodash.com/docs#templateSettings-imports) options & [ES template delimiters](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-template-literal-lexical-components)
97-
* [_.transform](https://lodash.com/docs#transform) as a powerful alternative to [_.reduce](https://lodash.com/docs#reduce) for transforming objects
98-
* [_.unzipWith](https://lodash.com/docs#unzipWith) & [_.zipWith](https://lodash.com/docs#zipWith) to specify how grouped values should be combined
99-
* [_.valuesIn](https://lodash.com/docs#valuesIn) for getting values of all enumerable properties
100-
* [_.xor](https://lodash.com/docs#xor) to complement [_.difference](https://lodash.com/docs#difference), [_.intersection](https://lodash.com/docs#intersection), & [_.union](https://lodash.com/docs#union)
101-
* [_.add](https://lodash.com/docs#add), [_.round](https://lodash.com/docs#round), [_.sum](https://lodash.com/docs#sum), &
102-
[more](https://lodash.com/docs "_.ceil & _.floor") math methods
103-
* [_.bind](https://lodash.com/docs#bind), [_.curry](https://lodash.com/docs#curry), [_.partial](https://lodash.com/docs#partial), &
104-
[more](https://lodash.com/docs "_.bindKey, _.curryRight, _.partialRight") support customizable argument placeholders
105-
* [_.capitalize](https://lodash.com/docs#capitalize), [_.trim](https://lodash.com/docs#trim), &
106-
[more](https://lodash.com/docs "_.camelCase, _.deburr, _.endsWith, _.escapeRegExp, _.kebabCase, _.pad, _.padLeft, _.padRight, _.repeat, _.snakeCase, _.startCase, _.startsWith, _.trimLeft, _.trimRight, _.trunc, _.words") string methods
107-
* [_.clone](https://lodash.com/docs#clone), [_.isEqual](https://lodash.com/docs#isEqual), &
108-
[more](https://lodash.com/docs "_.assign, _.cloneDeep, _.merge") accept customizer callbacks
109-
* [_.dropWhile](https://lodash.com/docs#dropWhile), [_.takeWhile](https://lodash.com/docs#takeWhile), &
110-
[more](https://lodash.com/docs "_.drop, _.dropRight, _.dropRightWhile, _.take, _.takeRight, _.takeRightWhile") to complement [_.first](https://lodash.com/docs#first), [_.initial](https://lodash.com/docs#initial), [_.last](https://lodash.com/docs#last), & [_.rest](https://lodash.com/docs#rest)
111-
* [_.findLast](https://lodash.com/docs#findLast), [_.findLastKey](https://lodash.com/docs#findLastKey), &
112-
[more](https://lodash.com/docs "_.curryRight, _.dropRight, _.dropRightWhile, _.flowRight, _.forEachRight, _.forInRight, _.forOwnRight, _.padRight, partialRight, _.takeRight, _.trimRight, _.takeRightWhile") right-associative methods
113-
* [_.includes](https://lodash.com/docs#includes), [_.toArray](https://lodash.com/docs#toArray), &
114-
[more](https://lodash.com/docs "_.at, _.countBy, _.every, _.filter, _.find, _.findLast, _.findWhere, _.forEach, _.forEachRight, _.groupBy, _.indexBy, _.invoke, _.map, _.max, _.min, _.partition, _.pluck, _.reduce, _.reduceRight, _.reject, _.shuffle, _.size, _.some, _.sortBy, _.sortByAll, _.sortByOrder, _.sum, _.where") accept strings
115-
* [_#commit](https://lodash.com/docs#prototype-commit) & [_#plant](https://lodash.com/docs#prototype-plant) for working with chain sequences
116-
* [_#thru](https://lodash.com/docs#thru) to pass values thru a chain sequence
117-
11853
## Support
11954

120-
Tested in Chrome 43-44, Firefox 38-39, IE 6-11, MS Edge, Safari 5-8, ChakraNode 0.12.2, io.js 2.5.0, Node.js 0.8.28, 0.10.40, & 0.12.7, PhantomJS 1.9.8, RingoJS 0.11, & Rhino 1.7.6.
55+
Tested in Chrome 46-47, Firefox 42-43, IE 9-11, Edge 13, Safari 8-9, Node.js 0.10.x, 0.12.x, 4.x, & 5.x, &amp; PhantomJS 1.9.8.
12156
Automated [browser](https://saucelabs.com/u/lodash) & [CI](https://travis-ci.org/lodash/lodash/) test runs are available. Special thanks to [Sauce Labs](https://saucelabs.com/) for providing automated browser testing.

add.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/**
2+
* Adds two numbers.
3+
*
4+
* @static
5+
* @memberOf _
6+
* @category Math
7+
* @param {number} augend The first number in an addition.
8+
* @param {number} addend The second number in an addition.
9+
* @returns {number} Returns the total.
10+
* @example
11+
*
12+
* _.add(6, 4);
13+
* // => 10
14+
*/
15+
function add(augend, addend) {
16+
var result;
17+
if (augend !== undefined) {
18+
result = augend;
19+
}
20+
if (addend !== undefined) {
21+
result = result === undefined ? addend : (result + addend);
22+
}
23+
return result;
24+
}
25+
26+
module.exports = add;

function/after.js renamed to after.js

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1+
var toInteger = require('./toInteger');
2+
13
/** Used as the `TypeError` message for "Functions" methods. */
24
var FUNC_ERROR_TEXT = 'Expected a function';
35

4-
/* Native method references for those with the same name as other `lodash` methods. */
5-
var nativeIsFinite = global.isFinite;
6-
76
/**
87
* The opposite of `_.before`; this method creates a function that invokes
98
* `func` once it's called `n` or more times.
@@ -29,15 +28,9 @@ var nativeIsFinite = global.isFinite;
2928
*/
3029
function after(n, func) {
3130
if (typeof func != 'function') {
32-
if (typeof n == 'function') {
33-
var temp = n;
34-
n = func;
35-
func = temp;
36-
} else {
37-
throw new TypeError(FUNC_ERROR_TEXT);
38-
}
31+
throw new TypeError(FUNC_ERROR_TEXT);
3932
}
40-
n = nativeIsFinite(n = +n) ? n : 0;
33+
n = toInteger(n);
4134
return function() {
4235
if (--n < 1) {
4336
return func.apply(this, arguments);

array.js

Lines changed: 61 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,63 @@
11
module.exports = {
2-
'chunk': require('./array/chunk'),
3-
'compact': require('./array/compact'),
4-
'difference': require('./array/difference'),
5-
'drop': require('./array/drop'),
6-
'dropRight': require('./array/dropRight'),
7-
'dropRightWhile': require('./array/dropRightWhile'),
8-
'dropWhile': require('./array/dropWhile'),
9-
'fill': require('./array/fill'),
10-
'findIndex': require('./array/findIndex'),
11-
'findLastIndex': require('./array/findLastIndex'),
12-
'first': require('./array/first'),
13-
'flatten': require('./array/flatten'),
14-
'flattenDeep': require('./array/flattenDeep'),
15-
'head': require('./array/head'),
16-
'indexOf': require('./array/indexOf'),
17-
'initial': require('./array/initial'),
18-
'intersection': require('./array/intersection'),
19-
'last': require('./array/last'),
20-
'lastIndexOf': require('./array/lastIndexOf'),
21-
'object': require('./array/object'),
22-
'pull': require('./array/pull'),
23-
'pullAt': require('./array/pullAt'),
24-
'remove': require('./array/remove'),
25-
'rest': require('./array/rest'),
26-
'slice': require('./array/slice'),
27-
'sortedIndex': require('./array/sortedIndex'),
28-
'sortedLastIndex': require('./array/sortedLastIndex'),
29-
'tail': require('./array/tail'),
30-
'take': require('./array/take'),
31-
'takeRight': require('./array/takeRight'),
32-
'takeRightWhile': require('./array/takeRightWhile'),
33-
'takeWhile': require('./array/takeWhile'),
34-
'union': require('./array/union'),
35-
'uniq': require('./array/uniq'),
36-
'unique': require('./array/unique'),
37-
'unzip': require('./array/unzip'),
38-
'unzipWith': require('./array/unzipWith'),
39-
'without': require('./array/without'),
40-
'xor': require('./array/xor'),
41-
'zip': require('./array/zip'),
42-
'zipObject': require('./array/zipObject'),
43-
'zipWith': require('./array/zipWith')
2+
'chunk': require('./chunk'),
3+
'compact': require('./compact'),
4+
'concat': require('./concat'),
5+
'difference': require('./difference'),
6+
'differenceBy': require('./differenceBy'),
7+
'differenceWith': require('./differenceWith'),
8+
'drop': require('./drop'),
9+
'dropRight': require('./dropRight'),
10+
'dropRightWhile': require('./dropRightWhile'),
11+
'dropWhile': require('./dropWhile'),
12+
'fill': require('./fill'),
13+
'findIndex': require('./findIndex'),
14+
'findLastIndex': require('./findLastIndex'),
15+
'flatMap': require 10000 ('./flatMap'),
16+
'flatten': require('./flatten'),
17+
'flattenDeep': require('./flattenDeep'),
18+
'fromPairs': require('./fromPairs'),
19+
'head': require('./head'),
20+
'indexOf': require('./indexOf'),
21+
'initial': require('./initial'),
22+
'intersection': require('./intersection'),
23+
'intersectionBy': require('./intersectionBy'),
24+
'intersectionWith': require('./intersectionWith'),
25+
'join': require('./join'),
26+
'last': require('./last'),
27+
'lastIndexOf': require('./lastIndexOf'),
28+
'pull': require('./pull'),
29+
'pullAll': require('./pullAll'),
30+
'pullAllBy': require('./pullAllBy'),
31+
'pullAt': require('./pullAt'),
32+
'remove': require('./remove'),
33+
'reverse': require('./reverse'),
34+
'slice': require('./slice'),
35+
'sortedIndex': require('./sortedIndex'),
36+
'sortedIndexBy': require('./sortedIndexBy'),
37+
'sortedIndexOf': require('./sortedIndexOf'),
38+
'sortedLastIndex': require('./sortedLastIndex'),
39+
'sortedLastIndexBy': require('./sortedLastIndexBy'),
40+
'sortedLastIndexOf': require('./sortedLastIndexOf'),
41+
'sortedUniq': require('./sortedUniq'),
42+
'sortedUniqBy': require('./sortedUniqBy'),
43+
'tail': require('./tail'),
44+
'take': require('./take'),
45+
'takeRight': require('./takeRight'),
46+
'takeRightWhile': require('./takeRightWhile'),
47+
'takeWhile': require('./takeWhile'),
48+
'union': require('./union'),
49+
'unionBy': require('./unionBy'),
50+
'unionWith': require('./unionWith'),
51+
'uniq': require('./uniq'),
52+
'uniqBy': require('./uniqBy'),
53+
'uniqWith': require('./uniqWith'),
54+
'unzip': require('./unzip'),
55+
'unzipWith': require('./unzipWith'),
56+
'without': require('./without'),
57+
'xor': require('./xor'),
58+
'xorBy': require('./xorBy'),
59+
'xorWith': require('./xorWith'),
60+
'zip': require('./zip'),
61+
'zipObject': require('./zipObject'),
62+
'zipWith': require('./zipWith')
4463
};

array/difference.js

Lines changed: 0 additions & 29 deletions
This file was deleted.

array/dropRightWhile.js

Lines changed: 0 additions & 59 deletions
This file was deleted.

0 commit comments

Comments
 (0)
0