Compare commits

...

1107 Commits

Author SHA1 Message Date
John-David Dalton
1cd9dc49a9 Bump to v4.2.1. 2016-02-03 01:31:34 -08:00
John-David Dalton
d64a97195b Rebuild lodash and docs. 2016-02-03 01:16:58 -08:00
John-David Dalton
c6a3ace553 Skip pseudo-private aliases. 2016-02-03 01:16:58 -08:00
John-David Dalton
497d57ca95 Ensure fp add and subtract don't have rearg applied. 2016-02-03 00:16:07 -08:00
John-David Dalton
3a07b411fb Add fp tests for placeholders. 2016-02-03 00:16:07 -08:00
John-David Dalton
b0c2a8d5fd Add fp _.partial tests for convert by name. 2016-02-03 00:16:06 -08:00
John-David Dalton
e404d214aa Add _.placeholder support so wrapped functions may support placeholders. 2016-02-03 00:16:06 -08:00
Nathan Tran
7f295dc6e8 Make _baseConvert use spread and not rest. 2016-02-03 00:16:06 -08:00
Prayag Verma
d2a8203efb Remove duplicate to and the words from docs. [ci skip] 2016-02-03 00:16:06 -08:00
John-David Dalton
33bfa8f961 Add trimChars fp mapping. 2016-02-03 00:16:06 -08:00
John-David Dalton
f944254cb8 Cleanup fp.curryN test label. 2016-02-03 00:16:06 -08:00
John-David Dalton
30339cfd86 Add fp.getOr test. 2016-02-03 00:16:06 -08:00
John-David Dalton
7dd5549b05 Increment lodash package version to enable ci tests. 2016-02-03 00:16:06 -08:00
John-David Dalton
b6b59d93d7 Bump to 4.2.0. 2016-02-02 00:33:16 -08:00
John-David Dalton
5af68bbf94 Rebuild lodash and docs. 2016-02-02 00:33:16 -08:00
John-David Dalton
db7debd3da Move benchmark.js to a dev dep. 2016-02-02 00:33:16 -08:00
laispace
29bc8d965b Fix _.sortedUniqBy doc example. [ci skip] 2016-02-01 23:55:34 -08:00
John-David Dalton
daeb55e99d Rename mapping rekey to rename. 2016-02-01 23:53:19 -08:00
John-David Dalton
fa4d85897c Add mutation notes to _.mergeWith, _.set, _.setWith, and _.unset. [ci skip] 2016-02-01 22:53:05 -08:00
John-David Dalton
983363e0cd Cleanup readme. [ci skip] 2016-02-01 22:37:56 -08:00
John-David Dalton
d95dad76b8 Remove dead code. 2016-02-01 22:37:56 -08:00
John-David Dalton
18f74aa5b2 Rename spreadArgs to otherArgs. 2016-02-01 22:37:56 -08:00
John-David Dalton
e96a8f7bc6 Cleanup map tests. 2016-02-01 22:37:56 -08:00
John-David Dalton
29f39be6ad Add _.flapMap tests for collections. 2016-02-01 22:37:56 -08:00
John-David Dalton
7a17967d79 Add _.spread tests for the start param. 2016-02-01 22:37:56 -08:00
John-David Dalton
de5bd32aba Rename rp vars to rest. 2016-02-01 22:37:56 -08:00
Jason Trill
199b2e1a3a Reword docs for _.tap and _.thru. [ci skip] 2016-02-01 22:37:56 -08:00
John-David Dalton
a43e4f10ef Update vendors. 2016-02-01 22:37:55 -08:00
Trevor Hudson
5522e4641d Update _.pickBy docs to include value as an iteratee param. [ci skip] 2016-02-01 22:37:55 -08:00
greenkeeperio-bot
6c82ea8fc3 Update qunitjs to 1.21.0. 2016-02-01 22:37:55 -08:00
John-David Dalton
b4b45b7139 Update docdown. 2016-02-01 22:37:55 -08:00
John-David Dalton
7ebb033016 Add _.at chaining test for objects with index keys. 2016-02-01 22:37:55 -08:00
John-David Dalton
163fdb46f0 Ensure fp _.partial and _.partialRight accept an args param. 2016-02-01 22:37:55 -08:00
John-David Dalton
b38cf204f7 Add start param to _.spread. 2016-02-01 22:37:55 -08:00
John-David Dalton
fe5381b0f4 Cleanup fp mapping. 2016-02-01 22:37:55 -08:00
John-David Dalton
c99e7f1337 Make _.flatMap a "Collection" method. 2016-02-01 22:37:55 -08:00
Mohammed Nauage
b61b674fec Remove sorted behavior from _.indexOf docs. [ci skip] 2016-02-01 22:37:55 -08:00
John-David Dalton
3bdaf99cfa Ensure _.iteratee clones sources for "_.matchesProperty" shorthand. 2016-02-01 22:37:54 -08:00
John-David Dalton
6c85e7015a Add assocPath and dissocPath fp aliases. 2016-02-01 22:37:54 -08:00
John-David Dalton
9788f7101b Ensure fp unset is immutable. [closes #1913] 2016-02-01 22:37:54 -08:00
Billy Janitsch
d0d5a3802d Alias set to assoc in FP. 2016-02-01 22:37:54 -08:00
John-David Dalton
1f160b31ff Make doc code sample comments match source comment style. [ci skip] 2016-01-30 01:02:49 -08:00
Ivan Tanev
13659e87cb Ensure _.attempt preserves custom errors. 2016-01-30 01:02:49 -08:00
John-David Dalton
ac9b0bfc1b Increment package version to enable ci tests. 2016-01-30 01:02:48 -08:00
John-David Dalton
07f7a3f3c5 Bump to 4.1.0. 2016-01-29 14:22:08 -08:00
John-David Dalton
22984f4eb2 Rebuild lodash and docs. 2016-01-29 14:21:44 -08:00
John-David Dalton
2286283f98 Add babel-plugin-lodash mention to readme. [ci skip] 2016-01-29 14:21:37 -08:00
Florent Cailhol
5ca26e6ae0 Remove V8 JIT bug fix for _.isObject. 2016-01-29 01:09:23 -08:00
John-David Dalton
e7c3afc1e5 Add index.js and lodash.js to the list of ignored files when generating fp modules. 2016-01-28 23:58:16 -08:00
John-David Dalton
82e9b4197b Add more fp mutation tests for deep objects. 2016-01-28 23:01:28 -08:00
John-David Dalton
820939f014 Update docdown. 2016-01-28 22:11:48 -08:00
John-David Dalton
e4c9916e17 Add default accumulator values to doc examples. [ci skip] 2016-01-28 22:11:43 -08:00
John-David Dalton
ce88b120eb Use npm config shorthand. 2016-01-28 18:11:53 -08:00
John-David Dalton
23c5101227 Make doc postprocess fix for symbol identifers more generic. 2016-01-28 14:45:15 -08:00
Craig Martin
de3eeb2d47 Use npm pretest hook. 2016-01-28 12:36:13 -08:00
John-David Dalton
03f7205e6d Ensure _.clone and _.cloneDeep work on prototype objects. 2016-01-28 01:05:25 -08:00
John-David Dalton
7bf7ab954b Update vendors and dev deps. 2016-01-28 01:05:25 -08:00
John-David Dalton
97612f3b31 Disable npm progress bar in travis for quicker installs. 2016-01-27 07:38:08 -08:00
John-David Dalton
71702d058c Ignore more files. 2016-01-27 01:19:03 -08:00
John-David Dalton
6a4164d9f3 Ensure remapped fp method modules are created. 2016-01-27 00:47:31 -08:00
John-David Dalton
d3b0eae84c Use mapping for aliasToReal. 2016-01-27 00:47:31 -08:00
John-David Dalton
0105b93f38 Ensure fp convert can work with aliases as name. 2016-01-27 00:19:06 -08:00
John-David Dalton
cae0d2c707 Add aliasToReal fp mapping. 2016-01-27 00:19:06 -08:00
John-David Dalton
dcb1572240 Reorg fp tests. 2016-01-27 00:19:06 -08:00
John-David Dalton
e20f43018b Separate fp _mapping into individual exports. 2016-01-27 00:19:06 -08:00
John-David Dalton
01e176694f Correct fp arg order of assignWith, assignInWith, merge, mergeWith, defaults, and defaultsDeep. 2016-01-27 00:19:06 -08:00
John-David Dalton
a239ccaa9a Add main:modules npm run script. 2016-01-26 21:32:22 -08:00
Jeroen Engels
b97a05b7f2 Add npm scripts to build docs. 2016-01-26 21:32:16 -08:00
John-David Dalton
c86754afde Cleanup hasPath and indexKeys. 2016-01-26 18:20:51 -08:00
John-David Dalton
95da9c0dd4 Optimize _.isEmpty. [closes #1888] 2016-01-26 18:20:50 -08:00
John-David Dalton
567171993b Define trim_trailing_whitespace rule for all files. 2016-01-26 18:20:50 -08:00
Kent C. Dodds
60a0d554a0 Run scripts in parallel. 2016-01-26 10:10:16 -08:00
John-David Dalton
f87af6c642 Add more npm run-scripts. 2016-01-26 08:41:38 -08:00
John-David Dalton
df849e8698 Fix style nits. 2016-01-26 08:41:38 -08:00
John-David Dalton
7a8ef7aeb7 Ensure _.sum and _.sumBy return 0 for empty arrays. [closes #1883] 2016-01-26 01:29:59 -08:00
John-David Dalton
25c7c8b153 Update dev deps. 2016-01-26 00:29:41 -08:00
John-David Dalton
8048f015e5 Ensure _.mergeWith overwrites primitives with source object clones. [closes #1880] 2016-01-26 00:28:38 -08:00
John-David Dalton
8a7fce41bb Add invokeMap to the excused methods in Backbone tests. 2016-01-26 00:28:38 -08:00
John-David Dalton
094a272443 Add _.invertBy. 2016-01-26 00:28:37 -08:00
John-David Dalton
552be2f5fb Remove multiVal param from _.invert. 2016-01-26 00:28:37 -08:00
John-David Dalton
d99954133c Add _.zipObjectDeep. 2016-01-26 00:28:37 -08:00
John-David Dalton
c49ace5587 Add back fp build-modules files. 2016-01-26 00:28:30 -08:00
John-David Dalton
258ad020ed Bump to 4.0.1. 2016-01-25 00:33:25 -08:00
John-David Dalton
59de939c1d Rebuild lodash and docs. 2016-01-25 00:33:25 -08:00
John-David Dalton
9d2d4f39bc Reorg build, fp, and lib files. 2016-01-25 00:32:37 -08:00
John-David Dalton
f555cd2303 Update map references in precompile.js. 2016-01-25 00:24:36 -08:00
Esa-Matti Suuronen
fcb80e926d Add precompile script for fp modules. 2016-01-25 00:24:36 -08:00
John-David Dalton
3f1fd98bef Doc cleanup of aggregator methods. [ci skip] 2016-01-25 00:24:36 -08:00
John-David Dalton
e2280db917 Fix documented iteratee arg count of _.partition. [ci skip] 2016-01-25 00:24:36 -08:00
John-David Dalton
627e92e7e0 Remove empty line in baseInvoke jsdoc. [ci skip] 2016-01-25 00:24:36 -08:00
John-David Dalton
5a9ca34a92 Rename initFromArray and initFromCollection vars to initAccum. 2016-01-25 00:24:36 -08:00
John-David Dalton
880ffcb1f6 Add more fp tests for key methods. 2016-01-25 00:24:36 -08:00
John-David Dalton
4e35d970af Avoid setting ary twice. 2016-01-25 00:24:36 -08:00
John-David Dalton
42a4e09f91 Minor capitalization nit in readme. [ci skip] 2016-01-25 00:24:36 -08:00
John-David Dalton
b13b17e801 Ensure fp key methods provide the key argument to their iteratees. [closes #1842] 2016-01-25 00:24:36 -08:00
John-David Dalton
68d0238044 Remove omitBy and pickBy from funcMethods. 2016-01-25 00:24:35 -08:00
John-David Dalton
82b4f4147e Add fp customizer test for _.setWith. 2016-01-25 00:24:35 -08:00
John-David Dalton
6cbd2c4188 Ensure _.concat treats nullish values as empty arrays. 2016-01-25 00:24:35 -08:00
John-David Dalton
78982f3074 Ensure _.concat returns an empty array for nullish array values. [closes #1856] 2016-01-25 00:24:35 -08:00
John-David Dalton
345746f7ab Add another test to help catch incorrect fp mapping. 2016-01-25 00:24:35 -08:00
John-David Dalton
741a7b9caa Remove mean from fp aryMethod map. 2016-01-25 00:24:35 -08:00
John-David Dalton
7544c8fac8 Add propOr fp alias. 2016-01-25 00:24:35 -08:00
John-David Dalton
a46169329d Fix fp test fails. 2016-01-25 00:24:35 -08:00
John-David Dalton
9aa56630ab Ensure _.noConflict only restores _ if lodash is the current _ value. 2016-01-25 00:24:35 -08:00
Billy Janitsch
01819e7a5a Disable fp concat rearg. 2016-01-25 00:24:34 -08:00
Billy Janitsch
bae497ec5a Update fp property and get aliases. 2016-01-25 00:24:34 -08:00
John-David Dalton
68e0c78602 Remove baseClone use from mergeDefaults. 2016-01-25 00:24:34 -08:00
John-David Dalton
6296afd279 Ensure _.words treats all-lower and all-upper postfixs as separate words. 2016-01-25 00:24:34 -08:00
John-David Dalton
6d58fe912d Ensure _.words captures all caped words. [closes #1833] 2016-01-25 00:24:34 -08:00
Nacho Martín
0c45957096 Fix iteratee arg count in _.partition docs. [ci skip]
If I am not mistaken, the docs for `partition` are wrong. It is only invoked with an argument, not three. See this fiddle https://jsfiddle.net/y8fcwa6m/
2016-01-25 00:24:34 -08:00
John-David Dalton
aa311bd792 Move unset to aryMethod[2] mapping. 2016-01-25 00:24:34 -08:00
John-David Dalton
8858cdbe8c Move position of _.keyBy doc example. [ci skip] 2016-01-25 00:24:34 -08:00
John-David Dalton
9d033247e9 Correct arg count in _.isEqualWit doc note. [ci skip] 2016-01-25 00:24:34 -08:00
Benjamin Tan
cacae31af3 Minor documentation fixes for stringSize, _.cond, _.intersection, and _.reverse. [ci skip] 2016-01-25 00:24:33 -08:00
John-David Dalton
759a44e2b8 Move omitBy and pickBy to aryMethod[2] mapping. [closes #1819] 2016-01-25 00:24:33 -08:00
think2011
2fb778413b Fix returns tag typo in _.toLength docs. [ci skip] 2016-01-25 00:24:33 -08:00
Ismaël Mejía
473d059efd Fix _.map doc example. [ci skip] 2016-01-25 00:24:33 -08:00
John-David Dalton
67cd43d97a Reduce description mentions of eachFunc. [ci skip] 2016-01-25 00:24:33 -08:00
John-David Dalton
b77248c975 Minor cleanup of contributing.md. [ci skip] 2016-01-25 00:24:33 -08:00
John-David Dalton
6bc58a16f6 Remove conditional exposure. 2016-01-25 00:24:33 -08:00
John-David Dalton
0edbd96bb5 Ensure mixinPrereqs is called before Backbone is loaded. 2016-01-25 00:24:33 -08:00
John-David Dalton
6ecc675670 Ensure Backbone test only adds missing methods. 2016-01-25 00:24:33 -08:00
John-David Dalton
c0a6f051fc Move getFuncName test. 2016-01-25 00:24:33 -08:00
John-David Dalton
6bc0aba800 Avoid chatty console.log. 2016-01-25 00:24:32 -08:00
Steven Sojka
6949f71516 Ensure getFuncName works when checking methods that shadow Object.prototype. 2016-01-25 00:24:32 -08:00
John-David Dalton
f6c6de40f1 Update fp mapping with a test to catch potentially missed wrappers. 2016-01-25 00:24:32 -08:00
John-David Dalton
fdea9a447f Revert_Symbol rename. 2016-01-25 00:24:32 -08:00
John-David Dalton
2e02636fc1 Revert lodash path in test/index.html. 2016-01-25 00:24:32 -08:00
John-David Dalton
17b9646c0b Add test warning about the lodash dependency. 2016-01-25 00:24:32 -08:00
John-David Dalton
0a3d7e7cbc Revert lodash dev dep bump. 2016-01-25 00:24:32 -08:00
John-David Dalton
a62d70e80c Add jsdoc name tag for flatMap. [closes #1811] 2016-01-25 00:24:32 -08:00
John-David Dalton
96bbf74207 Add has and hasIn to fp mapping. [closes #1805] 2016-01-25 00:24:32 -08:00
John-David Dalton
6cfe7fa5ea Move forEach and friends to the non-chaining section of the lodash doc note. [ci skip] 2016-01-25 00:24:32 -08:00
John-David Dalton
efc61ea70d Correct arg count typo in _.cloneWith docs. [ci skip] 2016-01-25 00:24:32 -08:00
John-David Dalton
e752b26f9e Clarify max size of _.sampleSize. [ci skp] [closes #1802] 2016-01-25 00:24:31 -08:00
Jeroen Engels
6b19ca1c11 Update contributing.md about how to launch tests. [ci skip] 2016-01-25 00:24:31 -08:00
John-David Dalton
42e01fd37b Add fp tests to npm test. 2016-01-25 00:24:31 -08:00
John-David Dalton
1df18a3e10 Make _.omitBy and _.pickBy pass a key param to iteratees. 2016-01-25 00:24:31 -08:00
John-David Dalton
f31fb8bd34 Add _.isEqual test for unordered object comparisons. 2016-01-25 00:24:31 -08:00
John-David Dalton
1d54d868e3 Fix merging functions and avoid augmenting sources. [closes #1794, #1801] 2016-01-25 00:24:31 -08:00
John-David Dalton
4b801f423b Update fp mapping to include uniqWith. [closes #1800] 2016-01-25 00:24:31 -08:00
John-David Dalton
96ef2110ce Add support for combining diacritical marks for symbols. 2016-01-25 00:24:31 -08:00
Beau Gunderson
84763cab26 Add failing test for Fitzpatrick modifiers. 2016-01-25 00:24:30 -08:00
Beau Gunderson
fc2ce9a021 Add test fails for keycap emoji (#1796). 2016-01-25 00:24:30 -08:00
John-David Dalton
a5c1421c6b Ensure _.fromPairs can consume results of _.toPairs. [closes #1790] 2016-01-25 00:24:30 -08:00
John-David Dalton
1a54e43a24 Add chunk to fp mapping. 2016-01-25 00:24:30 -08:00
John-David Dalton
1ab5a20784 Fix phantomjs test fails. 2016-01-25 00:24:30 -08:00
John-David Dalton
1634388534 Update fallback lodash module path. 2016-01-25 00:24:30 -08:00
Alon Niv
455afb0019 Fix ES5 parseInt link. [ci skip] 2016-01-14 07:46:29 -08:00
John-David Dalton
349dfbf182 Ensure core build slice has default start and end params. [closes #1789] 2016-01-14 01:34:34 -08:00
John-David Dalton
b081b3ae2d Cleanup intentation in baseIsMatch. 2016-01-13 23:09:46 -08:00
John-David Dalton
110f86f803 Fix lodash doc ticks. [ci skip] [closes #1787] 2016-01-13 23:08:56 -08:00
John-David Dalton
ace771d4e9 Add matches to core build. [closes #1784] 2016-01-13 22:41:48 -08:00
John-David Dalton
7544166d11 Add placeholders to fp wrapper. [closes #1780] 2016-01-13 22:07:50 -08:00
mori_9tarou
ff5f06b9f0 Fix _.pullAll doc example typo. [ci skip] 2016-01-13 22:07:12 -08:00
John-David Dalton
06395f8436 Simplify fp map. 2016-01-13 22:03:41 -08:00
John-David Dalton
fe3d86bf13 Ensure _.defaultsDeep doesn't convert function properties to objects. [closes #1783] 2016-01-13 21:20:05 -08:00
John-David Dalton
f92dc95c58 Add fp mapping for _.gt, _.gte, _.lt, and _.lte. [closes #1776] 2016-01-13 14:44:52 -08:00
John-David Dalton
9058c00cfe Add isEqual to fp mapping. [closes #1764] 2016-01-13 08:11:58 -08:00
think2011
8b6bd8442e Fix _.isMatchWith doc typo. [ci skip] 2016-01-13 08:11:37 -08:00
Strider
1ef22e976d Fix _.clone/_.cloneDeep doc typo. [ci skip] 2016-01-13 08:10:23 -08:00
Abhas Tandon
d0d86aecf8 Fix _.maxBy/_.minBy doc example. [ci skip] 2016-01-13 08:08:57 -08:00
John-David Dalton
1ef4807a8e Ensure object are compared unordered. [closes #1758] 2016-01-13 03:56:55 -08:00
John-David Dalton
846e813c99 Ensure each and eachRight have the correct chain behavior. 2016-01-13 03:45:15 -08:00
John-David Dalton
73405cf042 Update fp property alias mapping. [closes #1755] 2016-01-13 00:09:29 -08:00
John-David Dalton
79c873f3f8 Update fp map for assignment methods and set methods. [closes #1754] 2016-01-13 00:06:59 -08:00
greenkeeperio-bot
0fc6929dd4 Update lodash dev dep. 2016-01-13 00:06:59 -08:00
John-David Dalton
753a32bed7 Remove legacy doc note from _.range. [closes #1753] [ci skip] 2016-01-13 00:06:59 -08:00
John-David Dalton
027c572758 Add replace to fp map. 2016-01-13 00:06:59 -08:00
John-David Dalton
afb7d3e351 Add split to fp map. [closes #1752] 2016-01-13 00:06:59 -08:00
John-David Dalton
a5c3ae0a7e Remove run from jsdoc alias tag. [ci skip] 2016-01-13 00:06:59 -08:00
John-David Dalton
9477e46fb3 Fix typos in lodash doc note. [ci skip] 2016-01-13 00:06:58 -08:00
John-David Dalton
bf06df4475 Bump to v4.0.0. 2016-01-13 00:06:58 -08:00
John-David Dalton
e775a58496 Rebuild lodash and docs. 2016-01-13 00:06:58 -08:00
John-David Dalton
ad15e47d4d Update dev deps. 2016-01-13 00:06:58 -08:00
John-David Dalton
45f7a91780 Update fp modules. 2016-01-13 00:06:47 -08:00
John-David Dalton
b1401d03a1 Update fp/util module paths. 2016-01-12 08:00:35 -08:00
John-David Dalton
8b264e5c11 Add eq to fp mapping. 2016-01-11 23:33:44 -08:00
John-David Dalton
2fb4ec0d5f Rename conj and disj to overEvery and overSome in fp mapping. 2016-01-11 23:33:44 -08:00
John-David Dalton
ddd5318bb0 Change category names of "Utility" to "Util" and "Chain" to "Seq". 2016-01-11 22:55:14 -08:00
John-David Dalton
3d44135df5 Remove run alias. 2016-01-11 21:21:21 -08:00
John-David Dalton
a98fc802fc Cleanup _.maxBy and _.minBy doc example. [ci skip] 2016-01-11 16:14:26 -08:00
John-David Dalton
ed364ecfee Cleanup _.iteratee doc example. [ci skip] 2016-01-11 16:14:26 -08:00
John-David Dalton
434d217bfa Cleanup omit and pick doc examples. [ci skip] 2016-01-11 16:14:26 -08:00
John-David Dalton
2386557b5e Add more _.toArray doc examples. [ci skip] 2016-01-11 16:14:26 -08:00
John-David Dalton
f619a6666a Cleanup clone doc examples. [ci skip] 2016-01-11 16:14:26 -08:00
John-David Dalton
359ef9715e Cleanup resolve doc examples. [ci skip] 2016-01-11 16:14:25 -08:00
John-David Dalton
9211bc6329 Remove toInteger from baseSlice. 2016-01-11 08:17:00 -08:00
John-David Dalton
a26ef1a997 Remove unused variables. 2016-01-10 15:35:44 -08:00
John-David Dalton
c9f53b9a1c Remove .sauce.yml. 2016-01-10 13:44:54 -08:00
John-David Dalton
f9a3e66716 Update _.unzipWith and _.zipWith iteratee docs. [ci skip] 2016-01-10 12:38:02 -08:00
John-David Dalton
e5464fa199 Change "callback shorthand" to "iteratee shorthand". [ci skip] 2016-01-10 12:37:40 -08:00
John-David Dalton
9dc2f1ee29 Fix test for es build. 2016-01-09 13:56:56 -08:00
John-David Dalton
b27143aa15 Add missing bizarro labels. 2016-01-09 01:24:56 -08:00
John-David Dalton
07c38311ca Add _.clone test for objects without a constructor function. 2016-01-09 01:17:23 -08:00
John-David Dalton
4a0415a6bd Increase test coverage of symbols. 2016-01-09 01:17:16 -08:00
John-David Dalton
5d97cdbcfe Minor formatting nit. 2016-01-09 01:02:47 -08:00
John-David Dalton
7cce658fc4 Leak to avoid sporadic noglobals fails on Edge in Sauce Labs. 2016-01-08 23:46:48 -08:00
John-David Dalton
84879453b1 Add _.cond test for provided arguments. 2016-01-08 23:01:07 -08:00
John-David Dalton
9cc79db819 Add _.toLength test for -0. 2016-01-08 21:35:16 -08:00
John-David Dalton
17a1663513 Add default wait test for _.delay. 2016-01-08 21:35:16 -08:00
John-David Dalton
11538ccf90 Cleanup test labels. [ci skip] 2016-01-08 21:35:16 -08:00
John-David Dalton
5c51b1c4d1 Simplify baseInRange and baseRange description. [ci skip] 2016-01-08 21:35:16 -08:00
John-David Dalton
5a13fe28c9 Rename _.random params start and end to lower and upper. 2016-01-08 21:35:10 -08:00
John-David Dalton
946560c998 Add baseClamp. 2016-01-08 20:11:59 -08:00
John-David Dalton
7c5e032853 Simplify isNumber. 2016-01-08 11:47:17 -08:00
John-David Dalton
54ae91b2d9 Use freeParseFloat and freeParseInt. 2016-01-08 08:34:37 -08:00
John-David Dalton
8bd8aa3037 Assign methods should create an object when object is nullish. 2016-01-07 21:53:35 -08:00
John-David Dalton
6fa9490a13 Ensure uglify options are set correctly. 2016-01-07 21:20:22 -08:00
John-David Dalton
5dc48d1a83 Sync uglify options with lodash-cli. 2016-01-07 21:20:03 -08:00
John-David Dalton
9e56a92c8a Drop Node 0.8 testing. 2016-01-07 20:41:19 -08:00
John-David Dalton
ac98d81b85 Update deps. 2016-01-07 20:41:19 -08:00
John-David Dalton
05e80e32f7 Simplify trim methods. 2016-01-07 20:41:18 -08:00
John-David Dalton
7435058859 Rename Symbol var to _Symbol to avoid problems with Babel v6.4.0. 2016-01-07 20:41:18 -08:00
John-David Dalton
81b1d6e451 Change arguments passed to _.zipWith and _.unzipWith. 2016-01-07 20:41:18 -08:00
John-David Dalton
52754415e0 Remove support for flattening arrays with circular references. 2016-01-07 20:41:18 -08:00
John-David Dalton
d51d67a5c2 Add sauce.yml. 2016-01-07 20:40:57 -08:00
John-David Dalton
c62fbd811b Enable equalArrays and equalObjects to exit early before checking the stack. 2016-01-05 08:23:08 -08:00
John-David Dalton
1df780abba Add comment to createRange to avoid refactoring the way start is resolved. [ci skip] 2016-01-05 08:11:02 -08:00
John-David Dalton
150511b263 Add createRange. 2016-01-05 07:59:28 -08:00
John-David Dalton
7fefa954c8 Add baseInRange. 2016-01-05 07:40:57 -08:00
Christopher Hiller
030472cee4 Remove references to Bower, Component, and Volo. [ci skip] 2016-01-05 07:34:13 -08:00
John-David Dalton
00c0dc233e Move toNumber use out of baseRange. 2016-01-05 07:31:47 -08:00
greenkeeperio-bot
1013bccb9c Update async and platform dev deps. 2016-01-04 09:19:01 -06:00
John-David Dalton
0911e77c32 Fix _.transform test fail due to _.cloneDeep behavior change. 2016-01-04 09:18:32 -06:00
John-David Dalton
4cdd33b2aa Update tested browsers in sauce. 2016-01-04 09:18:32 -06:00
John-David Dalton
638f081390 Fix fp test fails due to _.cloneDeep behavior change. 2016-01-04 09:18:32 -06:00
John-David Dalton
21f28bfd0d Add missing semicolon. 2016-01-04 09:18:32 -06:00
John-David Dalton
941745cd06 Add _.cond test for this binding. 2016-01-04 09:18:32 -06:00
John-David Dalton
8bf6bcb8a7 Cleanup this binding tests. 2016-01-04 09:18:32 -06:00
John-David Dalton
e7b8fd8281 Add basic _.cond test and test for undefined return values. 2016-01-04 09:18:31 -06:00
John-David Dalton
b1ba01e85a Simplify _.once test. 2016-01-04 09:18:31 -06:00
John-David Dalton
a74c71e423 Add constant function helpers. 2016-01-04 09:18:31 -06:00
John-David Dalton
dba1bcf973 Simplify [[Prototype]] test labels. 2016-01-04 09:18:31 -06:00
John-David Dalton
ed3f8cc39d Add support for creating clones with the same [[Prototype]] as value. 2016-01-04 09:18:31 -06:00
John-David Dalton
f39fdc42f6 Remove legacy options param signature from _.template. 2016-01-04 09:18:31 -06:00
John-David Dalton
9ef191db33 Cleanup _.template tests. 2016-01-04 09:18:31 -06:00
John-David Dalton
9582f25835 Simplify source test labels. 2016-01-04 09:18:31 -06:00
John-David Dalton
4463975ace Add _.templateSettings.imports._.templateSettings tests. 2016-01-04 09:18:31 -06:00
John-David Dalton
33cf509822 Add _.cond test for shorthands. 2016-01-04 09:18:30 -06:00
John-David Dalton
34f44e8f25 Add parentheses to tests. 2016-01-03 10:08:10 -06:00
John-David Dalton
7fb738ab91 Add _.cond test for function checks. 2016-01-03 10:07:48 -06:00
John-David Dalton
973e0812ad Add TypeError check for methods that reject falsey params. 2016-01-02 13:53:30 -06:00
John-David Dalton
cd8218541a Tweak truthy test for memoize resolve. 2016-01-02 13:49:04 -06:00
John-David Dalton
2316dff1e0 Use lodashStable in more places. 2016-01-02 13:48:12 -06:00
John-David Dalton
15ce24db25 Add _.isSymbol tests. 2016-01-02 12:30:13 -06:00
John-David Dalton
b0e0a20e96 Fix realm assignments. 2016-01-02 11:41:18 -06:00
John-David Dalton
849f8e77ec Ensure _.toString does not throw on symbols. 2016-01-02 11:41:11 -06:00
John-David Dalton
f7c7dee8b0 Add _.isSymbol. 2016-01-02 11:04:41 -06:00
John-David Dalton
167fad9649 Cleanup doc note on lazy evaluation. [ci skip] 2016-01-02 10:32:36 -06:00
John-David Dalton
9d3a298895 Cleanup symbol tests. 2016-01-02 10:32:35 -06:00
John-David Dalton
19b5ef7c6f Cleanup _.transform realm test. 2016-01-02 10:32:35 -06:00
John-David Dalton
9b09caa463 Add symbol tests for isType methods. 2016-01-02 10:32:35 -06:00
John-David Dalton
f08b6e2690 Add _.cond doc example. [ci skip] 2016-01-02 10:32:26 -06:00
John-David Dalton
fa13cb5544 Add getIteratee to _.cond. 2016-01-01 23:50:13 -06:00
John-David Dalton
1427c99169 Add _.cond. 2016-01-01 23:18:40 -06:00
John-David Dalton
3e155bdbb9 Move _.bindAll to the utility category. 2016-01-01 16:18:02 -06:00
John-David Dalton
f830612f17 Update tab/spacing rules for html files. 2016-01-01 14:49:47 -06:00
John-David Dalton
3b86574b4d Remove bower.json. 2016-01-01 12:09:06 -06:00
John-David Dalton
30d9cb9a4a Move flow and flowRight to checkFuncs. 2016-01-01 11:15:54 -06:00
John-David Dalton
cfe05b7d34 Bump copyright year. [ci skip] 2016-01-01 10:04:36 -06:00
John-David Dalton
60a016ae39 Remove Rhino mention from comment. [ci skip] 2015-12-31 20:54:47 -06:00
John-David Dalton
6229e02806 Excuse root._ export from coverage. 2015-12-30 17:18:03 -06:00
John-David Dalton
5202294ae2 Add more excused coverage gaps. 2015-12-30 14:50:16 -06:00
John-David Dalton
5bc50c2ef0 Simplify CommonJS UMD. 2015-12-30 14:50:03 -06:00
John-David Dalton
22b0b942ae Simplify assocSet pattern. 2015-12-29 22:18:12 -06:00
John-David Dalton
41f86399f0 Remove coverage check for break in createBaseEach. 2015-12-29 22:15:13 -06:00
John-David Dalton
bc7f2af2ce Add _.orderBy test for string objects. 2015-12-29 21:26:00 -06:00
John-David Dalton
db04398e49 Add support for removing the last capture group. 2015-12-29 09:15:01 -06:00
John-David Dalton
56929e9725 Use == for the 'desc' check in compareMultiple. 2015-12-29 08:52:50 -06:00
John-David Dalton
6798259b84 Use eq in assignInDefaults. 2015-12-29 01:29:18 -06:00
John-David Dalton
20906c7bf7 Update vendors. 2015-12-29 00:25:14 -06:00
John-David Dalton
560ddac75a Simplify Stack test. 2015-12-28 22:33:45 -06:00
John-David Dalton
daecf5cf01 Simplify setProperty. 2015-12-28 22:33:40 -06:00
John-David Dalton
505f8d5cda Fix phantomjs test fails. 2015-12-28 21:54:50 -06:00
John-David Dalton
1d7fd0638d Add more Stack tests. 2015-12-28 20:34:44 -06:00
John-David Dalton
67ca691334 Use eq in assocIndexOf. 2015-12-28 20:34:32 -06:00
John-David Dalton
85da55d917 Add Stack#clear. 2015-12-28 20:34:17 -06:00
John-David Dalton
ee8567ab38 Cleanup MapCache tests. 2015-12-28 20:33:39 -06:00
John-David Dalton
4ca2740628 Add _.transform test to check that object constructor is a function before using its [[Prototype]]. 2015-12-28 16:40:29 -06:00
John-David Dalton
23e6302329 Cleanup tests. 2015-12-28 16:28:05 -06:00
John-David Dalton
95c6dd8992 Add tests for MapCache values. 2015-12-28 15:18:45 -06:00
John-David Dalton
a5b733998d Remove "Opera" from test labels. 2015-12-28 14:54:01 -06:00
John-David Dalton
68b7749a0f Add more MapCache tests. 2015-12-28 14:53:13 -06:00
John-David Dalton
fb37e0767a Add tests for skipping value assignments. 2015-12-28 13:16:05 -06:00
John-David Dalton
43469b9877 Simplify Object.defineProperty use. 2015-12-28 13:15:43 -06:00
John-David Dalton
5a53215506 Rename assignSymbols to copySymbols and implement by way of copyObject. 2015-12-28 11:36:53 -06:00
John-David Dalton
51ce9edcf3 Rearrange _.has and _.hasIn tests. 2015-12-28 11:12:14 -06:00
John-David Dalton
18481a40b2 Add _.has and _.hasIn tests for arguments objects and strings. 2015-12-28 11:11:20 -06:00
John-David Dalton
24c0221ec5 Expand common case check in mergeData. 2015-12-28 10:37:49 -06:00
John-David Dalton
0f928233ce Add _.ary test case for multiple applied arys. 2015-12-28 10:11:17 -06:00
John-David Dalton
e5730af949 Add _.zipObject test for extra keys. 2015-12-28 00:08:26 -06:00
John-David Dalton
ed23b6b89d Rearrange tests for consistency. 2015-12-27 23:59:04 -06:00
John-David Dalton
28420ac1fc Add _.conforms test for missing object properties. 2015-12-27 23:58:51 -06:00
John-David Dalton
6da255f786 Add more MapCache tests. 2015-12-27 23:29:15 -06:00
John-David Dalton
2396932846 Remove dead code from stringToArray. 2015-12-27 23:10:59 -06:00
John-David Dalton
89b9f46ad8 Increase coverage of _.random, _.template, and _.truncate. 2015-12-27 20:23:01 -06:00
John-David Dalton
7dd0bb5005 Use 'utf8', which Node uses, instead of 'utf-8'. 2015-12-27 18:41:21 -06:00
John-David Dalton
44ecbc944b Move _#reverse tests into _.reverse tests. 2015-12-27 18:40:37 -06:00
John-David Dalton
223460bbd2 Remove unneeded assertion from a _.xor chaining test. 2015-12-27 16:22:12 -06:00
John-David Dalton
1a0a9709f2 Add tests for chaining _.invokeMap. 2015-12-27 16:21:21 -06:00
John-David Dalton
a16c282f99 Add more test coverage to _.add, _.subtract, and _.transform. 2015-12-27 15:08:48 -06:00
John-David Dalton
aeac5b0203 Increase code coverage of partial lines. 2015-12-27 14:41:57 -06:00
John-David Dalton
afdc4b746a Remove dead code in createRecurryWrapper. 2015-12-27 14:41:34 -06:00
John-David Dalton
6c84ccd5c5 Remove dead code from baseIntersection and cloneSymbol. 2015-12-27 13:27:47 -06:00
John-David Dalton
916bfed84b Add bizarro tests for Object.getOwnPropertySymbols. 2015-12-27 11:19:36 -06:00
John-David Dalton
35bb3ac128 Remove dead code from baseClone. 2015-12-27 11:19:36 -06:00
John-David Dalton
4f1c3887f7 Remove 'utf-8' option because it's the default. 2015-12-27 11:19:30 -06:00
John-David Dalton
ce19067cfd Cleanup PATTERN use in travis.yml. 2015-12-27 10:10:05 -06:00
John-David Dalton
00f4ebe6aa Remove legacy filePath resolving code. 2015-12-27 00:12:06 -06:00
John-David Dalton
5add1cfd25 Add test/remove.js to remove snippets while preserving new lines. 2015-12-27 00:06:15 -06:00
John-David Dalton
c67092d72b Report coverage from lodash.js instead of dist/lodash.js. 2015-12-26 22:15:50 -06:00
John-David Dalton
4bb5402cca Try codecov. 2015-12-26 22:08:38 -06:00
John-David Dalton
837acf1394 Add "use strict" directive to strict mode test. 2015-12-26 22:08:24 -06:00
John-David Dalton
0d8779734d Cleanup comment. [ci skip] 2015-12-26 22:07:15 -06:00
John-David Dalton
d8213454c2 Use assignValue in assignSymbols. 2015-12-26 21:31:26 -06:00
John-David Dalton
e05c8677bf Search for srcValue in stack before objValue. 2015-12-26 21:31:02 -06:00
John-David Dalton
a5b9063088 Use objValue instead of oldValue. 2015-12-26 21:26:36 -06:00
John-David Dalton
83ea7ac136 Make eq comparisons new value vs. old value. 2015-12-26 21:24:45 -06:00
John-David Dalton
f3075d685e Only copy symbols on objects and nested objects. 2015-12-26 19:24:59 -06:00
John-David Dalton
a811476c1b Add tests for cloning properties that shadow those on Object.prototype. 2015-12-26 12:26:49 -06:00
John-David Dalton
64fe626fa6 Simplify supported comparision doc notes for _.isMatch, _.matches, and _.matchesProperty. [ci skip] 2015-12-26 11:04:17 -06:00
John-David Dalton
f8236c711f Use eq in more places. 2015-12-25 22:01:52 -06:00
Benjamin Tan
b1f6bc72f4 Fix minor doc typo in _.chunk. [ci skip] 2015-12-25 22:01:51 -06:00
John-David Dalton
300dee34bd Test cloning date objects. 2015-12-25 22:01:51 -06:00
John-David Dalton
1eaa112f7d Add tests for cloning symbol properties. 2015-12-25 22:01:51 -06:00
John-David Dalton
8228376160 Use assignValue in baseClone to avoid strict mode errors. 2015-12-25 22:01:45 -06:00
John-David Dalton
a58cd65db8 Add support for cloning symbol properties to _.clone and _.cloneDeep. 2015-12-24 13:35:15 -06:00
John-David Dalton
2df689524e Simplify _.times doc example. [ci skip] 2015-12-24 00:16:25 -06:00
John-David Dalton
a20ad60f13 Add "requireEarlyReturn" rule. 2015-12-23 18:36:13 -06:00
John-David Dalton
1c781389d2 Add support for comparing array buffers to _.isEqual. 2015-12-23 18:18:12 -06:00
flyyang
5e639d1704 Fix doc and test label typos. [ci skip] 2015-12-23 09:22:41 -06:00
John-David Dalton
8e64432e2c Add docs to clarify what values are supported by _.clone and _.isEqual. [ci skip] 2015-12-23 00:56:41 -06:00
John-David Dalton
a8de2ca410 Indent nit. [ci skip] 2015-12-23 00:54:59 -06:00
John-David Dalton
6343518bca Simplify instanbul invocation in travis.yml. 2015-12-22 23:27:16 -06:00
John-David Dalton
351e259174 Add coverage to the .gitignore. 2015-12-22 18:17:07 -06:00
greenkeeperio-bot
1d77e29c3c Update dev deps. 2015-12-22 18:16:45 -06:00
John-David Dalton
eba9b3d22a Avoid test fail in Edge. 2015-12-22 01:22:09 -06:00
John-David Dalton
844fe1d979 Make var name changes for consistency. 2015-12-22 01:04:26 -06:00
John-David Dalton
0971a7820f Add support for symbols to _.clone, _.cloneDeep, and _.isEqual. 2015-12-22 01:04:26 -06:00
John-David Dalton
06c6f180dc Simplify test descriptions. 2015-12-22 01:04:26 -06:00
John-David Dalton
33da30266c Ensure min and max of _.random are swapped if min > max. 2015-12-22 01:04:19 -06:00
John-David Dalton
ad8628f8e7 Avoid isIterateeCall check if step is a number. 2015-12-20 14:03:04 -06:00
John-David Dalton
f42446d22f Avoid isIterateeCall check if floating is a boolean. 2015-12-20 12:39:00 -06:00
John-David Dalton
4b77b7a8b3 Make _.add, _.subtract, and _.sum not skip NaN values. 2015-12-19 10:37:49 -06:00
John-David Dalton
9e99a57615 Make "asc" the default order of _.orderBy. 2015-12-18 23:32:43 -06:00
John-David Dalton
7e648741ad Remove unneeded _.memoize.Cache test. 2015-12-17 20:43:56 -08:00
John-David Dalton
b1d396bbbb Cleanup mapClear. 2015-12-17 20:43:32 -08:00
Aaron Hamid
380435d020 Add clear method to MapCache. 2015-12-17 20:01:17 -08:00
John-David Dalton
71fb66dc37 Rename _.sortByOrder to _.orderBy. 2015-12-16 20:14:52 -08:00
John-David Dalton
a53280f047 Remove volo from package.json. 2015-12-16 17:56:35 -08:00
John-David Dalton
ccfb968b8a Clarify arity param of _.curry. [ci skip] 2015-12-16 01:15:43 -08:00
John-David Dalton
db731e0c91 Cleanup fp mapping and tests. 2015-12-15 22:25:52 -08:00
Benjamin Tan
a4b86f8368 Limit sample to one argument. 2015-12-15 22:25:52 -08:00
Benjamin Tan
44c697908b Ensure curryN, curryRightN, curryRight, and sampleSize are defined. 2015-12-15 22:25:35 -08:00
John-David Dalton
e3c79bd24a Refine Object.prototype check in _.defaults. 2015-12-15 21:04:39 -08:00
John-David Dalton
fb1ed531e4 Cleanup param docs. [ci skip] 2015-12-15 20:55:44 -08:00
John-David Dalton
a6cb6d26a4 Add _.split test for limit. 2015-12-15 20:37:43 -08:00
John-David Dalton
003a5981d6 Cleanup jQuery doc references. [ci skip] 2015-12-15 00:28:47 -08:00
John-David Dalton
0bf38b826e Update dev deps. 2015-12-14 22:53:40 -08:00
John-David Dalton
4038d12f1b Move replace and split tests from chained to non-chained forms. 2015-12-14 21:44:36 -08:00
John-David Dalton
9d60e28aad Reset args to undefined. 2015-12-14 20:37:44 -08:00
John-David Dalton
ae92aa200f Add fp tests for cherry-picked reduce and reduce iterating an object. 2015-12-14 20:37:05 -08:00
John-David Dalton
4584b857ca Update vendor/underscore. 2015-12-14 11:54:17 -08:00
John-David Dalton
46bdf5d79d Simplify _.reduce and _.reduceRight. 2015-12-14 08:25:28 -08:00
John-David Dalton
83720f457e Remove custom lodash option from perf and test ui. 2015-12-14 08:25:10 -08:00
John-David Dalton
0706af1543 Ensure the fp iteratee wrapper enforces arity for functions with a length of 0. 2015-12-14 08:06:29 -08:00
John-David Dalton
41985d8c1a Ensure reduce and reduceRight use getIteratee for the array path. 2015-12-13 23:29:52 -08:00
John-David Dalton
440eb0876c Dry up lib/fp/base.js 2015-12-12 14:10:45 -08:00
John-David Dalton
ac0a0ea07e Add delete to Map interface note. [ci skip] 2015-12-12 11:03:34 -08:00
John-David Dalton
4a534da00a Use MDN for built-in method references. [ci skip] 2015-12-12 11:03:18 -08:00
John-David Dalton
ff4143b482 Expose _.replace and _.split. 2015-12-12 10:54:11 -08:00
John-David Dalton
f132c0024f Make fp versions of set and setWith immutable. 2015-12-11 01:39:33 -08:00
John-David Dalton
82a1010f64 Fix fp test fail when run from Node. 2015-12-11 01:29:14 -08:00
greenkeeperio-bot
d885a9afd0 Update coveralls to 2.11.6. 2015-12-10 22:40:19 -08:00
John-David Dalton
08568fcc8f Update vendor/backbone and vendor/underscore. 2015-12-10 18:32:57 -08:00
John-David Dalton
2192b7748e Remove test/asset/test-ui.js use from test/fp.html. 2015-12-09 23:36:40 -08:00
John-David Dalton
c96a579291 Simplify _.overArgs. 2015-12-09 01:37:34 -08:00
greenkeeperio-bot
095cf94c45 Update jscs to 2.7.0. 2015-12-09 01:28:10 -08:00
John-David Dalton
f7a49778ea Rename _.modArgs to _.overArgs and remove _.modArgsSet. 2015-12-08 23:23:34 -08:00
John-David Dalton
58b235b435 Fix fp test fails in IE10 and Firefox. 2015-12-07 00:58:03 -08:00
John-David Dalton
a7f1c3c883 Fix test fails in IE11. 2015-12-07 00:37:37 -08:00
John-David Dalton
268d411bb4 Update lodash builds in travis.yml. 2015-12-06 22:48:39 -08:00
John-David Dalton
7cdf708e3c Prevent false minified method name test fail. 2015-12-06 22:13:39 -08:00
John-David Dalton
42c077de02 Make fp tests browser runnable. 2015-12-05 23:44:09 -08:00
John-David Dalton
769f78a2b7 Rename test/test.fp.js to test/test-fp.js. 2015-12-05 22:01:05 -08:00
John-David Dalton
b69ba06db9 Add a doc on path creation for _.set. [ci skip] 2015-12-05 12:55:16 -08:00
John-David Dalton
42d5cc584e Simplify iteration in createBaseFor . 2015-12-05 12:55:15 -08:00
John-David Dalton
f3d54d0975 Add _.rangeRight tests. 2015-12-05 12:55:15 -08:00
John-David Dalton
39192ad388 Shorten flag vars. 2015-12-05 12:55:15 -08:00
John-David Dalton
19500d36c7 Avoid fails in flowRight setup. 2015-12-05 12:55:15 -08:00
John-David Dalton
229f0b48cd Update perf/perf.js to correctly load libs when running from the command line. 2015-12-05 12:55:15 -08:00
John-David Dalton
58736f743e Add rangeRight to fp mapping. 2015-12-05 12:55:10 -08:00
John-David Dalton
dc136cbf31 Remove perf/run-perf.sh. 2015-12-03 18:00:00 -08:00
John-David Dalton
81e39f7c4b Add _.rangeRight docs. [ci skip] 2015-12-03 17:59:46 -08:00
John-David Dalton
1cbb6f1405 Add doc note to _.includes about string values. [ci skip] 2015-12-03 11:54:27 -08:00
John-David Dalton
1ae6e67cdc Add _.rangeRight. 2015-12-03 08:41:55 -08:00
John-David Dalton
3d43cc1029 Use "IE" instead of "Internet Explorer" in comment. [ci skip] 2015-12-01 10:10:29 -08:00
John-David Dalton
230e8d0787 Make build expose fp mapping in the dist. 2015-11-30 20:19:56 -08:00
John-David Dalton
8154e5e521 Fix argument juggling. 2015-11-30 20:18:08 -08:00
greenkeeperio-bot
f4467f6033 Update sauce-tunnel to 2.3.0. 2015-11-30 10:34:46 -08:00
Brian Mock
562b04a763 Update email address in CoC. [ci skip] 2015-11-29 15:18:12 -08:00
John-David Dalton
9bcbcc5293 Ensure _.clone handles generators correctly. 2015-11-29 17:00:45 -06:00
John-David Dalton
fdc15df3b3 Remove rhino testing. 2015-11-29 12:00:53 -06:00
John-David Dalton
e778458f78 Minor style tweak to _.overEvery test. 2015-11-29 00:09:13 -06:00
John-David Dalton
0a55eff5d5 Fix spread test fail. 2015-11-29 00:07:43 -06:00
John-David Dalton
3874b5bf84 Add semicolons. 2015-11-29 00:01:28 -06:00
John-David Dalton
d07343a1aa Use apply in more places. 2015-11-28 23:13:55 -06:00
John-David Dalton
a37c6db377 Use apply in _.invokeMap. 2015-11-28 10:02:42 -06:00
John-David Dalton
1f991a7cdc Rename binaryIndex and binaryIndexBy to baseSortedIndex and baseSortedIndexBy. 2015-11-28 00:42:05 -06:00
John-David Dalton
e99a31c2fa Update call and invocation use. [ci skip] 2015-11-27 20:18:09 -06:00
John-David Dalton
876fe52efc Describe HOT vars a bit more. [ci skip] 2015-11-27 20:16:11 -06:00
John-David Dalton
8f190b1fb1 Update Firefox in test/saucelabs.js. 2015-11-27 18:33:56 -06:00
John-David Dalton
411f3ecb3e Update benchmarks. 2015-11-27 18:33:50 -06:00
John-David Dalton
3d31423eef Remove thisArg param benchmarks. 2015-11-27 16:24:13 -06:00
John-David Dalton
68c0eb5216 Remove java scaffolding from benchmarks. 2015-11-27 16:23:51 -06:00
John-David Dalton
39dae19974 Update vendor/benchmark.js. 2015-11-27 16:19:39 -06:00
John-David Dalton
2dd6f0124e Infer sign of range's step when only start and end are provided. 2015-11-27 01:01:44 -06:00
John-David Dalton
826af968c8 Add baseTrim. 2015-11-26 23:17:44 -06:00
John-David Dalton
70c3d325a0 Infer sign of range's step when only end is provided. 2015-11-26 23:17:30 -06:00
John-David Dalton
6289211910 Update test.fp with over methods. 2015-11-25 12:48:38 -08:00
John-David Dalton
86346291a7 Update fp mapping for invoke. 2015-11-25 12:25:45 -08:00
John-David Dalton
05d57b90a9 Rename _.invokePath to _.invoke. 2015-11-25 12:07:13 -08:00
John-David Dalton
dd64f5eac4 Ensure _.flattenDeep works on arrays with circular references. [closes #1664] 2015-11-25 09:20:05 -08:00
John-David Dalton
e6de183651 Update jsdoc params for stack. [ci skip] 2015-11-25 09:20:05 -08:00
John-David Dalton
7bd986337a Add lazy invokeMap. 2015-11-24 23:20:18 -08:00
John-David Dalton
6dc92df880 Add implicit chaining test for _.invokePath. 2015-11-24 16:22:44 -08:00
John-David Dalton
44abe46da4 Rename _.invoke to _.invokeMap. 2015-11-24 16:22:40 -08:00
greenkeeperio-bot
9e334b5ece Update webpack to 1.12.9 & istanbul to 0.4.1. 2015-11-24 12:02:57 -08:00
John-David Dalton
ee8a248086 Add large array test for _.uniqBy and _.sortedUniqBy. 2015-11-24 12:02:57 -08:00
John-David Dalton
8f1f98b003 Add _.invokePath tests. 2015-11-24 12:02:57 -08:00
John-David Dalton
a6bc1fa316 Avoid set optimization if iteratee is provided to baseUniq. 2015-11-24 00:33:28 -08:00
John-David Dalton
ce6c0f3082 Add array path test for _.zipObject. 2015-11-23 21:48:10 -08:00
John-David Dalton
393849384b Update _.result doc example. [ci skip] 2015-11-23 00:00:49 -08:00
John-David Dalton
618280340f Cleanup function doc descriptions and params. [ci skip] 2015-11-23 00:00:24 -08:00
John-David Dalton
6b77af4e5a Add baseInvokePath. 2015-11-22 23:53:13 -08:00
John-David Dalton
aa8524b8ad Add _.flatMap chain sequence test. 2015-11-22 20:31:02 -08:00
John-David Dalton
87a813566a Expose _.invokePath. 2015-11-21 21:57:54 -08:00
John-David Dalton
73a97d5762 Reword chain sequence to sequence. 2015-11-21 12:20:55 -08:00
John-David Dalton
ce4c6ec755 Add _.flatMap test. 2015-11-21 00:16:23 -08:00
John-David Dalton
21b5139d98 Update fp mapping. 2015-11-21 00:12:23 -08:00
John-David Dalton
7745c91c69 Split _.fromPairs into _.zipObject. 2015-11-21 00:02:08 -08:00
John-David Dalton
bce8f498b4 Update _.map doc note on guarded methods. [ci skip] 2015-11-20 21:58:03 -08:00
John-David Dalton
7eaacc3997 Simplify wrapperReverse docs. [ci skip] 2015-11-20 21:57:40 -08:00
John-David Dalton
c699ff7574 Cleanup wrapperAt. 2015-11-20 21:57:17 -08:00
John-David Dalton
11d8867d7a Add _.flatMap. 2015-11-20 21:56:56 -08:00
greenkeeperio-bot
d4eeb8d186 Update dep packages. 2015-11-20 18:01:06 -08:00
John-David Dalton
a562a20b4e Ensure _.bindKey funcs call object[key] when called with the new operator. 2015-11-20 08:13:58 -08:00
John-David Dalton
3ecf626ad0 Update fp mapping. 2015-11-20 08:13:58 -08:00
John-David Dalton
766c4315e6 Rename _.pairs and _.zipObject to _.toPairs and _.fromPairs. 2015-11-20 08:13:51 -08:00
John-David Dalton
b9f2855034 Rename _.conj, _.disj, and _.juxt to _.overEvery, _.overSome, and _.over. 2015-11-19 08:18:32 -08:00
John-David Dalton
44397f79a6 Rename padLeft, padRight, trimLeft, and trimRight to padStart, padEnd, trimStart, and trimEnd. 2015-11-18 15:52:17 -08:00
John-David Dalton
dcca9b82b1 Add doc note to debounce and throttle about the arguments provided to the invoked func. [ci skip] 2015-11-18 15:52:17 -08:00
John-David Dalton
ecef32a101 Minor travis.yml nit. 2015-11-18 15:52:17 -08:00
John-David Dalton
41d425319c Fix core builds and test them. 2015-11-18 15:52:17 -08:00
John-David Dalton
6a49f227b4 Move sauce enviro var higher in travis.yml. 2015-11-18 15:52:16 -08:00
John-David Dalton
a3ced39b12 Use caret for platform.js dep range. 2015-11-18 15:52:16 -08:00
John-David Dalton
b89045b20f Remove unused case in apply. 2015-11-18 15:52:16 -08:00
John-David Dalton
4e3f3899c4 Add at to the lodash shortcut fusion doc note. [ci skip] 2015-11-18 15:52:16 -08:00
John-David Dalton
a8d865a246 Expose _.join. 2015-11-16 08:13:48 -08:00
John-David Dalton
cad0fbfc4d Ensure _.at works with an out of range index when chaining. 2015-11-15 23:44:46 -08:00
John-David Dalton
45f07d5014 Ensure shortcut fusion works for _.at with no indexes specified. 2015-11-15 23:44:45 -08:00
John-David Dalton
64a7503196 Add lazy at tests to ensure it works with string index values. 2015-11-15 23:44:45 -08:00
John-David Dalton
783c23cbfb Make _.at support shortcut fusion in a chain sequence when operating on an array and selecting a single index. [closes #1636] 2015-11-15 23:44:45 -08:00
John-David Dalton
1c04dfe083 Minor wording nit in test description. [ci skip] 2015-11-15 23:44:45 -08:00
John-David Dalton
59ec97f59f Ensure _.keys and _.keysIn skip "length" keys for strict mode arguments objects in Safari 9. 2015-11-14 13:00:12 -08:00
John-David Dalton
c71d26c7e8 Update lodash paths in test-ui.js and perf-ui.js. 2015-11-14 13:00:12 -08:00
John-David Dalton
88e58aa8f9 Update our CoC. [ci skip] 2015-11-14 13:00:12 -08:00
John-David Dalton
40850f9cda Update core builds. 2015-11-14 13:00:12 -08:00
John-David Dalton
be3afcf668 Ensure correct param order in fp.zip. 2015-11-12 09:56:24 -08:00
John-David Dalton
c1b7679cac Make _.times implicitly end a chain sequence. 2015-11-11 23:37:18 -08:00
John-David Dalton
a370c48d9c Rename wrapper param to wrapFunc. 2015-11-11 23:37:18 -08:00
John-David Dalton
6c0e456a5e Description cleanup for Math methods. [ci skip] 2015-11-11 23:37:18 -08:00
John-David Dalton
ebb993b862 Fix code style nits. 2015-11-10 23:58:50 -08:00
Agus Pina
3408db91b6 Add _.mean. 2015-11-10 23:56:07 -08:00
John-David Dalton
f0e8371997 Simplify function descriptions. [ci skip] 2015-11-10 23:34:53 -08:00
John-David Dalton
55383b9de4 Add apply doc block. [ci skip] 2015-11-10 23:34:20 -08:00
John-David Dalton
5551a8365a Cleanup wrapper functions. 2015-11-10 23:33:27 -08:00
John-David Dalton
87fc16af19 Cleanup createPartialWrapper. 2015-11-10 07:40:16 -08:00
John-David Dalton
80d91b693a Optimize createPartialWrapper. 2015-11-09 23:16:22 -08:00
John-David Dalton
977438309b Remove partials cleanup in createWrapper and move it to bind and bindKey. 2015-11-09 23:15:31 -08:00
John-David Dalton
28b426f19d Move createRecurryWrapper lower in source. 2015-11-09 20:09:30 -08:00
John-David Dalton
d40c5d3de8 Add createSet. 2015-11-09 20:09:25 -08:00
Jason Karns
53702774d0 upport deep paths as keys in _.zipObject. 2015-11-09 08:41:21 -08:00
John-David Dalton
b36e659c56 Avoid a circular dependency in createHybridWrapper. 2015-11-09 07:13:41 -08:00
John-David Dalton
0dcf028592 Split createHybridWrapper into createCurryWrapper and createRecurryWrapper. 2015-11-08 23:22:14 -08:00
John-David Dalton
549918d7f9 Update fp test for zipObject. 2015-11-08 21:04:40 -08:00
John-David Dalton
dcb23f46a4 Add concat to fp mapping. 2015-11-08 21:00:52 -08:00
John-David Dalton
c152ae71e2 Add add and subtract to fp mapping. 2015-11-08 20:56:19 -08:00
John-David Dalton
32cd726bd0 Move _#concat to _.concat. 2015-11-08 20:50:21 -08:00
John-David Dalton
4f104d74ca Rename baseIncludes to arrayIncludes and includesWith to arrayIncludesWith. 2015-11-08 19:43:36 -08:00
John-David Dalton
9c44430975 Rename _.includes param target to value. 2015-11-08 19:42:54 -08:00
John-David Dalton
1309f37a7e Cleanup comparator and iteratee param descriptions. [ci skip] 2015-11-08 19:41:05 -08:00
John-David Dalton
3ed0cc14ea Add subtract to lodash doc block. [ci skip] 2015-11-08 13:35:16 -08:00
John-David Dalton
73a698151f Cleanup _.sortedIndexBy and _.sortedLastIndexBy test. 2015-11-08 12:23:18 -08:00
John-David Dalton
8a3842b788 Ensure _.defaults assigns properties that shadow those on Object.prototype. 2015-11-08 12:16:47 -08:00
John-David Dalton
73d68c9609 Simplify NaN checks in tests. 2015-11-08 12:13:37 -08:00
DARCHY Jeremy
f6d81e1bd8 Add _.subtract. 2015-11-07 22:05:34 -08:00
John-David Dalton
98e607e610 Update ecstatic to 1.2.0, webpack to 1.12.3, & jscs to 2.5.1. 2015-11-06 10:54:22 -08:00
John-David Dalton
a7ec0c2e93 Fix fp alias assignments. 2015-11-05 15:10:28 -06:00
John-David Dalton
0b3e19f56e Use argument in place of parameter for test descriptions. [ci skip] 2015-11-05 15:10:11 -06:00
John-David Dalton
60ac7cfe74 Add conj, disj, and juxt to aryMethodMap. 2015-11-05 15:09:23 -06:00
John-David Dalton
491102f221 Correct arity mapping for _.uniqueId. 2015-11-05 09:09:34 -06:00
Xotic750
9db252e55d Cleanup baseFill. 2015-11-04 23:59:42 -06:00
Xotic750
b9b94609f5 Enhance _.debounce to use toNumber. 2015-11-04 23:19:59 -06:00
Xotic750
fe910d01f6 The_.throttle method uses _.debounce so no coersion of wait required. 2015-11-04 23:13:36 -06:00
Xotic750
ea71539b7a Enhance delay with toNumber to use binary and octal strings. 2015-11-04 14:30:36 -06:00
John-David Dalton
3d9fd1d374 Add fast path for falsey values in _.toInteger, _.toLength, _.toNumber, and _.toSafeInteger. 2015-11-03 07:22:00 -06:00
Xotic750
3eda8e64f3 Enhance createRound by using toNumber to allow binary and octal strings. 2015-11-03 06:22:26 -06:00
Xotic750
ec8ccbcc55 Enhance clamp with toNumber to allow binary and octal strings. 2015-11-03 06:13:10 -06:00
Xotic750
1d58823405 Enhance inRange with toNumber to allow binary and octal strings. 2015-11-03 06:13:10 -06:00
Xotic750
19e0650c4f Enhance random with toNumber to allow binary and octal strings. 2015-11-03 06:13:10 -06:00
Xotic750
f45fc10cb1 Enhance range with toNumber to allow binary and octal strings. 2015-11-03 11:35:33 +01:00
greenkeeperio-bot
42dff0e5fb Update fs-extra to 0.26.2. 2015-11-02 22:03:55 -06:00
John-David Dalton
ee9339e73b Add shortcut fusion heuristic note to lodash docs. [ci skip] 2015-11-02 13:12:44 -06:00
John-David Dalton
611aaa5385 Update doc examples of isInteger, isLength, isNumber, isSafeInteger, toInteger, toLength, toNumber, toSafeInteger, and toString. [ci skip] 2015-11-02 13:12:17 -06:00
Xotic750
e25369a306 Improve documents for _.toString by including examples. [ci skip] 2015-11-02 08:38:15 -08:00
Xotic750
67701944f1 Improve toNumber documentation by including examples. [ci skip] 2015-11-02 08:37:47 -08:00
Xotic750
ecaee16d23 Improve documentation of toLength by including examples. [ci skip] 2015-11-02 08:32:43 -08:00
John-David Dalton
b84c336855 Add _.unary tests. 2015-11-01 17:30:06 -08:00
John-David Dalton
447bafaa5b Add _.differenceWith, _.intersectionWith, _.unionWith, _.uniqWith, and _.xorWith` tests. 2015-11-01 17:15:45 -08:00
John-David Dalton
2f93e0a499 Fix failing test in Node < 0.12. 2015-11-01 15:41:19 -08:00
John-David Dalton
6c2ada9ffc Expose _.unary. 2015-11-01 15:21:50 -08:00
John-David Dalton
982b9d2b0a Use hexadecimal instead of hex for consistency. [ci skip] 2015-11-01 15:01:59 -08:00
John-David Dalton
1fe87d0348 Simplify reIsBinary. 2015-11-01 14:56:55 -08:00
John-David Dalton
8d8d4fa3b1 Use MAX_INTEGER instead of Number.MAX_VALUE. 2015-11-01 14:51:44 -08:00
John-David Dalton
94fb8c6f92 Add toNumber use to _.toInteger. 2015-11-01 14:51:25 -08:00
John-David Dalton
04c7b33f90 Cleanup tests. 2015-11-01 14:03:09 -08:00
John-David Dalton
ae76c3ee71 Cleanup _.toNumber test. 2015-11-01 13:43:38 -08:00
John-David Dalton
7d1e24d07f Update to Node 5 in travis tests. 2015-10-31 14:30:42 -07:00
Xotic750
37955345ef Add _.toNumber. 2015-10-31 14:30:10 -07:00
John-David Dalton
4bc35e9ed4 Remove internal isLength test since it's exposed now. 2015-10-31 12:23:03 -07:00
John-David Dalton
c142cfc81d Add "loosely" qualify to the _.isLength spec note. [ci skip] 2015-10-31 11:01:13 -07:00
John-David Dalton
39a22bf15b Cleanup _.toInteger and max MAX_INTEGER equal to Number.MAX_VALUE. 2015-10-31 10:49:40 -07:00
John-David Dalton
eb636f9538 Cleanup _.toLength tests. 2015-10-31 10:46:48 -07:00
John-David Dalton
8a838633d1 Cleanup lodash, isLength, and toLength docs. [ci skip] 2015-10-31 10:46:32 -07:00
John-David Dalton
963e297c74 Cleanup _.isLengh tests. 2015-10-30 23:01:25 -07:00
John-David Dalton
d95dbf6ba8 Simplify reIsUint. 2015-10-30 22:27:21 -07:00
John-David Dalton
ae032c8523 Cleanup isIndex tests. 2015-10-30 21:57:46 -07:00
Xotic750
2b4a10c159 Expose _.toLength. 2015-10-30 21:41:17 -07:00
Xotic750
c7ef030ef5 Improve reIsUint to filter strings like '0001' and add tests. 2015-10-30 21:41:16 -07:00
Xotic750
7e726735ba Expose _.isLength. 2015-10-30 21:40:53 -07:00
John-David Dalton
3d25b2fd9b Add _.differenceWith, _.intersectionWith, _.unionWith, _.uniqWith, and _.xorWith. 2015-10-30 10:04:10 -07:00
John-David Dalton
96a22aaec0 Make fp convert call noConflict. 2015-10-30 01:01:10 -07:00
greenkeeperio-bot
ccef887f88 Update jscs to 2.5.0. 2015-10-29 11:06:49 -07:00
John-David Dalton
7d9c6527a4 Add and update mutation notes for _.assign and _.assignIn. [ci skip] 2015-10-28 07:43:48 -07:00
John-David Dalton
ef7191dbc1 Move assignIn and assignInWith closer to assign. 2015-10-28 07:40:16 -07:00
John-David Dalton
bc2adb208c Ensure _.toString produces the correct result for Object(-0). 2015-10-28 07:29:20 -07:00
Xotic750
cd371ac66f Preserve sign of 0 in _.toString. 2015-10-28 00:04:15 -07:00
John-David Dalton
9c342eb432 Move _.extend and _.extendWith to alias and add _.assignIn and _.assignInWith. 2015-10-27 16:59:44 -07:00
greenkeeperio-bot
95f5b39aed Update qunitjs to 1.20.0. 2015-10-27 16:35:19 -07:00
John-David Dalton
9ce38cb43c Space nit in test catch block. 2015-10-27 08:37:28 -07:00
John-David Dalton
8b57b3086e Newline nit in _.valuesIn description. [ci skip] 2015-10-27 06:50:38 -07:00
John-David Dalton
3fdec6d25e Add missing comma to baseFind description. [ci skip] 2015-10-27 06:50:37 -07:00
John-David Dalton
557af10067 Add _.functionsIn and _.pairsIn. 2015-10-27 06:50:30 -07:00
John-David Dalton
6b2645b310 Add ramda aliases to fp mapping. 2015-10-27 00:55:01 -07:00
John-David Dalton
c360ee0fa4 Use number values for fp cap mapping. 2015-10-26 21:22:29 -07:00
John-David Dalton
3ac5870530 Run travis in its faster container-based infrastructure. 2015-10-26 15:31:58 -07:00
Xotic750
5218fd2c24 Rename _.trunc to _.truncate. 2015-10-26 15:19:10 -07:00
fdegiuli
accb8e9b07 Fix typo in _.sumBy examples. [ci skip] 2015-10-26 15:18:53 -07:00
greenkeeperio-bot
e331ea5d82 Update async to 1.5.0. 2015-10-25 19:03:25 -07:00
John-David Dalton
ae804b8cc7 Cleanup labels for modified sources tests. 2015-10-25 12:43:28 -07:00
John-David Dalton
66d72345f2 Ensure _.conforms functions return true when comparing an empty source. 2015-10-25 12:42:58 -07:00
John-David Dalton
436d64f881 Update fs-extra to version 0.26.0. 2015-10-25 11:42:19 -07:00
John-David Dalton
c3ec32cc16 Add empty invocation test to string methods test. 2015-10-25 11:42:03 -07:00
John-David Dalton
4b86df4966 Add _.template test for empty strings. 2015-10-25 11:42:03 -07:00
John-David Dalton
9fbf1955f2 Add more _.conforms tests. 2015-10-25 11:42:03 -07:00
John-David Dalton
2008a82017 Add _.conforms test. 2015-10-25 11:42:03 -07:00
John-David Dalton
8c04a00177 Newline nit. 2015-10-25 11:42:02 -07:00
John-David Dalton
8370277352 Move flow tests. 2015-10-25 11:42:02 -07:00
John-David Dalton
89279009d8 Ensure _.defaultsDeep doesn't attempt a merge of a string into an array. [closes #1560] 2015-10-25 11:42:02 -07:00
John-David Dalton
182b29662d Cleanup n to integer tests. 2015-10-24 11:26:50 -07:00
John-David Dalton
8119bcdc61 Add _.nthArg tests. 2015-10-24 11:24:46 -07:00
John-David Dalton
b6d40f75c9 Remove slower ipad run from sauce testing. 2015-10-24 11:11:41 -07:00
John-David Dalton
d9570e8223 Simplify lib/fp/fp.js. 2015-10-24 09:58:01 -07:00
John-David Dalton
3a0fc24a6a Allow _.flow and _.flowRight to accept an array of functions. 2015-10-24 09:08:19 -07:00
John-David Dalton
04879d0fe5 Update fp mapping for nthArg, modArgs, and modArgsSet. 2015-10-24 09:08:11 -07:00
John-David Dalton
0d9b03ced2 Move juxt, flow, and flowRight to the Utility category mapping. 2015-10-24 08:05:27 -07:00
John-David Dalton
7be7acfe30 Add _.nthArg. 2015-10-24 00:38:29 -07:00
John-David Dalton
655f7918ea Add _.conj, _.disj, and _.conforms to the lodash doc block. [ci skip] 2015-10-23 23:52:43 -07:00
John-David Dalton
67e799ccb2 Correct jsdoc param indicators for _.omit and _.pick. [ci skip] 2015-10-23 23:05:22 -07:00
John-David Dalton
4c12319d19 Reclassify _.conj and _.disj to the Utility category. 2015-10-23 23:04:12 -07:00
John-David Dalton
3769719816 Use undefined instead of nullish checks in baseConvert. 2015-10-23 22:13:21 -07:00
John-David Dalton
cc8e4956f5 Clarify docs of _.matches and _.modArgs methods. [ci skip] 2015-10-23 22:12:17 -07:00
John-David Dalton
3ad67c754f Add _.conforms. 2015-10-23 22:08:47 -07:00
John-David Dalton
cabd4198b0 Remove nativeMax and nativeMin use from _.clamp. 2015-10-23 16:25:22 -07:00
John-David Dalton
2bf80673ae Cleanup customizer doc examples. [ci skip] 2015-10-23 16:21:29 -07:00
John-David Dalton
2182e0696d Remove unmatched PATTERN3 in travis.yml. 2015-10-23 10:16:53 -07:00
John-David Dalton
9c44b5c384 Remove commented-out tests from travis.yml. 2015-10-23 10:07:08 -07:00
John-David Dalton
d5f51f2881 Rebuild dist. 2015-10-22 22:58:31 -07:00
John-David Dalton
176e17c45d Cleanup lib/fp/fp.js. 2015-10-22 22:57:33 -07:00
John-David Dalton
7912b08c41 Rename restParam to rest in aryMethodMap. 2015-10-22 22:50:56 -07:00
John-David Dalton
643ffce289 Fix aliasMap typo. 2015-10-22 22:49:56 -07:00
John-David Dalton
0d4d740961 Add fp tests. 2015-10-22 22:49:29 -07:00
John-David Dalton
68473f08d6 Add ./lib files to the jscs style check. 2015-10-22 21:17:59 -07:00
John-David Dalton
6c09a69991 Add clamp to fp mapping. 2015-10-22 21:11:07 -07:00
John-David Dalton
ac16bc0e15 Update build scripts. 2015-10-22 21:06:08 -07:00
John-David Dalton
99287a89eb Update bower.json. 2015-10-22 18:37:01 -07:00
John-David Dalton
e0aaf876c2 Combine _.toInteger and _.toSafeInteger tests. 2015-10-22 17:39:57 -07:00
John-David Dalton
022f79beed Add lodash chaining doc notes for _.clamp and _.toSafeInteger. [ci skip] 2015-10-22 17:35:41 -07:00
John-David Dalton
a6aac88561 Cleanup IEEE-754 doc references. [ci skip] 2015-10-22 17:35:41 -07:00
John-David Dalton
87057095bc Cleanup _.isSafeInteger description. [ci skip] 2015-10-22 17:35:40 -07:00
Xotic750
5afa75ce51 Add _.toSafeInteger. 2015-10-22 17:35:36 -07:00
John-David Dalton
c525598fd9 Add _.clamp test for just passing the max param. 2015-10-22 17:08:45 -07:00
John-David Dalton
f54cfb0ea2 Simplify resolving start in _.range. 2015-10-22 17:08:22 -07:00
John-David Dalton
91fcf837f7 Use strict equality undefined checks instead of nullish param checks in _.random. 2015-10-22 17:07:50 -07:00
John-David Dalton
64e98d897f Update tested browsers in test/saucelabs.js. 2015-10-22 06:24:21 -07:00
John-David Dalton
99a5fcc665 Fix typos in _.clamp test labels. 2015-10-21 22:15:17 -07:00
John-David Dalton
f0c38a6419 Use _.clamp in _.sampleSize, _.endsWith, and _.startsWith. 2015-10-21 22:11:41 -07:00
John-David Dalton
14c2747e80 Make min optional for _.clamp. 2015-10-21 22:10:05 -07:00
John-David Dalton
3ee2a15cde Cleanup test labels for -0. 2015-10-21 22:07:19 -07:00
John-David Dalton
8982578edd Ensure a _.range result can start with -0. 2015-10-21 22:05:29 -07:00
John-David Dalton
5ec6f1085a Ensure _.toInteger can return -0. 2015-10-21 22:04:14 -07:00
John-David Dalton
1513e46605 Use strict undefined comparisons where nullish aren't required. 2015-10-21 20:25:50 -07:00
Xotic750
b95ed73e1d Add _.clamp and tests. 2015-10-21 18:21:36 -07:00
Xotic750
ff22efb3e2 Add doc notes on IEEE 754-2008 and floating-point oddness. [ci skip] 2015-10-21 17:48:21 -07:00
John-David Dalton
35c6db1289 Add flush to debounced methods. 2015-10-21 17:48:01 -07:00
John-David Dalton
602e5d2766 Use 'a' for string tests instead of 'x'. 2015-10-20 22:37:27 -07:00
John-David Dalton
247c4f1068 Add identity helper to tests. 2015-10-20 22:10:33 -07:00
John-David Dalton
bdb5e4642f Add fp files. 2015-10-20 21:43:42 -07:00
John-David Dalton
661e9b08b6 Update jscs to version 2.3.5 and update istanbul to version 0.4.0. 2015-10-19 21:04:17 -07:00
John-David Dalton
fdf6478bc9 Use helper methods from the stable lodash release to test unstable bits. 2015-10-19 20:59:12 -07:00
John-David Dalton
10229cd332 Rename npm script from lint to style. 2015-10-19 20:57:12 -07:00
Kris Borchers
33e2499006 Fix JSCS name typo in CONTRIBUTING.md. 2015-10-19 20:57:12 -07:00
sfinktah
6ae58e74c7 Changed references to _.include to _.includes. 2015-10-16 13:10:44 -04:00
Mathias Bynens
689b292c24 Add _.lowerCase, _.lowerFirst, _.toLower, _.toUpper, _.upperCase, _.upperFirst tests. 2015-10-16 13:10:00 -04:00
John-David Dalton
f6a4ab62b8 Add _.toPath test for consecutive brackets and dots. 2015-10-15 06:08:30 -07:00
John-David Dalton
e197884e07 Add _.upperFirst and _.lowerFirst. 2015-10-15 04:09:01 -07:00
John-David Dalton
ba095d11cc Use an MDN url shortener. [ci skip] 2015-10-14 23:24:41 -07:00
John-David Dalton
e22cb5f3b3 Rename _.first to _.head, _.rest to _.tail, & _.restParam to _.rest. 2015-10-14 17:55:01 -07:00
greenkeeperio-bot
da993ee48d Update requirejs to version 2.1.20 and jscs to version 2.3.1. 2015-10-14 17:25:02 -07:00
John-David Dalton
9458759810 Change n params to number where appropriate. 2015-10-13 22:48:46 -07:00
Tejo Kumar Reddy Chenchu
dd27a0adc7 Fix rounding issue with the precision param of _.floor. 2015-10-13 22:42:36 -07:00
John-David Dalton
3fd276f8a6 Change version to 4.0.0-pre. 2015-10-13 09:43:11 -07:00
John-David Dalton
33f454bb75 Correct the jsdoc @name tag of the chain wrapper Symbol.iterator function. [ci skip] 2015-10-13 06:20:19 -07:00
John-David Dalton
1fd5d501b0 Ensure dummy exports and module are reset. 2015-10-13 00:38:16 -07:00
John-David Dalton
e4220282c8 Add _.conj and _.disj test for early exits. 2015-10-12 23:23:51 -07:00
Miro Mannino
6dec9cb831 Clarify exit early behavior in _.every doc and refine related test. 2015-10-12 23:23:03 -07:00
greenkeeperio-bot
1ad55ec263 Update coveralls to version 2.11.4. 2015-10-12 09:30:20 -07:00
John-David Dalton
96f5dbfccf Add bizarro _.memoize.Cache test. 2015-10-12 06:57:33 -07:00
John-David Dalton
fd2aa1f51c Add docdown dev dep. 2015-10-12 06:57:33 -07:00
John-David Dalton
74137d4eab Fix _.differenceBy doc example. [ci skip] 2015-10-12 06:57:33 -07:00
John-David Dalton
02398e319d Update lodash chaining doc notes. [ci skip] 2015-10-12 06:57:27 -07:00
John-David Dalton
32d6a04107 Use array.pop() instead of array.length-- in _.zipWith. 2015-10-11 23:31:04 -07:00
John-David Dalton
6bff374e91 Ensure _.intersectionBy doesn't treat iteratee as an empty array. 2015-10-11 23:31:04 -07:00
John-David Dalton
18b5cb24c2 Ensure baseIntersection doesn't transform array. 2015-10-11 23:31:04 -07:00
John-David Dalton
04e8ca771b Add _.differenceBy, _.intersectionBy, _.pullAllBy, _.unionBy, and _.xorBy tests. 2015-10-11 23:31:04 -07:00
John-David Dalton
174f771612 Add _.reverse test. 2015-10-11 21:34:50 -07:00
John-David Dalton
4f0a5e937b Add _.juxt tests. 2015-10-11 21:22:50 -07:00
John-David Dalton
505f02fd72 Expose _.reverse. 2015-10-11 17:05:25 -07:00
John-David Dalton
a6c7ffd664 Update istanbul to version 0.3.22 and request to version 2.65.0. 2015-10-11 17:03:55 -07:00
John-David Dalton
a08d52eb48 Ensure _.defaultsDeep doesn't modify sources. 2015-10-11 01:39:30 -07:00
John-David Dalton
414ad602f2 Add more tests for _.differenceBy, _.intersectionBy, _.unionBy, and _.xorBy. 2015-10-10 17:50:05 -07:00
greenkeeperio-bot
e961505e0a Update chalk to version 1.1.1 and ecstatic to v1.1.3. 2015-10-10 13:49:13 -07:00
John-David Dalton
59278a7a85 Reduce baseExtremum. 2015-10-09 12:59:14 -07:00
John-David Dalton
adaf6d7955 Tighten reBasicWord and reHasComplexWord. 2015-10-09 08:44:31 -07:00
greenkeeperio-bot
f6624bf270 Update request to version 2.64.0. 2015-10-09 08:03:57 -07:00
John-David Dalton
cdf03228c2 Minor test label nit of param to argument. 2015-10-08 23:41:49 -07:00
John-David Dalton
1fd710e88d Add _.word tests. 2015-10-08 23:41:43 -07:00
John-David Dalton
dc2e760b5a Add reHasComplexWord checks. 2015-10-08 23:31:52 -07:00
John-David Dalton
150bd32f97 Add _.toLower and _.toUpper. 2015-10-08 21:50:30 -07:00
John-David Dalton
d9fc0f1e37 Move dev deps in travis.yml to package.json. 2015-10-08 16:22:26 -07:00
John-David Dalton
e2c7e3a107 Avoid require in comments. [ci skip] 2015-10-08 10:45:46 -07:00
John-David Dalton
4995aa0298 Add a couple more math op chars in the latin-1 block for completeness. 2015-10-08 09:14:48 -07:00
John-David Dalton
54b774e481 Update _.lowerCase and _.upperCase doc examples. [ci skip] 2015-10-08 00:00:00 -07:00
John-David Dalton
c85095d53f Remove unused functions, vars, and params. 2015-10-07 23:54:33 -07:00
John-David Dalton
8132ed52fd Rename var rsJoiner to rsOptJoin to align with others. 2015-10-07 23:22:41 -07:00
John-David Dalton
eb723422c1 Update reWords detection. 2015-10-07 23:09:51 -07:00
John-David Dalton
051e5a6308 Clear args and thisArg in debounce cancel. 2015-10-07 13:21:52 -07:00
John-David Dalton
2d3e64b51a Correct _.pullAllBy doc example. [ci skip] 2015-10-07 00:23:02 -07:00
John-David Dalton
a21b25f751 Add _.differenceBy, _.intersectionBy, _.pickAllBy, _.unionBy, and _.xorBy tests. 2015-10-07 00:18:42 -07:00
John-David Dalton
1d425b1731 Make MapCache, SetCache, and Stack add values left to right. 2015-10-06 23:16:56 -07:00
John-David Dalton
141630f557 Add more MapCache and Stack tests. 2015-10-06 23:16:02 -07:00
John-David Dalton
9fd48bab69 Add bizarro Map tests. 2015-10-06 22:29:24 -07:00
John-David Dalton
f880e39838 Clarify bug comment of baseHas. [ci skip] 2015-10-06 20:11:31 -07:00
John-David Dalton
afb66f4b8a Remove unnecessary Map tests. 2015-10-06 19:53:01 -07:00
John-David Dalton
7e09802565 Reorganize clone tests. 2015-10-06 19:52:25 -07:00
John-David Dalton
a8b3833580 Add Stack test. 2015-10-06 19:51:25 -07:00
John-David Dalton
bf1bcaf394 Add _.cloneDeep test for objects with lots of circular references. 2015-10-06 08:16:22 -07:00
John-David Dalton
7b61569d32 Add bizarro tests for Object.create. 2015-10-06 08:15:07 -07:00
John-David Dalton
9c27ed8bda Remove nullish checks from baseHas and baseHasIn. 2015-10-06 07:07:49 -07:00
John-David Dalton
c9cb64ac10 Remove shim script tag in test/backbone.html. 2015-10-05 23:34:36 -07:00
John-David Dalton
4bd5122462 Update excused Underscore tests. 2015-10-05 23:34:16 -07:00
John-David Dalton
4dac4328e6 Minor whitespace nit in toPath doc example. 2015-10-05 21:57:04 -07:00
John-David Dalton
f7a857744f No longer coerce values to integers in add, max, min, or sum methods. 2015-10-05 21:56:32 -07:00
Droogans
6725e7dc49 Add _.upperCase and _.lowerCase. 2015-10-05 21:32:25 -07:00
John-David Dalton
7da4ea5ecb Simplify _.isFunction. 2015-10-05 11:06:49 -07:00
John-David Dalton
6d5c6b2de7 Optimize _.intersection and _.intersectionBy for empty arrays. 2015-10-05 10:53:41 -07:00
John-David Dalton
ed462747bf Minor ternary formatting. 2015-10-05 10:52:58 -07:00
John-David Dalton
53b37ca98f Use isObjectLike insteadof isObject in isArrayLikeObject. 2015-10-05 07:18:32 -07:00
John-David Dalton
423320f235 Remove unused variable push. 2015-10-05 07:18:13 -07:00
John-David Dalton
020a8c864f Adjust docs param descriptions and examples for xyzBy methods. [ci skip] 2015-10-04 23:00:50 -07:00
John-David Dalton
69e6389369 Add _.differenceBy, _.intersectionBy, _.isArrayLikeObject, _.pullAllBy, _.unionBy, and _.xorBy. 2015-10-04 23:00:30 -07:00
John-David Dalton
0eaa10f578 Adjust stackSet array length check to be consistent with others like it. 2015-10-04 21:39:43 -07:00
John-David Dalton
2740dc5efa Move assocIndexOf closer to other assoc functions. 2015-10-04 14:40:00 -07:00
John-David Dalton
592824781c Make isArrayLike use isFunction. 2015-10-04 14:09:25 -07:00
John-David Dalton
4bef0e21e7 Create getTag helper. 2015-10-04 14:04:49 -07:00
John-David Dalton
7d7ce728ff Fix npm builds. 2015-10-04 00:17:05 -07:00
John-David Dalton
27159cfa00 Move Hash definition above MapCache. 2015-10-03 22:51:56 -07:00
John-David Dalton
d236e37652 Add Stack helpers. 2015-10-03 22:41:06 -07:00
John-David Dalton
940559fc76 Optimize cacheIndexOf, cachePush, and isKeyable. 2015-10-03 16:27:21 -07:00
John-David Dalton
5746169aec Replace createHash with a Hash constructor. 2015-10-03 11:42:30 -07:00
John-David Dalton
4aa6fdeb2a Move assoc and hash functions closer together. 2015-10-01 23:20:32 -07:00
John-David Dalton
77ab121c30 Cleanup bizarro scaffolding in test/test.js. 2015-10-01 22:34:33 -07:00
John-David Dalton
9558048906 Avoid a hasOwnProperty bug in IE 10-11 where objects with a [[Prototype]] of null incorrectly report false for own index properties. 2015-10-01 22:22:05 -07:00
John-David Dalton
b3f6426d36 Add assoc and hash helpers. 2015-10-01 22:21:58 -07:00
John-David Dalton
d407d8aa08 Ensure _.isFunction returns true for generator functions. [closes #1498] 2015-10-01 09:00:00 -07:00
John-David Dalton
8842fa209d Swap createWrapper with alternatives in _.bindAll and _.wrap. 2015-10-01 08:22:12 -07:00
John-David Dalton
bc252228e1 Add bizarro Map. 2015-09-30 23:08:11 -07:00
John-David Dalton
1b3cb0f184 Combine MemCache and Stack into MapCache. 2015-09-30 23:07:03 -07:00
John-David Dalton
f607c671f8 Add a Stack cache helper to avoid linear search of stacks in modern environments. 2015-09-30 20:46:18 -07:00
John-David Dalton
8f431cff52 Cleanup _.every and _.some tests. 2015-09-29 08:16:36 -07:00
John-David Dalton
6a81a7ba8e Add _.conj and _.disj tests. 2015-09-29 08:16:23 -07:00
John-David Dalton
1f713ed9d1 Add more wrapper tests. 2015-09-27 23:01:46 -07:00
John-David Dalton
2cb4829536 Make _.words chainable by default. 2015-09-27 23:01:46 -07:00
John-David Dalton
48d5110b5d Remove wrapperToString. 2015-09-27 23:01:46 -07:00
John-David Dalton
68a5e2017e Make _.drop, _.dropRight, _.take, _.takeRight coerce n of undefined to 0. 2015-09-27 23:01:46 -07:00
John-David Dalton
63c46a9aca Minor space nit in test/test.js. [ci skip] 2015-09-27 23:01:45 -07:00
John-David Dalton
528bec0bb1 Add _.sampleSize. 2015-09-27 23:01:40 -07:00
John-David Dalton
9c79cb7766 Add _.pullAll. 2015-09-27 16:33:10 -07:00
John-David Dalton
38ac518095 Add _#toString test for nullish values. 2015-09-27 10:03:43 -07:00
John-David Dalton
7488068d50 Add support for combining diacritical marks to _.toArray. 2015-09-25 22:27:31 -07:00
John-David Dalton
8e207196d3 Expose _.toString. 2015-09-25 19:51:41 -07:00
John-David Dalton
9c35db38a0 Exit early in baseToString if value is already a string. 2015-09-25 16:28:13 -07:00
John-David Dalton
2087736649 Add support for unicode modifiers. 2015-09-25 01:26:15 -07:00
Tim Ruffles
dd75deb27f Clarify the order in which sources are applied in docs of _.assign, _.defaults, and _.merge. [ci skip] 2015-09-24 08:21:57 -07:00
John-David Dalton
5f42a3d4db Minor createInvoker param description nit. [ci skip] 2015-09-24 00:56:17 -07:00
John-David Dalton
a569b723c5 Use getIteratee in createModArgs. 2015-09-23 23:53:50 -07:00
John-David Dalton
ee2078f3ea Add _.conj, _.disj, & _.juxt. 2015-09-23 22:45:55 -07:00
John-David Dalton
12af298e33 Cleanup doc descriptions for _.modArgs and _.modArgsSet. [ci skip] 2015-09-23 22:45:35 -07:00
John-David Dalton
0429f27c54 Cleanup doc examples for lodash and _.map. [ci skip] 2015-09-23 22:44:53 -07:00
John-David Dalton
5026f51dfd Add accumulator doc note to _.unzipWith and _.zipWith. [closes #1484] [ci skip] 2015-09-23 19:34:07 -07:00
Thomas Reggi
80abaafcae Fix typo "occurence" to "occurrence". [ci skip] 2015-09-23 19:05:19 -07:00
Anderson Aguiar
bc651e886d Fix typo in comment 2015-09-22 22:06:00 -03:00
John-David Dalton
ba9cfc3b26 Clarify baseToString and other converter method docs. [ci skip] 2015-09-22 00:35:24 -07:00
John-David Dalton
b5bbc18c89 Add _#next test for _.toArray results. 2015-09-20 17:09:48 -07:00
John-David Dalton
e35088f9e3 Add dingbat support to _.words. 2015-09-20 12:58:17 -07:00
John-David Dalton
1c3b325633 Cleanup astral tests. 2015-09-20 12:57:40 -07:00
John-David Dalton
0415701e50 Add tests for variation selectors. 2015-09-20 11:59:29 -07:00
John-David Dalton
cfe813fa08 Add regional indicator tests. 2015-09-20 11:59:23 -07:00
John-David Dalton
f4ff336636 Add _.trunc tests for astrals as separators. 2015-09-20 11:58:24 -07:00
John-David Dalton
a4b333ceb8 Use _.toArray in wrapperNext. 2015-09-19 10:34:14 -07:00
John-David Dalton
f029d7c943 Add support for variation selectors. 2015-09-19 10:34:14 -07:00
John-David Dalton
53bf94ce78 Expand existing support for zero-width-joiners. 2015-09-18 15:30:12 -07:00
John-David Dalton
406e36977e Add support for regional indicator symbols and zero-width-joiners. 2015-09-18 01:28:31 -07:00
John-David Dalton
98ee746ada Move _.isArguments checks further down. 2015-09-16 19:11:52 -07:00
John-David Dalton
9e0a22f771 Cleanup and formatting pass. 2015-09-16 19:10:19 -07:00
John-David Dalton
14e62ae8d2 Make _.isString use _.isArray to reduce usage patterns. 2015-09-16 19:09:16 -07:00
John-David Dalton
1162d2edd5 Update _.toInteger test to ensure proper rounding. 2015-09-16 08:33:56 -07:00
John-David Dalton
a84e44b2a3 Use MAX_ARRAY_LENGTH instead of INFINITY for the default __takeCount__ value. 2015-09-15 23:48:36 -07:00
John-David Dalton
cd4f278a16 Add _.toInteger test for negative floats. 2015-09-15 23:45:25 -07:00
John-David Dalton
c7f34e74ac Add _.isInteger and _.isSafeInteger tests. 2015-09-15 23:42:15 -07:00
John-David Dalton
00d26a6419 Attempt again to ensure again _.toInteger converts Infinity to an integer. 2015-09-15 23:41:53 -07:00
John-David Dalton
eb57e522aa Cleanup isXyz tests. 2015-09-15 23:38:36 -07:00
John-David Dalton
e9230463e8 Fix host object tests for _.isInteger and _.isSafeInteger. 2015-09-15 22:08:51 -07:00
John-David Dalton
d652f144b2 Continue astral symbol support in _.trunc. 2015-09-15 20:40:49 -07:00
John-David Dalton
e04a512c4c Update _.isFinite doc examples. [ci skip] 2015-09-15 20:39:51 -07:00
John-David Dalton
c276278767 Use stringToArray more in _.trimLeft and _.trimRight. 2015-09-15 20:39:31 -07:00
John-David Dalton
2e248d1ca8 Ensure _.toInteger converts Infinity to an integer. 2015-09-15 20:37:53 -07:00
John-David Dalton
a5df55a6e7 Update constant references. 2015-09-15 20:36:35 -07:00
John-David Dalton
f7e05e438e Avoid creating an array in stringSize. 2015-09-15 20:34:11 -07:00
John-David Dalton
49266dce89 Add _.isInteger and _.isSafeInteger. 2015-09-15 20:33:36 -07:00
John-David Dalton
3a81738455 Collapse ranges. 2015-09-15 01:09:47 -07:00
John-David Dalton
a4ff501bb1 Add _.toArray test for empty strings. 2015-09-15 00:41:03 -07:00
John-David Dalton
351c131764 Use more stringToArray. 2015-09-15 00:34:42 -07:00
John-David Dalton
799fcb354b Pass style linting. 2015-09-15 00:23:54 -07:00
John-David Dalton
16a29659b3 Add tests for lone surrogates. 2015-09-15 00:02:45 -07:00
John-David Dalton
55ef0f12cc Rework charsLeftIndex and charsRightIndex to pass tests. 2015-09-14 23:45:18 -07:00
John-David Dalton
925c489cf9 Add more astral symbol tests. 2015-09-14 22:47:06 -07:00
John-David Dalton
3f57236c19 Cleanup charsLeftIndex, charsRightIndex, capitalize, and trim methods. 2015-09-14 21:06:28 -07:00
John-David Dalton
b4dd21fc64 First pass at astral symbols tests. 2015-09-14 18:10:11 -07:00
John-David Dalton
8278b1e79f Make _.startCase use _.capitalize. 2015-09-14 18:03:32 -07:00
John-David Dalton
c313f0c135 Minor cleanup to reWords. 2015-09-14 13:24:06 -07:00
John-David Dalton
e9bfaa7d51 Add support for astral symbols to _.camelCase, _.capitalize, _.startCase, and _.words. 2015-09-14 10:38:00 -07:00
John-David Dalton
0ae254d6b4 Add stringToArray helper. 2015-09-14 08:21:48 -07:00
John-David Dalton
bbc7b0b59b Move _.repeat empty string check to the left. 2015-09-14 01:09:54 -07:00
John-David Dalton
7f284d6ed5 Reduce _.forEach iteration note. [ci skip] 2015-09-14 01:09:04 -07:00
John-David Dalton
4744f93a47 Remove unneeded _.runInContext comment block. [ci skip] 2015-09-14 01:07:51 -07:00
John-David Dalton
a2fe87a63a Make regexp var name singular. 2015-09-14 01:07:12 -07:00
John-David Dalton
fa61e30dd5 Add support for astral symbols in string methods. [closes #1463] 2015-09-14 01:06:40 -07:00
John-David Dalton
0fb94ad3c6 Minor formatting nit. 2015-09-13 22:08:14 -07:00
John-David Dalton
33a73fb0c4 Cleanup other realm tests. 2015-09-13 22:08:08 -07:00
John-David Dalton
a61eeeaa03 Minor formatting cleanup in travis.yml. 2015-09-13 10:19:49 -07:00
John-David Dalton
80f6990a43 Remove value guards in baseDifference and baseSortedUniqBy. 2015-09-12 22:29:19 -07:00
John-David Dalton
0d5f8437f5 Indentation nit in baseTimes. 2015-09-12 22:28:46 -07:00
John-David Dalton
5e968deb4e Add more source replacements to travis.yml. 2015-09-12 20:52:40 -07:00
John-David Dalton
ac1ffa2efe Cleanup _.merge tests. 2015-09-12 09:53:30 -07:00
John-David Dalton
ed2e6d16c8 Add more _.merge tests for arguments. 2015-09-12 09:53:30 -07:00
John-David Dalton
dafe807888 Ensure _.merge doesn't modify array/typed-array/plain-object source values. 2015-09-12 09:53:25 -07:00
John-David Dalton
1320706172 Make _.merge source object assignments align with source array assignments. 2015-09-12 00:00:13 -07:00
John-David Dalton
fb4cf9e78f Cleanup _.assign and _.extend docs. [ci skip] 2015-09-11 23:47:32 -07:00
Rhys van der Waerden
8cbb8befd4 Clarify _.merge description. [ci skip]
Mention behaviour difference between merging plain objects and objects with non-Object prototypes. As discussed in #1455.
2015-09-11 23:46:27 -07:00
John-David Dalton
aa303df387 Update core builds. 2015-09-11 18:25:03 -07:00
John-David Dalton
e42d29611c Ensure wrapper actions are copied in wrapperClone. 2015-09-11 18:22:34 -07:00
John-David Dalton
a5213f1291 Add strict equal fast path for object comparisons in equalObjects. 2015-09-11 18:03:20 -07:00
John-David Dalton
875dfec570 Add tag checks back to baseIsEqualDeep. 2015-09-11 18:02:49 -07:00
John-David Dalton
6edde288ee Add requireDotNotation rule to jscsrc. 2015-09-11 18:02:19 -07:00
John-David Dalton
a6ead18121 Avoid deep crawl if object and source are strict equal. 2015-09-11 12:57:34 -07:00
John-David Dalton
7245570405 Cleanup, organize, and group jscs rules. 2015-09-11 00:26:05 -07:00
John-David Dalton
38a37f1b18 Use === in _.isEqual doc example. [ci skip] 2015-09-10 19:08:07 -07:00
John-David Dalton
5c98ab4b8f Simplify doc examples that use Math methods. [ci skip] 2015-09-10 19:07:37 -07:00
John-David Dalton
5ddb1ef76d Remove duplicate jsdoc param from equalObjects docs. [ci skip] 2015-09-10 19:06:56 -07:00
John-David Dalton
8b320f913d Remove unneeded type check from createRound. 2015-09-10 19:06:08 -07:00
John-David Dalton
8e0011d07a Ensure clone methods create maps and sets from other realms. 2015-09-10 19:05:25 -07:00
John-David Dalton
e50734a6fb Update jscs rules. 2015-09-10 19:03:53 -07:00
John-David Dalton
307dae4fac Adjust _.omit and _.pickBy doc examples to show more of a difference between them. [ci skip] 2015-09-10 07:38:56 -07:00
John-David Dalton
d8c5f85cd2 Add _.modArgsSet tests. 2015-09-09 23:45:37 -07:00
John-David Dalton
94c95469e1 Minor test cleanup. 2015-09-09 22:59:37 -07:00
John-David Dalton
e8244f7f07 Adjust property descriptors in tests. 2015-09-09 22:59:37 -07:00
John-David Dalton
a48f48ca95 Ensure _.merge skips merging when object and source are the same value. 2015-09-09 22:59:29 -07:00
John-David Dalton
4a4e54479a Ensure _.merge assigns typed arrays directly. [closes #1453] 2015-09-09 22:10:23 -07:00
John-David Dalton
86d06e0a4c Cleanup _.merge tests. 2015-09-09 22:09:10 -07:00
John-David Dalton
9b41ae847b Consolidate this binding tests. 2015-09-09 20:44:58 -07:00
Ilya Mochalov
012cc521f5 Minor _.plant doc fix. [ci skip] 2015-09-09 18:11:40 -07:00
John-David Dalton
20695548f1 Use more pre-QUnit 2.0 APIs. 2015-09-09 18:05:48 -07:00
John-David Dalton
d77c5123c1 Add _.flip and _.modArgsSet to lodash doc note. [ci skip] 2015-09-09 10:34:50 -07:00
John-David Dalton
c32a6837e6 Update _.flip doc example and test to better show effect. 2015-09-09 10:29:43 -07:00
John-David Dalton
c604be31e0 Add _.flip test. 2015-09-09 08:31:28 -07:00
John-David Dalton
0a08edb6d7 Remove second _.rearg example. [ci skip] 2015-09-09 08:31:19 -07:00
John-David Dalton
4d7aeb8b96 Don't flip if there's less than 2 arguments. 2015-09-09 08:31:03 -07:00
John-David Dalton
6b09f1f233 Remove iojs from travis-yml tests. 2015-09-08 22:51:46 -07:00
Phillip Alexander
7364c84b6b Add Node.js v4 stable to Travis config.
NodeJS v4 was just released [NodeJS v4 announcement](https://nodejs.org/en/blog/release/v4.0.0/). This updates the CI build script to accommodate the release. Note: It should be "4", not "4.0" since Node will surely get a lot of minor updates before it goes LTS and reveal.js should test on the latest of them.
2015-09-08 22:49:16 -07:00
John-David Dalton
02a28d565b Add _.flip. [closes #1449] 2015-09-08 22:48:37 -07:00
John-David Dalton
2ac6e31cc3 Update QUnit to 1.19.0. 2015-09-08 22:34:19 -07:00
John-David Dalton
8bad4ae636 Rename multiValue param to multiVal. [ci skip] 2015-09-07 23:35:06 -07:00
John-David Dalton
f0010ea3a8 Add additional guard to isCombo check in mergeData. 2015-09-07 23:32:16 -07:00
John-David Dalton
f86bff3bf7 Minor _.modArgsSet doc example tweak. [ci skip] 2015-09-07 22:29:13 -07:00
John-David Dalton
99b0094dcd Minor code style nit in tests. [ci skip] 2015-09-07 22:14:20 -07:00
John-David Dalton
db86a6ff1c Simplify _.isMatch set test. 2015-09-07 22:05:44 -07:00
John-David Dalton
cbc188916d Fix typo and fail in _.isMatch test. 2015-09-07 21:59:57 -07:00
John-David Dalton
2f411230c5 Add _.isEqualWith and _.isMatchWith tests for maps and sets. 2015-09-07 21:36:49 -07:00
John-David Dalton
b9c8c877b7 Minor contributing text nit, new methods to functions. [ci skip] 2015-09-07 20:37:07 -07:00
John-David Dalton
13e4ba622e Add code of conduct doc. [ci skip] 2015-09-07 20:33:15 -07:00
John-David Dalton
7863256de5 Add map and set guards to tests to fix travis runs. 2015-09-06 22:41:07 -07:00
John-David Dalton
d81e029ec0 Add _.isMatchWith tests. 2015-09-06 22:32:09 -07:00
John-David Dalton
f6500eafb6 Cleanup _.isMatch tests. 2015-09-06 22:31:39 -07:00
John-David Dalton
9da03f529f Ensure equalByTag passing customizer to equalFunc. 2015-09-06 21:05:05 -07:00
John-David Dalton
1e1e4fd557 Add _.matches and _.matchesProperty tests for partial matching maps and sets. 2015-09-06 20:42:15 -07:00
John-David Dalton
08f8e659fd Cleanup _.matches and _.matchesProperty tests. 2015-09-06 20:35:43 -07:00
John-David Dalton
fc69fe1f21 Use map.size and set.size in mapToArray and setToArray. 2015-09-06 18:00:28 -07:00
John-David Dalton
38a16805ed Optimize map and set comparisons in _.isEqual. 2015-09-06 17:01:17 -07:00
John-David Dalton
dfd4ae9ea4 Add _.modArgsSet. 2015-09-05 22:29:38 -07:00
John-David Dalton
5c9585b2b0 Ensure correct execution order of _.modArgs transforms. 2015-09-05 22:29:11 -07:00
John-David Dalton
dc2e769d9a Ensure _.toPath converts array values to strings. 2015-09-05 11:25:06 -07:00
John-David Dalton
15a4fb7adf Add _.toPath tests. 2015-09-05 10:00:21 -07:00
John-David Dalton
7bb10d56f8 Add _.toPath doc examples. [ci skip] 2015-09-05 10:00:08 -07:00
John-David Dalton
650282b186 Add console.logs to doc examples. [ci skip] 2015-09-05 09:59:38 -07:00
John-David Dalton
ded3cfc251 Add _.toInteger tests. 2015-09-05 09:31:37 -07:00
John-David Dalton
a4fee3a3ad Add _.isObjectLike tests. 2015-09-05 09:26:09 -07:00
John-David Dalton
58d7404ee4 Add a _.memoize test for the this binding of resolver. 2015-09-05 09:14:38 -07:00
John-David Dalton
556eee8563 Use a create function helper for modArgs. 2015-09-05 09:04:46 -07:00
John-David Dalton
1422f50ee9 Remove isStrict guards from tests. 2015-09-05 01:05:39 -07:00
Philippe Lhoste
1be4adf365 Improve documentation for method chaining. [ci skip] 2015-09-05 01:05:39 -07:00
John-David Dalton
4510ada21e Update lodash doc block. [ci skip] 2015-09-05 01:05:39 -07:00
John-David Dalton
e516d99b2d Expose _.toInteger. 2015-09-04 08:35:36 -07:00
John-David Dalton
b534b83756 Fix failing tests in strict mode. 2015-09-04 01:02:47 -07:00
John-David Dalton
41b537249b Expose _.isObjectLike and _.toPath. 2015-09-04 00:55:34 -07:00
John-David Dalton
4a87acf1ac Remove "Number" and "String" from contextProps. 2015-09-04 00:55:16 -07:00
John-David Dalton
41d3b66867 Move NEGATIVE_INFINITY and POSITIVE_INFINITY out of runInContext. 2015-09-04 00:36:34 -07:00
John-David Dalton
3ef7ae24e5 Expose _.isArrayLike. 2015-09-03 22:08:02 -07:00
John-David Dalton
824d3b75f9 Add Safari 8.1 note to _.isArguments. [ci skip] 2015-09-03 20:05:39 -07:00
John-David Dalton
38a802fed3 Fix _.isArguments in Safari 8.1. 2015-09-03 19:53:11 -07:00
John-David Dalton
ee776fd0de Add IE11 note to noMapSetTag definition. [ci skip] 2015-09-03 19:53:11 -07:00
John-David Dalton
a1f29d8f4a Cleanup get/set/unset tests. 2015-09-03 18:28:57 -07:00
John-David Dalton
3e42a817a1 Fix failing map/set tests in IE11. 2015-09-03 15:22:21 -07:00
John-David Dalton
617dd703e1 Soften language on isXyz methods that use duck typing. [ci skip] 2015-09-03 15:22:21 -07:00
John-David Dalton
e63d7ff9d5 Rename var initFromArray to initFromCollection in _.reduce and _.reduceRight. 2015-09-03 15:21:12 -07:00
Ray Hammond
7e73b27edf Updated contributing text to include code style linter details. [ci skip] 2015-09-03 12:54:47 -07:00
Michał Lipiński
6898b896d1 Add _.unset. 2015-09-03 09:28:06 -07:00
John-David Dalton
085e2c24d3 Remove weakmap and set shims. 2015-09-03 09:18:10 -07:00
John-David Dalton
cc77eb7855 Change augment to modify. [ci skip] 2015-09-03 09:06:16 -07:00
John-David Dalton
8e9f9f6f2f Detect maps and sets in IE11. 2015-09-03 09:02:33 -07:00
John-David Dalton
51006e8304 Tweak test try-catch style to be consistent with lodash. 2015-09-03 08:22:33 -07:00
Ray Hammond
fce2bd89c7 Added jscs code style checker. 2015-09-03 08:19:41 -07:00
John-David Dalton
830be3d918 Add strict mode test for _.isArguments. 2015-09-02 22:56:25 -07:00
John-David Dalton
0926e5a986 Fix test errors in IE9. 2015-09-02 16:59:42 -07:00
Ray Hammond
b61411956c Missing semicolon linting fixes to test.js. 2015-09-02 11:44:23 -07:00
John-David Dalton
5648fe940c Add MS Edge testing with saucelabs. 2015-09-02 08:45:44 -07:00
Ray Hammond
57ad32448f Added missing semicolon. 2015-09-02 08:45:34 -07:00
John-David Dalton
b4db3c050d Ensure _.isEqual performs unordered comparisons of maps and sets. 2015-09-01 21:50:28 -07:00
John-David Dalton
3f954ca790 Add _.isEqual tests for maps and sets. 2015-09-01 01:17:15 -07:00
John-David Dalton
6e0174e879 Cleanup _.isEqual tests. 2015-09-01 00:46:55 -07:00
John-David Dalton
e4873f1982 Add map and set tests for clone methods. 2015-09-01 00:37:37 -07:00
John-David Dalton
3d35817a2f Add _.toArray tests for ES6 iterables. 2015-09-01 00:23:08 -07:00
John-David Dalton
8c6aef3edb Cleanup newlines and semicolons. 2015-08-31 23:32:07 -07:00
John-David Dalton
5fd8939b7d Add Symbol.iterator guards to tests. 2015-08-31 19:40:32 -07:00
John-David Dalton
4c1b578b80 Add _#plant test for cloned chainAll settings. 2015-08-31 19:16:00 -07:00
John-David Dalton
f6bf81d16f More test cleanup. 2015-08-31 19:11:29 -07:00
John-David Dalton
2d8cc57642 Ensure _#plant resets iterator data of the cloned sequence. 2015-08-31 18:47:37 -07:00
John-David Dalton
3b131f0231 Add coverage for wrapped[Symbol.iterator]. 2015-08-31 18:04:07 -07:00
John-David Dalton
202ce472bb Cleanup tests. 2015-08-31 17:54:06 -07:00
John-David Dalton
7206edec2e Cleanup .next tests. 2015-08-31 17:52:32 -07:00
John-David Dalton
9e86efadbc Make the chain wrapper iterable. 2015-08-30 23:40:34 -07:00
Graeme Yeates
433331adac Add ES6 compliant lodash(...).next() iterator. 2015-08-30 22:47:32 -07:00
John-David Dalton
a0cd024b39 Add checks to iteratorSymbol assignment. 2015-08-30 10:09:28 -07:00
John-David Dalton
4fbb31b4dc Adjust Set references to fix the build. 2015-08-30 09:59:19 -07:00
John-David Dalton
09bcc5aaec Move more functions out of runInContext. 2015-08-30 09:37:23 -07:00
John-David Dalton
c921c9bd12 Add support for ES6 Set/Map to _.clone/_.isEqual/_.toArray and iterator support to _.toArray. 2015-08-30 08:58:12 -07:00
John-David Dalton
8f621b38bf Update builds. 2015-08-30 05:12:06 -07:00
John-David Dalton
257d957dfb Add baseSortedUniqBy. 2015-08-30 05:12:06 -07:00
John-David Dalton
a0a6f0ae87 Correct arity hints for baseSortByOrder and createAggregator. 2015-08-30 04:55:05 -07:00
John-David Dalton
c396b60612 Cleanup _.pairs and _.invert. 2015-08-30 04:45:49 -07:00
John-David Dalton
98a97b1eaf Use arrayReduce in baseWrapperValue and _.invert, arrayEach in _.bindAll, and baseTimes in _.unzip. 2015-08-30 04:27:52 -07:00
John-David Dalton
7d6fcc75da Use arrayReduce in basePick. 2015-08-30 03:56:14 -07:00
Nathan Bellowe
ecd8b7f614 Update _.modArgs doc example to better show the method's affect. [ci skip] 2015-08-30 03:56:07 -07:00
John-David Dalton
cc1bcc25b9 Enable phantomjs tests in travis.yml. 2015-08-29 14:31:08 -07:00
John-David Dalton
b792276a00 Update PATTERN2 in travis.yml. 2015-08-29 13:33:08 -07:00
John-David Dalton
b1d52ccd82 Rename _.indexBy to _.keyBy to avoid confusion with _.sortedIndexBy forms. 2015-08-29 13:33:08 -07:00
John-David Dalton
cc0e91ac2f Remove duplicated tests. 2015-08-29 10:52:23 -07:00
John-David Dalton
dfac7b4261 Make _.xyzBy methods provide just a single param to their callbacks. 2015-08-29 10:52:02 -07:00
John-David Dalton
1258eef213 Use toInteger in _.repeat. 2015-08-29 09:18:33 -07:00
John-David Dalton
f79148fa62 Rename arraySum to baseSum. 2015-08-29 09:16:48 -07:00
John-David Dalton
4d2aa29926 Simplify baseValues, createCompounder, initKeys, _.after, _.pairs, _.range, & _.times. 2015-08-29 09:15:47 -07:00
John-David Dalton
f016840c53 Correct baseSortedUniqBy. 2015-08-29 09:10:29 -07:00
John-David Dalton
cffeec4713 Cleanup baseSortedUniq and add more uniq related tests. 2015-08-28 08:53:05 -07:00
John-David Dalton
fcbe4620cd Simplify baseFunctions. 2015-08-28 08:15:50 -07:00
John-David Dalton
5a5e0363c2 Remove Chakra check as they've resolve their 'vm' issue. 2015-08-27 10:39:23 -07:00
John-David Dalton
64512ee2ae Fix skipTest count for _.isNil other realm test. 2015-08-27 10:23:57 -07:00
John-David Dalton
ce4f2f1326 Ensure _.merge merges plain-objects onto non plain-objects. [closes #1413] 2015-08-27 09:21:37 -07:00
John-David Dalton
dfebb83c35 Update excused Underscore tests. 2015-08-26 22:43:02 -07:00
John-David Dalton
0ba226e3c2 Fix test fails and _.uniqBy use baseUniqBy. 2015-08-26 22:21:18 -07:00
John-David Dalton
e0f59eccf0 Formatting nit in baseWhile. 2015-08-26 21:43:52 -07:00
John-David Dalton
820e720b0a Cleanup various method descriptions. [ci skip] 2015-08-26 21:43:37 -07:00
John-David Dalton
936c5f5d3d Add baseUniqBy. 2015-08-26 21:43:12 -07:00
John-David Dalton
d0b3b8de44 Minor test cleanup. 2015-08-26 08:30:22 -07:00
John-David Dalton
89d53306f3 Use toInteger in pad methods and make nullish chars checks in pad and trim methods undefined checks. 2015-08-26 08:30:06 -07:00
John-David Dalton
e30a20120c Split out _.sortedIndexOf, _.sortedLastIndexOf, _.sortedUniq, and _.sortedUniqBy. 2015-08-26 08:27:16 -07:00
John-David Dalton
790d6331f8 Remove fromIndex type check from _.includes. 2015-08-25 23:12:12 -07:00
John-David Dalton
9121ab95ea Bump package for easier testing. 2015-08-24 18:09:42 -07:00
John-David Dalton
b09e5cf5a7 Minor shortcut fusion test cleanup. 2015-08-24 08:22:51 -07:00
John-David Dalton
b53a8e873d Rename the baseIteratee param func to value. 2015-08-23 23:36:55 -07:00
John-David Dalton
4c38963c6f Add iteratee arity hints back. 2015-08-23 23:36:05 -07:00
John-David Dalton
b0d6c34565 Add isIterateeCall checks back to _.every and _.some. 2015-08-23 18:41:11 -07:00
John-David Dalton
0a9c9411f0 Update core builds. 2015-08-22 20:37:02 -07:00
John-David Dalton
e253f58aac Fix _.keysIn test fails in IE9. 2015-08-22 20:35:33 -07:00
John-David Dalton
0aa8ad202a Implement copyObject by way of copyObjectWith. 2015-08-22 18:41:48 -07:00
John-David Dalton
7bc5a501c4 Remove explicit Object coercion in _.keysIn. 2015-08-21 18:35:31 -07:00
John-David Dalton
4691a38d21 Add baseKeys. 2015-08-21 13:56:59 -07:00
MaxPRafferty
00bae752d0 Add item to _.fill example. [ci skip]
While not the minimum example required to show the fill functionality, having the fill write more than one value better fits the purpose of the function in practice.
2015-08-21 12:15:29 -07:00
John-David Dalton
e253fe0547 Use nullish to describe _.isNil. [ci skip] 2015-08-21 08:28:49 -07:00
John-David Dalton
e35d73be8f Add isNative chaining test. 2015-08-20 08:16:41 -07:00
John-David Dalton
f9f7af2430 Cleanup _.isNil doc examples and tests. 2015-08-20 08:11:17 -07:00
John-David Dalton
7aef780b14 Add hasIn to lodash chaining doc note. [ci skip] 2015-08-20 08:02:44 -07:00
xixilive
5644a20eec Add _.isNil function. 2015-08-20 00:16:17 -07:00
John-David Dalton
b135431542 Remove unused escapeRegExpChar function. 2015-08-19 22:07:50 -07:00
John-David Dalton
efdb254b12 Fix _.isMatchWith test fail. 2015-08-19 21:56:08 -07:00
John-David Dalton
8fd2f0ae11 Add _.hasIn tests. 2015-08-19 17:26:53 -07:00
John-David Dalton
3f7ee9bd2e Remove unneeded Object use. 2015-08-19 16:42:24 -07:00
John-David Dalton
a049c1189e Consistent use of of instead of on in path related docs. [ci skip] 2015-08-19 16:42:14 -07:00
John-David Dalton
9859b1555f Add _.hasIn and more path helper functions. 2015-08-18 23:29:27 -07:00
John-David Dalton
356e47a6a3 Remove double declared length var in sample. 2015-08-18 14:03:04 -07:00
John-David Dalton
2c1c8fc8df Remove unneeded _.escapeRegExp test. 2015-08-18 13:46:55 -07:00
John-David Dalton
e7bdd4a624 Ensure paths with newlines are walkable. 2015-08-17 23:56:27 -07:00
John-David Dalton
1a9069e80a Remove rogue console.log debug. 2015-08-17 00:24:05 -07:00
John-David Dalton
484861e3ee Change objectValue and sourceValue params to objValue and srcValue. 2015-08-16 23:29:58 -07:00
John-David Dalton
99ba0a4927 Ensure isMatchWith invokes customizer callbacks with object and source params. 2015-08-16 23:28:06 -07:00
John-David Dalton
ba3ede584e Add stack params to several customizer callback calls. 2015-08-14 07:36:09 -07:00
John-David Dalton
dd472f489b Avoid stack overflow with _.defaultsDeep. 2015-08-13 08:56:43 -07:00
John-David Dalton
9f0dd40b3b Remove component.json reference from bower.json. 2015-08-12 08:14:40 -07:00
John-David Dalton
edc03287aa Ensure _.defaultsDeep works on circular references. 2015-08-10 23:08:34 -07:00
John-David Dalton
d6dc7627b9 Start making Underscore tests work with the core build. 2015-08-09 21:49:30 -07:00
John-David Dalton
59773ca284 Update Backbone tests for core build runs. 2015-08-09 21:38:16 -07:00
John-David Dalton
6aa01ffe05 Remove old android platforms from sauce tests. 2015-08-09 21:36:02 -07:00
John-David Dalton
5b3de94fee Add core build to test dropdowns. 2015-08-09 21:34:24 -07:00
John-David Dalton
b4edf122f6 Update _.reduce and _.transform object iteration doc example. [ci skip] 2015-08-09 00:09:17 -07:00
John-David Dalton
1647c4deab Update test/saucelabs.js for lodash v4. 2015-08-08 17:46:32 -07:00
John-David Dalton
3efb91e86d Enable most sauce labs runs. 2015-08-08 17:35:28 -07:00
John-David Dalton
d6f73054a5 Update tested sauce browsers. 2015-08-08 17:35:15 -07:00
John-David Dalton
bd9b38665d Update Underscore/Backbone tests and make them passable. 2015-08-08 16:52:47 -07:00
John-David Dalton
de5c2b906e Add core builds. 2015-08-04 22:54:50 -07:00
John-David Dalton
4a4badcdc1 Reduce _.mixin with arrayEach. 2015-08-04 22:29:58 -07:00
John-David Dalton
fa7ebb36dc Add _.isNaN test for a Number object. 2015-08-04 22:29:58 -07:00
John-David Dalton
447440776b Remove component.json. 2015-08-01 11:12:22 -07:00
John-David Dalton
f5714f2eb0 Reduce _.isEmpty. 2015-08-01 11:03:49 -07:00
John-David Dalton
a3b76f9259 Minor plural nit in _.sortBy docs. [ci skip] 2015-07-31 16:49:04 -07:00
John-David Dalton
ba71421a23 Test label nits. 2015-07-31 14:03:32 -07:00
John-David Dalton
61251b305d Simplify _.escapeRegExp to align with the defunct ES7 proposal. 2015-07-31 14:03:32 -07:00
John-David Dalton
73464d6bb6 Ensure many n like params are coerced to integers. [closes #1377] 2015-07-31 10:41:45 -07:00
John-David Dalton
7f7ebed4ea Drop the __chain__ check from lodash. 2015-07-30 17:46:28 -07:00
John-David Dalton
5c53809269 Use isObject comboed with isArrayLike. 2015-07-30 09:09:11 -07:00
John-David Dalton
3935d5f2f7 Ensure _.merge doesn't convert strings to arrays. [closes #1375] 2015-07-30 09:09:11 -07:00
John-David Dalton
693704a832 Remove argument juggling from _.before. 2015-07-29 23:22:34 -07:00
John-David Dalton
b17f6eee6a Remove unneeded isIterateeCall checks. 2015-07-29 12:20:25 -07:00
John-David Dalton
ccb90f46e6 Remove overloaded options param support for _.trunc. 2015-07-29 12:19:49 -07:00
John-David Dalton
dfa4cd921e Add test for _.escapeRegExp escaping string containing only chars that require leading escaping. 2015-07-29 08:22:10 -07:00
John-David Dalton
32e0afd19c Have _.chunk exit early for empty arrays too. 2015-07-28 22:41:58 -07:00
John-David Dalton
5fb732c0e6 Change default size of _.chunk to 0. 2015-07-28 13:49:55 -07:00
John-David Dalton
48a6c4f2bf Add _.setWith tests. 2015-07-26 10:32:32 -07:00
John-David Dalton
f1597386ef Ensure _.set and _.setWith don't assign a value if it's the same as the destination value. 2015-07-26 09:58:33 -07:00
John-David Dalton
731d5b6872 Add assignValue and assignMergeValue helpers to make value assignments more consistent across methods. 2015-07-26 09:42:21 -07:00
James M Snell
ce569e4bc4 Add npm test. 2015-07-25 20:26:34 -07:00
John-David Dalton
f48b8d6d91 Cleanup _.some docs. [ci skip] 2015-07-24 17:39:56 -07:00
John-David Dalton
4fc94a4383 Use extendWith instead of defaults in _.template to reduce deps. 2015-07-24 17:12:36 -07:00
John-David Dalton
c5057905b6 Cleanup doc examples of _.isEqualWith, _.isMatchWith, & _.setWith. [ci skip] 2015-07-24 17:10:25 -07:00
John-David Dalton
3c388c76c6 Add to docs of _.assignWith and _.setWith. [ci skip] 2015-07-24 08:36:42 -07:00
John-David Dalton
a730fe13c7 Make baseGet align with baseSet. 2015-07-24 08:36:00 -07:00
John-David Dalton
4520e0710d Add _.setWith. 2015-07-23 09:18:09 -07:00
John-David Dalton
7e42892e6a Update vendor. 2015-07-23 09:18:09 -07:00
John-David Dalton
a0c580298e Cleanup comments. [ci skip] 2015-07-23 09:05:50 -07:00
John-David Dalton
e7ad50d243 Remove unneeded var bit from _.omit. 2015-07-20 20:08:53 -07:00
John-David Dalton
1394d42f58 Simplify createXYZ function descriptions. [ci skip] 2015-07-20 17:22:57 -07:00
Graeme Yeates
a8e95e25ad Add string to valid _.includes parameters. [ci skip] 2015-07-20 17:03:57 -07:00
John-David Dalton
87cb4db263 Simplify isHostObject. 2015-07-20 11:34:58 -07:00
John-David Dalton
2ccda44c44 Add isObjectLike and isHostObject checks to _.isPlainObject. 2015-07-20 11:34:58 -07:00
John-David Dalton
0253c7bcf1 Add license field to bower.json. [closes #1355] [ci skip] 2015-07-20 11:34:58 -07:00
John-David Dalton
9c7b39b7a7 Remove _.clone test for strings. 2015-07-20 11:34:58 -07:00
John-David Dalton
5f4611fce2 Minor nit to move objCtorString above objToString. 2015-07-20 11:34:58 -07:00
John-David Dalton
c4fa2e70bf Remove old JScript tests. 2015-07-20 11:34:58 -07:00
John-David Dalton
15b1a22501 Remove non-enumerable prototype property tests. 2015-07-20 11:34:58 -07:00
John-David Dalton
51425788d8 Cleanup _.isEqual test for non-index properties on arrays. 2015-07-20 11:34:58 -07:00
John-David Dalton
a17d5eea47 Remove splice objects tests. 2015-07-20 11:34:58 -07:00
John-David Dalton
ef909e8a54 Remove _.support tests. 2015-07-20 11:34:57 -07:00
John-David Dalton
0a24e9854b Add bizarro test for Object#propertyIsEnumerable. 2015-07-20 11:34:57 -07:00
John-David Dalton
4eb2eea809 Remove unneeded sort calls from keys tests. 2015-07-20 11:34:57 -07:00
John-David Dalton
8a6705617f Consistent Foo style in tests. 2015-07-20 11:34:57 -07:00
John-David Dalton
bbe122aba5 Improve test coverage. 2015-07-20 11:34:57 -07:00
John-David Dalton
40409df885 Ensure basePullAt works with deep paths. 2015-07-20 11:34:57 -07:00
John-David Dalton
7fdbdae6b9 Use arraySum in _.sum. 2015-07-20 11:34:57 -07:00
John-David Dalton
b87a18bd80 Remove toFunction from _.unzipWith. 2015-07-20 11:34:57 -07:00
John-David Dalton
6d650a48db Remove some older browser notes in test labels. [ci skip] 2015-07-20 11:34:56 -07:00
John-David Dalton
54ea0eac8e Remove string tests for "Collection" methods. 2015-07-20 11:34:56 -07:00
John-David Dalton
4054898170 Cleanup lazy method wrapper. 2015-07-20 11:34:56 -07:00
John-David Dalton
8a205e1e32 Add lazy chaining tests for _.find and _.findLast. 2015-07-20 11:34:56 -07:00
Graeme Yeates
39068730e2 Enable shortcut fusion for _.find and _.findLast. 2015-07-20 11:34:56 -07:00
John-David Dalton
1e344455b8 Make eq its own method. 2015-07-20 11:34:56 -07:00
John-David Dalton
9a01f3a337 Move the false example for _.isEqual below the true one. [ci skip] 2015-07-20 11:34:56 -07:00
John-David Dalton
f6ea758b85 Make array length checks more uniform. 2015-07-20 11:34:56 -07:00
John-David Dalton
51fb82902b Make max and min use arrayExtremum instead of their xyzBy counterparts. 2015-07-20 11:34:55 -07:00
John-David Dalton
3c342adb67 Move Reflect assignment. 2015-07-20 11:34:55 -07:00
John-David Dalton
24d592f94f Remove rogue semicolon. 2015-07-20 11:34:55 -07:00
John-David Dalton
181ebf024c Remove compat and modern modifiers from build commands in travis.yml. 2015-07-20 11:34:55 -07:00
John-David Dalton
ecf693ac75 Change file references from lodash.src.js to lodash.js. 2015-07-20 11:34:55 -07:00
John-David Dalton
8266266639 Update vendor/benchmark.js. 2015-07-20 11:34:55 -07:00
John-David Dalton
0f2419357c Move lodash.src.js to lodash.js. 2015-07-20 11:34:30 -07:00
John-David Dalton
2e57123aa2 Remove lodash.js 2015-07-20 11:32:11 -07:00
John-David Dalton
881733e099 Temporarily disable a few more runs in travis.yml. 2015-07-20 11:26:01 -07:00
John-David Dalton
18f778ce11 Remove var use for the baseKeysIn fork assignment. 2015-07-20 11:26:01 -07:00
John-David Dalton
b8060a5bcc Add more methods to the lodash doc note. [ci skip] 2015-07-20 11:26:01 -07:00
Michael Kearns
7a34b2982f Reword _.merge docs for clarity. [ci skip] 2015-07-20 11:26:01 -07:00
John-David Dalton
f695af587a Remove createExtremum. 2015-07-20 11:26:00 -07:00
John-David Dalton
7759615775 Ensure "Collection" methods treat functions as objects. 2015-07-20 11:26:00 -07:00
John-David Dalton
bbad03547d Make _.at an "Object" method. 2015-07-20 11:26:00 -07:00
John-David Dalton
b638f86b75 Use a heavier function check in isArrayLike. 2015-07-20 11:26:00 -07:00
John-David Dalton
ab6210dc30 Avoid es-sham getPrototypeOf when constructor is not a function. 2015-07-20 11:26:00 -07:00
John-David Dalton
9ca16e3933 Rename baseCompareAscending to compareAscending. 2015-07-20 11:26:00 -07:00
John-David Dalton
76ab41a742 Add _.matches and _.matchesProperty tests for primitive object and a source with undefined values. 2015-07-20 11:26:00 -07:00
John-David Dalton
c6f6eb294b Use numberProto more in test/test.js. 2015-07-20 11:26:00 -07:00
John-David Dalton
19836a55a3 Remove an isArray check from baseMatchesProperty. 2015-07-20 11:25:59 -07:00
John-David Dalton
862c7fde6d Docs cleanup pass. [ci skip] 2015-07-20 11:25:59 -07:00
John-David Dalton
5d842273d9 Remove accidental trailing comma. 2015-07-20 11:25:59 -07:00
John-David Dalton
33a9ebaba1 Fix _.matches and _.matchesProperty doc notes on inherited properties. [ci skip] [closes #1344] 2015-07-20 11:25:59 -07:00
John-David Dalton
192e35882a Remove toIterable and toObject. 2015-07-20 11:25:59 -07:00
John-David Dalton
e6b9aaf499 Temporarily reduce scope of automated testing until things are more stable. 2015-07-20 11:25:59 -07:00
John-David Dalton
b821660e79 Remove irrelevant comments. [ci skip] 2015-07-20 11:25:59 -07:00
John-David Dalton
0beaf47a64 Extract common components of _.keys and _.keysIn and make _.keysIn use the Reflect.enumerate shim as a compat path for older enviros. 2015-07-20 11:25:59 -07:00
John-David Dalton
8a9e9e9a11 Remove support for pre-es5 environments. 2015-07-20 11:25:59 -07:00
Oliver Hoffmann
df17244353 Update root assignment to work in Firefox extensions. [closes #1340] 2015-07-20 11:25:58 -07:00
Graeme Yeates
ffd3e17364 Add _.isFunction test for NodeList instances. 2015-07-20 11:25:58 -07:00
John-David Dalton
211a6cc4f1 Doc cleanup to turn "accepts an iteratee" to "accepts iteratee". [ci skip] 2015-07-20 11:25:58 -07:00
John-David Dalton
4c09879aab Add _.assignWith, _.cloneDeepWith, _.cloneWith, _.extendWith, _.isEqualWith, _.isMatchWith, and _.mergeWith. 2015-07-20 11:25:58 -07:00
John-David Dalton
fd526e8754 Split _.omit and _.pick into _.omitBy and _.pickBy. 2015-07-20 11:25:58 -07:00
John-David Dalton
974306d4f0 Generalize the unwrapped value path in lazy method wrappers a bit. 2015-07-20 11:25:58 -07:00
John-David Dalton
56452d9fd8 Document start and end swap for _.inRange. [ci skip] [closes #1332] 2015-07-20 11:25:58 -07:00
John-David Dalton
6d231fecd1 Update html indent style in .editorconfig. 2015-07-20 11:25:58 -07:00
John-David Dalton
2e91cf727a Simplify checkGlobal. 2015-07-20 11:25:58 -07:00
John-David Dalton
64b9402e12 Strict equal nit in _.uniq. 2015-07-20 11:25:57 -07:00
John-David Dalton
4bae0c0139 Minor formatting nit for _.without. 2015-07-20 11:25:57 -07:00
John-David Dalton
06bc4aa50b Make isArayLike return false for functions. 2015-07-20 11:25:57 -07:00
John-David Dalton
31a7ac1e81 Ensure _.assign, _.extend, _.defaults, and _.merge coerce values to objects. 2015-07-20 11:25:57 -07:00
John-David Dalton
c75ac3ac64 Simplify nullish and falsey checks. 2015-07-20 11:25:57 -07:00
John-David Dalton
3e14d8f4dd Minor doc formatting nits for pickByArray and pickByPredicate. [ci skip] 2015-07-20 11:25:57 -07:00
John-David Dalton
6cde31f843 Remove doc references to this bindings and other dropped features. [ci skip] 2015-07-20 11:25:57 -07:00
John-David Dalton
a7b70008ba Drop boolean options param support in _.mixin. 2015-07-20 11:25:57 -07:00
John-David Dalton
8cc19d908e Drop boolean options param support in _.debounce and _.throttle. 2015-07-20 11:25:57 -07:00
John-David Dalton
d58cda122d Remove _.bindAll support for binding all methods when no method names are provided. 2015-07-20 11:25:56 -07:00
John-David Dalton
ab26945eca Add _.extend and make it and _.defaults, _.defaultsDeep, and _.merge iterate over inherited properties. 2015-07-20 11:25:56 -07:00
John-David Dalton
2da1b2af1a Drop boolean orders param support in _.sortByOrder. 2015-07-20 11:25:56 -07:00
John-David Dalton
2586129dcd Replace arrayCopy and baseCopy with copyArray, copyObject, and copyObjectWith. 2015-07-20 11:25:56 -07:00
John-David Dalton
13e5d77041 Remove iOS 4.3 in sauce because they're eoling it. 2015-07-20 11:25:56 -07:00
John-David Dalton
d036ff6c4f Drop IE 6/7 testing. 2015-07-20 11:25:56 -07:00
jdalton
1f1bc393d3 Cleanup docs for deep methods and those that accept customizer functions. [ci skip] 2015-07-20 11:25:56 -07:00
jdalton
9aa34e2487 Remove isDeep params from _.clone and _.flatten. 2015-07-20 11:25:56 -07:00
jdalton
0b7bffe3b5 Use more descriptive var names when mapping falsey values. 2015-07-20 11:25:56 -07:00
jdalton
41f248f54d Split out _.sortedIndex and _.sortedLastIndex into _.sortedIndexBy and _.sortedLastIndexBy. 2015-07-20 11:25:55 -07:00
jdalton
bc7cabde4e Cleanup forEach and friends doc examples. [ci skip] 2015-07-20 11:25:55 -07:00
jdalton
65d5bba7df Make _.maxBy, _.minBy, _.sumBy, & _.uniqBy support only arrays and provide only 1 argument to iteratees. 2015-07-20 11:25:55 -07:00
jdalton
340a6d195f Add _.sumBy. 2015-07-20 11:25:55 -07:00
jdalton
83ac168664 Simplify getIteratee assignments in methods. 2015-07-20 11:25:55 -07:00
jdalton
8ac1a67b7d Split _.uniq out into _.uniqBy. 2015-07-20 11:25:55 -07:00
jdalton
abd67d0786 Remove alias jsdoc tags for those no longer supported. [ci skip] 2015-07-20 11:25:55 -07:00
jdalton
9a9e4cddd7 Rename baseExtremumBy and createExtremumBy helpers. 2015-07-20 11:25:55 -07:00
jdalton
10c44b08c9 Reduce the number of function creator helpers to improve readabilty. 2015-07-20 11:25:54 -07:00
jdalton
86b19f742c Split _.max and _.min out into _.maxBy and _.minBy. 2015-07-20 11:25:54 -07:00
jdalton
cb94b03e3e Document more default params. [ci skip] 2015-07-20 11:25:54 -07:00
jdalton
a898c3d7bc Absorb _.sortByAll into _.sortBy. 2015-07-20 11:25:54 -07:00
jdalton
86be6d7897 Move resolve doc helpers higher in their example blocks. [ci skip] 2015-07-20 11:25:54 -07:00
jdalton
d3d4de12be Rename pickByCallback to pickByPredicate. 2015-07-20 11:25:54 -07:00
jdalton
04bac321d1 Cleanup doc examples. [ci skip] 2015-07-20 11:25:54 -07:00
jdalton
1011353729 Adjust guard doc notes. [ci skip] 2015-07-20 11:25:54 -07:00
jdalton
5651993d93 Use var toIteratee instead of callback. 2015-07-20 11:25:54 -07:00
jdalton
c51466935c Rename bindCallback to toFunction. 2015-07-20 11:25:54 -07:00
John-David Dalton
454aca7003 Remove thisArg params from most methods. 2015-07-20 11:25:53 -07:00
jdalton
5ff9f01aba Remove _.findWhere, _.pluck, & _.where. 2015-07-20 11:25:53 -07:00
jdalton
b5dd2e605d Make _.forEach and friends implicitly end a chain sequence. 2015-07-20 11:25:53 -07:00
jdalton
1bfe25f1a5 Remove aliases and rename _.callback to _.iteratee. 2015-07-20 11:25:53 -07:00
jdalton
bd98779b3c Fix test fails related to root._. 2015-07-20 11:25:53 -07:00
jdalton
7862ae6d36 Adjust UMD to export to window or self when available regardless of other exports. 2015-07-20 11:25:53 -07:00
78 changed files with 45541 additions and 29522 deletions

View File

@@ -4,15 +4,9 @@
root = true
[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
[**.{js,json,md}]
indent_style = space
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
[**.html]
indent_style = tab
insert_final_newline = false
trim_trailing_whitespace = true

1
.gitignore vendored
View File

@@ -3,4 +3,5 @@
*.log
*.map
lodash.compat.min.js
coverage
node_modules

96
.jscsrc Normal file
View File

@@ -0,0 +1,96 @@
{
"maxErrors": "2000",
"maximumLineLength": {
"value": 180,
"allExcept": ["comments", "functionSignature", "regex"]
},
"requireCurlyBraces": [
"if",
"else",
"for",
"while",
"do",
"try",
"catch"
],
"requireOperatorBeforeLineBreak": [
"=",
"+",
"-",
"/",
"*",
"==",
"===",
"!=",
"!==",
">",
">=",
"<",
"<="
],
"requireSpaceAfterKeywords": [
"if",
"else",
"for",
"while",
"do",
"switch",
"return",
"try",
"catch"
],
"requireSpaceBeforeBinaryOperators": [
"=", "+=", "-=", "*=", "/=", "%=", "<<=", ">>=", ">>>=",
"&=", "|=", "^=", "+=",
"+", "-", "*", "/", "%", "<<", ">>", ">>>", "&",
"|", "^", "&&", "||", "===", "==", ">=",
"<=", "<", ">", "!=", "!=="
],
"requireSpacesInFunctionExpression": {
"beforeOpeningCurlyBrace": true
},
"requireCamelCaseOrUpperCaseIdentifiers": true,
"requireDotNotation": { "allExcept": ["keywords"] },
"requireEarlyReturn": true,
"requireLineFeedAtFileEnd": true,
"requireSemicolons": true,
"requireSpaceAfterBinaryOperators": true,
"requireSpacesInConditionalExpression": true,
"requireSpaceBeforeObjectValues": true,
"requireSpaceBeforeBlockStatements": true,
"requireSpacesInForStatement": true,
"validateIndentation": 2,
"validateParameterSeparator": ", ",
"validateQuoteMarks": { "mark": "'", "escape": true },
"disallowSpacesInAnonymousFunctionExpression": {
"beforeOpeningRoundBrace": true
},
"disallowSpacesInFunctionDeclaration": {
"beforeOpeningRoundBrace": true
},
"disallowSpacesInFunctionExpression": {
"beforeOpeningRoundBrace": true
},
"disallowKeywords": ["with"],
"disallowMixedSpacesAndTabs": true,
"disallowMultipleLineBreaks": true,
"disallowNewlineBeforeBlockStatements": true,
"disallowSpaceAfterObjectKeys": true,
"disallowSpaceAfterPrefixUnaryOperators": true,
"disallowSpacesInCallExpression": true,
"disallowSpacesInsideArrayBrackets": true,
"disallowSpacesInsideParentheses": true,
"disallowTrailingWhitespace": true,
"jsDoc": {
"checkRedundantAccess": true,
"checkTypes": true,
"requireNewlineAfterDescription": true,
"requireParamDescription": true,
"requireParamTypes": true,
"requireReturnTypes": true
}
}

View File

@@ -1,39 +1,25 @@
language: node_js
sudo: false
node_js:
- "0.12"
- "5"
env:
global:
- PATTERN1="s|\s*else\s*\{\s*iteratee\(index\);\s*\}||"
- BIN="node" BUILD="compat" ISTANBUL=false OPTION=""
- NPM_VERSION="^2.0.0" SAUCE_LABS=false SAUCE_USERNAME="lodash"
- BIN="node" ISTANBUL=false OPTION=""
- SAUCE_LABS=false SAUCE_USERNAME="lodash"
- secure: "tg1JFsIFnxzLaTboFPOnm+aJCuMm5+JdhLlESlqg9x3fwro++7KCnwHKLNovhchaPe4otC43ZMB/nfWhDnDm11dKbm/V6HlTkED+dadTsaLxVDg6J+7yK41QhokBPJOxLV78iDaNaAQVYEirAgZ0yn8kFubxmNKV+bpCGQNc9yU="
matrix:
- BUILD="compat"
- BUILD="modern"
- BUILD="modern"
- BUILD="modern" ISTANBUL=true
-
- BIN="phantomjs"
- BIN="rhino" OPTION="-opt -1"
- BIN="rhino" OPTION="-opt -1 -require"
- BIN="ringo" OPTION="-o -1"
- ISTANBUL=true
- SAUCE_LABS=true
matrix:
include:
- node_js: "iojs"
env:
- node_js: "iojs"
env: BUILD="modern"
- node_js: "0.8"
env: NPM_VERSION="~1.4.0"
- node_js: "0.8"
env: BUILD="modern" NPM_VERSION="~1.4.0"
- node_js: "0.10"
env:
- node_js: "0.10"
env: BUILD="modern"
- node_js: "0.12"
env: SAUCE_LABS=true
- node_js: "0.12"
env: SAUCE_LABS=true BUILD="modern"
env:
- node_js: "4"
env:
git:
depth: 10
branches:
@@ -47,30 +33,45 @@ notifications:
on_failure: always
before_install:
- "nvm use $TRAVIS_NODE_VERSION"
- "npm config set loglevel error"
- "npm i -g npm@\"$NPM_VERSION\""
- "[ $SAUCE_LABS == false ] || npm i chalk@\"^1.0.0\" ecstatic@\"0.8.0\" request@\"^2.0.0\" sauce-tunnel@\"2.2.3\""
- "[ $ISTANBUL == false ] || (npm i -g coveralls@\"^2.0.0\" && npm i istanbul@\"0.3.17\")"
- "[ $BIN != 'rhino' ] || (sudo mkdir /opt/rhino-1.7.6 && sudo wget --no-check-certificate -O $_/js.jar https://lodash.com/_travis/rhino-1.7.6.jar)"
- "[ $BIN != 'rhino' ] || (echo -e '#!/bin/sh\\njava -jar /opt/rhino-1.7.6/js.jar $@' | sudo tee /usr/local/bin/rhino && sudo chmod +x /usr/local/bin/rhino)"
- "[ $BIN != 'ringo' ] || (wget --no-check-certificate https://lodash.com/_travis/ringojs-0.11.zip && sudo unzip ringojs-0.11 -d /opt && rm ringojs-0.11.zip)"
- "[ $BIN != 'ringo' ] || (sudo ln -s /opt/ringojs-0.11/bin/ringo /usr/local/bin/ringo && sudo chmod +x $_)"
- "perl -pi -e 's|\"lodash\"|\"lodash-compat\"|' ./package.json"
- "git clone --depth=10 --branch=master git://github.com/lodash/lodash-cli ./node_modules/lodash-cli && mkdir $_/node_modules && cd $_ && ln -s ../../../ ./lodash-compat && cd ../ && npm i && cd ../../"
- "node ./node_modules/lodash-cli/bin/lodash $BUILD -o ./lodash.$BUILD.js"
- "npm set loglevel error"
- "npm set progress false"
- "npm i -g npm@\"^2.0.0\""
- |
PATTERN[0]="|\s*if\s*\(isHostObject\b[\s\S]+?\}(?=\n)|"
PATTERN[1]="|\s*if\s*\(enumerate\b[\s\S]+?\};\s*\}|"
PATTERN[2]="|\s*while\s*\([^)]+\)\s*\{\s*iteratee\(index\);\s*\}|"
PATTERN[3]="|\s*else\s*\{\s*assocSet\(data\b[\s\S]+?\}|"
PATTERN[4]="|\s*if\s*\(ctorString\b[\s\S]+?\}\s*\}|"
PATTERN[5]="|\bindex,\s*iterable\)\s*===\s*false\)[^}]+?(break;)|"
PATTERN[6]="|\s*if\s*\(!lodashFunc\)\s*\{\s*return;\s*\}|"
PATTERN[7]="|\s*define\([\s\S]+?\);|"
PATTERN[8]="|\s*root\._\s*=\s*_;|"
if [ $ISTANBUL == true ]; then
set -e
for PTRN in ${PATTERN[@]}; do
node ./test/remove.js "$PTRN" ./lodash.js
done
fi
- "git clone --depth=10 --branch=master git://github.com/lodash/lodash-cli ./node_modules/lodash-cli && mkdir $_/node_modules && cd $_ && ln -s ../../../ ./lodash && cd ../ && npm i && cd ../../"
- "node ./node_modules/lodash-cli/bin/lodash -o ./dist/lodash.js"
script:
- "[ $ISTANBUL == false ] || cp ./lodash.$BUILD.js ./lodash.js"
- "[ $ISTANBUL == false ] || perl -0pi -e \"$PATTERN\" ./lodash.js"
- "[ $ISTANBUL == false ] || node ./node_modules/istanbul/lib/cli.js cover -x \"**/vendor/**\" --report lcovonly ./test/test.js -- ./lodash.js"
- "[ $ISTANBUL == false ] || istanbul cover -x \"**/vendor/**\" --report lcovonly ./test/test.js -- ./lodash.js"
- "[ $ISTANBUL == false ] || [ $TRAVIS_SECURE_ENV_VARS == false ] || (cat ./coverage/lcov.info | coveralls) || true"
- "[ $ISTANBUL == false ] || [ $TRAVIS_SECURE_ENV_VARS == false ] || (cat ./coverage/coverage.json | codecov) || true"
- "[ $SAUCE_LABS == true ] || [ $ISTANBUL == true ] || cd ./test"
- "[ $SAUCE_LABS == true ] || [ $ISTANBUL == true ] || $BIN $OPTION ./test.js ../lodash.$BUILD.js"
- "[ $SAUCE_LABS == true ] || [ $ISTANBUL == true ] || [ $TRAVIS_SECURE_ENV_VARS == false ] || $BIN $OPTION ./test.js ../lodash.$BUILD.min.js"
- "[ $SAUCE_LABS == false ] || $BIN ./test/saucelabs.js name=\"lodash tests\" runner=\"test/index.html?build=../lodash.$BUILD.js&noglobals=true\" tags=\"$BUILD,development\""
- "[ $SAUCE_LABS == false ] || $BIN ./test/saucelabs.js name=\"lodash tests\" runner=\"test/index.html?build=../lodash.$BUILD.min.js&noglobals=true\" tags=\"$BUILD,production\""
- "[ $SAUCE_LABS == false ] || [ $BUILD != 'compat' ] || $BIN ./test/saucelabs.js name=\"lodash tests\" runner=\"test/index.html?build=../lodash.$BUILD.js\" tags=\"$BUILD,development,ie-compat\" compatMode=7"
- "[ $SAUCE_LABS == false ] || [ $BUILD != 'compat' ] || $BIN ./test/saucelabs.js name=\"lodash tests\" runner=\"test/index.html?build=../lodash.$BUILD.min.js\" tags=\"$BUILD,production,ie-compat\" compatMode=7"
- "[ $SAUCE_LABS == false ] || $BIN ./test/saucelabs.js name=\"backbone tests\" runner=\"test/backbone.html?build=../lodash.$BUILD.min.js\" tags=\"$BUILD,production,backbone\""
- "[ $SAUCE_LABS == false ] || $BIN ./test/saucelabs.js name=\"backbone tests\" runner=\"test/backbone.html?build=../lodash.$BUILD.js\" tags=\"$BUILD,development,backbone\""
- "[ $SAUCE_LABS == false ] || $BIN ./test/saucelabs.js name=\"underscore tests\" runner=\"test/underscore.html?build=../lodash.$BUILD.min.js\" tags=\"$BUILD,production,underscore\""
- "[ $SAUCE_LABS == false ] || $BIN ./test/saucelabs.js name=\"underscore tests\" runner=\"test/underscore.html?build=../lodash.$BUILD.js\" tags=\"$BUILD,development,underscore\""
- "[ $SAUCE_LABS == true ] || [ $ISTANBUL == true ] || $BIN $OPTION ./test.js ../lodash.js"
- "[ $SAUCE_LABS == true ] || [ $ISTANBUL == true ] || [ $TRAVIS_SECURE_ENV_VARS == false ] || $BIN $OPTION ./test.js ../dist/lodash.min.js"
- "[ $SAUCE_LABS == false ] || rm -rf ./node_modules/lodash"
- "[ $SAUCE_LABS == false ] || ($BIN ./node_modules/lodash-cli/bin/lodash modularize exports=node -o ./node_modules/lodash && node ./node_modules/lodash-cli/bin/lodash -d -o ./node_modules/lodash/index.js)"
- "[ $SAUCE_LABS == false ] || $BIN ./node_modules/lodash-cli/bin/lodash core -o ./dist/lodash.core.js"
- "[ $SAUCE_LABS == false ] || npm run build"
- "[ $SAUCE_LABS == false ] || $BIN ./test/saucelabs.js name=\"lodash tests\" runner=\"test/index.html?build=../dist/lodash.js&noglobals=true\" tags=\"development\""
- "[ $SAUCE_LABS == false ] || $BIN ./test/saucelabs.js name=\"lodash tests\" runner=\"test/index.html?build=../dist/lodash.min.js&noglobals=true\" tags=\"production\""
- "[ $SAUCE_LABS == false ] || $BIN ./test/saucelabs.js name=\"lodash-fp tests\" runner=\"test/fp.html?noglobals=true\" tags=\"development\""
- "[ $SAUCE_LABS == false ] || $BIN ./test/saucelabs.js name=\"underscore tests\" runner=\"test/underscore.html?build=../dist/lodash.js\" tags=\"development,underscore\""
- "[ $SAUCE_LABS == false ] || $BIN ./test/saucelabs.js name=\"underscore tests\" runner=\"test/underscore.html?build=../dist/lodash.min.js\" tags=\"production,underscore\""
- "[ $SAUCE_LABS == false ] || $BIN ./test/saucelabs.js name=\"backbone tests\" runner=\"test/backbone.html?build=../dist/lodash.js\" tags=\"development,backbone\""
- "[ $SAUCE_LABS == false ] || $BIN ./test/saucelabs.js name=\"backbone tests\" runner=\"test/backbone.html?build=../dist/lodash.min.js\" tags=\"production,backbone\""
- "[ $SAUCE_LABS == false ] || $BIN ./test/saucelabs.js name=\"backbone tests\" runner=\"test/backbone.html?build=../dist/lodash.core.js\" tags=\"development,backbone\""
- "[ $SAUCE_LABS == false ] || $BIN ./test/saucelabs.js name=\"backbone tests\" runner=\"test/backbone.html?build=../dist/lodash.core.min.js\" tags=\"production,backbone\""

49
CODE_OF_CONDUCT.md Normal file
View File

@@ -0,0 +1,49 @@
# Contributor Code of Conduct
As contributors and maintainers of this project, and in the interest of
fostering an open and welcoming community, we pledge to respect all people who
contribute through reporting issues, posting feature requests, updating
documentation, submitting pull requests or patches, and other activities.
We are committed to making participation in this project a harassment-free
experience for everyone, regardless of level of experience, gender, gender
identity and expression, sexual orientation, disability, personal appearance,
body size, race, ethnicity, age, religion, or nationality.
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery
* Personal attacks
* Trolling or insulting/derogatory comments
* Public or private harassment
* Publishing other's private information, such as physical or electronic
addresses, without explicit permission
* Other unethical or unprofessional conduct
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
By adopting this Code of Conduct, project maintainers commit themselves to
fairly and consistently applying these principles to every aspect of managing
this project. Project maintainers who do not follow or enforce the Code of
Conduct may be permanently removed from the project team.
This code of conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community.
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting a project maintainer at
[coc@lodash.com](mailto:coc@lodash.com). All complaints will be reviewed and
investigated and will result in a response that is deemed necessary and
appropriate to the circumstances. Maintainers are obligated to maintain
confidentiality with regard to the reporter of an incident.
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 1.3.0, available at
[http://contributor-covenant.org/version/1/3/0/][version]
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/3/0/

View File

@@ -1,17 +1,15 @@
# Contributing to lodash
If youd like to contribute a feature or bug fix, you can [fork](https://help.github.com/articles/fork-a-repo/) lodash, commit your changes, & [send a pull request](https://help.github.com/articles/using-pull-requests/).
Please make sure to [search the issue tracker](https://github.com/lodash/lodash/issues) first; your issue may have already been discussed or fixed in `master`.
Contributions are always welcome. Before contributing, please read the [code of conduct](https://github.com/lodash/lodash/blob/master/CODE_OF_CONDUCT.md) & [search the issue tracker](https://github.com/lodash/lodash/issues);
your issue may have already been discussed or fixed in `master`. To contribute, [fork](https://help.github.com/articles/fork-a-repo/) lodash, commit your changes, & [send a pull request](https://help.github.com/articles/using-pull-requests/).
## Tests
Include updated unit tests in the `test` directory as part of your pull request.
Dont worry about regenerating the documentation, lodash.js, or lodash.min.js.
Dont worry about regenerating the `dist/` or `doc/` files.
Before running the unit tests youll need to install, `npm i`, [development dependencies](https://docs.npmjs.com/files/package.json#devdependencies).
Run unit tests from the command-line via `node test/test`, or open `test/index.html` in a web browser.
The `test/run-test.sh` script attempts to run the tests in [Rhino](https://developer.mozilla.org/en-US/docs/Mozilla/Projects/Rhino), [RingoJS](http://ringojs.org/), [PhantomJS](http://phantomjs.org/), & [Node](http://nodejs.org/), before running them in your default browser.
Run unit tests from the command-line via `npm test`, or open `test/index.html` & `test/fp.html` in a web browser.
The [Backbone](http://backbonejs.org/) & [Underscore](http://underscorejs.org/) test suites are included as well.
## Contributor License Agreement
@@ -36,4 +34,10 @@ In addition to the following guidelines, please follow the conventions already e
Single-quoted strings are preferred to double-quoted strings; however, please use a double-quoted string if the value contains a single-quote character to avoid unnecessary escaping.
- **Comments**:<br>
Please use single-line comments to annotate significant additions, & [JSDoc-style](http://www.2ality.com/2011/08/jsdoc-intro.html) comments for new methods.
Please use single-line comments to annotate significant additions, & [JSDoc-style](http://www.2ality.com/2011/08/jsdoc-intro.html) comments for functions.
Guidelines are enforced using [JSCS](https://www.npmjs.com/package/jscs):
```bash
$ npm run style
```

View File

@@ -1,5 +1,5 @@
Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
Based on Underscore.js, copyright 2009-2015 Jeremy Ashkenas,
Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/>
Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas,
DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
Permission is hereby granted, free of charge, to any person obtaining

View File

@@ -1,29 +1,30 @@
# lodash v3.10.1
# lodash v4.2.1
The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash](https://lodash.com/) with packages for [Bower](http://bower.io/), [Component](http://component.github.io/), & [Volo](http://volojs.org/).
The [lodash](https://lodash.com/) library exported as a [UMD](https://github.com/umdjs/umd) module.
Generated using [lodash-cli](https://www.npmjs.com/package/lodash-cli):
```bash
$ lodash modern -o ./lodash.js
$ npm run build
$ lodash -o ./dist/lodash.js
$ lodash core -o ./dist/lodash.core.js
```
## Community
[![Join the chat at https://gitter.im/lodash/lodash](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/lodash/lodash)
[![Gitter](https://badges.gitter.im/lodash/lodash.svg)](https://gitter.im/lodash/lodash)
## Module formats
lodash is also available in a variety of other builds & module formats.
Lodash is available in a variety of other builds & module formats.
* 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
* 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
* ES modules for the [modern](https://github.com/lodash/lodash/tree/3.10.1-es) build
* [lodash](https://www.npmjs.com/package/lodash) & [per method packages](https://www.npmjs.com/browse/keyword/lodash-modularized)
* [lodash-amd](https://www.npmjs.com/package/lodash-amd)
* [lodash-es](https://www.npmjs.com/package/lodash-es) & [babel-plugin-lodash](https://www.npmjs.com/package/babel-plugin-lodash)
## Further Reading
* [API Documentation](https://lodash.com/docs)
* [Build Differences](https://github.com/lodash/lodash/wiki/Build-Differences)
* [Changelog](https://github.com/lodash/lodash/wiki/Changelog)
* [Release Notes](https://github.com/lodash/lodash/releases)
* [Roadmap](https://github.com/lodash/lodash/wiki/Roadmap)
* [More Resources](https://github.com/lodash/lodash/wiki/Resources)

View File

@@ -1,19 +0,0 @@
{
"name": "lodash",
"main": "lodash.js",
"ignore": [
".*",
"*.custom.*",
"*.log",
"*.map",
"*.md",
"lodash.src.js",
"component.json",
"package.json",
"doc",
"node_modules",
"perf",
"test",
"vendor"
]
}

View File

@@ -1,10 +0,0 @@
{
"name": "lodash",
"repo": "lodash/lodash",
"version": "3.10.1",
"description": "The modern build of lodash.",
"license": "MIT",
"main": "lodash.js",
"keywords": ["stdlib", "util"],
"scripts": ["lodash.js"]
}

3814
dist/lodash.core.js vendored Normal file

File diff suppressed because it is too large Load Diff

30
dist/lodash.core.min.js vendored Normal file
View File

@@ -0,0 +1,30 @@
/**
* @license
* lodash 4.2.1 (Custom Build) lodash.com/license | Underscore.js 1.8.3 underscorejs.org/LICENSE
* Build: `lodash core -o ./dist/lodash.core.js`
*/
;(function(){function n(n,t){for(var r=-1,e=t.length,u=n.length;++r<e;)n[u+r]=t[r];return n}function t(n,t,r){for(var e=-1,u=n.length;++e<u;){var o=n[e],i=t(o);if(null!=i&&(c===an?i===i:r(i,c)))var c=i,f=o}return f}function r(n,t,r){var e;return r(n,function(n,r,u){return t(n,r,u)?(e=n,false):void 0}),e}function e(n,t,r,e,u){return u(n,function(n,u,o){r=e?(e=false,n):t(r,n,u,o)}),r}function u(n,t){return w(t,function(t){return n[t]})}function o(n){return n&&n.Object===Object?n:null}function i(n){return hn[n];
}function c(n){var t=false;if(null!=n&&typeof n.toString!="function")try{t=!!(n+"")}catch(r){}return t}function f(n,t){return n=typeof n=="number"||sn.test(n)?+n:-1,n>-1&&0==n%1&&(null==t?9007199254740991:t)>n}function a(n){if(Y(n)&&!Mn(n)){if(n instanceof l)return n;if(xn.call(n,"__wrapped__")){var t=new l(n.__wrapped__,n.__chain__);return t.__actions__=k(n.__actions__),t}}return new l(n)}function l(n,t){this.__wrapped__=n,this.__actions__=[],this.__chain__=!!t}function p(n,t,r,e){return n===an||V(n,On[r])&&!xn.call(e,r)?t:n;
}function s(n,t,r){if(typeof n!="function")throw new TypeError("Expected a function");return setTimeout(function(){n.apply(an,r)},t)}function h(n,t){var r=true;return In(n,function(n,e,u){return r=!!t(n,e,u)}),r}function v(n,t){var r=[];return In(n,function(n,e,u){t(n,e,u)&&r.push(n)}),r}function y(t,r,e,u){u||(u=[]);for(var o=-1,i=t.length;++o<i;){var c=t[o];Y(c)&&L(c)&&(e||Mn(c)||K(c))?r?y(c,r,e,u):n(u,c):e||(u[u.length]=c)}return u}function _(n,t){return n&&$n(n,t,en)}function g(n,t){return v(t,function(t){
return Q(n[t])})}function b(n,t,r,e,u){return n===t?true:null==n||null==t||!X(n)&&!Y(t)?n!==n&&t!==t:j(n,t,b,r,e,u)}function j(n,t,r,e,u,o){var i=Mn(n),f=Mn(t),a="[object Array]",l="[object Array]";i||(a=An.call(n),"[object Arguments]"==a&&(a="[object Object]")),f||(l=An.call(t),"[object Arguments]"==l&&(l="[object Object]"));var p="[object Object]"==a&&!c(n),f="[object Object]"==l&&!c(t);return!(l=a==l)||i||p?2&u||(a=p&&xn.call(n,"__wrapped__"),f=f&&xn.call(t,"__wrapped__"),!a&&!f)?l?(o||(o=[]),(a=G(o,function(t){
return t[0]===n}))&&a[1]?a[1]==t:(o.push([n,t]),t=(i?D:$)(n,t,r,e,u,o),o.pop(),t)):false:r(a?n.value():n,f?t.value():t,e,u,o):I(n,t,a)}function m(n){var t=typeof n;return"function"==t?n:null==n?cn:("object"==t?O:E)(n)}function d(n){n=null==n?n:Object(n);var t,r=[];for(t in n)r.push(t);return r}function w(n,t){var r=-1,e=L(n)?Array(n.length):[];return In(n,function(n,u,o){e[++r]=t(n,u,o)}),e}function O(n){var t=en(n);return function(r){var e=t.length;if(null==r)return!e;for(r=Object(r);e--;){var u=t[e];
if(!(u in r&&b(n[u],r[u],an,3)))return false}return true}}function x(n,t){return n=Object(n),M(t,function(t,r){return r in n&&(t[r]=n[r]),t},{})}function E(n){return function(t){return null==t?an:t[n]}}function A(n,t,r){var e=-1,u=n.length;for(0>t&&(t=-t>u?0:u+t),r=r>u?u:r,0>r&&(r+=u),u=t>r?0:r-t>>>0,t>>>=0,r=Array(u);++e<u;)r[e]=n[e+t];return r}function k(n){return A(n,0,n.length)}function N(n,t){var r;return In(n,function(n,e,u){return r=t(n,e,u),!r}),!!r}function S(t,r){return M(r,function(t,r){return r.func.apply(r.thisArg,n([t],r.args));
},t)}function T(n,t,r,e){r||(r={});for(var u=-1,o=t.length;++u<o;){var i=t[u],c=e?e(r[i],n[i],i,r,n):n[i],f=r,a=f[i];(!V(a,c)||V(a,On[i])&&!xn.call(f,i)||c===an&&!(i in f))&&(f[i]=c)}return r}function F(n){return U(function(t,r){var e=-1,u=r.length,o=u>1?r[u-1]:an,o=typeof o=="function"?(u--,o):an;for(t=Object(t);++e<u;){var i=r[e];i&&n(t,i,e,o)}return t})}function B(n){return function(){var t=arguments,r=Dn(n.prototype),t=n.apply(r,t);return X(t)?t:r}}function R(n,t,r){function e(){for(var o=-1,i=arguments.length,c=-1,f=r.length,a=Array(f+i),l=this&&this!==dn&&this instanceof e?u:n;++c<f;)a[c]=r[c];
for(;i--;)a[c++]=arguments[++o];return l.apply(t,a)}if(typeof n!="function")throw new TypeError("Expected a function");var u=B(n);return e}function D(n,t,r,e,u,o){var i=-1,c=1&u,f=n.length,a=t.length;if(f!=a&&!(2&u&&a>f))return false;for(a=true;++i<f;){var l=n[i],p=t[i];if(void 0!==an){a=false;break}if(c){if(!N(t,function(n){return l===n||r(l,n,e,u,o)})){a=false;break}}else if(l!==p&&!r(l,p,e,u,o)){a=false;break}}return a}function I(n,t,r){switch(r){case"[object Boolean]":case"[object Date]":return+n==+t;case"[object Error]":
return n.name==t.name&&n.message==t.message;case"[object Number]":return n!=+n?t!=+t:n==+t;case"[object RegExp]":case"[object String]":return n==t+""}return false}function $(n,t,r,e,u,o){var i=2&u,c=en(n),f=c.length,a=en(t).length;if(f!=a&&!i)return false;for(var l=f;l--;){var p=c[l];if(!(i?p in t:xn.call(t,p)))return false}for(a=true;++l<f;){var p=c[l],s=n[p],h=t[p];if(void 0!==an||s!==h&&!r(s,h,e,u,o)){a=false;break}i||(i="constructor"==p)}return a&&!i&&(r=n.constructor,e=t.constructor,r!=e&&"constructor"in n&&"constructor"in t&&!(typeof r=="function"&&r instanceof r&&typeof e=="function"&&e instanceof e)&&(a=false)),
a}function q(n){var t=n?n.length:an;if(W(t)&&(Mn(n)||nn(n)||K(n))){n=String;for(var r=-1,e=Array(t);++r<t;)e[r]=n(r);t=e}else t=null;return t}function z(n){var t=n&&n.constructor;return n===(typeof t=="function"&&t.prototype||On)}function C(n){return n?n[0]:an}function G(n,t){return r(n,m(t),In)}function J(n,t){return In(n,typeof t=="function"?t:cn)}function M(n,t,r){return e(n,m(t),r,3>arguments.length,In)}function P(n,t){var r;if(typeof t!="function")throw new TypeError("Expected a function");return n=Pn(n),
function(){return 0<--n&&(r=t.apply(this,arguments)),1>=n&&(t=an),r}}function U(n){var t;if(typeof n!="function")throw new TypeError("Expected a function");return t=Rn(t===an?n.length-1:Pn(t),0),function(){for(var r=arguments,e=-1,u=Rn(r.length-t,0),o=Array(u);++e<u;)o[e]=r[t+e];for(u=Array(t+1),e=-1;++e<t;)u[e]=r[e];return u[t]=o,n.apply(this,u)}}function V(n,t){return n===t||n!==n&&t!==t}function H(n,t){return n>t}function K(n){return Y(n)&&L(n)&&xn.call(n,"callee")&&(!Tn.call(n,"callee")||"[object Arguments]"==An.call(n));
}function L(n){return null!=n&&!(typeof n=="function"&&Q(n))&&W(qn(n))}function Q(n){return n=X(n)?An.call(n):"","[object Function]"==n||"[object GeneratorFunction]"==n}function W(n){return typeof n=="number"&&n>-1&&0==n%1&&9007199254740991>=n}function X(n){var t=typeof n;return!!n&&("object"==t||"function"==t)}function Y(n){return!!n&&typeof n=="object"}function Z(n){return typeof n=="number"||Y(n)&&"[object Number]"==An.call(n)}function nn(n){return typeof n=="string"||!Mn(n)&&Y(n)&&"[object String]"==An.call(n);
}function tn(n,t){return t>n}function rn(n){return typeof n=="string"?n:null==n?"":n+""}function en(n){var t=z(n);if(!t&&!L(n))return Bn(Object(n));var r,e=q(n),u=!!e,e=e||[],o=e.length;for(r in n)!xn.call(n,r)||u&&("length"==r||f(r,o))||t&&"constructor"==r||e.push(r);return e}function un(n){for(var t=-1,r=z(n),e=d(n),u=e.length,o=q(n),i=!!o,o=o||[],c=o.length;++t<u;){var a=e[t];i&&("length"==a||f(a,c))||"constructor"==a&&(r||!xn.call(n,a))||o.push(a)}return o}function on(n){return n?u(n,en(n)):[];
}function cn(n){return n}function fn(t,r,e){var u=en(r),o=g(r,u);null!=e||X(r)&&(o.length||!u.length)||(e=r,r=t,t=this,o=g(r,en(r)));var i=X(e)&&"chain"in e?e.chain:true,c=Q(t);return In(o,function(e){var u=r[e];t[e]=u,c&&(t.prototype[e]=function(){var r=this.__chain__;if(i||r){var e=t(this.__wrapped__);return(e.__actions__=k(this.__actions__)).push({func:u,args:arguments,thisArg:t}),e.__chain__=r,e}return u.apply(t,n([this.value()],arguments))})}),t}var an,ln=/[&<>"'`]/g,pn=RegExp(ln.source),sn=/^(?:0|[1-9]\d*)$/,hn={
"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","`":"&#96;"},vn={"function":true,object:true},yn=vn[typeof exports]&&exports&&!exports.nodeType?exports:null,_n=vn[typeof module]&&module&&!module.nodeType?module:null,gn=o(vn[typeof self]&&self),bn=o(vn[typeof window]&&window),jn=_n&&_n.exports===yn?yn:null,mn=o(vn[typeof this]&&this),dn=o(yn&&_n&&typeof global=="object"&&global)||bn!==(mn&&mn.window)&&bn||gn||mn||Function("return this")(),wn=Array.prototype,On=Object.prototype,xn=On.hasOwnProperty,En=0,An=On.toString,kn=dn._,Nn=dn.f,Sn=Nn?Nn.g:an,Tn=On.propertyIsEnumerable,Fn=dn.isFinite,Bn=Object.keys,Rn=Math.max,Dn=function(){
function n(){}return function(t){if(X(t)){n.prototype=t;var r=new n;n.prototype=an}return r||{}}}(),In=function(n,t){return function(r,e){if(null==r)return r;if(!L(r))return n(r,e);for(var u=r.length,o=t?u:-1,i=Object(r);(t?o--:++o<u)&&false!==e(i[o],o,i););return r}}(_),$n=function(n){return function(t,r,e){var u=-1,o=Object(t);e=e(t);for(var i=e.length;i--;){var c=e[n?i:++u];if(false===r(o[c],c,o))break}return t}}();Sn&&!Tn.call({valueOf:1},"valueOf")&&(d=function(n){n=Sn(n);for(var t,r=[];!(t=n.next()).done;)r.push(t.value);
return r});var qn=E("length"),zn=U(function(t,r){return Mn(t)||(t=null==t?[]:[Object(t)]),y(r),n(k(t),on)}),Cn=U(function(n,t,r){return R(n,t,r)}),Gn=U(function(n,t){return s(n,1,t)}),Jn=U(function(n,t,r){return s(n,Un(t)||0,r)}),Mn=Array.isArray,Pn=Number,Un=Number,Vn=F(function(n,t){T(t,en(t),n)}),Hn=F(function(n,t){T(t,un(t),n)}),Kn=F(function(n,t,r,e){T(t,un(t),n,e)}),Ln=U(function(n){return n.push(an,p),Kn.apply(an,n)}),Qn=U(function(n,t){return null==n?{}:x(n,y(t))}),Wn=m;l.prototype=Dn(a.prototype),
l.prototype.constructor=l,a.assignIn=Hn,a.before=P,a.bind=Cn,a.chain=function(n){return n=a(n),n.__chain__=true,n},a.compact=function(n){return v(n,Boolean)},a.concat=zn,a.create=function(n,t){var r=Dn(n);return t?Vn(r,t):r},a.defaults=Ln,a.defer=Gn,a.delay=Jn,a.filter=function(n,t){return v(n,m(t))},a.flatten=function(n){return n&&n.length?y(n):[]},a.flattenDeep=function(n){return n&&n.length?y(n,true):[]},a.iteratee=Wn,a.keys=en,a.map=function(n,t){return w(n,m(t))},a.matches=function(n){return O(Vn({},n));
},a.mixin=fn,a.negate=function(n){if(typeof n!="function")throw new TypeError("Expected a function");return function(){return!n.apply(this,arguments)}},a.once=function(n){return P(2,n)},a.pick=Qn,a.slice=function(n,t,r){var e=n?n.length:0;return r=r===an?e:+r,e?A(n,null==t?0:+t,r):[]},a.sortBy=function(n,t){var r=0;return t=m(t),w(w(n,function(n,e,u){return{c:n,b:r++,a:t(n,e,u)}}).sort(function(n,t){var r;n:{r=n.a;var e=t.a;if(r!==e){var u=null===r,o=r===an,i=r===r,c=null===e,f=e===an,a=e===e;if(r>e&&!c||!i||u&&!f&&a||o&&a){
r=1;break n}if(e>r&&!u||!a||c&&!o&&i||f&&i){r=-1;break n}}r=0}return r||n.b-t.b}),E("c"))},a.tap=function(n,t){return t(n),n},a.thru=function(n,t){return t(n)},a.toArray=function(n){return L(n)?n.length?k(n):[]:on(n)},a.values=on,a.extend=Hn,fn(a,a),a.clone=function(n){return X(n)?Mn(n)?k(n):T(n,en(n)):n},a.escape=function(n){return(n=rn(n))&&pn.test(n)?n.replace(ln,i):n},a.every=function(n,t,r){return t=r?an:t,h(n,m(t))},a.find=G,a.forEach=J,a.has=function(n,t){return null!=n&&xn.call(n,t)},a.head=C,
a.identity=cn,a.indexOf=function(n,t,r){var e=n?n.length:0;r=typeof r=="number"?0>r?Rn(e+r,0):r:0,r=(r||0)-1;for(var u=t===t;++r<e;){var o=n[r];if(u?o===t:o!==o)return r}return-1},a.isArguments=K,a.isArray=Mn,a.isBoolean=function(n){return true===n||false===n||Y(n)&&"[object Boolean]"==An.call(n)},a.isDate=function(n){return Y(n)&&"[object Date]"==An.call(n)},a.isEmpty=function(n){if(L(n)&&(Mn(n)||nn(n)||Q(n.splice)||K(n)))return!n.length;for(var t in n)if(xn.call(n,t))return false;return true},a.isEqual=function(n,t){
return b(n,t)},a.isFinite=function(n){return typeof n=="number"&&Fn(n)},a.isFunction=Q,a.isNaN=function(n){return Z(n)&&n!=+n},a.isNull=function(n){return null===n},a.isNumber=Z,a.isObject=X,a.isRegExp=function(n){return X(n)&&"[object RegExp]"==An.call(n)},a.isString=nn,a.isUndefined=function(n){return n===an},a.last=function(n){var t=n?n.length:0;return t?n[t-1]:an},a.max=function(n){return n&&n.length?t(n,cn,H):an},a.min=function(n){return n&&n.length?t(n,cn,tn):an},a.noConflict=function(){return dn._===this&&(dn._=kn),
this},a.noop=function(){},a.reduce=M,a.result=function(n,t,r){return t=null==n?an:n[t],t===an&&(t=r),Q(t)?t.call(n):t},a.size=function(n){return null==n?0:(n=L(n)?n:en(n),n.length)},a.some=function(n,t,r){return t=r?an:t,N(n,m(t))},a.uniqueId=function(n){var t=++En;return rn(n)+t},a.each=J,a.first=C,fn(a,function(){var n={};return _(a,function(t,r){xn.call(a.prototype,r)||(n[r]=t)}),n}(),{chain:false}),a.VERSION="4.2.1",In("pop join replace reverse split push shift sort splice unshift".split(" "),function(n){
var t=(/^(?:replace|split)$/.test(n)?String.prototype:wn)[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:pop|join|replace|shift)$/.test(n);a.prototype[n]=function(){var n=arguments;return e&&!this.__chain__?t.apply(this.value(),n):this[r](function(r){return t.apply(r,n)})}}),a.prototype.toJSON=a.prototype.valueOf=a.prototype.value=function(){return S(this.__wrapped__,this.__actions__)},(bn||gn||{})._=a,typeof define=="function"&&typeof define.amd=="object"&&define.amd? define(function(){
return a}):yn&&_n?(jn&&((_n.exports=a)._=a),yn._=a):dn._=a}).call(this);

563
dist/lodash.fp.js vendored Normal file
View File

@@ -0,0 +1,563 @@
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else if(typeof exports === 'object')
exports["fp"] = factory();
else
root["fp"] = factory();
})(this, function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports, __webpack_require__) {
var baseConvert = __webpack_require__(1);
/**
* Converts `lodash` to an immutable auto-curried iteratee-first data-last version.
*
* @param {Function} lodash The lodash function.
* @returns {Function} Returns the converted `lodash`.
*/
function browserConvert(lodash) {
return baseConvert(lodash, lodash);
}
module.exports = browserConvert;
/***/ },
/* 1 */
/***/ function(module, exports, __webpack_require__) {
var mapping = __webpack_require__(2),
mutateMap = mapping.mutate,
placeholder = {};
/**
* The base implementation of `convert` which accepts a `util` object of methods
* required to perform conversions.
*
* @param {Object} util The util object.
* @param {string} name The name of the function to wrap.
* @param {Function} func The function to wrap.
* @returns {Function|Object} Returns the converted function or object.
*/
function baseConvert(util, name, func) {
if (typeof func != 'function') {
func = name;
name = undefined;
}
if (func == null) {
throw new TypeError;
}
var isLib = name === undefined && typeof func.VERSION == 'string';
var _ = isLib ? func : {
'ary': util.ary,
'cloneDeep': util.cloneDeep,
'curry': util.curry,
'forEach': util.forEach,
'isFunction': util.isFunction,
'iteratee': util.iteratee,
'keys': util.keys,
'rearg': util.rearg,
'spread': util.spread
};
var ary = _.ary,
cloneDeep = _.cloneDeep,
curry = _.curry,
each = _.forEach,
isFunction = _.isFunction,
keys = _.keys,
rearg = _.rearg,
spread = _.spread;
var baseArity = function(func, n) {
return n == 2
? function(a, b) { return func.apply(undefined, arguments); }
: function(a) { return func.apply(undefined, arguments); };
};
var baseAry = function(func, n) {
return n == 2
? function(a, b) { return func(a, b); }
: function(a) { return func(a); };
};
var cloneArray = function(array) {
var length = array ? array.length : 0,
result = Array(length);
while (length--) {
result[length] = array[length];
}
return result;
};
var createCloner = function(func) {
return function(object) {
return func({}, object);
};
};
var immutWrap = function(func, cloner) {
return overArg(func, cloner, true);
};
var iterateeAry = function(func, n) {
return overArg(func, function(func) {
return baseAry(func, n);
});
};
var iterateeRearg = function(func, indexes) {
return overArg(func, function(func) {
var n = indexes.length;
return baseArity(rearg(baseAry(func, n), indexes), n);
});
};
var overArg = function(func, iteratee, retArg) {
return function() {
var length = arguments.length,
args = Array(length);
while (length--) {
args[length] = arguments[length];
}
args[0] = iteratee(args[0]);
var result = func.apply(undefined, args);
return retArg ? args[0] : result;
};
};
var wrappers = {
'iteratee': function(iteratee) {
return function() {
var func = arguments[0],
arity = arguments[1];
arity = arity > 2 ? (arity - 2) : 1;
func = iteratee(func);
var length = func.length;
return (length && length <= arity) ? func : baseAry(func, arity);
};
},
'mixin': function(mixin) {
return function(source) {
var func = this;
if (!isFunction(func)) {
return mixin(func, Object(source));
}
var methods = [],
methodNames = [];
each(keys(source), function(key) {
var value = source[key];
if (isFunction(value)) {
methodNames.push(key);
methods.push(func.prototype[key]);
}
});
mixin(func, Object(source));
each(methodNames, function(methodName, index) {
var method = methods[index];
if (isFunction(method)) {
func.prototype[methodName] = method;
} else {
delete func.prototype[methodName];
}
});
return func;
};
},
'runInContext': function(runInContext) {
return function(context) {
return baseConvert(util, runInContext(context));
};
}
};
var wrap = function(name, func) {
name = mapping.aliasToReal[name] || name;
var wrapper = wrappers[name];
if (wrapper) {
return wrapper(func);
}
var wrapped = func;
if (mutateMap.array[name]) {
wrapped = immutWrap(func, cloneArray);
}
else if (mutateMap.object[name]) {
wrapped = immutWrap(func, createCloner(func));
}
else if (mutateMap.set[name]) {
wrapped = immutWrap(func, cloneDeep);
}
var result;
each(mapping.caps, function(cap) {
each(mapping.aryMethod[cap], function(otherName) {
if (name == otherName) {
var aryN = !isLib && mapping.iterateeAry[name],
reargIndexes = mapping.iterateeRearg[name],
spreadStart = mapping.methodSpread[name];
result = spreadStart === undefined
? ary(wrapped, cap)
: spread(wrapped, spreadStart);
if (cap > 1 && !mapping.skipRearg[name]) {
result = rearg(result, mapping.methodRearg[name] || mapping.aryRearg[cap]);
}
if (reargIndexes) {
result = iterateeRearg(result, reargIndexes);
} else if (aryN) {
result = iterateeAry(result, aryN);
}
if (cap > 1) {
result = curry(result, cap);
}
return false;
}
});
return !result;
});
result || (result = func);
if (mapping.placeholder[name]) {
func.placeholder = result.placeholder = placeholder;
}
return result;
};
if (!isLib) {
return wrap(name, func);
}
// Add placeholder.
_.placeholder = placeholder;
// Iterate over methods for the current ary cap.
var pairs = [];
each(mapping.caps, function(cap) {
each(mapping.aryMethod[cap], function(key) {
var func = _[mapping.rename[key] || key];
if (func) {
pairs.push([key, wrap(key, func)]);
}
});
});
// Assign to `_` leaving `_.prototype` unchanged to allow chaining.
each(pairs, function(pair) {
_[pair[0]] = pair[1];
});
// Wrap the lodash method and its aliases.
each(keys(_), function(key) {
each(mapping.realToAlias[key] || [], function(alias) {
_[alias] = _[key];
});
});
return _;
}
module.exports = baseConvert;
/***/ },
/* 2 */
/***/ function(module, exports) {
/** Used to map aliases to their real names. */
exports.aliasToReal = {
'__': 'placeholder',
'all': 'some',
'allPass': 'overEvery',
'apply': 'spread',
'assoc': 'set',
'assocPath': 'set',
'compose': 'flowRight',
'contains': 'includes',
'dissoc': 'unset',
'dissocPath': 'unset',
'each': 'forEach',
'eachRight': 'forEachRight',
'equals': 'isEqual',
'extend': 'assignIn',
'extendWith': 'assignInWith',
'first': 'head',
'init': 'initial',
'mapObj': 'mapValues',
'omitAll': 'omit',
'nAry': 'ary',
'path': 'get',
'pathEq': 'matchesProperty',
'pathOr': 'getOr',
'pickAll': 'pick',
'pipe': 'flow',
'prop': 'get',
'propOf': 'propertyOf',
'propOr': 'getOr',
'somePass': 'overSome',
'unapply': 'rest',
'unnest': 'flatten',
'useWith': 'overArgs',
'whereEq': 'filter',
'zipObj': 'zipObject'
};
/** Used to map ary to method names. */
exports.aryMethod = {
1: [
'attempt', 'ceil', 'create', 'curry', 'curryRight', 'floor', 'fromPairs',
'invert', 'iteratee', 'memoize', 'method', 'methodOf', 'mixin', 'over',
'overEvery', 'overSome', 'rest', 'reverse', 'round', 'runInContext',
'spread', 'template', 'trim', 'trimEnd', 'trimStart', 'uniqueId', 'words'
],
2: [
'add', 'after', 'ary', 'assign', 'assignIn', 'at', 'before', 'bind', 'bindKey',
'chunk', 'cloneDeepWith', 'cloneWith', 'concat', 'countBy', 'curryN',
'curryRightN', 'debounce', 'defaults', 'defaultsDeep', 'delay', 'difference',
'drop', 'dropRight', 'dropRightWhile', 'dropWhile', 'endsWith', 'eq', 'every',
'filter', 'find', 'find', 'findIndex', 'findKey', 'findLast', 'findLastIndex',
'findLastKey', 'flatMap', 'forEach', 'forEachRight', 'forIn', 'forInRight',
'forOwn', 'forOwnRight', 'get', 'groupBy', 'gt', 'gte', 'has', 'hasIn',
'includes', 'indexOf', 'intersection', 'invertBy', 'invoke', 'invokeMap',
'isEqual', 'isMatch', 'join', 'keyBy', 'lastIndexOf', 'lt', 'lte', 'map',
'mapKeys', 'mapValues', 'matchesProperty', 'maxBy', 'merge', 'minBy', 'omit',
'omitBy', 'orderBy', 'overArgs', 'pad', 'padEnd', 'padStart', 'parseInt',
'partial', 'partialRight', 'partition', 'pick', 'pickBy', 'pull', 'pullAll',
'pullAt', 'random', 'range', 'rangeRight', 'rearg', 'reject', 'remove',
'repeat', 'result', 'sampleSize', 'some', 'sortBy', 'sortedIndex',
'sortedIndexOf', 'sortedLastIndex', 'sortedLastIndexOf', 'sortedUniqBy',
'split', 'startsWith', 'subtract', 'sumBy', 'take', 'takeRight', 'takeRightWhile',
'takeWhile', 'tap', 'throttle', 'thru', 'times', 'trimChars', 'trimCharsEnd',
'trimCharsStart', 'truncate', 'union', 'uniqBy', 'uniqWith', 'unset',
'unzipWith', 'without', 'wrap', 'xor', 'zip', 'zipObject', 'zipObjectDeep'
],
3: [
'assignInWith', 'assignWith', 'clamp', 'differenceBy', 'differenceWith',
'getOr', 'inRange', 'intersectionBy', 'intersectionWith', 'isEqualWith',
'isMatchWith', 'mergeWith', 'pullAllBy', 'reduce', 'reduceRight', 'replace',
'set', 'slice', 'sortedIndexBy', 'sortedLastIndexBy', 'transform', 'unionBy',
'unionWith', 'xorBy', 'xorWith', 'zipWith'
],
4: [
'fill', 'setWith'
]
};
/** Used to map ary to rearg configs. */
exports.aryRearg = {
2: [1, 0],
3: [2, 1, 0],
4: [3, 2, 0, 1]
};
/** Used to iterate `mapping.aryMethod` keys. */
exports.caps = [1, 2, 3, 4];
/** Used to map method names to their iteratee ary. */
exports.iterateeAry = {
'assignWith': 2,
'assignInWith': 2,
'cloneDeepWith': 1,
'cloneWith': 1,
'dropRightWhile': 1,
'dropWhile': 1,
'every': 1,
'filter': 1,
'find': 1,
'findIndex': 1,
'findKey': 1,
'findLast': 1,
'findLastIndex': 1,
'findLastKey': 1,
'flatMap': 1,
'forEach': 1,
'forEachRight': 1,
'forIn': 1,
'forInRight': 1,
'forOwn': 1,
'forOwnRight': 1,
'isEqualWith': 2,
'isMatchWith': 2,
'map': 1,
'mapKeys': 1,
'mapValues': 1,
'partition': 1,
'reduce': 2,
'reduceRight': 2,
'reject': 1,
'remove': 1,
'some': 1,
'takeRightWhile': 1,
'takeWhile': 1,
'times': 1,
'transform': 2
};
/** Used to map method names to iteratee rearg configs. */
exports.iterateeRearg = {
'findKey': [1],
'findLastKey': [1],
'mapKeys': [1]
};
/** Used to map method names to rearg configs. */
exports.methodRearg = {
'assignInWith': [1, 2, 0],
'assignWith': [1, 2, 0],
'clamp': [2, 0, 1],
'mergeWith': [1, 2, 0],
'reduce': [2, 0, 1],
'reduceRight': [2, 0, 1],
'set': [2, 0, 1],
'setWith': [3, 1, 2, 0],
'slice': [2, 0, 1],
'transform': [2, 0, 1]
};
/** Used to map method names to spread configs. */
exports.methodSpread = {
'partial': 1,
'partialRight': 1
};
/** Used to identify methods which mutate arrays or objects. */
exports.mutate = {
'array': {
'fill': true,
'pull': true,
'pullAll': true,
'pullAllBy': true,
'pullAt': true,
'remove': true,
'reverse': true
},
'object': {
'assign': true,
'assignIn': true,
'assignInWith': true,
'assignWith': true,
'defaults': true,
'defaultsDeep': true,
'merge': true,
'mergeWith': true
},
'set': {
'set': true,
'setWith': true,
'unset': true
}
};
/** Used to track methods with placeholder support */
exports.placeholder = {
'bind': true,
'bindKey': true,
'curry': true,
'curryRight': true,
'partial': true,
'partialRight': true
};
/** Used to map real names to their aliases. */
exports.realToAlias = (function() {
var hasOwnProperty = Object.prototype.hasOwnProperty,
object = exports.aliasToReal,
result = {};
for (var key in object) {
var value = object[key];
if (hasOwnProperty.call(result, value)) {
result[value].push(key);
} else {
result[value] = [key];
}
}
return result;
}());
/** Used to map method names to other names. */
exports.rename = {
'curryN': 'curry',
'curryRightN': 'curryRight',
'getOr': 'get',
'trimChars': 'trim',
'trimCharsEnd': 'trimEnd',
'trimCharsStart': 'trimStart'
};
/** Used to track methods that skip `_.rearg`. */
exports.skipRearg = {
'add': true,
'assign': true,
'assignIn': true,
'concat': true,
'difference': true,
'matchesProperty': true,
'merge': true,
'partial': true,
'partialRight': true,
'random': true,
'range': true,
'rangeRight': true,
'subtract': true,
'zip': true,
'zipObject': true
};
/***/ }
/******/ ])
});
;

12
dist/lodash.fp.min.js vendored Normal file
View File

@@ -0,0 +1,12 @@
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.fp=t():e.fp=t()}(this,function(){return function(e){function t(n){if(r[n])return r[n].exports;var i=r[n]={exports:{},id:n,loaded:!1};return e[n].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){function n(e){return i(e,e)}var i=r(1);e.exports=n},function(e,t,r){function n(e,t,r){
if("function"!=typeof r&&(r=t,t=void 0),null==r)throw new TypeError;var s=void 0===t&&"string"==typeof r.VERSION,u=s?r:{ary:e.ary,cloneDeep:e.cloneDeep,curry:e.curry,forEach:e.forEach,isFunction:e.isFunction,iteratee:e.iteratee,keys:e.keys,rearg:e.rearg,spread:e.spread},c=u.ary,p=u.cloneDeep,l=u.curry,h=u.forEach,f=u.isFunction,d=u.keys,g=u.rearg,y=u.spread,m=function(e,t){return 2==t?function(t,r){return e.apply(void 0,arguments)}:function(t){return e.apply(void 0,arguments)}},v=function(e,t){return 2==t?function(t,r){
return e(t,r)}:function(t){return e(t)}},R=function(e){for(var t=e?e.length:0,r=Array(t);t--;)r[t]=e[t];return r},W=function(e){return function(t){return e({},t)}},x=function(e,t){return E(e,t,!0)},I=function(e,t){return E(e,function(e){return v(e,t)})},O=function(e,t){return E(e,function(e){var r=t.length;return m(g(v(e,r),t),r)})},E=function(e,t,r){return function(){for(var n=arguments.length,i=Array(n);n--;)i[n]=arguments[n];i[0]=t(i[0]);var a=e.apply(void 0,i);return r?i[0]:a}},b={iteratee:function(e){
return function(){var t=arguments[0],r=arguments[1];r=r>2?r-2:1,t=e(t);var n=t.length;return n&&r>=n?t:v(t,r)}},mixin:function(e){return function(t){var r=this;if(!f(r))return e(r,Object(t));var n=[],i=[];return h(d(t),function(e){var a=t[e];f(a)&&(i.push(e),n.push(r.prototype[e]))}),e(r,Object(t)),h(i,function(e,t){var i=n[t];f(i)?r.prototype[e]=i:delete r.prototype[e]}),r}},runInContext:function(t){return function(r){return n(e,t(r))}}},B=function(e,t){e=i.aliasToReal[e]||e;var r=b[e];if(r)return r(t);
var n=t;a.array[e]?n=x(t,R):a.object[e]?n=x(t,W(t)):a.set[e]&&(n=x(t,p));var u;return h(i.caps,function(t){return h(i.aryMethod[t],function(r){if(e==r){var a=!s&&i.iterateeAry[e],o=i.iterateeRearg[e],p=i.methodSpread[e];return u=void 0===p?c(n,t):y(n,p),t>1&&!i.skipRearg[e]&&(u=g(u,i.methodRearg[e]||i.aryRearg[t])),o?u=O(u,o):a&&(u=I(u,a)),t>1&&(u=l(u,t)),!1}}),!u}),u||(u=t),i.placeholder[e]&&(t.placeholder=u.placeholder=o),u};if(!s)return B(t,r);u.placeholder=o;var k=[];return h(i.caps,function(e){
h(i.aryMethod[e],function(e){var t=u[i.rename[e]||e];t&&k.push([e,B(e,t)])})}),h(k,function(e){u[e[0]]=e[1]}),h(d(u),function(e){h(i.realToAlias[e]||[],function(t){u[t]=u[e]})}),u}var i=r(2),a=i.mutate,o={};e.exports=n},function(e,t){t.aliasToReal={__:"placeholder",all:"some",allPass:"overEvery",apply:"spread",assoc:"set",assocPath:"set",compose:"flowRight",contains:"includes",dissoc:"unset",dissocPath:"unset",each:"forEach",eachRight:"forEachRight",equals:"isEqual",extend:"assignIn",extendWith:"assignInWith",
first:"head",init:"initial",mapObj:"mapValues",omitAll:"omit",nAry:"ary",path:"get",pathEq:"matchesProperty",pathOr:"getOr",pickAll:"pick",pipe:"flow",prop:"get",propOf:"propertyOf",propOr:"getOr",somePass:"overSome",unapply:"rest",unnest:"flatten",useWith:"overArgs",whereEq:"filter",zipObj:"zipObject"},t.aryMethod={1:["attempt","ceil","create","curry","curryRight","floor","fromPairs","invert","iteratee","memoize","method","methodOf","mixin","over","overEvery","overSome","rest","reverse","round","runInContext","spread","template","trim","trimEnd","trimStart","uniqueId","words"],
2:["add","after","ary","assign","assignIn","at","before","bind","bindKey","chunk","cloneDeepWith","cloneWith","concat","countBy","curryN","curryRightN","debounce","defaults","defaultsDeep","delay","difference","drop","dropRight","dropRightWhile","dropWhile","endsWith","eq","every","filter","find","find","findIndex","findKey","findLast","findLastIndex","findLastKey","flatMap","forEach","forEachRight","forIn","forInRight","forOwn","forOwnRight","get","groupBy","gt","gte","has","hasIn","includes","indexOf","intersection","invertBy","invoke","invokeMap","isEqual","isMatch","join","keyBy","lastIndexOf","lt","lte","map","mapKeys","mapValues","matchesProperty","maxBy","merge","minBy","omit","omitBy","orderBy","overArgs","pad","padEnd","padStart","parseInt","partial","partialRight","partition","pick","pickBy","pull","pullAll","pullAt","random","range","rangeRight","rearg","reject","remove","repeat","result","sampleSize","some","sortBy","sortedIndex","sortedIndexOf","sortedLastIndex","sortedLastIndexOf","sortedUniqBy","split","startsWith","subtract","sumBy","take","takeRight","takeRightWhile","takeWhile","tap","throttle","thru","times","trimChars","trimCharsEnd","trimCharsStart","truncate","union","uniqBy","uniqWith","unset","unzipWith","without","wrap","xor","zip","zipObject","zipObjectDeep"],
3:["assignInWith","assignWith","clamp","differenceBy","differenceWith","getOr","inRange","intersectionBy","intersectionWith","isEqualWith","isMatchWith","mergeWith","pullAllBy","reduce","reduceRight","replace","set","slice","sortedIndexBy","sortedLastIndexBy","transform","unionBy","unionWith","xorBy","xorWith","zipWith"],4:["fill","setWith"]},t.aryRearg={2:[1,0],3:[2,1,0],4:[3,2,0,1]},t.caps=[1,2,3,4],t.iterateeAry={assignWith:2,assignInWith:2,cloneDeepWith:1,cloneWith:1,dropRightWhile:1,dropWhile:1,
every:1,filter:1,find:1,findIndex:1,findKey:1,findLast:1,findLastIndex:1,findLastKey:1,flatMap:1,forEach:1,forEachRight:1,forIn:1,forInRight:1,forOwn:1,forOwnRight:1,isEqualWith:2,isMatchWith:2,map:1,mapKeys:1,mapValues:1,partition:1,reduce:2,reduceRight:2,reject:1,remove:1,some:1,takeRightWhile:1,takeWhile:1,times:1,transform:2},t.iterateeRearg={findKey:[1],findLastKey:[1],mapKeys:[1]},t.methodRearg={assignInWith:[1,2,0],assignWith:[1,2,0],clamp:[2,0,1],mergeWith:[1,2,0],reduce:[2,0,1],reduceRight:[2,0,1],
set:[2,0,1],setWith:[3,1,2,0],slice:[2,0,1],transform:[2,0,1]},t.methodSpread={partial:1,partialRight:1},t.mutate={array:{fill:!0,pull:!0,pullAll:!0,pullAllBy:!0,pullAt:!0,remove:!0,reverse:!0},object:{assign:!0,assignIn:!0,assignInWith:!0,assignWith:!0,defaults:!0,defaultsDeep:!0,merge:!0,mergeWith:!0},set:{set:!0,setWith:!0,unset:!0}},t.placeholder={bind:!0,bindKey:!0,curry:!0,curryRight:!0,partial:!0,partialRight:!0},t.realToAlias=function(){var e=Object.prototype.hasOwnProperty,r=t.aliasToReal,n={};
for(var i in r){var a=r[i];e.call(n,a)?n[a].push(i):n[a]=[i]}return n}(),t.rename={curryN:"curry",curryRightN:"curryRight",getOr:"get",trimChars:"trim",trimCharsEnd:"trimEnd",trimCharsStart:"trimStart"},t.skipRearg={add:!0,assign:!0,assignIn:!0,concat:!0,difference:!0,matchesProperty:!0,merge:!0,partial:!0,partialRight:!0,random:!0,range:!0,rangeRight:!0,subtract:!0,zip:!0,zipObject:!0}}])});

File diff suppressed because it is too large Load Diff

118
dist/lodash.min.js vendored Normal file
View File

@@ -0,0 +1,118 @@
/**
* @license
* lodash 4.2.1 (Custom Build) lodash.com/license | Underscore.js 1.8.3 underscorejs.org/LICENSE
* Build: `lodash -o ./dist/lodash.js`
*/
;(function(){function n(n,t){return n.set(t[0],t[1]),n}function t(n,t){return n.add(t),n}function r(n,t,r){switch(r.length){case 0:return n.call(t);case 1:return n.call(t,r[0]);case 2:return n.call(t,r[0],r[1]);case 3:return n.call(t,r[0],r[1],r[2])}return n.apply(t,r)}function e(n,t,r,e){for(var u=-1,o=n.length;++u<o;){var i=n[u];t(e,i,r(i),n)}return e}function u(n,t){for(var r=-1,e=n.length;++r<e&&false!==t(n[r],r,n););return n}function o(n,t){for(var r=-1,e=n.length;++r<e;)if(!t(n[r],r,n))return false;
return true}function i(n,t){for(var r=-1,e=n.length,u=-1,o=[];++r<e;){var i=n[r];t(i,r,n)&&(o[++u]=i)}return o}function f(n,t){return!!n.length&&-1<d(n,t,0)}function c(n,t,r){for(var e=-1,u=n.length;++e<u;)if(r(t,n[e]))return true;return false}function a(n,t){for(var r=-1,e=n.length,u=Array(e);++r<e;)u[r]=t(n[r],r,n);return u}function l(n,t){for(var r=-1,e=t.length,u=n.length;++r<e;)n[u+r]=t[r];return n}function s(n,t,r,e){var u=-1,o=n.length;for(e&&o&&(r=n[++u]);++u<o;)r=t(r,n[u],u,n);return r}function h(n,t,r,e){
var u=n.length;for(e&&u&&(r=n[--u]);u--;)r=t(r,n[u],u,n);return r}function p(n,t){for(var r=-1,e=n.length;++r<e;)if(t(n[r],r,n))return true;return false}function _(n,t,r){for(var e=-1,u=n.length;++e<u;){var o=n[e],i=t(o);if(null!=i&&(f===Z?i===i:r(i,f)))var f=i,c=o}return c}function g(n,t,r,e){var u;return r(n,function(n,r,o){return t(n,r,o)?(u=e?r:n,false):void 0}),u}function v(n,t,r){for(var e=n.length,u=r?e:-1;r?u--:++u<e;)if(t(n[u],u,n))return u;return-1}function d(n,t,r){if(t!==t)return C(n,r);--r;for(var e=n.length;++r<e;)if(n[r]===t)return r;
return-1}function y(n,t,r,e,u){return u(n,function(n,u,o){r=e?(e=false,n):t(r,n,u,o)}),r}function b(n,t){var r=n.length;for(n.sort(t);r--;)n[r]=n[r].c;return n}function x(n,t){for(var r,e=-1,u=n.length;++e<u;){var o=t(n[e]);o!==Z&&(r=r===Z?o:r+o)}return r}function m(n,t){for(var r=-1,e=Array(n);++r<n;)e[r]=t(r);return e}function j(n,t){return a(t,function(t){return[t,n[t]]})}function w(n){return function(t){return n(t)}}function A(n,t){return a(t,function(t){return n[t]})}function O(n,t){for(var r=-1,e=n.length;++r<e&&-1<d(t,n[r],0););
return r}function E(n,t){for(var r=n.length;r--&&-1<d(t,n[r],0););return r}function k(n){return n&&n.Object===Object?n:null}function I(n,t){if(n!==t){var r=null===n,e=n===Z,u=n===n,o=null===t,i=t===Z,f=t===t;if(n>t&&!o||!u||r&&!i&&f||e&&f)return 1;if(t>n&&!r||!f||o&&!e&&u||i&&u)return-1}return 0}function R(n){return Bn[n]}function S(n){return zn[n]}function W(n){return"\\"+Fn[n]}function C(n,t,r){var e=n.length;for(t+=r?0:-1;r?t--:++t<e;){var u=n[t];if(u!==u)return t}return-1}function U(n){var t=false;
if(null!=n&&typeof n.toString!="function")try{t=!!(n+"")}catch(r){}return t}function B(n,t){return n=typeof n=="number"||yn.test(n)?+n:-1,n>-1&&0==n%1&&(null==t?9007199254740991:t)>n}function z(n){for(var t,r=[];!(t=n.next()).done;)r.push(t.value);return r}function L(n){var t=-1,r=Array(n.size);return n.forEach(function(n,e){r[++t]=[e,n]}),r}function $(n,t){for(var r=-1,e=n.length,u=-1,o=[];++r<e;)n[r]===t&&(n[r]="__lodash_placeholder__",o[++u]=r);return o}function F(n){var t=-1,r=Array(n.size);return n.forEach(function(n){
r[++t]=n}),r}function M(n){if(!n||!kn.test(n))return n.length;for(var t=En.lastIndex=0;En.test(n);)t++;return t}function N(n){return Ln[n]}function D(k){function yn(n){if(be(n)&&!Lo(n)&&!(n instanceof An)){if(n instanceof wn)return n;if(iu.call(n,"__wrapped__"))return Nr(n)}return new wn(n)}function jn(){}function wn(n,t){this.__wrapped__=n,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=Z}function An(n){this.__wrapped__=n,this.__actions__=[],this.__dir__=1,this.__filtered__=false,
this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function Bn(){}function zn(n){var t=-1,r=n?n.length:0;for(this.clear();++t<r;){var e=n[t];this.set(e[0],e[1])}}function Ln(n){var t=-1,r=n?n.length:0;for(this.__data__=new zn;++t<r;)this.push(n[t])}function $n(n,t){var r=n.__data__;return Cr(t)?(r=r.__data__,"__lodash_hash_undefined__"===(typeof t=="string"?r.string:r.hash)[t]):r.has(t)}function Fn(n){var t=-1,r=n?n.length:0;for(this.clear();++t<r;){var e=n[t];this.set(e[0],e[1]);
}}function Dn(n,t){var r=qn(n,t);return 0>r?false:(r==n.length-1?n.pop():ju.call(n,r,1),true)}function Zn(n,t){var r=qn(n,t);return 0>r?Z:n[r][1]}function qn(n,t){for(var r=n.length;r--;)if(ae(n[r][0],t))return r;return-1}function Pn(n,t,r){var e=qn(n,t);0>e?n.push([t,r]):n[e][1]=r}function Tn(n,t,r,e){return n===Z||ae(n,uu[r])&&!iu.call(e,r)?t:n}function Kn(n,t,r){(r!==Z&&!ae(n[t],r)||typeof t=="number"&&r===Z&&!(t in n))&&(n[t]=r)}function Jn(n,t,r){var e=n[t];(!ae(e,r)||ae(e,uu[t])&&!iu.call(n,t)||r===Z&&!(t in n))&&(n[t]=r);
}function Yn(n,t,r,e){return Tu(n,function(n,u,o){t(e,n,r(n),o)}),e}function Hn(n,t){return n&&Jt(t,$e(t),n)}function Qn(n,t){for(var r=-1,e=null==n,u=t.length,o=Array(u);++r<u;)o[r]=e?Z:Be(n,t[r]);return o}function Xn(n,t,r){return n===n&&(r!==Z&&(n=n>r?r:n),t!==Z&&(n=t>n?t:n)),n}function nt(n,t,r,e,o,i){var f;if(r&&(f=o?r(n,e,o,i):r(n)),f!==Z)return f;if(!ye(n))return n;if(e=Lo(n)){if(f=Er(n),!t)return Vt(n,f)}else{var c=Ar(n),a="[object Function]"==c||"[object GeneratorFunction]"==c;if("[object Object]"!=c&&"[object Arguments]"!=c&&(!a||o))return Un[c]?Ir(n,c,t):o?n:{};
if(U(n))return o?n:{};if(f=kr(a?{}:n),!t)return Ht(n,Hn(f,n))}return i||(i=new Fn),(o=i.get(n))?o:(i.set(n,f),(e?u:ct)(n,function(e,u){Jn(f,u,nt(e,t,r,u,n,i))}),e?f:Ht(n,f))}function tt(n){var t=$e(n),r=t.length;return function(e){if(null==e)return!r;for(var u=r;u--;){var o=t[u],i=n[o],f=e[o];if(f===Z&&!(o in Object(e))||!i(f))return false}return true}}function rt(n,t,r){if(typeof n!="function")throw new ru("Expected a function");return mu(function(){n.apply(Z,r)},t)}function et(n,t,r,e){var u=-1,o=f,i=true,l=n.length,s=[],h=t.length;
if(!l)return s;r&&(t=a(t,w(r))),e?(o=c,i=false):t.length>=200&&(o=$n,i=false,t=new Ln(t));n:for(;++u<l;){var p=n[u],_=r?r(p):p;if(i&&_===_){for(var g=h;g--;)if(t[g]===_)continue n;s.push(p)}else o(t,_,e)||s.push(p)}return s}function ut(n,t){var r=true;return Tu(n,function(n,e,u){return r=!!t(n,e,u)}),r}function ot(n,t){var r=[];return Tu(n,function(n,e,u){t(n,e,u)&&r.push(n)}),r}function it(n,t,r,e){e||(e=[]);for(var u=-1,o=n.length;++u<o;){var i=n[u];pe(i)&&(r||Lo(i)||se(i))?t?it(i,t,r,e):l(e,i):r||(e[e.length]=i);
}return e}function ft(n,t){null==n||Gu(n,t,Fe)}function ct(n,t){return n&&Gu(n,t,$e)}function at(n,t){return n&&Vu(n,t,$e)}function lt(n,t){return i(t,function(t){return ge(n[t])})}function st(n,t){t=Wr(t,n)?[t+""]:Mt(t);for(var r=0,e=t.length;null!=n&&e>r;)n=n[t[r++]];return r&&r==e?n:Z}function ht(n,t){return iu.call(n,t)||typeof n=="object"&&t in n&&null===du(n)}function pt(n,t){return t in Object(n)}function _t(n,t,r){for(var e=r?c:f,u=n.length,o=u,i=Array(u),l=[];o--;){var s=n[o];o&&t&&(s=a(s,w(t))),
i[o]=r||!t&&120>s.length?Z:new Ln(o&&s)}var s=n[0],h=-1,p=s.length,_=i[0];n:for(;++h<p;){var g=s[h],v=t?t(g):g;if(_?!$n(_,v):!e(l,v,r)){for(o=u;--o;){var d=i[o];if(d?!$n(d,v):!e(n[o],v,r))continue n}_&&_.push(v),l.push(g)}}return l}function gt(n,t,r){var e={};return ct(n,function(n,u,o){t(e,r(n),u,o)}),e}function vt(n,t,e){return Wr(t,n)||(t=Mt(t),n=Lr(n,t),t=Pr(t)),t=null==n?n:n[t],null==t?Z:r(t,n,e)}function dt(n,t,r,e,u){if(n===t)n=true;else if(null==n||null==t||!ye(n)&&!be(t))n=n!==n&&t!==t;else n:{
var o=Lo(n),i=Lo(t),f="[object Array]",c="[object Array]";o||(f=Ar(n),"[object Arguments]"==f?f="[object Object]":"[object Object]"!=f&&(o=Ee(n))),i||(c=Ar(t),"[object Arguments]"==c?c="[object Object]":"[object Object]"!=c&&Ee(t));var a="[object Object]"==f&&!U(n),i="[object Object]"==c&&!U(t),c=f==c;if(!c||o||a){if(!(2&e)&&(f=a&&iu.call(n,"__wrapped__"),i=i&&iu.call(t,"__wrapped__"),f||i)){n=dt(f?n.value():n,i?t.value():t,r,e,u);break n}c?(u||(u=new Fn),n=(o?dr:br)(n,t,dt,r,e,u)):n=false}else n=yr(n,t,f,dt,r,e);
}return n}function yt(n,t,r,e){var u=r.length,o=u,i=!e;if(null==n)return!o;for(n=Object(n);u--;){var f=r[u];if(i&&f[2]?f[1]!==n[f[0]]:!(f[0]in n))return false}for(;++u<o;){var f=r[u],c=f[0],a=n[c],l=f[1];if(i&&f[2]){if(a===Z&&!(c in n))return false}else if(f=new Fn,c=e?e(a,l,c,n,t,f):Z,c===Z?!dt(l,a,e,3,f):!c)return false}return true}function bt(n){var t=typeof n;return"function"==t?n:null==n?Ke:"object"==t?Lo(n)?wt(n[0],n[1]):jt(n):Ye(n)}function xt(n){n=null==n?n:Object(n);var t,r=[];for(t in n)r.push(t);return r;
}function mt(n,t){var r=-1,e=he(n)?Array(n.length):[];return Tu(n,function(n,u,o){e[++r]=t(n,u,o)}),e}function jt(n){var t=jr(n);if(1==t.length&&t[0][2]){var r=t[0][0],e=t[0][1];return function(n){return null==n?false:n[r]===e&&(e!==Z||r in Object(n))}}return function(r){return r===n||yt(r,n,t)}}function wt(n,t){return function(r){var e=Be(r,n);return e===Z&&e===t?Le(r,n):dt(t,e,Z,3)}}function At(n,t,r,e,o){if(n!==t){var i=Lo(t)||Ee(t)?Z:Fe(t);u(i||t,function(u,f){if(i&&(f=u,u=t[f]),ye(u)){o||(o=new Fn);
var c=f,a=o,l=n[c],s=t[c],h=a.get(s);if(h)Kn(n,c,h);else{var h=e?e(l,s,c+"",n,t,a):Z,p=h===Z;p&&(h=s,Lo(s)||Ee(s)?Lo(l)?h=r?Vt(l):l:pe(l)?h=Vt(l):(p=false,h=nt(s)):je(s)||se(s)?se(l)?h=Ce(l):!ye(l)||r&&ge(l)?(p=false,h=nt(s)):h=r?nt(l):l:p=false),a.set(s,h),p&&At(h,s,r,e,a),Kn(n,c,h)}}else c=e?e(n[f],u,f+"",n,t,o):Z,c===Z&&(c=u),Kn(n,f,c)})}}function Ot(n,t,r){var e=-1,u=mr();return t=a(t.length?t:Array(1),function(n){return u(n)}),n=mt(n,function(n){return{a:a(t,function(t){return t(n)}),b:++e,c:n}}),b(n,function(n,t){
var e;n:{e=-1;for(var u=n.a,o=t.a,i=u.length,f=r.length;++e<i;){var c=I(u[e],o[e]);if(c){e=f>e?c*("desc"==r[e]?-1:1):c;break n}}e=n.b-t.b}return e})}function Et(n,t){return n=Object(n),s(t,function(t,r){return r in n&&(t[r]=n[r]),t},{})}function kt(n,t){var r={};return ft(n,function(n,e){t(n,e)&&(r[e]=n)}),r}function It(n){return function(t){return null==t?Z:t[n]}}function Rt(n){return function(t){return st(t,n)}}function St(n,t,r){var e=-1,u=t.length,o=n;for(r&&(o=a(n,function(n){return r(n)}));++e<u;)for(var i=0,f=t[e],f=r?r(f):f;-1<(i=d(o,f,i));)o!==n&&ju.call(o,i,1),
ju.call(n,i,1);return n}function Wt(n,t){for(var r=n?t.length:0,e=r-1;r--;){var u=t[r];if(e==r||u!=o){var o=u;if(B(u))ju.call(n,u,1);else if(Wr(u,n))delete n[u];else{var u=Mt(u),i=Lr(n,u);null!=i&&delete i[Pr(u)]}}}}function Ct(n,t){return n+Au(Wu()*(t-n+1))}function Ut(n,t,r,e){t=Wr(t,n)?[t+""]:Mt(t);for(var u=-1,o=t.length,i=o-1,f=n;null!=f&&++u<o;){var c=t[u];if(ye(f)){var a=r;if(u!=i){var l=f[c],a=e?e(l,c,f):Z;a===Z&&(a=null==l?B(t[u+1])?[]:{}:l)}Jn(f,c,a)}f=f[c]}return n}function Bt(n,t,r){var e=-1,u=n.length;
for(0>t&&(t=-t>u?0:u+t),r=r>u?u:r,0>r&&(r+=u),u=t>r?0:r-t>>>0,t>>>=0,r=Array(u);++e<u;)r[e]=n[e+t];return r}function zt(n,t){var r;return Tu(n,function(n,e,u){return r=t(n,e,u),!r}),!!r}function Lt(n,t,r){var e=0,u=n?n.length:e;if(typeof t=="number"&&t===t&&2147483647>=u){for(;u>e;){var o=e+u>>>1,i=n[o];(r?t>=i:t>i)&&null!==i?e=o+1:u=o}return u}return $t(n,t,Ke,r)}function $t(n,t,r,e){t=r(t);for(var u=0,o=n?n.length:0,i=t!==t,f=null===t,c=t===Z;o>u;){var a=Au((u+o)/2),l=r(n[a]),s=l!==Z,h=l===l;(i?h||e:f?h&&s&&(e||null!=l):c?h&&(e||s):null==l?0:e?t>=l:t>l)?u=a+1:o=a;
}return Ru(o,4294967294)}function Ft(n,t){for(var r=0,e=n.length,u=n[0],o=t?t(u):u,i=o,f=0,c=[u];++r<e;)u=n[r],o=t?t(u):u,ae(o,i)||(i=o,c[++f]=u);return c}function Mt(n){return Lo(n)?n:$r(n)}function Nt(n,t,r){var e=-1,u=f,o=n.length,i=true,a=[],l=a;if(r)i=false,u=c;else if(o<200)l=t?[]:a;else{if(u=t?null:Yu(n))return F(u);i=false,u=$n,l=new Ln}n:for(;++e<o;){var s=n[e],h=t?t(s):s;if(i&&h===h){for(var p=l.length;p--;)if(l[p]===h)continue n;t&&l.push(h),a.push(s)}else u(l,h,r)||(l!==a&&l.push(h),a.push(s));
}return a}function Dt(n,t,r,e){for(var u=n.length,o=e?u:-1;(e?o--:++o<u)&&t(n[o],o,n););return r?Bt(n,e?0:o,e?o+1:u):Bt(n,e?o+1:0,e?u:o)}function Zt(n,t){var r=n;return r instanceof An&&(r=r.value()),s(t,function(n,t){return t.func.apply(t.thisArg,l([n],t.args))},r)}function qt(n,t,r){for(var e=-1,u=n.length;++e<u;)var o=o?l(et(o,n[e],t,r),et(n[e],o,t,r)):n[e];return o&&o.length?Nt(o,t,r):[]}function Pt(n,t,r){for(var e=-1,u=n.length,o=t.length,i={};++e<u;)r(i,n[e],o>e?t[e]:Z);return i}function Tt(n){
var t=new n.constructor(n.byteLength);return new _u(t).set(new _u(n)),t}function Kt(n,t,r){for(var e=r.length,u=-1,o=Iu(n.length-e,0),i=-1,f=t.length,c=Array(f+o);++i<f;)c[i]=t[i];for(;++u<e;)c[r[u]]=n[u];for(;o--;)c[i++]=n[u++];return c}function Gt(n,t,r){for(var e=-1,u=r.length,o=-1,i=Iu(n.length-u,0),f=-1,c=t.length,a=Array(i+c);++o<i;)a[o]=n[o];for(i=o;++f<c;)a[i+f]=t[f];for(;++e<u;)a[i+r[e]]=n[o++];return a}function Vt(n,t){var r=-1,e=n.length;for(t||(t=Array(e));++r<e;)t[r]=n[r];return t}function Jt(n,t,r){
return Yt(n,t,r)}function Yt(n,t,r,e){r||(r={});for(var u=-1,o=t.length;++u<o;){var i=t[u],f=e?e(r[i],n[i],i,r,n):n[i];Jn(r,i,f)}return r}function Ht(n,t){return Jt(n,Xu(n),t)}function Qt(n,t){return function(r,u){var o=Lo(r)?e:Yn,i=t?t():{};return o(r,n,mr(u),i)}}function Xt(n){return ce(function(t,r){var e=-1,u=r.length,o=u>1?r[u-1]:Z,i=u>2?r[2]:Z,o=typeof o=="function"?(u--,o):Z;for(i&&Sr(r[0],r[1],i)&&(o=3>u?Z:o,u=1),t=Object(t);++e<u;)(i=r[e])&&n(t,i,e,o);return t})}function nr(n,t){return function(r,e){
if(null==r)return r;if(!he(r))return n(r,e);for(var u=r.length,o=t?u:-1,i=Object(r);(t?o--:++o<u)&&false!==e(i[o],o,i););return r}}function tr(n){return function(t,r,e){var u=-1,o=Object(t);e=e(t);for(var i=e.length;i--;){var f=e[n?i:++u];if(false===r(o[f],f,o))break}return t}}function rr(n,t,r){function e(){return(this&&this!==Gn&&this instanceof e?o:n).apply(u?r:this,arguments)}var u=1&t,o=or(n);return e}function er(n){return function(t){t=Ue(t);var r=kn.test(t)?t.match(En):Z,e=r?r[0]:t.charAt(0);return t=r?r.slice(1).join(""):t.slice(1),
e[n]()+t}}function ur(n){return function(t){return s(Pe(Ze(t)),n,"")}}function or(n){return function(){var t=arguments;switch(t.length){case 0:return new n;case 1:return new n(t[0]);case 2:return new n(t[0],t[1]);case 3:return new n(t[0],t[1],t[2]);case 4:return new n(t[0],t[1],t[2],t[3]);case 5:return new n(t[0],t[1],t[2],t[3],t[4]);case 6:return new n(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new n(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var r=Pu(n.prototype),t=n.apply(r,t);return ye(t)?t:r}}function ir(n,t,e){
function u(){for(var i=arguments.length,f=i,c=Array(i),a=this&&this!==Gn&&this instanceof u?o:n,l=yn.placeholder||u.placeholder;f--;)c[f]=arguments[f];return f=3>i&&c[0]!==l&&c[i-1]!==l?[]:$(c,l),i-=f.length,e>i?_r(n,t,cr,l,Z,c,f,Z,Z,e-i):r(a,this,c)}var o=or(n);return u}function fr(n){return ce(function(t){t=it(t);var r=t.length,e=r,u=wn.prototype.thru;for(n&&t.reverse();e--;){var o=t[e];if(typeof o!="function")throw new ru("Expected a function");if(u&&!i&&"wrapper"==xr(o))var i=new wn([],true)}for(e=i?e:r;++e<r;)var o=t[e],u=xr(o),f="wrapper"==u?Hu(o):Z,i=f&&Ur(f[0])&&424==f[1]&&!f[4].length&&1==f[9]?i[xr(f[0])].apply(i,f[3]):1==o.length&&Ur(o)?i[u]():i.thru(o);
return function(){var n=arguments,e=n[0];if(i&&1==n.length&&Lo(e)&&e.length>=200)return i.plant(e).value();for(var u=0,n=r?t[u].apply(this,n):e;++u<r;)n=t[u].call(this,n);return n}})}function cr(n,t,r,e,u,o,i,f,c,a){function l(){for(var y=arguments.length,b=y,x=Array(y);b--;)x[b]=arguments[b];if(e&&(x=Kt(x,e,u)),o&&(x=Gt(x,o,i)),_||g){var b=yn.placeholder||l.placeholder,m=$(x,b),y=y-m.length;if(a>y)return _r(n,t,cr,b,r,x,m,f,c,a-y)}if(y=h?r:this,b=p?y[n]:n,f)for(var m=x.length,j=Ru(f.length,m),w=Vt(x);j--;){
var A=f[j];x[j]=B(A,m)?w[A]:Z}else v&&x.length>1&&x.reverse();return s&&x.length>c&&(x.length=c),this&&this!==Gn&&this instanceof l&&(b=d||or(b)),b.apply(y,x)}var s=128&t,h=1&t,p=2&t,_=8&t,g=16&t,v=512&t,d=p?Z:or(n);return l}function ar(n,t){return function(r,e){return gt(r,n,t(e))}}function lr(n){return ce(function(t){return t=a(it(t),mr()),ce(function(e){var u=this;return n(t,function(n){return r(n,u,e)})})})}function sr(n,t,r){return t=Re(t),n=M(n),t&&t>n?(t-=n,r=r===Z?" ":r+"",n=qe(r,wu(t/M(r))),
kn.test(r)?n.match(En).slice(0,t).join(""):n.slice(0,t)):""}function hr(n,t,e,u){function o(){for(var t=-1,c=arguments.length,a=-1,l=u.length,s=Array(l+c),h=this&&this!==Gn&&this instanceof o?f:n;++a<l;)s[a]=u[a];for(;c--;)s[a++]=arguments[++t];return r(h,i?e:this,s)}var i=1&t,f=or(n);return o}function pr(n){return function(t,r,e){e&&typeof e!="number"&&Sr(t,r,e)&&(r=e=Z),t=We(t),t=t===t?t:0,r===Z?(r=t,t=0):r=We(r)||0,e=e===Z?r>t?1:-1:We(e)||0;var u=-1;r=Iu(wu((r-t)/(e||1)),0);for(var o=Array(r);r--;)o[n?r:++u]=t,
t+=e;return o}}function _r(n,t,r,e,u,o,i,f,c,a){var l=8&t;f=f?Vt(f):Z;var s=l?i:Z;i=l?Z:i;var h=l?o:Z;return o=l?Z:o,t=(t|(l?32:64))&~(l?64:32),4&t||(t&=-4),t=[n,t,u,h,s,o,i,f,c,a],r=r.apply(Z,t),Ur(n)&&no(r,t),r.placeholder=e,r}function gr(n){var t=nu[n];return function(n,r){if(n=We(n),r=Re(r)){var e=(Ue(n)+"e").split("e"),e=t(e[0]+"e"+(+e[1]+r)),e=(Ue(e)+"e").split("e");return+(e[0]+"e"+(+e[1]-r))}return t(n)}}function vr(n,t,r,e,u,o,i,f){var c=2&t;if(!c&&typeof n!="function")throw new ru("Expected a function");
var a=e?e.length:0;if(a||(t&=-97,e=u=Z),i=i===Z?i:Iu(Re(i),0),f=f===Z?f:Re(f),a-=u?u.length:0,64&t){var l=e,s=u;e=u=Z}var h=c?Z:Hu(n);return o=[n,t,r,e,u,l,s,o,i,f],h&&(r=o[1],n=h[1],t=r|n,e=128==n&&8==r||128==n&&256==r&&h[8]>=o[7].length||384==n&&h[8]>=h[7].length&&8==r,131>t||e)&&(1&n&&(o[2]=h[2],t|=1&r?0:4),(r=h[3])&&(e=o[3],o[3]=e?Kt(e,r,h[4]):Vt(r),o[4]=e?$(o[3],"__lodash_placeholder__"):Vt(h[4])),(r=h[5])&&(e=o[5],o[5]=e?Gt(e,r,h[6]):Vt(r),o[6]=e?$(o[5],"__lodash_placeholder__"):Vt(h[6])),(r=h[7])&&(o[7]=Vt(r)),
128&n&&(o[8]=null==o[8]?h[8]:Ru(o[8],h[8])),null==o[9]&&(o[9]=h[9]),o[0]=h[0],o[1]=t),n=o[0],t=o[1],r=o[2],e=o[3],u=o[4],f=o[9]=null==o[9]?c?0:n.length:Iu(o[9]-a,0),!f&&24&t&&(t&=-25),(h?Ju:no)(t&&1!=t?8==t||16==t?ir(n,t,f):32!=t&&33!=t||u.length?cr.apply(Z,o):hr(n,t,r,e):rr(n,t,r),o)}function dr(n,t,r,e,u,o){var i=-1,f=2&u,c=1&u,a=n.length,l=t.length;if(!(a==l||f&&l>a))return false;if(l=o.get(n))return l==t;for(l=true,o.set(n,t);++i<a;){var s=n[i],h=t[i];if(e)var _=f?e(h,s,i,t,n,o):e(s,h,i,n,t,o);if(_!==Z){
if(_)continue;l=false;break}if(c){if(!p(t,function(n){return s===n||r(s,n,e,u,o)})){l=false;break}}else if(s!==h&&!r(s,h,e,u,o)){l=false;break}}return o["delete"](n),l}function yr(n,t,r,e,u,o){switch(r){case"[object ArrayBuffer]":if(n.byteLength!=t.byteLength||!e(new _u(n),new _u(t)))break;return true;case"[object Boolean]":case"[object Date]":return+n==+t;case"[object Error]":return n.name==t.name&&n.message==t.message;case"[object Number]":return n!=+n?t!=+t:n==+t;case"[object RegExp]":case"[object String]":
return n==t+"";case"[object Map]":var i=L;case"[object Set]":return i||(i=F),(2&o||n.size==t.size)&&e(i(n),i(t),u,1|o);case"[object Symbol]":return!!pu&&Du.call(n)==Du.call(t)}return false}function br(n,t,r,e,u,o){var i=2&u,f=$e(n),c=f.length,a=$e(t).length;if(c!=a&&!i)return false;for(var l=c;l--;){var s=f[l];if(!(i?s in t:ht(t,s)))return false}if(a=o.get(n))return a==t;a=true,o.set(n,t);for(var h=i;++l<c;){var s=f[l],p=n[s],_=t[s];if(e)var g=i?e(_,p,s,t,n,o):e(p,_,s,n,t,o);if(g===Z?p!==_&&!r(p,_,e,u,o):!g){a=false;
break}h||(h="constructor"==s)}return a&&!h&&(r=n.constructor,e=t.constructor,r!=e&&"constructor"in n&&"constructor"in t&&!(typeof r=="function"&&r instanceof r&&typeof e=="function"&&e instanceof e)&&(a=false)),o["delete"](n),a}function xr(n){for(var t=n.name+"",r=qu[t],e=iu.call(qu,t)?r.length:0;e--;){var u=r[e],o=u.func;if(null==o||o==n)return u.name}return t}function mr(){var n=yn.iteratee||Ge,n=n===Ge?bt:n;return arguments.length?n(arguments[0],arguments[1]):n}function jr(n){n=Me(n);for(var t=n.length;t--;){
var r=n[t][1];n[t][2]=r===r&&!ye(r)}return n}function wr(n,t){var r=null==n?Z:n[t];return xe(r)?r:Z}function Ar(n){return au.call(n)}function Or(n,t,r){if(null==n)return false;var e=r(n,t);return e||Wr(t)||(t=Mt(t),n=Lr(n,t),null!=n&&(t=Pr(t),e=r(n,t))),r=n?n.length:Z,e||!!r&&de(r)&&B(t,r)&&(Lo(n)||Ae(n)||se(n))}function Er(n){var t=n.length,r=n.constructor(t);return t&&"string"==typeof n[0]&&iu.call(n,"index")&&(r.index=n.index,r.input=n.input),r}function kr(n){return Br(n)?{}:(n=n.constructor,Pu(ge(n)?n.prototype:Z));
}function Ir(r,e,u){var o=r.constructor;switch(e){case"[object ArrayBuffer]":return Tt(r);case"[object Boolean]":case"[object Date]":return new o(+r);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return e=r.buffer,new r.constructor(u?Tt(e):e,r.byteOffset,r.length);case"[object Map]":return u=r.constructor,
s(L(r),n,new u);case"[object Number]":case"[object String]":return new o(r);case"[object RegExp]":return u=new r.constructor(r.source,hn.exec(r)),u.lastIndex=r.lastIndex,u;case"[object Set]":return u=r.constructor,s(F(r),t,new u);case"[object Symbol]":return pu?Object(Du.call(r)):{}}}function Rr(n){var t=n?n.length:Z;return de(t)&&(Lo(n)||Ae(n)||se(n))?m(t,String):null}function Sr(n,t,r){if(!ye(r))return false;var e=typeof t;return("number"==e?he(r)&&B(t,r.length):"string"==e&&t in r)?ae(r[t],n):false}function Wr(n,t){
return typeof n=="number"?true:!Lo(n)&&(rn.test(n)||!tn.test(n)||null!=t&&n in Object(t))}function Cr(n){var t=typeof n;return"number"==t||"boolean"==t||"string"==t&&"__proto__"!==n||null==n}function Ur(n){var t=xr(n),r=yn[t];return typeof r=="function"&&t in An.prototype?n===r?true:(t=Hu(r),!!t&&n===t[0]):false}function Br(n){var t=n&&n.constructor;return n===(typeof t=="function"&&t.prototype||uu)}function zr(n,t,r,e,u,o){return ye(n)&&ye(t)&&(o.set(t,n),At(n,t,Z,zr,o)),n}function Lr(n,t){return 1==t.length?n:Be(n,Bt(t,0,-1));
}function $r(n){var t=[];return Ue(n).replace(en,function(n,r,e,u){t.push(e?u.replace(ln,"$1"):r||n)}),t}function Fr(n){return pe(n)?n:[]}function Mr(n){return typeof n=="function"?n:Ke}function Nr(n){if(n instanceof An)return n.clone();var t=new wn(n.__wrapped__,n.__chain__);return t.__actions__=Vt(n.__actions__),t.__index__=n.__index__,t.__values__=n.__values__,t}function Dr(n,t,r){var e=n?n.length:0;return e?(t=r||t===Z?1:Re(t),Bt(n,0>t?0:t,e)):[]}function Zr(n,t,r){var e=n?n.length:0;return e?(t=r||t===Z?1:Re(t),
t=e-t,Bt(n,0,0>t?0:t)):[]}function qr(n){return n?n[0]:Z}function Pr(n){var t=n?n.length:0;return t?n[t-1]:Z}function Tr(n,t){return n&&n.length&&t&&t.length?St(n,t):n}function Kr(n){return n?Cu.call(n):n}function Gr(n){if(!n||!n.length)return[];var t=0;return n=i(n,function(n){return pe(n)?(t=Iu(n.length,t),true):void 0}),m(t,function(t){return a(n,It(t))})}function Vr(n,t){if(!n||!n.length)return[];var e=Gr(n);return null==t?e:a(e,function(n){return r(t,Z,n)})}function Jr(n){return n=yn(n),n.__chain__=true,
n}function Yr(n,t){return t(n)}function Hr(){return this}function Qr(n,t){return typeof t=="function"&&Lo(n)?u(n,t):Tu(n,Mr(t))}function Xr(n,t){var r;if(typeof t=="function"&&Lo(n)){for(r=n.length;r--&&false!==t(n[r],r,n););r=n}else r=Ku(n,Mr(t));return r}function ne(n,t){return(Lo(n)?a:mt)(n,mr(t,3))}function te(n,t){var r=-1,e=Ie(n),u=e.length,o=u-1;for(t=Xn(Re(t),0,u);++r<t;){var u=Ct(r,o),i=e[u];e[u]=e[r],e[r]=i}return e.length=t,e}function re(n,t,r){return t=r?Z:t,t=n&&null==t?n.length:t,vr(n,128,Z,Z,Z,Z,t);
}function ee(n,t){var r;if(typeof t!="function")throw new ru("Expected a function");return n=Re(n),function(){return 0<--n&&(r=t.apply(this,arguments)),1>=n&&(t=Z),r}}function ue(n,t,r){return t=r?Z:t,n=vr(n,8,Z,Z,Z,Z,Z,t),n.placeholder=yn.placeholder||ue.placeholder,n}function oe(n,t,r){return t=r?Z:t,n=vr(n,16,Z,Z,Z,Z,Z,t),n.placeholder=yn.placeholder||oe.placeholder,n}function ie(n,t,r){function e(){p&&gu(p),a&&gu(a),g=0,c=a=h=p=_=Z}function u(t,r){r&&gu(r),a=p=_=Z,t&&(g=ko(),l=n.apply(h,c),p||a||(c=h=Z));
}function o(){var n=t-(ko()-s);0>=n||n>t?u(_,a):p=mu(o,n)}function i(){u(y,p)}function f(){if(c=arguments,s=ko(),h=this,_=y&&(p||!v),false===d)var r=v&&!p;else{a||v||(g=s);var e=d-(s-g),u=0>=e||e>d;u?(a&&(a=gu(a)),g=s,l=n.apply(h,c)):a||(a=mu(i,e))}return u&&p?p=gu(p):p||t===d||(p=mu(o,t)),r&&(u=true,l=n.apply(h,c)),!u||p||a||(c=h=Z),l}var c,a,l,s,h,p,_,g=0,v=false,d=false,y=true;if(typeof n!="function")throw new ru("Expected a function");return t=We(t)||0,ye(r)&&(v=!!r.leading,d="maxWait"in r&&Iu(We(r.maxWait)||0,t),
y="trailing"in r?!!r.trailing:y),f.cancel=e,f.flush=function(){return(p&&_||a&&y)&&(l=n.apply(h,c)),e(),l},f}function fe(n,t){function r(){var e=arguments,u=t?t.apply(this,e):e[0],o=r.cache;return o.has(u)?o.get(u):(e=n.apply(this,e),r.cache=o.set(u,e),e)}if(typeof n!="function"||t&&typeof t!="function")throw new ru("Expected a function");return r.cache=new fe.Cache,r}function ce(n,t){if(typeof n!="function")throw new ru("Expected a function");return t=Iu(t===Z?n.length-1:Re(t),0),function(){for(var e=arguments,u=-1,o=Iu(e.length-t,0),i=Array(o);++u<o;)i[u]=e[t+u];
switch(t){case 0:return n.call(this,i);case 1:return n.call(this,e[0],i);case 2:return n.call(this,e[0],e[1],i)}for(o=Array(t+1),u=-1;++u<t;)o[u]=e[u];return o[t]=i,r(n,this,o)}}function ae(n,t){return n===t||n!==n&&t!==t}function le(n,t){return n>t}function se(n){return pe(n)&&iu.call(n,"callee")&&(!xu.call(n,"callee")||"[object Arguments]"==au.call(n))}function he(n){return null!=n&&!(typeof n=="function"&&ge(n))&&de(Qu(n))}function pe(n){return be(n)&&he(n)}function _e(n){return be(n)&&typeof n.message=="string"&&"[object Error]"==au.call(n);
}function ge(n){return n=ye(n)?au.call(n):"","[object Function]"==n||"[object GeneratorFunction]"==n}function ve(n){return typeof n=="number"&&n==Re(n)}function de(n){return typeof n=="number"&&n>-1&&0==n%1&&9007199254740991>=n}function ye(n){var t=typeof n;return!!n&&("object"==t||"function"==t)}function be(n){return!!n&&typeof n=="object"}function xe(n){return null==n?false:ge(n)?su.test(ou.call(n)):be(n)&&(U(n)?su:vn).test(n)}function me(n){return typeof n=="number"||be(n)&&"[object Number]"==au.call(n);
}function je(n){if(!be(n)||"[object Object]"!=au.call(n)||U(n))return false;var t=uu;return typeof n.constructor=="function"&&(t=du(n)),null===t?true:(n=t.constructor,typeof n=="function"&&n instanceof n&&ou.call(n)==cu)}function we(n){return ye(n)&&"[object RegExp]"==au.call(n)}function Ae(n){return typeof n=="string"||!Lo(n)&&be(n)&&"[object String]"==au.call(n)}function Oe(n){return typeof n=="symbol"||be(n)&&"[object Symbol]"==au.call(n)}function Ee(n){return be(n)&&de(n.length)&&!!Cn[au.call(n)]}function ke(n,t){
return t>n}function Ie(n){if(!n)return[];if(he(n))return Ae(n)?n.match(En):Vt(n);if(bu&&n[bu])return z(n[bu]());var t=Ar(n);return("[object Map]"==t?L:"[object Set]"==t?F:Ne)(n)}function Re(n){if(!n)return 0===n?n:0;if(n=We(n),n===q||n===-q)return 1.7976931348623157e308*(0>n?-1:1);var t=n%1;return n===n?t?n-t:n:0}function Se(n){return n?Xn(Re(n),0,4294967295):0}function We(n){if(ye(n)&&(n=ge(n.valueOf)?n.valueOf():n,n=ye(n)?n+"":n),typeof n!="string")return 0===n?n:+n;n=n.replace(fn,"");var t=gn.test(n);
return t||dn.test(n)?Nn(n.slice(2),t?2:8):_n.test(n)?P:+n}function Ce(n){return Jt(n,Fe(n))}function Ue(n){if(typeof n=="string")return n;if(null==n)return"";if(Oe(n))return pu?Zu.call(n):"";var t=n+"";return"0"==t&&1/n==-q?"-0":t}function Be(n,t,r){return n=null==n?Z:st(n,t),n===Z?r:n}function ze(n,t){return Or(n,t,ht)}function Le(n,t){return Or(n,t,pt)}function $e(n){var t=Br(n);if(!t&&!he(n))return ku(Object(n));var r,e=Rr(n),u=!!e,e=e||[],o=e.length;for(r in n)!ht(n,r)||u&&("length"==r||B(r,o))||t&&"constructor"==r||e.push(r);
return e}function Fe(n){for(var t=-1,r=Br(n),e=xt(n),u=e.length,o=Rr(n),i=!!o,o=o||[],f=o.length;++t<u;){var c=e[t];i&&("length"==c||B(c,f))||"constructor"==c&&(r||!iu.call(n,c))||o.push(c)}return o}function Me(n){return j(n,$e(n))}function Ne(n){return n?A(n,$e(n)):[]}function De(n){return ti(Ue(n).toLowerCase())}function Ze(n){return(n=Ue(n))&&n.replace(bn,R).replace(On,"")}function qe(n,t){n=Ue(n),t=Re(t);var r="";if(!n||1>t||t>9007199254740991)return r;do t%2&&(r+=n),t=Au(t/2),n+=n;while(t);return r;
}function Pe(n,t,r){return n=Ue(n),t=r?Z:t,t===Z&&(t=Sn.test(n)?Rn:In),n.match(t)||[]}function Te(n){return function(){return n}}function Ke(n){return n}function Ge(n){return bt(typeof n=="function"?n:nt(n,true))}function Ve(n,t,r){var e=$e(t),o=lt(t,e);null!=r||ye(t)&&(o.length||!e.length)||(r=t,t=n,n=this,o=lt(t,$e(t)));var i=ye(r)&&"chain"in r?r.chain:true,f=ge(n);return u(o,function(r){var e=t[r];n[r]=e,f&&(n.prototype[r]=function(){var t=this.__chain__;if(i||t){var r=n(this.__wrapped__);return(r.__actions__=Vt(this.__actions__)).push({
func:e,args:arguments,thisArg:n}),r.__chain__=t,r}return e.apply(n,l([this.value()],arguments))})}),n}function Je(){}function Ye(n){return Wr(n)?It(n):Rt(n)}function He(n){return n&&n.length?x(n,Ke):0}k=k?Vn.defaults({},k,Vn.pick(Gn,Wn)):Gn;var Qe=k.Date,Xe=k.Error,nu=k.Math,tu=k.RegExp,ru=k.TypeError,eu=k.Array.prototype,uu=k.Object.prototype,ou=k.Function.prototype.toString,iu=uu.hasOwnProperty,fu=0,cu=ou.call(Object),au=uu.toString,lu=Gn._,su=tu("^"+ou.call(iu).replace(un,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),hu=k.f,pu=k.Symbol,_u=k.Uint8Array,gu=k.clearTimeout,vu=hu?hu.g:Z,du=Object.getPrototypeOf,yu=Object.getOwnPropertySymbols,bu=typeof(bu=pu&&pu.iterator)=="symbol"?bu:Z,xu=uu.propertyIsEnumerable,mu=k.setTimeout,ju=eu.splice,wu=nu.ceil,Au=nu.floor,Ou=k.isFinite,Eu=eu.join,ku=Object.keys,Iu=nu.max,Ru=nu.min,Su=k.parseInt,Wu=nu.random,Cu=eu.reverse,Uu=wr(k,"Map"),Bu=wr(k,"Set"),zu=wr(k,"WeakMap"),Lu=wr(Object,"create"),$u=zu&&new zu,Fu=Uu?ou.call(Uu):"",Mu=Bu?ou.call(Bu):"",Nu=pu?pu.prototype:Z,Du=pu?Nu.valueOf:Z,Zu=pu?Nu.toString:Z,qu={};
yn.templateSettings={escape:Q,evaluate:X,interpolate:nn,variable:"",imports:{_:yn}};var Pu=function(){function n(){}return function(t){if(ye(t)){n.prototype=t;var r=new n;n.prototype=Z}return r||{}}}(),Tu=nr(ct),Ku=nr(at,true),Gu=tr(),Vu=tr(true);vu&&!xu.call({valueOf:1},"valueOf")&&(xt=function(n){return z(vu(n))});var Ju=$u?function(n,t){return $u.set(n,t),n}:Ke,Yu=Bu&&2===new Bu([1,2]).size?function(n){return new Bu(n)}:Je,Hu=$u?function(n){return $u.get(n)}:Je,Qu=It("length"),Xu=yu||function(){return[];
};(Uu&&"[object Map]"!=Ar(new Uu)||Bu&&"[object Set]"!=Ar(new Bu))&&(Ar=function(n){var t=au.call(n);if(n="[object Object]"==t?n.constructor:null,n=typeof n=="function"?ou.call(n):""){if(n==Fu)return"[object Map]";if(n==Mu)return"[object Set]"}return t});var no=function(){var n=0,t=0;return function(r,e){var u=ko(),o=16-(u-t);if(t=u,o>0){if(150<=++n)return r}else n=0;return Ju(r,e)}}(),to=ce(function(n,t){Lo(n)||(n=null==n?[]:[Object(n)]),t=it(t);for(var r=n,e=t,u=-1,o=r.length,i=-1,f=e.length,c=Array(o+f);++u<o;)c[u]=r[u];
for(;++i<f;)c[u++]=e[i];return c}),ro=ce(function(n,t){return pe(n)?et(n,it(t,false,true)):[]}),eo=ce(function(n,t){var r=Pr(t);return pe(r)&&(r=Z),pe(n)?et(n,it(t,false,true),mr(r)):[]}),uo=ce(function(n,t){var r=Pr(t);return pe(r)&&(r=Z),pe(n)?et(n,it(t,false,true),Z,r):[]}),oo=ce(function(n){var t=a(n,Fr);return t.length&&t[0]===n[0]?_t(t):[]}),io=ce(function(n){var t=Pr(n),r=a(n,Fr);return t===Pr(r)?t=Z:r.pop(),r.length&&r[0]===n[0]?_t(r,mr(t)):[]}),fo=ce(function(n){var t=Pr(n),r=a(n,Fr);return t===Pr(r)?t=Z:r.pop(),
r.length&&r[0]===n[0]?_t(r,Z,t):[]}),co=ce(Tr),ao=ce(function(n,t){t=a(it(t),String);var r=Qn(n,t);return Wt(n,t.sort(I)),r}),lo=ce(function(n){return Nt(it(n,false,true))}),so=ce(function(n){var t=Pr(n);return pe(t)&&(t=Z),Nt(it(n,false,true),mr(t))}),ho=ce(function(n){var t=Pr(n);return pe(t)&&(t=Z),Nt(it(n,false,true),Z,t)}),po=ce(function(n,t){return pe(n)?et(n,t):[]}),_o=ce(function(n){return qt(i(n,pe))}),go=ce(function(n){var t=Pr(n);return pe(t)&&(t=Z),qt(i(n,pe),mr(t))}),vo=ce(function(n){var t=Pr(n);return pe(t)&&(t=Z),
qt(i(n,pe),Z,t)}),yo=ce(Gr),bo=ce(function(n){var t=n.length,t=t>1?n[t-1]:Z,t=typeof t=="function"?(n.pop(),t):Z;return Vr(n,t)}),xo=ce(function(n){function t(t){return Qn(t,n)}n=it(n);var r=n.length,e=r?n[0]:0,u=this.__wrapped__;return 1>=r&&!this.__actions__.length&&u instanceof An&&B(e)?(u=u.slice(e,+e+(r?1:0)),u.__actions__.push({func:Yr,args:[t],thisArg:Z}),new wn(u,this.__chain__).thru(function(n){return r&&!n.length&&n.push(Z),n})):this.thru(t)}),mo=Qt(function(n,t,r){iu.call(n,r)?++n[r]:n[r]=1;
}),jo=Qt(function(n,t,r){iu.call(n,r)?n[r].push(t):n[r]=[t]}),wo=ce(function(n,t,e){var u=-1,o=typeof t=="function",i=Wr(t),f=he(n)?Array(n.length):[];return Tu(n,function(n){var c=o?t:i&&null!=n?n[t]:Z;f[++u]=c?r(c,n,e):vt(n,t,e)}),f}),Ao=Qt(function(n,t,r){n[r]=t}),Oo=Qt(function(n,t,r){n[r?0:1].push(t)},function(){return[[],[]]}),Eo=ce(function(n,t){if(null==n)return[];var r=t.length;return r>1&&Sr(n,t[0],t[1])?t=[]:r>2&&Sr(t[0],t[1],t[2])&&(t.length=1),Ot(n,it(t),[])}),ko=Qe.now,Io=ce(function(n,t,r){
var e=1;if(r.length)var u=$(r,yn.placeholder||Io.placeholder),e=32|e;return vr(n,e,t,r,u)}),Ro=ce(function(n,t,r){var e=3;if(r.length)var u=$(r,yn.placeholder||Ro.placeholder),e=32|e;return vr(t,e,n,r,u)}),So=ce(function(n,t){return rt(n,1,t)}),Wo=ce(function(n,t,r){return rt(n,We(t)||0,r)}),Co=ce(function(n,t){t=a(it(t),mr());var e=t.length;return ce(function(u){for(var o=-1,i=Ru(u.length,e);++o<i;)u[o]=t[o].call(this,u[o]);return r(n,this,u)})}),Uo=ce(function(n,t){var r=$(t,yn.placeholder||Uo.placeholder);
return vr(n,32,Z,t,r)}),Bo=ce(function(n,t){var r=$(t,yn.placeholder||Bo.placeholder);return vr(n,64,Z,t,r)}),zo=ce(function(n,t){return vr(n,256,Z,Z,Z,it(t))}),Lo=Array.isArray,$o=Xt(function(n,t){Jt(t,$e(t),n)}),Fo=Xt(function(n,t){Jt(t,Fe(t),n)}),Mo=Xt(function(n,t,r,e){Yt(t,Fe(t),n,e)}),No=Xt(function(n,t,r,e){Yt(t,$e(t),n,e)}),Do=ce(function(n,t){return Qn(n,it(t))}),Zo=ce(function(n){return n.push(Z,Tn),r(Mo,Z,n)}),qo=ce(function(n){return n.push(Z,zr),r(Vo,Z,n)}),Po=ar(function(n,t,r){n[t]=r;
},Te(Ke)),To=ar(function(n,t,r){iu.call(n,t)?n[t].push(r):n[t]=[r]},mr),Ko=ce(vt),Go=Xt(function(n,t,r){At(n,t,r)}),Vo=Xt(function(n,t,r,e){At(n,t,r,e)}),Jo=ce(function(n,t){return null==n?{}:(t=a(it(t),String),Et(n,et(Fe(n),t)))}),Yo=ce(function(n,t){return null==n?{}:Et(n,it(t))}),Ho=ur(function(n,t,r){return t=t.toLowerCase(),n+(r?De(t):t)}),Qo=ur(function(n,t,r){return n+(r?"-":"")+t.toLowerCase()}),Xo=ur(function(n,t,r){return n+(r?" ":"")+t.toLowerCase()}),ni=er("toLowerCase"),ti=er("toUpperCase"),ri=ur(function(n,t,r){
return n+(r?"_":"")+t.toLowerCase()}),ei=ur(function(n,t,r){return n+(r?" ":"")+De(t)}),ui=ur(function(n,t,r){return n+(r?" ":"")+t.toUpperCase()}),oi=ce(function(n,t){try{return r(n,Z,t)}catch(e){return ye(e)?e:new Xe(e)}}),ii=ce(function(n,t){return u(it(t),function(t){n[t]=Io(n[t],n)}),n}),fi=fr(),ci=fr(true),ai=ce(function(n,t){return function(r){return vt(r,n,t)}}),li=ce(function(n,t){return function(r){return vt(n,r,t)}}),si=lr(a),hi=lr(o),pi=lr(p),_i=pr(),gi=pr(true),vi=gr("ceil"),di=gr("floor"),yi=gr("round");
return yn.prototype=jn.prototype,wn.prototype=Pu(jn.prototype),wn.prototype.constructor=wn,An.prototype=Pu(jn.prototype),An.prototype.constructor=An,Bn.prototype=Lu?Lu(null):uu,zn.prototype.clear=function(){this.__data__={hash:new Bn,map:Uu?new Uu:[],string:new Bn}},zn.prototype["delete"]=function(n){var t=this.__data__;return Cr(n)?(t=typeof n=="string"?t.string:t.hash,n=(Lu?t[n]!==Z:iu.call(t,n))&&delete t[n]):n=Uu?t.map["delete"](n):Dn(t.map,n),n},zn.prototype.get=function(n){var t=this.__data__;
return Cr(n)?(t=typeof n=="string"?t.string:t.hash,Lu?(n=t[n],n="__lodash_hash_undefined__"===n?Z:n):n=iu.call(t,n)?t[n]:Z):n=Uu?t.map.get(n):Zn(t.map,n),n},zn.prototype.has=function(n){var t=this.__data__;return Cr(n)?(t=typeof n=="string"?t.string:t.hash,n=Lu?t[n]!==Z:iu.call(t,n)):n=Uu?t.map.has(n):-1<qn(t.map,n),n},zn.prototype.set=function(n,t){var r=this.__data__;return Cr(n)?(typeof n=="string"?r.string:r.hash)[n]=Lu&&t===Z?"__lodash_hash_undefined__":t:Uu?r.map.set(n,t):Pn(r.map,n,t),this;
},Ln.prototype.push=function(n){var t=this.__data__;Cr(n)?(t=t.__data__,(typeof n=="string"?t.string:t.hash)[n]="__lodash_hash_undefined__"):t.set(n,"__lodash_hash_undefined__")},Fn.prototype.clear=function(){this.__data__={array:[],map:null}},Fn.prototype["delete"]=function(n){var t=this.__data__,r=t.array;return r?Dn(r,n):t.map["delete"](n)},Fn.prototype.get=function(n){var t=this.__data__,r=t.array;return r?Zn(r,n):t.map.get(n)},Fn.prototype.has=function(n){var t=this.__data__,r=t.array;return r?-1<qn(r,n):t.map.has(n);
},Fn.prototype.set=function(n,t){var r=this.__data__,e=r.array;return e&&(199>e.length?Pn(e,n,t):(r.array=null,r.map=new zn(e))),(r=r.map)&&r.set(n,t),this},fe.Cache=zn,yn.after=function(n,t){if(typeof t!="function")throw new ru("Expected a function");return n=Re(n),function(){return 1>--n?t.apply(this,arguments):void 0}},yn.ary=re,yn.assign=$o,yn.assignIn=Fo,yn.assignInWith=Mo,yn.assignWith=No,yn.at=Do,yn.before=ee,yn.bind=Io,yn.bindAll=ii,yn.bindKey=Ro,yn.chain=Jr,yn.chunk=function(n,t){t=Iu(Re(t),0);
var r=n?n.length:0;if(!r||1>t)return[];for(var e=0,u=-1,o=Array(wu(r/t));r>e;)o[++u]=Bt(n,e,e+=t);return o},yn.compact=function(n){for(var t=-1,r=n?n.length:0,e=-1,u=[];++t<r;){var o=n[t];o&&(u[++e]=o)}return u},yn.concat=to,yn.cond=function(n){var t=n?n.length:0,e=mr();return n=t?a(n,function(n){if("function"!=typeof n[1])throw new ru("Expected a function");return[e(n[0]),n[1]]}):[],ce(function(e){for(var u=-1;++u<t;){var o=n[u];if(r(o[0],this,e))return r(o[1],this,e)}})},yn.conforms=function(n){
return tt(nt(n,true))},yn.constant=Te,yn.countBy=mo,yn.create=function(n,t){var r=Pu(n);return t?Hn(r,t):r},yn.curry=ue,yn.curryRight=oe,yn.debounce=ie,yn.defaults=Zo,yn.defaultsDeep=qo,yn.defer=So,yn.delay=Wo,yn.difference=ro,yn.differenceBy=eo,yn.differenceWith=uo,yn.drop=Dr,yn.dropRight=Zr,yn.dropRightWhile=function(n,t){return n&&n.length?Dt(n,mr(t,3),true,true):[]},yn.dropWhile=function(n,t){return n&&n.length?Dt(n,mr(t,3),true):[]},yn.fill=function(n,t,r,e){var u=n?n.length:0;if(!u)return[];for(r&&typeof r!="number"&&Sr(n,t,r)&&(r=0,
e=u),u=n.length,r=Re(r),0>r&&(r=-r>u?0:u+r),e=e===Z||e>u?u:Re(e),0>e&&(e+=u),e=r>e?0:Se(e);e>r;)n[r++]=t;return n},yn.filter=function(n,t){return(Lo(n)?i:ot)(n,mr(t,3))},yn.flatMap=function(n,t){return it(ne(n,t))},yn.flatten=function(n){return n&&n.length?it(n):[]},yn.flattenDeep=function(n){return n&&n.length?it(n,true):[]},yn.flip=function(n){return vr(n,512)},yn.flow=fi,yn.flowRight=ci,yn.fromPairs=function(n){for(var t=-1,r=n?n.length:0,e={};++t<r;){var u=n[t];e[u[0]]=u[1]}return e},yn.functions=function(n){
return null==n?[]:lt(n,$e(n))},yn.functionsIn=function(n){return null==n?[]:lt(n,Fe(n))},yn.groupBy=jo,yn.initial=function(n){return Zr(n,1)},yn.intersection=oo,yn.intersectionBy=io,yn.intersectionWith=fo,yn.invert=Po,yn.invertBy=To,yn.invokeMap=wo,yn.iteratee=Ge,yn.keyBy=Ao,yn.keys=$e,yn.keysIn=Fe,yn.map=ne,yn.mapKeys=function(n,t){var r={};return t=mr(t,3),ct(n,function(n,e,u){r[t(n,e,u)]=n}),r},yn.mapValues=function(n,t){var r={};return t=mr(t,3),ct(n,function(n,e,u){r[e]=t(n,e,u)}),r},yn.matches=function(n){
return jt(nt(n,true))},yn.matchesProperty=function(n,t){return wt(n,nt(t,true))},yn.memoize=fe,yn.merge=Go,yn.mergeWith=Vo,yn.method=ai,yn.methodOf=li,yn.mixin=Ve,yn.negate=function(n){if(typeof n!="function")throw new ru("Expected a function");return function(){return!n.apply(this,arguments)}},yn.nthArg=function(n){return n=Re(n),function(){return arguments[n]}},yn.omit=Jo,yn.omitBy=function(n,t){return t=mr(t,2),kt(n,function(n,r){return!t(n,r)})},yn.once=function(n){return ee(2,n)},yn.orderBy=function(n,t,r,e){
return null==n?[]:(Lo(t)||(t=null==t?[]:[t]),r=e?Z:r,Lo(r)||(r=null==r?[]:[r]),Ot(n,t,r))},yn.over=si,yn.overArgs=Co,yn.overEvery=hi,yn.overSome=pi,yn.partial=Uo,yn.partialRight=Bo,yn.partition=Oo,yn.pick=Yo,yn.pickBy=function(n,t){return null==n?{}:kt(n,mr(t,2))},yn.property=Ye,yn.propertyOf=function(n){return function(t){return null==n?Z:st(n,t)}},yn.pull=co,yn.pullAll=Tr,yn.pullAllBy=function(n,t,r){return n&&n.length&&t&&t.length?St(n,t,mr(r)):n},yn.pullAt=ao,yn.range=_i,yn.rangeRight=gi,yn.rearg=zo,
yn.reject=function(n,t){var r=Lo(n)?i:ot;return t=mr(t,3),r(n,function(n,r,e){return!t(n,r,e)})},yn.remove=function(n,t){var r=[];if(!n||!n.length)return r;var e=-1,u=[],o=n.length;for(t=mr(t,3);++e<o;){var i=n[e];t(i,e,n)&&(r.push(i),u.push(e))}return Wt(n,u),r},yn.rest=ce,yn.reverse=Kr,yn.sampleSize=te,yn.set=function(n,t,r){return null==n?n:Ut(n,t,r)},yn.setWith=function(n,t,r,e){return e=typeof e=="function"?e:Z,null==n?n:Ut(n,t,r,e)},yn.shuffle=function(n){return te(n,4294967295)},yn.slice=function(n,t,r){
var e=n?n.length:0;return e?(r&&typeof r!="number"&&Sr(n,t,r)?(t=0,r=e):(t=null==t?0:Re(t),r=r===Z?e:Re(r)),Bt(n,t,r)):[]},yn.sortBy=Eo,yn.sortedUniq=function(n){return n&&n.length?Ft(n):[]},yn.sortedUniqBy=function(n,t){return n&&n.length?Ft(n,mr(t)):[]},yn.split=function(n,t,r){return Ue(n).split(t,r)},yn.spread=function(n,t){if(typeof n!="function")throw new ru("Expected a function");return t=t===Z?0:Iu(Re(t),0),ce(function(e){var u=e[t];return e=e.slice(0,t),u&&l(e,u),r(n,this,e)})},yn.tail=function(n){
return Dr(n,1)},yn.take=function(n,t,r){return n&&n.length?(t=r||t===Z?1:Re(t),Bt(n,0,0>t?0:t)):[]},yn.takeRight=function(n,t,r){var e=n?n.length:0;return e?(t=r||t===Z?1:Re(t),t=e-t,Bt(n,0>t?0:t,e)):[]},yn.takeRightWhile=function(n,t){return n&&n.length?Dt(n,mr(t,3),false,true):[]},yn.takeWhile=function(n,t){return n&&n.length?Dt(n,mr(t,3)):[]},yn.tap=function(n,t){return t(n),n},yn.throttle=function(n,t,r){var e=true,u=true;if(typeof n!="function")throw new ru("Expected a function");return ye(r)&&(e="leading"in r?!!r.leading:e,
u="trailing"in r?!!r.trailing:u),ie(n,t,{leading:e,maxWait:t,trailing:u})},yn.thru=Yr,yn.toArray=Ie,yn.toPairs=Me,yn.toPairsIn=function(n){return j(n,Fe(n))},yn.toPath=function(n){return Lo(n)?a(n,String):$r(n)},yn.toPlainObject=Ce,yn.transform=function(n,t,r){var e=Lo(n)||Ee(n);if(t=mr(t,4),null==r)if(e||ye(n)){var o=n.constructor;r=e?Lo(n)?new o:[]:Pu(ge(o)?o.prototype:Z)}else r={};return(e?u:ct)(n,function(n,e,u){return t(r,n,e,u)}),r},yn.unary=function(n){return re(n,1)},yn.union=lo,yn.unionBy=so,
yn.unionWith=ho,yn.uniq=function(n){return n&&n.length?Nt(n):[]},yn.uniqBy=function(n,t){return n&&n.length?Nt(n,mr(t)):[]},yn.uniqWith=function(n,t){return n&&n.length?Nt(n,Z,t):[]},yn.unset=function(n,t){var r;if(null==n)r=true;else{r=n;var e=t,e=Wr(e,r)?[e+""]:Mt(e);r=Lr(r,e),e=Pr(e),r=null!=r&&ze(r,e)?delete r[e]:true}return r},yn.unzip=Gr,yn.unzipWith=Vr,yn.values=Ne,yn.valuesIn=function(n){return null==n?A(n,Fe(n)):[]},yn.without=po,yn.words=Pe,yn.wrap=function(n,t){return t=null==t?Ke:t,Uo(t,n);
},yn.xor=_o,yn.xorBy=go,yn.xorWith=vo,yn.zip=yo,yn.zipObject=function(n,t){return Pt(n||[],t||[],Jn)},yn.zipObjectDeep=function(n,t){return Pt(n||[],t||[],Ut)},yn.zipWith=bo,yn.extend=Fo,yn.extendWith=Mo,Ve(yn,yn),yn.add=function(n,t){var r;return n!==Z&&(r=n),t!==Z&&(r=r===Z?t:r+t),r},yn.attempt=oi,yn.camelCase=Ho,yn.capitalize=De,yn.ceil=vi,yn.clamp=function(n,t,r){return r===Z&&(r=t,t=Z),r!==Z&&(r=We(r),r=r===r?r:0),t!==Z&&(t=We(t),t=t===t?t:0),Xn(We(n),t,r)},yn.clone=function(n){return nt(n)},
yn.cloneDeep=function(n){return nt(n,true)},yn.cloneDeepWith=function(n,t){return nt(n,true,t)},yn.cloneWith=function(n,t){return nt(n,false,t)},yn.deburr=Ze,yn.endsWith=function(n,t,r){n=Ue(n),t=typeof t=="string"?t:t+"";var e=n.length;return r=r===Z?e:Xn(Re(r),0,e),r-=t.length,r>=0&&n.indexOf(t,r)==r},yn.eq=ae,yn.escape=function(n){return(n=Ue(n))&&H.test(n)?n.replace(J,S):n},yn.escapeRegExp=function(n){return(n=Ue(n))&&on.test(n)?n.replace(un,"\\$&"):n},yn.every=function(n,t,r){var e=Lo(n)?o:ut;return r&&Sr(n,t,r)&&(t=Z),
e(n,mr(t,3))},yn.find=function(n,t){if(t=mr(t,3),Lo(n)){var r=v(n,t);return r>-1?n[r]:Z}return g(n,t,Tu)},yn.findIndex=function(n,t){return n&&n.length?v(n,mr(t,3)):-1},yn.findKey=function(n,t){return g(n,mr(t,3),ct,true)},yn.findLast=function(n,t){if(t=mr(t,3),Lo(n)){var r=v(n,t,true);return r>-1?n[r]:Z}return g(n,t,Ku)},yn.findLastIndex=function(n,t){return n&&n.length?v(n,mr(t,3),true):-1},yn.findLastKey=function(n,t){return g(n,mr(t,3),at,true)},yn.floor=di,yn.forEach=Qr,yn.forEachRight=Xr,yn.forIn=function(n,t){
return null==n?n:Gu(n,Mr(t),Fe)},yn.forInRight=function(n,t){return null==n?n:Vu(n,Mr(t),Fe)},yn.forOwn=function(n,t){return n&&ct(n,Mr(t))},yn.forOwnRight=function(n,t){return n&&at(n,Mr(t))},yn.get=Be,yn.gt=le,yn.gte=function(n,t){return n>=t},yn.has=ze,yn.hasIn=Le,yn.head=qr,yn.identity=Ke,yn.includes=function(n,t,r,e){return n=he(n)?n:Ne(n),r=r&&!e?Re(r):0,e=n.length,0>r&&(r=Iu(e+r,0)),Ae(n)?e>=r&&-1<n.indexOf(t,r):!!e&&-1<d(n,t,r)},yn.indexOf=function(n,t,r){var e=n?n.length:0;return e?(r=Re(r),
0>r&&(r=Iu(e+r,0)),d(n,t,r)):-1},yn.inRange=function(n,t,r){return t=We(t)||0,r===Z?(r=t,t=0):r=We(r)||0,n=We(n),n>=Ru(t,r)&&n<Iu(t,r)},yn.invoke=Ko,yn.isArguments=se,yn.isArray=Lo,yn.isArrayLike=he,yn.isArrayLikeObject=pe,yn.isBoolean=function(n){return true===n||false===n||be(n)&&"[object Boolean]"==au.call(n)},yn.isDate=function(n){return be(n)&&"[object Date]"==au.call(n)},yn.isElement=function(n){return!!n&&1===n.nodeType&&be(n)&&!je(n)},yn.isEmpty=function(n){if(he(n)&&(Lo(n)||Ae(n)||ge(n.splice)||se(n)))return!n.length;
for(var t in n)if(iu.call(n,t))return false;return true},yn.isEqual=function(n,t){return dt(n,t)},yn.isEqualWith=function(n,t,r){var e=(r=typeof r=="function"?r:Z)?r(n,t):Z;return e===Z?dt(n,t,r):!!e},yn.isError=_e,yn.isFinite=function(n){return typeof n=="number"&&Ou(n)},yn.isFunction=ge,yn.isInteger=ve,yn.isLength=de,yn.isMatch=function(n,t){return n===t||yt(n,t,jr(t))},yn.isMatchWith=function(n,t,r){return r=typeof r=="function"?r:Z,yt(n,t,jr(t),r)},yn.isNaN=function(n){return me(n)&&n!=+n},yn.isNative=xe,
yn.isNil=function(n){return null==n},yn.isNull=function(n){return null===n},yn.isNumber=me,yn.isObject=ye,yn.isObjectLike=be,yn.isPlainObject=je,yn.isRegExp=we,yn.isSafeInteger=function(n){return ve(n)&&n>=-9007199254740991&&9007199254740991>=n},yn.isString=Ae,yn.isSymbol=Oe,yn.isTypedArray=Ee,yn.isUndefined=function(n){return n===Z},yn.join=function(n,t){return n?Eu.call(n,t):""},yn.kebabCase=Qo,yn.last=Pr,yn.lastIndexOf=function(n,t,r){var e=n?n.length:0;if(!e)return-1;var u=e;if(r!==Z&&(u=Re(r),
u=(0>u?Iu(e+u,0):Ru(u,e-1))+1),t!==t)return C(n,u,true);for(;u--;)if(n[u]===t)return u;return-1},yn.lowerCase=Xo,yn.lowerFirst=ni,yn.lt=ke,yn.lte=function(n,t){return t>=n},yn.max=function(n){return n&&n.length?_(n,Ke,le):Z},yn.maxBy=function(n,t){return n&&n.length?_(n,mr(t),le):Z},yn.mean=function(n){return He(n)/(n?n.length:0)},yn.min=function(n){return n&&n.length?_(n,Ke,ke):Z},yn.minBy=function(n,t){return n&&n.length?_(n,mr(t),ke):Z},yn.noConflict=function(){return Gn._===this&&(Gn._=lu),this;
},yn.noop=Je,yn.now=ko,yn.pad=function(n,t,r){n=Ue(n),t=Re(t);var e=M(n);return t&&t>e?(e=(t-e)/2,t=Au(e),e=wu(e),sr("",t,r)+n+sr("",e,r)):n},yn.padEnd=function(n,t,r){return n=Ue(n),n+sr(n,t,r)},yn.padStart=function(n,t,r){return n=Ue(n),sr(n,t,r)+n},yn.parseInt=function(n,t,r){return r||null==t?t=0:t&&(t=+t),n=Ue(n).replace(fn,""),Su(n,t||(pn.test(n)?16:10))},yn.random=function(n,t,r){if(r&&typeof r!="boolean"&&Sr(n,t,r)&&(t=r=Z),r===Z&&(typeof t=="boolean"?(r=t,t=Z):typeof n=="boolean"&&(r=n,n=Z)),
n===Z&&t===Z?(n=0,t=1):(n=We(n)||0,t===Z?(t=n,n=0):t=We(t)||0),n>t){var e=n;n=t,t=e}return r||n%1||t%1?(r=Wu(),Ru(n+r*(t-n+Mn("1e-"+((r+"").length-1))),t)):Ct(n,t)},yn.reduce=function(n,t,r){var e=Lo(n)?s:y,u=3>arguments.length;return e(n,mr(t,4),r,u,Tu)},yn.reduceRight=function(n,t,r){var e=Lo(n)?h:y,u=3>arguments.length;return e(n,mr(t,4),r,u,Ku)},yn.repeat=qe,yn.replace=function(){var n=arguments,t=Ue(n[0]);return 3>n.length?t:t.replace(n[1],n[2])},yn.result=function(n,t,r){if(Wr(t,n))e=null==n?Z:n[t];else{
t=Mt(t);var e=Be(n,t);n=Lr(n,t)}return e===Z&&(e=r),ge(e)?e.call(n):e},yn.round=yi,yn.runInContext=D,yn.sample=function(n){n=he(n)?n:Ne(n);var t=n.length;return t>0?n[Ct(0,t-1)]:Z},yn.size=function(n){if(null==n)return 0;if(he(n)){var t=n.length;return t&&Ae(n)?M(n):t}return $e(n).length},yn.snakeCase=ri,yn.some=function(n,t,r){var e=Lo(n)?p:zt;return r&&Sr(n,t,r)&&(t=Z),e(n,mr(t,3))},yn.sortedIndex=function(n,t){return Lt(n,t)},yn.sortedIndexBy=function(n,t,r){return $t(n,t,mr(r))},yn.sortedIndexOf=function(n,t){
var r=n?n.length:0;if(r){var e=Lt(n,t);if(r>e&&ae(n[e],t))return e}return-1},yn.sortedLastIndex=function(n,t){return Lt(n,t,true)},yn.sortedLastIndexBy=function(n,t,r){return $t(n,t,mr(r),true)},yn.sortedLastIndexOf=function(n,t){if(n&&n.length){var r=Lt(n,t,true)-1;if(ae(n[r],t))return r}return-1},yn.startCase=ei,yn.startsWith=function(n,t,r){return n=Ue(n),r=Xn(Re(r),0,n.length),n.lastIndexOf(t,r)==r},yn.subtract=function(n,t){var r;return n!==Z&&(r=n),t!==Z&&(r=r===Z?t:r-t),r},yn.sum=He,yn.sumBy=function(n,t){
return n&&n.length?x(n,mr(t)):0},yn.template=function(n,t,r){var e=yn.templateSettings;r&&Sr(n,t,r)&&(t=Z),n=Ue(n),t=Mo({},t,e,Tn),r=Mo({},t.imports,e.imports,Tn);var u,o,i=$e(r),f=A(r,i),c=0;r=t.interpolate||xn;var a="__p+='";r=tu((t.escape||xn).source+"|"+r.source+"|"+(r===nn?sn:xn).source+"|"+(t.evaluate||xn).source+"|$","g");var l="sourceURL"in t?"//# sourceURL="+t.sourceURL+"\n":"";if(n.replace(r,function(t,r,e,i,f,l){return e||(e=i),a+=n.slice(c,l).replace(mn,W),r&&(u=true,a+="'+__e("+r+")+'"),
f&&(o=true,a+="';"+f+";\n__p+='"),e&&(a+="'+((__t=("+e+"))==null?'':__t)+'"),c=l+t.length,t}),a+="';",(t=t.variable)||(a="with(obj){"+a+"}"),a=(o?a.replace(T,""):a).replace(K,"$1").replace(G,"$1;"),a="function("+(t||"obj")+"){"+(t?"":"obj||(obj={});")+"var __t,__p=''"+(u?",__e=_.escape":"")+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+a+"return __p}",t=oi(function(){return Function(i,l+"return "+a).apply(Z,f)}),t.source=a,_e(t))throw t;return t},yn.times=function(n,t){
if(n=Re(n),1>n||n>9007199254740991)return[];var r=4294967295,e=Ru(n,4294967295);for(t=Mr(t),n-=4294967295,e=m(e,t);++r<n;)t(r);return e},yn.toInteger=Re,yn.toLength=Se,yn.toLower=function(n){return Ue(n).toLowerCase()},yn.toNumber=We,yn.toSafeInteger=function(n){return Xn(Re(n),-9007199254740991,9007199254740991)},yn.toString=Ue,yn.toUpper=function(n){return Ue(n).toUpperCase()},yn.trim=function(n,t,r){return(n=Ue(n))?r||t===Z?n.replace(fn,""):(t+="")?(n=n.match(En),t=t.match(En),n.slice(O(n,t),E(n,t)+1).join("")):n:n;
},yn.trimEnd=function(n,t,r){return(n=Ue(n))?r||t===Z?n.replace(an,""):(t+="")?(n=n.match(En),n.slice(0,E(n,t.match(En))+1).join("")):n:n},yn.trimStart=function(n,t,r){return(n=Ue(n))?r||t===Z?n.replace(cn,""):(t+="")?(n=n.match(En),n.slice(O(n,t.match(En))).join("")):n:n},yn.truncate=function(n,t){var r=30,e="...";if(ye(t))var u="separator"in t?t.separator:u,r="length"in t?Re(t.length):r,e="omission"in t?Ue(t.omission):e;n=Ue(n);var o=n.length;if(kn.test(n))var i=n.match(En),o=i.length;if(r>=o)return n;
if(o=r-M(e),1>o)return e;if(r=i?i.slice(0,o).join(""):n.slice(0,o),u===Z)return r+e;if(i&&(o+=r.length-o),we(u)){if(n.slice(o).search(u)){var f=r;for(u.global||(u=tu(u.source,Ue(hn.exec(u))+"g")),u.lastIndex=0;i=u.exec(f);)var c=i.index;r=r.slice(0,c===Z?o:c)}}else n.indexOf(u,o)!=o&&(u=r.lastIndexOf(u),u>-1&&(r=r.slice(0,u)));return r+e},yn.unescape=function(n){return(n=Ue(n))&&Y.test(n)?n.replace(V,N):n},yn.uniqueId=function(n){var t=++fu;return Ue(n)+t},yn.upperCase=ui,yn.upperFirst=ti,yn.each=Qr,
yn.eachRight=Xr,yn.first=qr,Ve(yn,function(){var n={};return ct(yn,function(t,r){iu.call(yn.prototype,r)||(n[r]=t)}),n}(),{chain:false}),yn.VERSION="4.2.1",u("bind bindKey curry curryRight partial partialRight".split(" "),function(n){yn[n].placeholder=yn}),u(["drop","take"],function(n,t){An.prototype[n]=function(r){var e=this.__filtered__;if(e&&!t)return new An(this);r=r===Z?1:Iu(Re(r),0);var u=this.clone();return e?u.__takeCount__=Ru(r,u.__takeCount__):u.__views__.push({size:Ru(r,4294967295),type:n+(0>u.__dir__?"Right":"")
}),u},An.prototype[n+"Right"]=function(t){return this.reverse()[n](t).reverse()}}),u(["filter","map","takeWhile"],function(n,t){var r=t+1,e=1==r||3==r;An.prototype[n]=function(n){var t=this.clone();return t.__iteratees__.push({iteratee:mr(n,3),type:r}),t.__filtered__=t.__filtered__||e,t}}),u(["head","last"],function(n,t){var r="take"+(t?"Right":"");An.prototype[n]=function(){return this[r](1).value()[0]}}),u(["initial","tail"],function(n,t){var r="drop"+(t?"":"Right");An.prototype[n]=function(){return this.__filtered__?new An(this):this[r](1);
}}),An.prototype.compact=function(){return this.filter(Ke)},An.prototype.find=function(n){return this.filter(n).head()},An.prototype.findLast=function(n){return this.reverse().find(n)},An.prototype.invokeMap=ce(function(n,t){return typeof n=="function"?new An(this):this.map(function(r){return vt(r,n,t)})}),An.prototype.reject=function(n){return n=mr(n,3),this.filter(function(t){return!n(t)})},An.prototype.slice=function(n,t){n=Re(n);var r=this;return r.__filtered__&&(n>0||0>t)?new An(r):(0>n?r=r.takeRight(-n):n&&(r=r.drop(n)),
t!==Z&&(t=Re(t),r=0>t?r.dropRight(-t):r.take(t-n)),r)},An.prototype.takeRightWhile=function(n){return this.reverse().takeWhile(n).reverse()},An.prototype.toArray=function(){return this.take(4294967295)},ct(An.prototype,function(n,t){var r=/^(?:filter|find|map|reject)|While$/.test(t),e=/^(?:head|last)$/.test(t),u=yn[e?"take"+("last"==t?"Right":""):t],o=e||/^find/.test(t);u&&(yn.prototype[t]=function(){function t(n){return n=u.apply(yn,l([n],f)),e&&h?n[0]:n}var i=this.__wrapped__,f=e?[1]:arguments,c=i instanceof An,a=f[0],s=c||Lo(i);
s&&r&&typeof a=="function"&&1!=a.length&&(c=s=false);var h=this.__chain__,p=!!this.__actions__.length,a=o&&!h,c=c&&!p;return!o&&s?(i=c?i:new An(this),i=n.apply(i,f),i.__actions__.push({func:Yr,args:[t],thisArg:Z}),new wn(i,h)):a&&c?n.apply(this,f):(i=this.thru(t),a?e?i.value()[0]:i.value():i)})}),u("pop push shift sort splice unshift".split(" "),function(n){var t=eu[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:pop|shift)$/.test(n);yn.prototype[n]=function(){var n=arguments;return e&&!this.__chain__?t.apply(this.value(),n):this[r](function(r){
return t.apply(r,n)})}}),ct(An.prototype,function(n,t){var r=yn[t];if(r){var e=r.name+"";(qu[e]||(qu[e]=[])).push({name:t,func:r})}}),qu[cr(Z,2).name]=[{name:"wrapper",func:Z}],An.prototype.clone=function(){var n=new An(this.__wrapped__);return n.__actions__=Vt(this.__actions__),n.__dir__=this.__dir__,n.__filtered__=this.__filtered__,n.__iteratees__=Vt(this.__iteratees__),n.__takeCount__=this.__takeCount__,n.__views__=Vt(this.__views__),n},An.prototype.reverse=function(){if(this.__filtered__){var n=new An(this);
n.__dir__=-1,n.__filtered__=true}else n=this.clone(),n.__dir__*=-1;return n},An.prototype.value=function(){var n,t=this.__wrapped__.value(),r=this.__dir__,e=Lo(t),u=0>r,o=e?t.length:0;n=o;for(var i=this.__views__,f=0,c=-1,a=i.length;++c<a;){var l=i[c],s=l.size;switch(l.type){case"drop":f+=s;break;case"dropRight":n-=s;break;case"take":n=Ru(n,f+s);break;case"takeRight":f=Iu(f,n-s)}}if(n={start:f,end:n},i=n.start,f=n.end,n=f-i,u=u?f:i-1,i=this.__iteratees__,f=i.length,c=0,a=Ru(n,this.__takeCount__),!e||200>o||o==n&&a==n)return Zt(t,this.__actions__);
e=[];n:for(;n--&&a>c;){for(u+=r,o=-1,l=t[u];++o<f;){var h=i[o],s=h.type,h=(0,h.iteratee)(l);if(2==s)l=h;else if(!h){if(1==s)continue n;break n}}e[c++]=l}return e},yn.prototype.at=xo,yn.prototype.chain=function(){return Jr(this)},yn.prototype.commit=function(){return new wn(this.value(),this.__chain__)},yn.prototype.flatMap=function(n){return this.map(n).flatten()},yn.prototype.next=function(){this.__values__===Z&&(this.__values__=Ie(this.value()));var n=this.__index__>=this.__values__.length,t=n?Z:this.__values__[this.__index__++];
return{done:n,value:t}},yn.prototype.plant=function(n){for(var t,r=this;r instanceof jn;){var e=Nr(r);e.__index__=0,e.__values__=Z,t?u.__wrapped__=e:t=e;var u=e,r=r.__wrapped__}return u.__wrapped__=n,t},yn.prototype.reverse=function(){var n=this.__wrapped__;return n instanceof An?(this.__actions__.length&&(n=new An(this)),n=n.reverse(),n.__actions__.push({func:Yr,args:[Kr],thisArg:Z}),new wn(n,this.__chain__)):this.thru(Kr)},yn.prototype.toJSON=yn.prototype.valueOf=yn.prototype.value=function(){return Zt(this.__wrapped__,this.__actions__);
},bu&&(yn.prototype[bu]=Hr),yn}var Z,q=1/0,P=NaN,T=/\b__p\+='';/g,K=/\b(__p\+=)''\+/g,G=/(__e\(.*?\)|\b__t\))\+'';/g,V=/&(?:amp|lt|gt|quot|#39|#96);/g,J=/[&<>"'`]/g,Y=RegExp(V.source),H=RegExp(J.source),Q=/<%-([\s\S]+?)%>/g,X=/<%([\s\S]+?)%>/g,nn=/<%=([\s\S]+?)%>/g,tn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,rn=/^\w*$/,en=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g,un=/[\\^$.*+?()[\]{}|]/g,on=RegExp(un.source),fn=/^\s+|\s+$/g,cn=/^\s+/,an=/\s+$/,ln=/\\(\\)?/g,sn=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,hn=/\w*$/,pn=/^0x/i,_n=/^[-+]0x[0-9a-f]+$/i,gn=/^0b[01]+$/i,vn=/^\[object .+?Constructor\]$/,dn=/^0o[0-7]+$/i,yn=/^(?:0|[1-9]\d*)$/,bn=/[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g,xn=/($^)/,mn=/['\n\r\u2028\u2029\\]/g,jn="[\\ufe0e\\ufe0f]?(?:[\\u0300-\\u036f\\ufe20-\\ufe23\\u20d0-\\u20f0]|\\ud83c[\\udffb-\\udfff])?(?:\\u200d(?:[^\\ud800-\\udfff]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])[\\ufe0e\\ufe0f]?(?:[\\u0300-\\u036f\\ufe20-\\ufe23\\u20d0-\\u20f0]|\\ud83c[\\udffb-\\udfff])?)*",wn="(?:[\\u2700-\\u27bf]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])"+jn,An="(?:[^\\ud800-\\udfff][\\u0300-\\u036f\\ufe20-\\ufe23\\u20d0-\\u20f0]?|[\\u0300-\\u036f\\ufe20-\\ufe23\\u20d0-\\u20f0]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff]|[\\ud800-\\udfff])",On=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe23\\u20d0-\\u20f0]","g"),En=RegExp("\\ud83c[\\udffb-\\udfff](?=\\ud83c[\\udffb-\\udfff])|"+An+jn,"g"),kn=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe23\\u20d0-\\u20f0\\ufe0e\\ufe0f]"),In=/[a-zA-Z0-9]+/g,Rn=RegExp(["[A-Z\\xc0-\\xd6\\xd8-\\xde]?[a-z\\xdf-\\xf6\\xf8-\\xff]+(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2018\\u2019\\u201c\\u201d \\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]|[A-Z\\xc0-\\xd6\\xd8-\\xde]|$)|(?:[A-Z\\xc0-\\xd6\\xd8-\\xde]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2018\\u2019\\u201c\\u201d \\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\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2018\\u2019\\u201c\\u201d \\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]|[A-Z\\xc0-\\xd6\\xd8-\\xde](?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2018\\u2019\\u201c\\u201d \\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\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])|$)|[A-Z\\xc0-\\xd6\\xd8-\\xde]?(?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2018\\u2019\\u201c\\u201d \\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\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+|[A-Z\\xc0-\\xd6\\xd8-\\xde]+|\\d+",wn].join("|"),"g"),Sn=/[a-z][A-Z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Wn="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 parseInt setTimeout".split(" "),Cn={};
Cn["[object Float32Array]"]=Cn["[object Float64Array]"]=Cn["[object Int8Array]"]=Cn["[object Int16Array]"]=Cn["[object Int32Array]"]=Cn["[object Uint8Array]"]=Cn["[object Uint8ClampedArray]"]=Cn["[object Uint16Array]"]=Cn["[object Uint32Array]"]=true,Cn["[object Arguments]"]=Cn["[object Array]"]=Cn["[object ArrayBuffer]"]=Cn["[object Boolean]"]=Cn["[object Date]"]=Cn["[object Error]"]=Cn["[object Function]"]=Cn["[object Map]"]=Cn["[object Number]"]=Cn["[object Object]"]=Cn["[object RegExp]"]=Cn["[object Set]"]=Cn["[object String]"]=Cn["[object WeakMap]"]=false;
var Un={};Un["[object Arguments]"]=Un["[object Array]"]=Un["[object ArrayBuffer]"]=Un["[object Boolean]"]=Un["[object Date]"]=Un["[object Float32Array]"]=Un["[object Float64Array]"]=Un["[object Int8Array]"]=Un["[object Int16Array]"]=Un["[object Int32Array]"]=Un["[object Map]"]=Un["[object Number]"]=Un["[object Object]"]=Un["[object RegExp]"]=Un["[object Set]"]=Un["[object String]"]=Un["[object Symbol]"]=Un["[object Uint8Array]"]=Un["[object Uint8ClampedArray]"]=Un["[object Uint16Array]"]=Un["[object Uint32Array]"]=true,
Un["[object Error]"]=Un["[object Function]"]=Un["[object WeakMap]"]=false;var Bn={"\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"},zn={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","`":"&#96;"},Ln={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'","&#96;":"`"},$n={"function":true,object:true},Fn={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"
},Mn=parseFloat,Nn=parseInt,Dn=$n[typeof exports]&&exports&&!exports.nodeType?exports:null,Zn=$n[typeof module]&&module&&!module.nodeType?module:null,qn=k($n[typeof self]&&self),Pn=k($n[typeof window]&&window),Tn=Zn&&Zn.exports===Dn?Dn:null,Kn=k($n[typeof this]&&this),Gn=k(Dn&&Zn&&typeof global=="object"&&global)||Pn!==(Kn&&Kn.window)&&Pn||qn||Kn||Function("return this")(),Vn=D();(Pn||qn||{})._=Vn,typeof define=="function"&&typeof define.amd=="object"&&define.amd? define(function(){return Vn}):Dn&&Zn?(Tn&&((Zn.exports=Vn)._=Vn),
Dn._=Vn):Gn._=Vn}).call(this);

301
dist/mapping.fp.js vendored Normal file
View File

@@ -0,0 +1,301 @@
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else if(typeof exports === 'object')
exports["mapping"] = factory();
else
root["mapping"] = factory();
})(this, function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports) {
/** Used to map aliases to their real names. */
exports.aliasToReal = {
'__': 'placeholder',
'all': 'some',
'allPass': 'overEvery',
'apply': 'spread',
'assoc': 'set',
'assocPath': 'set',
'compose': 'flowRight',
'contains': 'includes',
'dissoc': 'unset',
'dissocPath': 'unset',
'each': 'forEach',
'eachRight': 'forEachRight',
'equals': 'isEqual',
'extend': 'assignIn',
'extendWith': 'assignInWith',
'first': 'head',
'init': 'initial',
'mapObj': 'mapValues',
'omitAll': 'omit',
'nAry': 'ary',
'path': 'get',
'pathEq': 'matchesProperty',
'pathOr': 'getOr',
'pickAll': 'pick',
'pipe': 'flow',
'prop': 'get',
'propOf': 'propertyOf',
'propOr': 'getOr',
'somePass': 'overSome',
'unapply': 'rest',
'unnest': 'flatten',
'useWith': 'overArgs',
'whereEq': 'filter',
'zipObj': 'zipObject'
};
/** Used to map ary to method names. */
exports.aryMethod = {
1: [
'attempt', 'ceil', 'create', 'curry', 'curryRight', 'floor', 'fromPairs',
'invert', 'iteratee', 'memoize', 'method', 'methodOf', 'mixin', 'over',
'overEvery', 'overSome', 'rest', 'reverse', 'round', 'runInContext',
'spread', 'template', 'trim', 'trimEnd', 'trimStart', 'uniqueId', 'words'
],
2: [
'add', 'after', 'ary', 'assign', 'assignIn', 'at', 'before', 'bind', 'bindKey',
'chunk', 'cloneDeepWith', 'cloneWith', 'concat', 'countBy', 'curryN',
'curryRightN', 'debounce', 'defaults', 'defaultsDeep', 'delay', 'difference',
'drop', 'dropRight', 'dropRightWhile', 'dropWhile', 'endsWith', 'eq', 'every',
'filter', 'find', 'find', 'findIndex', 'findKey', 'findLast', 'findLastIndex',
'findLastKey', 'flatMap', 'forEach', 'forEachRight', 'forIn', 'forInRight',
'forOwn', 'forOwnRight', 'get', 'groupBy', 'gt', 'gte', 'has', 'hasIn',
'includes', 'indexOf', 'intersection', 'invertBy', 'invoke', 'invokeMap',
'isEqual', 'isMatch', 'join', 'keyBy', 'lastIndexOf', 'lt', 'lte', 'map',
'mapKeys', 'mapValues', 'matchesProperty', 'maxBy', 'merge', 'minBy', 'omit',
'omitBy', 'orderBy', 'overArgs', 'pad', 'padEnd', 'padStart', 'parseInt',
'partial', 'partialRight', 'partition', 'pick', 'pickBy', 'pull', 'pullAll',
'pullAt', 'random', 'range', 'rangeRight', 'rearg', 'reject', 'remove',
'repeat', 'result', 'sampleSize', 'some', 'sortBy', 'sortedIndex',
'sortedIndexOf', 'sortedLastIndex', 'sortedLastIndexOf', 'sortedUniqBy',
'split', 'startsWith', 'subtract', 'sumBy', 'take', 'takeRight', 'takeRightWhile',
'takeWhile', 'tap', 'throttle', 'thru', 'times', 'trimChars', 'trimCharsEnd',
'trimCharsStart', 'truncate', 'union', 'uniqBy', 'uniqWith', 'unset',
'unzipWith', 'without', 'wrap', 'xor', 'zip', 'zipObject', 'zipObjectDeep'
],
3: [
'assignInWith', 'assignWith', 'clamp', 'differenceBy', 'differenceWith',
'getOr', 'inRange', 'intersectionBy', 'intersectionWith', 'isEqualWith',
'isMatchWith', 'mergeWith', 'pullAllBy', 'reduce', 'reduceRight', 'replace',
'set', 'slice', 'sortedIndexBy', 'sortedLastIndexBy', 'transform', 'unionBy',
'unionWith', 'xorBy', 'xorWith', 'zipWith'
],
4: [
'fill', 'setWith'
]
};
/** Used to map ary to rearg configs. */
exports.aryRearg = {
2: [1, 0],
3: [2, 1, 0],
4: [3, 2, 0, 1]
};
/** Used to iterate `mapping.aryMethod` keys. */
exports.caps = [1, 2, 3, 4];
/** Used to map method names to their iteratee ary. */
exports.iterateeAry = {
'assignWith': 2,
'assignInWith': 2,
'cloneDeepWith': 1,
'cloneWith': 1,
'dropRightWhile': 1,
'dropWhile': 1,
'every': 1,
'filter': 1,
'find': 1,
'findIndex': 1,
'findKey': 1,
'findLast': 1,
'findLastIndex': 1,
'findLastKey': 1,
'flatMap': 1,
'forEach': 1,
'forEachRight': 1,
'forIn': 1,
'forInRight': 1,
'forOwn': 1,
'forOwnRight': 1,
'isEqualWith': 2,
'isMatchWith': 2,
'map': 1,
'mapKeys': 1,
'mapValues': 1,
'partition': 1,
'reduce': 2,
'reduceRight': 2,
'reject': 1,
'remove': 1,
'some': 1,
'takeRightWhile': 1,
'takeWhile': 1,
'times': 1,
'transform': 2
};
/** Used to map method names to iteratee rearg configs. */
exports.iterateeRearg = {
'findKey': [1],
'findLastKey': [1],
'mapKeys': [1]
};
/** Used to map method names to rearg configs. */
exports.methodRearg = {
'assignInWith': [1, 2, 0],
'assignWith': [1, 2, 0],
'clamp': [2, 0, 1],
'mergeWith': [1, 2, 0],
'reduce': [2, 0, 1],
'reduceRight': [2, 0, 1],
'set': [2, 0, 1],
'setWith': [3, 1, 2, 0],
'slice': [2, 0, 1],
'transform': [2, 0, 1]
};
/** Used to map method names to spread configs. */
exports.methodSpread = {
'partial': 1,
'partialRight': 1
};
/** Used to identify methods which mutate arrays or objects. */
exports.mutate = {
'array': {
'fill': true,
'pull': true,
'pullAll': true,
'pullAllBy': true,
'pullAt': true,
'remove': true,
'reverse': true
},
'object': {
'assign': true,
'assignIn': true,
'assignInWith': true,
'assignWith': true,
'defaults': true,
'defaultsDeep': true,
'merge': true,
'mergeWith': true
},
'set': {
'set': true,
'setWith': true,
'unset': true
}
};
/** Used to track methods with placeholder support */
exports.placeholder = {
'bind': true,
'bindKey': true,
'curry': true,
'curryRight': true,
'partial': true,
'partialRight': true
};
/** Used to map real names to their aliases. */
exports.realToAlias = (function() {
var hasOwnProperty = Object.prototype.hasOwnProperty,
object = exports.aliasToReal,
result = {};
for (var key in object) {
var value = object[key];
if (hasOwnProperty.call(result, value)) {
result[value].push(key);
} else {
result[value] = [key];
}
}
return result;
}());
/** Used to map method names to other names. */
exports.rename = {
'curryN': 'curry',
'curryRightN': 'curryRight',
'getOr': 'get',
'trimChars': 'trim',
'trimCharsEnd': 'trimEnd',
'trimCharsStart': 'trimStart'
};
/** Used to track methods that skip `_.rearg`. */
exports.skipRearg = {
'add': true,
'assign': true,
'assignIn': true,
'concat': true,
'difference': true,
'matchesProperty': true,
'merge': true,
'partial': true,
'partialRight': true,
'random': true,
'range': true,
'rangeRight': true,
'subtract': true,
'zip': true,
'zipObject': true
};
/***/ }
/******/ ])
});
;

File diff suppressed because it is too large Load Diff

237
fp/_baseConvert.js Normal file
View File

@@ -0,0 +1,237 @@
var mapping = require('./_mapping'),
mutateMap = mapping.mutate,
placeholder = {};
/**
* The base implementation of `convert` which accepts a `util` object of methods
* required to perform conversions.
*
* @param {Object} util The util object.
* @param {string} name The name of the function to wrap.
* @param {Function} func The function to wrap.
* @returns {Function|Object} Returns the converted function or object.
*/
function baseConvert(util, name, func) {
if (typeof func != 'function') {
func = name;
name = undefined;
}
if (func == null) {
throw new TypeError;
}
var isLib = name === undefined && typeof func.VERSION == 'string';
var _ = isLib ? func : {
'ary': util.ary,
'cloneDeep': util.cloneDeep,
'curry': util.curry,
'forEach': util.forEach,
'isFunction': util.isFunction,
'iteratee': util.iteratee,
'keys': util.keys,
'rearg': util.rearg,
'spread': util.spread
};
var ary = _.ary,
cloneDeep = _.cloneDeep,
curry = _.curry,
each = _.forEach,
isFunction = _.isFunction,
keys = _.keys,
rearg = _.rearg,
spread = _.spread;
var baseArity = function(func, n) {
return n == 2
? function(a, b) { return func.apply(undefined, arguments); }
: function(a) { return func.apply(undefined, arguments); };
};
var baseAry = function(func, n) {
return n == 2
? function(a, b) { return func(a, b); }
: function(a) { return func(a); };
};
var cloneArray = function(array) {
var length = array ? array.length : 0,
result = Array(length);
while (length--) {
result[length] = array[length];
}
return result;
};
var createCloner = function(func) {
return function(object) {
return func({}, object);
};
};
var immutWrap = function(func, cloner) {
return overArg(func, cloner, true);
};
var iterateeAry = function(func, n) {
return overArg(func, function(func) {
return baseAry(func, n);
});
};
var iterateeRearg = function(func, indexes) {
return overArg(func, function(func) {
var n = indexes.length;
return baseArity(rearg(baseAry(func, n), indexes), n);
});
};
var overArg = function(func, iteratee, retArg) {
return function() {
var length = arguments.length,
args = Array(length);
while (length--) {
args[length] = arguments[length];
}
args[0] = iteratee(args[0]);
var result = func.apply(undefined, args);
return retArg ? args[0] : result;
};
};
var wrappers = {
'iteratee': function(iteratee) {
return function() {
var func = arguments[0],
arity = arguments[1];
arity = arity > 2 ? (arity - 2) : 1;
func = iteratee(func);
var length = func.length;
return (length && length <= arity) ? func : baseAry(func, arity);
};
},
'mixin': function(mixin) {
return function(source) {
var func = this;
if (!isFunction(func)) {
return mixin(func, Object(source));
}
var methods = [],
methodNames = [];
each(keys(source), function(key) {
var value = source[key];
if (isFunction(value)) {
methodNames.push(key);
methods.push(func.prototype[key]);
}
});
mixin(func, Object(source));
each(methodNames, function(methodName, index) {
var method = methods[index];
if (isFunction(method)) {
func.prototype[methodName] = method;
} else {
delete func.prototype[methodName];
}
});
return func;
};
},
'runInContext': function(runInContext) {
return function(context) {
return baseConvert(util, runInContext(context));
};
}
};
var wrap = function(name, func) {
name = mapping.aliasToReal[name] || name;
var wrapper = wrappers[name];
if (wrapper) {
return wrapper(func);
}
var wrapped = func;
if (mutateMap.array[name]) {
wrapped = immutWrap(func, cloneArray);
}
else if (mutateMap.object[name]) {
wrapped = immutWrap(func, createCloner(func));
}
else if (mutateMap.set[name]) {
wrapped = immutWrap(func, cloneDeep);
}
var result;
each(mapping.caps, function(cap) {
each(mapping.aryMethod[cap], function(otherName) {
if (name == otherName) {
var aryN = !isLib && mapping.iterateeAry[name],
reargIndexes = mapping.iterateeRearg[name],
spreadStart = mapping.methodSpread[name];
result = spreadStart === undefined
? ary(wrapped, cap)
: spread(wrapped, spreadStart);
if (cap > 1 && !mapping.skipRearg[name]) {
result = rearg(result, mapping.methodRearg[name] || mapping.aryRearg[cap]);
}
if (reargIndexes) {
result = iterateeRearg(result, reargIndexes);
} else if (aryN) {
result = iterateeAry(result, aryN);
}
if (cap > 1) {
result = curry(result, cap);
}
return false;
}
});
return !result;
});
result || (result = func);
if (mapping.placeholder[name]) {
func.placeholder = result.placeholder = placeholder;
}
return result;
};
if (!isLib) {
return wrap(name, func);
}
// Add placeholder.
_.placeholder = placeholder;
// Iterate over methods for the current ary cap.
var pairs = [];
each(mapping.caps, function(cap) {
each(mapping.aryMethod[cap], function(key) {
var func = _[mapping.rename[key] || key];
if (func) {
pairs.push([key, wrap(key, func)]);
}
});
});
// Assign to `_` leaving `_.prototype` unchanged to allow chaining.
each(pairs, function(pair) {
_[pair[0]] = pair[1];
});
// Wrap the lodash method and its aliases.
each(keys(_), function(key) {
each(mapping.realToAlias[key] || [], function(alias) {
_[alias] = _[key];
});
});
return _;
}
module.exports = baseConvert;

13
fp/_convertBrowser.js Normal file
View File

@@ -0,0 +1,13 @@
var baseConvert = require('./_baseConvert');
/**
* Converts `lodash` to an immutable auto-curried iteratee-first data-last version.
*
* @param {Function} lodash The lodash function.
* @returns {Function} Returns the converted `lodash`.
*/
function browserConvert(lodash) {
return baseConvert(lodash, lodash);
}
module.exports = browserConvert;

239
fp/_mapping.js Normal file
View File

@@ -0,0 +1,239 @@
/** Used to map aliases to their real names. */
exports.aliasToReal = {
'__': 'placeholder',
'all': 'some',
'allPass': 'overEvery',
'apply': 'spread',
'assoc': 'set',
'assocPath': 'set',
'compose': 'flowRight',
'contains': 'includes',
'dissoc': 'unset',
'dissocPath': 'unset',
'each': 'forEach',
'eachRight': 'forEachRight',
'equals': 'isEqual',
'extend': 'assignIn',
'extendWith': 'assignInWith',
'first': 'head',
'init': 'initial',
'mapObj': 'mapValues',
'omitAll': 'omit',
'nAry': 'ary',
'path': 'get',
'pathEq': 'matchesProperty',
'pathOr': 'getOr',
'pickAll': 'pick',
'pipe': 'flow',
'prop': 'get',
'propOf': 'propertyOf',
'propOr': 'getOr',
'somePass': 'overSome',
'unapply': 'rest',
'unnest': 'flatten',
'useWith': 'overArgs',
'whereEq': 'filter',
'zipObj': 'zipObject'
};
/** Used to map ary to method names. */
exports.aryMethod = {
1: [
'attempt', 'ceil', 'create', 'curry', 'curryRight', 'floor', 'fromPairs',
'invert', 'iteratee', 'memoize', 'method', 'methodOf', 'mixin', 'over',
'overEvery', 'overSome', 'rest', 'reverse', 'round', 'runInContext',
'spread', 'template', 'trim', 'trimEnd', 'trimStart', 'uniqueId', 'words'
],
2: [
'add', 'after', 'ary', 'assign', 'assignIn', 'at', 'before', 'bind', 'bindKey',
'chunk', 'cloneDeepWith', 'cloneWith', 'concat', 'countBy', 'curryN',
'curryRightN', 'debounce', 'defaults', 'defaultsDeep', 'delay', 'difference',
'drop', 'dropRight', 'dropRightWhile', 'dropWhile', 'endsWith', 'eq', 'every',
'filter', 'find', 'find', 'findIndex', 'findKey', 'findLast', 'findLastIndex',
'findLastKey', 'flatMap', 'forEach', 'forEachRight', 'forIn', 'forInRight',
'forOwn', 'forOwnRight', 'get', 'groupBy', 'gt', 'gte', 'has', 'hasIn',
'includes', 'indexOf', 'intersection', 'invertBy', 'invoke', 'invokeMap',
'isEqual', 'isMatch', 'join', 'keyBy', 'lastIndexOf', 'lt', 'lte', 'map',
'mapKeys', 'mapValues', 'matchesProperty', 'maxBy', 'merge', 'minBy', 'omit',
'omitBy', 'orderBy', 'overArgs', 'pad', 'padEnd', 'padStart', 'parseInt',
'partial', 'partialRight', 'partition', 'pick', 'pickBy', 'pull', 'pullAll',
'pullAt', 'random', 'range', 'rangeRight', 'rearg', 'reject', 'remove',
'repeat', 'result', 'sampleSize', 'some', 'sortBy', 'sortedIndex',
'sortedIndexOf', 'sortedLastIndex', 'sortedLastIndexOf', 'sortedUniqBy',
'split', 'startsWith', 'subtract', 'sumBy', 'take', 'takeRight', 'takeRightWhile',
'takeWhile', 'tap', 'throttle', 'thru', 'times', 'trimChars', 'trimCharsEnd',
'trimCharsStart', 'truncate', 'union', 'uniqBy', 'uniqWith', 'unset',
'unzipWith', 'without', 'wrap', 'xor', 'zip', 'zipObject', 'zipObjectDeep'
],
3: [
'assignInWith', 'assignWith', 'clamp', 'differenceBy', 'differenceWith',
'getOr', 'inRange', 'intersectionBy', 'intersectionWith', 'isEqualWith',
'isMatchWith', 'mergeWith', 'pullAllBy', 'reduce', 'reduceRight', 'replace',
'set', 'slice', 'sortedIndexBy', 'sortedLastIndexBy', 'transform', 'unionBy',
'unionWith', 'xorBy', 'xorWith', 'zipWith'
],
4: [
'fill', 'setWith'
]
};
/** Used to map ary to rearg configs. */
exports.aryRearg = {
2: [1, 0],
3: [2, 1, 0],
4: [3, 2, 0, 1]
};
/** Used to iterate `mapping.aryMethod` keys. */
exports.caps = [1, 2, 3, 4];
/** Used to map method names to their iteratee ary. */
exports.iterateeAry = {
'assignWith': 2,
'assignInWith': 2,
'cloneDeepWith': 1,
'cloneWith': 1,
'dropRightWhile': 1,
'dropWhile': 1,
'every': 1,
'filter': 1,
'find': 1,
'findIndex': 1,
'findKey': 1,
'findLast': 1,
'findLastIndex': 1,
'findLastKey': 1,
'flatMap': 1,
'forEach': 1,
'forEachRight': 1,
'forIn': 1,
'forInRight': 1,
'forOwn': 1,
'forOwnRight': 1,
'isEqualWith': 2,
'isMatchWith': 2,
'map': 1,
'mapKeys': 1,
'mapValues': 1,
'partition': 1,
'reduce': 2,
'reduceRight': 2,
'reject': 1,
'remove': 1,
'some': 1,
'takeRightWhile': 1,
'takeWhile': 1,
'times': 1,
'transform': 2
};
/** Used to map method names to iteratee rearg configs. */
exports.iterateeRearg = {
'findKey': [1],
'findLastKey': [1],
'mapKeys': [1]
};
/** Used to map method names to rearg configs. */
exports.methodRearg = {
'assignInWith': [1, 2, 0],
'assignWith': [1, 2, 0],
'clamp': [2, 0, 1],
'mergeWith': [1, 2, 0],
'reduce': [2, 0, 1],
'reduceRight': [2, 0, 1],
'set': [2, 0, 1],
'setWith': [3, 1, 2, 0],
'slice': [2, 0, 1],
'transform': [2, 0, 1]
};
/** Used to map method names to spread configs. */
exports.methodSpread = {
'partial': 1,
'partialRight': 1
};
/** Used to identify methods which mutate arrays or objects. */
exports.mutate = {
'array': {
'fill': true,
'pull': true,
'pullAll': true,
'pullAllBy': true,
'pullAt': true,
'remove': true,
'reverse': true
},
'object': {
'assign': true,
'assignIn': true,
'assignInWith': true,
'assignWith': true,
'defaults': true,
'defaultsDeep': true,
'merge': true,
'mergeWith': true
},
'set': {
'set': true,
'setWith': true,
'unset': true
}
};
/** Used to track methods with placeholder support */
exports.placeholder = {
'bind': true,
'bindKey': true,
'curry': true,
'curryRight': true,
'partial': true,
'partialRight': true
};
/** Used to map real names to their aliases. */
exports.realToAlias = (function() {
var hasOwnProperty = Object.prototype.hasOwnProperty,
object = exports.aliasToReal,
result = {};
for (var key in object) {
var value = object[key];
if (hasOwnProperty.call(result, value)) {
result[value].push(key);
} else {
result[value] = [key];
}
}
return result;
}());
/** Used to map method names to other names. */
exports.rename = {
'curryN': 'curry',
'curryRightN': 'curryRight',
'getOr': 'get',
'trimChars': 'trim',
'trimCharsEnd': 'trimEnd',
'trimCharsStart': 'trimStart'
};
/** Used to track methods that skip `_.rearg`. */
exports.skipRearg = {
'add': true,
'assign': true,
'assignIn': true,
'concat': true,
'difference': true,
'matchesProperty': true,
'merge': true,
'partial': true,
'partialRight': true,
'random': true,
'range': true,
'rangeRight': true,
'subtract': true,
'zip': true,
'zipObject': true
};

26
lib/common/minify.js Normal file
View File

@@ -0,0 +1,26 @@
'use strict';
var _ = require('lodash'),
fs = require('fs-extra'),
uglify = require('uglify-js');
var uglifyOptions = require('./uglify.options.js');
/*----------------------------------------------------------------------------*/
function minify(inpath, outpath, callback, options) {
if (_.isFunction(outpath)) {
if (_.isObject(callback)) {
options = callback;
}
callback = outpath;
outpath = undefined;
}
if (!outpath) {
outpath = inpath.replace(/(?=\.js$)/, '.min');
}
var output = uglify.minify(inpath, _.defaults(options || {}, uglifyOptions));
fs.writeFile(outpath, output.code, 'utf-8', callback);
}
module.exports = minify;

View File

@@ -0,0 +1,16 @@
module.exports = {
'compress': {
'pure_getters': true,
'unsafe': true,
'unsafe_comps': true,
'warnings': false
},
'mangle': {
'except': ['define']
},
'output': {
'ascii_only': true,
'comments': /^!|@cc_on|@license|@preserve/i,
'max_line_len': 500
}
};

55
lib/doc/build.js Normal file
View File

@@ -0,0 +1,55 @@
'use strict';
var _ = require('lodash'),
docdown = require('docdown'),
fs = require('fs-extra'),
path = require('path');
var basePath = path.join(__dirname, '..', '..'),
docPath = path.join(basePath, 'doc'),
readmePath = path.join(docPath, 'README.md');
var pkg = require('../../package.json'),
version = pkg.version;
var config = {
'base': {
'entryLinks': [
'<% if (name == "templateSettings" || !/^(?:methods|properties|seq)$/i.test(category)) {' +
'print("[&#x24C3;](https://www.npmjs.com/package/lodash." + name.toLowerCase() + " \\"See the npm package\\")")' +
'} %>'
],
'path': path.join(basePath, 'lodash.js'),
'title': '<a href="https://lodash.com/">lodash</a> <span>v' + version + '</span>',
'toc': 'categories',
'url': 'https://github.com/lodash/lodash/blob/' + version + '/lodash.js'
},
'github': {
'hash': 'github'
},
'site': {
'tocLink': '#docs'
}
};
function postprocess(string) {
// Fix docdown bug by wrapping symbol property identifiers in brackets.
return string.replace(/\.(Symbol\.(?:[a-z]+[A-Z]?)+)/g, '[$1]');
}
/*----------------------------------------------------------------------------*/
function onComplete(error) {
if (error) {
throw error;
}
}
function build(type) {
var options = _.defaults({}, config.base, config[type]),
markdown = docdown(options);
fs.writeFile(readmePath, postprocess(markdown), onComplete);
}
build(_.last(process.argv));

55
lib/fp/build-dist.js Normal file
View File

@@ -0,0 +1,55 @@
'use strict';
var _ = require('lodash'),
async = require('async'),
path = require('path'),
webpack = require('webpack');
var minify = require('../common/minify.js');
var basePath = path.join(__dirname, '..', '..'),
distPath = path.join(basePath, 'dist'),
fpPath = path.join(basePath, 'fp'),
filename = 'lodash.fp.js';
var fpConfig = {
'entry': path.join(fpPath, '_convertBrowser.js'),
'output': {
'path': distPath,
'filename': filename,
'library': 'fp',
'libraryTarget': 'umd'
},
'plugins': [
new webpack.optimize.OccurenceOrderPlugin,
new webpack.optimize.DedupePlugin
]
};
var mappingConfig = {
'entry': path.join(fpPath, '_mapping.js'),
'output': {
'path': distPath,
'filename': 'mapping.fp.js',
'library': 'mapping',
'libraryTarget': 'umd'
}
};
/*----------------------------------------------------------------------------*/
function onComplete(error) {
if (error) {
throw error;
}
}
function build() {
async.series([
_.partial(webpack, mappingConfig),
_.partial(webpack, fpConfig),
_.partial(minify, path.join(distPath, filename))
], onComplete);
}
build();

117
lib/fp/build-modules.js Normal file
View File

@@ -0,0 +1,117 @@
'use strict';
var _ = require('lodash'),
async = require('async'),
fs = require('fs-extra'),
glob = require('glob'),
path = require('path');
var mapping = require('../../fp/_mapping');
var templatePath = path.join(__dirname, 'template');
var template = _.transform(glob.sync(path.join(templatePath, '*.jst')), function(result, filePath) {
result[path.basename(filePath, '.jst')] = _.template(fs.readFileSync(filePath));
}, {});
var aryMethods = _.union(
mapping.aryMethod[1],
mapping.aryMethod[2],
mapping.aryMethod[3],
mapping.aryMethod[4]
);
var categories = [
'array',
'collection',
'date',
'function',
'lang',
'math',
'number',
'object',
'seq',
'string',
'util'
];
function isAlias(funcName) {
return _.has(mapping.aliasToReal, funcName);
}
function isCategory(funcName) {
return _.includes(categories, funcName);
}
function isThru(funcName) {
return !_.includes(aryMethods, funcName);
}
function getTemplate(moduleName) {
var data = {
'name': _.result(mapping.aliasToReal, moduleName, moduleName),
'rename': mapping.rename
};
if (isAlias(moduleName)) {
return template.alias(data);
}
if (isCategory(moduleName)) {
return template.category(data);
}
if (isThru(moduleName)) {
return template.thru(data);
}
return template.module(data);
}
/*----------------------------------------------------------------------------*/
function onComplete(error) {
if (error) {
throw error;
}
}
function build(target) {
var fpPath = path.join(target, 'fp');
// Glob existing lodash module paths.
var modulePaths = glob.sync(path.join(target, '*.js'), {
'nodir': true,
'ignore': [
'_*.js',
'core.js',
'fp.js',
'index.js',
'lodash.js'
].map(function(filename) {
return path.join(target, filename);
})
});
// Add FP alias and remapped module paths.
_.each([mapping.aliasToReal, mapping.rename], function(data) {
_.forOwn(data, function(realName, alias) {
if (!_.startsWith(alias, '_')) {
modulePaths.push(path.join(target, alias + '.js'));
}
});
});
modulePaths = _.uniq(modulePaths);
var actions = modulePaths.map(function(modulePath) {
var moduleName = path.basename(modulePath, '.js');
return _.partial(fs.writeFile, path.join(fpPath, moduleName + '.js'), getTemplate(moduleName));
});
actions.unshift(_.partial(fs.copy, path.join(__dirname, '../../fp'), fpPath));
actions.push(_.partial(fs.writeFile, path.join(target, 'fp.js'), template.fp()));
actions.push(_.partial(fs.writeFile, path.join(fpPath, 'convert.js'), template.convert()));
actions.push(_.partial(fs.writeFile, path.join(fpPath, '_util.js'), template._util()));
async.series(actions, onComplete);
}
build(_.last(process.argv));

11
lib/fp/template/_util.jst Normal file
View File

@@ -0,0 +1,11 @@
module.exports = {
'ary': require('../ary'),
'cloneDeep': require('../cloneDeep'),
'curry': require('../curry'),
'forEach': require('../_arrayEach'),
'isFunction': require('../isFunction'),
'iteratee': require('../iteratee'),
'keys': require('../_baseKeys'),
'rearg': require('../rearg'),
'spread': require('../spread')
};

View File

@@ -0,0 +1 @@
module.exports = require('./<%= name %>');

View File

@@ -0,0 +1,2 @@
var convert = require('./convert');
module.exports = convert(require('../<%= name %>'));

View File

@@ -0,0 +1,16 @@
var baseConvert = require('./_baseConvert'),
util = require('./_util');
/**
* Converts `func` of `name` to an immutable auto-curried iteratee-first data-last
* version. If `name` is an object its methods will be converted.
*
* @param {string} name The name of the function to wrap.
* @param {Function} [func] The function to wrap.
* @returns {Function|Object} Returns the converted function or object.
*/
function convert(name, func) {
return baseConvert(util, name, func);
}
module.exports = convert;

2
lib/fp/template/fp.jst Normal file
View File

@@ -0,0 +1,2 @@
var _ = require('./lodash').noConflict().runInContext();
module.exports = require('./fp/convert')(_);

View File

@@ -0,0 +1,2 @@
var convert = require('./convert');
module.exports = convert('<%= name %>', require('../<%= _.result(rename, name, name) %>'));

1
lib/fp/template/thru.jst Normal file
View File

@@ -0,0 +1 @@
module.exports = require('../<%= name %>');

32
lib/main/build-dist.js Normal file
View File

@@ -0,0 +1,32 @@
'use strict';
var _ = require('lodash'),
async = require('async'),
fs = require('fs-extra'),
path = require('path');
var minify = require('../common/minify.js');
var basePath = path.join(__dirname, '..', '..'),
distPath = path.join(basePath, 'dist'),
filename = 'lodash.js';
var baseLodash = path.join(basePath, filename),
distLodash = path.join(distPath, filename);
/*----------------------------------------------------------------------------*/
function onComplete(error) {
if (error) {
throw error;
}
}
function build() {
async.series([
_.partial(fs.copy, baseLodash, distLodash),
_.partial(minify, distLodash)
], onComplete);
}
build();

23
lib/main/build-modules.js Normal file
View File

@@ -0,0 +1,23 @@
'use strict';
var _ = require('lodash'),
fs = require('fs-extra'),
path = require('path');
var basePath = path.join(__dirname, '..', '..'),
distPath = path.join(basePath, 'dist'),
corePath = path.join(distPath, 'lodash.core.js');
/*----------------------------------------------------------------------------*/
function onComplete(error) {
if (error) {
throw error;
}
}
function build(target) {
fs.copy(corePath, path.join(target, 'core.js'), onComplete);
}
build(_.last(process.argv));

11599
lodash.js

File diff suppressed because it is too large Load Diff

98
lodash.min.js vendored
View File

@@ -1,98 +0,0 @@
/**
* @license
* lodash 3.10.1 (Custom Build) lodash.com/license | Underscore.js 1.8.3 underscorejs.org/LICENSE
* Build: `lodash modern -o ./lodash.js`
*/
;(function(){function n(n,t){if(n!==t){var r=null===n,e=n===w,u=n===n,o=null===t,i=t===w,f=t===t;if(n>t&&!o||!u||r&&!i&&f||e&&f)return 1;if(n<t&&!r||!f||o&&!e&&u||i&&u)return-1}return 0}function t(n,t,r){for(var e=n.length,u=r?e:-1;r?u--:++u<e;)if(t(n[u],u,n))return u;return-1}function r(n,t,r){if(t!==t)return p(n,r);r-=1;for(var e=n.length;++r<e;)if(n[r]===t)return r;return-1}function e(n){return typeof n=="function"||false}function u(n){return null==n?"":n+""}function o(n,t){for(var r=-1,e=n.length;++r<e&&-1<t.indexOf(n.charAt(r)););
return r}function i(n,t){for(var r=n.length;r--&&-1<t.indexOf(n.charAt(r)););return r}function f(t,r){return n(t.a,r.a)||t.b-r.b}function a(n){return Nn[n]}function c(n){return Tn[n]}function l(n,t,r){return t?n=Bn[n]:r&&(n=Dn[n]),"\\"+n}function s(n){return"\\"+Dn[n]}function p(n,t,r){var e=n.length;for(t+=r?0:-1;r?t--:++t<e;){var u=n[t];if(u!==u)return t}return-1}function h(n){return!!n&&typeof n=="object"}function _(n){return 160>=n&&9<=n&&13>=n||32==n||160==n||5760==n||6158==n||8192<=n&&(8202>=n||8232==n||8233==n||8239==n||8287==n||12288==n||65279==n);
}function v(n,t){for(var r=-1,e=n.length,u=-1,o=[];++r<e;)n[r]===t&&(n[r]=z,o[++u]=r);return o}function g(n){for(var t=-1,r=n.length;++t<r&&_(n.charCodeAt(t)););return t}function y(n){for(var t=n.length;t--&&_(n.charCodeAt(t)););return t}function d(n){return Ln[n]}function m(_){function Nn(n){if(h(n)&&!(Oo(n)||n instanceof zn)){if(n instanceof Ln)return n;if(nu.call(n,"__chain__")&&nu.call(n,"__wrapped__"))return Mr(n)}return new Ln(n)}function Tn(){}function Ln(n,t,r){this.__wrapped__=n,this.__actions__=r||[],
this.__chain__=!!t}function zn(n){this.__wrapped__=n,this.__actions__=[],this.__dir__=1,this.__filtered__=false,this.__iteratees__=[],this.__takeCount__=Ru,this.__views__=[]}function Bn(){this.__data__={}}function Dn(n){var t=n?n.length:0;for(this.data={hash:gu(null),set:new lu};t--;)this.push(n[t])}function Mn(n,t){var r=n.data;return(typeof t=="string"||ge(t)?r.set.has(t):r.hash[t])?0:-1}function qn(n,t){var r=-1,e=n.length;for(t||(t=Be(e));++r<e;)t[r]=n[r];return t}function Pn(n,t){for(var r=-1,e=n.length;++r<e&&false!==t(n[r],r,n););
return n}function Kn(n,t){for(var r=-1,e=n.length;++r<e;)if(!t(n[r],r,n))return false;return true}function Vn(n,t){for(var r=-1,e=n.length,u=-1,o=[];++r<e;){var i=n[r];t(i,r,n)&&(o[++u]=i)}return o}function Gn(n,t){for(var r=-1,e=n.length,u=Be(e);++r<e;)u[r]=t(n[r],r,n);return u}function Jn(n,t){for(var r=-1,e=t.length,u=n.length;++r<e;)n[u+r]=t[r];return n}function Xn(n,t,r,e){var u=-1,o=n.length;for(e&&o&&(r=n[++u]);++u<o;)r=t(r,n[u],u,n);return r}function Hn(n,t){for(var r=-1,e=n.length;++r<e;)if(t(n[r],r,n))return true;
return false}function Qn(n,t,r,e){return n!==w&&nu.call(e,r)?n:t}function nt(n,t,r){for(var e=-1,u=zo(t),o=u.length;++e<o;){var i=u[e],f=n[i],a=r(f,t[i],i,n,t);(a===a?a===f:f!==f)&&(f!==w||i in n)||(n[i]=a)}return n}function tt(n,t){return null==t?n:et(t,zo(t),n)}function rt(n,t){for(var r=-1,e=null==n,u=!e&&Er(n),o=u?n.length:0,i=t.length,f=Be(i);++r<i;){var a=t[r];f[r]=u?Cr(a,o)?n[a]:w:e?w:n[a]}return f}function et(n,t,r){r||(r={});for(var e=-1,u=t.length;++e<u;){var o=t[e];r[o]=n[o]}return r}function ut(n,t,r){
var e=typeof n;return"function"==e?t===w?n:Bt(n,t,r):null==n?Fe:"object"==e?bt(n):t===w?ze(n):xt(n,t)}function ot(n,t,r,e,u,o,i){var f;if(r&&(f=u?r(n,e,u):r(n)),f!==w)return f;if(!ge(n))return n;if(e=Oo(n)){if(f=kr(n),!t)return qn(n,f)}else{var a=ru.call(n),c=a==K;if(a!=Z&&a!=B&&(!c||u))return Fn[a]?Rr(n,a,t):u?n:{};if(f=Ir(c?{}:n),!t)return tt(f,n)}for(o||(o=[]),i||(i=[]),u=o.length;u--;)if(o[u]==n)return i[u];return o.push(n),i.push(f),(e?Pn:_t)(n,function(e,u){f[u]=ot(e,t,r,u,n,o,i)}),f}function it(n,t,r){
if(typeof n!="function")throw new Ge(L);return su(function(){n.apply(w,r)},t)}function ft(n,t){var e=n?n.length:0,u=[];if(!e)return u;var o=-1,i=xr(),f=i===r,a=f&&t.length>=F&&gu&&lu?new Dn(t):null,c=t.length;a&&(i=Mn,f=false,t=a);n:for(;++o<e;)if(a=n[o],f&&a===a){for(var l=c;l--;)if(t[l]===a)continue n;u.push(a)}else 0>i(t,a,0)&&u.push(a);return u}function at(n,t){var r=true;return Su(n,function(n,e,u){return r=!!t(n,e,u)}),r}function ct(n,t,r,e){var u=e,o=u;return Su(n,function(n,i,f){i=+t(n,i,f),(r(i,u)||i===e&&i===o)&&(u=i,
o=n)}),o}function lt(n,t){var r=[];return Su(n,function(n,e,u){t(n,e,u)&&r.push(n)}),r}function st(n,t,r,e){var u;return r(n,function(n,r,o){return t(n,r,o)?(u=e?r:n,false):void 0}),u}function pt(n,t,r,e){e||(e=[]);for(var u=-1,o=n.length;++u<o;){var i=n[u];h(i)&&Er(i)&&(r||Oo(i)||pe(i))?t?pt(i,t,r,e):Jn(e,i):r||(e[e.length]=i)}return e}function ht(n,t){Nu(n,t,Re)}function _t(n,t){return Nu(n,t,zo)}function vt(n,t){return Tu(n,t,zo)}function gt(n,t){for(var r=-1,e=t.length,u=-1,o=[];++r<e;){var i=t[r];
ve(n[i])&&(o[++u]=i)}return o}function yt(n,t,r){if(null!=n){r!==w&&r in Br(n)&&(t=[r]),r=0;for(var e=t.length;null!=n&&r<e;)n=n[t[r++]];return r&&r==e?n:w}}function dt(n,t,r,e,u,o){if(n===t)n=true;else if(null==n||null==t||!ge(n)&&!h(t))n=n!==n&&t!==t;else n:{var i=dt,f=Oo(n),a=Oo(t),c=D,l=D;f||(c=ru.call(n),c==B?c=Z:c!=Z&&(f=xe(n))),a||(l=ru.call(t),l==B?l=Z:l!=Z&&xe(t));var s=c==Z,a=l==Z,l=c==l;if(!l||f||s){if(!e&&(c=s&&nu.call(n,"__wrapped__"),a=a&&nu.call(t,"__wrapped__"),c||a)){n=i(c?n.value():n,a?t.value():t,r,e,u,o);
break n}if(l){for(u||(u=[]),o||(o=[]),c=u.length;c--;)if(u[c]==n){n=o[c]==t;break n}u.push(n),o.push(t),n=(f?yr:mr)(n,t,i,r,e,u,o),u.pop(),o.pop()}else n=false}else n=dr(n,t,c)}return n}function mt(n,t,r){var e=t.length,u=e,o=!r;if(null==n)return!u;for(n=Br(n);e--;){var i=t[e];if(o&&i[2]?i[1]!==n[i[0]]:!(i[0]in n))return false}for(;++e<u;){var i=t[e],f=i[0],a=n[f],c=i[1];if(o&&i[2]){if(a===w&&!(f in n))return false}else if(i=r?r(a,c,f):w,i===w?!dt(c,a,r,true):!i)return false}return true}function wt(n,t){var r=-1,e=Er(n)?Be(n.length):[];
return Su(n,function(n,u,o){e[++r]=t(n,u,o)}),e}function bt(n){var t=Ar(n);if(1==t.length&&t[0][2]){var r=t[0][0],e=t[0][1];return function(n){return null==n?false:n[r]===e&&(e!==w||r in Br(n))}}return function(n){return mt(n,t)}}function xt(n,t){var r=Oo(n),e=Wr(n)&&t===t&&!ge(t),u=n+"";return n=Dr(n),function(o){if(null==o)return false;var i=u;if(o=Br(o),!(!r&&e||i in o)){if(o=1==n.length?o:yt(o,Et(n,0,-1)),null==o)return false;i=Zr(n),o=Br(o)}return o[i]===t?t!==w||i in o:dt(t,o[i],w,true)}}function At(n,t,r,e,u){
if(!ge(n))return n;var o=Er(t)&&(Oo(t)||xe(t)),i=o?w:zo(t);return Pn(i||t,function(f,a){if(i&&(a=f,f=t[a]),h(f)){e||(e=[]),u||(u=[]);n:{for(var c=a,l=e,s=u,p=l.length,_=t[c];p--;)if(l[p]==_){n[c]=s[p];break n}var p=n[c],v=r?r(p,_,c,n,t):w,g=v===w;g&&(v=_,Er(_)&&(Oo(_)||xe(_))?v=Oo(p)?p:Er(p)?qn(p):[]:me(_)||pe(_)?v=pe(p)?ke(p):me(p)?p:{}:g=false),l.push(_),s.push(v),g?n[c]=At(v,_,r,l,s):(v===v?v!==p:p===p)&&(n[c]=v)}}else c=n[a],l=r?r(c,f,a,n,t):w,(s=l===w)&&(l=f),l===w&&(!o||a in n)||!s&&(l===l?l===c:c!==c)||(n[a]=l);
}),n}function jt(n){return function(t){return null==t?w:t[n]}}function kt(n){var t=n+"";return n=Dr(n),function(r){return yt(r,n,t)}}function It(n,t){for(var r=n?t.length:0;r--;){var e=t[r];if(e!=u&&Cr(e)){var u=e;pu.call(n,e,1)}}}function Rt(n,t){return n+yu(ku()*(t-n+1))}function Ot(n,t,r,e,u){return u(n,function(n,u,o){r=e?(e=false,n):t(r,n,u,o)}),r}function Et(n,t,r){var e=-1,u=n.length;for(t=null==t?0:+t||0,0>t&&(t=-t>u?0:u+t),r=r===w||r>u?u:+r||0,0>r&&(r+=u),u=t>r?0:r-t>>>0,t>>>=0,r=Be(u);++e<u;)r[e]=n[e+t];
return r}function Ct(n,t){var r;return Su(n,function(n,e,u){return r=t(n,e,u),!r}),!!r}function Ut(n,t){var r=n.length;for(n.sort(t);r--;)n[r]=n[r].c;return n}function Wt(t,r,e){var u=wr(),o=-1;return r=Gn(r,function(n){return u(n)}),t=wt(t,function(n){return{a:Gn(r,function(t){return t(n)}),b:++o,c:n}}),Ut(t,function(t,r){var u;n:{for(var o=-1,i=t.a,f=r.a,a=i.length,c=e.length;++o<a;)if(u=n(i[o],f[o])){if(o>=c)break n;o=e[o],u*="asc"===o||true===o?1:-1;break n}u=t.b-r.b}return u})}function $t(n,t){
var r=0;return Su(n,function(n,e,u){r+=+t(n,e,u)||0}),r}function St(n,t){var e=-1,u=xr(),o=n.length,i=u===r,f=i&&o>=F,a=f&&gu&&lu?new Dn(void 0):null,c=[];a?(u=Mn,i=false):(f=false,a=t?[]:c);n:for(;++e<o;){var l=n[e],s=t?t(l,e,n):l;if(i&&l===l){for(var p=a.length;p--;)if(a[p]===s)continue n;t&&a.push(s),c.push(l)}else 0>u(a,s,0)&&((t||f)&&a.push(s),c.push(l))}return c}function Ft(n,t){for(var r=-1,e=t.length,u=Be(e);++r<e;)u[r]=n[t[r]];return u}function Nt(n,t,r,e){for(var u=n.length,o=e?u:-1;(e?o--:++o<u)&&t(n[o],o,n););
return r?Et(n,e?0:o,e?o+1:u):Et(n,e?o+1:0,e?u:o)}function Tt(n,t){var r=n;r instanceof zn&&(r=r.value());for(var e=-1,u=t.length;++e<u;)var o=t[e],r=o.func.apply(o.thisArg,Jn([r],o.args));return r}function Lt(n,t,r){var e=0,u=n?n.length:e;if(typeof t=="number"&&t===t&&u<=Eu){for(;e<u;){var o=e+u>>>1,i=n[o];(r?i<=t:i<t)&&null!==i?e=o+1:u=o}return u}return zt(n,t,Fe,r)}function zt(n,t,r,e){t=r(t);for(var u=0,o=n?n.length:0,i=t!==t,f=null===t,a=t===w;u<o;){var c=yu((u+o)/2),l=r(n[c]),s=l!==w,p=l===l;
(i?p||e:f?p&&s&&(e||null!=l):a?p&&(e||s):null==l?0:e?l<=t:l<t)?u=c+1:o=c}return xu(o,Ou)}function Bt(n,t,r){if(typeof n!="function")return Fe;if(t===w)return n;switch(r){case 1:return function(r){return n.call(t,r)};case 3:return function(r,e,u){return n.call(t,r,e,u)};case 4:return function(r,e,u,o){return n.call(t,r,e,u,o)};case 5:return function(r,e,u,o,i){return n.call(t,r,e,u,o,i)}}return function(){return n.apply(t,arguments)}}function Dt(n){var t=new ou(n.byteLength);return new hu(t).set(new hu(n)),
t}function Mt(n,t,r){for(var e=r.length,u=-1,o=bu(n.length-e,0),i=-1,f=t.length,a=Be(f+o);++i<f;)a[i]=t[i];for(;++u<e;)a[r[u]]=n[u];for(;o--;)a[i++]=n[u++];return a}function qt(n,t,r){for(var e=-1,u=r.length,o=-1,i=bu(n.length-u,0),f=-1,a=t.length,c=Be(i+a);++o<i;)c[o]=n[o];for(i=o;++f<a;)c[i+f]=t[f];for(;++e<u;)c[i+r[e]]=n[o++];return c}function Pt(n,t){return function(r,e,u){var o=t?t():{};if(e=wr(e,u,3),Oo(r)){u=-1;for(var i=r.length;++u<i;){var f=r[u];n(o,f,e(f,u,r),r)}}else Su(r,function(t,r,u){
n(o,t,e(t,r,u),u)});return o}}function Kt(n){return le(function(t,r){var e=-1,u=null==t?0:r.length,o=2<u?r[u-2]:w,i=2<u?r[2]:w,f=1<u?r[u-1]:w;for(typeof o=="function"?(o=Bt(o,f,5),u-=2):(o=typeof f=="function"?f:w,u-=o?1:0),i&&Ur(r[0],r[1],i)&&(o=3>u?w:o,u=1);++e<u;)(i=r[e])&&n(t,i,o);return t})}function Vt(n,t){return function(r,e){var u=r?Bu(r):0;if(!Sr(u))return n(r,e);for(var o=t?u:-1,i=Br(r);(t?o--:++o<u)&&false!==e(i[o],o,i););return r}}function Zt(n){return function(t,r,e){var u=Br(t);e=e(t);for(var o=e.length,i=n?o:-1;n?i--:++i<o;){
var f=e[i];if(false===r(u[f],f,u))break}return t}}function Yt(n,t){function r(){return(this&&this!==Zn&&this instanceof r?e:n).apply(t,arguments)}var e=Jt(n);return r}function Gt(n){return function(t){var r=-1;t=$e(Ce(t));for(var e=t.length,u="";++r<e;)u=n(u,t[r],r);return u}}function Jt(n){return function(){var t=arguments;switch(t.length){case 0:return new n;case 1:return new n(t[0]);case 2:return new n(t[0],t[1]);case 3:return new n(t[0],t[1],t[2]);case 4:return new n(t[0],t[1],t[2],t[3]);case 5:
return new n(t[0],t[1],t[2],t[3],t[4]);case 6:return new n(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new n(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var r=$u(n.prototype),t=n.apply(r,t);return ge(t)?t:r}}function Xt(n){function t(r,e,u){return u&&Ur(r,e,u)&&(e=w),r=gr(r,n,w,w,w,w,w,e),r.placeholder=t.placeholder,r}return t}function Ht(n,t){return le(function(r){var e=r[0];return null==e?e:(r.push(t),n.apply(w,r))})}function Qt(n,t){return function(r,e,u){if(u&&Ur(r,e,u)&&(e=w),e=wr(e,u,3),1==e.length){
u=r=Oo(r)?r:zr(r);for(var o=e,i=-1,f=u.length,a=t,c=a;++i<f;){var l=u[i],s=+o(l);n(s,a)&&(a=s,c=l)}if(u=c,!r.length||u!==t)return u}return ct(r,e,n,t)}}function nr(n,r){return function(e,u,o){return u=wr(u,o,3),Oo(e)?(u=t(e,u,r),-1<u?e[u]:w):st(e,u,n)}}function tr(n){return function(r,e,u){return r&&r.length?(e=wr(e,u,3),t(r,e,n)):-1}}function rr(n){return function(t,r,e){return r=wr(r,e,3),st(t,r,n,true)}}function er(n){return function(){for(var t,r=arguments.length,e=n?r:-1,u=0,o=Be(r);n?e--:++e<r;){
var i=o[u++]=arguments[e];if(typeof i!="function")throw new Ge(L);!t&&Ln.prototype.thru&&"wrapper"==br(i)&&(t=new Ln([],true))}for(e=t?-1:r;++e<r;){var i=o[e],u=br(i),f="wrapper"==u?zu(i):w;t=f&&$r(f[0])&&f[1]==(E|k|R|C)&&!f[4].length&&1==f[9]?t[br(f[0])].apply(t,f[3]):1==i.length&&$r(i)?t[u]():t.thru(i)}return function(){var n=arguments,e=n[0];if(t&&1==n.length&&Oo(e)&&e.length>=F)return t.plant(e).value();for(var u=0,n=r?o[u].apply(this,n):e;++u<r;)n=o[u].call(this,n);return n}}}function ur(n,t){
return function(r,e,u){return typeof e=="function"&&u===w&&Oo(r)?n(r,e):t(r,Bt(e,u,3))}}function or(n){return function(t,r,e){return(typeof r!="function"||e!==w)&&(r=Bt(r,e,3)),n(t,r,Re)}}function ir(n){return function(t,r,e){return(typeof r!="function"||e!==w)&&(r=Bt(r,e,3)),n(t,r)}}function fr(n){return function(t,r,e){var u={};return r=wr(r,e,3),_t(t,function(t,e,o){o=r(t,e,o),e=n?o:e,t=n?t:o,u[e]=t}),u}}function ar(n){return function(t,r,e){return t=u(t),(n?t:"")+pr(t,r,e)+(n?"":t)}}function cr(n){
var t=le(function(r,e){var u=v(e,t.placeholder);return gr(r,n,w,e,u)});return t}function lr(n,t){return function(r,e,u,o){var i=3>arguments.length;return typeof e=="function"&&o===w&&Oo(r)?n(r,e,u,i):Ot(r,wr(e,o,4),u,i,t)}}function sr(n,t,r,e,u,o,i,f,a,c){function l(){for(var m=arguments.length,b=m,j=Be(m);b--;)j[b]=arguments[b];if(e&&(j=Mt(j,e,u)),o&&(j=qt(j,o,i)),_||y){var b=l.placeholder,k=v(j,b),m=m-k.length;if(m<c){var I=f?qn(f):w,m=bu(c-m,0),E=_?k:w,k=_?w:k,C=_?j:w,j=_?w:j;return t|=_?R:O,t&=~(_?O:R),
g||(t&=~(x|A)),j=[n,t,r,C,E,j,k,I,a,m],I=sr.apply(w,j),$r(n)&&Du(I,j),I.placeholder=b,I}}if(b=p?r:this,I=h?b[n]:n,f)for(m=j.length,E=xu(f.length,m),k=qn(j);E--;)C=f[E],j[E]=Cr(C,m)?k[C]:w;return s&&a<j.length&&(j.length=a),this&&this!==Zn&&this instanceof l&&(I=d||Jt(n)),I.apply(b,j)}var s=t&E,p=t&x,h=t&A,_=t&k,g=t&j,y=t&I,d=h?w:Jt(n);return l}function pr(n,t,r){return n=n.length,t=+t,n<t&&mu(t)?(t-=n,r=null==r?" ":r+"",Ue(r,vu(t/r.length)).slice(0,t)):""}function hr(n,t,r,e){function u(){for(var t=-1,f=arguments.length,a=-1,c=e.length,l=Be(c+f);++a<c;)l[a]=e[a];
for(;f--;)l[a++]=arguments[++t];return(this&&this!==Zn&&this instanceof u?i:n).apply(o?r:this,l)}var o=t&x,i=Jt(n);return u}function _r(n){var t=Pe[n];return function(n,r){return(r=r===w?0:+r||0)?(r=au(10,r),t(n*r)/r):t(n)}}function vr(n){return function(t,r,e,u){var o=wr(e);return null==e&&o===ut?Lt(t,r,n):zt(t,r,o(e,u,1),n)}}function gr(n,t,r,e,u,o,i,f){var a=t&A;if(!a&&typeof n!="function")throw new Ge(L);var c=e?e.length:0;if(c||(t&=~(R|O),e=u=w),c-=u?u.length:0,t&O){var l=e,s=u;e=u=w}var p=a?w:zu(n);
return r=[n,t,r,e,u,l,s,o,i,f],p&&(e=r[1],t=p[1],f=e|t,u=t==E&&e==k||t==E&&e==C&&r[7].length<=p[8]||t==(E|C)&&e==k,(f<E||u)&&(t&x&&(r[2]=p[2],f|=e&x?0:j),(e=p[3])&&(u=r[3],r[3]=u?Mt(u,e,p[4]):qn(e),r[4]=u?v(r[3],z):qn(p[4])),(e=p[5])&&(u=r[5],r[5]=u?qt(u,e,p[6]):qn(e),r[6]=u?v(r[5],z):qn(p[6])),(e=p[7])&&(r[7]=qn(e)),t&E&&(r[8]=null==r[8]?p[8]:xu(r[8],p[8])),null==r[9]&&(r[9]=p[9]),r[0]=p[0],r[1]=f),t=r[1],f=r[9]),r[9]=null==f?a?0:n.length:bu(f-c,0)||0,(p?Lu:Du)(t==x?Yt(r[0],r[2]):t!=R&&t!=(x|R)||r[4].length?sr.apply(w,r):hr.apply(w,r),r);
}function yr(n,t,r,e,u,o,i){var f=-1,a=n.length,c=t.length;if(a!=c&&(!u||c<=a))return false;for(;++f<a;){var l=n[f],c=t[f],s=e?e(u?c:l,u?l:c,f):w;if(s!==w){if(s)continue;return false}if(u){if(!Hn(t,function(n){return l===n||r(l,n,e,u,o,i)}))return false}else if(l!==c&&!r(l,c,e,u,o,i))return false}return true}function dr(n,t,r){switch(r){case M:case q:return+n==+t;case P:return n.name==t.name&&n.message==t.message;case V:return n!=+n?t!=+t:n==+t;case Y:case G:return n==t+""}return false}function mr(n,t,r,e,u,o,i){var f=zo(n),a=f.length,c=zo(t).length;
if(a!=c&&!u)return false;for(c=a;c--;){var l=f[c];if(!(u?l in t:nu.call(t,l)))return false}for(var s=u;++c<a;){var l=f[c],p=n[l],h=t[l],_=e?e(u?h:p,u?p:h,l):w;if(_===w?!r(p,h,e,u,o,i):!_)return false;s||(s="constructor"==l)}return s||(r=n.constructor,e=t.constructor,!(r!=e&&"constructor"in n&&"constructor"in t)||typeof r=="function"&&r instanceof r&&typeof e=="function"&&e instanceof e)?true:false}function wr(n,t,r){var e=Nn.callback||Se,e=e===Se?ut:e;return r?e(n,t,r):e}function br(n){for(var t=n.name+"",r=Wu[t],e=r?r.length:0;e--;){
var u=r[e],o=u.func;if(null==o||o==n)return u.name}return t}function xr(n,t,e){var u=Nn.indexOf||Vr,u=u===Vr?r:u;return n?u(n,t,e):u}function Ar(n){n=Oe(n);for(var t=n.length;t--;){var r=n[t][1];n[t][2]=r===r&&!ge(r)}return n}function jr(n,t){var r=null==n?w:n[t];return ye(r)?r:w}function kr(n){var t=n.length,r=new n.constructor(t);return t&&"string"==typeof n[0]&&nu.call(n,"index")&&(r.index=n.index,r.input=n.input),r}function Ir(n){return n=n.constructor,typeof n=="function"&&n instanceof n||(n=Ve),
new n}function Rr(n,t,r){var e=n.constructor;switch(t){case J:return Dt(n);case M:case q:return new e(+n);case X:case H:case Q:case nn:case tn:case rn:case en:case un:case on:return t=n.buffer,new e(r?Dt(t):t,n.byteOffset,n.length);case V:case G:return new e(n);case Y:var u=new e(n.source,kn.exec(n));u.lastIndex=n.lastIndex}return u}function Or(n,t,r){return null==n||Wr(t,n)||(t=Dr(t),n=1==t.length?n:yt(n,Et(t,0,-1)),t=Zr(t)),t=null==n?n:n[t],null==t?w:t.apply(n,r)}function Er(n){return null!=n&&Sr(Bu(n));
}function Cr(n,t){return n=typeof n=="number"||On.test(n)?+n:-1,t=null==t?Cu:t,-1<n&&0==n%1&&n<t}function Ur(n,t,r){if(!ge(r))return false;var e=typeof t;return("number"==e?Er(r)&&Cr(t,r.length):"string"==e&&t in r)?(t=r[t],n===n?n===t:t!==t):false}function Wr(n,t){var r=typeof n;return"string"==r&&dn.test(n)||"number"==r?true:Oo(n)?false:!yn.test(n)||null!=t&&n in Br(t)}function $r(n){var t=br(n),r=Nn[t];return typeof r=="function"&&t in zn.prototype?n===r?true:(t=zu(r),!!t&&n===t[0]):false}function Sr(n){return typeof n=="number"&&-1<n&&0==n%1&&n<=Cu;
}function Fr(n,t){return n===w?t:Eo(n,t,Fr)}function Nr(n,t){n=Br(n);for(var r=-1,e=t.length,u={};++r<e;){var o=t[r];o in n&&(u[o]=n[o])}return u}function Tr(n,t){var r={};return ht(n,function(n,e,u){t(n,e,u)&&(r[e]=n)}),r}function Lr(n){for(var t=Re(n),r=t.length,e=r&&n.length,u=!!e&&Sr(e)&&(Oo(n)||pe(n)),o=-1,i=[];++o<r;){var f=t[o];(u&&Cr(f,e)||nu.call(n,f))&&i.push(f)}return i}function zr(n){return null==n?[]:Er(n)?ge(n)?n:Ve(n):Ee(n)}function Br(n){return ge(n)?n:Ve(n)}function Dr(n){if(Oo(n))return n;
var t=[];return u(n).replace(mn,function(n,r,e,u){t.push(e?u.replace(An,"$1"):r||n)}),t}function Mr(n){return n instanceof zn?n.clone():new Ln(n.__wrapped__,n.__chain__,qn(n.__actions__))}function qr(n,t,r){return n&&n.length?((r?Ur(n,t,r):null==t)&&(t=1),Et(n,0>t?0:t)):[]}function Pr(n,t,r){var e=n?n.length:0;return e?((r?Ur(n,t,r):null==t)&&(t=1),t=e-(+t||0),Et(n,0,0>t?0:t)):[]}function Kr(n){return n?n[0]:w}function Vr(n,t,e){var u=n?n.length:0;if(!u)return-1;if(typeof e=="number")e=0>e?bu(u+e,0):e;else if(e)return e=Lt(n,t),
e<u&&(t===t?t===n[e]:n[e]!==n[e])?e:-1;return r(n,t,e||0)}function Zr(n){var t=n?n.length:0;return t?n[t-1]:w}function Yr(n){return qr(n,1)}function Gr(n,t,e,u){if(!n||!n.length)return[];null!=t&&typeof t!="boolean"&&(u=e,e=Ur(n,t,u)?w:t,t=false);var o=wr();if((null!=e||o!==ut)&&(e=o(e,u,3)),t&&xr()===r){t=e;var i;e=-1,u=n.length;for(var o=-1,f=[];++e<u;){var a=n[e],c=t?t(a,e,n):a;e&&i===c||(i=c,f[++o]=a)}n=f}else n=St(n,e);return n}function Jr(n){if(!n||!n.length)return[];var t=-1,r=0;n=Vn(n,function(n){
return Er(n)?(r=bu(n.length,r),true):void 0});for(var e=Be(r);++t<r;)e[t]=Gn(n,jt(t));return e}function Xr(n,t,r){return n&&n.length?(n=Jr(n),null==t?n:(t=Bt(t,r,4),Gn(n,function(n){return Xn(n,t,w,true)}))):[]}function Hr(n,t){var r=-1,e=n?n.length:0,u={};for(!e||t||Oo(n[0])||(t=[]);++r<e;){var o=n[r];t?u[o]=t[r]:o&&(u[o[0]]=o[1])}return u}function Qr(n){return n=Nn(n),n.__chain__=true,n}function ne(n,t,r){return t.call(r,n)}function te(n,t,r){var e=Oo(n)?Kn:at;return r&&Ur(n,t,r)&&(t=w),(typeof t!="function"||r!==w)&&(t=wr(t,r,3)),
e(n,t)}function re(n,t,r){var e=Oo(n)?Vn:lt;return t=wr(t,r,3),e(n,t)}function ee(n,t,r,e){var u=n?Bu(n):0;return Sr(u)||(n=Ee(n),u=n.length),r=typeof r!="number"||e&&Ur(t,r,e)?0:0>r?bu(u+r,0):r||0,typeof n=="string"||!Oo(n)&&be(n)?r<=u&&-1<n.indexOf(t,r):!!u&&-1<xr(n,t,r)}function ue(n,t,r){var e=Oo(n)?Gn:wt;return t=wr(t,r,3),e(n,t)}function oe(n,t,r){if(r?Ur(n,t,r):null==t){n=zr(n);var e=n.length;return 0<e?n[Rt(0,e-1)]:w}r=-1,n=je(n);var e=n.length,u=e-1;for(t=xu(0>t?0:+t||0,e);++r<t;){var e=Rt(r,u),o=n[e];
n[e]=n[r],n[r]=o}return n.length=t,n}function ie(n,t,r){var e=Oo(n)?Hn:Ct;return r&&Ur(n,t,r)&&(t=w),(typeof t!="function"||r!==w)&&(t=wr(t,r,3)),e(n,t)}function fe(n,t){var r;if(typeof t!="function"){if(typeof n!="function")throw new Ge(L);var e=n;n=t,t=e}return function(){return 0<--n&&(r=t.apply(this,arguments)),1>=n&&(t=w),r}}function ae(n,t,r){function e(t,r){r&&iu(r),a=p=h=w,t&&(_=ho(),c=n.apply(s,f),p||a||(f=s=w))}function u(){var n=t-(ho()-l);0>=n||n>t?e(h,a):p=su(u,n)}function o(){e(g,p);
}function i(){if(f=arguments,l=ho(),s=this,h=g&&(p||!y),false===v)var r=y&&!p;else{a||y||(_=l);var e=v-(l-_),i=0>=e||e>v;i?(a&&(a=iu(a)),_=l,c=n.apply(s,f)):a||(a=su(o,e))}return i&&p?p=iu(p):p||t===v||(p=su(u,t)),r&&(i=true,c=n.apply(s,f)),!i||p||a||(f=s=w),c}var f,a,c,l,s,p,h,_=0,v=false,g=true;if(typeof n!="function")throw new Ge(L);if(t=0>t?0:+t||0,true===r)var y=true,g=false;else ge(r)&&(y=!!r.leading,v="maxWait"in r&&bu(+r.maxWait||0,t),g="trailing"in r?!!r.trailing:g);return i.cancel=function(){p&&iu(p),a&&iu(a),
_=0,a=p=h=w},i}function ce(n,t){function r(){var e=arguments,u=t?t.apply(this,e):e[0],o=r.cache;return o.has(u)?o.get(u):(e=n.apply(this,e),r.cache=o.set(u,e),e)}if(typeof n!="function"||t&&typeof t!="function")throw new Ge(L);return r.cache=new ce.Cache,r}function le(n,t){if(typeof n!="function")throw new Ge(L);return t=bu(t===w?n.length-1:+t||0,0),function(){for(var r=arguments,e=-1,u=bu(r.length-t,0),o=Be(u);++e<u;)o[e]=r[t+e];switch(t){case 0:return n.call(this,o);case 1:return n.call(this,r[0],o);
case 2:return n.call(this,r[0],r[1],o)}for(u=Be(t+1),e=-1;++e<t;)u[e]=r[e];return u[t]=o,n.apply(this,u)}}function se(n,t){return n>t}function pe(n){return h(n)&&Er(n)&&nu.call(n,"callee")&&!cu.call(n,"callee")}function he(n,t,r,e){return e=(r=typeof r=="function"?Bt(r,e,3):w)?r(n,t):w,e===w?dt(n,t,r):!!e}function _e(n){return h(n)&&typeof n.message=="string"&&ru.call(n)==P}function ve(n){return ge(n)&&ru.call(n)==K}function ge(n){var t=typeof n;return!!n&&("object"==t||"function"==t)}function ye(n){
return null==n?false:ve(n)?uu.test(Qe.call(n)):h(n)&&Rn.test(n)}function de(n){return typeof n=="number"||h(n)&&ru.call(n)==V}function me(n){var t;if(!h(n)||ru.call(n)!=Z||pe(n)||!(nu.call(n,"constructor")||(t=n.constructor,typeof t!="function"||t instanceof t)))return false;var r;return ht(n,function(n,t){r=t}),r===w||nu.call(n,r)}function we(n){return ge(n)&&ru.call(n)==Y}function be(n){return typeof n=="string"||h(n)&&ru.call(n)==G}function xe(n){return h(n)&&Sr(n.length)&&!!Sn[ru.call(n)]}function Ae(n,t){
return n<t}function je(n){var t=n?Bu(n):0;return Sr(t)?t?qn(n):[]:Ee(n)}function ke(n){return et(n,Re(n))}function Ie(n){return gt(n,Re(n))}function Re(n){if(null==n)return[];ge(n)||(n=Ve(n));for(var t=n.length,t=t&&Sr(t)&&(Oo(n)||pe(n))&&t||0,r=n.constructor,e=-1,r=typeof r=="function"&&r.prototype===n,u=Be(t),o=0<t;++e<t;)u[e]=e+"";for(var i in n)o&&Cr(i,t)||"constructor"==i&&(r||!nu.call(n,i))||u.push(i);return u}function Oe(n){n=Br(n);for(var t=-1,r=zo(n),e=r.length,u=Be(e);++t<e;){var o=r[t];
u[t]=[o,n[o]]}return u}function Ee(n){return Ft(n,zo(n))}function Ce(n){return(n=u(n))&&n.replace(En,a).replace(xn,"")}function Ue(n,t){var r="";if(n=u(n),t=+t,1>t||!n||!mu(t))return r;do t%2&&(r+=n),t=yu(t/2),n+=n;while(t);return r}function We(n,t,r){var e=n;return(n=u(n))?(r?Ur(e,t,r):null==t)?n.slice(g(n),y(n)+1):(t+="",n.slice(o(n,t),i(n,t)+1)):n}function $e(n,t,r){return r&&Ur(n,t,r)&&(t=w),n=u(n),n.match(t||Wn)||[]}function Se(n,t,r){return r&&Ur(n,t,r)&&(t=w),h(n)?Ne(n):ut(n,t)}function Fe(n){
return n}function Ne(n){return bt(ot(n,true))}function Te(n,t,r){if(null==r){var e=ge(t),u=e?zo(t):w;((u=u&&u.length?gt(t,u):w)?u.length:e)||(u=false,r=t,t=n,n=this)}u||(u=gt(t,zo(t)));var o=true,e=-1,i=ve(n),f=u.length;false===r?o=false:ge(r)&&"chain"in r&&(o=r.chain);for(;++e<f;){r=u[e];var a=t[r];n[r]=a,i&&(n.prototype[r]=function(t){return function(){var r=this.__chain__;if(o||r){var e=n(this.__wrapped__);return(e.__actions__=qn(this.__actions__)).push({func:t,args:arguments,thisArg:n}),e.__chain__=r,e}return t.apply(n,Jn([this.value()],arguments));
}}(a))}return n}function Le(){}function ze(n){return Wr(n)?jt(n):kt(n)}_=_?Yn.defaults(Zn.Object(),_,Yn.pick(Zn,$n)):Zn;var Be=_.Array,De=_.Date,Me=_.Error,qe=_.Function,Pe=_.Math,Ke=_.Number,Ve=_.Object,Ze=_.RegExp,Ye=_.String,Ge=_.TypeError,Je=Be.prototype,Xe=Ve.prototype,He=Ye.prototype,Qe=qe.prototype.toString,nu=Xe.hasOwnProperty,tu=0,ru=Xe.toString,eu=Zn._,uu=Ze("^"+Qe.call(nu).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ou=_.ArrayBuffer,iu=_.clearTimeout,fu=_.parseFloat,au=Pe.pow,cu=Xe.propertyIsEnumerable,lu=jr(_,"Set"),su=_.setTimeout,pu=Je.splice,hu=_.Uint8Array,_u=jr(_,"WeakMap"),vu=Pe.ceil,gu=jr(Ve,"create"),yu=Pe.floor,du=jr(Be,"isArray"),mu=_.isFinite,wu=jr(Ve,"keys"),bu=Pe.max,xu=Pe.min,Au=jr(De,"now"),ju=_.parseInt,ku=Pe.random,Iu=Ke.NEGATIVE_INFINITY,Ru=Ke.POSITIVE_INFINITY,Ou=4294967294,Eu=2147483647,Cu=9007199254740991,Uu=_u&&new _u,Wu={};
Nn.support={},Nn.templateSettings={escape:_n,evaluate:vn,interpolate:gn,variable:"",imports:{_:Nn}};var $u=function(){function n(){}return function(t){if(ge(t)){n.prototype=t;var r=new n;n.prototype=w}return r||{}}}(),Su=Vt(_t),Fu=Vt(vt,true),Nu=Zt(),Tu=Zt(true),Lu=Uu?function(n,t){return Uu.set(n,t),n}:Fe,zu=Uu?function(n){return Uu.get(n)}:Le,Bu=jt("length"),Du=function(){var n=0,t=0;return function(r,e){var u=ho(),o=S-(u-t);if(t=u,0<o){if(++n>=$)return r}else n=0;return Lu(r,e)}}(),Mu=le(function(n,t){
return h(n)&&Er(n)?ft(n,pt(t,false,true)):[]}),qu=tr(),Pu=tr(true),Ku=le(function(n){for(var t=n.length,e=t,u=Be(l),o=xr(),i=o===r,f=[];e--;){var a=n[e]=Er(a=n[e])?a:[];u[e]=i&&120<=a.length&&gu&&lu?new Dn(e&&a):null}var i=n[0],c=-1,l=i?i.length:0,s=u[0];n:for(;++c<l;)if(a=i[c],0>(s?Mn(s,a):o(f,a,0))){for(e=t;--e;){var p=u[e];if(0>(p?Mn(p,a):o(n[e],a,0)))continue n}s&&s.push(a),f.push(a)}return f}),Vu=le(function(t,r){r=pt(r);var e=rt(t,r);return It(t,r.sort(n)),e}),Zu=vr(),Yu=vr(true),Gu=le(function(n){return St(pt(n,false,true));
}),Ju=le(function(n,t){return Er(n)?ft(n,t):[]}),Xu=le(Jr),Hu=le(function(n){var t=n.length,r=2<t?n[t-2]:w,e=1<t?n[t-1]:w;return 2<t&&typeof r=="function"?t-=2:(r=1<t&&typeof e=="function"?(--t,e):w,e=w),n.length=t,Xr(n,r,e)}),Qu=le(function(n){return n=pt(n),this.thru(function(t){t=Oo(t)?t:[Br(t)];for(var r=n,e=-1,u=t.length,o=-1,i=r.length,f=Be(u+i);++e<u;)f[e]=t[e];for(;++o<i;)f[e++]=r[o];return f})}),no=le(function(n,t){return rt(n,pt(t))}),to=Pt(function(n,t,r){nu.call(n,r)?++n[r]:n[r]=1}),ro=nr(Su),eo=nr(Fu,true),uo=ur(Pn,Su),oo=ur(function(n,t){
for(var r=n.length;r--&&false!==t(n[r],r,n););return n},Fu),io=Pt(function(n,t,r){nu.call(n,r)?n[r].push(t):n[r]=[t]}),fo=Pt(function(n,t,r){n[r]=t}),ao=le(function(n,t,r){var e=-1,u=typeof t=="function",o=Wr(t),i=Er(n)?Be(n.length):[];return Su(n,function(n){var f=u?t:o&&null!=n?n[t]:w;i[++e]=f?f.apply(n,r):Or(n,t,r)}),i}),co=Pt(function(n,t,r){n[r?0:1].push(t)},function(){return[[],[]]}),lo=lr(Xn,Su),so=lr(function(n,t,r,e){var u=n.length;for(e&&u&&(r=n[--u]);u--;)r=t(r,n[u],u,n);return r},Fu),po=le(function(n,t){
if(null==n)return[];var r=t[2];return r&&Ur(t[0],t[1],r)&&(t.length=1),Wt(n,pt(t),[])}),ho=Au||function(){return(new De).getTime()},_o=le(function(n,t,r){var e=x;if(r.length)var u=v(r,_o.placeholder),e=e|R;return gr(n,e,t,r,u)}),vo=le(function(n,t){t=t.length?pt(t):Ie(n);for(var r=-1,e=t.length;++r<e;){var u=t[r];n[u]=gr(n[u],x,n)}return n}),go=le(function(n,t,r){var e=x|A;if(r.length)var u=v(r,go.placeholder),e=e|R;return gr(t,e,n,r,u)}),yo=Xt(k),mo=Xt(I),wo=le(function(n,t){return it(n,1,t)}),bo=le(function(n,t,r){
return it(n,t,r)}),xo=er(),Ao=er(true),jo=le(function(n,t){if(t=pt(t),typeof n!="function"||!Kn(t,e))throw new Ge(L);var r=t.length;return le(function(e){for(var u=xu(e.length,r);u--;)e[u]=t[u](e[u]);return n.apply(this,e)})}),ko=cr(R),Io=cr(O),Ro=le(function(n,t){return gr(n,C,w,w,w,pt(t))}),Oo=du||function(n){return h(n)&&Sr(n.length)&&ru.call(n)==D},Eo=Kt(At),Co=Kt(function(n,t,r){return r?nt(n,t,r):tt(n,t)}),Uo=Ht(Co,function(n,t){return n===w?t:n}),Wo=Ht(Eo,Fr),$o=rr(_t),So=rr(vt),Fo=or(Nu),No=or(Tu),To=ir(_t),Lo=ir(vt),zo=wu?function(n){
var t=null==n?w:n.constructor;return typeof t=="function"&&t.prototype===n||typeof n!="function"&&Er(n)?Lr(n):ge(n)?wu(n):[]}:Lr,Bo=fr(true),Do=fr(),Mo=le(function(n,t){if(null==n)return{};if("function"!=typeof t[0])return t=Gn(pt(t),Ye),Nr(n,ft(Re(n),t));var r=Bt(t[0],t[1],3);return Tr(n,function(n,t,e){return!r(n,t,e)})}),qo=le(function(n,t){return null==n?{}:"function"==typeof t[0]?Tr(n,Bt(t[0],t[1],3)):Nr(n,pt(t))}),Po=Gt(function(n,t,r){return t=t.toLowerCase(),n+(r?t.charAt(0).toUpperCase()+t.slice(1):t);
}),Ko=Gt(function(n,t,r){return n+(r?"-":"")+t.toLowerCase()}),Vo=ar(),Zo=ar(true),Yo=Gt(function(n,t,r){return n+(r?"_":"")+t.toLowerCase()}),Go=Gt(function(n,t,r){return n+(r?" ":"")+(t.charAt(0).toUpperCase()+t.slice(1))}),Jo=le(function(n,t){try{return n.apply(w,t)}catch(r){return _e(r)?r:new Me(r)}}),Xo=le(function(n,t){return function(r){return Or(r,n,t)}}),Ho=le(function(n,t){return function(r){return Or(n,r,t)}}),Qo=_r("ceil"),ni=_r("floor"),ti=Qt(se,Iu),ri=Qt(Ae,Ru),ei=_r("round");return Nn.prototype=Tn.prototype,
Ln.prototype=$u(Tn.prototype),Ln.prototype.constructor=Ln,zn.prototype=$u(Tn.prototype),zn.prototype.constructor=zn,Bn.prototype["delete"]=function(n){return this.has(n)&&delete this.__data__[n]},Bn.prototype.get=function(n){return"__proto__"==n?w:this.__data__[n]},Bn.prototype.has=function(n){return"__proto__"!=n&&nu.call(this.__data__,n)},Bn.prototype.set=function(n,t){return"__proto__"!=n&&(this.__data__[n]=t),this},Dn.prototype.push=function(n){var t=this.data;typeof n=="string"||ge(n)?t.set.add(n):t.hash[n]=true;
},ce.Cache=Bn,Nn.after=function(n,t){if(typeof t!="function"){if(typeof n!="function")throw new Ge(L);var r=n;n=t,t=r}return n=mu(n=+n)?n:0,function(){return 1>--n?t.apply(this,arguments):void 0}},Nn.ary=function(n,t,r){return r&&Ur(n,t,r)&&(t=w),t=n&&null==t?n.length:bu(+t||0,0),gr(n,E,w,w,w,w,t)},Nn.assign=Co,Nn.at=no,Nn.before=fe,Nn.bind=_o,Nn.bindAll=vo,Nn.bindKey=go,Nn.callback=Se,Nn.chain=Qr,Nn.chunk=function(n,t,r){t=(r?Ur(n,t,r):null==t)?1:bu(yu(t)||1,1),r=0;for(var e=n?n.length:0,u=-1,o=Be(vu(e/t));r<e;)o[++u]=Et(n,r,r+=t);
return o},Nn.compact=function(n){for(var t=-1,r=n?n.length:0,e=-1,u=[];++t<r;){var o=n[t];o&&(u[++e]=o)}return u},Nn.constant=function(n){return function(){return n}},Nn.countBy=to,Nn.create=function(n,t,r){var e=$u(n);return r&&Ur(n,t,r)&&(t=w),t?tt(e,t):e},Nn.curry=yo,Nn.curryRight=mo,Nn.debounce=ae,Nn.defaults=Uo,Nn.defaultsDeep=Wo,Nn.defer=wo,Nn.delay=bo,Nn.difference=Mu,Nn.drop=qr,Nn.dropRight=Pr,Nn.dropRightWhile=function(n,t,r){return n&&n.length?Nt(n,wr(t,r,3),true,true):[]},Nn.dropWhile=function(n,t,r){
return n&&n.length?Nt(n,wr(t,r,3),true):[]},Nn.fill=function(n,t,r,e){var u=n?n.length:0;if(!u)return[];for(r&&typeof r!="number"&&Ur(n,t,r)&&(r=0,e=u),u=n.length,r=null==r?0:+r||0,0>r&&(r=-r>u?0:u+r),e=e===w||e>u?u:+e||0,0>e&&(e+=u),u=r>e?0:e>>>0,r>>>=0;r<u;)n[r++]=t;return n},Nn.filter=re,Nn.flatten=function(n,t,r){var e=n?n.length:0;return r&&Ur(n,t,r)&&(t=false),e?pt(n,t):[]},Nn.flattenDeep=function(n){return n&&n.length?pt(n,true):[]},Nn.flow=xo,Nn.flowRight=Ao,Nn.forEach=uo,Nn.forEachRight=oo,Nn.forIn=Fo,
Nn.forInRight=No,Nn.forOwn=To,Nn.forOwnRight=Lo,Nn.functions=Ie,Nn.groupBy=io,Nn.indexBy=fo,Nn.initial=function(n){return Pr(n,1)},Nn.intersection=Ku,Nn.invert=function(n,t,r){r&&Ur(n,t,r)&&(t=w),r=-1;for(var e=zo(n),u=e.length,o={};++r<u;){var i=e[r],f=n[i];t?nu.call(o,f)?o[f].push(i):o[f]=[i]:o[f]=i}return o},Nn.invoke=ao,Nn.keys=zo,Nn.keysIn=Re,Nn.map=ue,Nn.mapKeys=Bo,Nn.mapValues=Do,Nn.matches=Ne,Nn.matchesProperty=function(n,t){return xt(n,ot(t,true))},Nn.memoize=ce,Nn.merge=Eo,Nn.method=Xo,Nn.methodOf=Ho,
Nn.mixin=Te,Nn.modArgs=jo,Nn.negate=function(n){if(typeof n!="function")throw new Ge(L);return function(){return!n.apply(this,arguments)}},Nn.omit=Mo,Nn.once=function(n){return fe(2,n)},Nn.pairs=Oe,Nn.partial=ko,Nn.partialRight=Io,Nn.partition=co,Nn.pick=qo,Nn.pluck=function(n,t){return ue(n,ze(t))},Nn.property=ze,Nn.propertyOf=function(n){return function(t){return yt(n,Dr(t),t+"")}},Nn.pull=function(){var n=arguments,t=n[0];if(!t||!t.length)return t;for(var r=0,e=xr(),u=n.length;++r<u;)for(var o=0,i=n[r];-1<(o=e(t,i,o));)pu.call(t,o,1);
return t},Nn.pullAt=Vu,Nn.range=function(n,t,r){r&&Ur(n,t,r)&&(t=r=w),n=+n||0,r=null==r?1:+r||0,null==t?(t=n,n=0):t=+t||0;var e=-1;t=bu(vu((t-n)/(r||1)),0);for(var u=Be(t);++e<t;)u[e]=n,n+=r;return u},Nn.rearg=Ro,Nn.reject=function(n,t,r){var e=Oo(n)?Vn:lt;return t=wr(t,r,3),e(n,function(n,r,e){return!t(n,r,e)})},Nn.remove=function(n,t,r){var e=[];if(!n||!n.length)return e;var u=-1,o=[],i=n.length;for(t=wr(t,r,3);++u<i;)r=n[u],t(r,u,n)&&(e.push(r),o.push(u));return It(n,o),e},Nn.rest=Yr,Nn.restParam=le,
Nn.set=function(n,t,r){if(null==n)return n;var e=t+"";t=null!=n[e]||Wr(t,n)?[e]:Dr(t);for(var e=-1,u=t.length,o=u-1,i=n;null!=i&&++e<u;){var f=t[e];ge(i)&&(e==o?i[f]=r:null==i[f]&&(i[f]=Cr(t[e+1])?[]:{})),i=i[f]}return n},Nn.shuffle=function(n){return oe(n,Ru)},Nn.slice=function(n,t,r){var e=n?n.length:0;return e?(r&&typeof r!="number"&&Ur(n,t,r)&&(t=0,r=e),Et(n,t,r)):[]},Nn.sortBy=function(n,t,r){if(null==n)return[];r&&Ur(n,t,r)&&(t=w);var e=-1;return t=wr(t,r,3),n=wt(n,function(n,r,u){return{a:t(n,r,u),
b:++e,c:n}}),Ut(n,f)},Nn.sortByAll=po,Nn.sortByOrder=function(n,t,r,e){return null==n?[]:(e&&Ur(t,r,e)&&(r=w),Oo(t)||(t=null==t?[]:[t]),Oo(r)||(r=null==r?[]:[r]),Wt(n,t,r))},Nn.spread=function(n){if(typeof n!="function")throw new Ge(L);return function(t){return n.apply(this,t)}},Nn.take=function(n,t,r){return n&&n.length?((r?Ur(n,t,r):null==t)&&(t=1),Et(n,0,0>t?0:t)):[]},Nn.takeRight=function(n,t,r){var e=n?n.length:0;return e?((r?Ur(n,t,r):null==t)&&(t=1),t=e-(+t||0),Et(n,0>t?0:t)):[]},Nn.takeRightWhile=function(n,t,r){
return n&&n.length?Nt(n,wr(t,r,3),false,true):[]},Nn.takeWhile=function(n,t,r){return n&&n.length?Nt(n,wr(t,r,3)):[]},Nn.tap=function(n,t,r){return t.call(r,n),n},Nn.throttle=function(n,t,r){var e=true,u=true;if(typeof n!="function")throw new Ge(L);return false===r?e=false:ge(r)&&(e="leading"in r?!!r.leading:e,u="trailing"in r?!!r.trailing:u),ae(n,t,{leading:e,maxWait:+t,trailing:u})},Nn.thru=ne,Nn.times=function(n,t,r){if(n=yu(n),1>n||!mu(n))return[];var e=-1,u=Be(xu(n,4294967295));for(t=Bt(t,r,1);++e<n;)4294967295>e?u[e]=t(e):t(e);
return u},Nn.toArray=je,Nn.toPlainObject=ke,Nn.transform=function(n,t,r,e){var u=Oo(n)||xe(n);return t=wr(t,e,4),null==r&&(u||ge(n)?(e=n.constructor,r=u?Oo(n)?new e:[]:$u(ve(e)?e.prototype:w)):r={}),(u?Pn:_t)(n,function(n,e,u){return t(r,n,e,u)}),r},Nn.union=Gu,Nn.uniq=Gr,Nn.unzip=Jr,Nn.unzipWith=Xr,Nn.values=Ee,Nn.valuesIn=function(n){return Ft(n,Re(n))},Nn.where=function(n,t){return re(n,bt(t))},Nn.without=Ju,Nn.wrap=function(n,t){return t=null==t?Fe:t,gr(t,R,w,[n],[])},Nn.xor=function(){for(var n=-1,t=arguments.length;++n<t;){
var r=arguments[n];if(Er(r))var e=e?Jn(ft(e,r),ft(r,e)):r}return e?St(e):[]},Nn.zip=Xu,Nn.zipObject=Hr,Nn.zipWith=Hu,Nn.backflow=Ao,Nn.collect=ue,Nn.compose=Ao,Nn.each=uo,Nn.eachRight=oo,Nn.extend=Co,Nn.iteratee=Se,Nn.methods=Ie,Nn.object=Hr,Nn.select=re,Nn.tail=Yr,Nn.unique=Gr,Te(Nn,Nn),Nn.add=function(n,t){return(+n||0)+(+t||0)},Nn.attempt=Jo,Nn.camelCase=Po,Nn.capitalize=function(n){return(n=u(n))&&n.charAt(0).toUpperCase()+n.slice(1)},Nn.ceil=Qo,Nn.clone=function(n,t,r,e){return t&&typeof t!="boolean"&&Ur(n,t,r)?t=false:typeof t=="function"&&(e=r,
r=t,t=false),typeof r=="function"?ot(n,t,Bt(r,e,3)):ot(n,t)},Nn.cloneDeep=function(n,t,r){return typeof t=="function"?ot(n,true,Bt(t,r,3)):ot(n,true)},Nn.deburr=Ce,Nn.endsWith=function(n,t,r){n=u(n),t+="";var e=n.length;return r=r===w?e:xu(0>r?0:+r||0,e),r-=t.length,0<=r&&n.indexOf(t,r)==r},Nn.escape=function(n){return(n=u(n))&&hn.test(n)?n.replace(sn,c):n},Nn.escapeRegExp=function(n){return(n=u(n))&&bn.test(n)?n.replace(wn,l):n||"(?:)"},Nn.every=te,Nn.find=ro,Nn.findIndex=qu,Nn.findKey=$o,Nn.findLast=eo,
Nn.findLastIndex=Pu,Nn.findLastKey=So,Nn.findWhere=function(n,t){return ro(n,bt(t))},Nn.first=Kr,Nn.floor=ni,Nn.get=function(n,t,r){return n=null==n?w:yt(n,Dr(t),t+""),n===w?r:n},Nn.gt=se,Nn.gte=function(n,t){return n>=t},Nn.has=function(n,t){if(null==n)return false;var r=nu.call(n,t);if(!r&&!Wr(t)){if(t=Dr(t),n=1==t.length?n:yt(n,Et(t,0,-1)),null==n)return false;t=Zr(t),r=nu.call(n,t)}return r||Sr(n.length)&&Cr(t,n.length)&&(Oo(n)||pe(n))},Nn.identity=Fe,Nn.includes=ee,Nn.indexOf=Vr,Nn.inRange=function(n,t,r){
return t=+t||0,r===w?(r=t,t=0):r=+r||0,n>=xu(t,r)&&n<bu(t,r)},Nn.isArguments=pe,Nn.isArray=Oo,Nn.isBoolean=function(n){return true===n||false===n||h(n)&&ru.call(n)==M},Nn.isDate=function(n){return h(n)&&ru.call(n)==q},Nn.isElement=function(n){return!!n&&1===n.nodeType&&h(n)&&!me(n)},Nn.isEmpty=function(n){return null==n?true:Er(n)&&(Oo(n)||be(n)||pe(n)||h(n)&&ve(n.splice))?!n.length:!zo(n).length},Nn.isEqual=he,Nn.isError=_e,Nn.isFinite=function(n){return typeof n=="number"&&mu(n)},Nn.isFunction=ve,Nn.isMatch=function(n,t,r,e){
return r=typeof r=="function"?Bt(r,e,3):w,mt(n,Ar(t),r)},Nn.isNaN=function(n){return de(n)&&n!=+n},Nn.isNative=ye,Nn.isNull=function(n){return null===n},Nn.isNumber=de,Nn.isObject=ge,Nn.isPlainObject=me,Nn.isRegExp=we,Nn.isString=be,Nn.isTypedArray=xe,Nn.isUndefined=function(n){return n===w},Nn.kebabCase=Ko,Nn.last=Zr,Nn.lastIndexOf=function(n,t,r){var e=n?n.length:0;if(!e)return-1;var u=e;if(typeof r=="number")u=(0>r?bu(e+r,0):xu(r||0,e-1))+1;else if(r)return u=Lt(n,t,true)-1,n=n[u],(t===t?t===n:n!==n)?u:-1;
if(t!==t)return p(n,u,true);for(;u--;)if(n[u]===t)return u;return-1},Nn.lt=Ae,Nn.lte=function(n,t){return n<=t},Nn.max=ti,Nn.min=ri,Nn.noConflict=function(){return Zn._=eu,this},Nn.noop=Le,Nn.now=ho,Nn.pad=function(n,t,r){n=u(n),t=+t;var e=n.length;return e<t&&mu(t)?(e=(t-e)/2,t=yu(e),e=vu(e),r=pr("",e,r),r.slice(0,t)+n+r):n},Nn.padLeft=Vo,Nn.padRight=Zo,Nn.parseInt=function(n,t,r){return(r?Ur(n,t,r):null==t)?t=0:t&&(t=+t),n=We(n),ju(n,t||(In.test(n)?16:10))},Nn.random=function(n,t,r){r&&Ur(n,t,r)&&(t=r=w);
var e=null==n,u=null==t;return null==r&&(u&&typeof n=="boolean"?(r=n,n=1):typeof t=="boolean"&&(r=t,u=true)),e&&u&&(t=1,u=false),n=+n||0,u?(t=n,n=0):t=+t||0,r||n%1||t%1?(r=ku(),xu(n+r*(t-n+fu("1e-"+((r+"").length-1))),t)):Rt(n,t)},Nn.reduce=lo,Nn.reduceRight=so,Nn.repeat=Ue,Nn.result=function(n,t,r){var e=null==n?w:n[t];return e===w&&(null==n||Wr(t,n)||(t=Dr(t),n=1==t.length?n:yt(n,Et(t,0,-1)),e=null==n?w:n[Zr(t)]),e=e===w?r:e),ve(e)?e.call(n):e},Nn.round=ei,Nn.runInContext=m,Nn.size=function(n){var t=n?Bu(n):0;
return Sr(t)?t:zo(n).length},Nn.snakeCase=Yo,Nn.some=ie,Nn.sortedIndex=Zu,Nn.sortedLastIndex=Yu,Nn.startCase=Go,Nn.startsWith=function(n,t,r){return n=u(n),r=null==r?0:xu(0>r?0:+r||0,n.length),n.lastIndexOf(t,r)==r},Nn.sum=function(n,t,r){if(r&&Ur(n,t,r)&&(t=w),t=wr(t,r,3),1==t.length){n=Oo(n)?n:zr(n),r=n.length;for(var e=0;r--;)e+=+t(n[r])||0;n=e}else n=$t(n,t);return n},Nn.template=function(n,t,r){var e=Nn.templateSettings;r&&Ur(n,t,r)&&(t=r=w),n=u(n),t=nt(tt({},r||t),e,Qn),r=nt(tt({},t.imports),e.imports,Qn);
var o,i,f=zo(r),a=Ft(r,f),c=0;r=t.interpolate||Cn;var l="__p+='";r=Ze((t.escape||Cn).source+"|"+r.source+"|"+(r===gn?jn:Cn).source+"|"+(t.evaluate||Cn).source+"|$","g");var p="sourceURL"in t?"//# sourceURL="+t.sourceURL+"\n":"";if(n.replace(r,function(t,r,e,u,f,a){return e||(e=u),l+=n.slice(c,a).replace(Un,s),r&&(o=true,l+="'+__e("+r+")+'"),f&&(i=true,l+="';"+f+";\n__p+='"),e&&(l+="'+((__t=("+e+"))==null?'':__t)+'"),c=a+t.length,t}),l+="';",(t=t.variable)||(l="with(obj){"+l+"}"),l=(i?l.replace(fn,""):l).replace(an,"$1").replace(cn,"$1;"),
l="function("+(t||"obj")+"){"+(t?"":"obj||(obj={});")+"var __t,__p=''"+(o?",__e=_.escape":"")+(i?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}",t=Jo(function(){return qe(f,p+"return "+l).apply(w,a)}),t.source=l,_e(t))throw t;return t},Nn.trim=We,Nn.trimLeft=function(n,t,r){var e=n;return(n=u(n))?n.slice((r?Ur(e,t,r):null==t)?g(n):o(n,t+"")):n},Nn.trimRight=function(n,t,r){var e=n;return(n=u(n))?(r?Ur(e,t,r):null==t)?n.slice(0,y(n)+1):n.slice(0,i(n,t+"")+1):n;
},Nn.trunc=function(n,t,r){r&&Ur(n,t,r)&&(t=w);var e=U;if(r=W,null!=t)if(ge(t)){var o="separator"in t?t.separator:o,e="length"in t?+t.length||0:e;r="omission"in t?u(t.omission):r}else e=+t||0;if(n=u(n),e>=n.length)return n;if(e-=r.length,1>e)return r;if(t=n.slice(0,e),null==o)return t+r;if(we(o)){if(n.slice(e).search(o)){var i,f=n.slice(0,e);for(o.global||(o=Ze(o.source,(kn.exec(o)||"")+"g")),o.lastIndex=0;n=o.exec(f);)i=n.index;t=t.slice(0,null==i?e:i)}}else n.indexOf(o,e)!=e&&(o=t.lastIndexOf(o),
-1<o&&(t=t.slice(0,o)));return t+r},Nn.unescape=function(n){return(n=u(n))&&pn.test(n)?n.replace(ln,d):n},Nn.uniqueId=function(n){var t=++tu;return u(n)+t},Nn.words=$e,Nn.all=te,Nn.any=ie,Nn.contains=ee,Nn.eq=he,Nn.detect=ro,Nn.foldl=lo,Nn.foldr=so,Nn.head=Kr,Nn.include=ee,Nn.inject=lo,Te(Nn,function(){var n={};return _t(Nn,function(t,r){Nn.prototype[r]||(n[r]=t)}),n}(),false),Nn.sample=oe,Nn.prototype.sample=function(n){return this.__chain__||null!=n?this.thru(function(t){return oe(t,n)}):oe(this.value());
},Nn.VERSION=b,Pn("bind bindKey curry curryRight partial partialRight".split(" "),function(n){Nn[n].placeholder=Nn}),Pn(["drop","take"],function(n,t){zn.prototype[n]=function(r){var e=this.__filtered__;if(e&&!t)return new zn(this);r=null==r?1:bu(yu(r)||0,0);var u=this.clone();return e?u.__takeCount__=xu(u.__takeCount__,r):u.__views__.push({size:r,type:n+(0>u.__dir__?"Right":"")}),u},zn.prototype[n+"Right"]=function(t){return this.reverse()[n](t).reverse()}}),Pn(["filter","map","takeWhile"],function(n,t){
var r=t+1,e=r!=T;zn.prototype[n]=function(n,t){var u=this.clone();return u.__iteratees__.push({iteratee:wr(n,t,1),type:r}),u.__filtered__=u.__filtered__||e,u}}),Pn(["first","last"],function(n,t){var r="take"+(t?"Right":"");zn.prototype[n]=function(){return this[r](1).value()[0]}}),Pn(["initial","rest"],function(n,t){var r="drop"+(t?"":"Right");zn.prototype[n]=function(){return this.__filtered__?new zn(this):this[r](1)}}),Pn(["pluck","where"],function(n,t){var r=t?"filter":"map",e=t?bt:ze;zn.prototype[n]=function(n){
return this[r](e(n))}}),zn.prototype.compact=function(){return this.filter(Fe)},zn.prototype.reject=function(n,t){return n=wr(n,t,1),this.filter(function(t){return!n(t)})},zn.prototype.slice=function(n,t){n=null==n?0:+n||0;var r=this;return r.__filtered__&&(0<n||0>t)?new zn(r):(0>n?r=r.takeRight(-n):n&&(r=r.drop(n)),t!==w&&(t=+t||0,r=0>t?r.dropRight(-t):r.take(t-n)),r)},zn.prototype.takeRightWhile=function(n,t){return this.reverse().takeWhile(n,t).reverse()},zn.prototype.toArray=function(){return this.take(Ru);
},_t(zn.prototype,function(n,t){var r=/^(?:filter|map|reject)|While$/.test(t),e=/^(?:first|last)$/.test(t),u=Nn[e?"take"+("last"==t?"Right":""):t];u&&(Nn.prototype[t]=function(){function t(n){return e&&i?u(n,1)[0]:u.apply(w,Jn([n],o))}var o=e?[1]:arguments,i=this.__chain__,f=this.__wrapped__,a=!!this.__actions__.length,c=f instanceof zn,l=o[0],s=c||Oo(f);return s&&r&&typeof l=="function"&&1!=l.length&&(c=s=false),l={func:ne,args:[t],thisArg:w},a=c&&!a,e&&!i?a?(f=f.clone(),f.__actions__.push(l),n.call(f)):u.call(w,this.value())[0]:!e&&s?(f=a?f:new zn(this),
f=n.apply(f,o),f.__actions__.push(l),new Ln(f,i)):this.thru(t)})}),Pn("join pop push replace shift sort splice split unshift".split(" "),function(n){var t=(/^(?:replace|split)$/.test(n)?He:Je)[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:join|pop|replace|shift)$/.test(n);Nn.prototype[n]=function(){var n=arguments;return e&&!this.__chain__?t.apply(this.value(),n):this[r](function(r){return t.apply(r,n)})}}),_t(zn.prototype,function(n,t){var r=Nn[t];if(r){var e=r.name+"";(Wu[e]||(Wu[e]=[])).push({
name:t,func:r})}}),Wu[sr(w,A).name]=[{name:"wrapper",func:w}],zn.prototype.clone=function(){var n=new zn(this.__wrapped__);return n.__actions__=qn(this.__actions__),n.__dir__=this.__dir__,n.__filtered__=this.__filtered__,n.__iteratees__=qn(this.__iteratees__),n.__takeCount__=this.__takeCount__,n.__views__=qn(this.__views__),n},zn.prototype.reverse=function(){if(this.__filtered__){var n=new zn(this);n.__dir__=-1,n.__filtered__=true}else n=this.clone(),n.__dir__*=-1;return n},zn.prototype.value=function(){
var n,t=this.__wrapped__.value(),r=this.__dir__,e=Oo(t),u=0>r,o=e?t.length:0;n=o;for(var i=this.__views__,f=0,a=-1,c=i.length;++a<c;){var l=i[a],s=l.size;switch(l.type){case"drop":f+=s;break;case"dropRight":n-=s;break;case"take":n=xu(n,f+s);break;case"takeRight":f=bu(f,n-s)}}if(n={start:f,end:n},i=n.start,f=n.end,n=f-i,u=u?f:i-1,i=this.__iteratees__,f=i.length,a=0,c=xu(n,this.__takeCount__),!e||o<F||o==n&&c==n)return Tt(t,this.__actions__);e=[];n:for(;n--&&a<c;){for(u+=r,o=-1,l=t[u];++o<f;){var p=i[o],s=p.type,p=p.iteratee(l);
if(s==T)l=p;else if(!p){if(s==N)continue n;break n}}e[a++]=l}return e},Nn.prototype.chain=function(){return Qr(this)},Nn.prototype.commit=function(){return new Ln(this.value(),this.__chain__)},Nn.prototype.concat=Qu,Nn.prototype.plant=function(n){for(var t,r=this;r instanceof Tn;){var e=Mr(r);t?u.__wrapped__=e:t=e;var u=e,r=r.__wrapped__}return u.__wrapped__=n,t},Nn.prototype.reverse=function(){function n(n){return n.reverse()}var t=this.__wrapped__;return t instanceof zn?(this.__actions__.length&&(t=new zn(this)),
t=t.reverse(),t.__actions__.push({func:ne,args:[n],thisArg:w}),new Ln(t,this.__chain__)):this.thru(n)},Nn.prototype.toString=function(){return this.value()+""},Nn.prototype.run=Nn.prototype.toJSON=Nn.prototype.valueOf=Nn.prototype.value=function(){return Tt(this.__wrapped__,this.__actions__)},Nn.prototype.collect=Nn.prototype.map,Nn.prototype.head=Nn.prototype.first,Nn.prototype.select=Nn.prototype.filter,Nn.prototype.tail=Nn.prototype.rest,Nn}var w,b="3.10.1",x=1,A=2,j=4,k=8,I=16,R=32,O=64,E=128,C=256,U=30,W="...",$=150,S=16,F=200,N=1,T=2,L="Expected a function",z="__lodash_placeholder__",B="[object Arguments]",D="[object Array]",M="[object Boolean]",q="[object Date]",P="[object Error]",K="[object Function]",V="[object Number]",Z="[object Object]",Y="[object RegExp]",G="[object String]",J="[object ArrayBuffer]",X="[object Float32Array]",H="[object Float64Array]",Q="[object Int8Array]",nn="[object Int16Array]",tn="[object Int32Array]",rn="[object Uint8Array]",en="[object Uint8ClampedArray]",un="[object Uint16Array]",on="[object Uint32Array]",fn=/\b__p\+='';/g,an=/\b(__p\+=)''\+/g,cn=/(__e\(.*?\)|\b__t\))\+'';/g,ln=/&(?:amp|lt|gt|quot|#39|#96);/g,sn=/[&<>"'`]/g,pn=RegExp(ln.source),hn=RegExp(sn.source),_n=/<%-([\s\S]+?)%>/g,vn=/<%([\s\S]+?)%>/g,gn=/<%=([\s\S]+?)%>/g,yn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/,dn=/^\w*$/,mn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g,wn=/^[:!,]|[\\^$.*+?()[\]{}|\/]|(^[0-9a-fA-Fnrtuvx])|([\n\r\u2028\u2029])/g,bn=RegExp(wn.source),xn=/[\u0300-\u036f\ufe20-\ufe23]/g,An=/\\(\\)?/g,jn=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,kn=/\w*$/,In=/^0[xX]/,Rn=/^\[object .+?Constructor\]$/,On=/^\d+$/,En=/[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g,Cn=/($^)/,Un=/['\n\r\u2028\u2029\\]/g,Wn=RegExp("[A-Z\\xc0-\\xd6\\xd8-\\xde]+(?=[A-Z\\xc0-\\xd6\\xd8-\\xde][a-z\\xdf-\\xf6\\xf8-\\xff]+)|[A-Z\\xc0-\\xd6\\xd8-\\xde]?[a-z\\xdf-\\xf6\\xf8-\\xff]+|[A-Z\\xc0-\\xd6\\xd8-\\xde]+|[0-9]+","g"),$n="Array ArrayBuffer Date Error Float32Array Float64Array Function Int8Array Int16Array Int32Array Math Number Object RegExp Set String _ clearTimeout isFinite parseFloat parseInt setTimeout TypeError Uint8Array Uint8ClampedArray Uint16Array Uint32Array WeakMap".split(" "),Sn={};
Sn[X]=Sn[H]=Sn[Q]=Sn[nn]=Sn[tn]=Sn[rn]=Sn[en]=Sn[un]=Sn[on]=true,Sn[B]=Sn[D]=Sn[J]=Sn[M]=Sn[q]=Sn[P]=Sn[K]=Sn["[object Map]"]=Sn[V]=Sn[Z]=Sn[Y]=Sn["[object Set]"]=Sn[G]=Sn["[object WeakMap]"]=false;var Fn={};Fn[B]=Fn[D]=Fn[J]=Fn[M]=Fn[q]=Fn[X]=Fn[H]=Fn[Q]=Fn[nn]=Fn[tn]=Fn[V]=Fn[Z]=Fn[Y]=Fn[G]=Fn[rn]=Fn[en]=Fn[un]=Fn[on]=true,Fn[P]=Fn[K]=Fn["[object Map]"]=Fn["[object Set]"]=Fn["[object WeakMap]"]=false;var Nn={"\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"},Tn={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","`":"&#96;"},Ln={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'","&#96;":"`"},zn={"function":true,object:true},Bn={0:"x30",1:"x31",2:"x32",3:"x33",4:"x34",5:"x35",6:"x36",7:"x37",8:"x38",9:"x39",A:"x41",B:"x42",C:"x43",D:"x44",E:"x45",F:"x46",a:"x61",b:"x62",c:"x63",d:"x64",e:"x65",f:"x66",n:"x6e",r:"x72",t:"x74",u:"x75",v:"x76",x:"x78"},Dn={"\\":"\\",
"'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Mn=zn[typeof exports]&&exports&&!exports.nodeType&&exports,qn=zn[typeof module]&&module&&!module.nodeType&&module,Pn=zn[typeof self]&&self&&self.Object&&self,Kn=zn[typeof window]&&window&&window.Object&&window,Vn=qn&&qn.exports===Mn&&Mn,Zn=Mn&&qn&&typeof global=="object"&&global&&global.Object&&global||Kn!==(this&&this.window)&&Kn||Pn||this,Yn=m();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(Zn._=Yn, define(function(){
return Yn})):Mn&&qn?Vn?(qn.exports=Yn)._=Yn:Mn._=Yn:Zn._=Yn}).call(this);

View File

@@ -1,33 +1,49 @@
{
"name": "lodash",
"version": "3.10.1",
"main": "lodash.src.js",
"version": "4.2.1",
"main": "lodash.js",
"private": true,
"devDependencies": {
"curl-amd": "0.8.12",
"dojo": "~1.10.0",
"jquery": "~1.11.0",
"platform": "~1.3.0",
"qunit-extras": "~1.4.0",
"qunitjs": "~1.18.0",
"requirejs": "~2.1.0"
"async": "^1.5.2",
"benchmark": "^2.1.0",
"chalk": "^1.1.1",
"codecov.io": "~0.1.6",
"coveralls": "^2.11.6",
"curl-amd": "~0.8.12",
"docdown": "~0.4.1",
"dojo": "^1.10.4",
"ecstatic": "^1.4.0",
"fs-extra": "~0.26.5",
"glob": "^6.0.4",
"istanbul": "0.4.2",
"jquery": "^2.2.0",
"jscs": "^2.9.0",
"lodash": "^3.10.1",
"platform": "^1.3.1",
"qunit-extras": "^1.4.5",
"qunitjs": "~1.21.0",
"request": "^2.69.0",
"requirejs": "^2.1.22",
"sauce-tunnel": "2.3.0",
"uglify-js": "2.6.1",
"webpack": "^1.12.12"
},
"volo": {
"type": "directory",
"ignore": [
".*",
"*.custom.*",
"*.log",
"*.map",
"*.md",
"lodash.src.js",
"bower.json",
"component.json",
"doc",
"node_modules",
"perf",
"test",
"vendor"
]
"scripts": {
"build": "npm run build:main & npm run build:fp",
"build:fp": "node lib/fp/build-dist.js",
"build:fp-modules": "node lib/fp/build-modules.js",
"build:main": "node lib/main/build-dist.js",
"build:main-modules": "node lib/main/build-modules.js",
"doc": "node lib/doc/build github",
"doc:site": "node lib/doc/build site",
"pretest": "npm run build",
"style": "npm run style:main & npm run style:fp & npm run style:perf & npm run style:test",
"style:fp": "jscs fp/*.js lib/**/*.js",
"style:main": "jscs lodash.js",
"style:perf": "jscs perf/*.js perf/**/*.js",
"style:test": "jscs test/*.js test/**/*.js",
"test": "npm run test:main && npm run test:fp",
"test:fp": "node test/test-fp",
"test:main": "node test/test"
}
}

View File

@@ -58,10 +58,7 @@
span1.innerHTML =
'<label for="perf-build">Build: </label>' +
'<select id="perf-build">' +
'<option value="lodash-compat">lodash (compat)</option>' +
'<option value="lodash-modern">lodash (modern)</option>' +
'<option value="lodash-custom-dev">lodash (custom development)</option>' +
'<option value="lodash-custom">lodash (custom production)</option>' +
'<option value="lodash">lodash</option>' +
'</select>';
var span2 = document.createElement('span');
@@ -71,10 +68,7 @@
'<select id="perf-other">' +
'<option value="underscore-dev">Underscore (development)</option>' +
'<option value="underscore">Underscore (production)</option>' +
'<option value="lodash-compat">lodash (compat)</option>' +
'<option value="lodash-modern">lodash (modern)</option>' +
'<option value="lodash-custom-dev">lodash (custom development)</option>' +
'<option value="lodash-custom">lodash (custom production)</option>' +
'<option value="lodash">lodash</option>' +
'</select>';
var buildList = span1.lastChild,
@@ -86,11 +80,8 @@
buildList.selectedIndex = (function() {
switch (build) {
case 'lodash-compat': return 0;
case 'lodash-custom-dev': return 2;
case 'lodash-custom': return 3;
case 'lodash-modern':
case null: return 1;
case 'lodash':
case null: return 0;
}
return -1;
}());
@@ -98,10 +89,7 @@
otherList.selectedIndex = (function() {
switch (other) {
case 'underscore-dev': return 0;
case 'lodash-compat': return 2;
case 'lodash-modern': return 3;
case 'lodash-custom-dev': return 4;
case 'lodash-custom': return 5;
case 'lodash': return 2;
case 'underscore':
case null: return 1;
}
@@ -116,11 +104,8 @@
ui.buildPath = (function() {
var result;
switch (build) {
case 'lodash-compat': result = 'lodash.compat.min.js'; break;
case 'lodash-custom-dev': result = 'lodash.custom.js'; break;
case 'lodash-custom': result = 'lodash.custom.min.js'; break;
case null: build = 'lodash-modern';
case 'lodash-modern': result = 'lodash.min.js'; break;
case null: build = 'lodash';
case 'lodash': result = 'dist/lodash.min.js'; break;
default: return build;
}
return basePath + result;
@@ -130,10 +115,7 @@
ui.otherPath = (function() {
var result;
switch (other) {
case 'lodash-compat': result = 'lodash.compat.min.js'; break;
case 'lodash-modern': result = 'lodash.min.js'; break;
case 'lodash-custom-dev': result = 'lodash.custom.js'; break;
case 'lodash-custom': result = 'lodash.custom.min.js'; break;
case 'lodash': result = 'dist/lodash.min.js'; break;
case 'underscore-dev': result = 'vendor/underscore/underscore.js'; break;
case null: other = 'underscore';
case 'underscore': result = 'vendor/underscore/underscore-min.js'; break;

View File

@@ -9,10 +9,6 @@
padding: 0;
height: 100%;
}
applet {
position: absolute;
left: -9999em;
}
#FirebugUI {
top: 2em;
}
@@ -28,9 +24,9 @@
</head>
<body>
<div id="perf-toolbar"></div>
<script src="../lodash.js"></script>
<script src="../node_modules/platform/platform.js"></script>
<script src="../lodash.src.js"></script>
<script src="../vendor/benchmark.js/benchmark.js"></script>
<script src="../node_modules/benchmark/benchmark.js"></script>
<script src="../vendor/firebug-lite/src/firebug-lite-debug.js"></script>
<script src="./asset/perf-ui.js"></script>
<script>
@@ -66,15 +62,6 @@
setTimeout(run, 15);
}
// is the applet permitted?
if (!/[?&]nojava=true(?:&|$)/.test(location.search)) {
// is the applet really needed?
while (!(measured = new Date - begin)) {}
if (measured > 1 && !((perfNow = window.performance) && typeof (perfNow.now || perfNow.webkitNow) == 'function')) {
// load applet
document.write('<applet code="nano" archive="../vendor/benchmark.js/nano.jar"></applet>');
}
}
window.onload = init;
}());
</script>

View File

@@ -38,16 +38,16 @@
result = params;
}
var last = result[result.length - 1];
result = (result.length > min && !/perf(?:\.js)?$/.test(last)) ? last : '../lodash.src.js';
result = (result.length > min && !/perf(?:\.js)?$/.test(last)) ? last : '../lodash.js';
if (!amd) {
try {
result = require('fs').realpathSync(result);
} catch(e) {}
} catch (e) {}
try {
result = require.resolve(result);
} catch(e) {}
} catch (e) {}
}
return result;
}());
@@ -88,13 +88,10 @@
/** Detect if in a browser environment. */
var isBrowser = isHostType(root, 'document') && isHostType(root, 'navigator');
/** Detect if in a Java environment. */
var isJava = !isBrowser && /Java/.test(toString.call(root.java));
/** Use a single "load" function. */
var load = (typeof require == 'function' && !amd)
? require
: (isJava && root.load) || noop;
: noop;
/** Load lodash. */
var lodash = root.lodash || (root.lodash = (
@@ -104,19 +101,19 @@
lodash.noConflict()
));
/** Load Benchmark.js. */
var Benchmark = root.Benchmark || (root.Benchmark = (
Benchmark = load('../vendor/benchmark.js/benchmark.js') || root.Benchmark,
Benchmark = Benchmark.Benchmark || Benchmark,
Benchmark.runInContext(lodash.extend({}, root, { '_': lodash }))
));
/** Load Underscore. */
var _ = root._ || (root._ = (
var _ = root.underscore || (root.underscore = (
_ = load('../vendor/underscore/underscore.js') || root._,
_._ || _
));
/** Load Benchmark.js. */
var Benchmark = root.Benchmark || (root.Benchmark = (
Benchmark = load('../node_modules/benchmark/benchmark.js') || root.Benchmark,
Benchmark = Benchmark.Benchmark || Benchmark,
Benchmark.runInContext(lodash.extend({}, root, { '_': lodash }))
));
/*--------------------------------------------------------------------------*/
/**
@@ -205,7 +202,7 @@
fbPanel.getElementById('fbPanel1');
log('\nSit back and relax, this may take a while.');
suites[0].run({ 'async': !isJava });
suites[0].run({ 'async': true });
}
/*--------------------------------------------------------------------------*/
@@ -258,7 +255,7 @@
if (suites.length) {
// Run next suite.
suites[0].run({ 'async': !isJava });
suites[0].run({ 'async': true });
}
else {
var aMeanHz = getGeometricMean(score.a),
@@ -284,7 +281,7 @@
lodash.extend(Benchmark.options, {
'async': true,
'setup': '\
var _ = global._,\
var _ = global.underscore,\
lodash = global.lodash,\
belt = this.name == buildName ? lodash : _;\
\
@@ -351,8 +348,8 @@
square = function(v) { return v * v; };\
\
var largeArray = belt.range(10000),\
_chaining = _.chain ? _(largeArray).chain() : _(largeArray),\
lodashChaining = lodash(largeArray);\
_chaining = _(largeArray).chain(),\
lodashChaining = lodash(largeArray).chain();\
}\
if (typeof compact != "undefined") {\
var uncompacted = numbers.slice();\
@@ -360,13 +357,13 @@
uncompacted[6] = null;\
uncompacted[18] = "";\
}\
if (typeof compose != "undefined") {\
if (typeof flowRight != "undefined") {\
var compAddOne = function(n) { return n + 1; },\
compAddTwo = function(n) { return n + 2; },\
compAddThree = function(n) { return n + 3; };\
\
var _composed = _.compose(compAddThree, compAddTwo, compAddOne),\
lodashComposed = lodash.compose(compAddThree, compAddTwo, compAddOne);\
var _composed = _.flowRight && _.flowRight(compAddThree, compAddTwo, compAddOne),\
lodashComposed = lodash.flowRight && lodash.flowRight(compAddThree, compAddTwo, compAddOne);\
}\
if (typeof countBy != "undefined" || typeof omit != "undefined") {\
var wordToNumber = {\
@@ -461,11 +458,8 @@
if (typeof matches != "undefined") {\
var source = { "num": 9 };\
\
var _findWhere = _.findWhere || _.find,\
_matcher = (_.matches || _.createCallback || _.noop)(source);\
\
var lodashFindWhere = lodash.findWhere || lodash.find,\
lodashMatcher = (lodash.matches || lodash.createCallback || lodash.noop)(source);\
var _matcher = (_.matches || _.noop)(source),\
lodashMatcher = (lodash.matches || lodash.noop)(source);\
}\
if (typeof multiArrays != "undefined") {\
var twentyValues = belt.shuffle(belt.range(20)),\
@@ -645,25 +639,13 @@
/*--------------------------------------------------------------------------*/
suites.push(
Benchmark.Suite('`_.bindAll` iterating arguments')
Benchmark.Suite('`_.bindAll`')
.add(buildName, {
'fn': 'lodash.bindAll.apply(lodash, [bindAllObjects[++bindAllCount]].concat(funcNames))',
'fn': 'lodash.bindAll(bindAllObjects[++bindAllCount], funcNames)',
'teardown': 'function bindAll(){}'
})
.add(otherName, {
'fn': '_.bindAll.apply(_, [bindAllObjects[++bindAllCount]].concat(funcNames))',
'teardown': 'function bindAll(){}'
})
);
suites.push(
Benchmark.Suite('`_.bindAll` iterating the `object`')
.add(buildName, {
'fn': 'lodash.bindAll(bindAllObjects[++bindAllCount])',
'teardown': 'function bindAll(){}'
})
.add(otherName, {
'fn': '_.bindAll(bindAllObjects[++bindAllCount])',
'fn': '_.bindAll(bindAllObjects[++bindAllCount], funcNames)',
'teardown': 'function bindAll(){}'
})
);
@@ -706,32 +688,6 @@
/*--------------------------------------------------------------------------*/
suites.push(
Benchmark.Suite('`_.compose`')
.add(buildName, {
'fn': 'lodash.compose(compAddThree, compAddTwo, compAddOne)',
'teardown': 'function compose(){}'
})
.add(otherName, {
'fn': '_.compose(compAddThree, compAddTwo, compAddOne)',
'teardown': 'function compose(){}'
})
);
suites.push(
Benchmark.Suite('composed call')
.add(buildName, {
'fn': 'lodashComposed(0)',
'teardown': 'function compose(){}'
})
.add(otherName, {
'fn': '_composed(0)',
'teardown': 'function compose(){}'
})
);
/*--------------------------------------------------------------------------*/
suites.push(
Benchmark.Suite('`_.countBy` with `callback` iterating an array')
.add(buildName, '\
@@ -832,22 +788,6 @@
)
);
suites.push(
Benchmark.Suite('`_.each` iterating an array with `thisArg` (slow path)')
.add(buildName, '\
var result = [];\
lodash.each(numbers, function(num, index) {\
result.push(num + this["key" + index]);\
}, object)'
)
.add(otherName, '\
var result = [];\
_.each(numbers, function(num, index) {\
result.push(num + this["key" + index]);\
}, object)'
)
);
suites.push(
Benchmark.Suite('`_.each` iterating an object')
.add(buildName, '\
@@ -910,20 +850,6 @@
)
);
suites.push(
Benchmark.Suite('`_.filter` iterating an array with `thisArg` (slow path)')
.add(buildName, '\
lodash.filter(numbers, function(num, index) {\
return this["key" + index] % 2;\
}, object)'
)
.add(otherName, '\
_.filter(numbers, function(num, index) {\
return this["key" + index] % 2;\
}, object)'
)
);
suites.push(
Benchmark.Suite('`_.filter` iterating an object')
.add(buildName, '\
@@ -938,6 +864,18 @@
)
);
suites.push(
Benchmark.Suite('`_.filter` with `_.matches` shorthand')
.add(buildName, {
'fn': 'lodash.filter(objects, source)',
'teardown': 'function matches(){}'
})
.add(otherName, {
'fn': '_.filter(objects, source)',
'teardown': 'function matches(){}'
})
);
suites.push(
Benchmark.Suite('`_.filter` with `_.matches` predicate')
.add(buildName, {
@@ -981,19 +919,17 @@
);
// Avoid Underscore induced `OutOfMemoryError` in Rhino and Ringo.
if (!isJava) {
suites.push(
Benchmark.Suite('`_.find` with `_.matches` shorthand')
.add(buildName, {
'fn': 'lodashFindWhere(objects, source)',
'teardown': 'function matches(){}'
})
.add(otherName, {
'fn': '_findWhere(objects, source)',
'teardown': 'function matches(){}'
})
);
}
suites.push(
Benchmark.Suite('`_.find` with `_.matches` shorthand')
.add(buildName, {
'fn': 'lodash.find(objects, source)',
'teardown': 'function matches(){}'
})
.add(otherName, {
'fn': '_.find(objects, source)',
'teardown': 'function matches(){}'
})
);
/*--------------------------------------------------------------------------*/
@@ -1009,32 +945,60 @@
})
);
/*--------------------------------------------------------------------------*/
suites.push(
Benchmark.Suite('`_.flatten` nested arrays of numbers with `isDeep`')
Benchmark.Suite('`_.flattenDeep` nested arrays of numbers')
.add(buildName, {
'fn': 'lodash.flatten(nestedNumbers, lodashFlattenDeep)',
'fn': 'lodash.flattenDeep(nestedNumbers)',
'teardown': 'function flatten(){}'
})
.add(otherName, {
'fn': '_.flatten(nestedNumbers, _flattenDeep)',
'fn': '_.flattenDeep(nestedNumbers)',
'teardown': 'function flatten(){}'
})
);
suites.push(
Benchmark.Suite('`_.flatten` nest arrays of objects with `isDeep`')
Benchmark.Suite('`_.flattenDeep` nest arrays of objects')
.add(buildName, {
'fn': 'lodash.flatten(nestedObjects, lodashFlattenDeep)',
'fn': 'lodash.flattenDeep(nestedObjects)',
'teardown': 'function flatten(){}'
})
.add(otherName, {
'fn': '_.flatten(nestedObjects, _flattenDeep)',
'fn': '_.flattenDeep(nestedObjects)',
'teardown': 'function flatten(){}'
})
);
/*--------------------------------------------------------------------------*/
suites.push(
Benchmark.Suite('`_.flowRight`')
.add(buildName, {
'fn': 'lodash.flowRight(compAddThree, compAddTwo, compAddOne)',
'teardown': 'function flowRight(){}'
})
.add(otherName, {
'fn': '_.flowRight(compAddThree, compAddTwo, compAddOne)',
'teardown': 'function flowRight(){}'
})
);
suites.push(
Benchmark.Suite('composed call')
.add(buildName, {
'fn': 'lodashComposed(0)',
'teardown': 'function flowRight(){}'
})
.add(otherName, {
'fn': '_composed(0)',
'teardown': 'function flowRight(){}'
})
);
/*--------------------------------------------------------------------------*/
suites.push(
Benchmark.Suite('`_.functions`')
.add(buildName, '\
@@ -1086,73 +1050,37 @@
suites.push(
Benchmark.Suite('`_.includes` searching an array')
.add(buildName, '\
lodash.include(numbers, limit - 1)'
lodash.includes(numbers, limit - 1)'
)
.add(otherName, '\
_.include(numbers, limit - 1)'
_.includes(numbers, limit - 1)'
)
);
suites.push(
Benchmark.Suite('`_.includes` searching an object')
.add(buildName, '\
lodash.include(object, limit - 1)'
lodash.includes(object, limit - 1)'
)
.add(otherName, '\
_.include(object, limit - 1)'
_.includes(object, limit - 1)'
)
);
if (lodash.include('ab', 'ab') && _.include('ab', 'ab')) {
if (lodash.includes('ab', 'ab') && _.includes('ab', 'ab')) {
suites.push(
Benchmark.Suite('`_.includes` searching a string')
.add(buildName, '\
lodash.include(strNumbers, "," + (limit - 1))'
lodash.includes(strNumbers, "," + (limit - 1))'
)
.add(otherName, '\
_.include(strNumbers, "," + (limit - 1))'
_.includes(strNumbers, "," + (limit - 1))'
)
);
}
/*--------------------------------------------------------------------------*/
suites.push(
Benchmark.Suite('`_.indexBy` with `callback` iterating an array')
.add(buildName, '\
lodash.indexBy(numbers, function(num) { return num >> 1; })'
)
.add(otherName, '\
_.indexBy(numbers, function(num) { return num >> 1; })'
)
);
suites.push(
Benchmark.Suite('`_.indexBy` with `property` name iterating an array')
.add(buildName, {
'fn': 'lodash.indexBy(words, "length")',
'teardown': 'function countBy(){}'
})
.add(otherName, {
'fn': '_.indexBy(words, "length")',
'teardown': 'function countBy(){}'
})
);
suites.push(
Benchmark.Suite('`_.indexBy` with `callback` iterating an object')
.add(buildName, {
'fn': 'lodash.indexBy(wordToNumber, function(num) { return num >> 1; })',
'teardown': 'function countBy(){}'
})
.add(otherName, {
'fn': '_.indexBy(wordToNumber, function(num) { return num >> 1; })',
'teardown': 'function countBy(){}'
})
);
/*--------------------------------------------------------------------------*/
suites.push(
Benchmark.Suite('`_.indexOf`')
.add(buildName, {
@@ -1165,18 +1093,6 @@
})
);
suites.push(
Benchmark.Suite('`_.indexOf` performing a binary search')
.add(buildName, {
'fn': 'lodash.indexOf(hundredSortedValues, 99, true)',
'teardown': 'function multiArrays(){}'
})
.add(otherName, {
'fn': '_.indexOf(hundredSortedValues, 99, true)',
'teardown': 'function multiArrays(){}'
})
);
/*--------------------------------------------------------------------------*/
suites.push(
@@ -1216,42 +1132,42 @@
/*--------------------------------------------------------------------------*/
suites.push(
Benchmark.Suite('`_.invoke` iterating an array')
Benchmark.Suite('`_.invokeMap` iterating an array')
.add(buildName, '\
lodash.invoke(numbers, "toFixed")'
lodash.invokeMap(numbers, "toFixed")'
)
.add(otherName, '\
_.invoke(numbers, "toFixed")'
_.invokeMap(numbers, "toFixed")'
)
);
suites.push(
Benchmark.Suite('`_.invoke` with arguments iterating an array')
Benchmark.Suite('`_.invokeMap` with arguments iterating an array')
.add(buildName, '\
lodash.invoke(numbers, "toFixed", 1)'
lodash.invokeMap(numbers, "toFixed", 1)'
)
.add(otherName, '\
_.invoke(numbers, "toFixed", 1)'
_.invokeMap(numbers, "toFixed", 1)'
)
);
suites.push(
Benchmark.Suite('`_.invoke` with a function for `path` iterating an array')
Benchmark.Suite('`_.invokeMap` with a function for `path` iterating an array')
.add(buildName, '\
lodash.invoke(numbers, Number.prototype.toFixed, 1)'
lodash.invokeMap(numbers, Number.prototype.toFixed, 1)'
)
.add(otherName, '\
_.invoke(numbers, Number.prototype.toFixed, 1)'
_.invokeMap(numbers, Number.prototype.toFixed, 1)'
)
);
suites.push(
Benchmark.Suite('`_.invoke` iterating an object')
Benchmark.Suite('`_.invokeMap` iterating an object')
.add(buildName, '\
lodash.invoke(object, "toFixed", 1)'
lodash.invokeMap(object, "toFixed", 1)'
)
.add(otherName, '\
_.invoke(object, "toFixed", 1)'
_.invokeMap(object, "toFixed", 1)'
)
);
@@ -1413,18 +1329,6 @@
})
);
suites.push(
Benchmark.Suite('`_.lastIndexOf` performing a binary search')
.add(buildName, {
'fn': 'lodash.lastIndexOf(hundredSortedValues, 0, true)',
'teardown': 'function multiArrays(){}'
})
.add(otherName, {
'fn': '_.lastIndexOf(hundredSortedValues, 0, true)',
'teardown': 'function multiArrays(){}'
})
);
/*--------------------------------------------------------------------------*/
suites.push(
@@ -1441,20 +1345,6 @@
)
);
suites.push(
Benchmark.Suite('`_.map` with `thisArg` iterating an array (slow path)')
.add(buildName, '\
lodash.map(objects, function(value, index) {\
return this["key" + index] + value.num;\
}, object)'
)
.add(otherName, '\
_.map(objects, function(value, index) {\
return this["key" + index] + value.num;\
}, object)'
)
);
suites.push(
Benchmark.Suite('`_.map` iterating an object')
.add(buildName, '\
@@ -1469,6 +1359,16 @@
)
);
suites.push(
Benchmark.Suite('`_.map` with `_.property` shorthand')
.add(buildName, '\
lodash.map(objects, "num")'
)
.add(otherName, '\
_.map(objects, "num")'
)
);
/*--------------------------------------------------------------------------*/
suites.push(
@@ -1519,18 +1419,6 @@
/*--------------------------------------------------------------------------*/
suites.push(
Benchmark.Suite('`_.pairs`')
.add(buildName, '\
lodash.pairs(object)'
)
.add(otherName, '\
_.pairs(object)'
)
);
/*--------------------------------------------------------------------------*/
suites.push(
Benchmark.Suite('`_.partial` (slow path)')
.add(buildName, {
@@ -1571,20 +1459,6 @@
)
);
suites.push(
Benchmark.Suite('`_.partition` iterating an array with `thisArg` (slow path)')
.add(buildName, '\
lodash.partition(numbers, function(num, index) {\
return this["key" + index] % 2;\
}, object)'
)
.add(otherName, '\
_.partition(numbers, function(num, index) {\
return this["key" + index] % 2;\
}, object)'
)
);
suites.push(
Benchmark.Suite('`_.partition` iterating an object')
.add(buildName, '\
@@ -1613,18 +1487,6 @@
/*--------------------------------------------------------------------------*/
suites.push(
Benchmark.Suite('`_.pluck`')
.add(buildName, '\
lodash.pluck(objects, "num")'
)
.add(otherName, '\
_.pluck(objects, "num")'
)
);
/*--------------------------------------------------------------------------*/
suites.push(
Benchmark.Suite('`_.reduce` iterating an array')
.add(buildName, '\
@@ -1707,20 +1569,6 @@
)
);
suites.push(
Benchmark.Suite('`_.reject` iterating an array with `thisArg` (slow path)')
.add(buildName, '\
lodash.reject(numbers, function(num, index) {\
return this["key" + index] % 2;\
}, object)'
)
.add(otherName, '\
_.reject(numbers, function(num, index) {\
return this["key" + index] % 2;\
}, object)'
)
);
suites.push(
Benchmark.Suite('`_.reject` iterating an object')
.add(buildName, '\
@@ -1738,12 +1586,12 @@
/*--------------------------------------------------------------------------*/
suites.push(
Benchmark.Suite('`_.sample` with an `n`')
Benchmark.Suite('`_.sampleSize`')
.add(buildName, '\
lodash.sample(numbers, limit / 2)'
lodash.sampleSize(numbers, limit / 2)'
)
.add(otherName, '\
_.sample(numbers, limit / 2)'
_.sampleSize(numbers, limit / 2)'
)
);
@@ -1787,20 +1635,6 @@
)
);
suites.push(
Benchmark.Suite('`_.some` with `thisArg` iterating an array (slow path)')
.add(buildName, '\
lodash.some(objects, function(value, index) {\
return this["key" + index] == (limit - 1);\
}, object)'
)
.add(otherName, '\
_.some(objects, function(value, index) {\
return this["key" + index] == (limit - 1);\
}, object)'
)
);
suites.push(
Benchmark.Suite('`_.some` iterating an object')
.add(buildName, '\
@@ -1827,16 +1661,6 @@
)
);
suites.push(
Benchmark.Suite('`_.sortBy` with `callback` and `thisArg` (slow path)')
.add(buildName, '\
lodash.sortBy(numbers, function(num) { return this.sin(num); }, Math)'
)
.add(otherName, '\
_.sortBy(numbers, function(num) { return this.sin(num); }, Math)'
)
);
suites.push(
Benchmark.Suite('`_.sortBy` with `property` name')
.add(buildName, {
@@ -1861,18 +1685,20 @@
)
);
/*--------------------------------------------------------------------------*/
suites.push(
Benchmark.Suite('`_.sortedIndex` with `callback`')
Benchmark.Suite('`_.sortedIndexBy`')
.add(buildName, {
'fn': '\
lodash.sortedIndex(words, "twenty-five", function(value) {\
lodash.sortedIndexBy(words, "twenty-five", function(value) {\
return wordToNumber[value];\
})',
'teardown': 'function countBy(){}'
})
.add(otherName, {
'fn': '\
_.sortedIndex(words, "twenty-five", function(value) {\
_.sortedIndexBy(words, "twenty-five", function(value) {\
return wordToNumber[value];\
})',
'teardown': 'function countBy(){}'
@@ -1881,6 +1707,34 @@
/*--------------------------------------------------------------------------*/
suites.push(
Benchmark.Suite('`_.sortedIndexOf`')
.add(buildName, {
'fn': 'lodash.sortedIndexOf(hundredSortedValues, 99)',
'teardown': 'function multiArrays(){}'
})
.add(otherName, {
'fn': '_.sortedIndexOf(hundredSortedValues, 99)',
'teardown': 'function multiArrays(){}'
})
);
/*--------------------------------------------------------------------------*/
suites.push(
Benchmark.Suite('`_.sortedLastIndexOf`')
.add(buildName, {
'fn': 'lodash.sortedLastIndexOf(hundredSortedValues, 0)',
'teardown': 'function multiArrays(){}'
})
.add(otherName, {
'fn': '_.sortedLastIndexOf(hundredSortedValues, 0)',
'teardown': 'function multiArrays(){}'
})
);
/*--------------------------------------------------------------------------*/
suites.push(
Benchmark.Suite('`_.sum`')
.add(buildName, '\
@@ -1943,18 +1797,6 @@
)
);
suites.push(
Benchmark.Suite('`_.times` with `thisArg` (slow path)')
.add(buildName, '\
var result = [];\
lodash.times(limit, function(n) { result.push(this.sin(n)); }, Math)'
)
.add(otherName, '\
var result = [];\
_.times(limit, function(n) { result.push(this.sin(n)); }, Math)'
)
);
/*--------------------------------------------------------------------------*/
suites.push(
@@ -1979,6 +1821,18 @@
/*--------------------------------------------------------------------------*/
suites.push(
Benchmark.Suite('`_.toPairs`')
.add(buildName, '\
lodash.toPairs(object)'
)
.add(otherName, '\
_.toPairs(object)'
)
);
/*--------------------------------------------------------------------------*/
suites.push(
Benchmark.Suite('`_.unescape` string without html entities')
.add(buildName, '\
@@ -2035,20 +1889,6 @@
)
);
suites.push(
Benchmark.Suite('`_.uniq` with `callback`')
.add(buildName, '\
lodash.uniq(numbers.concat(twoNumbers, fourNumbers), function(num) {\
return num % 2;\
})'
)
.add(otherName, '\
_.uniq(numbers.concat(twoNumbers, fourNumbers), function(num) {\
return num % 2;\
})'
)
);
suites.push(
Benchmark.Suite('`_.uniq` iterating an array of 200 elements')
.add(buildName, {
@@ -2063,6 +1903,22 @@
/*--------------------------------------------------------------------------*/
suites.push(
Benchmark.Suite('`_.uniqBy`')
.add(buildName, '\
lodash.uniqBy(numbers.concat(twoNumbers, fourNumbers), function(num) {\
return num % 2;\
})'
)
.add(otherName, '\
_.uniqBy(numbers.concat(twoNumbers, fourNumbers), function(num) {\
return num % 2;\
})'
)
);
/*--------------------------------------------------------------------------*/
suites.push(
Benchmark.Suite('`_.values`')
.add(buildName, '\
@@ -2075,20 +1931,6 @@
/*--------------------------------------------------------------------------*/
suites.push(
Benchmark.Suite('`_.where`')
.add(buildName, {
'fn': 'lodash.where(objects, source)',
'teardown': 'function matches(){}'
})
.add(otherName, {
'fn': '_.where(objects, source)',
'teardown': 'function matches(){}'
})
);
/*--------------------------------------------------------------------------*/
suites.push(
Benchmark.Suite('`_.without`')
.add(buildName, '\

View File

@@ -1,14 +0,0 @@
cd "$(dirname "$0")"
echo "Running performance suite in node..."
node perf.js ../lodash.js && node perf.js ../lodash.min.js
for cmd in rhino "rhino -require" narwhal ringo phantomjs; do
echo ""
echo "Running performance suite in $cmd..."
$cmd perf.js ../lodash.src.js
done
echo ""
echo "Running performance suite in a browser..."
open index.html

View File

@@ -1,157 +0,0 @@
;(function() {
/** Used to determine if values are of the language type Object. */
var objectTypes = {
'function': true,
'object': true
};
/** Used as the `Set#toString` return value. */
var nativeString = String(Object.prototype.toString).replace(/toString/g, 'Set');
/** Detect free variable `exports`. */
var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports;
/** Detect free variable `module`. */
var freeModule = objectTypes[typeof module] && module && !module.nodeType && module;
/** Detect free variable `global` from Node.js. */
var freeGlobal = freeExports && freeModule && typeof global == 'object' && global;
/** Detect free variable `self`. */
var freeSelf = objectTypes[typeof self] && self && self.Object && self;
/** Detect free variable `window`. */
var freeWindow = objectTypes[typeof window] && window && window.Object && window;
/**
* Used as a reference to the global object.
*
* The `this` value is used if it is the global object to avoid Greasemonkey's
* restricted `window` object, otherwise the `window` object is used.
*/
var root = freeGlobal || ((freeWindow !== (this && this.window)) && freeWindow) || freeSelf || this;
/*--------------------------------------------------------------------------*/
/**
* Installs `Set` on the given `context` object.
*
* @memberOf exports
* @param {Object} context The context object.
*/
function runInContext(context) {
/**
* Creates a `Set` object.
*/
function Set() {
this.__cache__ = {};
}
/**
* Gets the index at which the first occurrence of `value` is found using
* strict equality for comparisons, i.e. `===`.
*
* @private
* @param {Array} array The array to search.
* @param {*} value The value to search for.
* @returns {number} Returns the index of the matched value or `-1`.
*/
function indexOf(array, value) {
var index = -1,
length = array.length;
while (++index < length) {
if (array[index] === value) {
return index;
}
}
return -1;
}
/**
* Checks if `value` is in the set.
*
* @memberOf Set
* @param {*} value The value to search for.
* @returns {boolean} Returns `true` if `value` is found, else `false`.
*/
function has(value) {
var type = typeof value,
cache = this.__cache__;
if (type == 'boolean' || value == null) {
return cache[value] || false;
}
if (type != 'number' && type != 'string') {
type = 'object';
}
var key = type == 'number' ? value : '_' + value;
cache = (cache = cache[type]) && cache[key];
return type == 'object'
? (cache && indexOf(cache, value) > -1 ? true : false)
: (cache || false);
}
/**
* Adds `value` to the set.
*
* @memberOf Set
* @param {*} value The value to add.
*/
function add(value) {
var cache = this.__cache__,
type = typeof value;
if (type == 'boolean' || value == null) {
cache[value] = true;
} else {
if (type != 'number' && type != 'string') {
type = 'object';
}
var key = type == 'number' ? value : '_' + value,
typeCache = cache[type] || (cache[type] = {});
if (type == 'object') {
var array = typeCache[key];
if (array) {
array.push(value);
} else {
typeCache[key] = [value];
}
} else {
typeCache[key] = true;
}
}
}
/**
* Produces the `toString` result of `Set`.
*
* @static
* @memberOf Set
* @returns {string} Returns the string result.
*/
function toString() {
return nativeString;
}
Set.toString = toString;
Set.prototype.add = add;
Set.prototype.has = has;
if (!root.Set) {
context.Set = Set;
}
}
/*--------------------------------------------------------------------------*/
if (freeExports) {
freeExports.runInContext = runInContext;
} else {
runInContext(root);
}
}.call(this));

View File

@@ -64,12 +64,10 @@
buildList.selectedIndex = (function() {
switch (build) {
case 'lodash-compat': return 1;
case 'lodash-modern-dev': return 2;
case 'lodash-modern': return 3;
case 'lodash-custom-dev': return 4;
case 'lodash-custom': return 5;
case 'lodash-compat-dev':
case 'lodash': return 1;
case 'lodash-core-dev': return 2;
case 'lodash-core': return 3;
case 'lodash-dev':
case null: return 0;
}
return -1;
@@ -95,12 +93,10 @@
span1.innerHTML =
'<label for="qunit-build">Build: </label>' +
'<select id="qunit-build">' +
'<option value="lodash-compat-dev">lodash (compat development)</option>' +
'<option value="lodash-compat">lodash (compat production)</option>' +
'<option value="lodash-modern-dev">lodash (modern development)</option>' +
'<option value="lodash-modern">lodash (modern production)</option>' +
'<option value="lodash-custom-dev">lodash (custom development)</option>' +
'<option value="lodash-custom">lodash (custom production)</option>' +
'<option value="lodash-dev">lodash (development)</option>' +
'<option value="lodash">lodash (production)</option>' +
'<option value="lodash-core-dev">lodash-core (development)</option>' +
'<option value="lodash-core">lodash-core (production)</option>' +
'</select>';
var span2 = document.createElement('span');
@@ -124,29 +120,15 @@
init();
});
// Used to indicate testing a foreign file.
ui.isForeign = RegExp('^(\\w+:)?//').test(build);
// Used to indicate testing a modularized build.
ui.isModularize = /\b(?:amd|commonjs|es6?|node|npm|(index|main)\.js)\b/.test([location.pathname, location.search]);
// Used to indicate testing in Sauce Labs' automated test cloud.
ui.isSauceLabs = location.port == '9001';
// Used to indicate that lodash is in strict mode.
ui.isStrict = /\bes6?\b/.test([location.pathname, location.search]);
// The lodash build file path.
ui.buildPath = (function() {
var result;
switch (build) {
case 'lodash-compat': result = 'lodash.compat.min.js'; break;
case 'lodash-modern-dev': result = 'lodash.js'; break;
case 'lodash-modern': result = 'lodash.min.js'; break;
case 'lodash-custom-dev': result = 'lodash.custom.js'; break;
case 'lodash-custom': result = 'lodash.custom.min.js'; break;
case null: build = 'lodash-compat-dev';
case 'lodash-compat-dev': result = 'lodash.src.js'; break;
case 'lodash': result = 'dist/lodash.min.js'; break;
case 'lodash-core-dev': result = 'dist/lodash.core.js'; break;
case 'lodash-core': result = 'dist/lodash.core.min.js'; break;
case null: build = 'lodash-dev';
case 'lodash-dev': result = 'lodash.js'; break;
default: return build;
}
return basePath + result;
@@ -165,6 +147,21 @@
return basePath + result;
}());
// Used to indicate testing a core build.
ui.isCore = /\bcore(\.min)?\.js\b/.test(ui.buildPath);
// Used to indicate testing a foreign file.
ui.isForeign = RegExp('^(\\w+:)?//').test(build);
// Used to indicate testing a modularized build.
ui.isModularize = /\b(?:amd|commonjs|es6?|node|npm|(index|main)\.js)\b/.test([location.pathname, location.search]);
// Used to indicate testing in Sauce Labs' automated test cloud.
ui.isSauceLabs = location.port == '9001';
// Used to indicate that lodash is in strict mode.
ui.isStrict = /\bes6?\b/.test([location.pathname, location.search]);
ui.urlParams = { 'build': build, 'loader': loader };
ui.timing = { 'loadEventEnd': 0 };

View File

@@ -1,102 +0,0 @@
;(function() {
/** Used to determine if values are of the language type Object. */
var objectTypes = {
'function': true,
'object': true
};
/** Used as the `WeakMap#toString` return value. */
var nativeString = String(Object.prototype.toString).replace(/toString/g, 'WeakMap');
/** Detect free variable `exports`. */
var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports;
/** Detect free variable `module`. */
var freeModule = objectTypes[typeof module] && module && !module.nodeType && module;
/** Detect free variable `global` from Node.js. */
var freeGlobal = freeExports && freeModule && typeof global == 'object' && global;
/** Detect free variable `self`. */
var freeSelf = objectTypes[typeof self] && self && self.Object && self;
/** Detect free variable `window`. */
var freeWindow = objectTypes[typeof window] && window && window.Object && window;
/**
* Used as a reference to the global object.
*
* The `this` value is used if it is the global object to avoid Greasemonkey's
* restricted `window` object, otherwise the `window` object is used.
*/
var root = freeGlobal || ((freeWindow !== (this && this.window)) && freeWindow) || freeSelf || this;
/*--------------------------------------------------------------------------*/
/**
* Installs `WeakMap` on the given `context` object.
*
* @memberOf exports
* @param {Object} context The context object.
*/
function runInContext(context) {
/**
* Creates a `WeakMap` object.
*/
function WeakMap() {
// No operation performed.
}
/**
* Gets the value associated with the given key.
*
* @memberOf WeakMap
* @param {Object} key The key object.
* @returns {*} Returns the associated value, else `undefined`.
*/
function get(key) {
return key.__weakmap__;
}
/**
* Sets a value for the given key.
*
* @memberOf WeakMap
* @param {Object} key The key object.
* @param {*} value The value to set.
*/
function set(key, value) {
key.__weakmap__ = value;
return this;
}
/**
* Produces the `toString` result of `WeakMap`.
*
* @static
* @memberOf WeakMap
* @returns {string} Returns the string result.
*/
function toString() {
return nativeString;
}
WeakMap.toString = toString;
WeakMap.prototype.get = get;
WeakMap.prototype.set = set;
if (!root.WeakMap) {
context.WeakMap = WeakMap;
}
}
/*--------------------------------------------------------------------------*/
if (freeExports) {
freeExports.runInContext = runInContext;
} else {
runInContext(root);
}
}.call(this));

View File

@@ -4,7 +4,7 @@ addEventListener('message', function(e) {
if (e.data) {
try {
importScripts('../' + e.data);
} catch(e) {
} catch (e) {
self._ = { 'VERSION': e.message };
}
postMessage(_.VERSION);

View File

@@ -22,27 +22,67 @@
<script src="../vendor/json-js/json2.js"></script>
<script src="../node_modules/platform/platform.js"></script>
<script src="./asset/test-ui.js"></script>
<script src="../lodash.src.js"></script>
<script src="../lodash.js"></script>
<script>
QUnit.config.asyncRetries = 10;
QUnit.config.hidepassed = true;
var mixinPrereqs = (function() {
var aliasToReal = {
'indexBy': 'keyBy',
'invoke': 'invokeMap'
};
var keyMap = {
'rest': 'tail'
};
var lodash = _.noConflict();
return function(_) {
_.mixin({
'debounce': _.debounce || lodash.debounce,
'defer': _.defer || lodash.defer,
'pluck': _.pluck || lodash.pluck
lodash.defaultsDeep(_, { 'templateSettings': lodash.templateSettings });
lodash.mixin(_, lodash.pick(lodash, lodash.difference([
'countBy',
'debounce',
'difference',
'find',
'findIndex',
'findLastIndex',
'groupBy',
'includes',
'invert',
'invokeMap',
'keyBy',
'omit',
'partition',
'reduceRight',
'reject',
'sample',
'without'
], lodash.functions(_))));
lodash.forOwn(keyMap, function(realName, otherName) {
_[otherName] = lodash[realName];
_.prototype[otherName] = lodash.prototype[realName];
});
lodash.forOwn(aliasToReal, function(realName, alias) {
_[alias] = _[realName];
_.prototype[alias] = _.prototype[realName];
});
};
}());
QUnit.config.asyncRetries = 10;
QUnit.config.hidepassed = true;
// Load test scripts.
document.write(ui.urlParams.loader != 'none'
? '<script data-dojo-config="async:1" src="' + ui.loaderPath + '"><\/script>'
: ([
'<script src="' + ui.buildPath + '"><\/script>',
// Load prerequisite scripts.
document.write(ui.urlParams.loader == 'none'
? '<script src="' + ui.buildPath + '"><\/script>'
: '<script data-dojo-config="async:1" src="' + ui.loaderPath + '"><\/script>'
);
</script>
<script>
if (ui.urlParams.loader == 'none') {
mixinPrereqs(_);
document.write([
'<script src="../node_modules/jquery/dist/jquery.js"><\/script>',
'<script src="../vendor/backbone/backbone.js"><\/script>',
'<script src="../vendor/backbone/test/setup/dom-setup.js"><\/script>',
@@ -54,8 +94,8 @@
'<script src="../vendor/backbone/test/router.js"><\/script>',
'<script src="../vendor/backbone/test/view.js"><\/script>',
'<script src="../vendor/backbone/test/sync.js"><\/script>'
].join('\n'))
);
].join('\n'));
}
</script>
<script>
(function() {
@@ -63,7 +103,6 @@
curl.config({ 'apiName': 'require' });
}
if (!window.require) {
mixinPrereqs(_);
return;
}
var reBasename = /[\w.-]+$/,
@@ -107,24 +146,22 @@
QUnit.config.autostart = false;
require(getConfig(), ['underscore', 'backbone'], function(lodash) {
require(getConfig(), ['underscore'], function(lodash) {
mixinPrereqs(lodash);
if (ui.isModularize) {
window._ = lodash;
}
require(getConfig(), [
'test/setup/dom-setup',
'test/setup/environment',
'test/noconflict',
'test/events',
'test/model',
'test/collection',
'test/router',
'test/view',
'test/sync'
], function() {
QUnit.start();
require(getConfig(), ['backbone'], function() {
require(getConfig(), [
'test/setup/dom-setup',
'test/setup/environment',
'test/noconflict',
'test/events',
'test/model',
'test/collection',
'test/router',
'test/view',
'test/sync'
], function() {
QUnit.start();
});
});
});
}());

41
test/fp.html Normal file
View File

@@ -0,0 +1,41 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>lodash-fp Test Suite</title>
<link rel="stylesheet" href="../node_modules/qunitjs/qunit/qunit.css">
</head>
<body>
<script>
// Avoid reporting tests to Sauce Labs when script errors occur.
if (location.port == '9001') {
window.onerror = function(message) {
if (window.QUnit) {
QUnit.config.done.length = 0;
}
global_test_results = { 'message': message };
};
}
</script>
<script src="../lodash.js"></script>
<script src="../dist/lodash.fp.js"></script>
<script src="../dist/mapping.fp.js"></script>
<script src="../node_modules/qunitjs/qunit/qunit.js"></script>
<script src="../node_modules/qunit-extras/qunit-extras.js"></script>
<script src="../node_modules/platform/platform.js"></script>
<script src="./test-fp.js"></script>
<div id="qunit"></div>
<script>
// Set a more readable browser name.
window.onload = function() {
var timeoutId = setInterval(function() {
var ua = document.getElementById('qunit-userAgent');
if (ua) {
ua.innerHTML = platform;
clearInterval(timeoutId);
}
}, 16);
};
</script>
</body>
</html>

View File

@@ -5,7 +5,7 @@
<title>lodash Test Suite</title>
<link rel="stylesheet" href="../node_modules/qunitjs/qunit/qunit.css">
<style>
#exports {
#exports, #module {
display: none;
}
</style>
@@ -22,35 +22,33 @@
};
}
</script>
<script src="../node_modules/lodash/index.js"></script>
<script>var lodashStable = _.noConflict();</script>
<script src="../node_modules/qunitjs/qunit/qunit.js"></script>
<script src="../node_modules/qunit-extras/qunit-extras.js"></script>
<script src="../node_modules/platform/platform.js"></script>
<script src="./asset/set.js"></script>
<script src="./asset/weakmap.js"></script>
<script src="./asset/test-ui.js"></script>
<div id="qunit"></div>
<div id="exports"></div>
<div id="module"></div>
<script>
var setProperty = (function() {
var _defineProperty = Object.defineProperty;
return function(object, key, value) {
try {
_defineProperty(object, key, {
'configurable': true,
'enumerable': false,
'writable': true,
'value': value
});
} catch(e) {
object[key] = value;
}
};
}());
function setProperty(object, key, value) {
try {
Object.defineProperty(object, key, {
'configurable': true,
'enumerable': false,
'writable': true,
'value': value
});
} catch (e) {
object[key] = value;
}
return object;
}
function addBizarroMethods() {
var funcProto = Function.prototype,
objectProto = Object.prototype,
stringProto = String.prototype;
objectProto = Object.prototype;
var hasOwnProperty = objectProto.hasOwnProperty,
fnToString = funcProto.toString,
@@ -64,9 +62,11 @@
return value;
};
}
function createToString(funcName) {
return constant(nativeString.replace(reToString, funcName));
}
// Allow bypassing native checks.
setProperty(funcProto, 'toString', (function() {
function wrapper() {
@@ -82,29 +82,39 @@
funcProto._method = noop;
// Set bad shims.
setProperty(Array, '_isArray', Array.isArray);
setProperty(Array, 'isArray', noop);
setProperty(Date, '_now', Date.now);
setProperty(Date, 'now', noop);
setProperty(Object, '_keys', Object.keys);
setProperty(Object, 'keys', noop);
setProperty(objectProto, '_propertyIsEnumerable', propertyIsEnumerable);
setProperty(objectProto, 'propertyIsEnumerable', function(key) {
if (key == '1' && this && typeof this == 'object' &&
hasOwnProperty.call(this, 'callee') &&
!propertyIsEnumerable.call(this, 'callee') &&
this.length === 2 && this[0] === 1 && this[1] === 0) {
throw new Error;
}
return propertyIsEnumerable.call(this, key);
return !(key == 'valueOf' && this && this.valueOf === 1) && _propertyIsEnumerable.call(this, key);
});
setProperty(window, '_Map', window.Map);
if (_Map) {
setProperty(window, 'Map', (function(Map) {
var count = 0;
return function() {
if (count++) {
return new Map;
}
var result = {};
setProperty(window, 'Map', Map);
return result;
};
}(_Map)));
setProperty(Map, 'toString', createToString('Map'));
}
setProperty(Object, '_create', Object.create);
setProperty(Object, 'create', noop);
setProperty(Object, '_getOwnPropertySymbols', Object.getOwnPropertySymbols);
setProperty(Object, 'getOwnPropertySymbols', undefined);
setProperty(window, '_Set', window.Set);
setProperty(window, 'Set', noop);
setProperty(window, '_Symbol', window.Symbol);
setProperty(window, 'Symbol', undefined);
setProperty(window, '_WeakMap', window.WeakMap);
setProperty(window, 'WeakMap', noop);
@@ -119,47 +129,53 @@
function removeBizarroMethods() {
var funcProto = Function.prototype,
objectProto = Object.prototype,
stringProto = String.prototype;
objectProto = Object.prototype;
if (Array._isArray) {
setProperty(Array, 'isArray', Array._isArray);
if (Object._create) {
Object.create = Object._create;
} else {
delete Array.isArray;
delete Object.create;
}
if (Date._now) {
setProperty(Date, 'now', Date._now);
if (Object._getOwnPropertySymbols) {
Object.getOwnPropertySymbols = Object._getOwnPropertySymbols;
} else {
delete Date.now;
delete Object.getOwnPropertySymbols;
}
if (Object._keys) {
setProperty(Object, 'keys', Object._keys);
if (_Map) {
Map = _Map;
} else {
delete Object.keys;
setProperty(window, 'Map', undefined);
}
if (window._Set) {
if (_Set) {
Set = _Set;
} else {
setProperty(window, 'Set', undefined);
}
setProperty(window, '_Set', undefined);
if (window._WeakMap) {
if (_Symbol) {
Symbol = _Symbol;
}
if (_WeakMap) {
WeakMap = _WeakMap;
} else {
setProperty(window, 'WeakMap', undefined);
}
setProperty(objectProto, 'propertyIsEnumerable', objectProto._propertyIsEnumerable);
setProperty(window, '_Map', undefined);
setProperty(window, '_Set', undefined);
setProperty(window, '_Symbol', undefined);
setProperty(window, '_WeakMap', undefined);
setProperty(window, 'WinRTError', undefined);
setProperty(window, 'exports', undefined);
setProperty(window, 'exports', document.getElementById('exports'));
setProperty(window, 'global', undefined);
setProperty(window, 'module', undefined);
setProperty(window, 'module', document.getElementById('module'));
setProperty(objectProto, 'propertyIsEnumerable', objectProto._propertyIsEnumerable);
delete Array._isArray;
delete Date._now;
delete Object._keys;
delete funcProto._method;
delete objectProto._propertyIsEnumerable;
delete Object._create;
delete Object._getOwnPropertySymbols;
}
// Load lodash to expose it to the bad extensions/shims.
@@ -266,20 +282,17 @@
underscoreModule = underscore.result(underscore, 'noConflict') || underscore;
underscoreModule.moduleName = 'underscore';
}
if (ui.isModularize) {
window._ = lodash;
}
window._ = lodash;
if (ui.isModularize) {
require(getConfig(), [
'lodash/internal/baseEach',
'lodash/internal/isIndex',
'lodash/internal/isIterateeCall',
'lodash/internal/isLength'
], function(baseEach, isIndex, isIterateeCall, isLength) {
'lodash/internal/isIterateeCall'
], function(baseEach, isIndex, isIterateeCall) {
lodash._baseEach = baseEach;
lodash._isIndex = isIndex;
lodash._isIterateeCall = isIterateeCall;
lodash._isLength = isLength;
loadTests();
});
} else {

27
test/remove.js Normal file
View File

@@ -0,0 +1,27 @@
#!/usr/bin/env node
'use strict';
var fs = require('fs'),
path = require('path');
var args = (args = process.argv)
.slice((args[0] === process.execPath || args[0] === 'node') ? 2 : 0);
var filePath = path.resolve(args[1]),
reLine = /.*/gm,
slice = Array.prototype.slice;
var pattern = (function() {
var result = args[0],
delimiter = result.charAt(0),
lastIndex = result.lastIndexOf(delimiter);
return RegExp(result.slice(1, lastIndex), result.slice(lastIndex + 1));
}());
/*----------------------------------------------------------------------------*/
fs.writeFileSync(filePath, fs.readFileSync(filePath, 'utf8').replace(pattern, function(match) {
var snippet = slice.call(arguments, -3, -1)[0];
return match.replace(snippet, snippet.replace(reLine, ''));
}));

View File

@@ -1,14 +0,0 @@
cd "$(dirname "$0")"
echo "Testing in node..."
node test.js ../lodash.src.js
for cmd in rhino "rhino -require" ringo phantomjs; do
echo ""
echo "Testing in $cmd..."
$cmd test.js ../lodash.src.js
done
echo ""
echo "Testing in a browser..."
open index.html

View File

@@ -17,7 +17,7 @@ var EventEmitter = require('events').EventEmitter,
util = require('util');
/** Load other modules. */
var _ = require('../lodash.src.js'),
var _ = require('../lodash.js'),
chalk = require('chalk'),
ecstatic = require('ecstatic'),
request = require('request'),
@@ -102,26 +102,18 @@ var browserNameMap = {
/** List of platforms to load the runner on. */
var platforms = [
['Linux', 'android', '5.0'],
['Linux', 'android', '4.4'],
['Linux', 'android', '4.0'],
['Windows 8.1', 'firefox', '38'],
['Windows 8.1', 'firefox', '37'],
['Windows 8.1', 'firefox', '20'],
['Windows 8.1', 'chrome', '43'],
['Windows 8.1', 'chrome', '42'],
['Windows 8.1', 'internet explorer', '11'],
['Linux', 'android', '5.1'],
['Windows 10', 'chrome', '47'],
['Windows 10', 'chrome', '46'],
['Windows 10', 'firefox', '43'],
['Windows 10', 'firefox', '42'],
['Windows 10', 'microsoftedge', '20.10240'],
['Windows 10', 'internet explorer', '11'],
['Windows 8', 'internet explorer', '10'],
['Windows 7', 'internet explorer', '9'],
['Windows 7', 'internet explorer', '8'],
['Windows XP', 'internet explorer', '7'],
['Windows XP', 'internet explorer', '6'],
['OS X 10.9', 'ipad', '8.1'],
['OS X 10.6', 'ipad', '4'],
['OS X 10.10', 'safari', '8'],
['OS X 10.9', 'safari', '7'],
['OS X 10.8', 'safari', '6'],
['OS X 10.6', 'safari', '5']
// ['OS X 10.10', 'ipad', '9.1'],
['OS X 10.11', 'safari', '9'],
['OS X 10.10', 'safari', '8']
];
/** Used to tailor the `platforms` array. */
@@ -132,7 +124,7 @@ var isAMD = _.includes(tags, 'amd'),
// The platforms to test IE compatibility modes.
if (compatMode) {
platforms = [
['Windows 8.1', 'internet explorer', '11'],
['Windows 10', 'internet explorer', '11'],
['Windows 8', 'internet explorer', '10'],
['Windows 7', 'internet explorer', '9'],
['Windows 7', 'internet explorer', '8']
@@ -276,7 +268,7 @@ function isJobId(value) {
*/
function logInline(text) {
var blankLine = _.repeat(' ', _.size(prevLine));
prevLine = text = _.trunc(text, 40);
prevLine = text = _.truncate(text, { 'length': 40 });
process.stdout.write(text + blankLine.slice(text.length) + '\r');
}
@@ -298,7 +290,7 @@ function logThrobber() {
* @returns {Array} Returns the new converted array.
*/
function optionToArray(name, string) {
return _.compact(_.invoke((optionToValue(name, string) || '').split(/, */), 'trim'));
return _.compact(_.invokeMap((optionToValue(name, string) || '').split(/, */), 'trim'));
}
/**
@@ -560,7 +552,7 @@ util.inherits(Job, EventEmitter);
* @param {Object} Returns the job instance.
*/
Job.prototype.remove = function(callback) {
this.once('remove', _.callback(callback));
this.once('remove', _.iteratee(callback));
if (this.removing) {
return this;
}
@@ -585,7 +577,7 @@ Job.prototype.remove = function(callback) {
* @param {Object} Returns the job instance.
*/
Job.prototype.reset = function(callback) {
this.once('reset', _.callback(callback));
this.once('reset', _.iteratee(callback));
if (this.resetting) {
return this;
}
@@ -601,7 +593,7 @@ Job.prototype.reset = function(callback) {
* @param {Object} Returns the job instance.
*/
Job.prototype.restart = function(callback) {
this.once('restart', _.callback(callback));
this.once('restart', _.iteratee(callback));
if (this.restarting) {
return this;
}
@@ -626,7 +618,7 @@ Job.prototype.restart = function(callback) {
* @param {Object} Returns the job instance.
*/
Job.prototype.start = function(callback) {
this.once('start', _.callback(callback));
this.once('start', _.iteratee(callback));
if (this.starting || this.running) {
return this;
}
@@ -647,7 +639,7 @@ Job.prototype.start = function(callback) {
* @param {Object} Returns the job instance.
*/
Job.prototype.status = function(callback) {
this.once('status', _.callback(callback));
this.once('status', _.iteratee(callback));
if (this.checking || this.removing || this.resetting || this.restarting || this.starting || this.stopping) {
return this;
}
@@ -669,7 +661,7 @@ Job.prototype.status = function(callback) {
* @param {Object} Returns the job instance.
*/
Job.prototype.stop = function(callback) {
this.once('stop', _.callback(callback));
this.once('stop', _.iteratee(callback));
if (this.stopping) {
return this;
}
@@ -707,14 +699,14 @@ function Tunnel(properties) {
var active = [],
queue = [];
var all = _.map(this.platforms, function(platform) {
var all = _.map(this.platforms, _.bind(function(platform) {
return new Job(_.merge({
'user': this.user,
'pass': this.pass,
'tunnel': this,
'options': { 'platforms': [platform] }
}, this.job));
}, this);
}, this));
var completed = 0,
restarted = [],
@@ -722,7 +714,7 @@ function Tunnel(properties) {
total = all.length,
tunnel = this;
_.invoke(all, 'on', 'complete', function() {
_.invokeMap(all, 'on', 'complete', function() {
_.pull(active, this);
if (success) {
success = !this.failed;
@@ -734,7 +726,7 @@ function Tunnel(properties) {
tunnel.dequeue();
});
_.invoke(all, 'on', 'restart', function() {
_.invokeMap(all, 'on', 'restart', function() {
if (!_.includes(restarted, this)) {
restarted.push(this);
}
@@ -768,7 +760,7 @@ util.inherits(Tunnel, EventEmitter);
* @param {Function} callback The function called once the tunnel is restarted.
*/
Tunnel.prototype.restart = function(callback) {
this.once('restart', _.callback(callback));
this.once('restart', _.iteratee(callback));
if (this.restarting) {
return this;
}
@@ -782,7 +774,7 @@ Tunnel.prototype.restart = function(callback) {
all = jobs.all;
var reset = _.after(all.length, _.bind(this.stop, this, onGenericRestart)),
stop = _.after(active.length, _.partial(_.invoke, all, 'reset', reset));
stop = _.after(active.length, _.partial(_.invokeMap, all, 'reset', reset));
if (_.isEmpty(active)) {
_.defer(stop);
@@ -790,7 +782,7 @@ Tunnel.prototype.restart = function(callback) {
if (_.isEmpty(all)) {
_.defer(reset);
}
_.invoke(active, 'stop', function() {
_.invokeMap(active, 'stop', function() {
_.pull(active, this);
stop();
});
@@ -810,7 +802,7 @@ Tunnel.prototype.restart = function(callback) {
* @param {Object} Returns the tunnel instance.
*/
Tunnel.prototype.start = function(callback) {
this.once('start', _.callback(callback));
this.once('start', _.iteratee(callback));
if (this.starting || this.running) {
return this;
}
@@ -853,7 +845,7 @@ Tunnel.prototype.dequeue = function() {
* @param {Object} Returns the tunnel instance.
*/
Tunnel.prototype.stop = function(callback) {
this.once('stop', _.callback(callback));
this.once('stop', _.iteratee(callback));
if (this.stopping) {
return this;
}
@@ -878,7 +870,7 @@ Tunnel.prototype.stop = function(callback) {
if (_.isEmpty(active)) {
_.defer(stop);
}
_.invoke(active, 'stop', function() {
_.invokeMap(active, 'stop', function() {
_.pull(active, this);
stop();
});

1122
test/test-fp.js Normal file

File diff suppressed because it is too large Load Diff

23957
test/test.js

File diff suppressed because it is too large Load Diff

View File

@@ -23,50 +23,94 @@
<script src="../node_modules/jquery/dist/jquery.js"></script>
<script src="../node_modules/platform/platform.js"></script>
<script src="./asset/test-ui.js"></script>
<script src="../lodash.js"></script>
<script>
QUnit.config.asyncRetries = 10;
QUnit.config.hidepassed = true;
// Excuse tests we intentionally fail or those with problems.
QUnit.config.excused = {
'Arrays': {
'difference': [
'can perform an OO-style difference'
],
'drop': [
'alias for rest'
'is an alias for rest'
],
'first': [
'can pass an index to first',
'[1,2]',
'0'
'returns an empty array when n <= 0 (0 case)',
'returns an empty array when n <= 0 (negative case)',
'can fetch the first n elements',
'returns the whole array if n > length'
],
'findIndex': [
'called with context'
],
'findLastIndex': [
'called with context'
],
'flatten': [
'Flattens empty arrays',
'supports empty arrays',
'can flatten nested arrays',
'can shallowly flatten nested arrays',
'works on an arguments object',
'can shallowly flatten arrays containing only other arrays'
'can handle very deep arrays'
],
'head': [
'is an alias for first'
],
'indexOf': [
"sorted indexOf doesn't uses binary search",
'0'
],
'initial': [
'initial can take an index',
'initial can take a large index',
'initial works on arguments object'
'returns all but the last n elements',
'returns an empty array when n > length',
'works on an arguments object'
],
'intersection': [
'can perform an OO-style intersection'
],
'last': [
'can pass an index to last',
'0'
'returns an empty array when n <= 0 (0 case)',
'returns an empty array when n <= 0 (negative case)',
'can fetch the last n elements',
'returns the whole array if n > length'
],
'lastIndexOf': [
'should treat falsey `fromIndex` values, except `0` and `NaN`, as `array.length`',
'should treat non-number `fromIndex` values as `array.length`',
'[0,-1,-1]'
],
'object': [
'an array of pairs zipped together into an object',
'an object converted to pairs and back to an object'
],
'range': [
'range with two arguments a &amp; b, b&lt;a generates an empty array'
],
'rest': [
'working rest(0)',
'rest can take an index',
'works on arguments object'
'returns the whole array when index is 0',
'returns elements starting at the given index',
'works on an arguments object'
],
'sortedIndex': [
'2',
'3'
],
'tail': [
'is an alias for rest'
],
'take': [
'alias for first'
'is an alias for first'
],
'uniq': [
'uses the result of `iterator` for uniqueness comparisons (unsorted case)',
'`sorted` argument defaults to false when omitted',
'when `iterator` is a string, uses that key for comparisons (unsorted case)',
'uses the result of `iterator` for uniqueness comparisons (sorted case)',
'when `iterator` is a string, uses that key for comparisons (sorted case)',
'can use falsey pluck like iterator'
],
'union': [
'can perform an OO-style union'
]
},
'Chaining': {
@@ -78,20 +122,120 @@
]
},
'Collections': {
'lookupIterator with contexts': true,
'Iterating objects with sketchy length properties': true,
'Resistant to collection length and properties changing while iterating': true,
'countBy': [
'true'
],
'each': [
'context object property accessed'
],
'every': [
'Can be called with object',
'Died on test #15',
'context works'
],
'filter': [
'given context',
'[{"a":1,"b":2},{"a":1,"b":3},{"a":1,"b":4}]',
'[{"a":1,"b":2},{"a":2,"b":2}]',
'Empty object accepts all items',
'OO-filter'
],
'find': [
'{"a":1,"b":4}',
'undefined when not found',
'undefined when searching empty list',
'works on objects',
'undefined',
'called with context'
],
'findWhere': [
'checks properties given function'
],
'groupBy': [
'true'
],
'includes': [
"doesn't delegate to binary search"
],
'invoke': [
'handles null & undefined'
],
'map': [
'tripled numbers with context',
'OO-style doubled numbers'
],
'Resistant to collection length and properties changing while iterating': [
'Died on test #50'
'max': [
'can handle null/undefined',
'can perform a computation-based max',
'Maximum value of an empty object',
'Maximum value of an empty array',
'Maximum value of a non-numeric collection',
'Finds correct max in array starting with num and containing a NaN',
'Finds correct max in array starting with NaN',
'Respects iterator return value of -Infinity',
'String keys use property iterator',
'Iterator context',
'Lookup falsy iterator'
],
'min': [
'can handle null/undefined',
'can perform a computation-based min',
'Minimum value of an empty object',
'Minimum value of an empty array',
'Minimum value of a non-numeric collection',
'Finds correct min in array starting with NaN',
'Respects iterator return value of Infinity',
'String keys use property iterator',
'Iterator context',
'Lookup falsy iterator'
],
'partition': [
'can reference the array index',
'Died on test #8',
'partition takes a context argument',
'function(a){[code]}'
],
'pluck': [
'[1]'
],
'reduce': [
'can reduce with a context object'
],
'reject': [
'Returns empty list given empty array'
],
'sample': [
'behaves correctly on negative n',
'Died on test #3'
],
'some': [
'Can be called with object',
'Died on test #17',
'context works'
],
'where': [
'checks properties given function'
],
'Can use various collection methods on NodeLists': [
'<span id="id2"></span>',
'<span id="id1"></span>'
]
},
'Functions': {
'debounce asap': true,
'debounce asap cancel': true,
'debounce after system time is set backwards': true,
'debounce asap recursively': true,
'throttle repeatedly with results': true,
'more throttle does not trigger leading call when leading is set to false': true,
'throttle does not trigger trailing call when trailing is set to false': true,
'before': [
'stores a memo to the last value',
'provides context'
],
'bind': [
'Died on test #2'
],
@@ -102,45 +246,78 @@
'{"bar":"BAR","foo":"FOO"}',
'Died on test #8'
],
'throttle repeatedly with results': true,
'more throttle does not trigger leading call when leading is set to false': true,
'throttle does not trigger trailing call when trailing is set to false': true,
'debounce asap': true
'partial':[
'can partially apply with placeholders',
'accepts more arguments than the number of placeholders',
'accepts fewer arguments than the number of placeholders',
'unfilled placeholders are undefined',
'keeps prototype',
'allows the placeholder to be swapped out'
]
},
'Objects': {
'#1929 Typed Array constructors are functions': true,
'allKeys': true,
'extendOwn': true,
'mapObject': true,
'matcher': true,
'matcher ': true,
'allKeys': [
'is not fooled by sparse arrays; see issue #95',
'is not fooled by sparse arrays with additional properties',
'[]'
],
'defaults': [
'defaults skips nulls',
'defaults skips undefined'
],
'extend': [
'extend copies all properties from source'
'extending null results in null',
'extending undefined results in undefined'
],
'extendOwn': [
'extending non-objects results in returning the non-object value',
'extending undefined results in undefined'
],
'functions': [
'also looks up functions on the prototype'
],
'isEqual': [
'`0` is not equal to `-0`',
'Commutative equality is implemented for `0` and `-0`',
'`new Number(0)` and `-0` are not equal',
'Commutative equality is implemented for `new Number(0)` and `-0`'
'Commutative equality is implemented for `new Number(0)` and `-0`',
'false'
],
'isFinite': [
'Numeric strings are numbers',
'Number instances can be finite'
],
'isMatch': [
'inherited and own properties are checked on the test object',
'doesnt falsey match constructor on undefined/null'
],
'findKey': [
'called with context'
],
'keys': [
'is not fooled by sparse arrays; see issue #95',
'[]'
],
'matches': [
'inherited and own properties are checked on the test object',
'doesnt fasley match constructor on undefined/null'
'mapObject': [
'keep context',
'called with context',
'mapValue identity'
],
'matcher': [
'null matches null',
'treats primitives as empty'
],
'omit': [
'can accept a predicate',
'function is given context'
],
'pick': [
'can accept a predicate and context',
'function is given context'
]
},
'Utility': {
'noConflict (node vm)': true,
'now': [
'Produces the correct time in milliseconds'
],
@@ -150,19 +327,75 @@
}
};
// Only excuse in Sauce Labs (buggy Safari and timers).
var mixinPrereqs = (function() {
var aliasToReal = {
'all': 'every',
'allKeys': 'keysIn',
'any': 'some',
'collect': 'map',
'compose': 'flowRight',
'contains': 'includes',
'detect': 'find',
'extendOwn': 'assign',
'findWhere': 'find',
'foldl': 'reduce',
'foldr': 'reduceRight',
'include': 'includes',
'indexBy': 'keyBy',
'inject': 'reduce',
'invoke': 'invokeMap',
'mapObject': 'mapValues',
'matcher': 'matches',
'methods': 'functions',
'object': 'zipObject',
'pairs': 'toPairs',
'pluck': 'map',
'restParam': 'restArgs',
'select': 'filter',
'unique': 'uniq',
'where': 'filter'
};
var keyMap = {
'rest': 'tail',
'restArgs': 'rest'
};
var lodash = _.noConflict();
return function(_) {
lodash.defaultsDeep(_, { 'templateSettings': lodash.templateSettings });
lodash.mixin(_, lodash.pick(lodash, lodash.difference(lodash.functions(lodash), lodash.functions(_))));
lodash.forOwn(keyMap, function(realName, otherName) {
_[otherName] = lodash[realName];
_.prototype[otherName] = lodash.prototype[realName];
});
lodash.forOwn(aliasToReal, function(realName, alias) {
_[alias] = _[realName];
_.prototype[alias] = _.prototype[realName];
});
};
}());
// Only excuse in Sauce Labs.
if (!ui.isSauceLabs) {
delete QUnit.config.excused.Functions['throttle repeatedly with results'];
delete QUnit.config.excused.Functions['more throttle does not trigger leading call when leading is set to false'];
delete QUnit.config.excused.Functions['throttle does not trigger trailing call when trailing is set to false'];
delete QUnit.config.excused.Functions['debounce asap'];
delete QUnit.config.excused.Utility.now;
}
// Load test scripts.
document.write(ui.urlParams.loader != 'none'
? '<script data-dojo-config="async:1" src="' + ui.loaderPath + '"><\/script>'
: ([
'<script src="' + ui.buildPath + '"><\/script>',
// Load prerequisite scripts.
document.write(ui.urlParams.loader == 'none'
? '<script src="' + ui.buildPath + '"><\/script>'
: '<script data-dojo-config="async:1" src="' + ui.loaderPath + '"><\/script>'
);
</script>
<script>
if (ui.urlParams.loader == 'none') {
mixinPrereqs(_);
document.write([
'<script src="../vendor/underscore/test/collections.js"><\/script>',
'<script src="../vendor/underscore/test/arrays.js"><\/script>',
'<script src="../vendor/underscore/test/functions.js"><\/script>',
@@ -170,8 +403,8 @@
'<script src="../vendor/underscore/test/cross-document.js"><\/script>',
'<script src="../vendor/underscore/test/utility.js"><\/script>',
'<script src="../vendor/underscore/test/chaining.js"><\/script>'
].join('\n'))
);
].join('\n'));
}
</script>
<script>
(function() {
@@ -181,6 +414,13 @@
if (!window.require) {
return;
}
// Wrap to work around tests assuming Node `require` use.
require = (function(func) {
return function() {
return arguments[0] === '..' ? window._ : func.apply(null, arguments);
};
}(require));
var reBasename = /[\w.-]+$/,
basePath = ('//' + location.host + location.pathname.replace(reBasename, '')).replace(/\btest\/$/, ''),
modulePath = ui.buildPath.replace(/\.js$/, ''),
@@ -221,9 +461,7 @@
QUnit.config.autostart = false;
require(getConfig(), [moduleId], function(lodash) {
if (ui.isModularize) {
window._ = lodash;
}
mixinPrereqs(lodash);
require(getConfig(), [
'test/collections',
'test/arrays',

View File

@@ -1,4 +1,4 @@
Copyright (c) 2010-2015 Jeremy Ashkenas, DocumentCloud
Copyright (c) 2010-2016 Jeremy Ashkenas, DocumentCloud
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation

View File

@@ -1,6 +1,6 @@
// Backbone.js 1.2.1
// Backbone.js 1.2.3
// (c) 2010-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
// (c) 2010-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
// Backbone may be freely distributed under the MIT license.
// For all details and documentation:
// http://backbonejs.org
@@ -9,8 +9,8 @@
// Establish the root object, `window` (`self`) in the browser, or `global` on the server.
// We use `self` instead of `window` for `WebWorker` support.
var root = (typeof self == 'object' && self.self == self && self) ||
(typeof global == 'object' && global.global == global && global);
var root = (typeof self == 'object' && self.self === self && self) ||
(typeof global == 'object' && global.global === global && global);
// Set up Backbone appropriately for the environment. Start with AMD.
if (typeof define === 'function' && define.amd) {
@@ -23,7 +23,7 @@
// Next for Node.js or CommonJS. jQuery may not be needed as a module.
} else if (typeof exports !== 'undefined') {
var _ = require('underscore'), $;
try { $ = require('jquery'); } catch(e) {}
try { $ = require('jquery'); } catch (e) {}
factory(root, exports, _, $);
// Finally, as a browser global.
@@ -31,7 +31,7 @@
root.Backbone = factory(root, {}, root._, (root.jQuery || root.Zepto || root.ender || root.$));
}
}(function(root, Backbone, _, $) {
})(function(root, Backbone, _, $) {
// Initial Setup
// -------------
@@ -41,10 +41,10 @@
var previousBackbone = root.Backbone;
// Create a local reference to a common array method we'll want to use later.
var slice = [].slice;
var slice = Array.prototype.slice;
// Current version of the library. Keep in sync with `package.json`.
Backbone.VERSION = '1.2.1';
Backbone.VERSION = '1.2.3';
// For Backbone's purposes, jQuery, Zepto, Ender, or My Library (kidding) owns
// the `$` variable.
@@ -68,8 +68,13 @@
// form param named `model`.
Backbone.emulateJSON = false;
// Proxy Underscore methods to a Backbone class' prototype using a
// particular attribute as the data argument
// Proxy Backbone class methods to Underscore functions, wrapping the model's
// `attributes` object or collection's `models` array behind the scenes.
//
// collection.filter(function(model) { return model.get('age') > 10 });
// collection.each(this.addView);
//
// `Function#apply` can be slow so we use the method's arg count, if we know it.
var addMethod = function(length, method, attribute) {
switch (length) {
case 1: return function() {
@@ -79,10 +84,10 @@
return _[method](this[attribute], value);
};
case 3: return function(iteratee, context) {
return _[method](this[attribute], iteratee, context);
return _[method](this[attribute], cb(iteratee, this), context);
};
case 4: return function(iteratee, defaultVal, context) {
return _[method](this[attribute], iteratee, defaultVal, context);
return _[method](this[attribute], cb(iteratee, this), defaultVal, context);
};
default: return function() {
var args = slice.call(arguments);
@@ -97,12 +102,26 @@
});
};
// Support `collection.sortBy('attr')` and `collection.findWhere({id: 1})`.
var cb = function(iteratee, instance) {
if (_.isFunction(iteratee)) return iteratee;
if (_.isObject(iteratee) && !instance._isModel(iteratee)) return modelMatcher(iteratee);
if (_.isString(iteratee)) return function(model) { return model.get(iteratee); };
return iteratee;
};
var modelMatcher = function(attrs) {
var matcher = _.matches(attrs);
return function(model) {
return matcher(model.attributes);
};
};
// Backbone.Events
// ---------------
// A module that can be mixed in to *any object* in order to provide it with
// custom events. You may bind with `on` or remove with `off` callback
// functions to an event; `trigger`-ing an event fires all callbacks in
// a custom event channel. You may bind a callback to an event with `on` or
// remove with `off`; `trigger`-ing an event fires all callbacks in
// succession.
//
// var object = {};
@@ -117,26 +136,25 @@
// Iterates over the standard `event, callback` (as well as the fancy multiple
// space-separated events `"change blur", callback` and jQuery-style event
// maps `{event: callback}`), reducing them by manipulating `memo`.
// Passes a normalized single event name and callback, as well as any
// optional `opts`.
var eventsApi = function(iteratee, memo, name, callback, opts) {
// maps `{event: callback}`).
var eventsApi = function(iteratee, events, name, callback, opts) {
var i = 0, names;
if (name && typeof name === 'object') {
// Handle event maps.
if (callback !== void 0 && 'context' in opts && opts.context === void 0) opts.context = callback;
for (names = _.keys(name); i < names.length ; i++) {
memo = iteratee(memo, names[i], name[names[i]], opts);
events = eventsApi(iteratee, events, names[i], name[names[i]], opts);
}
} else if (name && eventSplitter.test(name)) {
// Handle space separated event names.
// Handle space-separated event names by delegating them individually.
for (names = name.split(eventSplitter); i < names.length; i++) {
memo = iteratee(memo, names[i], callback, opts);
events = iteratee(events, names[i], callback, opts);
}
} else {
memo = iteratee(memo, name, callback, opts);
// Finally, standard events.
events = iteratee(events, name, callback, opts);
}
return memo;
return events;
};
// Bind an event to a `callback` function. Passing `"all"` will bind
@@ -145,13 +163,12 @@
return internalOn(this, name, callback, context);
};
// An internal use `on` function, used to guard the `listening` argument from
// the public API.
// Guard the `listening` argument from the public API.
var internalOn = function(obj, name, callback, context, listening) {
obj._events = eventsApi(onApi, obj._events || {}, name, callback, {
context: context,
ctx: obj,
listening: listening
context: context,
ctx: obj,
listening: listening
});
if (listening) {
@@ -163,8 +180,9 @@
};
// Inversion-of-control versions of `on`. Tell *this* object to listen to
// an event in another object... keeping track of what it's listening to.
Events.listenTo = function(obj, name, callback) {
// an event in another object... keeping track of what it's listening to
// for easier unbinding later.
Events.listenTo = function(obj, name, callback) {
if (!obj) return this;
var id = obj._listenId || (obj._listenId = _.uniqueId('l'));
var listeningTo = this._listeningTo || (this._listeningTo = {});
@@ -189,7 +207,7 @@
var context = options.context, ctx = options.ctx, listening = options.listening;
if (listening) listening.count++;
handlers.push({ callback: callback, context: context, ctx: context || ctx, listening: listening });
handlers.push({callback: callback, context: context, ctx: context || ctx, listening: listening});
}
return events;
};
@@ -198,18 +216,18 @@
// callbacks with that function. If `callback` is null, removes all
// callbacks for the event. If `name` is null, removes all bound
// callbacks for all events.
Events.off = function(name, callback, context) {
Events.off = function(name, callback, context) {
if (!this._events) return this;
this._events = eventsApi(offApi, this._events, name, callback, {
context: context,
listeners: this._listeners
context: context,
listeners: this._listeners
});
return this;
};
// Tell this object to stop listening to either specific events ... or
// to every object it's currently listening to.
Events.stopListening = function(obj, name, callback) {
Events.stopListening = function(obj, name, callback) {
var listeningTo = this._listeningTo;
if (!listeningTo) return this;
@@ -231,7 +249,6 @@
// The reducing API that removes a callback from the `events` object.
var offApi = function(events, name, callback, options) {
// No events to consider.
if (!events) return;
var i = 0, listening;
@@ -286,17 +303,17 @@
};
// Bind an event to only be triggered a single time. After the first time
// the callback is invoked, it will be removed. When multiple events are
// passed in using the space-separated syntax, the event will fire once for every
// event you passed in, not once for a combination of all events
Events.once = function(name, callback, context) {
// the callback is invoked, its listener will be removed. If multiple events
// are passed in using the space-separated syntax, the handler will fire
// once for each event, not once for a combination of all events.
Events.once = function(name, callback, context) {
// Map the event into a `{event: once}` object.
var events = eventsApi(onceMap, {}, name, callback, _.bind(this.off, this));
return this.on(events, void 0, context);
};
// Inversion-of-control versions of `once`.
Events.listenToOnce = function(obj, name, callback) {
Events.listenToOnce = function(obj, name, callback) {
// Map the event into a `{event: once}` object.
var events = eventsApi(onceMap, {}, name, callback, _.bind(this.stopListening, this, obj));
return this.listenTo(obj, events);
@@ -319,7 +336,7 @@
// passed the same arguments as `trigger` is, apart from the event name
// (unless you're listening on `"all"`, which will cause your callback to
// receive the true name of the event as the first argument).
Events.trigger = function(name) {
Events.trigger = function(name) {
if (!this._events) return this;
var length = Math.max(0, arguments.length - 1);
@@ -331,7 +348,7 @@
};
// Handles triggering the appropriate event callbacks.
var triggerApi = function(objEvents, name, cb, args) {
var triggerApi = function(objEvents, name, callback, args) {
if (objEvents) {
var events = objEvents[name];
var allEvents = objEvents.all;
@@ -476,9 +493,6 @@
var changed = this.changed;
var prev = this._previousAttributes;
// Check for changes of `id`.
if (this.idAttribute in attrs) this.id = attrs[this.idAttribute];
// For each `set` attribute, update or delete the current value.
for (var attr in attrs) {
val = attrs[attr];
@@ -491,6 +505,9 @@
unset ? delete current[attr] : current[attr] = val;
}
// Update the `id`.
if (this.idAttribute in attrs) this.id = this.get(this.idAttribute);
// Trigger all relevant attribute changes.
if (!silent) {
if (changes.length) this._pending = options;
@@ -602,8 +619,8 @@
// the model will be valid when the attributes, if any, are set.
if (attrs && !wait) {
if (!this.set(attrs, options)) return false;
} else {
if (!this._validate(attrs, options)) return false;
} else if (!this._validate(attrs, options)) {
return false;
}
// After a successful server-side save, the client is (optionally)
@@ -713,9 +730,10 @@
});
// Underscore methods that we want to implement on the Model.
var modelMethods = { keys: 1, values: 1, pairs: 1, invert: 1, pick: 0,
omit: 0, chain: 1, isEmpty: 1 };
// Underscore methods that we want to implement on the Model, mapped to the
// number of arguments they take.
var modelMethods = {keys: 1, values: 1, pairs: 1, invert: 1, pick: 0,
omit: 0, chain: 1, isEmpty: 1};
// Mix in each Underscore method as a proxy to `Model#attributes`.
addUnderscoreMethods(Model, modelMethods, 'attributes');
@@ -746,6 +764,17 @@
var setOptions = {add: true, remove: true, merge: true};
var addOptions = {add: true, remove: false};
// Splices `insert` into `array` at index `at`.
var splice = function(array, insert, at) {
at = Math.min(Math.max(at, 0), array.length);
var tail = Array(array.length - at);
var length = insert.length;
var i;
for (i = 0; i < tail.length; i++) tail[i] = array[i + at];
for (i = 0; i < length; i++) array[i + at] = insert[i];
for (i = 0; i < tail.length; i++) array[i + length + at] = tail[i];
};
// Define the Collection's inheritable methods.
_.extend(Collection.prototype, Events, {
@@ -768,7 +797,9 @@
return Backbone.sync.apply(this, arguments);
},
// Add a model, or list of models to the set.
// Add a model, or list of models to the set. `models` may be Backbone
// Models or raw JavaScript objects to be converted to Models, or any
// combination of the two.
add: function(models, options) {
return this.set(models, _.extend({merge: false}, options, addOptions));
},
@@ -777,9 +808,12 @@
remove: function(models, options) {
options = _.extend({}, options);
var singular = !_.isArray(models);
models = singular ? [models] : _.clone(models);
models = singular ? [models] : models.slice();
var removed = this._removeModels(models, options);
if (!options.silent && removed) this.trigger('update', this, options);
if (!options.silent && removed.length) {
options.changes = {added: [], merged: [], removed: removed};
this.trigger('update', this, options);
}
return singular ? removed[0] : removed;
},
@@ -788,97 +822,113 @@
// already exist in the collection, as necessary. Similar to **Model#set**,
// the core operation for updating the data contained by the collection.
set: function(models, options) {
if (models == null) return;
options = _.defaults({}, options, setOptions);
if (options.parse && !this._isModel(models)) models = this.parse(models, options);
if (options.parse && !this._isModel(models)) {
models = this.parse(models, options) || [];
}
var singular = !_.isArray(models);
models = singular ? (models ? [models] : []) : models.slice();
var id, model, attrs, existing, sort;
models = singular ? [models] : models.slice();
var at = options.at;
if (at != null) at = +at;
if (at < 0) at += this.length + 1;
var sortable = this.comparator && (at == null) && options.sort !== false;
var set = [];
var toAdd = [];
var toMerge = [];
var toRemove = [];
var modelMap = {};
var add = options.add;
var merge = options.merge;
var remove = options.remove;
var sort = false;
var sortable = this.comparator && at == null && options.sort !== false;
var sortAttr = _.isString(this.comparator) ? this.comparator : null;
var toAdd = [], toRemove = [], modelMap = {};
var add = options.add, merge = options.merge, remove = options.remove;
var order = !sortable && add && remove ? [] : false;
var orderChanged = false;
// Turn bare objects into model references, and prevent invalid models
// from being added.
for (var i = 0; i < models.length; i++) {
attrs = models[i];
var model, i;
for (i = 0; i < models.length; i++) {
model = models[i];
// If a duplicate is found, prevent it from being added and
// optionally merge it into the existing model.
if (existing = this.get(attrs)) {
if (remove) modelMap[existing.cid] = true;
if (merge && attrs !== existing) {
attrs = this._isModel(attrs) ? attrs.attributes : attrs;
var existing = this.get(model);
if (existing) {
if (merge && model !== existing) {
var attrs = this._isModel(model) ? model.attributes : model;
if (options.parse) attrs = existing.parse(attrs, options);
existing.set(attrs, options);
if (sortable && !sort && existing.hasChanged(sortAttr)) sort = true;
toMerge.push(existing);
if (sortable && !sort) sort = existing.hasChanged(sortAttr);
}
if (!modelMap[existing.cid]) {
modelMap[existing.cid] = true;
set.push(existing);
}
models[i] = existing;
// If this is a new, valid model, push it to the `toAdd` list.
} else if (add) {
model = models[i] = this._prepareModel(attrs, options);
if (!model) continue;
toAdd.push(model);
this._addReference(model, options);
model = models[i] = this._prepareModel(model, options);
if (model) {
toAdd.push(model);
this._addReference(model, options);
modelMap[model.cid] = true;
set.push(model);
}
}
// Do not add multiple models with the same `id`.
model = existing || model;
if (!model) continue;
id = this.modelId(model.attributes);
if (order && (model.isNew() || !modelMap[id])) {
order.push(model);
// Check to see if this is actually a new model at this index.
orderChanged = orderChanged || !this.models[i] || model.cid !== this.models[i].cid;
}
modelMap[id] = true;
}
// Remove nonexistent models if appropriate.
// Remove stale models.
if (remove) {
for (var i = 0; i < this.length; i++) {
if (!modelMap[(model = this.models[i]).cid]) toRemove.push(model);
for (i = 0; i < this.length; i++) {
model = this.models[i];
if (!modelMap[model.cid]) toRemove.push(model);
}
if (toRemove.length) this._removeModels(toRemove, options);
}
// See if sorting is needed, update `length` and splice in new models.
if (toAdd.length || orderChanged) {
var orderChanged = false;
var replace = !sortable && add && remove;
if (set.length && replace) {
orderChanged = this.length !== set.length || _.some(this.models, function(m, index) {
return m !== set[index];
});
this.models.length = 0;
splice(this.models, set, 0);
this.length = this.models.length;
} else if (toAdd.length) {
if (sortable) sort = true;
this.length += toAdd.length;
if (at != null) {
for (var i = 0; i < toAdd.length; i++) {
this.models.splice(at + i, 0, toAdd[i]);
}
} else {
if (order) this.models.length = 0;
var orderedModels = order || toAdd;
for (var i = 0; i < orderedModels.length; i++) {
this.models.push(orderedModels[i]);
}
}
splice(this.models, toAdd, at == null ? this.length : at);
this.length = this.models.length;
}
// Silently sort the collection if appropriate.
if (sort) this.sort({silent: true});
// Unless silenced, it's time to fire all appropriate add/sort events.
// Unless silenced, it's time to fire all appropriate add/sort/update events.
if (!options.silent) {
var addOpts = at != null ? _.clone(options) : options;
for (var i = 0; i < toAdd.length; i++) {
if (at != null) addOpts.index = at + i;
(model = toAdd[i]).trigger('add', model, this, addOpts);
for (i = 0; i < toAdd.length; i++) {
if (at != null) options.index = at + i;
model = toAdd[i];
model.trigger('add', model, this, options);
}
if (sort || orderChanged) this.trigger('sort', this, options);
if (toAdd.length || toRemove.length) this.trigger('update', this, options);
if (toAdd.length || toRemove.length || toMerge.length) {
options.changes = {
added: toAdd,
removed: toRemove,
merged: toMerge
};
this.trigger('update', this, options);
}
}
// Return the added (or merged) model (or models).
@@ -935,6 +985,11 @@
return this._byId[obj] || this._byId[id] || this._byId[obj.cid];
},
// Returns `true` if the model is in the collection.
has: function(obj) {
return this.get(obj) != null;
},
// Get the model at the given index.
at: function(index) {
if (index < 0) index += this.length;
@@ -944,10 +999,7 @@
// Return models with matching attributes. Useful for simple cases of
// `filter`.
where: function(attrs, first) {
var matches = _.matches(attrs);
return this[first ? 'find' : 'filter'](function(model) {
return matches(model.attributes);
});
return this[first ? 'find' : 'filter'](attrs);
},
// Return the first model with matching attributes. Useful for simple cases
@@ -960,23 +1012,26 @@
// normal circumstances, as the set will maintain sort order as each item
// is added.
sort: function(options) {
if (!this.comparator) throw new Error('Cannot sort a set without a comparator');
var comparator = this.comparator;
if (!comparator) throw new Error('Cannot sort a set without a comparator');
options || (options = {});
// Run sort based on type of `comparator`.
if (_.isString(this.comparator) || this.comparator.length === 1) {
this.models = this.sortBy(this.comparator, this);
} else {
this.models.sort(_.bind(this.comparator, this));
}
var length = comparator.length;
if (_.isFunction(comparator)) comparator = _.bind(comparator, this);
// Run sort based on type of `comparator`.
if (length === 1 || _.isString(comparator)) {
this.models = this.sortBy(comparator);
} else {
this.models.sort(comparator);
}
if (!options.silent) this.trigger('sort', this, options);
return this;
},
// Pluck an attribute from each model in the collection.
pluck: function(attr) {
return _.invoke(this.models, 'get', attr);
return this.map(attr + '');
},
// Fetch the default set of models for this collection, resetting the
@@ -1007,9 +1062,9 @@
if (!wait) this.add(model, options);
var collection = this;
var success = options.success;
options.success = function(model, resp, callbackOpts) {
if (wait) collection.add(model, callbackOpts);
if (success) success.call(callbackOpts.context, model, resp, callbackOpts);
options.success = function(m, resp, callbackOpts) {
if (wait) collection.add(m, callbackOpts);
if (success) success.call(callbackOpts.context, m, resp, callbackOpts);
};
model.save(null, options);
return model;
@@ -1030,7 +1085,7 @@
},
// Define how to uniquely identify models in the collection.
modelId: function (attrs) {
modelId: function(attrs) {
return attrs[this.model.prototype.idAttribute || 'id'];
},
@@ -1058,7 +1113,6 @@
},
// Internal method called by both remove and set.
// Returns removed models, or false if nothing is removed.
_removeModels: function(models, options) {
var removed = [];
for (var i = 0; i < models.length; i++) {
@@ -1069,6 +1123,12 @@
this.models.splice(index, 1);
this.length--;
// Remove references before triggering 'remove' event to prevent an
// infinite loop. #3693
delete this._byId[model.cid];
var id = this.modelId(model.attributes);
if (id != null) delete this._byId[id];
if (!options.silent) {
options.index = index;
model.trigger('remove', model, this, options);
@@ -1077,12 +1137,12 @@
removed.push(model);
this._removeReference(model, options);
}
return removed.length ? removed : false;
return removed;
},
// Method for checking whether an object should be considered a model for
// the purposes of adding to the collection.
_isModel: function (model) {
_isModel: function(model) {
return model instanceof Model;
},
@@ -1108,14 +1168,16 @@
// events simply proxy through. "add" and "remove" events that originate
// in other collections are ignored.
_onModelEvent: function(event, model, collection, options) {
if ((event === 'add' || event === 'remove') && collection !== this) return;
if (event === 'destroy') this.remove(model, options);
if (event === 'change') {
var prevId = this.modelId(model.previousAttributes());
var id = this.modelId(model.attributes);
if (prevId !== id) {
if (prevId != null) delete this._byId[prevId];
if (id != null) this._byId[id] = model;
if (model) {
if ((event === 'add' || event === 'remove') && collection !== this) return;
if (event === 'destroy') this.remove(model, options);
if (event === 'change') {
var prevId = this.modelId(model.previousAttributes());
var id = this.modelId(model.attributes);
if (prevId !== id) {
if (prevId != null) delete this._byId[prevId];
if (id != null) this._byId[id] = model;
}
}
}
this.trigger.apply(this, arguments);
@@ -1126,31 +1188,18 @@
// Underscore methods that we want to implement on the Collection.
// 90% of the core usefulness of Backbone Collections is actually implemented
// right here:
var collectionMethods = { forEach: 3, each: 3, map: 3, collect: 3, reduce: 4,
foldl: 4, inject: 4, reduceRight: 4, foldr: 4, find: 3, detect: 3, filter: 3,
select: 3, reject: 3, every: 3, all: 3, some: 3, any: 3, include: 2,
contains: 2, invoke: 0, max: 3, min: 3, toArray: 1, size: 1, first: 3,
var collectionMethods = {forEach: 3, each: 3, map: 3, collect: 3, reduce: 0,
foldl: 0, inject: 0, reduceRight: 0, foldr: 0, find: 3, detect: 3, filter: 3,
select: 3, reject: 3, every: 3, all: 3, some: 3, any: 3, include: 3, includes: 3,
contains: 3, invoke: 0, max: 3, min: 3, toArray: 1, size: 1, first: 3,
head: 3, take: 3, initial: 3, rest: 3, tail: 3, drop: 3, last: 3,
without: 0, difference: 0, indexOf: 3, shuffle: 1, lastIndexOf: 3,
isEmpty: 1, chain: 1, sample: 3, partition: 3 };
isEmpty: 1, chain: 1, sample: 3, partition: 3, groupBy: 3, countBy: 3,
sortBy: 3, indexBy: 3, findIndex: 3, findLastIndex: 3};
// Mix in each Underscore method as a proxy to `Collection#models`.
addUnderscoreMethods(Collection, collectionMethods, 'models');
// Underscore methods that take a property name as an argument.
var attributeMethods = ['groupBy', 'countBy', 'sortBy', 'indexBy'];
// Use attributes instead of properties.
_.each(attributeMethods, function(method) {
if (!_[method]) return;
Collection.prototype[method] = function(value, context) {
var iterator = _.isFunction(value) ? value : function(model) {
return model.get(value);
};
return _[method](this.models, iterator, context);
};
});
// Backbone.View
// -------------
@@ -1174,7 +1223,7 @@
// Cached regex to split keys for `delegate`.
var delegateEventSplitter = /^(\S+)\s*(.*)$/;
// List of view options to be merged as properties.
// List of view options to be set as properties.
var viewOptions = ['model', 'collection', 'el', 'id', 'attributes', 'className', 'tagName', 'events'];
// Set up all inheritable **Backbone.View** properties and methods.
@@ -1396,9 +1445,9 @@
var methodMap = {
'create': 'POST',
'update': 'PUT',
'patch': 'PATCH',
'patch': 'PATCH',
'delete': 'DELETE',
'read': 'GET'
'read': 'GET'
};
// Set the default implementation of `Backbone.ajax` to proxy through to `$`.
@@ -1518,7 +1567,7 @@
// falls back to polling.
var History = Backbone.History = function() {
this.handlers = [];
_.bindAll(this, 'checkUrl');
this.checkUrl = _.bind(this.checkUrl, this);
// Ensure that `History` can be used outside of the browser.
if (typeof window !== 'undefined') {
@@ -1555,8 +1604,8 @@
// Does the pathname match the root?
matchRoot: function() {
var path = this.decodeFragment(this.location.pathname);
var root = path.slice(0, this.root.length - 1) + '/';
return root === this.root;
var rootPath = path.slice(0, this.root.length - 1) + '/';
return rootPath === this.root;
},
// Unicode characters in `location.pathname` are percent encoded so they're
@@ -1611,7 +1660,7 @@
this.options = _.extend({root: '/'}, this.options, options);
this.root = this.options.root;
this._wantsHashChange = this.options.hashChange !== false;
this._hasHashChange = 'onhashchange' in window;
this._hasHashChange = 'onhashchange' in window && (document.documentMode === void 0 || document.documentMode > 7);
this._useHashChange = this._wantsHashChange && this._hasHashChange;
this._wantsPushState = !!this.options.pushState;
this._hasPushState = !!(this.history && this.history.pushState);
@@ -1628,8 +1677,8 @@
// If we've started off with a route from a `pushState`-enabled
// browser, but we're currently in a browser that doesn't support it...
if (!this._hasPushState && !this.atRoot()) {
var root = this.root.slice(0, -1) || '/';
this.location.replace(root + '#' + this.getPath());
var rootPath = this.root.slice(0, -1) || '/';
this.location.replace(rootPath + '#' + this.getPath());
// Return immediately as browser will do redirect to new url
return true;
@@ -1658,7 +1707,7 @@
}
// Add a cross-platform `addEventListener` shim for older browsers.
var addEventListener = window.addEventListener || function (eventName, listener) {
var addEventListener = window.addEventListener || function(eventName, listener) {
return attachEvent('on' + eventName, listener);
};
@@ -1679,7 +1728,7 @@
// but possibly useful for unit testing Routers.
stop: function() {
// Add a cross-platform `removeEventListener` shim for older browsers.
var removeEventListener = window.removeEventListener || function (eventName, listener) {
var removeEventListener = window.removeEventListener || function(eventName, listener) {
return detachEvent('on' + eventName, listener);
};
@@ -1730,7 +1779,7 @@
// If the root doesn't match, no routes can match either.
if (!this.matchRoot()) return false;
fragment = this.fragment = this.getFragment(fragment);
return _.any(this.handlers, function(handler) {
return _.some(this.handlers, function(handler) {
if (handler.route.test(fragment)) {
handler.callback(fragment);
return true;
@@ -1753,11 +1802,11 @@
fragment = this.getFragment(fragment || '');
// Don't include a trailing slash on the root.
var root = this.root;
var rootPath = this.root;
if (fragment === '' || fragment.charAt(0) === '?') {
root = root.slice(0, -1) || '/';
rootPath = rootPath.slice(0, -1) || '/';
}
var url = root + fragment;
var url = rootPath + fragment;
// Strip the hash and decode for matching.
fragment = this.decodeFragment(fragment.replace(pathStripper, ''));
@@ -1773,7 +1822,7 @@
// fragment to store history.
} else if (this._wantsHashChange) {
this._updateHash(this.location, fragment, options.replace);
if (this.iframe && (fragment !== this.getHash(this.iframe.contentWindow))) {
if (this.iframe && fragment !== this.getHash(this.iframe.contentWindow)) {
var iWindow = this.iframe.contentWindow;
// Opening and closing the iframe tricks IE7 and earlier to push a
@@ -1835,14 +1884,9 @@
_.extend(child, parent, staticProps);
// Set the prototype chain to inherit from `parent`, without calling
// `parent` constructor function.
var Surrogate = function(){ this.constructor = child; };
Surrogate.prototype = parent.prototype;
child.prototype = new Surrogate;
// Add prototype properties (instance properties) to the subclass,
// if supplied.
if (protoProps) _.extend(child.prototype, protoProps);
// `parent`'s constructor function and add the prototype properties.
child.prototype = _.create(parent.prototype, protoProps);
child.prototype.constructor = child;
// Set a convenience property in case the parent's prototype is needed
// later.
@@ -1870,4 +1914,4 @@
return Backbone;
}));
});

File diff suppressed because it is too large Load Diff

View File

@@ -1,42 +1,44 @@
(function() {
module("Backbone.Events");
QUnit.module('Backbone.Events');
test("on and trigger", 2, function() {
var obj = { counter: 0 };
_.extend(obj,Backbone.Events);
QUnit.test('on and trigger', function(assert) {
assert.expect(2);
var obj = {counter: 0};
_.extend(obj, Backbone.Events);
obj.on('event', function() { obj.counter += 1; });
obj.trigger('event');
equal(obj.counter,1,'counter should be incremented.');
assert.equal(obj.counter, 1, 'counter should be incremented.');
obj.trigger('event');
obj.trigger('event');
obj.trigger('event');
obj.trigger('event');
equal(obj.counter, 5, 'counter should be incremented five times.');
assert.equal(obj.counter, 5, 'counter should be incremented five times.');
});
test("binding and triggering multiple events", 4, function() {
var obj = { counter: 0 };
QUnit.test('binding and triggering multiple events', function(assert) {
assert.expect(4);
var obj = {counter: 0};
_.extend(obj, Backbone.Events);
obj.on('a b c', function() { obj.counter += 1; });
obj.trigger('a');
equal(obj.counter, 1);
assert.equal(obj.counter, 1);
obj.trigger('a b');
equal(obj.counter, 3);
assert.equal(obj.counter, 3);
obj.trigger('c');
equal(obj.counter, 4);
assert.equal(obj.counter, 4);
obj.off('a c');
obj.trigger('a b c');
equal(obj.counter, 5);
assert.equal(obj.counter, 5);
});
test("binding and triggering with event maps", function() {
var obj = { counter: 0 };
QUnit.test('binding and triggering with event maps', function(assert) {
var obj = {counter: 0};
_.extend(obj, Backbone.Events);
var increment = function() {
@@ -50,54 +52,85 @@
}, obj);
obj.trigger('a');
equal(obj.counter, 1);
assert.equal(obj.counter, 1);
obj.trigger('a b');
equal(obj.counter, 3);
assert.equal(obj.counter, 3);
obj.trigger('c');
equal(obj.counter, 4);
assert.equal(obj.counter, 4);
obj.off({
a: increment,
c: increment
}, obj);
obj.trigger('a b c');
equal(obj.counter, 5);
assert.equal(obj.counter, 5);
});
test("binding and trigger with event maps context", 2, function() {
var obj = { counter: 0 };
QUnit.test('binding and triggering multiple event names with event maps', function(assert) {
var obj = {counter: 0};
_.extend(obj, Backbone.Events);
var increment = function() {
this.counter += 1;
};
obj.on({
'a b c': increment
});
obj.trigger('a');
assert.equal(obj.counter, 1);
obj.trigger('a b');
assert.equal(obj.counter, 3);
obj.trigger('c');
assert.equal(obj.counter, 4);
obj.off({
'a c': increment
});
obj.trigger('a b c');
assert.equal(obj.counter, 5);
});
QUnit.test('binding and trigger with event maps context', function(assert) {
assert.expect(2);
var obj = {counter: 0};
var context = {};
_.extend(obj, Backbone.Events);
obj.on({
a: function() {
strictEqual(this, context, 'defaults `context` to `callback` param');
}
a: function() {
assert.strictEqual(this, context, 'defaults `context` to `callback` param');
}
}, context).trigger('a');
obj.off().on({
a: function() {
strictEqual(this, context, 'will not override explicit `context` param');
}
a: function() {
assert.strictEqual(this, context, 'will not override explicit `context` param');
}
}, this, context).trigger('a');
});
test("listenTo and stopListening", 1, function() {
QUnit.test('listenTo and stopListening', function(assert) {
assert.expect(1);
var a = _.extend({}, Backbone.Events);
var b = _.extend({}, Backbone.Events);
a.listenTo(b, 'all', function(){ ok(true); });
a.listenTo(b, 'all', function(){ assert.ok(true); });
b.trigger('anything');
a.listenTo(b, 'all', function(){ ok(false); });
a.listenTo(b, 'all', function(){ assert.ok(false); });
a.stopListening();
b.trigger('anything');
});
test("listenTo and stopListening with event maps", 4, function() {
QUnit.test('listenTo and stopListening with event maps', function(assert) {
assert.expect(4);
var a = _.extend({}, Backbone.Events);
var b = _.extend({}, Backbone.Events);
var cb = function(){ ok(true); };
var cb = function(){ assert.ok(true); };
a.listenTo(b, {event: cb});
b.trigger('event');
a.listenTo(b, {event2: cb});
@@ -108,10 +141,11 @@
b.trigger('event event2');
});
test("stopListening with omitted args", 2, function () {
QUnit.test('stopListening with omitted args', function(assert) {
assert.expect(2);
var a = _.extend({}, Backbone.Events);
var b = _.extend({}, Backbone.Events);
var cb = function () { ok(true); };
var cb = function() { assert.ok(true); };
a.listenTo(b, 'event', cb);
b.on('event', cb);
a.listenTo(b, 'event2', cb);
@@ -124,219 +158,237 @@
b.trigger('event2');
});
test("listenToOnce", 2, function() {
QUnit.test('listenToOnce', function(assert) {
assert.expect(2);
// Same as the previous test, but we use once rather than having to explicitly unbind
var obj = { counterA: 0, counterB: 0 };
var obj = {counterA: 0, counterB: 0};
_.extend(obj, Backbone.Events);
var incrA = function(){ obj.counterA += 1; obj.trigger('event'); };
var incrB = function(){ obj.counterB += 1; };
obj.listenToOnce(obj, 'event', incrA);
obj.listenToOnce(obj, 'event', incrB);
obj.trigger('event');
equal(obj.counterA, 1, 'counterA should have only been incremented once.');
equal(obj.counterB, 1, 'counterB should have only been incremented once.');
assert.equal(obj.counterA, 1, 'counterA should have only been incremented once.');
assert.equal(obj.counterB, 1, 'counterB should have only been incremented once.');
});
test("listenToOnce and stopListening", 1, function() {
QUnit.test('listenToOnce and stopListening', function(assert) {
assert.expect(1);
var a = _.extend({}, Backbone.Events);
var b = _.extend({}, Backbone.Events);
a.listenToOnce(b, 'all', function() { ok(true); });
a.listenToOnce(b, 'all', function() { assert.ok(true); });
b.trigger('anything');
b.trigger('anything');
a.listenToOnce(b, 'all', function() { ok(false); });
a.listenToOnce(b, 'all', function() { assert.ok(false); });
a.stopListening();
b.trigger('anything');
});
test("listenTo, listenToOnce and stopListening", 1, function() {
QUnit.test('listenTo, listenToOnce and stopListening', function(assert) {
assert.expect(1);
var a = _.extend({}, Backbone.Events);
var b = _.extend({}, Backbone.Events);
a.listenToOnce(b, 'all', function() { ok(true); });
a.listenToOnce(b, 'all', function() { assert.ok(true); });
b.trigger('anything');
b.trigger('anything');
a.listenTo(b, 'all', function() { ok(false); });
a.listenTo(b, 'all', function() { assert.ok(false); });
a.stopListening();
b.trigger('anything');
});
test("listenTo and stopListening with event maps", 1, function() {
QUnit.test('listenTo and stopListening with event maps', function(assert) {
assert.expect(1);
var a = _.extend({}, Backbone.Events);
var b = _.extend({}, Backbone.Events);
a.listenTo(b, {change: function(){ ok(true); }});
a.listenTo(b, {change: function(){ assert.ok(true); }});
b.trigger('change');
a.listenTo(b, {change: function(){ ok(false); }});
a.listenTo(b, {change: function(){ assert.ok(false); }});
a.stopListening();
b.trigger('change');
});
test("listenTo yourself", 1, function(){
QUnit.test('listenTo yourself', function(assert) {
assert.expect(1);
var e = _.extend({}, Backbone.Events);
e.listenTo(e, "foo", function(){ ok(true); });
e.trigger("foo");
e.listenTo(e, 'foo', function(){ assert.ok(true); });
e.trigger('foo');
});
test("listenTo yourself cleans yourself up with stopListening", 1, function(){
QUnit.test('listenTo yourself cleans yourself up with stopListening', function(assert) {
assert.expect(1);
var e = _.extend({}, Backbone.Events);
e.listenTo(e, "foo", function(){ ok(true); });
e.trigger("foo");
e.listenTo(e, 'foo', function(){ assert.ok(true); });
e.trigger('foo');
e.stopListening();
e.trigger("foo");
e.trigger('foo');
});
test("stopListening cleans up references", 12, function() {
QUnit.test('stopListening cleans up references', function(assert) {
assert.expect(12);
var a = _.extend({}, Backbone.Events);
var b = _.extend({}, Backbone.Events);
var fn = function() {};
b.on('event', fn);
a.listenTo(b, 'event', fn).stopListening();
equal(_.size(a._listeningTo), 0);
equal(_.size(b._events.event), 1);
equal(_.size(b._listeners), 0);
assert.equal(_.size(a._listeningTo), 0);
assert.equal(_.size(b._events.event), 1);
assert.equal(_.size(b._listeners), 0);
a.listenTo(b, 'event', fn).stopListening(b);
equal(_.size(a._listeningTo), 0);
equal(_.size(b._events.event), 1);
equal(_.size(b._listeners), 0);
assert.equal(_.size(a._listeningTo), 0);
assert.equal(_.size(b._events.event), 1);
assert.equal(_.size(b._listeners), 0);
a.listenTo(b, 'event', fn).stopListening(b, 'event');
equal(_.size(a._listeningTo), 0);
equal(_.size(b._events.event), 1);
equal(_.size(b._listeners), 0);
assert.equal(_.size(a._listeningTo), 0);
assert.equal(_.size(b._events.event), 1);
assert.equal(_.size(b._listeners), 0);
a.listenTo(b, 'event', fn).stopListening(b, 'event', fn);
equal(_.size(a._listeningTo), 0);
equal(_.size(b._events.event), 1);
equal(_.size(b._listeners), 0);
assert.equal(_.size(a._listeningTo), 0);
assert.equal(_.size(b._events.event), 1);
assert.equal(_.size(b._listeners), 0);
});
test("stopListening cleans up references from listenToOnce", 12, function() {
QUnit.test('stopListening cleans up references from listenToOnce', function(assert) {
assert.expect(12);
var a = _.extend({}, Backbone.Events);
var b = _.extend({}, Backbone.Events);
var fn = function() {};
b.on('event', fn);
a.listenToOnce(b, 'event', fn).stopListening();
equal(_.size(a._listeningTo), 0);
equal(_.size(b._events.event), 1);
equal(_.size(b._listeners), 0);
assert.equal(_.size(a._listeningTo), 0);
assert.equal(_.size(b._events.event), 1);
assert.equal(_.size(b._listeners), 0);
a.listenToOnce(b, 'event', fn).stopListening(b);
equal(_.size(a._listeningTo), 0);
equal(_.size(b._events.event), 1);
equal(_.size(b._listeners), 0);
assert.equal(_.size(a._listeningTo), 0);
assert.equal(_.size(b._events.event), 1);
assert.equal(_.size(b._listeners), 0);
a.listenToOnce(b, 'event', fn).stopListening(b, 'event');
equal(_.size(a._listeningTo), 0);
equal(_.size(b._events.event), 1);
equal(_.size(b._listeners), 0);
assert.equal(_.size(a._listeningTo), 0);
assert.equal(_.size(b._events.event), 1);
assert.equal(_.size(b._listeners), 0);
a.listenToOnce(b, 'event', fn).stopListening(b, 'event', fn);
equal(_.size(a._listeningTo), 0);
equal(_.size(b._events.event), 1);
equal(_.size(b._listeners), 0);
assert.equal(_.size(a._listeningTo), 0);
assert.equal(_.size(b._events.event), 1);
assert.equal(_.size(b._listeners), 0);
});
test("listenTo and off cleaning up references", 8, function() {
QUnit.test('listenTo and off cleaning up references', function(assert) {
assert.expect(8);
var a = _.extend({}, Backbone.Events);
var b = _.extend({}, Backbone.Events);
var fn = function() {};
a.listenTo(b, 'event', fn);
b.off();
equal(_.size(a._listeningTo), 0);
equal(_.size(b._listeners), 0);
assert.equal(_.size(a._listeningTo), 0);
assert.equal(_.size(b._listeners), 0);
a.listenTo(b, 'event', fn);
b.off('event');
equal(_.size(a._listeningTo), 0);
equal(_.size(b._listeners), 0);
assert.equal(_.size(a._listeningTo), 0);
assert.equal(_.size(b._listeners), 0);
a.listenTo(b, 'event', fn);
b.off(null, fn);
equal(_.size(a._listeningTo), 0);
equal(_.size(b._listeners), 0);
assert.equal(_.size(a._listeningTo), 0);
assert.equal(_.size(b._listeners), 0);
a.listenTo(b, 'event', fn);
b.off(null, null, a);
equal(_.size(a._listeningTo), 0);
equal(_.size(b._listeners), 0);
assert.equal(_.size(a._listeningTo), 0);
assert.equal(_.size(b._listeners), 0);
});
test("listenTo and stopListening cleaning up references", 2, function() {
QUnit.test('listenTo and stopListening cleaning up references', function(assert) {
assert.expect(2);
var a = _.extend({}, Backbone.Events);
var b = _.extend({}, Backbone.Events);
a.listenTo(b, 'all', function(){ ok(true); });
a.listenTo(b, 'all', function(){ assert.ok(true); });
b.trigger('anything');
a.listenTo(b, 'other', function(){ ok(false); });
a.listenTo(b, 'other', function(){ assert.ok(false); });
a.stopListening(b, 'other');
a.stopListening(b, 'all');
equal(_.size(a._listeningTo), 0);
assert.equal(_.size(a._listeningTo), 0);
});
test("listenToOnce without context cleans up references after the event has fired", 2, function() {
QUnit.test('listenToOnce without context cleans up references after the event has fired', function(assert) {
assert.expect(2);
var a = _.extend({}, Backbone.Events);
var b = _.extend({}, Backbone.Events);
a.listenToOnce(b, 'all', function(){ ok(true); });
a.listenToOnce(b, 'all', function(){ assert.ok(true); });
b.trigger('anything');
equal(_.size(a._listeningTo), 0);
assert.equal(_.size(a._listeningTo), 0);
});
test("listenToOnce with event maps cleans up references", 2, function() {
QUnit.test('listenToOnce with event maps cleans up references', function(assert) {
assert.expect(2);
var a = _.extend({}, Backbone.Events);
var b = _.extend({}, Backbone.Events);
a.listenToOnce(b, {
one: function() { ok(true); },
two: function() { ok(false); }
one: function() { assert.ok(true); },
two: function() { assert.ok(false); }
});
b.trigger('one');
equal(_.size(a._listeningTo), 1);
assert.equal(_.size(a._listeningTo), 1);
});
test("listenToOnce with event maps binds the correct `this`", 1, function() {
QUnit.test('listenToOnce with event maps binds the correct `this`', function(assert) {
assert.expect(1);
var a = _.extend({}, Backbone.Events);
var b = _.extend({}, Backbone.Events);
a.listenToOnce(b, {
one: function() { ok(this === a); },
two: function() { ok(false); }
one: function() { assert.ok(this === a); },
two: function() { assert.ok(false); }
});
b.trigger('one');
});
test("listenTo with empty callback doesn't throw an error", 1, function(){
QUnit.test("listenTo with empty callback doesn't throw an error", function(assert) {
assert.expect(1);
var e = _.extend({}, Backbone.Events);
e.listenTo(e, "foo", null);
e.trigger("foo");
ok(true);
e.listenTo(e, 'foo', null);
e.trigger('foo');
assert.ok(true);
});
test("trigger all for each event", 3, function() {
var a, b, obj = { counter: 0 };
QUnit.test('trigger all for each event', function(assert) {
assert.expect(3);
var a, b, obj = {counter: 0};
_.extend(obj, Backbone.Events);
obj.on('all', function(event) {
obj.counter++;
if (event == 'a') a = true;
if (event == 'b') b = true;
if (event === 'a') a = true;
if (event === 'b') b = true;
})
.trigger('a b');
ok(a);
ok(b);
equal(obj.counter, 2);
assert.ok(a);
assert.ok(b);
assert.equal(obj.counter, 2);
});
test("on, then unbind all functions", 1, function() {
var obj = { counter: 0 };
_.extend(obj,Backbone.Events);
QUnit.test('on, then unbind all functions', function(assert) {
assert.expect(1);
var obj = {counter: 0};
_.extend(obj, Backbone.Events);
var callback = function() { obj.counter += 1; };
obj.on('event', callback);
obj.trigger('event');
obj.off('event');
obj.trigger('event');
equal(obj.counter, 1, 'counter should have only been incremented once.');
assert.equal(obj.counter, 1, 'counter should have only been incremented once.');
});
test("bind two callbacks, unbind only one", 2, function() {
var obj = { counterA: 0, counterB: 0 };
_.extend(obj,Backbone.Events);
QUnit.test('bind two callbacks, unbind only one', function(assert) {
assert.expect(2);
var obj = {counterA: 0, counterB: 0};
_.extend(obj, Backbone.Events);
var callback = function() { obj.counterA += 1; };
obj.on('event', callback);
obj.on('event', function() { obj.counterB += 1; });
obj.trigger('event');
obj.off('event', callback);
obj.trigger('event');
equal(obj.counterA, 1, 'counterA should have only been incremented once.');
equal(obj.counterB, 2, 'counterB should have been incremented twice.');
assert.equal(obj.counterA, 1, 'counterA should have only been incremented once.');
assert.equal(obj.counterB, 2, 'counterB should have been incremented twice.');
});
test("unbind a callback in the midst of it firing", 1, function() {
QUnit.test('unbind a callback in the midst of it firing', function(assert) {
assert.expect(1);
var obj = {counter: 0};
_.extend(obj, Backbone.Events);
var callback = function() {
@@ -347,12 +399,13 @@
obj.trigger('event');
obj.trigger('event');
obj.trigger('event');
equal(obj.counter, 1, 'the callback should have been unbound.');
assert.equal(obj.counter, 1, 'the callback should have been unbound.');
});
test("two binds that unbind themeselves", 2, function() {
var obj = { counterA: 0, counterB: 0 };
_.extend(obj,Backbone.Events);
QUnit.test('two binds that unbind themeselves', function(assert) {
assert.expect(2);
var obj = {counterA: 0, counterB: 0};
_.extend(obj, Backbone.Events);
var incrA = function(){ obj.counterA += 1; obj.off('event', incrA); };
var incrB = function(){ obj.counterB += 1; obj.off('event', incrB); };
obj.on('event', incrA);
@@ -360,48 +413,52 @@
obj.trigger('event');
obj.trigger('event');
obj.trigger('event');
equal(obj.counterA, 1, 'counterA should have only been incremented once.');
equal(obj.counterB, 1, 'counterB should have only been incremented once.');
assert.equal(obj.counterA, 1, 'counterA should have only been incremented once.');
assert.equal(obj.counterB, 1, 'counterB should have only been incremented once.');
});
test("bind a callback with a supplied context", 1, function () {
var TestClass = function () {
QUnit.test('bind a callback with a supplied context', function(assert) {
assert.expect(1);
var TestClass = function() {
return this;
};
TestClass.prototype.assertTrue = function () {
ok(true, '`this` was bound to the callback');
TestClass.prototype.assertTrue = function() {
assert.ok(true, '`this` was bound to the callback');
};
var obj = _.extend({},Backbone.Events);
obj.on('event', function () { this.assertTrue(); }, (new TestClass));
var obj = _.extend({}, Backbone.Events);
obj.on('event', function() { this.assertTrue(); }, new TestClass);
obj.trigger('event');
});
test("nested trigger with unbind", 1, function () {
var obj = { counter: 0 };
QUnit.test('nested trigger with unbind', function(assert) {
assert.expect(1);
var obj = {counter: 0};
_.extend(obj, Backbone.Events);
var incr1 = function(){ obj.counter += 1; obj.off('event', incr1); obj.trigger('event'); };
var incr2 = function(){ obj.counter += 1; };
obj.on('event', incr1);
obj.on('event', incr2);
obj.trigger('event');
equal(obj.counter, 3, 'counter should have been incremented three times');
assert.equal(obj.counter, 3, 'counter should have been incremented three times');
});
test("callback list is not altered during trigger", 2, function () {
QUnit.test('callback list is not altered during trigger', function(assert) {
assert.expect(2);
var counter = 0, obj = _.extend({}, Backbone.Events);
var incr = function(){ counter++; };
var incrOn = function(){ obj.on('event all', incr); };
var incrOff = function(){ obj.off('event all', incr); };
obj.on('event all', incrOn).trigger('event');
equal(counter, 0, 'on does not alter callback list');
assert.equal(counter, 0, 'on does not alter callback list');
obj.off().on('event', incrOff).on('event all', incr).trigger('event');
equal(counter, 2, 'off does not alter callback list');
assert.equal(counter, 2, 'off does not alter callback list');
});
test("#1282 - 'all' callback list is retrieved after each event.", 1, function() {
QUnit.test("#1282 - 'all' callback list is retrieved after each event.", function(assert) {
assert.expect(1);
var counter = 0;
var obj = _.extend({}, Backbone.Events);
var incr = function(){ counter++; };
@@ -409,61 +466,68 @@
obj.on('y', incr).on('all', incr);
})
.trigger('x y');
strictEqual(counter, 2);
assert.strictEqual(counter, 2);
});
test("if no callback is provided, `on` is a noop", 0, function() {
QUnit.test('if no callback is provided, `on` is a noop', function(assert) {
assert.expect(0);
_.extend({}, Backbone.Events).on('test').trigger('test');
});
test("if callback is truthy but not a function, `on` should throw an error just like jQuery", 1, function() {
QUnit.test('if callback is truthy but not a function, `on` should throw an error just like jQuery', function(assert) {
assert.expect(1);
var view = _.extend({}, Backbone.Events).on('test', 'noop');
throws(function() {
assert.raises(function() {
view.trigger('test');
});
});
test("remove all events for a specific context", 4, function() {
QUnit.test('remove all events for a specific context', function(assert) {
assert.expect(4);
var obj = _.extend({}, Backbone.Events);
obj.on('x y all', function() { ok(true); });
obj.on('x y all', function() { ok(false); }, obj);
obj.on('x y all', function() { assert.ok(true); });
obj.on('x y all', function() { assert.ok(false); }, obj);
obj.off(null, null, obj);
obj.trigger('x y');
});
test("remove all events for a specific callback", 4, function() {
QUnit.test('remove all events for a specific callback', function(assert) {
assert.expect(4);
var obj = _.extend({}, Backbone.Events);
var success = function() { ok(true); };
var fail = function() { ok(false); };
var success = function() { assert.ok(true); };
var fail = function() { assert.ok(false); };
obj.on('x y all', success);
obj.on('x y all', fail);
obj.off(null, fail);
obj.trigger('x y');
});
test("#1310 - off does not skip consecutive events", 0, function() {
QUnit.test('#1310 - off does not skip consecutive events', function(assert) {
assert.expect(0);
var obj = _.extend({}, Backbone.Events);
obj.on('event', function() { ok(false); }, obj);
obj.on('event', function() { ok(false); }, obj);
obj.on('event', function() { assert.ok(false); }, obj);
obj.on('event', function() { assert.ok(false); }, obj);
obj.off(null, null, obj);
obj.trigger('event');
});
test("once", 2, function() {
QUnit.test('once', function(assert) {
assert.expect(2);
// Same as the previous test, but we use once rather than having to explicitly unbind
var obj = { counterA: 0, counterB: 0 };
var obj = {counterA: 0, counterB: 0};
_.extend(obj, Backbone.Events);
var incrA = function(){ obj.counterA += 1; obj.trigger('event'); };
var incrB = function(){ obj.counterB += 1; };
obj.once('event', incrA);
obj.once('event', incrB);
obj.trigger('event');
equal(obj.counterA, 1, 'counterA should have only been incremented once.');
equal(obj.counterB, 1, 'counterB should have only been incremented once.');
assert.equal(obj.counterA, 1, 'counterA should have only been incremented once.');
assert.equal(obj.counterB, 1, 'counterB should have only been incremented once.');
});
test("once variant one", 3, function() {
var f = function(){ ok(true); };
QUnit.test('once variant one', function(assert) {
assert.expect(3);
var f = function(){ assert.ok(true); };
var a = _.extend({}, Backbone.Events).once('event', f);
var b = _.extend({}, Backbone.Events).on('event', f);
@@ -474,8 +538,9 @@
b.trigger('event');
});
test("once variant two", 3, function() {
var f = function(){ ok(true); };
QUnit.test('once variant two', function(assert) {
assert.expect(3);
var f = function(){ assert.ok(true); };
var obj = _.extend({}, Backbone.Events);
obj
@@ -485,8 +550,9 @@
.trigger('event');
});
test("once with off", 0, function() {
var f = function(){ ok(true); };
QUnit.test('once with off', function(assert) {
assert.expect(0);
var f = function(){ assert.ok(true); };
var obj = _.extend({}, Backbone.Events);
obj.once('event', f);
@@ -494,8 +560,8 @@
obj.trigger('event');
});
test("once with event maps", function() {
var obj = { counter: 0 };
QUnit.test('once with event maps', function(assert) {
var obj = {counter: 0};
_.extend(obj, Backbone.Events);
var increment = function() {
@@ -509,94 +575,103 @@
}, obj);
obj.trigger('a');
equal(obj.counter, 1);
assert.equal(obj.counter, 1);
obj.trigger('a b');
equal(obj.counter, 2);
assert.equal(obj.counter, 2);
obj.trigger('c');
equal(obj.counter, 3);
assert.equal(obj.counter, 3);
obj.trigger('a b c');
equal(obj.counter, 3);
assert.equal(obj.counter, 3);
});
test("once with off only by context", 0, function() {
QUnit.test('once with off only by context', function(assert) {
assert.expect(0);
var context = {};
var obj = _.extend({}, Backbone.Events);
obj.once('event', function(){ ok(false); }, context);
obj.once('event', function(){ assert.ok(false); }, context);
obj.off(null, null, context);
obj.trigger('event');
});
test("Backbone object inherits Events", function() {
ok(Backbone.on === Backbone.Events.on);
QUnit.test('Backbone object inherits Events', function(assert) {
assert.ok(Backbone.on === Backbone.Events.on);
});
asyncTest("once with asynchronous events", 1, function() {
var func = _.debounce(function() { ok(true); start(); }, 50);
QUnit.test('once with asynchronous events', function(assert) {
var done = assert.async();
assert.expect(1);
var func = _.debounce(function() { assert.ok(true); done(); }, 50);
var obj = _.extend({}, Backbone.Events).once('async', func);
obj.trigger('async');
obj.trigger('async');
});
test("once with multiple events.", 2, function() {
QUnit.test('once with multiple events.', function(assert) {
assert.expect(2);
var obj = _.extend({}, Backbone.Events);
obj.once('x y', function() { ok(true); });
obj.once('x y', function() { assert.ok(true); });
obj.trigger('x y');
});
test("Off during iteration with once.", 2, function() {
QUnit.test('Off during iteration with once.', function(assert) {
assert.expect(2);
var obj = _.extend({}, Backbone.Events);
var f = function(){ this.off('event', f); };
obj.on('event', f);
obj.once('event', function(){});
obj.on('event', function(){ ok(true); });
obj.on('event', function(){ assert.ok(true); });
obj.trigger('event');
obj.trigger('event');
});
test("`once` on `all` should work as expected", 1, function() {
QUnit.test('`once` on `all` should work as expected', function(assert) {
assert.expect(1);
Backbone.once('all', function() {
ok(true);
assert.ok(true);
Backbone.trigger('all');
});
Backbone.trigger('all');
});
test("once without a callback is a noop", 0, function() {
QUnit.test('once without a callback is a noop', function(assert) {
assert.expect(0);
_.extend({}, Backbone.Events).once('event').trigger('event');
});
test("listenToOnce without a callback is a noop", 0, function() {
QUnit.test('listenToOnce without a callback is a noop', function(assert) {
assert.expect(0);
var obj = _.extend({}, Backbone.Events);
obj.listenToOnce(obj, 'event').trigger('event');
});
test("event functions are chainable", function() {
QUnit.test('event functions are chainable', function(assert) {
var obj = _.extend({}, Backbone.Events);
var obj2 = _.extend({}, Backbone.Events);
var fn = function() {};
equal(obj, obj.trigger('noeventssetyet'));
equal(obj, obj.off('noeventssetyet'));
equal(obj, obj.stopListening('noeventssetyet'));
equal(obj, obj.on('a', fn));
equal(obj, obj.once('c', fn));
equal(obj, obj.trigger('a'));
equal(obj, obj.listenTo(obj2, 'a', fn));
equal(obj, obj.listenToOnce(obj2, 'b', fn));
equal(obj, obj.off('a c'));
equal(obj, obj.stopListening(obj2, 'a'));
equal(obj, obj.stopListening());
assert.equal(obj, obj.trigger('noeventssetyet'));
assert.equal(obj, obj.off('noeventssetyet'));
assert.equal(obj, obj.stopListening('noeventssetyet'));
assert.equal(obj, obj.on('a', fn));
assert.equal(obj, obj.once('c', fn));
assert.equal(obj, obj.trigger('a'));
assert.equal(obj, obj.listenTo(obj2, 'a', fn));
assert.equal(obj, obj.listenToOnce(obj2, 'b', fn));
assert.equal(obj, obj.off('a c'));
assert.equal(obj, obj.stopListening(obj2, 'a'));
assert.equal(obj, obj.stopListening());
});
test("#3448 - listenToOnce with space-separated events", 2, function() {
QUnit.test('#3448 - listenToOnce with space-separated events', function(assert) {
assert.expect(2);
var one = _.extend({}, Backbone.Events);
var two = _.extend({}, Backbone.Events);
var count = 1;
one.listenToOnce(two, 'x y', function(n) { ok(n === count++); });
one.listenToOnce(two, 'x y', function(n) { assert.ok(n === count++); });
two.trigger('x', 1);
two.trigger('x', 1);
two.trigger('y', 2);

File diff suppressed because it is too large Load Diff

View File

@@ -1,12 +1,13 @@
(function() {
module("Backbone.noConflict");
QUnit.module('Backbone.noConflict');
test('noConflict', 2, function() {
QUnit.test('noConflict', function(assert) {
assert.expect(2);
var noconflictBackbone = Backbone.noConflict();
equal(window.Backbone, undefined, 'Returned window.Backbone');
assert.equal(window.Backbone, undefined, 'Returned window.Backbone');
window.Backbone = noconflictBackbone;
equal(window.Backbone, noconflictBackbone, 'Backbone is still pointing to the original Backbone');
assert.equal(window.Backbone, noconflictBackbone, 'Backbone is still pointing to the original Backbone');
});
})();

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,4 @@
$('body').append(
'<div id="qunit"></div>' +
'<div id="qunit-fixture">' +
'<div id="testElement"><h1>Test</h1></div>' +
'</div>'
);
'<div id="qunit-fixture"></div>'
);

View File

@@ -8,6 +8,8 @@
var pushState = history.pushState;
var replaceState = history.replaceState;
QUnit.config.noglobals = true;
QUnit.testStart(function() {
var env = QUnit.config.current.testEnvironment;

View File

@@ -1,218 +1,236 @@
(function() {
var Library = Backbone.Collection.extend({
url : function() { return '/library'; }
url: function() { return '/library'; }
});
var library;
var attrs = {
title : "The Tempest",
author : "Bill Shakespeare",
length : 123
title: 'The Tempest',
author: 'Bill Shakespeare',
length: 123
};
module("Backbone.sync", {
QUnit.module('Backbone.sync', {
setup : function() {
beforeEach: function(assert) {
library = new Library;
library.create(attrs, {wait: false});
},
teardown: function() {
afterEach: function(assert) {
Backbone.emulateHTTP = false;
}
});
test("read", 4, function() {
QUnit.test('read', function(assert) {
assert.expect(4);
library.fetch();
equal(this.ajaxSettings.url, '/library');
equal(this.ajaxSettings.type, 'GET');
equal(this.ajaxSettings.dataType, 'json');
ok(_.isEmpty(this.ajaxSettings.data));
assert.equal(this.ajaxSettings.url, '/library');
assert.equal(this.ajaxSettings.type, 'GET');
assert.equal(this.ajaxSettings.dataType, 'json');
assert.ok(_.isEmpty(this.ajaxSettings.data));
});
test("passing data", 3, function() {
QUnit.test('passing data', function(assert) {
assert.expect(3);
library.fetch({data: {a: 'a', one: 1}});
equal(this.ajaxSettings.url, '/library');
equal(this.ajaxSettings.data.a, 'a');
equal(this.ajaxSettings.data.one, 1);
assert.equal(this.ajaxSettings.url, '/library');
assert.equal(this.ajaxSettings.data.a, 'a');
assert.equal(this.ajaxSettings.data.one, 1);
});
test("create", 6, function() {
equal(this.ajaxSettings.url, '/library');
equal(this.ajaxSettings.type, 'POST');
equal(this.ajaxSettings.dataType, 'json');
QUnit.test('create', function(assert) {
assert.expect(6);
assert.equal(this.ajaxSettings.url, '/library');
assert.equal(this.ajaxSettings.type, 'POST');
assert.equal(this.ajaxSettings.dataType, 'json');
var data = JSON.parse(this.ajaxSettings.data);
equal(data.title, 'The Tempest');
equal(data.author, 'Bill Shakespeare');
equal(data.length, 123);
assert.equal(data.title, 'The Tempest');
assert.equal(data.author, 'Bill Shakespeare');
assert.equal(data.length, 123);
});
test("update", 7, function() {
QUnit.test('update', function(assert) {
assert.expect(7);
library.first().save({id: '1-the-tempest', author: 'William Shakespeare'});
equal(this.ajaxSettings.url, '/library/1-the-tempest');
equal(this.ajaxSettings.type, 'PUT');
equal(this.ajaxSettings.dataType, 'json');
assert.equal(this.ajaxSettings.url, '/library/1-the-tempest');
assert.equal(this.ajaxSettings.type, 'PUT');
assert.equal(this.ajaxSettings.dataType, 'json');
var data = JSON.parse(this.ajaxSettings.data);
equal(data.id, '1-the-tempest');
equal(data.title, 'The Tempest');
equal(data.author, 'William Shakespeare');
equal(data.length, 123);
assert.equal(data.id, '1-the-tempest');
assert.equal(data.title, 'The Tempest');
assert.equal(data.author, 'William Shakespeare');
assert.equal(data.length, 123);
});
test("update with emulateHTTP and emulateJSON", 7, function() {
QUnit.test('update with emulateHTTP and emulateJSON', function(assert) {
assert.expect(7);
library.first().save({id: '2-the-tempest', author: 'Tim Shakespeare'}, {
emulateHTTP: true,
emulateJSON: true
});
equal(this.ajaxSettings.url, '/library/2-the-tempest');
equal(this.ajaxSettings.type, 'POST');
equal(this.ajaxSettings.dataType, 'json');
equal(this.ajaxSettings.data._method, 'PUT');
assert.equal(this.ajaxSettings.url, '/library/2-the-tempest');
assert.equal(this.ajaxSettings.type, 'POST');
assert.equal(this.ajaxSettings.dataType, 'json');
assert.equal(this.ajaxSettings.data._method, 'PUT');
var data = JSON.parse(this.ajaxSettings.data.model);
equal(data.id, '2-the-tempest');
equal(data.author, 'Tim Shakespeare');
equal(data.length, 123);
assert.equal(data.id, '2-the-tempest');
assert.equal(data.author, 'Tim Shakespeare');
assert.equal(data.length, 123);
});
test("update with just emulateHTTP", 6, function() {
QUnit.test('update with just emulateHTTP', function(assert) {
assert.expect(6);
library.first().save({id: '2-the-tempest', author: 'Tim Shakespeare'}, {
emulateHTTP: true
});
equal(this.ajaxSettings.url, '/library/2-the-tempest');
equal(this.ajaxSettings.type, 'POST');
equal(this.ajaxSettings.contentType, 'application/json');
assert.equal(this.ajaxSettings.url, '/library/2-the-tempest');
assert.equal(this.ajaxSettings.type, 'POST');
assert.equal(this.ajaxSettings.contentType, 'application/json');
var data = JSON.parse(this.ajaxSettings.data);
equal(data.id, '2-the-tempest');
equal(data.author, 'Tim Shakespeare');
equal(data.length, 123);
assert.equal(data.id, '2-the-tempest');
assert.equal(data.author, 'Tim Shakespeare');
assert.equal(data.length, 123);
});
test("update with just emulateJSON", 6, function() {
QUnit.test('update with just emulateJSON', function(assert) {
assert.expect(6);
library.first().save({id: '2-the-tempest', author: 'Tim Shakespeare'}, {
emulateJSON: true
});
equal(this.ajaxSettings.url, '/library/2-the-tempest');
equal(this.ajaxSettings.type, 'PUT');
equal(this.ajaxSettings.contentType, 'application/x-www-form-urlencoded');
assert.equal(this.ajaxSettings.url, '/library/2-the-tempest');
assert.equal(this.ajaxSettings.type, 'PUT');
assert.equal(this.ajaxSettings.contentType, 'application/x-www-form-urlencoded');
var data = JSON.parse(this.ajaxSettings.data.model);
equal(data.id, '2-the-tempest');
equal(data.author, 'Tim Shakespeare');
equal(data.length, 123);
assert.equal(data.id, '2-the-tempest');
assert.equal(data.author, 'Tim Shakespeare');
assert.equal(data.length, 123);
});
test("read model", 3, function() {
QUnit.test('read model', function(assert) {
assert.expect(3);
library.first().save({id: '2-the-tempest', author: 'Tim Shakespeare'});
library.first().fetch();
equal(this.ajaxSettings.url, '/library/2-the-tempest');
equal(this.ajaxSettings.type, 'GET');
ok(_.isEmpty(this.ajaxSettings.data));
assert.equal(this.ajaxSettings.url, '/library/2-the-tempest');
assert.equal(this.ajaxSettings.type, 'GET');
assert.ok(_.isEmpty(this.ajaxSettings.data));
});
test("destroy", 3, function() {
QUnit.test('destroy', function(assert) {
assert.expect(3);
library.first().save({id: '2-the-tempest', author: 'Tim Shakespeare'});
library.first().destroy({wait: true});
equal(this.ajaxSettings.url, '/library/2-the-tempest');
equal(this.ajaxSettings.type, 'DELETE');
equal(this.ajaxSettings.data, null);
assert.equal(this.ajaxSettings.url, '/library/2-the-tempest');
assert.equal(this.ajaxSettings.type, 'DELETE');
assert.equal(this.ajaxSettings.data, null);
});
test("destroy with emulateHTTP", 3, function() {
QUnit.test('destroy with emulateHTTP', function(assert) {
assert.expect(3);
library.first().save({id: '2-the-tempest', author: 'Tim Shakespeare'});
library.first().destroy({
emulateHTTP: true,
emulateJSON: true
});
equal(this.ajaxSettings.url, '/library/2-the-tempest');
equal(this.ajaxSettings.type, 'POST');
equal(JSON.stringify(this.ajaxSettings.data), '{"_method":"DELETE"}');
assert.equal(this.ajaxSettings.url, '/library/2-the-tempest');
assert.equal(this.ajaxSettings.type, 'POST');
assert.equal(JSON.stringify(this.ajaxSettings.data), '{"_method":"DELETE"}');
});
test("urlError", 2, function() {
QUnit.test('urlError', function(assert) {
assert.expect(2);
var model = new Backbone.Model();
throws(function() {
assert.raises(function() {
model.fetch();
});
model.fetch({url: '/one/two'});
equal(this.ajaxSettings.url, '/one/two');
assert.equal(this.ajaxSettings.url, '/one/two');
});
test("#1052 - `options` is optional.", 0, function() {
QUnit.test('#1052 - `options` is optional.', function(assert) {
assert.expect(0);
var model = new Backbone.Model();
model.url = '/test';
Backbone.sync('create', model);
});
test("Backbone.ajax", 1, function() {
QUnit.test('Backbone.ajax', function(assert) {
assert.expect(1);
Backbone.ajax = function(settings){
strictEqual(settings.url, '/test');
assert.strictEqual(settings.url, '/test');
};
var model = new Backbone.Model();
model.url = '/test';
Backbone.sync('create', model);
});
test("Call provided error callback on error.", 1, function() {
QUnit.test('Call provided error callback on error.', function(assert) {
assert.expect(1);
var model = new Backbone.Model;
model.url = '/test';
Backbone.sync('read', model, {
error: function() { ok(true); }
error: function() { assert.ok(true); }
});
this.ajaxSettings.error();
});
test('Use Backbone.emulateHTTP as default.', 2, function() {
QUnit.test('Use Backbone.emulateHTTP as default.', function(assert) {
assert.expect(2);
var model = new Backbone.Model;
model.url = '/test';
Backbone.emulateHTTP = true;
model.sync('create', model);
strictEqual(this.ajaxSettings.emulateHTTP, true);
assert.strictEqual(this.ajaxSettings.emulateHTTP, true);
Backbone.emulateHTTP = false;
model.sync('create', model);
strictEqual(this.ajaxSettings.emulateHTTP, false);
assert.strictEqual(this.ajaxSettings.emulateHTTP, false);
});
test('Use Backbone.emulateJSON as default.', 2, function() {
QUnit.test('Use Backbone.emulateJSON as default.', function(assert) {
assert.expect(2);
var model = new Backbone.Model;
model.url = '/test';
Backbone.emulateJSON = true;
model.sync('create', model);
strictEqual(this.ajaxSettings.emulateJSON, true);
assert.strictEqual(this.ajaxSettings.emulateJSON, true);
Backbone.emulateJSON = false;
model.sync('create', model);
strictEqual(this.ajaxSettings.emulateJSON, false);
assert.strictEqual(this.ajaxSettings.emulateJSON, false);
});
test("#1756 - Call user provided beforeSend function.", 4, function() {
QUnit.test('#1756 - Call user provided beforeSend function.', function(assert) {
assert.expect(4);
Backbone.emulateHTTP = true;
var model = new Backbone.Model;
model.url = '/test';
var xhr = {
setRequestHeader: function(header, value) {
strictEqual(header, 'X-HTTP-Method-Override');
strictEqual(value, 'DELETE');
assert.strictEqual(header, 'X-HTTP-Method-Override');
assert.strictEqual(value, 'DELETE');
}
};
model.sync('delete', model, {
beforeSend: function(_xhr) {
ok(_xhr === xhr);
assert.ok(_xhr === xhr);
return false;
}
});
strictEqual(this.ajaxSettings.beforeSend(xhr), false);
assert.strictEqual(this.ajaxSettings.beforeSend(xhr), false);
});
test('#2928 - Pass along `textStatus` and `errorThrown`.', 2, function() {
QUnit.test('#2928 - Pass along `textStatus` and `errorThrown`.', function(assert) {
assert.expect(2);
var model = new Backbone.Model;
model.url = '/test';
model.on('error', function(model, xhr, options) {
strictEqual(options.textStatus, 'textStatus');
strictEqual(options.errorThrown, 'errorThrown');
model.on('error', function(m, xhr, options) {
assert.strictEqual(options.textStatus, 'textStatus');
assert.strictEqual(options.errorThrown, 'errorThrown');
});
model.fetch();
this.ajaxSettings.error({}, 'textStatus', 'errorThrown');

View File

@@ -2,97 +2,109 @@
var view;
module("Backbone.View", {
QUnit.module('Backbone.View', {
beforeEach: function(assert) {
$('#qunit-fixture').append(
'<div id="testElement"><h1>Test</h1></div>'
);
setup: function() {
view = new Backbone.View({
id : 'test-view',
className : 'test-view',
other : 'non-special-option'
id: 'test-view',
className: 'test-view',
other: 'non-special-option'
});
}
});
test("constructor", 3, function() {
equal(view.el.id, 'test-view');
equal(view.el.className, 'test-view');
equal(view.el.other, void 0);
QUnit.test('constructor', function(assert) {
assert.expect(3);
assert.equal(view.el.id, 'test-view');
assert.equal(view.el.className, 'test-view');
assert.equal(view.el.other, void 0);
});
test("$", 2, function() {
var view = new Backbone.View;
view.setElement('<p><a><b>test</b></a></p>');
var result = view.$('a b');
QUnit.test('$', function(assert) {
assert.expect(2);
var myView = new Backbone.View;
myView.setElement('<p><a><b>test</b></a></p>');
var result = myView.$('a b');
strictEqual(result[0].innerHTML, 'test');
ok(result.length === +result.length);
assert.strictEqual(result[0].innerHTML, 'test');
assert.ok(result.length === +result.length);
});
test("$el", 3, function() {
var view = new Backbone.View;
view.setElement('<p><a><b>test</b></a></p>');
strictEqual(view.el.nodeType, 1);
QUnit.test('$el', function(assert) {
assert.expect(3);
var myView = new Backbone.View;
myView.setElement('<p><a><b>test</b></a></p>');
assert.strictEqual(myView.el.nodeType, 1);
ok(view.$el instanceof Backbone.$);
strictEqual(view.$el[0], view.el);
assert.ok(myView.$el instanceof Backbone.$);
assert.strictEqual(myView.$el[0], myView.el);
});
test("initialize", 1, function() {
QUnit.test('initialize', function(assert) {
assert.expect(1);
var View = Backbone.View.extend({
initialize: function() {
this.one = 1;
}
});
strictEqual(new View().one, 1);
assert.strictEqual(new View().one, 1);
});
test("render", 1, function() {
var view = new Backbone.View;
equal(view.render(), view, '#render returns the view instance');
QUnit.test('render', function(assert) {
assert.expect(1);
var myView = new Backbone.View;
assert.equal(myView.render(), myView, '#render returns the view instance');
});
test("delegateEvents", 6, function() {
QUnit.test('delegateEvents', function(assert) {
assert.expect(6);
var counter1 = 0, counter2 = 0;
var view = new Backbone.View({el: '#testElement'});
view.increment = function(){ counter1++; };
view.$el.on('click', function(){ counter2++; });
var myView = new Backbone.View({el: '#testElement'});
myView.increment = function(){ counter1++; };
myView.$el.on('click', function(){ counter2++; });
var events = {'click h1': 'increment'};
view.delegateEvents(events);
view.$('h1').trigger('click');
equal(counter1, 1);
equal(counter2, 1);
myView.delegateEvents(events);
myView.$('h1').trigger('click');
assert.equal(counter1, 1);
assert.equal(counter2, 1);
view.$('h1').trigger('click');
equal(counter1, 2);
equal(counter2, 2);
myView.$('h1').trigger('click');
assert.equal(counter1, 2);
assert.equal(counter2, 2);
view.delegateEvents(events);
view.$('h1').trigger('click');
equal(counter1, 3);
equal(counter2, 3);
myView.delegateEvents(events);
myView.$('h1').trigger('click');
assert.equal(counter1, 3);
assert.equal(counter2, 3);
});
test("delegate", 3, function() {
var view = new Backbone.View({el: '#testElement'});
view.delegate('click', 'h1', function() {
ok(true);
QUnit.test('delegate', function(assert) {
assert.expect(3);
var myView = new Backbone.View({el: '#testElement'});
myView.delegate('click', 'h1', function() {
assert.ok(true);
});
view.delegate('click', function() {
ok(true);
myView.delegate('click', function() {
assert.ok(true);
});
view.$('h1').trigger('click');
myView.$('h1').trigger('click');
equal(view.delegate(), view, '#delegate returns the view instance');
assert.equal(myView.delegate(), myView, '#delegate returns the view instance');
});
test("delegateEvents allows functions for callbacks", 3, function() {
var view = new Backbone.View({el: '<p></p>'});
view.counter = 0;
QUnit.test('delegateEvents allows functions for callbacks', function(assert) {
assert.expect(3);
var myView = new Backbone.View({el: '<p></p>'});
myView.counter = 0;
var events = {
click: function() {
@@ -100,137 +112,148 @@
}
};
view.delegateEvents(events);
view.$el.trigger('click');
equal(view.counter, 1);
myView.delegateEvents(events);
myView.$el.trigger('click');
assert.equal(myView.counter, 1);
view.$el.trigger('click');
equal(view.counter, 2);
myView.$el.trigger('click');
assert.equal(myView.counter, 2);
view.delegateEvents(events);
view.$el.trigger('click');
equal(view.counter, 3);
myView.delegateEvents(events);
myView.$el.trigger('click');
assert.equal(myView.counter, 3);
});
test("delegateEvents ignore undefined methods", 0, function() {
var view = new Backbone.View({el: '<p></p>'});
view.delegateEvents({'click': 'undefinedMethod'});
view.$el.trigger('click');
QUnit.test('delegateEvents ignore undefined methods', function(assert) {
assert.expect(0);
var myView = new Backbone.View({el: '<p></p>'});
myView.delegateEvents({'click': 'undefinedMethod'});
myView.$el.trigger('click');
});
test("undelegateEvents", 7, function() {
QUnit.test('undelegateEvents', function(assert) {
assert.expect(7);
var counter1 = 0, counter2 = 0;
var view = new Backbone.View({el: '#testElement'});
view.increment = function(){ counter1++; };
view.$el.on('click', function(){ counter2++; });
var myView = new Backbone.View({el: '#testElement'});
myView.increment = function(){ counter1++; };
myView.$el.on('click', function(){ counter2++; });
var events = {'click h1': 'increment'};
view.delegateEvents(events);
view.$('h1').trigger('click');
equal(counter1, 1);
equal(counter2, 1);
myView.delegateEvents(events);
myView.$('h1').trigger('click');
assert.equal(counter1, 1);
assert.equal(counter2, 1);
view.undelegateEvents();
view.$('h1').trigger('click');
equal(counter1, 1);
equal(counter2, 2);
myView.undelegateEvents();
myView.$('h1').trigger('click');
assert.equal(counter1, 1);
assert.equal(counter2, 2);
view.delegateEvents(events);
view.$('h1').trigger('click');
equal(counter1, 2);
equal(counter2, 3);
myView.delegateEvents(events);
myView.$('h1').trigger('click');
assert.equal(counter1, 2);
assert.equal(counter2, 3);
equal(view.undelegateEvents(), view, '#undelegateEvents returns the view instance');
assert.equal(myView.undelegateEvents(), myView, '#undelegateEvents returns the view instance');
});
test("undelegate", 1, function() {
view = new Backbone.View({el: '#testElement'});
view.delegate('click', function() { ok(false); });
view.delegate('click', 'h1', function() { ok(false); });
QUnit.test('undelegate', function(assert) {
assert.expect(1);
var myView = new Backbone.View({el: '#testElement'});
myView.delegate('click', function() { assert.ok(false); });
myView.delegate('click', 'h1', function() { assert.ok(false); });
view.undelegate('click');
myView.undelegate('click');
view.$('h1').trigger('click');
view.$el.trigger('click');
myView.$('h1').trigger('click');
myView.$el.trigger('click');
equal(view.undelegate(), view, '#undelegate returns the view instance');
assert.equal(myView.undelegate(), myView, '#undelegate returns the view instance');
});
test("undelegate with passed handler", 1, function() {
view = new Backbone.View({el: '#testElement'});
var listener = function() { ok(false); };
view.delegate('click', listener);
view.delegate('click', function() { ok(true); });
view.undelegate('click', listener);
view.$el.trigger('click');
QUnit.test('undelegate with passed handler', function(assert) {
assert.expect(1);
var myView = new Backbone.View({el: '#testElement'});
var listener = function() { assert.ok(false); };
myView.delegate('click', listener);
myView.delegate('click', function() { assert.ok(true); });
myView.undelegate('click', listener);
myView.$el.trigger('click');
});
test("undelegate with selector", 2, function() {
view = new Backbone.View({el: '#testElement'});
view.delegate('click', function() { ok(true); });
view.delegate('click', 'h1', function() { ok(false); });
view.undelegate('click', 'h1');
view.$('h1').trigger('click');
view.$el.trigger('click');
QUnit.test('undelegate with selector', function(assert) {
assert.expect(2);
var myView = new Backbone.View({el: '#testElement'});
myView.delegate('click', function() { assert.ok(true); });
myView.delegate('click', 'h1', function() { assert.ok(false); });
myView.undelegate('click', 'h1');
myView.$('h1').trigger('click');
myView.$el.trigger('click');
});
test("undelegate with handler and selector", 2, function() {
view = new Backbone.View({el: '#testElement'});
view.delegate('click', function() { ok(true); });
var handler = function(){ ok(false); };
view.delegate('click', 'h1', handler);
view.undelegate('click', 'h1', handler);
view.$('h1').trigger('click');
view.$el.trigger('click');
QUnit.test('undelegate with handler and selector', function(assert) {
assert.expect(2);
var myView = new Backbone.View({el: '#testElement'});
myView.delegate('click', function() { assert.ok(true); });
var handler = function(){ assert.ok(false); };
myView.delegate('click', 'h1', handler);
myView.undelegate('click', 'h1', handler);
myView.$('h1').trigger('click');
myView.$el.trigger('click');
});
test("tagName can be provided as a string", 1, function() {
QUnit.test('tagName can be provided as a string', function(assert) {
assert.expect(1);
var View = Backbone.View.extend({
tagName: 'span'
});
equal(new View().el.tagName, 'SPAN');
assert.equal(new View().el.tagName, 'SPAN');
});
test("tagName can be provided as a function", 1, function() {
QUnit.test('tagName can be provided as a function', function(assert) {
assert.expect(1);
var View = Backbone.View.extend({
tagName: function() {
return 'p';
}
});
ok(new View().$el.is('p'));
assert.ok(new View().$el.is('p'));
});
test("_ensureElement with DOM node el", 1, function() {
QUnit.test('_ensureElement with DOM node el', function(assert) {
assert.expect(1);
var View = Backbone.View.extend({
el: document.body
});
equal(new View().el, document.body);
assert.equal(new View().el, document.body);
});
test("_ensureElement with string el", 3, function() {
QUnit.test('_ensureElement with string el', function(assert) {
assert.expect(3);
var View = Backbone.View.extend({
el: "body"
el: 'body'
});
strictEqual(new View().el, document.body);
assert.strictEqual(new View().el, document.body);
View = Backbone.View.extend({
el: "#testElement > h1"
el: '#testElement > h1'
});
strictEqual(new View().el, $("#testElement > h1").get(0));
assert.strictEqual(new View().el, $('#testElement > h1').get(0));
View = Backbone.View.extend({
el: "#nonexistent"
el: '#nonexistent'
});
ok(!new View().el);
assert.ok(!new View().el);
});
test("with className and id functions", 2, function() {
QUnit.test('with className and id functions', function(assert) {
assert.expect(2);
var View = Backbone.View.extend({
className: function() {
return 'className';
@@ -240,33 +263,54 @@
}
});
strictEqual(new View().el.className, 'className');
strictEqual(new View().el.id, 'id');
assert.strictEqual(new View().el.className, 'className');
assert.strictEqual(new View().el.id, 'id');
});
test("with attributes", 2, function() {
QUnit.test('with attributes', function(assert) {
assert.expect(2);
var View = Backbone.View.extend({
attributes: {
id: 'id',
'id': 'id',
'class': 'class'
}
});
strictEqual(new View().el.className, 'class');
strictEqual(new View().el.id, 'id');
assert.strictEqual(new View().el.className, 'class');
assert.strictEqual(new View().el.id, 'id');
});
test("with attributes as a function", 1, function() {
QUnit.test('with attributes as a function', function(assert) {
assert.expect(1);
var View = Backbone.View.extend({
attributes: function() {
return {'class': 'dynamic'};
}
});
strictEqual(new View().el.className, 'dynamic');
assert.strictEqual(new View().el.className, 'dynamic');
});
test("multiple views per element", 3, function() {
QUnit.test('should default to className/id properties', function(assert) {
assert.expect(4);
var View = Backbone.View.extend({
className: 'backboneClass',
id: 'backboneId',
attributes: {
'class': 'attributeClass',
'id': 'attributeId'
}
});
var myView = new View;
assert.strictEqual(myView.el.className, 'backboneClass');
assert.strictEqual(myView.el.id, 'backboneId');
assert.strictEqual(myView.$el.attr('class'), 'backboneClass');
assert.strictEqual(myView.$el.attr('id'), 'backboneId');
});
QUnit.test('multiple views per element', function(assert) {
assert.expect(3);
var count = 0;
var $el = $('<p></p>');
@@ -280,105 +324,112 @@
});
var view1 = new View;
$el.trigger("click");
equal(1, count);
$el.trigger('click');
assert.equal(1, count);
var view2 = new View;
$el.trigger("click");
equal(3, count);
$el.trigger('click');
assert.equal(3, count);
view1.delegateEvents();
$el.trigger("click");
equal(5, count);
$el.trigger('click');
assert.equal(5, count);
});
test("custom events", 2, function() {
QUnit.test('custom events', function(assert) {
assert.expect(2);
var View = Backbone.View.extend({
el: $('body'),
events: {
"fake$event": function() { ok(true); }
fake$event: function() { assert.ok(true); }
}
});
var view = new View;
var myView = new View;
$('body').trigger('fake$event').trigger('fake$event');
$('body').off('fake$event');
$('body').trigger('fake$event');
});
test("#1048 - setElement uses provided object.", 2, function() {
QUnit.test('#1048 - setElement uses provided object.', function(assert) {
assert.expect(2);
var $el = $('body');
var view = new Backbone.View({el: $el});
ok(view.$el === $el);
var myView = new Backbone.View({el: $el});
assert.ok(myView.$el === $el);
view.setElement($el = $($el));
ok(view.$el === $el);
myView.setElement($el = $($el));
assert.ok(myView.$el === $el);
});
test("#986 - Undelegate before changing element.", 1, function() {
QUnit.test('#986 - Undelegate before changing element.', function(assert) {
assert.expect(1);
var button1 = $('<button></button>');
var button2 = $('<button></button>');
var View = Backbone.View.extend({
events: {
click: function(e) {
ok(view.el === e.target);
assert.ok(myView.el === e.target);
}
}
});
var view = new View({el: button1});
view.setElement(button2);
var myView = new View({el: button1});
myView.setElement(button2);
button1.trigger('click');
button2.trigger('click');
});
test("#1172 - Clone attributes object", 2, function() {
QUnit.test('#1172 - Clone attributes object', function(assert) {
assert.expect(2);
var View = Backbone.View.extend({
attributes: {foo: 'bar'}
});
var view1 = new View({id: 'foo'});
strictEqual(view1.el.id, 'foo');
assert.strictEqual(view1.el.id, 'foo');
var view2 = new View();
ok(!view2.el.id);
assert.ok(!view2.el.id);
});
test("views stopListening", 0, function() {
QUnit.test('views stopListening', function(assert) {
assert.expect(0);
var View = Backbone.View.extend({
initialize: function() {
this.listenTo(this.model, 'all x', function(){ ok(false); });
this.listenTo(this.collection, 'all x', function(){ ok(false); });
this.listenTo(this.model, 'all x', function(){ assert.ok(false); });
this.listenTo(this.collection, 'all x', function(){ assert.ok(false); });
}
});
var view = new View({
var myView = new View({
model: new Backbone.Model,
collection: new Backbone.Collection
});
view.stopListening();
view.model.trigger('x');
view.collection.trigger('x');
myView.stopListening();
myView.model.trigger('x');
myView.collection.trigger('x');
});
test("Provide function for el.", 2, function() {
QUnit.test('Provide function for el.', function(assert) {
assert.expect(2);
var View = Backbone.View.extend({
el: function() {
return "<p><a></a></p>";
return '<p><a></a></p>';
}
});
var view = new View;
ok(view.$el.is('p'));
ok(view.$el.has('a'));
var myView = new View;
assert.ok(myView.$el.is('p'));
assert.ok(myView.$el.has('a'));
});
test("events passed in options", 1, function() {
QUnit.test('events passed in options', function(assert) {
assert.expect(1);
var counter = 0;
var View = Backbone.View.extend({
@@ -388,50 +439,52 @@
}
});
var view = new View({
var myView = new View({
events: {
'click h1': 'increment'
}
});
view.$('h1').trigger('click').trigger('click');
equal(counter, 2);
myView.$('h1').trigger('click').trigger('click');
assert.equal(counter, 2);
});
test("remove", 2, function() {
var view = new Backbone.View;
QUnit.test('remove', function(assert) {
assert.expect(2);
var myView = new Backbone.View;
document.body.appendChild(view.el);
view.delegate('click', function() { ok(false); });
view.listenTo(view, 'all x', function() { ok(false); });
myView.delegate('click', function() { assert.ok(false); });
myView.listenTo(myView, 'all x', function() { assert.ok(false); });
equal(view.remove(), view, '#remove returns the view instance');
view.$el.trigger('click');
view.trigger('x');
assert.equal(myView.remove(), myView, '#remove returns the view instance');
myView.$el.trigger('click');
myView.trigger('x');
// In IE8 and below, parentNode still exists but is not document.body.
notEqual(view.el.parentNode, document.body);
assert.notEqual(myView.el.parentNode, document.body);
});
test("setElement", 3, function() {
var view = new Backbone.View({
QUnit.test('setElement', function(assert) {
assert.expect(3);
var myView = new Backbone.View({
events: {
click: function() { ok(false); }
click: function() { assert.ok(false); }
}
});
view.events = {
click: function() { ok(true); }
myView.events = {
click: function() { assert.ok(true); }
};
var oldEl = view.el;
var $oldEl = view.$el;
var oldEl = myView.el;
var $oldEl = myView.$el;
view.setElement(document.createElement('div'));
myView.setElement(document.createElement('div'));
$oldEl.click();
view.$el.click();
myView.$el.click();
notEqual(oldEl, view.el);
notEqual($oldEl, view.$el);
assert.notEqual(oldEl, myView.el);
assert.notEqual($oldEl, myView.$el);
});
})();

View File

@@ -1,22 +0,0 @@
Copyright 2010-2015 Mathias Bynens <http://mathiasbynens.be/>
Based on JSLitmus.js, copyright Robert Kieffer <http://broofa.com/>
Modified by John-David Dalton <http://allyoucanleet.com/>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@@ -1,4 +1,4 @@
Copyright (c) 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative
Copyright (c) 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative
Reporters & Editors
Permission is hereby granted, free of charge, to any person

View File

@@ -3,398 +3,399 @@
QUnit.module('Arrays');
test('first', function() {
equal(_.first([1, 2, 3]), 1, 'can pull out the first element of an array');
equal(_([1, 2, 3]).first(), 1, 'can perform OO-style "first()"');
deepEqual(_.first([1, 2, 3], 0), [], 'can pass an index to first');
deepEqual(_.first([1, 2, 3], 2), [1, 2], 'can pass an index to first');
deepEqual(_.first([1, 2, 3], 5), [1, 2, 3], 'can pass an index to first');
QUnit.test('first', function(assert) {
assert.equal(_.first([1, 2, 3]), 1, 'can pull out the first element of an array');
assert.equal(_([1, 2, 3]).first(), 1, 'can perform OO-style "first()"');
assert.deepEqual(_.first([1, 2, 3], 0), [], 'returns an empty array when n <= 0 (0 case)');
assert.deepEqual(_.first([1, 2, 3], -1), [], 'returns an empty array when n <= 0 (negative case)');
assert.deepEqual(_.first([1, 2, 3], 2), [1, 2], 'can fetch the first n elements');
assert.deepEqual(_.first([1, 2, 3], 5), [1, 2, 3], 'returns the whole array if n > length');
var result = (function(){ return _.first(arguments); }(4, 3, 2, 1));
equal(result, 4, 'works on an arguments object.');
assert.equal(result, 4, 'works on an arguments object');
result = _.map([[1, 2, 3], [1, 2, 3]], _.first);
deepEqual(result, [1, 1], 'works well with _.map');
result = (function() { return _.first([1, 2, 3], 2); }());
deepEqual(result, [1, 2]);
equal(_.first(null), undefined, 'handles nulls');
strictEqual(_.first([1, 2, 3], -1).length, 0);
assert.deepEqual(result, [1, 1], 'works well with _.map');
assert.equal(_.first(null), void 0, 'returns undefined when called on null');
});
test('head', function() {
strictEqual(_.first, _.head, 'alias for first');
QUnit.test('head', function(assert) {
assert.strictEqual(_.head, _.first, 'is an alias for first');
});
test('take', function() {
strictEqual(_.first, _.take, 'alias for first');
QUnit.test('take', function(assert) {
assert.strictEqual(_.take, _.first, 'is an alias for first');
});
test('rest', function() {
QUnit.test('rest', function(assert) {
var numbers = [1, 2, 3, 4];
deepEqual(_.rest(numbers), [2, 3, 4], 'working rest()');
deepEqual(_.rest(numbers, 0), [1, 2, 3, 4], 'working rest(0)');
deepEqual(_.rest(numbers, 2), [3, 4], 'rest can take an index');
assert.deepEqual(_.rest(numbers), [2, 3, 4], 'fetches all but the first element');
assert.deepEqual(_.rest(numbers, 0), [1, 2, 3, 4], 'returns the whole array when index is 0');
assert.deepEqual(_.rest(numbers, 2), [3, 4], 'returns elements starting at the given index');
var result = (function(){ return _(arguments).rest(); }(1, 2, 3, 4));
deepEqual(result, [2, 3, 4], 'works on arguments object');
assert.deepEqual(result, [2, 3, 4], 'works on an arguments object');
result = _.map([[1, 2, 3], [1, 2, 3]], _.rest);
deepEqual(_.flatten(result), [2, 3, 2, 3], 'works well with _.map');
result = (function(){ return _(arguments).rest(); }(1, 2, 3, 4));
deepEqual(result, [2, 3, 4], 'works on arguments object');
assert.deepEqual(_.flatten(result), [2, 3, 2, 3], 'works well with _.map');
});
test('tail', function() {
strictEqual(_.rest, _.tail, 'alias for rest');
QUnit.test('tail', function(assert) {
assert.strictEqual(_.tail, _.rest, 'is an alias for rest');
});
test('drop', function() {
strictEqual(_.rest, _.drop, 'alias for rest');
QUnit.test('drop', function(assert) {
assert.strictEqual(_.drop, _.rest, 'is an alias for rest');
});
test('initial', function() {
deepEqual(_.initial([1, 2, 3, 4, 5]), [1, 2, 3, 4], 'working initial()');
deepEqual(_.initial([1, 2, 3, 4], 2), [1, 2], 'initial can take an index');
deepEqual(_.initial([1, 2, 3, 4], 6), [], 'initial can take a large index');
QUnit.test('initial', function(assert) {
assert.deepEqual(_.initial([1, 2, 3, 4, 5]), [1, 2, 3, 4], 'returns all but the last element');
assert.deepEqual(_.initial([1, 2, 3, 4], 2), [1, 2], 'returns all but the last n elements');
assert.deepEqual(_.initial([1, 2, 3, 4], 6), [], 'returns an empty array when n > length');
var result = (function(){ return _(arguments).initial(); }(1, 2, 3, 4));
deepEqual(result, [1, 2, 3], 'initial works on arguments object');
assert.deepEqual(result, [1, 2, 3], 'works on an arguments object');
result = _.map([[1, 2, 3], [1, 2, 3]], _.initial);
deepEqual(_.flatten(result), [1, 2, 1, 2], 'initial works with _.map');
assert.deepEqual(_.flatten(result), [1, 2, 1, 2], 'works well with _.map');
});
test('last', function() {
equal(_.last([1, 2, 3]), 3, 'can pull out the last element of an array');
deepEqual(_.last([1, 2, 3], 0), [], 'can pass an index to last');
deepEqual(_.last([1, 2, 3], 2), [2, 3], 'can pass an index to last');
deepEqual(_.last([1, 2, 3], 5), [1, 2, 3], 'can pass an index to last');
QUnit.test('last', function(assert) {
assert.equal(_.last([1, 2, 3]), 3, 'can pull out the last element of an array');
assert.equal(_([1, 2, 3]).last(), 3, 'can perform OO-style "last()"');
assert.deepEqual(_.last([1, 2, 3], 0), [], 'returns an empty array when n <= 0 (0 case)');
assert.deepEqual(_.last([1, 2, 3], -1), [], 'returns an empty array when n <= 0 (negative case)');
assert.deepEqual(_.last([1, 2, 3], 2), [2, 3], 'can fetch the last n elements');
assert.deepEqual(_.last([1, 2, 3], 5), [1, 2, 3], 'returns the whole array if n > length');
var result = (function(){ return _(arguments).last(); }(1, 2, 3, 4));
equal(result, 4, 'works on an arguments object');
assert.equal(result, 4, 'works on an arguments object');
result = _.map([[1, 2, 3], [1, 2, 3]], _.last);
deepEqual(result, [3, 3], 'works well with _.map');
equal(_.last(null), undefined, 'handles nulls');
strictEqual(_.last([1, 2, 3], -1).length, 0);
assert.deepEqual(result, [3, 3], 'works well with _.map');
assert.equal(_.last(null), void 0, 'returns undefined when called on null');
});
test('compact', function() {
equal(_.compact([0, 1, false, 2, false, 3]).length, 3, 'can trim out all falsy values');
var result = (function(){ return _.compact(arguments).length; }(0, 1, false, 2, false, 3));
equal(result, 3, 'works on an arguments object');
QUnit.test('compact', function(assert) {
assert.deepEqual(_.compact([1, false, null, 0, '', void 0, NaN, 2]), [1, 2], 'removes all falsy values');
var result = (function(){ return _.compact(arguments); }(0, 1, false, 2, false, 3));
assert.deepEqual(result, [1, 2, 3], 'works on an arguments object');
result = _.map([[1, false, false], [false, false, 3]], _.compact);
assert.deepEqual(result, [[1], [3]], 'works well with _.map');
});
test('flatten', function() {
deepEqual(_.flatten(null), [], 'Flattens supports null');
deepEqual(_.flatten(void 0), [], 'Flattens supports undefined');
QUnit.test('flatten', function(assert) {
assert.deepEqual(_.flatten(null), [], 'supports null');
assert.deepEqual(_.flatten(void 0), [], 'supports undefined');
deepEqual(_.flatten([[], [[]], []]), [], 'Flattens empty arrays');
deepEqual(_.flatten([[], [[]], []], true), [[]], 'Flattens empty arrays');
assert.deepEqual(_.flatten([[], [[]], []]), [], 'supports empty arrays');
assert.deepEqual(_.flatten([[], [[]], []], true), [[]], 'can shallowly flatten empty arrays');
var list = [1, [2], [3, [[[4]]]]];
deepEqual(_.flatten(list), [1, 2, 3, 4], 'can flatten nested arrays');
deepEqual(_.flatten(list, true), [1, 2, 3, [[[4]]]], 'can shallowly flatten nested arrays');
assert.deepEqual(_.flatten(list), [1, 2, 3, 4], 'can flatten nested arrays');
assert.deepEqual(_.flatten(list, true), [1, 2, 3, [[[4]]]], 'can shallowly flatten nested arrays');
var result = (function(){ return _.flatten(arguments); }(1, [2], [3, [[[4]]]]));
deepEqual(result, [1, 2, 3, 4], 'works on an arguments object');
assert.deepEqual(result, [1, 2, 3, 4], 'works on an arguments object');
list = [[1], [2], [3], [[4]]];
deepEqual(_.flatten(list, true), [1, 2, 3, [4]], 'can shallowly flatten arrays containing only other arrays');
assert.deepEqual(_.flatten(list, true), [1, 2, 3, [4]], 'can shallowly flatten arrays containing only other arrays');
equal(_.flatten([_.range(10), _.range(10), 5, 1, 3], true).length, 23);
equal(_.flatten([_.range(10), _.range(10), 5, 1, 3]).length, 23);
equal(_.flatten([new Array(1000000), _.range(56000), 5, 1, 3]).length, 1056003, 'Flatten can handle massive collections');
equal(_.flatten([new Array(1000000), _.range(56000), 5, 1, 3], true).length, 1056003, 'Flatten can handle massive collections');
assert.equal(_.flatten([_.range(10), _.range(10), 5, 1, 3], true).length, 23, 'can flatten medium length arrays');
assert.equal(_.flatten([_.range(10), _.range(10), 5, 1, 3]).length, 23, 'can shallowly flatten medium length arrays');
assert.equal(_.flatten([new Array(1000000), _.range(56000), 5, 1, 3]).length, 1056003, 'can handle massive arrays');
assert.equal(_.flatten([new Array(1000000), _.range(56000), 5, 1, 3], true).length, 1056003, 'can handle massive arrays in shallow mode');
var x = _.range(100000);
for (var i = 0; i < 1000; i++) x = [x];
assert.deepEqual(_.flatten(x), _.range(100000), 'can handle very deep arrays');
assert.deepEqual(_.flatten(x, true), x[0], 'can handle very deep arrays in shallow mode');
});
test('without', function() {
QUnit.test('without', function(assert) {
var list = [1, 2, 1, 0, 3, 1, 4];
deepEqual(_.without(list, 0, 1), [2, 3, 4], 'can remove all instances of an object');
assert.deepEqual(_.without(list, 0, 1), [2, 3, 4], 'removes all instances of the given values');
var result = (function(){ return _.without(arguments, 0, 1); }(1, 2, 1, 0, 3, 1, 4));
deepEqual(result, [2, 3, 4], 'works on an arguments object');
assert.deepEqual(result, [2, 3, 4], 'works on an arguments object');
list = [{one : 1}, {two : 2}];
equal(_.without(list, {one : 1}).length, 2, 'uses real object identity for comparisons.');
equal(_.without(list, list[0]).length, 1, 'ditto.');
list = [{one: 1}, {two: 2}];
assert.deepEqual(_.without(list, {one: 1}), list, 'compares objects by reference (value case)');
assert.deepEqual(_.without(list, list[0]), [{two: 2}], 'compares objects by reference (reference case)');
});
test('sortedIndex', function() {
var numbers = [10, 20, 30, 40, 50], num = 35;
var indexForNum = _.sortedIndex(numbers, num);
equal(indexForNum, 3, '35 should be inserted at index 3');
QUnit.test('sortedIndex', function(assert) {
var numbers = [10, 20, 30, 40, 50];
var indexFor35 = _.sortedIndex(numbers, 35);
assert.equal(indexFor35, 3, 'finds the index at which a value should be inserted to retain order');
var indexFor30 = _.sortedIndex(numbers, 30);
equal(indexFor30, 2, '30 should be inserted at index 2');
assert.equal(indexFor30, 2, 'finds the smallest index at which a value could be inserted to retain order');
var objects = [{x: 10}, {x: 20}, {x: 30}, {x: 40}];
var iterator = function(obj){ return obj.x; };
strictEqual(_.sortedIndex(objects, {x: 25}, iterator), 2);
strictEqual(_.sortedIndex(objects, {x: 35}, 'x'), 3);
assert.strictEqual(_.sortedIndex(objects, {x: 25}, iterator), 2, 'uses the result of `iterator` for order comparisons');
assert.strictEqual(_.sortedIndex(objects, {x: 35}, 'x'), 3, 'when `iterator` is a string, uses that key for order comparisons');
var context = {1: 2, 2: 3, 3: 4};
iterator = function(obj){ return this[obj]; };
strictEqual(_.sortedIndex([1, 3], 2, iterator, context), 1);
assert.strictEqual(_.sortedIndex([1, 3], 2, iterator, context), 1, 'can execute its iterator in the given context');
var values = [0, 1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767, 65535, 131071, 262143, 524287, 1048575, 2097151, 4194303, 8388607, 16777215, 33554431, 67108863, 134217727, 268435455, 536870911, 1073741823, 2147483647];
var array = Array(Math.pow(2, 32) - 1);
var values = [0, 1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767, 65535, 131071, 262143, 524287,
1048575, 2097151, 4194303, 8388607, 16777215, 33554431, 67108863, 134217727, 268435455, 536870911, 1073741823, 2147483647];
var largeArray = Array(Math.pow(2, 32) - 1);
var length = values.length;
// Sparsely populate `array`
while (length--) {
array[values[length]] = values[length];
largeArray[values[length]] = values[length];
}
equal(_.sortedIndex(array, 2147483648), 2147483648, 'should work with large indexes');
assert.equal(_.sortedIndex(largeArray, 2147483648), 2147483648, 'works with large indexes');
});
test('uniq', function() {
QUnit.test('uniq', function(assert) {
var list = [1, 2, 1, 3, 1, 4];
deepEqual(_.uniq(list), [1, 2, 3, 4], 'can find the unique values of an unsorted array');
assert.deepEqual(_.uniq(list), [1, 2, 3, 4], 'can find the unique values of an unsorted array');
list = [1, 1, 1, 2, 2, 3];
deepEqual(_.uniq(list, true), [1, 2, 3], 'can find the unique values of a sorted array faster');
assert.deepEqual(_.uniq(list, true), [1, 2, 3], 'can find the unique values of a sorted array faster');
list = [{name: 'moe'}, {name: 'curly'}, {name: 'larry'}, {name: 'curly'}];
var iterator = function(value) { return value.name; };
deepEqual(_.map(_.uniq(list, false, iterator), iterator), ['moe', 'curly', 'larry'], 'can find the unique values of an array using a custom iterator');
list = [{name: 'Moe'}, {name: 'Curly'}, {name: 'Larry'}, {name: 'Curly'}];
var expected = [{name: 'Moe'}, {name: 'Curly'}, {name: 'Larry'}];
var iterator = function(stooge) { return stooge.name; };
assert.deepEqual(_.uniq(list, false, iterator), expected, 'uses the result of `iterator` for uniqueness comparisons (unsorted case)');
assert.deepEqual(_.uniq(list, iterator), expected, '`sorted` argument defaults to false when omitted');
assert.deepEqual(_.uniq(list, 'name'), expected, 'when `iterator` is a string, uses that key for comparisons (unsorted case)');
deepEqual(_.map(_.uniq(list, iterator), iterator), ['moe', 'curly', 'larry'], 'can find the unique values of an array using a custom iterator without specifying whether array is sorted');
iterator = function(value) { return value + 1; };
list = [1, 2, 2, 3, 4, 4];
deepEqual(_.uniq(list, true, iterator), [1, 2, 3, 4], 'iterator works with sorted array');
var kittens = [
{kitten: 'Celery', cuteness: 8},
{kitten: 'Juniper', cuteness: 10},
{kitten: 'Spottis', cuteness: 10}
];
var expected = [
{kitten: 'Celery', cuteness: 8},
{kitten: 'Juniper', cuteness: 10}
];
deepEqual(_.uniq(kittens, true, 'cuteness'), expected, 'string iterator works with sorted array');
list = [{score: 8}, {score: 10}, {score: 10}];
expected = [{score: 8}, {score: 10}];
iterator = function(item) { return item.score; };
assert.deepEqual(_.uniq(list, true, iterator), expected, 'uses the result of `iterator` for uniqueness comparisons (sorted case)');
assert.deepEqual(_.uniq(list, true, 'score'), expected, 'when `iterator` is a string, uses that key for comparisons (sorted case)');
assert.deepEqual(_.uniq([{0: 1}, {0: 1}, {0: 1}, {0: 2}], 0), [{0: 1}, {0: 2}], 'can use falsey pluck like iterator');
var result = (function(){ return _.uniq(arguments); }(1, 2, 1, 3, 1, 4));
deepEqual(result, [1, 2, 3, 4], 'works on an arguments object');
assert.deepEqual(result, [1, 2, 3, 4], 'works on an arguments object');
var a = {}, b = {}, c = {};
deepEqual(_.uniq([a, b, a, b, c]), [a, b, c], 'works on values that can be tested for equivalency but not ordered');
assert.deepEqual(_.uniq([a, b, a, b, c]), [a, b, c], 'works on values that can be tested for equivalency but not ordered');
deepEqual(_.uniq(null), []);
assert.deepEqual(_.uniq(null), [], 'returns an empty array when `array` is not iterable');
var context = {};
list = [3];
_.uniq(list, function(value, index, array) {
strictEqual(this, context);
strictEqual(value, 3);
strictEqual(index, 0);
strictEqual(array, list);
assert.strictEqual(this, context, 'executes its iterator in the given context');
assert.strictEqual(value, 3, 'passes its iterator the value');
assert.strictEqual(index, 0, 'passes its iterator the index');
assert.strictEqual(array, list, 'passes its iterator the entire array');
}, context);
deepEqual(_.uniq([{a: 1, b: 1}, {a: 1, b: 2}, {a: 1, b: 3}, {a: 2, b: 1}], 'a'), [{a: 1, b: 1}, {a: 2, b: 1}], 'can use pluck like iterator');
deepEqual(_.uniq([{0: 1, b: 1}, {0: 1, b: 2}, {0: 1, b: 3}, {0: 2, b: 1}], 0), [{0: 1, b: 1}, {0: 2, b: 1}], 'can use falsey pluck like iterator');
});
test('unique', function() {
strictEqual(_.uniq, _.unique, 'alias for uniq');
QUnit.test('unique', function(assert) {
assert.strictEqual(_.unique, _.uniq, 'is an alias for uniq');
});
test('intersection', function() {
QUnit.test('intersection', function(assert) {
var stooges = ['moe', 'curly', 'larry'], leaders = ['moe', 'groucho'];
deepEqual(_.intersection(stooges, leaders), ['moe'], 'can take the set intersection of two arrays');
deepEqual(_(stooges).intersection(leaders), ['moe'], 'can perform an OO-style intersection');
assert.deepEqual(_.intersection(stooges, leaders), ['moe'], 'can find the set intersection of two arrays');
assert.deepEqual(_(stooges).intersection(leaders), ['moe'], 'can perform an OO-style intersection');
var result = (function(){ return _.intersection(arguments, leaders); }('moe', 'curly', 'larry'));
deepEqual(result, ['moe'], 'works on an arguments object');
assert.deepEqual(result, ['moe'], 'works on an arguments object');
var theSixStooges = ['moe', 'moe', 'curly', 'curly', 'larry', 'larry'];
deepEqual(_.intersection(theSixStooges, leaders), ['moe'], 'returns a duplicate-free array');
assert.deepEqual(_.intersection(theSixStooges, leaders), ['moe'], 'returns a duplicate-free array');
result = _.intersection([2, 4, 3, 1], [1, 2, 3]);
deepEqual(result, [2, 3, 1], 'preserves order of first array');
assert.deepEqual(result, [2, 3, 1], 'preserves the order of the first array');
result = _.intersection(null, [1, 2, 3]);
equal(Object.prototype.toString.call(result), '[object Array]', 'returns an empty array when passed null as first argument');
equal(result.length, 0, 'returns an empty array when passed null as first argument');
assert.deepEqual(result, [], 'returns an empty array when passed null as the first argument');
result = _.intersection([1, 2, 3], null);
equal(Object.prototype.toString.call(result), '[object Array]', 'returns an empty array when passed null as argument beyond the first');
equal(result.length, 0, 'returns an empty array when passed null as argument beyond the first');
assert.deepEqual(result, [], 'returns an empty array when passed null as an argument beyond the first');
});
test('union', function() {
QUnit.test('union', function(assert) {
var result = _.union([1, 2, 3], [2, 30, 1], [1, 40]);
deepEqual(result, [1, 2, 3, 30, 40], 'takes the union of a list of arrays');
assert.deepEqual(result, [1, 2, 3, 30, 40], 'can find the union of a list of arrays');
result = _([1, 2, 3]).union([2, 30, 1], [1, 40]);
assert.deepEqual(result, [1, 2, 3, 30, 40], 'can perform an OO-style union');
result = _.union([1, 2, 3], [2, 30, 1], [1, 40, [1]]);
deepEqual(result, [1, 2, 3, 30, 40, [1]], 'takes the union of a list of nested arrays');
assert.deepEqual(result, [1, 2, 3, 30, 40, [1]], 'can find the union of a list of nested arrays');
var args = null;
(function(){ args = arguments; }(1, 2, 3));
result = _.union(args, [2, 30, 1], [1, 40]);
deepEqual(result, [1, 2, 3, 30, 40], 'takes the union of a list of arrays');
result = _.union([10, 20], [1, 30, 10], [0, 40]);
assert.deepEqual(result, [10, 20, 1, 30, 0, 40], 'orders values by their first encounter');
result = _.union([1, 2, 3], 4);
deepEqual(result, [1, 2, 3], 'restrict the union to arrays only');
result = (function(){ return _.union(arguments, [2, 30, 1], [1, 40]); }(1, 2, 3));
assert.deepEqual(result, [1, 2, 3, 30, 40], 'works on an arguments object');
assert.deepEqual(_.union([1, 2, 3], 4), [1, 2, 3], 'restricts the union to arrays only');
});
test('difference', function() {
QUnit.test('difference', function(assert) {
var result = _.difference([1, 2, 3], [2, 30, 40]);
deepEqual(result, [1, 3], 'takes the difference of two arrays');
assert.deepEqual(result, [1, 3], 'can find the difference of two arrays');
result = _([1, 2, 3]).difference([2, 30, 40]);
assert.deepEqual(result, [1, 3], 'can perform an OO-style difference');
result = _.difference([1, 2, 3, 4], [2, 30, 40], [1, 11, 111]);
deepEqual(result, [3, 4], 'takes the difference of three arrays');
assert.deepEqual(result, [3, 4], 'can find the difference of three arrays');
result = _.difference([8, 9, 3, 1], [3, 8]);
assert.deepEqual(result, [9, 1], 'preserves the order of the first array');
result = (function(){ return _.difference(arguments, [2, 30, 40]); }(1, 2, 3));
assert.deepEqual(result, [1, 3], 'works on an arguments object');
result = _.difference([1, 2, 3], 1);
deepEqual(result, [1, 2, 3], 'restrict the difference to arrays only');
assert.deepEqual(result, [1, 2, 3], 'restrict the difference to arrays only');
});
test('zip', function() {
QUnit.test('zip', function(assert) {
var names = ['moe', 'larry', 'curly'], ages = [30, 40, 50], leaders = [true];
deepEqual(_.zip(names, ages, leaders), [
assert.deepEqual(_.zip(names, ages, leaders), [
['moe', 30, true],
['larry', 40, undefined],
['curly', 50, undefined]
['larry', 40, void 0],
['curly', 50, void 0]
], 'zipped together arrays of different lengths');
var stooges = _.zip(['moe', 30, 'stooge 1'], ['larry', 40, 'stooge 2'], ['curly', 50, 'stooge 3']);
deepEqual(stooges, [['moe', 'larry', 'curly'], [30, 40, 50], ['stooge 1', 'stooge 2', 'stooge 3']], 'zipped pairs');
assert.deepEqual(stooges, [['moe', 'larry', 'curly'], [30, 40, 50], ['stooge 1', 'stooge 2', 'stooge 3']], 'zipped pairs');
// In the case of difference lengths of the tuples undefineds
// In the case of different lengths of the tuples, undefined values
// should be used as placeholder
stooges = _.zip(['moe', 30], ['larry', 40], ['curly', 50, 'extra data']);
deepEqual(stooges, [['moe', 'larry', 'curly'], [30, 40, 50], [undefined, undefined, 'extra data']], 'zipped pairs with empties');
assert.deepEqual(stooges, [['moe', 'larry', 'curly'], [30, 40, 50], [void 0, void 0, 'extra data']], 'zipped pairs with empties');
var empty = _.zip([]);
deepEqual(empty, [], 'unzipped empty');
assert.deepEqual(empty, [], 'unzipped empty');
deepEqual(_.zip(null), [], 'handles null');
deepEqual(_.zip(), [], '_.zip() returns []');
assert.deepEqual(_.zip(null), [], 'handles null');
assert.deepEqual(_.zip(), [], '_.zip() returns []');
});
test('unzip', function() {
deepEqual(_.unzip(null), [], 'handles null');
QUnit.test('unzip', function(assert) {
assert.deepEqual(_.unzip(null), [], 'handles null');
deepEqual(_.unzip([['a', 'b'], [1, 2]]), [['a', 1], ['b', 2]]);
assert.deepEqual(_.unzip([['a', 'b'], [1, 2]]), [['a', 1], ['b', 2]]);
// complements zip
var zipped = _.zip(['fred', 'barney'], [30, 40], [true, false]);
deepEqual(_.unzip(zipped), [['fred', 'barney'], [30, 40], [true, false]]);
assert.deepEqual(_.unzip(zipped), [['fred', 'barney'], [30, 40], [true, false]]);
zipped = _.zip(['moe', 30], ['larry', 40], ['curly', 50, 'extra data']);
deepEqual(_.unzip(zipped), [['moe', 30, void 0], ['larry', 40, void 0], ['curly', 50, 'extra data']], 'Uses length of largest array');
assert.deepEqual(_.unzip(zipped), [['moe', 30, void 0], ['larry', 40, void 0], ['curly', 50, 'extra data']], 'Uses length of largest array');
});
test('object', function() {
QUnit.test('object', function(assert) {
var result = _.object(['moe', 'larry', 'curly'], [30, 40, 50]);
var shouldBe = {moe: 30, larry: 40, curly: 50};
deepEqual(result, shouldBe, 'two arrays zipped together into an object');
assert.deepEqual(result, shouldBe, 'two arrays zipped together into an object');
result = _.object([['one', 1], ['two', 2], ['three', 3]]);
shouldBe = {one: 1, two: 2, three: 3};
deepEqual(result, shouldBe, 'an array of pairs zipped together into an object');
assert.deepEqual(result, shouldBe, 'an array of pairs zipped together into an object');
var stooges = {moe: 30, larry: 40, curly: 50};
deepEqual(_.object(_.pairs(stooges)), stooges, 'an object converted to pairs and back to an object');
assert.deepEqual(_.object(_.pairs(stooges)), stooges, 'an object converted to pairs and back to an object');
deepEqual(_.object(null), {}, 'handles nulls');
assert.deepEqual(_.object(null), {}, 'handles nulls');
});
test('indexOf', function() {
QUnit.test('indexOf', function(assert) {
var numbers = [1, 2, 3];
equal(_.indexOf(numbers, 2), 1, 'can compute indexOf');
assert.equal(_.indexOf(numbers, 2), 1, 'can compute indexOf');
var result = (function(){ return _.indexOf(arguments, 2); }(1, 2, 3));
equal(result, 1, 'works on an arguments object');
assert.equal(result, 1, 'works on an arguments object');
_.each([null, void 0, [], false], function(val) {
var msg = 'Handles: ' + (_.isArray(val) ? '[]' : val);
equal(_.indexOf(val, 2), -1, msg);
equal(_.indexOf(val, 2, -1), -1, msg);
equal(_.indexOf(val, 2, -20), -1, msg);
equal(_.indexOf(val, 2, 15), -1, msg);
assert.equal(_.indexOf(val, 2), -1, msg);
assert.equal(_.indexOf(val, 2, -1), -1, msg);
assert.equal(_.indexOf(val, 2, -20), -1, msg);
assert.equal(_.indexOf(val, 2, 15), -1, msg);
});
var num = 35;
numbers = [10, 20, 30, 40, 50];
var index = _.indexOf(numbers, num, true);
equal(index, -1, '35 is not in the list');
assert.equal(index, -1, '35 is not in the list');
numbers = [10, 20, 30, 40, 50]; num = 40;
index = _.indexOf(numbers, num, true);
equal(index, 3, '40 is in the list');
assert.equal(index, 3, '40 is in the list');
numbers = [1, 40, 40, 40, 40, 40, 40, 40, 50, 60, 70]; num = 40;
equal(_.indexOf(numbers, num, true), 1, '40 is in the list');
equal(_.indexOf(numbers, 6, true), -1, '6 isnt in the list');
equal(_.indexOf([1, 2, 5, 4, 6, 7], 5, true), -1, 'sorted indexOf doesn\'t uses binary search');
ok(_.every(['1', [], {}, null], function() {
assert.equal(_.indexOf(numbers, num, true), 1, '40 is in the list');
assert.equal(_.indexOf(numbers, 6, true), -1, '6 isnt in the list');
assert.equal(_.indexOf([1, 2, 5, 4, 6, 7], 5, true), -1, 'sorted indexOf doesn\'t uses binary search');
assert.ok(_.every(['1', [], {}, null], function() {
return _.indexOf(numbers, num, {}) === 1;
}), 'non-nums as fromIndex make indexOf assume sorted');
numbers = [1, 2, 3, 1, 2, 3, 1, 2, 3];
index = _.indexOf(numbers, 2, 5);
equal(index, 7, 'supports the fromIndex argument');
assert.equal(index, 7, 'supports the fromIndex argument');
index = _.indexOf([,,,], undefined);
equal(index, 0, 'treats sparse arrays as if they were dense');
index = _.indexOf([,,, 0], void 0);
assert.equal(index, 0, 'treats sparse arrays as if they were dense');
var array = [1, 2, 3, 1, 2, 3];
strictEqual(_.indexOf(array, 1, -3), 3, 'neg `fromIndex` starts at the right index');
strictEqual(_.indexOf(array, 1, -2), -1, 'neg `fromIndex` starts at the right index');
strictEqual(_.indexOf(array, 2, -3), 4);
assert.strictEqual(_.indexOf(array, 1, -3), 3, 'neg `fromIndex` starts at the right index');
assert.strictEqual(_.indexOf(array, 1, -2), -1, 'neg `fromIndex` starts at the right index');
assert.strictEqual(_.indexOf(array, 2, -3), 4);
_.each([-6, -8, -Infinity], function(fromIndex) {
strictEqual(_.indexOf(array, 1, fromIndex), 0);
assert.strictEqual(_.indexOf(array, 1, fromIndex), 0);
});
strictEqual(_.indexOf([1, 2, 3], 1, true), 0);
assert.strictEqual(_.indexOf([1, 2, 3], 1, true), 0);
index = _.indexOf([], undefined, true);
equal(index, -1, 'empty array with truthy `isSorted` returns -1');
index = _.indexOf([], void 0, true);
assert.equal(index, -1, 'empty array with truthy `isSorted` returns -1');
});
test('indexOf with NaN', function() {
strictEqual(_.indexOf([1, 2, NaN, NaN], NaN), 2, 'Expected [1, 2, NaN] to contain NaN');
strictEqual(_.indexOf([1, 2, Infinity], NaN), -1, 'Expected [1, 2, NaN] to contain NaN');
QUnit.test('indexOf with NaN', function(assert) {
assert.strictEqual(_.indexOf([1, 2, NaN, NaN], NaN), 2, 'Expected [1, 2, NaN] to contain NaN');
assert.strictEqual(_.indexOf([1, 2, Infinity], NaN), -1, 'Expected [1, 2, NaN] to contain NaN');
strictEqual(_.indexOf([1, 2, NaN, NaN], NaN, 1), 2, 'startIndex does not affect result');
strictEqual(_.indexOf([1, 2, NaN, NaN], NaN, -2), 2, 'startIndex does not affect result');
assert.strictEqual(_.indexOf([1, 2, NaN, NaN], NaN, 1), 2, 'startIndex does not affect result');
assert.strictEqual(_.indexOf([1, 2, NaN, NaN], NaN, -2), 2, 'startIndex does not affect result');
(function() {
strictEqual(_.indexOf(arguments, NaN), 2, 'Expected arguments [1, 2, NaN] to contain NaN');
assert.strictEqual(_.indexOf(arguments, NaN), 2, 'Expected arguments [1, 2, NaN] to contain NaN');
}(1, 2, NaN, NaN));
});
test('indexOf with +- 0', function() {
QUnit.test('indexOf with +- 0', function(assert) {
_.each([-0, +0], function(val) {
strictEqual(_.indexOf([1, 2, val, val], val), 2);
strictEqual(_.indexOf([1, 2, val, val], -val), 2);
assert.strictEqual(_.indexOf([1, 2, val, val], val), 2);
assert.strictEqual(_.indexOf([1, 2, val, val], -val), 2);
});
});
test('lastIndexOf', function() {
QUnit.test('lastIndexOf', function(assert) {
var numbers = [1, 0, 1];
var falsey = [void 0, '', 0, false, NaN, null, undefined];
equal(_.lastIndexOf(numbers, 1), 2);
var falsey = [void 0, '', 0, false, NaN, null, void 0];
assert.equal(_.lastIndexOf(numbers, 1), 2);
numbers = [1, 0, 1, 0, 0, 1, 0, 0, 0];
numbers.lastIndexOf = null;
equal(_.lastIndexOf(numbers, 1), 5, 'can compute lastIndexOf, even without the native function');
equal(_.lastIndexOf(numbers, 0), 8, 'lastIndexOf the other element');
assert.equal(_.lastIndexOf(numbers, 1), 5, 'can compute lastIndexOf, even without the native function');
assert.equal(_.lastIndexOf(numbers, 0), 8, 'lastIndexOf the other element');
var result = (function(){ return _.lastIndexOf(arguments, 1); }(1, 0, 1, 0, 0, 1, 0, 0, 0));
equal(result, 5, 'works on an arguments object');
assert.equal(result, 5, 'works on an arguments object');
_.each([null, void 0, [], false], function(val) {
var msg = 'Handles: ' + (_.isArray(val) ? '[]' : val);
equal(_.lastIndexOf(val, 2), -1, msg);
equal(_.lastIndexOf(val, 2, -1), -1, msg);
equal(_.lastIndexOf(val, 2, -20), -1, msg);
equal(_.lastIndexOf(val, 2, 15), -1, msg);
assert.equal(_.lastIndexOf(val, 2), -1, msg);
assert.equal(_.lastIndexOf(val, 2, -1), -1, msg);
assert.equal(_.lastIndexOf(val, 2, -20), -1, msg);
assert.equal(_.lastIndexOf(val, 2, 15), -1, msg);
});
numbers = [1, 2, 3, 1, 2, 3, 1, 2, 3];
var index = _.lastIndexOf(numbers, 2, 2);
equal(index, 1, 'supports the fromIndex argument');
assert.equal(index, 1, 'supports the fromIndex argument');
var array = [1, 2, 3, 1, 2, 3];
strictEqual(_.lastIndexOf(array, 1, 0), 0, 'starts at the correct from idx');
strictEqual(_.lastIndexOf(array, 3), 5, 'should return the index of the last matched value');
strictEqual(_.lastIndexOf(array, 4), -1, 'should return `-1` for an unmatched value');
assert.strictEqual(_.lastIndexOf(array, 1, 0), 0, 'starts at the correct from idx');
assert.strictEqual(_.lastIndexOf(array, 3), 5, 'should return the index of the last matched value');
assert.strictEqual(_.lastIndexOf(array, 4), -1, 'should return `-1` for an unmatched value');
strictEqual(_.lastIndexOf(array, 1, 2), 0, 'should work with a positive `fromIndex`');
assert.strictEqual(_.lastIndexOf(array, 1, 2), 0, 'should work with a positive `fromIndex`');
_.each([6, 8, Math.pow(2, 32), Infinity], function(fromIndex) {
strictEqual(_.lastIndexOf(array, undefined, fromIndex), -1);
strictEqual(_.lastIndexOf(array, 1, fromIndex), 3);
strictEqual(_.lastIndexOf(array, '', fromIndex), -1);
assert.strictEqual(_.lastIndexOf(array, void 0, fromIndex), -1);
assert.strictEqual(_.lastIndexOf(array, 1, fromIndex), 3);
assert.strictEqual(_.lastIndexOf(array, '', fromIndex), -1);
});
var expected = _.map(falsey, function(value) {
@@ -405,133 +406,150 @@
return _.lastIndexOf(array, 3, fromIndex);
});
deepEqual(actual, expected, 'should treat falsey `fromIndex` values, except `0` and `NaN`, as `array.length`');
strictEqual(_.lastIndexOf(array, 3, '1'), 5, 'should treat non-number `fromIndex` values as `array.length`');
strictEqual(_.lastIndexOf(array, 3, true), 5, 'should treat non-number `fromIndex` values as `array.length`');
assert.deepEqual(actual, expected, 'should treat falsey `fromIndex` values, except `0` and `NaN`, as `array.length`');
assert.strictEqual(_.lastIndexOf(array, 3, '1'), 5, 'should treat non-number `fromIndex` values as `array.length`');
assert.strictEqual(_.lastIndexOf(array, 3, true), 5, 'should treat non-number `fromIndex` values as `array.length`');
strictEqual(_.lastIndexOf(array, 2, -3), 1, 'should work with a negative `fromIndex`');
strictEqual(_.lastIndexOf(array, 1, -3), 3, 'neg `fromIndex` starts at the right index');
assert.strictEqual(_.lastIndexOf(array, 2, -3), 1, 'should work with a negative `fromIndex`');
assert.strictEqual(_.lastIndexOf(array, 1, -3), 3, 'neg `fromIndex` starts at the right index');
deepEqual(_.map([-6, -8, -Infinity], function(fromIndex) {
assert.deepEqual(_.map([-6, -8, -Infinity], function(fromIndex) {
return _.lastIndexOf(array, 1, fromIndex);
}), [0, -1, -1]);
});
test('lastIndexOf with NaN', function() {
strictEqual(_.lastIndexOf([1, 2, NaN, NaN], NaN), 3, 'Expected [1, 2, NaN] to contain NaN');
strictEqual(_.lastIndexOf([1, 2, Infinity], NaN), -1, 'Expected [1, 2, NaN] to contain NaN');
QUnit.test('lastIndexOf with NaN', function(assert) {
assert.strictEqual(_.lastIndexOf([1, 2, NaN, NaN], NaN), 3, 'Expected [1, 2, NaN] to contain NaN');
assert.strictEqual(_.lastIndexOf([1, 2, Infinity], NaN), -1, 'Expected [1, 2, NaN] to contain NaN');
strictEqual(_.lastIndexOf([1, 2, NaN, NaN], NaN, 2), 2, 'fromIndex does not affect result');
strictEqual(_.lastIndexOf([1, 2, NaN, NaN], NaN, -2), 2, 'fromIndex does not affect result');
assert.strictEqual(_.lastIndexOf([1, 2, NaN, NaN], NaN, 2), 2, 'fromIndex does not affect result');
assert.strictEqual(_.lastIndexOf([1, 2, NaN, NaN], NaN, -2), 2, 'fromIndex does not affect result');
(function() {
strictEqual(_.lastIndexOf(arguments, NaN), 3, 'Expected arguments [1, 2, NaN] to contain NaN');
assert.strictEqual(_.lastIndexOf(arguments, NaN), 3, 'Expected arguments [1, 2, NaN] to contain NaN');
}(1, 2, NaN, NaN));
});
test('lastIndexOf with +- 0', function() {
QUnit.test('lastIndexOf with +- 0', function(assert) {
_.each([-0, +0], function(val) {
strictEqual(_.lastIndexOf([1, 2, val, val], val), 3);
strictEqual(_.lastIndexOf([1, 2, val, val], -val), 3);
strictEqual(_.lastIndexOf([-1, 1, 2], -val), -1);
assert.strictEqual(_.lastIndexOf([1, 2, val, val], val), 3);
assert.strictEqual(_.lastIndexOf([1, 2, val, val], -val), 3);
assert.strictEqual(_.lastIndexOf([-1, 1, 2], -val), -1);
});
});
test('findIndex', function() {
QUnit.test('findIndex', function(assert) {
var objects = [
{'a': 0, 'b': 0},
{'a': 1, 'b': 1},
{'a': 2, 'b': 2},
{'a': 0, 'b': 0}
{a: 0, b: 0},
{a: 1, b: 1},
{a: 2, b: 2},
{a: 0, b: 0}
];
equal(_.findIndex(objects, function(obj) {
assert.equal(_.findIndex(objects, function(obj) {
return obj.a === 0;
}), 0);
equal(_.findIndex(objects, function(obj) {
assert.equal(_.findIndex(objects, function(obj) {
return obj.b * obj.a === 4;
}), 2);
equal(_.findIndex(objects, 'a'), 1, 'Uses lookupIterator');
assert.equal(_.findIndex(objects, 'a'), 1, 'Uses lookupIterator');
equal(_.findIndex(objects, function(obj) {
assert.equal(_.findIndex(objects, function(obj) {
return obj.b * obj.a === 5;
}), -1);
equal(_.findIndex(null, _.noop), -1);
strictEqual(_.findIndex(objects, function(a) {
assert.equal(_.findIndex(null, _.noop), -1);
assert.strictEqual(_.findIndex(objects, function(a) {
return a.foo === null;
}), -1);
_.findIndex([{a: 1}], function(a, key, obj) {
equal(key, 0);
deepEqual(obj, [{a: 1}]);
strictEqual(this, objects, 'called with context');
assert.equal(key, 0);
assert.deepEqual(obj, [{a: 1}]);
assert.strictEqual(this, objects, 'called with context');
}, objects);
var sparse = [];
sparse[20] = {'a': 2, 'b': 2};
equal(_.findIndex(sparse, function(obj) {
sparse[20] = {a: 2, b: 2};
assert.equal(_.findIndex(sparse, function(obj) {
return obj && obj.b * obj.a === 4;
}), 20, 'Works with sparse arrays');
var array = [1, 2, 3, 4];
array.match = 55;
strictEqual(_.findIndex(array, function(x) { return x === 55; }), -1, 'doesn\'t match array-likes keys');
assert.strictEqual(_.findIndex(array, function(x) { return x === 55; }), -1, 'doesn\'t match array-likes keys');
});
test('findLastIndex', function() {
QUnit.test('findLastIndex', function(assert) {
var objects = [
{'a': 0, 'b': 0},
{'a': 1, 'b': 1},
{'a': 2, 'b': 2},
{'a': 0, 'b': 0}
{a: 0, b: 0},
{a: 1, b: 1},
{a: 2, b: 2},
{a: 0, b: 0}
];
equal(_.findLastIndex(objects, function(obj) {
assert.equal(_.findLastIndex(objects, function(obj) {
return obj.a === 0;
}), 3);
equal(_.findLastIndex(objects, function(obj) {
assert.equal(_.findLastIndex(objects, function(obj) {
return obj.b * obj.a === 4;
}), 2);
equal(_.findLastIndex(objects, 'a'), 2, 'Uses lookupIterator');
assert.equal(_.findLastIndex(objects, 'a'), 2, 'Uses lookupIterator');
equal(_.findLastIndex(objects, function(obj) {
assert.equal(_.findLastIndex(objects, function(obj) {
return obj.b * obj.a === 5;
}), -1);
equal(_.findLastIndex(null, _.noop), -1);
strictEqual(_.findLastIndex(objects, function(a) {
assert.equal(_.findLastIndex(null, _.noop), -1);
assert.strictEqual(_.findLastIndex(objects, function(a) {
return a.foo === null;
}), -1);
_.findLastIndex([{a: 1}], function(a, key, obj) {
equal(key, 0);
deepEqual(obj, [{a: 1}]);
strictEqual(this, objects, 'called with context');
assert.equal(key, 0);
assert.deepEqual(obj, [{a: 1}]);
assert.strictEqual(this, objects, 'called with context');
}, objects);
var sparse = [];
sparse[20] = {'a': 2, 'b': 2};
equal(_.findLastIndex(sparse, function(obj) {
sparse[20] = {a: 2, b: 2};
assert.equal(_.findLastIndex(sparse, function(obj) {
return obj && obj.b * obj.a === 4;
}), 20, 'Works with sparse arrays');
var array = [1, 2, 3, 4];
array.match = 55;
strictEqual(_.findLastIndex(array, function(x) { return x === 55; }), -1, 'doesn\'t match array-likes keys');
assert.strictEqual(_.findLastIndex(array, function(x) { return x === 55; }), -1, 'doesn\'t match array-likes keys');
});
test('range', function() {
deepEqual(_.range(0), [], 'range with 0 as a first argument generates an empty array');
deepEqual(_.range(4), [0, 1, 2, 3], 'range with a single positive argument generates an array of elements 0,1,2,...,n-1');
deepEqual(_.range(5, 8), [5, 6, 7], 'range with two arguments a &amp; b, a&lt;b generates an array of elements a,a+1,a+2,...,b-2,b-1');
deepEqual(_.range(8, 5), [], 'range with two arguments a &amp; b, b&lt;a generates an empty array');
deepEqual(_.range(3, 10, 3), [3, 6, 9], 'range with three arguments a &amp; b &amp; c, c &lt; b-a, a &lt; b generates an array of elements a,a+c,a+2c,...,b - (multiplier of a) &lt; c');
deepEqual(_.range(3, 10, 15), [3], 'range with three arguments a &amp; b &amp; c, c &gt; b-a, a &lt; b generates an array with a single element, equal to a');
deepEqual(_.range(12, 7, -2), [12, 10, 8], 'range with three arguments a &amp; b &amp; c, a &gt; b, c &lt; 0 generates an array of elements a,a-c,a-2c and ends with the number not less than b');
deepEqual(_.range(0, -10, -1), [0, -1, -2, -3, -4, -5, -6, -7, -8, -9], 'final example in the Python docs');
QUnit.test('range', function(assert) {
assert.deepEqual(_.range(0), [], 'range with 0 as a first argument generates an empty array');
assert.deepEqual(_.range(4), [0, 1, 2, 3], 'range with a single positive argument generates an array of elements 0,1,2,...,n-1');
assert.deepEqual(_.range(5, 8), [5, 6, 7], 'range with two arguments a &amp; b, a&lt;b generates an array of elements a,a+1,a+2,...,b-2,b-1');
assert.deepEqual(_.range(3, 10, 3), [3, 6, 9], 'range with three arguments a &amp; b &amp; c, c &lt; b-a, a &lt; b generates an array of elements a,a+c,a+2c,...,b - (multiplier of a) &lt; c');
assert.deepEqual(_.range(3, 10, 15), [3], 'range with three arguments a &amp; b &amp; c, c &gt; b-a, a &lt; b generates an array with a single element, equal to a');
assert.deepEqual(_.range(12, 7, -2), [12, 10, 8], 'range with three arguments a &amp; b &amp; c, a &gt; b, c &lt; 0 generates an array of elements a,a-c,a-2c and ends with the number not less than b');
assert.deepEqual(_.range(0, -10, -1), [0, -1, -2, -3, -4, -5, -6, -7, -8, -9], 'final example in the Python docs');
assert.strictEqual(1 / _.range(-0, 1)[0], -Infinity, 'should preserve -0');
assert.deepEqual(_.range(8, 5), [8, 7, 6], 'negative range generates descending array');
assert.deepEqual(_.range(-3), [0, -1, -2], 'negative range generates descending array');
});
QUnit.test('chunk', function(assert) {
assert.deepEqual(_.chunk([], 2), [], 'chunk for empty array returns an empty array');
assert.deepEqual(_.chunk([1, 2, 3], 0), [], 'chunk into parts of 0 elements returns empty array');
assert.deepEqual(_.chunk([1, 2, 3], -1), [], 'chunk into parts of negative amount of elements returns an empty array');
assert.deepEqual(_.chunk([1, 2, 3]), [], 'defaults to empty array (chunk size 0)');
assert.deepEqual(_.chunk([1, 2, 3], 1), [[1], [2], [3]], 'chunk into parts of 1 elements returns original array');
assert.deepEqual(_.chunk([1, 2, 3], 3), [[1, 2, 3]], 'chunk into parts of current array length elements returns the original array');
assert.deepEqual(_.chunk([1, 2, 3], 5), [[1, 2, 3]], 'chunk into parts of more then current array length elements returns the original array');
assert.deepEqual(_.chunk([10, 20, 30, 40, 50, 60, 70], 2), [[10, 20], [30, 40], [50, 60], [70]], 'chunk into parts of less then current array length elements');
assert.deepEqual(_.chunk([10, 20, 30, 40, 50, 60, 70], 3), [[10, 20, 30], [40, 50, 60], [70]], 'chunk into parts of less then current array length elements');
});
}());

View File

@@ -3,7 +3,7 @@
QUnit.module('Chaining');
test('map/flatten/reduce', function() {
QUnit.test('map/flatten/reduce', function(assert) {
var lyrics = [
'I\'m a lumberjack and I\'m okay',
'I sleep all night and I work all day',
@@ -17,12 +17,13 @@
hash[l] = hash[l] || 0;
hash[l]++;
return hash;
}, {}).value();
equal(counts.a, 16, 'counted all the letters in the song');
equal(counts.e, 10, 'counted all the letters in the song');
}, {})
.value();
assert.equal(counts.a, 16, 'counted all the letters in the song');
assert.equal(counts.e, 10, 'counted all the letters in the song');
});
test('select/reject/sortBy', function() {
QUnit.test('select/reject/sortBy', function(assert) {
var numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
numbers = _(numbers).chain().select(function(n) {
return n % 2 === 0;
@@ -31,10 +32,10 @@
}).sortBy(function(n) {
return -n;
}).value();
deepEqual(numbers, [10, 6, 2], 'filtered and reversed the numbers');
assert.deepEqual(numbers, [10, 6, 2], 'filtered and reversed the numbers');
});
test('select/reject/sortBy in functional style', function() {
QUnit.test('select/reject/sortBy in functional style', function(assert) {
var numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
numbers = _.chain(numbers).select(function(n) {
return n % 2 === 0;
@@ -43,10 +44,10 @@
}).sortBy(function(n) {
return -n;
}).value();
deepEqual(numbers, [10, 6, 2], 'filtered and reversed the numbers');
assert.deepEqual(numbers, [10, 6, 2], 'filtered and reversed the numbers');
});
test('reverse/concat/unshift/pop/map', function() {
QUnit.test('reverse/concat/unshift/pop/map', function(assert) {
var numbers = [1, 2, 3, 4, 5];
numbers = _(numbers).chain()
.reverse()
@@ -55,44 +56,44 @@
.pop()
.map(function(n){ return n * 2; })
.value();
deepEqual(numbers, [34, 10, 8, 6, 4, 2, 10, 10], 'can chain together array functions.');
assert.deepEqual(numbers, [34, 10, 8, 6, 4, 2, 10, 10], 'can chain together array functions.');
});
test('splice', function() {
QUnit.test('splice', function(assert) {
var instance = _([1, 2, 3, 4, 5]).chain();
deepEqual(instance.splice(1, 3).value(), [1, 5]);
deepEqual(instance.splice(1, 0).value(), [1, 5]);
deepEqual(instance.splice(1, 1).value(), [1]);
deepEqual(instance.splice(0, 1).value(), [], '#397 Can create empty array');
assert.deepEqual(instance.splice(1, 3).value(), [1, 5]);
assert.deepEqual(instance.splice(1, 0).value(), [1, 5]);
assert.deepEqual(instance.splice(1, 1).value(), [1]);
assert.deepEqual(instance.splice(0, 1).value(), [], '#397 Can create empty array');
});
test('shift', function() {
QUnit.test('shift', function(assert) {
var instance = _([1, 2, 3]).chain();
deepEqual(instance.shift().value(), [2, 3]);
deepEqual(instance.shift().value(), [3]);
deepEqual(instance.shift().value(), [], '#397 Can create empty array');
assert.deepEqual(instance.shift().value(), [2, 3]);
assert.deepEqual(instance.shift().value(), [3]);
assert.deepEqual(instance.shift().value(), [], '#397 Can create empty array');
});
test('pop', function() {
QUnit.test('pop', function(assert) {
var instance = _([1, 2, 3]).chain();
deepEqual(instance.pop().value(), [1, 2]);
deepEqual(instance.pop().value(), [1]);
deepEqual(instance.pop().value(), [], '#397 Can create empty array');
assert.deepEqual(instance.pop().value(), [1, 2]);
assert.deepEqual(instance.pop().value(), [1]);
assert.deepEqual(instance.pop().value(), [], '#397 Can create empty array');
});
test('chaining works in small stages', function() {
QUnit.test('chaining works in small stages', function(assert) {
var o = _([1, 2, 3, 4]).chain();
deepEqual(o.filter(function(i) { return i < 3; }).value(), [1, 2]);
deepEqual(o.filter(function(i) { return i > 2; }).value(), [3, 4]);
assert.deepEqual(o.filter(function(i) { return i < 3; }).value(), [1, 2]);
assert.deepEqual(o.filter(function(i) { return i > 2; }).value(), [3, 4]);
});
test('#1562: Engine proxies for chained functions', function() {
QUnit.test('#1562: Engine proxies for chained functions', function(assert) {
var wrapped = _(512);
strictEqual(wrapped.toJSON(), 512);
strictEqual(wrapped.valueOf(), 512);
strictEqual(+wrapped, 512);
strictEqual(wrapped.toString(), '512');
strictEqual('' + wrapped, '512');
assert.strictEqual(wrapped.toJSON(), 512);
assert.strictEqual(wrapped.valueOf(), 512);
assert.strictEqual(+wrapped, 512);
assert.strictEqual(wrapped.toString(), '512');
assert.strictEqual('' + wrapped, '512');
});
}());

File diff suppressed because it is too large Load Diff

View File

@@ -33,95 +33,95 @@
);
iDoc.close();
test('isEqual', function() {
QUnit.test('isEqual', function(assert) {
ok(!_.isEqual(iNumber, 101));
ok(_.isEqual(iNumber, 100));
assert.ok(!_.isEqual(iNumber, 101));
assert.ok(_.isEqual(iNumber, 100));
// Objects from another frame.
ok(_.isEqual({}, iObject), 'Objects with equivalent members created in different documents are equal');
assert.ok(_.isEqual({}, iObject), 'Objects with equivalent members created in different documents are equal');
// Array from another frame.
ok(_.isEqual([1, 2, 3], iArray), 'Arrays with equivalent elements created in different documents are equal');
assert.ok(_.isEqual([1, 2, 3], iArray), 'Arrays with equivalent elements created in different documents are equal');
});
test('isEmpty', function() {
ok(!_([iNumber]).isEmpty(), '[1] is not empty');
ok(!_.isEmpty(iArray), '[] is empty');
ok(_.isEmpty(iObject), '{} is empty');
QUnit.test('isEmpty', function(assert) {
assert.ok(!_([iNumber]).isEmpty(), '[1] is not empty');
assert.ok(!_.isEmpty(iArray), '[] is empty');
assert.ok(_.isEmpty(iObject), '{} is empty');
});
test('isElement', function() {
ok(!_.isElement('div'), 'strings are not dom elements');
ok(_.isElement(document.body), 'the body tag is a DOM element');
ok(_.isElement(iElement), 'even from another frame');
QUnit.test('isElement', function(assert) {
assert.ok(!_.isElement('div'), 'strings are not dom elements');
assert.ok(_.isElement(document.body), 'the body tag is a DOM element');
assert.ok(_.isElement(iElement), 'even from another frame');
});
test('isArguments', function() {
ok(_.isArguments(iArguments), 'even from another frame');
QUnit.test('isArguments', function(assert) {
assert.ok(_.isArguments(iArguments), 'even from another frame');
});
test('isObject', function() {
ok(_.isObject(iElement), 'even from another frame');
ok(_.isObject(iFunction), 'even from another frame');
QUnit.test('isObject', function(assert) {
assert.ok(_.isObject(iElement), 'even from another frame');
assert.ok(_.isObject(iFunction), 'even from another frame');
});
test('isArray', function() {
ok(_.isArray(iArray), 'even from another frame');
QUnit.test('isArray', function(assert) {
assert.ok(_.isArray(iArray), 'even from another frame');
});
test('isString', function() {
ok(_.isString(iString), 'even from another frame');
QUnit.test('isString', function(assert) {
assert.ok(_.isString(iString), 'even from another frame');
});
test('isNumber', function() {
ok(_.isNumber(iNumber), 'even from another frame');
QUnit.test('isNumber', function(assert) {
assert.ok(_.isNumber(iNumber), 'even from another frame');
});
test('isBoolean', function() {
ok(_.isBoolean(iBoolean), 'even from another frame');
QUnit.test('isBoolean', function(assert) {
assert.ok(_.isBoolean(iBoolean), 'even from another frame');
});
test('isFunction', function() {
ok(_.isFunction(iFunction), 'even from another frame');
QUnit.test('isFunction', function(assert) {
assert.ok(_.isFunction(iFunction), 'even from another frame');
});
test('isDate', function() {
ok(_.isDate(iDate), 'even from another frame');
QUnit.test('isDate', function(assert) {
assert.ok(_.isDate(iDate), 'even from another frame');
});
test('isRegExp', function() {
ok(_.isRegExp(iRegExp), 'even from another frame');
QUnit.test('isRegExp', function(assert) {
assert.ok(_.isRegExp(iRegExp), 'even from another frame');
});
test('isNaN', function() {
ok(_.isNaN(iNaN), 'even from another frame');
QUnit.test('isNaN', function(assert) {
assert.ok(_.isNaN(iNaN), 'even from another frame');
});
test('isNull', function() {
ok(_.isNull(iNull), 'even from another frame');
QUnit.test('isNull', function(assert) {
assert.ok(_.isNull(iNull), 'even from another frame');
});
test('isUndefined', function() {
ok(_.isUndefined(iUndefined), 'even from another frame');
QUnit.test('isUndefined', function(assert) {
assert.ok(_.isUndefined(iUndefined), 'even from another frame');
});
test('isError', function() {
ok(_.isError(iError), 'even from another frame');
QUnit.test('isError', function(assert) {
assert.ok(_.isError(iError), 'even from another frame');
});
if (typeof ActiveXObject != 'undefined') {
test('IE host objects', function() {
QUnit.test('IE host objects', function(assert) {
var xml = new ActiveXObject('Msxml2.DOMDocument.3.0');
ok(!_.isNumber(xml));
ok(!_.isBoolean(xml));
ok(!_.isNaN(xml));
ok(!_.isFunction(xml));
ok(!_.isNull(xml));
ok(!_.isUndefined(xml));
assert.ok(!_.isNumber(xml));
assert.ok(!_.isBoolean(xml));
assert.ok(!_.isNaN(xml));
assert.ok(!_.isFunction(xml));
assert.ok(!_.isNull(xml));
assert.ok(!_.isUndefined(xml));
});
test('#1621 IE 11 compat mode DOM elements are not functions', function() {
QUnit.test('#1621 IE 11 compat mode DOM elements are not functions', function(assert) {
var fn = function() {};
var xml = new ActiveXObject('Msxml2.DOMDocument.3.0');
var div = document.createElement('div');
@@ -132,10 +132,10 @@
_.isFunction(fn);
}
equal(_.isFunction(xml), false);
equal(_.isFunction(div), false);
equal(_.isFunction(fn), true);
assert.equal(_.isFunction(xml), false);
assert.equal(_.isFunction(div), false);
assert.equal(_.isFunction(fn), true);
});
}
}());
}());

View File

@@ -4,65 +4,65 @@
QUnit.module('Functions');
QUnit.config.asyncRetries = 3;
test('bind', function() {
var context = {name : 'moe'};
QUnit.test('bind', function(assert) {
var context = {name: 'moe'};
var func = function(arg) { return 'name: ' + (this.name || arg); };
var bound = _.bind(func, context);
equal(bound(), 'name: moe', 'can bind a function to a context');
assert.equal(bound(), 'name: moe', 'can bind a function to a context');
bound = _(func).bind(context);
equal(bound(), 'name: moe', 'can do OO-style binding');
assert.equal(bound(), 'name: moe', 'can do OO-style binding');
bound = _.bind(func, null, 'curly');
var result = bound();
// Work around a PhantomJS bug when applying a function with null|undefined.
ok(result === 'name: curly' || result === 'name: ' + window.name, 'can bind without specifying a context');
assert.ok(result === 'name: curly' || result === 'name: ' + window.name, 'can bind without specifying a context');
func = function(salutation, name) { return salutation + ': ' + name; };
func = _.bind(func, this, 'hello');
equal(func('moe'), 'hello: moe', 'the function was partially applied in advance');
assert.equal(func('moe'), 'hello: moe', 'the function was partially applied in advance');
func = _.bind(func, this, 'curly');
equal(func(), 'hello: curly', 'the function was completely applied in advance');
assert.equal(func(), 'hello: curly', 'the function was completely applied in advance');
func = function(salutation, firstname, lastname) { return salutation + ': ' + firstname + ' ' + lastname; };
func = _.bind(func, this, 'hello', 'moe', 'curly');
equal(func(), 'hello: moe curly', 'the function was partially applied in advance and can accept multiple arguments');
assert.equal(func(), 'hello: moe curly', 'the function was partially applied in advance and can accept multiple arguments');
func = function(context, message) { equal(this, context, message); };
func = function(ctx, message) { assert.equal(this, ctx, message); };
_.bind(func, 0, 0, 'can bind a function to `0`')();
_.bind(func, '', '', 'can bind a function to an empty string')();
_.bind(func, false, false, 'can bind a function to `false`')();
// These tests are only meaningful when using a browser without a native bind function
// To test this with a modern browser, set underscore's nativeBind to undefined
var F = function () { return this; };
var F = function() { return this; };
var boundf = _.bind(F, {hello: 'moe curly'});
var Boundf = boundf; // make eslint happy.
var newBoundf = new Boundf();
equal(newBoundf.hello, undefined, 'function should not be bound to the context, to comply with ECMAScript 5');
equal(boundf().hello, 'moe curly', "When called without the new operator, it's OK to be bound to the context");
ok(newBoundf instanceof F, 'a bound instance is an instance of the original function');
assert.equal(newBoundf.hello, void 0, 'function should not be bound to the context, to comply with ECMAScript 5');
assert.equal(boundf().hello, 'moe curly', "When called without the new operator, it's OK to be bound to the context");
assert.ok(newBoundf instanceof F, 'a bound instance is an instance of the original function');
throws(function() { _.bind('notafunction'); }, TypeError, 'throws an error when binding to a non-function');
assert.raises(function() { _.bind('notafunction'); }, TypeError, 'throws an error when binding to a non-function');
});
test('partial', function() {
QUnit.test('partial', function(assert) {
var obj = {name: 'moe'};
var func = function() { return this.name + ' ' + _.toArray(arguments).join(' '); };
obj.func = _.partial(func, 'a', 'b');
equal(obj.func('c', 'd'), 'moe a b c d', 'can partially apply');
assert.equal(obj.func('c', 'd'), 'moe a b c d', 'can partially apply');
obj.func = _.partial(func, _, 'b', _, 'd');
equal(obj.func('a', 'c'), 'moe a b c d', 'can partially apply with placeholders');
assert.equal(obj.func('a', 'c'), 'moe a b c d', 'can partially apply with placeholders');
func = _.partial(function() { return arguments.length; }, _, 'b', _, 'd');
equal(func('a', 'c', 'e'), 5, 'accepts more arguments than the number of placeholders');
equal(func('a'), 4, 'accepts fewer arguments than the number of placeholders');
assert.equal(func('a', 'c', 'e'), 5, 'accepts more arguments than the number of placeholders');
assert.equal(func('a'), 4, 'accepts fewer arguments than the number of placeholders');
func = _.partial(function() { return typeof arguments[2]; }, _, 'b', _, 'd');
equal(func('a'), 'undefined', 'unfilled placeholders are undefined');
assert.equal(func('a'), 'undefined', 'unfilled placeholders are undefined');
// passes context
function MyWidget(name, options) {
@@ -74,78 +74,93 @@
};
var MyWidgetWithCoolOpts = _.partial(MyWidget, _, {a: 1});
var widget = new MyWidgetWithCoolOpts('foo');
ok(widget instanceof MyWidget, 'Can partially bind a constructor');
equal(widget.get(), 'foo', 'keeps prototype');
deepEqual(widget.options, {a: 1});
assert.ok(widget instanceof MyWidget, 'Can partially bind a constructor');
assert.equal(widget.get(), 'foo', 'keeps prototype');
assert.deepEqual(widget.options, {a: 1});
_.partial.placeholder = obj;
func = _.partial(function() { return arguments.length; }, obj, 'b', obj, 'd');
assert.equal(func('a'), 4, 'allows the placeholder to be swapped out');
_.partial.placeholder = {};
func = _.partial(function() { return arguments.length; }, obj, 'b', obj, 'd');
assert.equal(func('a'), 5, 'swapping the placeholder preserves previously bound arguments');
_.partial.placeholder = _;
});
test('bindAll', function() {
var curly = {name : 'curly'}, moe = {
name : 'moe',
getName : function() { return 'name: ' + this.name; },
sayHi : function() { return 'hi: ' + this.name; }
QUnit.test('bindAll', function(assert) {
var curly = {name: 'curly'};
var moe = {
name: 'moe',
getName: function() { return 'name: ' + this.name; },
sayHi: function() { return 'hi: ' + this.name; }
};
curly.getName = moe.getName;
_.bindAll(moe, 'getName', 'sayHi');
curly.sayHi = moe.sayHi;
equal(curly.getName(), 'name: curly', 'unbound function is bound to current object');
equal(curly.sayHi(), 'hi: moe', 'bound function is still bound to original object');
assert.equal(curly.getName(), 'name: curly', 'unbound function is bound to current object');
assert.equal(curly.sayHi(), 'hi: moe', 'bound function is still bound to original object');
curly = {name : 'curly'};
curly = {name: 'curly'};
moe = {
name : 'moe',
getName : function() { return 'name: ' + this.name; },
sayHi : function() { return 'hi: ' + this.name; },
sayLast : function() { return this.sayHi(_.last(arguments)); }
name: 'moe',
getName: function() { return 'name: ' + this.name; },
sayHi: function() { return 'hi: ' + this.name; },
sayLast: function() { return this.sayHi(_.last(arguments)); }
};
throws(function() { _.bindAll(moe); }, Error, 'throws an error for bindAll with no functions named');
throws(function() { _.bindAll(moe, 'sayBye'); }, TypeError, 'throws an error for bindAll if the given key is undefined');
throws(function() { _.bindAll(moe, 'name'); }, TypeError, 'throws an error for bindAll if the given key is not a function');
assert.raises(function() { _.bindAll(moe); }, Error, 'throws an error for bindAll with no functions named');
assert.raises(function() { _.bindAll(moe, 'sayBye'); }, TypeError, 'throws an error for bindAll if the given key is undefined');
assert.raises(function() { _.bindAll(moe, 'name'); }, TypeError, 'throws an error for bindAll if the given key is not a function');
_.bindAll(moe, 'sayHi', 'sayLast');
curly.sayHi = moe.sayHi;
equal(curly.sayHi(), 'hi: moe');
assert.equal(curly.sayHi(), 'hi: moe');
var sayLast = moe.sayLast;
equal(sayLast(1, 2, 3, 4, 5, 6, 7, 'Tom'), 'hi: moe', 'createCallback works with any number of arguments');
assert.equal(sayLast(1, 2, 3, 4, 5, 6, 7, 'Tom'), 'hi: moe', 'createCallback works with any number of arguments');
_.bindAll(moe, ['getName']);
var getName = moe.getName;
assert.equal(getName(), 'name: moe', 'flattens arguments into a single list');
});
test('memoize', function() {
QUnit.test('memoize', function(assert) {
var fib = function(n) {
return n < 2 ? n : fib(n - 1) + fib(n - 2);
};
equal(fib(10), 55, 'a memoized version of fibonacci produces identical results');
assert.equal(fib(10), 55, 'a memoized version of fibonacci produces identical results');
fib = _.memoize(fib); // Redefine `fib` for memoization
equal(fib(10), 55, 'a memoized version of fibonacci produces identical results');
assert.equal(fib(10), 55, 'a memoized version of fibonacci produces identical results');
var o = function(str) {
return str;
};
var fastO = _.memoize(o);
equal(o('toString'), 'toString', 'checks hasOwnProperty');
equal(fastO('toString'), 'toString', 'checks hasOwnProperty');
assert.equal(o('toString'), 'toString', 'checks hasOwnProperty');
assert.equal(fastO('toString'), 'toString', 'checks hasOwnProperty');
// Expose the cache.
var upper = _.memoize(function(s) {
return s.toUpperCase();
});
equal(upper('foo'), 'FOO');
equal(upper('bar'), 'BAR');
deepEqual(upper.cache, {foo: 'FOO', bar: 'BAR'});
assert.equal(upper('foo'), 'FOO');
assert.equal(upper('bar'), 'BAR');
assert.deepEqual(upper.cache, {foo: 'FOO', bar: 'BAR'});
upper.cache = {foo: 'BAR', bar: 'FOO'};
equal(upper('foo'), 'BAR');
equal(upper('bar'), 'FOO');
assert.equal(upper('foo'), 'BAR');
assert.equal(upper('bar'), 'FOO');
var hashed = _.memoize(function(key) {
//https://github.com/jashkenas/underscore/pull/1679#discussion_r13736209
ok(/[a-z]+/.test(key), 'hasher doesn\'t change keys');
assert.ok(/[a-z]+/.test(key), 'hasher doesn\'t change keys');
return key;
}, function(key) {
return key.toUpperCase();
});
hashed('yep');
deepEqual(hashed.cache, {'YEP': 'yep'}, 'takes a hasher');
assert.deepEqual(hashed.cache, {YEP: 'yep'}, 'takes a hasher');
// Test that the hash function can be used to swizzle the key.
var objCacher = _.memoize(function(value, key) {
@@ -155,78 +170,94 @@
});
var myObj = objCacher('a', 'alpha');
var myObjAlias = objCacher('b', 'alpha');
notStrictEqual(myObj, undefined, 'object is created if second argument used as key');
strictEqual(myObj, myObjAlias, 'object is cached if second argument used as key');
strictEqual(myObj.value, 'a', 'object is not modified if second argument used as key');
assert.notStrictEqual(myObj, void 0, 'object is created if second argument used as key');
assert.strictEqual(myObj, myObjAlias, 'object is cached if second argument used as key');
assert.strictEqual(myObj.value, 'a', 'object is not modified if second argument used as key');
});
asyncTest('delay', 2, function() {
QUnit.test('delay', function(assert) {
assert.expect(2);
var done = assert.async();
var delayed = false;
_.delay(function(){ delayed = true; }, 100);
setTimeout(function(){ ok(!delayed, "didn't delay the function quite yet"); }, 50);
setTimeout(function(){ ok(delayed, 'delayed the function'); start(); }, 150);
setTimeout(function(){ assert.ok(!delayed, "didn't delay the function quite yet"); }, 50);
setTimeout(function(){ assert.ok(delayed, 'delayed the function'); done(); }, 150);
});
asyncTest('defer', 1, function() {
QUnit.test('defer', function(assert) {
assert.expect(1);
var done = assert.async();
var deferred = false;
_.defer(function(bool){ deferred = bool; }, true);
_.delay(function(){ ok(deferred, 'deferred the function'); start(); }, 50);
_.delay(function(){ assert.ok(deferred, 'deferred the function'); done(); }, 50);
});
asyncTest('throttle', 2, function() {
QUnit.test('throttle', function(assert) {
assert.expect(2);
var done = assert.async();
var counter = 0;
var incr = function(){ counter++; };
var throttledIncr = _.throttle(incr, 32);
throttledIncr(); throttledIncr();
equal(counter, 1, 'incr was called immediately');
_.delay(function(){ equal(counter, 2, 'incr was throttled'); start(); }, 64);
assert.equal(counter, 1, 'incr was called immediately');
_.delay(function(){ assert.equal(counter, 2, 'incr was throttled'); done(); }, 64);
});
asyncTest('throttle arguments', 2, function() {
QUnit.test('throttle arguments', function(assert) {
assert.expect(2);
var done = assert.async();
var value = 0;
var update = function(val){ value = val; };
var throttledUpdate = _.throttle(update, 32);
throttledUpdate(1); throttledUpdate(2);
_.delay(function(){ throttledUpdate(3); }, 64);
equal(value, 1, 'updated to latest value');
_.delay(function(){ equal(value, 3, 'updated to latest value'); start(); }, 96);
assert.equal(value, 1, 'updated to latest value');
_.delay(function(){ assert.equal(value, 3, 'updated to latest value'); done(); }, 96);
});
asyncTest('throttle once', 2, function() {
QUnit.test('throttle once', function(assert) {
assert.expect(2);
var done = assert.async();
var counter = 0;
var incr = function(){ return ++counter; };
var throttledIncr = _.throttle(incr, 32);
var result = throttledIncr();
_.delay(function(){
equal(result, 1, 'throttled functions return their value');
equal(counter, 1, 'incr was called once'); start();
assert.equal(result, 1, 'throttled functions return their value');
assert.equal(counter, 1, 'incr was called once'); done();
}, 64);
});
asyncTest('throttle twice', 1, function() {
QUnit.test('throttle twice', function(assert) {
assert.expect(1);
var done = assert.async();
var counter = 0;
var incr = function(){ counter++; };
var throttledIncr = _.throttle(incr, 32);
throttledIncr(); throttledIncr();
_.delay(function(){ equal(counter, 2, 'incr was called twice'); start(); }, 64);
_.delay(function(){ assert.equal(counter, 2, 'incr was called twice'); done(); }, 64);
});
asyncTest('more throttling', 3, function() {
QUnit.test('more throttling', function(assert) {
assert.expect(3);
var done = assert.async();
var counter = 0;
var incr = function(){ counter++; };
var throttledIncr = _.throttle(incr, 30);
throttledIncr(); throttledIncr();
equal(counter, 1);
assert.equal(counter, 1);
_.delay(function(){
equal(counter, 2);
assert.equal(counter, 2);
throttledIncr();
equal(counter, 3);
start();
assert.equal(counter, 3);
done();
}, 85);
});
asyncTest('throttle repeatedly with results', 6, function() {
QUnit.test('throttle repeatedly with results', function(assert) {
assert.expect(6);
var done = assert.async();
var counter = 0;
var incr = function(){ return ++counter; };
var throttledIncr = _.throttle(incr, 100);
@@ -238,17 +269,19 @@
_.delay(saveResult, 160);
_.delay(saveResult, 230);
_.delay(function() {
equal(results[0], 1, 'incr was called once');
equal(results[1], 1, 'incr was throttled');
equal(results[2], 1, 'incr was throttled');
equal(results[3], 2, 'incr was called twice');
equal(results[4], 2, 'incr was throttled');
equal(results[5], 3, 'incr was called trailing');
start();
assert.equal(results[0], 1, 'incr was called once');
assert.equal(results[1], 1, 'incr was throttled');
assert.equal(results[2], 1, 'incr was throttled');
assert.equal(results[3], 2, 'incr was called twice');
assert.equal(results[4], 2, 'incr was throttled');
assert.equal(results[5], 3, 'incr was called trailing');
done();
}, 300);
});
asyncTest('throttle triggers trailing call when invoked repeatedly', 2, function() {
QUnit.test('throttle triggers trailing call when invoked repeatedly', function(assert) {
assert.expect(2);
var done = assert.async();
var counter = 0;
var limit = 48;
var incr = function(){ counter++; };
@@ -259,29 +292,33 @@
throttledIncr();
}
var lastCount = counter;
ok(counter > 1);
assert.ok(counter > 1);
_.delay(function() {
ok(counter > lastCount);
start();
assert.ok(counter > lastCount);
done();
}, 96);
});
asyncTest('throttle does not trigger leading call when leading is set to false', 2, function() {
QUnit.test('throttle does not trigger leading call when leading is set to false', function(assert) {
assert.expect(2);
var done = assert.async();
var counter = 0;
var incr = function(){ counter++; };
var throttledIncr = _.throttle(incr, 60, {leading: false});
throttledIncr(); throttledIncr();
equal(counter, 0);
assert.equal(counter, 0);
_.delay(function() {
equal(counter, 1);
start();
assert.equal(counter, 1);
done();
}, 96);
});
asyncTest('more throttle does not trigger leading call when leading is set to false', 3, function() {
QUnit.test('more throttle does not trigger leading call when leading is set to false', function(assert) {
assert.expect(3);
var done = assert.async();
var counter = 0;
var incr = function(){ counter++; };
var throttledIncr = _.throttle(incr, 100, {leading: false});
@@ -290,75 +327,83 @@
_.delay(throttledIncr, 50);
_.delay(throttledIncr, 60);
_.delay(throttledIncr, 200);
equal(counter, 0);
assert.equal(counter, 0);
_.delay(function() {
equal(counter, 1);
assert.equal(counter, 1);
}, 250);
_.delay(function() {
equal(counter, 2);
start();
assert.equal(counter, 2);
done();
}, 350);
});
asyncTest('one more throttle with leading: false test', 2, function() {
QUnit.test('one more throttle with leading: false test', function(assert) {
assert.expect(2);
var done = assert.async();
var counter = 0;
var incr = function(){ counter++; };
var throttledIncr = _.throttle(incr, 100, {leading: false});
var time = new Date;
while (new Date - time < 350) throttledIncr();
ok(counter <= 3);
assert.ok(counter <= 3);
_.delay(function() {
ok(counter <= 4);
start();
assert.ok(counter <= 4);
done();
}, 200);
});
asyncTest('throttle does not trigger trailing call when trailing is set to false', 4, function() {
QUnit.test('throttle does not trigger trailing call when trailing is set to false', function(assert) {
assert.expect(4);
var done = assert.async();
var counter = 0;
var incr = function(){ counter++; };
var throttledIncr = _.throttle(incr, 60, {trailing: false});
throttledIncr(); throttledIncr(); throttledIncr();
equal(counter, 1);
assert.equal(counter, 1);
_.delay(function() {
equal(counter, 1);
assert.equal(counter, 1);
throttledIncr(); throttledIncr();
equal(counter, 2);
assert.equal(counter, 2);
_.delay(function() {
equal(counter, 2);
start();
assert.equal(counter, 2);
done();
}, 96);
}, 96);
});
asyncTest('throttle continues to function after system time is set backwards', 2, function() {
QUnit.test('throttle continues to function after system time is set backwards', function(assert) {
assert.expect(2);
var done = assert.async();
var counter = 0;
var incr = function(){ counter++; };
var throttledIncr = _.throttle(incr, 100);
var origNowFunc = _.now;
throttledIncr();
equal(counter, 1);
_.now = function () {
assert.equal(counter, 1);
_.now = function() {
return new Date(2013, 0, 1, 1, 1, 1);
};
_.delay(function() {
throttledIncr();
equal(counter, 2);
start();
assert.equal(counter, 2);
done();
_.now = origNowFunc;
}, 200);
});
asyncTest('throttle re-entrant', 2, function() {
QUnit.test('throttle re-entrant', function(assert) {
assert.expect(2);
var done = assert.async();
var sequence = [
['b1', 'b2'],
['c1', 'c2']
@@ -374,50 +419,114 @@
};
throttledAppend = _.throttle(append, 32);
throttledAppend.call('a1', 'a2');
equal(value, 'a1a2');
assert.equal(value, 'a1a2');
_.delay(function(){
equal(value, 'a1a2c1c2b1b2', 'append was throttled successfully');
start();
assert.equal(value, 'a1a2c1c2b1b2', 'append was throttled successfully');
done();
}, 100);
});
asyncTest('debounce', 1, function() {
QUnit.test('throttle cancel', function(assert) {
var done = assert.async();
var counter = 0;
var incr = function(){ counter++; };
var throttledIncr = _.throttle(incr, 32);
throttledIncr();
throttledIncr.cancel();
throttledIncr();
throttledIncr();
assert.equal(counter, 2, 'incr was called immediately');
_.delay(function(){ assert.equal(counter, 3, 'incr was throttled'); done(); }, 64);
});
QUnit.test('throttle cancel with leading: false', function(assert) {
var done = assert.async();
var counter = 0;
var incr = function(){ counter++; };
var throttledIncr = _.throttle(incr, 32, {leading: false});
throttledIncr();
throttledIncr.cancel();
assert.equal(counter, 0, 'incr was throttled');
_.delay(function(){ assert.equal(counter, 0, 'incr was throttled'); done(); }, 64);
});
QUnit.test('debounce', function(assert) {
assert.expect(1);
var done = assert.async();
var counter = 0;
var incr = function(){ counter++; };
var debouncedIncr = _.debounce(incr, 32);
debouncedIncr(); debouncedIncr();
_.delay(debouncedIncr, 16);
_.delay(function(){ equal(counter, 1, 'incr was debounced'); start(); }, 96);
_.delay(function(){ assert.equal(counter, 1, 'incr was debounced'); done(); }, 96);
});
asyncTest('debounce asap', 4, function() {
QUnit.test('debounce cancel', function(assert) {
assert.expect(1);
var done = assert.async();
var counter = 0;
var incr = function(){ counter++; };
var debouncedIncr = _.debounce(incr, 32);
debouncedIncr();
debouncedIncr.cancel();
_.delay(function(){ assert.equal(counter, 0, 'incr was not called'); done(); }, 96);
});
QUnit.test('debounce asap', function(assert) {
assert.expect(4);
var done = assert.async();
var a, b;
var counter = 0;
var incr = function(){ return ++counter; };
var debouncedIncr = _.debounce(incr, 64, true);
a = debouncedIncr();
b = debouncedIncr();
equal(a, 1);
equal(b, 1);
equal(counter, 1, 'incr was called immediately');
assert.equal(a, 1);
assert.equal(b, 1);
assert.equal(counter, 1, 'incr was called immediately');
_.delay(debouncedIncr, 16);
_.delay(debouncedIncr, 32);
_.delay(debouncedIncr, 48);
_.delay(function(){ equal(counter, 1, 'incr was debounced'); start(); }, 128);
_.delay(function(){ assert.equal(counter, 1, 'incr was debounced'); done(); }, 128);
});
asyncTest('debounce asap recursively', 2, function() {
QUnit.test('debounce asap cancel', function(assert) {
assert.expect(4);
var done = assert.async();
var a, b;
var counter = 0;
var incr = function(){ return ++counter; };
var debouncedIncr = _.debounce(incr, 64, true);
a = debouncedIncr();
debouncedIncr.cancel();
b = debouncedIncr();
assert.equal(a, 1);
assert.equal(b, 2);
assert.equal(counter, 2, 'incr was called immediately');
_.delay(debouncedIncr, 16);
_.delay(debouncedIncr, 32);
_.delay(debouncedIncr, 48);
_.delay(function(){ assert.equal(counter, 2, 'incr was debounced'); done(); }, 128);
});
QUnit.test('debounce asap recursively', function(assert) {
assert.expect(2);
var done = assert.async();
var counter = 0;
var debouncedIncr = _.debounce(function(){
counter++;
if (counter < 10) debouncedIncr();
}, 32, true);
debouncedIncr();
equal(counter, 1, 'incr was called immediately');
_.delay(function(){ equal(counter, 1, 'incr was debounced'); start(); }, 96);
assert.equal(counter, 1, 'incr was called immediately');
_.delay(function(){ assert.equal(counter, 1, 'incr was debounced'); done(); }, 96);
});
asyncTest('debounce after system time is set backwards', 2, function() {
QUnit.test('debounce after system time is set backwards', function(assert) {
assert.expect(2);
var done = assert.async();
var counter = 0;
var origNowFunc = _.now;
var debouncedIncr = _.debounce(function(){
@@ -425,21 +534,23 @@
}, 100, true);
debouncedIncr();
equal(counter, 1, 'incr was called immediately');
assert.equal(counter, 1, 'incr was called immediately');
_.now = function () {
_.now = function() {
return new Date(2013, 0, 1, 1, 1, 1);
};
_.delay(function() {
debouncedIncr();
equal(counter, 2, 'incr was debounced successfully');
start();
assert.equal(counter, 2, 'incr was debounced successfully');
done();
_.now = origNowFunc;
}, 200);
});
asyncTest('debounce re-entrant', 2, function() {
QUnit.test('debounce re-entrant', function(assert) {
assert.expect(2);
var done = assert.async();
var sequence = [
['b1', 'b2']
];
@@ -454,80 +565,81 @@
};
debouncedAppend = _.debounce(append, 32);
debouncedAppend.call('a1', 'a2');
equal(value, '');
assert.equal(value, '');
_.delay(function(){
equal(value, 'a1a2b1b2', 'append was debounced successfully');
start();
assert.equal(value, 'a1a2b1b2', 'append was debounced successfully');
done();
}, 100);
});
test('once', function() {
QUnit.test('once', function(assert) {
var num = 0;
var increment = _.once(function(){ return ++num; });
increment();
increment();
equal(num, 1);
assert.equal(num, 1);
equal(increment(), 1, 'stores a memo to the last value');
assert.equal(increment(), 1, 'stores a memo to the last value');
});
test('Recursive onced function.', 1, function() {
QUnit.test('Recursive onced function.', function(assert) {
assert.expect(1);
var f = _.once(function(){
ok(true);
assert.ok(true);
f();
});
f();
});
test('wrap', function() {
QUnit.test('wrap', function(assert) {
var greet = function(name){ return 'hi: ' + name; };
var backwards = _.wrap(greet, function(func, name){ return func(name) + ' ' + name.split('').reverse().join(''); });
equal(backwards('moe'), 'hi: moe eom', 'wrapped the salutation function');
assert.equal(backwards('moe'), 'hi: moe eom', 'wrapped the salutation function');
var inner = function(){ return 'Hello '; };
var obj = {name : 'Moe'};
obj.hi = _.wrap(inner, function(fn){ return fn() + this.name; });
equal(obj.hi(), 'Hello Moe');
var obj = {name: 'Moe'};
obj.hi = _.wrap(inner, function(fn){ return fn() + this.name; });
assert.equal(obj.hi(), 'Hello Moe');
var noop = function(){};
var noop = function(){};
var wrapped = _.wrap(noop, function(){ return Array.prototype.slice.call(arguments, 0); });
var ret = wrapped(['whats', 'your'], 'vector', 'victor');
deepEqual(ret, [noop, ['whats', 'your'], 'vector', 'victor']);
var ret = wrapped(['whats', 'your'], 'vector', 'victor');
assert.deepEqual(ret, [noop, ['whats', 'your'], 'vector', 'victor']);
});
test('negate', function() {
QUnit.test('negate', function(assert) {
var isOdd = function(n){ return n & 1; };
equal(_.negate(isOdd)(2), true, 'should return the complement of the given function');
equal(_.negate(isOdd)(3), false, 'should return the complement of the given function');
assert.equal(_.negate(isOdd)(2), true, 'should return the complement of the given function');
assert.equal(_.negate(isOdd)(3), false, 'should return the complement of the given function');
});
test('compose', function() {
QUnit.test('compose', function(assert) {
var greet = function(name){ return 'hi: ' + name; };
var exclaim = function(sentence){ return sentence + '!'; };
var composed = _.compose(exclaim, greet);
equal(composed('moe'), 'hi: moe!', 'can compose a function that takes another');
assert.equal(composed('moe'), 'hi: moe!', 'can compose a function that takes another');
composed = _.compose(greet, exclaim);
equal(composed('moe'), 'hi: moe!', 'in this case, the functions are also commutative');
assert.equal(composed('moe'), 'hi: moe!', 'in this case, the functions are also commutative');
// f(g(h(x, y, z)))
function h(x, y, z) {
equal(arguments.length, 3, 'First function called with multiple args');
assert.equal(arguments.length, 3, 'First function called with multiple args');
return z * y;
}
function g(x) {
equal(arguments.length, 1, 'Composed function is called with 1 argument');
assert.equal(arguments.length, 1, 'Composed function is called with 1 argument');
return x;
}
function f(x) {
equal(arguments.length, 1, 'Composed function is called with 1 argument');
assert.equal(arguments.length, 1, 'Composed function is called with 1 argument');
return x * 2;
}
composed = _.compose(f, g, h);
equal(composed(1, 2, 3), 12);
assert.equal(composed(1, 2, 3), 12);
});
test('after', function() {
QUnit.test('after', function(assert) {
var testAfter = function(afterAmount, timesCalled) {
var afterCalled = 0;
var after = _.after(afterAmount, function() {
@@ -537,13 +649,13 @@
return afterCalled;
};
equal(testAfter(5, 5), 1, 'after(N) should fire after being called N times');
equal(testAfter(5, 4), 0, 'after(N) should not fire unless called N times');
equal(testAfter(0, 0), 0, 'after(0) should not fire immediately');
equal(testAfter(0, 1), 1, 'after(0) should fire when first invoked');
assert.equal(testAfter(5, 5), 1, 'after(N) should fire after being called N times');
assert.equal(testAfter(5, 4), 0, 'after(N) should not fire unless called N times');
assert.equal(testAfter(0, 0), 0, 'after(0) should not fire immediately');
assert.equal(testAfter(0, 1), 1, 'after(0) should fire when first invoked');
});
test('before', function() {
QUnit.test('before', function(assert) {
var testBefore = function(beforeAmount, timesCalled) {
var beforeCalled = 0;
var before = _.before(beforeAmount, function() { beforeCalled++; });
@@ -551,31 +663,60 @@
return beforeCalled;
};
equal(testBefore(5, 5), 4, 'before(N) should not fire after being called N times');
equal(testBefore(5, 4), 4, 'before(N) should fire before being called N times');
equal(testBefore(0, 0), 0, 'before(0) should not fire immediately');
equal(testBefore(0, 1), 0, 'before(0) should not fire when first invoked');
assert.equal(testBefore(5, 5), 4, 'before(N) should not fire after being called N times');
assert.equal(testBefore(5, 4), 4, 'before(N) should fire before being called N times');
assert.equal(testBefore(0, 0), 0, 'before(0) should not fire immediately');
assert.equal(testBefore(0, 1), 0, 'before(0) should not fire when first invoked');
var context = {num: 0};
var increment = _.before(3, function(){ return ++this.num; });
_.times(10, increment, context);
equal(increment(), 2, 'stores a memo to the last value');
equal(context.num, 2, 'provides context');
assert.equal(increment(), 2, 'stores a memo to the last value');
assert.equal(context.num, 2, 'provides context');
});
test('iteratee', function() {
QUnit.test('iteratee', function(assert) {
var identity = _.iteratee();
equal(identity, _.identity, '_.iteratee is exposed as an external function.');
assert.equal(identity, _.identity, '_.iteratee is exposed as an external function.');
function fn() {
return arguments;
}
_.each([_.iteratee(fn), _.iteratee(fn, {})], function(cb) {
equal(cb().length, 0);
deepEqual(_.toArray(cb(1, 2, 3)), _.range(1, 4));
deepEqual(_.toArray(cb(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)), _.range(1, 11));
assert.equal(cb().length, 0);
assert.deepEqual(_.toArray(cb(1, 2, 3)), _.range(1, 4));
assert.deepEqual(_.toArray(cb(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)), _.range(1, 11));
});
});
QUnit.test('restArgs', function(assert) {
assert.expect(10);
_.restArgs(function(a, args) {
assert.strictEqual(a, 1);
assert.deepEqual(args, [2, 3], 'collects rest arguments into an array');
})(1, 2, 3);
_.restArgs(function(a, args) {
assert.strictEqual(a, void 0);
assert.deepEqual(args, [], 'passes empty array if there are not enough arguments');
})();
_.restArgs(function(a, b, c, args) {
assert.strictEqual(arguments.length, 4);
assert.deepEqual(args, [4, 5], 'works on functions with many named parameters');
})(1, 2, 3, 4, 5);
var obj = {};
_.restArgs(function() {
assert.strictEqual(this, obj, 'invokes function with this context');
}).call(obj);
_.restArgs(function(array, iteratee, context) {
assert.deepEqual(array, [1, 2, 3, 4], 'startIndex can be used manually specify index of rest parameter');
assert.strictEqual(iteratee, void 0);
assert.strictEqual(context, void 0);
}, 0)(1, 2, 3, 4);
});
}());

File diff suppressed because it is too large Load Diff

View File

@@ -4,181 +4,217 @@
QUnit.module('Utility', {
setup: function() {
beforeEach: function() {
templateSettings = _.clone(_.templateSettings);
},
teardown: function() {
afterEach: function() {
_.templateSettings = templateSettings;
}
});
test('#750 - Return _ instance.', 2, function() {
if (typeof this == 'object') {
QUnit.test('noConflict', function(assert) {
var underscore = _.noConflict();
assert.equal(underscore.identity(1), 1);
if (typeof require != 'function') {
assert.equal(this._, void 0, 'global underscore is removed');
this._ = underscore;
} else if (typeof global !== 'undefined') {
delete global._;
}
});
}
if (typeof require == 'function') {
QUnit.test('noConflict (node vm)', function(assert) {
assert.expect(2);
var done = assert.async();
var fs = require('fs');
var vm = require('vm');
var filename = __dirname + '/../underscore.js';
fs.readFile(filename, function(err, content){
var sandbox = vm.createScript(
content + 'this.underscore = this._.noConflict();',
filename
);
var context = {_: 'oldvalue'};
sandbox.runInNewContext(context);
assert.equal(context._, 'oldvalue');
assert.equal(context.underscore.VERSION, _.VERSION);
done();
});
});
}
QUnit.test('#750 - Return _ instance.', function(assert) {
assert.expect(2);
var instance = _([]);
ok(_(instance) === instance);
ok(new _(instance) === instance);
assert.ok(_(instance) === instance);
assert.ok(new _(instance) === instance);
});
test('identity', function() {
var stooge = {name : 'moe'};
equal(_.identity(stooge), stooge, 'stooge is the same as his identity');
QUnit.test('identity', function(assert) {
var stooge = {name: 'moe'};
assert.equal(_.identity(stooge), stooge, 'stooge is the same as his identity');
});
test('constant', function() {
var stooge = {name : 'moe'};
equal(_.constant(stooge)(), stooge, 'should create a function that returns stooge');
QUnit.test('constant', function(assert) {
var stooge = {name: 'moe'};
assert.equal(_.constant(stooge)(), stooge, 'should create a function that returns stooge');
});
test('noop', function() {
strictEqual(_.noop('curly', 'larry', 'moe'), undefined, 'should always return undefined');
QUnit.test('noop', function(assert) {
assert.strictEqual(_.noop('curly', 'larry', 'moe'), void 0, 'should always return undefined');
});
test('property', function() {
var stooge = {name : 'moe'};
equal(_.property('name')(stooge), 'moe', 'should return the property with the given name');
equal(_.property('name')(null), undefined, 'should return undefined for null values');
equal(_.property('name')(undefined), undefined, 'should return undefined for undefined values');
QUnit.test('property', function(assert) {
var stooge = {name: 'moe'};
assert.equal(_.property('name')(stooge), 'moe', 'should return the property with the given name');
assert.equal(_.property('name')(null), void 0, 'should return undefined for null values');
assert.equal(_.property('name')(void 0), void 0, 'should return undefined for undefined values');
});
test('propertyOf', function() {
QUnit.test('propertyOf', function(assert) {
var stoogeRanks = _.propertyOf({curly: 2, moe: 1, larry: 3});
equal(stoogeRanks('curly'), 2, 'should return the property with the given name');
equal(stoogeRanks(null), undefined, 'should return undefined for null values');
equal(stoogeRanks(undefined), undefined, 'should return undefined for undefined values');
assert.equal(stoogeRanks('curly'), 2, 'should return the property with the given name');
assert.equal(stoogeRanks(null), void 0, 'should return undefined for null values');
assert.equal(stoogeRanks(void 0), void 0, 'should return undefined for undefined values');
function MoreStooges() { this.shemp = 87; }
MoreStooges.prototype = {curly: 2, moe: 1, larry: 3};
var moreStoogeRanks = _.propertyOf(new MoreStooges());
equal(moreStoogeRanks('curly'), 2, 'should return properties from further up the prototype chain');
assert.equal(moreStoogeRanks('curly'), 2, 'should return properties from further up the prototype chain');
var nullPropertyOf = _.propertyOf(null);
equal(nullPropertyOf('curly'), undefined, 'should return undefined when obj is null');
var undefPropertyOf = _.propertyOf(undefined);
equal(undefPropertyOf('curly'), undefined, 'should return undefined when obj is undefined');
assert.equal(nullPropertyOf('curly'), void 0, 'should return undefined when obj is null');
var undefPropertyOf = _.propertyOf(void 0);
assert.equal(undefPropertyOf('curly'), void 0, 'should return undefined when obj is undefined');
});
test('random', function() {
QUnit.test('random', function(assert) {
var array = _.range(1000);
var min = Math.pow(2, 31);
var max = Math.pow(2, 62);
ok(_.every(array, function() {
assert.ok(_.every(array, function() {
return _.random(min, max) >= min;
}), 'should produce a random number greater than or equal to the minimum number');
ok(_.some(array, function() {
assert.ok(_.some(array, function() {
return _.random(Number.MAX_VALUE) > 0;
}), 'should produce a random number when passed `Number.MAX_VALUE`');
});
test('now', function() {
QUnit.test('now', function(assert) {
var diff = _.now() - new Date().getTime();
ok(diff <= 0 && diff > -5, 'Produces the correct time in milliseconds');//within 5ms
assert.ok(diff <= 0 && diff > -5, 'Produces the correct time in milliseconds');//within 5ms
});
test('uniqueId', function() {
QUnit.test('uniqueId', function(assert) {
var ids = [], i = 0;
while (i++ < 100) ids.push(_.uniqueId());
equal(_.uniq(ids).length, ids.length, 'can generate a globally-unique stream of ids');
assert.equal(_.uniq(ids).length, ids.length, 'can generate a globally-unique stream of ids');
});
test('times', function() {
QUnit.test('times', function(assert) {
var vals = [];
_.times(3, function (i) { vals.push(i); });
deepEqual(vals, [0, 1, 2], 'is 0 indexed');
_.times(3, function(i) { vals.push(i); });
assert.deepEqual(vals, [0, 1, 2], 'is 0 indexed');
//
vals = [];
_(3).times(function(i) { vals.push(i); });
deepEqual(vals, [0, 1, 2], 'works as a wrapper');
assert.deepEqual(vals, [0, 1, 2], 'works as a wrapper');
// collects return values
deepEqual([0, 1, 2], _.times(3, function(i) { return i; }), 'collects return values');
assert.deepEqual([0, 1, 2], _.times(3, function(i) { return i; }), 'collects return values');
deepEqual(_.times(0, _.identity), []);
deepEqual(_.times(-1, _.identity), []);
deepEqual(_.times(parseFloat('-Infinity'), _.identity), []);
assert.deepEqual(_.times(0, _.identity), []);
assert.deepEqual(_.times(-1, _.identity), []);
assert.deepEqual(_.times(parseFloat('-Infinity'), _.identity), []);
});
test('mixin', function() {
QUnit.test('mixin', function(assert) {
_.mixin({
myReverse: function(string) {
return string.split('').reverse().join('');
}
});
equal(_.myReverse('panacea'), 'aecanap', 'mixed in a function to _');
equal(_('champ').myReverse(), 'pmahc', 'mixed in a function to the OOP wrapper');
assert.equal(_.myReverse('panacea'), 'aecanap', 'mixed in a function to _');
assert.equal(_('champ').myReverse(), 'pmahc', 'mixed in a function to the OOP wrapper');
});
test('_.escape', function() {
equal(_.escape(null), '');
QUnit.test('_.escape', function(assert) {
assert.equal(_.escape(null), '');
});
test('_.unescape', function() {
QUnit.test('_.unescape', function(assert) {
var string = 'Curly & Moe';
equal(_.unescape(null), '');
equal(_.unescape(_.escape(string)), string);
equal(_.unescape(string), string, 'don\'t unescape unnecessarily');
assert.equal(_.unescape(null), '');
assert.equal(_.unescape(_.escape(string)), string);
assert.equal(_.unescape(string), string, 'don\'t unescape unnecessarily');
});
// Don't care what they escape them to just that they're escaped and can be unescaped
test('_.escape & unescape', function() {
QUnit.test('_.escape & unescape', function(assert) {
// test & (&amp;) seperately obviously
var escapeCharacters = ['<', '>', '"', '\'', '`'];
_.each(escapeCharacters, function(escapeChar) {
var str = 'a ' + escapeChar + ' string escaped';
var escaped = _.escape(str);
notEqual(str, escaped, escapeChar + ' is escaped');
equal(str, _.unescape(escaped), escapeChar + ' can be unescaped');
var s = 'a ' + escapeChar + ' string escaped';
var e = _.escape(s);
assert.notEqual(s, e, escapeChar + ' is escaped');
assert.equal(s, _.unescape(e), escapeChar + ' can be unescaped');
str = 'a ' + escapeChar + escapeChar + escapeChar + 'some more string' + escapeChar;
escaped = _.escape(str);
s = 'a ' + escapeChar + escapeChar + escapeChar + 'some more string' + escapeChar;
e = _.escape(s);
equal(escaped.indexOf(escapeChar), -1, 'can escape multiple occurances of ' + escapeChar);
equal(_.unescape(escaped), str, 'multiple occurrences of ' + escapeChar + ' can be unescaped');
assert.equal(e.indexOf(escapeChar), -1, 'can escape multiple occurances of ' + escapeChar);
assert.equal(_.unescape(e), s, 'multiple occurrences of ' + escapeChar + ' can be unescaped');
});
// handles multiple escape characters at once
var joiner = ' other stuff ';
var allEscaped = escapeCharacters.join(joiner);
allEscaped += allEscaped;
ok(_.every(escapeCharacters, function(escapeChar) {
assert.ok(_.every(escapeCharacters, function(escapeChar) {
return allEscaped.indexOf(escapeChar) !== -1;
}), 'handles multiple characters');
ok(allEscaped.indexOf(joiner) >= 0, 'can escape multiple escape characters at the same time');
assert.ok(allEscaped.indexOf(joiner) >= 0, 'can escape multiple escape characters at the same time');
// test & -> &amp;
var str = 'some string & another string & yet another';
var escaped = _.escape(str);
ok(escaped.indexOf('&') !== -1, 'handles & aka &amp;');
equal(_.unescape(str), str, 'can unescape &amp;');
assert.ok(escaped.indexOf('&') !== -1, 'handles & aka &amp;');
assert.equal(_.unescape(str), str, 'can unescape &amp;');
});
test('template', function() {
QUnit.test('template', function(assert) {
var basicTemplate = _.template("<%= thing %> is gettin' on my noives!");
var result = basicTemplate({thing : 'This'});
equal(result, "This is gettin' on my noives!", 'can do basic attribute interpolation');
var result = basicTemplate({thing: 'This'});
assert.equal(result, "This is gettin' on my noives!", 'can do basic attribute interpolation');
var sansSemicolonTemplate = _.template('A <% this %> B');
equal(sansSemicolonTemplate(), 'A B');
assert.equal(sansSemicolonTemplate(), 'A B');
var backslashTemplate = _.template('<%= thing %> is \\ridanculous');
equal(backslashTemplate({thing: 'This'}), 'This is \\ridanculous');
assert.equal(backslashTemplate({thing: 'This'}), 'This is \\ridanculous');
var escapeTemplate = _.template('<%= a ? "checked=\\"checked\\"" : "" %>');
equal(escapeTemplate({a: true}), 'checked="checked"', 'can handle slash escapes in interpolations.');
assert.equal(escapeTemplate({a: true}), 'checked="checked"', 'can handle slash escapes in interpolations.');
var fancyTemplate = _.template('<ul><% ' +
' for (var key in people) { ' +
'%><li><%= people[key] %></li><% } %></ul>');
result = fancyTemplate({people : {moe : 'Moe', larry : 'Larry', curly : 'Curly'}});
equal(result, '<ul><li>Moe</li><li>Larry</li><li>Curly</li></ul>', 'can run arbitrary javascript in templates');
result = fancyTemplate({people: {moe: 'Moe', larry: 'Larry', curly: 'Curly'}});
assert.equal(result, '<ul><li>Moe</li><li>Larry</li><li>Curly</li></ul>', 'can run arbitrary javascript in templates');
var escapedCharsInJavascriptTemplate = _.template('<ul><% _.each(numbers.split("\\n"), function(item) { %><li><%= item %></li><% }) %></ul>');
result = escapedCharsInJavascriptTemplate({numbers: 'one\ntwo\nthree\nfour'});
equal(result, '<ul><li>one</li><li>two</li><li>three</li><li>four</li></ul>', 'Can use escaped characters (e.g. \\n) in JavaScript');
assert.equal(result, '<ul><li>one</li><li>two</li><li>three</li><li>four</li></ul>', 'Can use escaped characters (e.g. \\n) in JavaScript');
var namespaceCollisionTemplate = _.template('<%= pageCount %> <%= thumbnails[pageCount] %> <% _.each(thumbnails, function(p) { %><div class="thumbnail" rel="<%= p %>"></div><% }); %>');
result = namespaceCollisionTemplate({
@@ -189,32 +225,32 @@
3: 'p3-thumbnail.gif'
}
});
equal(result, '3 p3-thumbnail.gif <div class="thumbnail" rel="p1-thumbnail.gif"></div><div class="thumbnail" rel="p2-thumbnail.gif"></div><div class="thumbnail" rel="p3-thumbnail.gif"></div>');
assert.equal(result, '3 p3-thumbnail.gif <div class="thumbnail" rel="p1-thumbnail.gif"></div><div class="thumbnail" rel="p2-thumbnail.gif"></div><div class="thumbnail" rel="p3-thumbnail.gif"></div>');
var noInterpolateTemplate = _.template('<div><p>Just some text. Hey, I know this is silly but it aids consistency.</p></div>');
result = noInterpolateTemplate();
equal(result, '<div><p>Just some text. Hey, I know this is silly but it aids consistency.</p></div>');
assert.equal(result, '<div><p>Just some text. Hey, I know this is silly but it aids consistency.</p></div>');
var quoteTemplate = _.template("It's its, not it's");
equal(quoteTemplate({}), "It's its, not it's");
assert.equal(quoteTemplate({}), "It's its, not it's");
var quoteInStatementAndBody = _.template('<% ' +
" if(foo == 'bar'){ " +
"%>Statement quotes and 'quotes'.<% } %>");
equal(quoteInStatementAndBody({foo: 'bar'}), "Statement quotes and 'quotes'.");
assert.equal(quoteInStatementAndBody({foo: 'bar'}), "Statement quotes and 'quotes'.");
var withNewlinesAndTabs = _.template('This\n\t\tis: <%= x %>.\n\tok.\nend.');
equal(withNewlinesAndTabs({x: 'that'}), 'This\n\t\tis: that.\n\tok.\nend.');
assert.equal(withNewlinesAndTabs({x: 'that'}), 'This\n\t\tis: that.\n\tok.\nend.');
var template = _.template('<i><%- value %></i>');
result = template({value: '<script>'});
equal(result, '<i>&lt;script&gt;</i>');
assert.equal(result, '<i>&lt;script&gt;</i>');
var stooge = {
name: 'Moe',
template: _.template("I'm <%= this.name %>")
};
equal(stooge.template(), "I'm Moe");
assert.equal(stooge.template(), "I'm Moe");
template = _.template('\n ' +
' <%\n ' +
@@ -222,159 +258,163 @@
' if (data) { data += 12345; }; %>\n ' +
' <li><%= data %></li>\n '
);
equal(template({data : 12345}).replace(/\s/g, ''), '<li>24690</li>');
assert.equal(template({data: 12345}).replace(/\s/g, ''), '<li>24690</li>');
_.templateSettings = {
evaluate : /\{\{([\s\S]+?)\}\}/g,
interpolate : /\{\{=([\s\S]+?)\}\}/g
evaluate: /\{\{([\s\S]+?)\}\}/g,
interpolate: /\{\{=([\s\S]+?)\}\}/g
};
var custom = _.template('<ul>{{ for (var key in people) { }}<li>{{= people[key] }}</li>{{ } }}</ul>');
result = custom({people : {moe : 'Moe', larry : 'Larry', curly : 'Curly'}});
equal(result, '<ul><li>Moe</li><li>Larry</li><li>Curly</li></ul>', 'can run arbitrary javascript in templates');
result = custom({people: {moe: 'Moe', larry: 'Larry', curly: 'Curly'}});
assert.equal(result, '<ul><li>Moe</li><li>Larry</li><li>Curly</li></ul>', 'can run arbitrary javascript in templates');
var customQuote = _.template("It's its, not it's");
equal(customQuote({}), "It's its, not it's");
assert.equal(customQuote({}), "It's its, not it's");
quoteInStatementAndBody = _.template("{{ if(foo == 'bar'){ }}Statement quotes and 'quotes'.{{ } }}");
equal(quoteInStatementAndBody({foo: 'bar'}), "Statement quotes and 'quotes'.");
assert.equal(quoteInStatementAndBody({foo: 'bar'}), "Statement quotes and 'quotes'.");
_.templateSettings = {
evaluate : /<\?([\s\S]+?)\?>/g,
interpolate : /<\?=([\s\S]+?)\?>/g
evaluate: /<\?([\s\S]+?)\?>/g,
interpolate: /<\?=([\s\S]+?)\?>/g
};
var customWithSpecialChars = _.template('<ul><? for (var key in people) { ?><li><?= people[key] ?></li><? } ?></ul>');
result = customWithSpecialChars({people : {moe : 'Moe', larry : 'Larry', curly : 'Curly'}});
equal(result, '<ul><li>Moe</li><li>Larry</li><li>Curly</li></ul>', 'can run arbitrary javascript in templates');
result = customWithSpecialChars({people: {moe: 'Moe', larry: 'Larry', curly: 'Curly'}});
assert.equal(result, '<ul><li>Moe</li><li>Larry</li><li>Curly</li></ul>', 'can run arbitrary javascript in templates');
var customWithSpecialCharsQuote = _.template("It's its, not it's");
equal(customWithSpecialCharsQuote({}), "It's its, not it's");
assert.equal(customWithSpecialCharsQuote({}), "It's its, not it's");
quoteInStatementAndBody = _.template("<? if(foo == 'bar'){ ?>Statement quotes and 'quotes'.<? } ?>");
equal(quoteInStatementAndBody({foo: 'bar'}), "Statement quotes and 'quotes'.");
assert.equal(quoteInStatementAndBody({foo: 'bar'}), "Statement quotes and 'quotes'.");
_.templateSettings = {
interpolate : /\{\{(.+?)\}\}/g
interpolate: /\{\{(.+?)\}\}/g
};
var mustache = _.template('Hello {{planet}}!');
equal(mustache({planet : 'World'}), 'Hello World!', 'can mimic mustache.js');
assert.equal(mustache({planet: 'World'}), 'Hello World!', 'can mimic mustache.js');
var templateWithNull = _.template('a null undefined {{planet}}');
equal(templateWithNull({planet : 'world'}), 'a null undefined world', 'can handle missing escape and evaluate settings');
assert.equal(templateWithNull({planet: 'world'}), 'a null undefined world', 'can handle missing escape and evaluate settings');
});
test('_.template provides the generated function source, when a SyntaxError occurs', function() {
QUnit.test('_.template provides the generated function source, when a SyntaxError occurs', function(assert) {
var source;
try {
_.template('<b><%= if x %></b>');
} catch (ex) {
var source = ex.source;
source = ex.source;
}
ok(/__p/.test(source));
assert.ok(/__p/.test(source));
});
test('_.template handles \\u2028 & \\u2029', function() {
QUnit.test('_.template handles \\u2028 & \\u2029', function(assert) {
var tmpl = _.template('<p>\u2028<%= "\\u2028\\u2029" %>\u2029</p>');
strictEqual(tmpl(), '<p>\u2028\u2028\u2029\u2029</p>');
assert.strictEqual(tmpl(), '<p>\u2028\u2028\u2029\u2029</p>');
});
test('result calls functions and returns primitives', function() {
QUnit.test('result calls functions and returns primitives', function(assert) {
var obj = {w: '', x: 'x', y: function(){ return this.x; }};
strictEqual(_.result(obj, 'w'), '');
strictEqual(_.result(obj, 'x'), 'x');
strictEqual(_.result(obj, 'y'), 'x');
strictEqual(_.result(obj, 'z'), undefined);
strictEqual(_.result(null, 'x'), undefined);
assert.strictEqual(_.result(obj, 'w'), '');
assert.strictEqual(_.result(obj, 'x'), 'x');
assert.strictEqual(_.result(obj, 'y'), 'x');
assert.strictEqual(_.result(obj, 'z'), void 0);
assert.strictEqual(_.result(null, 'x'), void 0);
});
test('result returns a default value if object is null or undefined', function() {
strictEqual(_.result(null, 'b', 'default'), 'default');
strictEqual(_.result(undefined, 'c', 'default'), 'default');
strictEqual(_.result(''.match('missing'), 1, 'default'), 'default');
QUnit.test('result returns a default value if object is null or undefined', function(assert) {
assert.strictEqual(_.result(null, 'b', 'default'), 'default');
assert.strictEqual(_.result(void 0, 'c', 'default'), 'default');
assert.strictEqual(_.result(''.match('missing'), 1, 'default'), 'default');
});
test('result returns a default value if property of object is missing', function() {
strictEqual(_.result({d: null}, 'd', 'default'), null);
strictEqual(_.result({e: false}, 'e', 'default'), false);
QUnit.test('result returns a default value if property of object is missing', function(assert) {
assert.strictEqual(_.result({d: null}, 'd', 'default'), null);
assert.strictEqual(_.result({e: false}, 'e', 'default'), false);
});
test('result only returns the default value if the object does not have the property or is undefined', function() {
strictEqual(_.result({}, 'b', 'default'), 'default');
strictEqual(_.result({d: undefined}, 'd', 'default'), 'default');
QUnit.test('result only returns the default value if the object does not have the property or is undefined', function(assert) {
assert.strictEqual(_.result({}, 'b', 'default'), 'default');
assert.strictEqual(_.result({d: void 0}, 'd', 'default'), 'default');
});
test('result does not return the default if the property of an object is found in the prototype', function() {
QUnit.test('result does not return the default if the property of an object is found in the prototype', function(assert) {
var Foo = function(){};
Foo.prototype.bar = 1;
strictEqual(_.result(new Foo, 'bar', 2), 1);
assert.strictEqual(_.result(new Foo, 'bar', 2), 1);
});
test('result does use the fallback when the result of invoking the property is undefined', function() {
QUnit.test('result does use the fallback when the result of invoking the property is undefined', function(assert) {
var obj = {a: function() {}};
strictEqual(_.result(obj, 'a', 'failed'), undefined);
assert.strictEqual(_.result(obj, 'a', 'failed'), void 0);
});
test('result fallback can use a function', function() {
QUnit.test('result fallback can use a function', function(assert) {
var obj = {a: [1, 2, 3]};
strictEqual(_.result(obj, 'b', _.constant(5)), 5);
strictEqual(_.result(obj, 'b', function() {
assert.strictEqual(_.result(obj, 'b', _.constant(5)), 5);
assert.strictEqual(_.result(obj, 'b', function() {
return this.a;
}), obj.a, 'called with context');
});
test('_.templateSettings.variable', function() {
QUnit.test('_.templateSettings.variable', function(assert) {
var s = '<%=data.x%>';
var data = {x: 'x'};
var tmp = _.template(s, {variable: 'data'});
strictEqual(tmp(data), 'x');
assert.strictEqual(tmp(data), 'x');
_.templateSettings.variable = 'data';
strictEqual(_.template(s)(data), 'x');
assert.strictEqual(_.template(s)(data), 'x');
});
test('#547 - _.templateSettings is unchanged by custom settings.', function() {
ok(!_.templateSettings.variable);
QUnit.test('#547 - _.templateSettings is unchanged by custom settings.', function(assert) {
assert.ok(!_.templateSettings.variable);
_.template('', {}, {variable: 'x'});
ok(!_.templateSettings.variable);
assert.ok(!_.templateSettings.variable);
});
test('#556 - undefined template variables.', function() {
QUnit.test('#556 - undefined template variables.', function(assert) {
var template = _.template('<%=x%>');
strictEqual(template({x: null}), '');
strictEqual(template({x: undefined}), '');
assert.strictEqual(template({x: null}), '');
assert.strictEqual(template({x: void 0}), '');
var templateEscaped = _.template('<%-x%>');
strictEqual(templateEscaped({x: null}), '');
strictEqual(templateEscaped({x: undefined}), '');
assert.strictEqual(templateEscaped({x: null}), '');
assert.strictEqual(templateEscaped({x: void 0}), '');
var templateWithProperty = _.template('<%=x.foo%>');
strictEqual(templateWithProperty({x: {}}), '');
strictEqual(templateWithProperty({x: {}}), '');
assert.strictEqual(templateWithProperty({x: {}}), '');
assert.strictEqual(templateWithProperty({x: {}}), '');
var templateWithPropertyEscaped = _.template('<%-x.foo%>');
strictEqual(templateWithPropertyEscaped({x: {}}), '');
strictEqual(templateWithPropertyEscaped({x: {}}), '');
assert.strictEqual(templateWithPropertyEscaped({x: {}}), '');
assert.strictEqual(templateWithPropertyEscaped({x: {}}), '');
});
test('interpolate evaluates code only once.', 2, function() {
QUnit.test('interpolate evaluates code only once.', function(assert) {
assert.expect(2);
var count = 0;
var template = _.template('<%= f() %>');
template({f: function(){ ok(!count++); }});
template({f: function(){ assert.ok(!count++); }});
var countEscaped = 0;
var templateEscaped = _.template('<%- f() %>');
templateEscaped({f: function(){ ok(!countEscaped++); }});
templateEscaped({f: function(){ assert.ok(!countEscaped++); }});
});
test('#746 - _.template settings are not modified.', 1, function() {
QUnit.test('#746 - _.template settings are not modified.', function(assert) {
assert.expect(1);
var settings = {};
_.template('', null, settings);
deepEqual(settings, {});
assert.deepEqual(settings, {});
});
test('#779 - delimeters are applied to unescaped text.', 1, function() {
QUnit.test('#779 - delimeters are applied to unescaped text.', function(assert) {
assert.expect(1);
var template = _.template('<<\nx\n>>', null, {evaluate: /<<(.*?)>>/g});
strictEqual(template(), '<<\nx\n>>');
assert.strictEqual(template(), '<<\nx\n>>');
});
}());

File diff suppressed because it is too large Load Diff