Compare commits

...

2489 Commits
3.10.0 ... 4.17

Author SHA1 Message Date
Benjamin Tan
f299b52f39 Bump to v4.17.21 2021-02-20 23:33:48 +08:00
Michał Lipiński
c4847ebe7d Improve performance of toNumber, trim and trimEnd on large input strings
This prevents potential ReDoS attacks using `_.toNumber` and `_.trim*`
as potential attack vectors.

Closes #5065.
2021-02-20 17:18:39 +08:00
Christophe Coevoet
3469357cff Prevent command injection through _.template's variable option
Closes #5085.
2021-02-20 16:28:01 +08:00
Benjamin Tan
ded9bc6658 Bump to v4.17.20. 2020-08-14 00:52:55 +08:00
Benjamin Tan
63150ef764 Documentation fixes. 2020-08-14 00:36:26 +08:00
Benjamin Tan
00f0f62a97 test.js: Remove trailing comma. 2020-07-26 19:38:01 +08:00
Benjamin Tan
846e434c7a Temporarily use a custom fork of lodash-cli. 2020-07-26 19:37:20 +08:00
Benjamin Tan
5d046f39cb Re-enable Travis tests on 4.17 branch. 2020-07-26 19:35:19 +08:00
Benjamin Tan
aa816b36d4 Remove /npm-package. 2020-07-26 19:34:22 +08:00
Mathias Bynens
d7fbc52ee0 Bump to v4.17.19 2020-07-08 19:14:09 +02:00
Mathias Bynens
2e1c0f22f4 Add npm-package 2020-07-08 19:10:23 +02:00
Mathias Bynens
1b6c282299 Bump to v4.17.18 2020-07-08 18:04:03 +02:00
Mathias Bynens
a370ac8140 Bump to v4.17.17 2020-07-08 14:00:48 +02:00
Mathias Bynens
1144918f35 Rebuild lodash and docs 2020-07-08 10:08:29 +02:00
Mathias Bynens
3a3b0fd339 Bump to v4.17.16 2020-07-08 09:44:35 +02:00
Jakub Mikulas
c84fe82760 fix(zipObjectDeep): prototype pollution (#4759) 2020-07-02 14:47:49 -07:00
Alex Brasetvik
e7b28ea6cb Sanitize sourceURL so it cannot affect evaled code (#4518) 2020-06-03 23:36:12 -07:00
Chinedum Ukejianya
0cec225778 Fix lodash.isEqual for circular references (#4320) (#4515) 2019-10-16 14:43:11 -07:00
Artemy Tregubenko
94c3a8133c Document matches* shorthands for over* methods (#4510) (#4514) 2019-10-13 10:54:27 -07:00
Michał Lipiński
659e8c019c Ensure orderBy will accept iteratee path arrays #4438 (#4513) 2019-10-10 13:04:37 -07:00
Graeme Yeates
602cc3f03d (4.17) Short circuit sortedIndexBy methods for empty arrays (#4497) 2019-10-04 10:23:55 -07:00
max
b281ddecc4 change documentation, show clearly how sortBy work with two iteratees (#4467) 2019-09-16 21:31:36 -07:00
John-David Dalton
ddfd9b11a0 Bump to v4.17.15. 2019-07-17 10:06:33 -07:00
John-David Dalton
b185fcee26 Rebuild lodash and docs. 2019-07-17 10:05:47 -07:00
John-David Dalton
be87d30394 Bump to v4.17.14. 2019-07-10 06:33:09 -07:00
John-David Dalton
a6fe6b1e17 Rebuild lodash and docs. 2019-07-10 06:32:17 -07:00
John-David Dalton
e37182845f Bump to v4.17.13. 2019-07-09 15:16:26 -07:00
John-David Dalton
357e899e68 Rebuild lodash and docs. 2019-07-09 15:15:19 -07:00
John-David Dalton
fd9a062d57 Bump to v4.17.12. 2019-07-09 13:42:00 -07:00
John-David Dalton
e77d68121f Rebuild lodash and docs. 2019-07-09 13:34:41 -07:00
John-David Dalton
629d186579 Update OpenJS references. 2019-07-09 13:31:30 -07:00
John-David Dalton
2406eac542 Fix minified build. 2019-07-09 13:30:56 -07:00
John-David Dalton
17a34bc585 Fix test bootstrap for core build. 2019-07-09 12:48:18 -07:00
John-David Dalton
53838a38f8 Fix tests in older browsers. 2019-07-09 12:43:33 -07:00
John-David Dalton
29e258497b Fix style:test lint nits. 2019-07-09 09:53:48 -07:00
John-David Dalton
8f4d3eb018 Update deps. 2019-07-09 09:36:22 -07:00
John-David Dalton
02b3295a63 Format nit. 2019-07-09 09:34:08 -07:00
John-David Dalton
52ab48c054 Use nativeIsFinite() instead of Number.isFinite(). 2019-07-09 09:33:04 -07:00
John-David Dalton
f8dc2149f7 Whitespace nit. 2019-07-09 09:32:38 -07:00
John-David Dalton
deb65de218 Revert "perf(toNumber): use +value to convert binary/octal/hexadecimal string (#4230)"
This reverts commit 7084300d34.
2019-07-09 09:29:54 -07:00
Alex Brasetvik
60eb517911 Prevent prototype pollution chaining to code execution via _.template (#4355) 2019-07-09 09:09:55 -07:00
Kirill
1f8ea07746 fix: prototype pollution in _.defaultsDeep (#4336) 2019-06-24 09:17:55 -07:00
Erick Calder
e42cd97dae Fixes issue with Object prototype and the chaining syntax. [closes #4247] 2019-05-09 13:54:13 -07:00
Jeff Friesen
343456d696 Round Infinity with a precision argument returns Infinity (#4272)
* Round Infinity with a precision argument returns Infinity

* Also making sure this is true for -Infinity
* Tested with _.round(), _.floor() and _.ceil()

* Switch to using isFinite to check if number should be rounded

* Add tests for rounding NaN now that there is an isFinite check
2019-04-18 13:04:18 -07:00
Marc Hassan
0b8592a35c mergeWith: stack passed to customizer should always be defined (#4244)
Summary:
If the first values encountered in the `object` in mergeWith are not objects, `stack` is undefined when passed to the `customizer`. Once the first object-ish value is encountered, `stack` gets initialized, and all further calls to `customizer` include a defined `stack`. This PR makes `stack` always defined, even before the first object-ish value is encountered.
2019-03-21 20:54:53 -07:00
Amu
7084300d34 perf(toNumber): use +value to convert binary/octal/hexadecimal string (#4230) 2019-03-13 22:47:28 -07:00
liang feng
15b156512f cancel old timer (#4139) 2019-02-11 22:49:02 -08:00
John-David Dalton
bda6f2795f Update wording of fp wiki template for method spread rule exceptions. 2018-12-04 20:26:22 -08:00
John-David Dalton
1cb18dfada Revert "Ensure _.pick paths aren't interpolated twice. [closes #3952]"
This reverts commit 39a7eae40d.
2018-11-21 10:23:00 -06:00
John-David Dalton
39a7eae40d Ensure _.pick paths aren't interpolated twice. [closes #3952] 2018-09-17 22:38:33 -07:00
John-David Dalton
e0cbb4c8e6 Ensure map and set clones contain custom properties of source values. [closes #3951] 2018-09-17 22:31:34 -07:00
John-David Dalton
0843bd46ef Bump to v4.17.11. 2018-09-12 10:44:07 -07:00
John-David Dalton
3ac4b261e4 Rebuild lodash and docs. 2018-09-12 10:44:01 -07:00
John-David Dalton
eaa9f36e91 Commit package-lock.json. 2018-08-31 16:22:41 -07:00
John-David Dalton
552f94a7db Lint nits. 2018-08-31 15:35:06 -07:00
John-David Dalton
d8ddc1a15f Add test for indirectly merging Object properties. 2018-08-31 15:34:45 -07:00
John-David Dalton
e5f9af5418 Remove prototype property check in safeGet(). 2018-08-31 15:22:17 -07:00
John-David Dalton
2de676fe76 Ensure placeholder properties are set for fp.convert() results. [closes #3440] 2018-08-30 23:57:31 -07:00
John-David Dalton
278c6dd33d Cleanup _.merge tests for function properties. 2018-08-30 22:58:11 -07:00
sina
79b9d20a91 Fix inconsistent merging of multiple sources to function property 2018-08-30 22:35:04 -07:00
John-David Dalton
6e62e1e8df Cleanup ReDoS test. 2018-08-30 22:33:55 -07:00
Manuel Jasso
5c08f18d36 Prevent ReDoS
To fix https://github.com/lodash/lodash/issues/3359, modified reHasUnicodeWord to remove an unnecessary comma which made the regex greedy, this is only a test regex and not a matching regex. Added unit tests, this now should run under 5 ms instead of over 1000 ms for huge 50k+ char words.
2018-08-30 22:07:27 -07:00
John-David Dalton
90e6199a16 Ensure Object.prototype is not augmented by _.merge. 2018-08-30 22:06:15 -07:00
John-David Dalton
67389a8c78 Bump to v4.17.10. 2018-04-24 15:27:33 -07:00
John-David Dalton
a65fd33603 Rebuild lodash and docs. 2018-04-24 15:26:43 -07:00
John-David Dalton
b002100433 Bump to v4.17.9. 2018-04-24 10:29:57 -07:00
John-David Dalton
4680cdacc0 Rebuild lodash and docs. 2018-04-24 10:29:50 -07:00
John-David Dalton
852988e04a Use util.types to migrate DEP0103 in Node.js.
PR: #3704
2018-04-24 10:28:01 -07:00
John-David Dalton
97e9edc53d Bump to v4.17.5. 2018-02-03 22:35:31 -08:00
John-David Dalton
ce32a89e3e Rebuild lodash and docs. 2018-02-03 22:35:25 -08:00
John-David Dalton
5e58cd216c Fix style nits. 2018-02-03 21:25:41 -08:00
John-David Dalton
5adb4ee95c Make _.defaults avoid accessing property values it doesn't need to. [closes #2983] 2018-02-03 21:25:41 -08:00
John-David Dalton
a73b92b58e Avoid using the values toString method in _.invert if it’s not a function. [closes #3260] 2018-02-03 21:25:41 -08:00
John-David Dalton
a1b53054d6 Add 4.17.5 branch to travis. 2018-02-03 21:25:31 -08:00
John-David Dalton
dac890a211 Enable _.words to detect ordinals in compound words. [closes #3561] 2018-02-02 18:10:02 -08:00
John-David Dalton
7167a78644 Replacing a regex in stringToPath with a quick character code check. (#3308) 2018-02-02 18:10:01 -08:00
John-David Dalton
f83197727b Avoid shadowing result in remainingWait. (#3280) 2018-02-02 18:10:01 -08:00
John-David Dalton
20c5307542 stringToPath: avoid shadowing variable. (#3226) 2018-02-02 18:10:01 -08:00
John-David Dalton
45ac7f3bcc Support symbols in property paths of set. [closes #3189] 2018-02-02 18:10:01 -08:00
John-David Dalton
7cb477a3a0 Use new to create the array clone. 2018-02-02 18:10:01 -08:00
John-David Dalton
b8c719d3be Fix cloneDeep with circularly dependent Sets/Maps. [closes #3122] 2018-02-02 18:09:54 -08:00
John-David Dalton
d8e069cc34 Avoid merging properties on to __proto__ objects. 2018-01-30 23:21:12 -08:00
John-David Dalton
5a3ff73997 Ensure cloneByPath preserves uncloneable values. [closes #3203] 2017-06-14 07:17:44 -07:00
John-David Dalton
912d6b04a1 Bump to v4.17.4. 2017-01-06 07:51:17 -08:00
John-David Dalton
165572022d Rebuild lodash and docs. 2017-01-06 07:50:36 -08:00
John-David Dalton
ae467c7313 Update deps. 2017-01-06 07:50:36 -08:00
John-David Dalton
1e80c19b0f Remove dead “modern environments” link from readme. [ci skip] 2017-01-06 07:50:29 -08:00
John-David Dalton
6eeafd3dc2 Update kitchen sink size. [ci skip] 2016-12-31 00:52:52 -06:00
John-David Dalton
e33b15674d Ensure _.omit doesn’t mutate object with deep paths. [closes #2912] 2016-12-30 18:09:11 -06:00
John-David Dalton
a23b918bef Increment package version to enable ci tests. 2016-12-30 18:07:58 -06:00
John-David Dalton
ef618992b5 Bump to v4.17.3. 2016-12-26 10:43:11 -06:00
John-David Dalton
708b962860 Rebuild lodash and docs. 2016-12-26 10:43:11 -06:00
John-David Dalton
da2d08d771 Update deps. 2016-12-26 10:43:11 -06:00
John-David Dalton
30863e5fa6 Fix conversion of npm package and source doc links. [ci skip] 2016-12-26 10:43:05 -06:00
John-David Dalton
6672a4f942 Update fp doc template for fp.reduceRight iteratee argument order. [ci skip] 2016-12-24 11:21:51 -06:00
John-David Dalton
f7263047bf Use a strict undefined check for arity in createWrap. 2016-12-21 15:23:54 -06:00
John-David Dalton
02fdf4e673 Wrap in ternary value within hashHas in parens for clarity. 2016-12-21 15:23:54 -06:00
John-David Dalton
e2c703a96f Avoid more coercion. 2016-12-21 15:23:54 -06:00
John-David Dalton
32fdfcc1e5 Avoid coercing position in _.startsWith, if it’s undefined. 2016-12-21 12:34:28 -06:00
John-David Dalton
6c1ae0b54d Update Safari in sauce. 2016-12-21 00:19:59 -06:00
John-David Dalton
0c1c87b046 Update Firefox in sauce. 2016-12-20 16:54:40 -06:00
John-David Dalton
b51786e72e Fix lazy sequence test fails. 2016-12-20 16:54:40 -06:00
John-David Dalton
5ee5099af1 Update code skipped on the coverage run. 2016-12-20 16:54:40 -06:00
John-David Dalton
482dc9478b Remove array length limit for lay evaluation. [closes #2874] 2016-12-20 16:54:40 -06:00
John-David Dalton
528b6a98a9 Minor doc space nit. [ci skip] 2016-12-06 15:15:09 +09:00
John-David Dalton
a8bcb5f3d5 ES6 to ES2015 nit. [ci skip] 2016-12-06 15:15:09 +09:00
Dave Wasmer
d429f90ec5 Mention ES6 delimiters in templateSettings docs (#2857) 2016-12-06 15:15:09 +09:00
John-David Dalton
72f559e1a3 Exit early from getSymbols if object is nullish. 2016-11-25 00:16:37 -06:00
Ophir LOJKINE
2f92d55024 Clarify _.isEqual docs on comparing functions and DOM nodes. [closes #2849] [ci skip] 2016-11-25 00:16:05 -06:00
John-David Dalton
5a86b67263 Minor engines field format nit. 2016-11-24 23:58:40 -06:00
John-David Dalton
bea4b29bc4 Remove unneeded Object coercions. 2016-11-24 23:41:10 -06:00
John-David Dalton
0cd4134bc6 Fix Android 5.1 test fails. 2016-11-24 23:41:10 -06:00
John-David Dalton
ec74813be6 Add non-enumerable symbol tests. 2016-11-24 00:07:26 -06:00
John-David Dalton
67926a4df2 Minor test nit. 2016-11-24 00:07:26 -06:00
John-David Dalton
40a591d0c0 Test _.isEqual crawls symbol properties. 2016-11-24 00:07:26 -06:00
John-David Dalton
783e03ffa3 Simplify baseIsEqualDeep now that getSymbols returns only enumerable symbols. 2016-11-24 00:07:26 -06:00
John-David Dalton
1dddf27a39 Include only enumerable symbols in getSymbols result. [closes #2845] 2016-11-24 00:07:26 -06:00
John-David Dalton
2890eabf66 Replace isObject use with isObjectLike in baseIsEqual. 2016-11-21 23:34:21 -06:00
John-David Dalton
a3e077324a Add support for comparing symbol properties to _.isEqual. [closes #2840] 2016-11-21 23:34:21 -06:00
John-David Dalton
86ee93650d Flip iteratee arguments for fp.reduceRight. 2016-11-21 23:34:21 -06:00
John-David Dalton
dd0d984d37 Add customOmitClone helper. 2016-11-21 23:34:21 -06:00
John-David Dalton
eba18891e5 Rename private spread helper to flatSpread. 2016-11-21 23:34:20 -06:00
John-David Dalton
5cb80a0a84 Disable headings link icons in marky-markdown. 2016-11-19 23:39:27 -06:00
John-David Dalton
db14f324f6 Increment package version to enable ci tests. 2016-11-19 23:39:27 -06:00
John-David Dalton
238defb150 Bump to v4.17.2. 2016-11-19 23:39:27 -06:00
John-David Dalton
53ba1e0c3c Rebuild lodash and docs. 2016-11-19 23:39:19 -06:00
John-David Dalton
95d3477c22 Fix code style nits. 2016-11-15 22:04:15 -08:00
John-David Dalton
a06d1a0313 Add _.omit and _.pick tests for keys over paths. 2016-11-15 21:47:03 -08:00
John-David Dalton
330c8cb46e Cleanup path tests. 2016-11-15 21:46:14 -08:00
John-David Dalton
da2e8a1030 Minor var order nit. 2016-11-15 20:18:53 -08:00
John-David Dalton
5bc9e6b8bd Avoid double cloning for the common case in _.omit. 2016-11-15 18:19:11 -08:00
John-David Dalton
9a02bd5fc7 Simplify baseUnset. 2016-11-15 18:07:27 -08:00
John-David Dalton
89656fdf4a Don’t treat a picked path as deep if it exists as a property of the object. [closes #2826] 2016-11-15 10:41:11 -08:00
John-David Dalton
4cb7bea97d Ensure _.spread doesn’t include arguments after those spread. [closes #2825] 2016-11-15 10:41:11 -08:00
John-David Dalton
eb4861c3cd Increment package version to enable ci tests. 2016-11-15 10:41:11 -08:00
John-David Dalton
170c13b5ba Bump to v4.17.1. 2016-11-14 20:37:42 -08:00
John-David Dalton
26a6117889 Rebuild lodash and docs. 2016-11-14 20:31:46 -08:00
John-David Dalton
014982cb2c Remove isKey use from invokeMap. 2016-11-14 17:32:52 -08:00
John-David Dalton
058361e222 Move the isKey check into castPath. 2016-11-14 15:37:46 -08:00
John-David Dalton
e344b66af9 Cleanup _.omit. 2016-11-14 12:04:52 -08:00
John-David Dalton
54cb3599e3 Fix yarn runs in travis by pinning to v0.16.1. 2016-11-14 10:41:38 -08:00
John-David Dalton
6c427b7a26 Avoid deep cloning of _.omit result. 2016-11-14 09:57:39 -08:00
John-David Dalton
ce093845e1 Ensure _.pick supports path arrays. [closes #2809] 2016-11-14 01:06:35 -08:00
John-David Dalton
102c5f00d7 Ensure _.pickBy doesn’t treat keys with dots as deep paths. [closes #2808] 2016-11-14 00:49:47 -08:00
John-David Dalton
13d315a93b Increment package version to enable ci tests. 2016-11-14 00:49:41 -08:00
John-David Dalton
2cc247ddf8 Bump to v4.17.0. 2016-11-13 22:49:29 -08:00
John-David Dalton
5488644658 Rebuild lodash and docs. 2016-11-11 09:40:37 -08:00
John-David Dalton
1fe9042953 Update coveralls and platform.js deps. 2016-11-11 09:40:33 -08:00
John-David Dalton
8bde34dda0 Update optional marky-markdown dep to 9.0.1. 2016-11-10 13:50:35 -08:00
greenkeeper[bot]
98720bea4a Update optional-dev-dependency to 2.0.0. 2016-11-10 13:32:10 -08:00
John-David Dalton
032637bba1 Update core error text. [ci skip] 2016-11-10 11:39:18 -08:00
John-David Dalton
dadde87cab Consolidate ternary in baseClone. 2016-11-08 08:36:02 -08:00
John-David Dalton
fcd0bbfc56 Correct bitmask flag order. [ci skip] 2016-11-08 07:35:20 -08:00
John-David Dalton
600fbbadfb Cleanup _.omit. 2016-11-08 01:03:41 -08:00
John-David Dalton
3d0df11e50 Add bitmask to baseClone. 2016-11-07 23:00:31 -08:00
John-David Dalton
2e4c997dba Use more clear condition in unclonable test. 2016-11-07 23:00:31 -08:00
John-David Dalton
5aaf7e40ae Cleanup deep path tests. 2016-11-07 23:00:21 -08:00
John-David Dalton
57703b040d Rename param props to paths. 2016-11-06 18:07:49 -08:00
John-David Dalton
c6ff776147 Use baseGet and baseSet in basePickBy. 2016-11-06 17:15:38 -08:00
Aviv Rosental
9ac729e1bc Add deep functionality for _.omit and _.pick. (#2794) 2016-11-06 17:02:41 -08:00
Jhen-Jie Hong
6d951ccc87 Fix freeProcess.binding(util) usage (#2793) 2016-11-06 11:11:01 -08:00
John-David Dalton
3217118fab Add more _.spread tests. 2016-11-06 00:39:13 -07:00
John-David Dalton
6ef973ae33 Avoid trailing slice unless needed. 2016-11-06 00:13:16 -07:00
John-David Dalton
e0a65ac34a Cleanup fp tests. 2016-11-06 00:11:53 -07:00
John-David Dalton
b833d83a3e Add tests for “AllWith” fp methods. 2016-11-06 00:11:53 -07:00
John-David Dalton
220713109c Capitalize Lodash in header. [ci skip] 2016-11-06 00:11:53 -07:00
John-David Dalton
cafb9822ce Refine combo mark ranges. 2016-11-06 00:11:48 -07:00
John-David Dalton
1b3815928d Ensure fp.mergeAllWith accepts more than 2 sources. [closes #2786] 2016-11-04 01:10:54 -07:00
greenkeeper[bot]
fbb67f9dbe Update deps. 2016-11-03 08:24:04 -07:00
John-David Dalton
8d24f393ac Increment package version to enable ci tests. 2016-11-01 00:55:43 -07:00
John-David Dalton
7759376b91 Bump to v4.16.6. 2016-10-31 23:00:14 -07:00
John-David Dalton
ccc3081be0 Rebuild lodash and docs. 2016-10-31 22:58:47 -07:00
John-David Dalton
62b66305f2 Adjust conditional assignments. 2016-10-31 20:34:49 -07:00
John-David Dalton
65daae2043 Remove unneeded var assignment in baseXor. 2016-10-31 16:32:58 -07:00
John-David Dalton
0fcf43b02b Ensure _.xor returns an empty array when comparing the same array. [closes #2776] 2016-10-31 16:32:58 -07:00
John-David Dalton
46d1f53ee9 Increment package version to enable ci tests. 2016-10-31 16:32:52 -07:00
John-David Dalton
fc22665dd8 Bump to v4.16.5. 2016-10-30 22:56:07 -07:00
John-David Dalton
7862e5ce2d Rebuild lodash and docs. 2016-10-30 22:56:04 -07:00
John-David Dalton
7cbffd5ebf Update deps. 2016-10-30 22:55:59 -07:00
John-David Dalton
5028267c72 Fix broken builds. 2016-10-29 18:32:24 -07:00
John-David Dalton
6f03ef955c Drop Node 4 testing in travis. 2016-10-29 18:32:24 -07:00
John-David Dalton
f75bf13ad1 Use ~ instead of $HOME. 2016-10-29 18:32:23 -07:00
John-David Dalton
d7dbf0951d Add another _.xor test for multiple arrays. 2016-10-29 18:32:23 -07:00
John-David Dalton
daf6de6a46 Add uncloneable Proxy constructor test. 2016-10-29 18:32:23 -07:00
John-David Dalton
7d4c3ed404 Add async function detection to _.isFunction. 2016-10-29 18:32:23 -07:00
John-David Dalton
a9fd17950a Add clear to the Map interface note of _.memoize. [ci skip] 2016-10-29 18:32:23 -07:00
John-David Dalton
b91a515258 Cleanup test labels. 2016-10-27 00:06:59 -07:00
John-David Dalton
bc5729a9de Use consistent nullish checks. 2016-10-27 00:06:59 -07:00
John-David Dalton
729d1a57aa Ensure _.xor works with more than two arrays. [closes #2758] 2016-10-27 00:06:59 -07:00
John-David Dalton
73e2562cd1 Add Node 7 testing to travis. 2016-10-26 00:51:34 -07:00
John-David Dalton
849423c9d8 Param doc format nits. [ci skip] 2016-10-25 23:13:40 -07:00
Richard Gibson
1c9a9f364d Avoid object mutation in getRawTag. [closes #2755] 2016-10-25 23:13:34 -07:00
John-David Dalton
e485e16d28 Update deps. 2016-10-25 14:30:33 -07:00
John-David Dalton
bc49e7fe18 Bump Chrome testing in Sauce. 2016-10-24 16:15:31 -07:00
John-David Dalton
6a9337434f Use travis jwt addon. 2016-10-24 16:15:31 -07:00
John-David Dalton
0c89b9aeb5 Update uglify-js to 2.7.4. 2016-10-24 10:17:49 -07:00
Josh Soref
6f7a8501cb Spelling. (#2745) 2016-10-20 12:15:15 -07:00
John-David Dalton
7a03898ffe Bump HOT_COUNT limit to improve fp debugging. 2016-10-19 16:22:32 -07:00
John-David Dalton
609ae34b4e Rename jQuery Foundation to JS Foundation. [ci skip] 2016-10-19 08:41:40 -07:00
John-David Dalton
2d21faf68a Update async to 2.1.2. 2016-10-19 08:41:36 -07:00
John-David Dalton
26ee0c5c2a Cleanup PhantomJS upgrade. 2016-10-15 23:32:13 -07:00
John-David Dalton
cafb5e1331 Avoid leaked var in _.before test. 2016-10-15 18:10:55 -07:00
John-David Dalton
7717b8aa64 Remove more quotes. 2016-10-15 18:10:55 -07:00
John-David Dalton
c82322c490 Fix amd test fails. 2016-10-15 18:10:50 -07:00
John-David Dalton
4af0c066ec Update async to 2.1.1. 2016-10-15 12:17:20 -07:00
John-David Dalton
d2b10de40b Bump Edge testing in Sauce. 2016-10-13 12:30:51 -07:00
John-David Dalton
26bfb74a60 Continue to configure npm. 2016-10-13 00:59:02 -07:00
John-David Dalton
ef129e4c8c Use semicolons in place of &&. 2016-10-13 00:48:07 -07:00
John-David Dalton
0b04309ea5 Use yarn. 2016-10-12 22:42:58 -07:00
John-David Dalton
fb4852f6db More travis cleanup. 2016-10-12 22:21:35 -07:00
John-David Dalton
5046943020 Remove extraneous quotes from travis.yml. 2016-10-12 19:50:55 -07:00
John-David Dalton
14d7f89f75 Remove mapping shortcut references. 2016-10-12 07:03:02 -07:00
John-David Dalton
d431e97030 fp.convert should handle aliased and remapped methods. [closes #2728] 2016-10-11 22:40:20 -07:00
John-David Dalton
8f06ea259a Tweak exit early in _.isFunction. 2016-10-10 10:34:38 -07:00
John-David Dalton
0a0fa58e2d Use isObjectLike instead of isObject. 2016-10-10 10:28:16 -07:00
John-David Dalton
286f1abb87 Use empty string instead of undefined. 2016-10-10 10:27:57 -07:00
John-David Dalton
a621ba236a Remove try-catches in tests where possible. 2016-10-10 08:13:15 -07:00
John-David Dalton
a041a3782d Remove unneeded IE conditional comments test. 2016-10-10 08:12:35 -07:00
John-David Dalton
9f8064a8b5 Add read-only Symbol.toStringTag test. 2016-10-09 23:35:46 -07:00
John-David Dalton
729f424622 Minor formatting nit. [ci skip] 2016-10-09 22:40:40 -07:00
John-David Dalton
6a8e978fd7 Remove unneeded _.isPlainObject test. 2016-10-09 22:32:20 -07:00
John-David Dalton
aea509c230 Add Symbol.toStringTag test for _.isPlainObject. 2016-10-09 22:25:33 -07:00
John-David Dalton
21113b8c87 Minor hyphen nit. [ci skip] 2016-10-09 22:25:01 -07:00
John-David Dalton
dcf6d382c4 Add missing realm.element. 2016-10-09 21:27:25 -07:00
John-David Dalton
c541598f40 Cleanup testing arguments objects. 2016-10-09 21:09:50 -07:00
John-David Dalton
bd8e38518f Add more _.isElement tests. 2016-10-09 20:24:48 -07:00
John-David Dalton
067036a359 Simplify isElement. 2016-10-09 20:24:36 -07:00
John-David Dalton
22b51ed232 Refine _.isError checks to avoid false positives on plain objects. 2016-10-09 20:06:03 -07:00
John-David Dalton
054e78572b Add support for ordinals to _.words. 2016-10-09 16:43:44 -07:00
John-David Dalton
31cb06a643 Move Symbol.toStringTag workaround to getRawTag. 2016-10-09 16:43:36 -07:00
John-David Dalton
ee4a5a2604 Make objectToString its own helper function. 2016-10-09 12:59:28 -07:00
John-David Dalton
05b60871c5 Minor toSource param description nit. [ci skip] 2016-10-09 12:37:22 -07:00
John-David Dalton
03a194fcb9 Make toStringTag checks resistant to spoofing. 2016-10-08 10:59:01 -07:00
John-David Dalton
52e96c38dc Exit early from _.isEmpty for nullish values. 2016-10-08 10:42:21 -07:00
John-David Dalton
f5dd98cac4 Clarify lodash build. 2016-10-08 10:41:35 -07:00
John-David Dalton
b890d40b54 Remove unneeded capture phase param from addEventListener. 2016-10-08 10:41:21 -07:00
John-David Dalton
457a0dc703 Update glob to 7.1.1. 2016-10-07 15:31:47 -07:00
John-David Dalton
e4837cd75d Increment package version to enable ci tests. 2016-10-07 08:15:21 -07:00
John-David Dalton
67b2c6f900 Bump to v4.16.4. 2016-10-05 23:20:11 -07:00
John-David Dalton
260a84c4d8 Rebuild lodash and docs. 2016-10-05 23:19:24 -07:00
John-David Dalton
4b0db6ec6c Update qunit-extras to 3.0.0. 2016-10-05 23:19:24 -07:00
John-David Dalton
9c4c194bb5 Replace Object.create mock with undefined to hit more bizarro code paths. 2016-10-05 23:19:24 -07:00
John-David Dalton
ac74a1ea15 Remove unneeded shim juggle. 2016-10-05 23:19:24 -07:00
John-David Dalton
e4ddf3e155 Add nested check to _.merge test for non-plain object source values. 2016-10-05 23:19:23 -07:00
John-David Dalton
896b27ef73 Remove unneeded bizarro tests. 2016-10-05 23:19:23 -07:00
John-David Dalton
bdf0b9f288 Cleanup Babel workaround. 2016-10-05 23:19:10 -07:00
John-David Dalton
1665e5cbff Add bizarro _.create test. 2016-10-05 17:22:31 -07:00
John-David Dalton
6e8c0de1ff Add buffer test for _.merge. 2016-10-05 15:36:36 -07:00
John-David Dalton
4fb41ac6a9 Update removed snippets for the coverage run. 2016-10-05 12:13:25 -07:00
John-David Dalton
af983b2dd3 Ensure _.negate test for multiple arguments hits the 4 arguments case. 2016-10-05 11:09:37 -07:00
John-David Dalton
405d5875b8 Add _.isEmpty test for prototype objects. 2016-10-05 11:09:37 -07:00
John-David Dalton
b30f979ec7 Wrap arguments in case IIFE is removed. 2016-10-05 10:34:20 -07:00
John-David Dalton
836bd258a0 Ensure _.toString works on an array of symbols. 2016-10-05 09:07:51 -07:00
John-David Dalton
d2f74ee245 Minor _.toString doc typo fix. [ci skip] 2016-10-05 08:16:03 -07:00
John-David Dalton
45f668b416 Add baseIsArguments. 2016-10-04 22:28:17 -07:00
John-David Dalton
d29d74f687 Move baseClamp use to arraySampleSize and baseSampleSize. 2016-10-04 22:28:16 -07:00
John-David Dalton
9fba7be296 Add comments to arrayLikeKeys. [ci skip] 2016-10-04 08:41:32 -07:00
John-David Dalton
f30851bac1 Simplify _.isArguments more. 2016-10-04 01:08:05 -07:00
John-David Dalton
d308bce09f Add isTypedArray check to _.isEmpty. 2016-10-04 00:32:15 -07:00
John-David Dalton
3d7dbd140c Remove unused variable. 2016-10-04 00:23:34 -07:00
John-David Dalton
15bd64a1b4 Normalize keys of buffers and typed arrays. 2016-10-04 00:23:00 -07:00
John-David Dalton
3c30100837 Use baseFor in baseMerge. 2016-10-03 22:32:30 -07:00
John-David Dalton
81bdb9da43 Cleanup array type juggling. 2016-10-03 20:34:37 -07:00
John-David Dalton
60e3a93a30 Simplify _.isArguments. 2016-10-03 20:33:39 -07:00
John-David Dalton
158f2839fd Remove Safari 8.1 note. [ci skip] 2016-10-03 20:30:46 -07:00
John-David Dalton
c7b9df4286 Cleanup branching for array-likes in baseMergeDeep. 2016-10-03 18:06:07 -07:00
John-David Dalton
0eca941e22 Add isBuffer checks to baseMerge and _.transform. 2016-10-03 18:05:32 -07:00
John-David Dalton
8592f4163f Fix _.merge regression with buffers. [closes #2699] 2016-10-03 17:07:45 -07:00
John-David Dalton
29e2598a39 Remove duplicate operator. [ci skip] 2016-10-03 14:57:06 -07:00
John-David Dalton
32e75acb9f Indentation nit. [ci skip] 2016-10-03 14:56:32 -07:00
John-David Dalton
b54501a771 Increment package version to enable ci tests. 2016-10-03 10:34:46 -07:00
John-David Dalton
6062860628 Bump to v4.16.3. 2016-10-02 20:22:53 -07:00
John-David Dalton
a12c3797fb Rebuild lodash and docs. 2016-10-02 20:22:06 -07:00
John-David Dalton
48bc8b4f1a Update Firefox in sauce. 2016-10-02 19:19:10 -07:00
John-David Dalton
e861681963 Cleanup buffer tests. 2016-10-02 13:57:42 -07:00
John-David Dalton
9985e81808 Add _.isEqual test for buffers. 2016-10-02 13:37:47 -07:00
John-David Dalton
ffde99b216 Minor test formatting nit. [ci skip] 2016-10-01 23:35:30 -07:00
John-David Dalton
492caa4fd2 Add _.isFunction test for the Proxy constructor. 2016-10-01 23:34:45 -07:00
John-David Dalton
01c0950ae8 Add existence check for runInContext. [closes #2694] 2016-09-30 15:33:12 -07:00
John-David Dalton
20fa52309c Add proxyTag check to _.isFunction for Safari 10 support of the Proxy constructor. [closes #2689] 2016-09-29 14:54:09 -07:00
John-David Dalton
7a345b5606 Clarify fp spread methods description. [closes #2687] [ci skip] 2016-09-29 13:06:04 -07:00
John-David Dalton
b6d8116882 Indentation nit in readme. [ci skip] 2016-09-28 14:03:24 -07:00
John-David Dalton
4495e74f77 Treat buffers separately from typed arrays. 2016-09-28 12:54:11 -07:00
John-David Dalton
c009349d99 Use only one defineProperty reference. 2016-09-27 14:36:41 -07:00
John-David Dalton
26d5ba992c Fix prototype typo. 2016-09-27 14:04:06 -07:00
John-David Dalton
320ef6f933 Cleanup assignment test. 2016-09-26 21:43:49 -07:00
John-David Dalton
b678bb4a74 Make _.defaultsDeep and _.merge consistent with _.defaults in assigning undefined values. [closes #2676] 2016-09-26 21:43:49 -07:00
John-David Dalton
c1c394ac60 Increment package version to enable ci tests. 2016-09-26 21:43:49 -07:00
John-David Dalton
70d3057e17 Bump to v4.16.2. 2016-09-25 13:24:51 -07:00
John-David Dalton
3d27920226 Rebuild lodash and docs. 2016-09-25 13:24:51 -07:00
John-David Dalton
33a43a5f93 Update Node usage example. [ci skip] 2016-09-25 13:24:51 -07:00
John-David Dalton
fac9501840 Refine ext detection. 2016-09-25 13:19:48 -07:00
John-David Dalton
4d6aade733 Rename param to size. 2016-09-25 13:19:48 -07:00
John-David Dalton
d9e2c1cc34 Remove MAX_ARRAY_LENGTH use in arrayShuffle and baseShuffle. 2016-09-25 13:19:48 -07:00
John-David Dalton
c8c6a7e7b1 Fix arraySample description. [ci skip] 2016-09-25 13:19:48 -07:00
John-David Dalton
69addb855e Add baseSample, baseSampleSize, and baseShuffle. 2016-09-25 13:19:48 -07:00
John-David Dalton
55fb0172c0 Move thrower from v4 to move to v3. 2016-09-25 13:19:43 -07:00
John-David Dalton
2026cbeebd Add thrower helper. 2016-09-24 10:57:38 -07:00
John-David Dalton
d6d01cdfa0 Remove the need for es-sham. 2016-09-23 19:25:46 -07:00
John-David Dalton
cb07604dc6 Fix local failing PhantomJS 2 test. 2016-09-23 16:51:21 -07:00
John-David Dalton
549def0e48 Use Buffer.allocUnsafe when available. 2016-09-23 16:48:36 -07:00
John-David Dalton
a3c215919d Create more error text constants. 2016-09-23 16:48:02 -07:00
John-David Dalton
ab904a1047 Add error to encourage users to shim when needed. 2016-09-23 14:39:03 -07:00
John-David Dalton
60381f4d6c Update deps. 2016-09-22 16:02:49 -07:00
John-David Dalton
8f607295ae Increment package version to enable ci tests. 2016-09-20 15:13:43 -07:00
John-David Dalton
27218a95af Bump to v4.16.1. 2016-09-20 09:40:52 -07:00
John-David Dalton
8e150ad6bc Rebuild lodash and docs. 2016-09-20 09:40:52 -07:00
John-David Dalton
c8914a890c Excuse more Underscore _.escape tests. 2016-09-20 09:40:52 -07:00
John-David Dalton
b25a86f352 Use lodashStable.escape in more places. 2016-09-20 07:49:59 -07:00
John-David Dalton
ec8e279235 Add _.escape and _.unescape tests for backticks. 2016-09-20 07:49:40 -07:00
John-David Dalton
1cc16029db Avoid attempting to (un)escape backticks. [closes #2660] 2016-09-20 07:31:21 -07:00
John-David Dalton
5c912bcc62 Wrap runInContext in parentheses as a hint to avoid deferred parsing. 2016-09-19 17:13:18 -07:00
John-David Dalton
b3742c8d3c Update coveralls to 2.11.14. 2016-09-19 17:13:18 -07:00
John-David Dalton
c3a7516712 Increment package version to enable ci tests. 2016-09-19 17:13:18 -07:00
John-David Dalton
12319d5775 Bump to v4.16.0. 2016-09-17 22:13:04 -07:00
John-David Dalton
45e1965936 Rebuild lodash and docs. 2016-09-17 22:10:52 -07:00
John-David Dalton
6091c8ec49 Remove outdated _.runInContext example. [ci skip] 2016-09-17 19:12:45 -07:00
John-David Dalton
cfb7dab0f3 Update deps. 2016-09-17 18:42:43 -07:00
John-David Dalton
2d9f3cde0f Add greenkeeper ignore field to packagre.json. [ci skip] 2016-09-17 16:28:15 -07:00
John-David Dalton
e5f4770247 Break out _.sampleSize and _.shuffle into array helpers. 2016-09-16 08:27:46 -07:00
Greenkeeper
dc7c321514 Update coveralls to 2.11.13. 2016-09-15 10:55:21 -07:00
John-David Dalton
40164659b1 Simplify changelog reference. [ci skip] 2016-09-15 10:16:59 -07:00
Mark Stosberg
7829f3d224 Add CHANGELOG in the expected place and link it to where it's actually maintained. (#2648)
Ref: https://github.com/lodash/lodash/issues/875
2016-09-15 10:10:09 -07:00
John-David Dalton
92359257c1 Update tested Chrome version in sauce. 2016-09-14 11:15:34 -07:00
John-David Dalton
d2a2b3a8c4 Reduce n_ note. [ci skip] 2016-09-10 21:05:32 -07:00
John-David Dalton
4019eb65f2 Use jsdelivr combo src for fp example. [ci skip] 2016-09-10 14:22:38 -07:00
John-David Dalton
4c5bead5c6 Update Node usage comments. [ci skip] 2016-09-10 13:34:07 -07:00
John-David Dalton
0163aae357 Trim code snippet comments. 2016-09-10 13:08:45 -07:00
John-David Dalton
8fa23a94a0 Use nullish checks instead of coercing to booleans. 2016-09-10 10:48:36 -07:00
John-David Dalton
8176d56c72 Move arraySample definition to fix builds. 2016-09-06 14:24:53 -07:00
John-David Dalton
5add168743 Update requirejs. 2016-09-06 13:00:59 -07:00
John-David Dalton
27e59404d3 Add engines field to package.json. 2016-09-06 12:43:28 -07:00
John-David Dalton
54f5ac7b8d Simplify nested highlights selector. 2016-09-06 08:04:38 -07:00
John-David Dalton
5c688cc0b7 Remove rogue html-minifier reference. 2016-09-05 23:20:37 -07:00
John-David Dalton
86efb0ea09 Use an arrow function. 2016-09-05 23:18:39 -07:00
John-David Dalton
bc13666222 Reduce highlights further. 2016-09-05 22:49:26 -07:00
John-David Dalton
d1abde7d1a Remove broken HTML escaping. 2016-09-05 02:08:07 -07:00
John-David Dalton
691db4d406 Refine the auto-link selector. 2016-09-05 01:54:33 -07:00
John-David Dalton
fb833b0c19 Cleanup build-site.js. 2016-09-04 22:32:21 -07:00
John-David Dalton
4d2181ad83 Use template string literals in build-doc.js. 2016-09-04 22:26:48 -07:00
John-David Dalton
9dd291a96e Move html-minifier use to lodash.github.io. 2016-09-04 01:23:16 -07:00
John-David Dalton
1344803e7e Minify highlights snippets. 2016-09-03 09:22:57 -07:00
John-David Dalton
4a5f8fa974 Split _.sample out to arraySample. 2016-09-01 20:03:40 -07:00
John-David Dalton
212e4a6407 Add more doc notes on the order of results. [ci skip] [closes #2622] 2016-09-01 11:41:38 -07:00
John-David Dalton
d47123779e Avoid inserting empty details. 2016-09-01 01:30:29 -07:00
John-David Dalton
fc734a6371 Increase the HOT_COUNT to avoid shorting out setting fp toString methods. 2016-09-01 01:12:12 -07:00
John-David Dalton
02be5b808e Rename “_” id references to “lodash”. 2016-08-30 22:32:32 -07:00
John-David Dalton
0d757fdc40 Ensure _.has returns the correct result for nested sparse arrays. [closes #2614] 2016-08-30 19:20:52 -07:00
John-David Dalton
0263a879c4 Add _.template note for disabling the ES template literal delimiter. [ci skip] 2016-08-29 16:19:23 -07:00
John-David Dalton
c309ed1c49 Add collapse_vars to the Uglify options. 2016-08-29 08:23:37 -07:00
John-David Dalton
e58de14437 Add memoizeCapped. 2016-08-29 08:07:34 -07:00
John-David Dalton
78a7fa1d14 Add Node.js test note. [ci skip] 2016-08-29 08:07:34 -07:00
John-David Dalton
77178a9583 Replace chaining _.forEach doc example with regular usage. [ci skip] 2016-08-29 07:37:47 -07:00
Georgii Dolzhykov
d2ab33eb52 Minor doc fix for mergeWith. [closes #2610] [ci skip] 2016-08-29 07:23:14 -07:00
John-David Dalton
7b3194660c Fix failing _.memoize test in IE 11. 2016-08-28 18:46:19 -07:00
John-David Dalton
f627b25e9d Remove cache.clear existance check. 2016-08-28 18:46:19 -07:00
John-David Dalton
1bbb7c9d3b Add _.memoize tests for max cache size and immutable maps. 2016-08-28 18:46:19 -07:00
John-David Dalton
08a4ae1f56 Add _.memoize tests for max cache size. 2016-08-28 18:46:19 -07:00
John-David Dalton
7c398f8019 Add Stack#size. 2016-08-28 18:46:03 -07:00
John-David Dalton
6651023f7f Unescape delete properties. 2016-08-27 19:58:03 -07:00
John-David Dalton
021df666a3 Cleanup test method flags. 2016-08-27 19:43:44 -07:00
John-David Dalton
d7e60cb6d0 Add more object assignments tests. 2016-08-27 19:29:41 -07:00
John-David Dalton
4cd26e6860 Add more “__proto__” assignment tests. 2016-08-27 19:17:11 -07:00
John-David Dalton
946a3bf5c8 Remove unneeded value guards in tests. 2016-08-27 18:36:40 -07:00
John-David Dalton
b10e6a01b2 Add _.memoize cache limit. 2016-08-27 18:21:42 -07:00
John-David Dalton
e23341a118 Fix deburred long S value. [closes #2606] 2016-08-27 16:52:46 -07:00
John-David Dalton
4446fb13a3 Change postfix increment operators to prefix. 2016-08-27 15:46:40 -07:00
John-David Dalton
4dfbde7716 Add shortOut helper. 2016-08-27 15:35:36 -07:00
John-David Dalton
3c03d4a1f3 Add castRest, flatRest, and overRest helpers. 2016-08-27 11:26:42 -07:00
John-David Dalton
a0ecdfff0b Minor _.defer doc example nit. [ci skip] 2016-08-27 11:26:41 -07:00
John-David Dalton
60023a23df Exit concat early if no arguments are provided. 2016-08-27 10:44:18 -07:00
John-David Dalton
e96442631c Scope markdown-doctest to the doc folder. 2016-08-27 09:17:45 -07:00
John-David Dalton
94750bfa3c Use ES6 in lib files. 2016-08-27 08:54:37 -07:00
John-David Dalton
5cc02555d0 Update Chrome and Firefox in sauce. 2016-08-25 15:44:26 -07:00
John-David Dalton
6e2f7e2f38 Update glob to 7.0.6. 2016-08-25 07:29:29 -07:00
John-David Dalton
de92cc32e6 Add __proto__ guards to more methods. 2016-08-25 07:00:40 -07:00
John-David Dalton
e97205409d Make the readme mimic the homepage more. [ci skip] 2016-08-24 08:22:27 -07:00
Zakaria Ridouh
091d8e3dbf add npm install guide (#2592) 2016-08-23 17:04:03 -07:00
John-David Dalton
171ca53c29 Split defineProperty to nativeDefineProperty. 2016-08-23 12:26:44 -07:00
John-David Dalton
5be61796d9 Use quotes instead of backticks. 2016-08-22 23:24:10 -07:00
John-David Dalton
1aee1c6cb8 Fix IE11 test fail. 2016-08-22 23:09:41 -07:00
John-David Dalton
343f48b08c Ensure __proto__ is treated as a regular key in assignments. [closes #2591] 2016-08-22 11:06:02 -07:00
John-David Dalton
358ecfd2eb Add writable descriptor to setToString. 2016-08-22 10:56:07 -07:00
John-David Dalton
8066ad7e65 Rename bash to shell. [ci skip] 2016-08-22 00:09:05 -07:00
John-David Dalton
7ae0d0099d Reduce highlights class names. 2016-08-21 23:58:28 -07:00
John-David Dalton
2e4fc41c9b Update marky-markdown to 8.1.0. 2016-08-21 21:04:37 -07:00
Greenkeeper
71247ff556 Update deps. 2016-08-21 19:07:06 -07:00
John-David Dalton
5ef163f143 Drop lesser used or soon to be unsupported Node.js versions from travis. 2016-08-21 19:06:24 -07:00
John-David Dalton
510cbfaa3f Cleanup fp test labels. 2016-08-18 10:45:08 -07:00
John-David Dalton
bd3fcab9c0 Add fp.rangeStep and fp.rangeStepRight. [closes #2584] 2016-08-18 10:45:08 -07:00
John-David Dalton
9841e6aa4c Use cacheHas in equalArrays. 2016-08-17 12:04:07 -07:00
John-David Dalton
1bf125eebd Add strictIndexOf and strictLastIndexOf helpers. 2016-08-17 12:04:06 -07:00
John-David Dalton
f9936b8b54 Add setToString helper. 2016-08-17 12:04:06 -07:00
John-David Dalton
d11aa6de06 Update _.sortBy doc example with preferred usage. [ci skip] 2016-08-17 12:04:06 -07:00
John-David Dalton
1c4fccc0fd Remove Edge note since it’s covered by the IE 11 note. [ci skip] 2016-08-17 12:04:06 -07:00
John-David Dalton
aa0323f04d Update Node.js compat comment. [ci skip] 2016-08-17 12:04:06 -07:00
John-David Dalton
2916e9dd11 Remove nonEnumShadows. 2016-08-13 14:17:41 -07:00
John-David Dalton
6958d7abd4 Newline nits. [ci skip] 2016-08-13 14:13:46 -07:00
John-David Dalton
9e661cb858 Excuse more Underscore tests. 2016-08-13 14:13:34 -07:00
John-David Dalton
a972026c67 Drop Node 0.10 testing in travis. 2016-08-13 13:52:20 -07:00
John-David Dalton
2b1bda7418 Remove old Chrome and Firefox fixes. 2016-08-13 13:50:21 -07:00
John-David Dalton
a6a3f3ed80 Remove isHostObject helper. 2016-08-13 13:29:41 -07:00
John-David Dalton
5cca51e978 Remove escaping backticks. 2016-08-13 13:29:41 -07:00
John-David Dalton
7c971587dc Increment package version to enable ci tests. 2016-08-13 13:29:41 -07:00
John-David Dalton
40a13d4b86 Bump to v4.15.0. 2016-08-12 07:20:51 -07:00
John-David Dalton
a0971d016d Rebuild lodash and docs. 2016-08-11 23:09:09 -07:00
John-David Dalton
410e9e3eb8 Update _.deburr tests. 2016-08-11 23:05:31 -07:00
John-David Dalton
37813c3826 Add _.negate test for accepting multiple arguments. 2016-08-11 23:05:28 -07:00
John-David Dalton
e00c243662 Update bug comments. [ci skip] 2016-08-11 23:05:27 -07:00
John-David Dalton
f504f5aac5 Minor comment nit. [ci skip] 2016-08-10 23:51:13 -07:00
John-David Dalton
0b63f2c259 Implement reAsciiWord by a negated character class to match more when unicode is dropped. 2016-08-10 23:18:15 -07:00
John-David Dalton
14fb27ce77 Update _.debounce test to hit code branch. 2016-08-10 18:44:46 -07:00
John-David Dalton
7da7d7b7e0 Update ecstatic to 2.1.0. 2016-08-10 18:44:21 -07:00
John-David Dalton
907add6acc Have travis cache the npm cache instead of node_modules. 2016-08-10 12:51:04 -07:00
John-David Dalton
f110e3ddcd Add Latin Extended-A support to comments/docs. [ci skip] 2016-08-10 12:51:04 -07:00
John-David Dalton
ed206e5611 Added latin extended-a block support to _.deburr. [closes #2511] 2016-08-10 12:50:57 -07:00
John-David Dalton
e4d8af175b Remove String reference. 2016-08-09 20:15:51 -07:00
John-David Dalton
ba7ddc8cdc Minor format nit. [ci skip] 2016-08-09 18:18:45 -07:00
John-David Dalton
389f5790a7 Remove npm update —dev from travis. 2016-08-09 18:17:59 -07:00
John-David Dalton
6071982dd9 Rework ascii and unicode helpers. 2016-08-09 18:08:20 -07:00
Greenkeeper
f71c0bd4c3 Update ecstatic to 2.0.0. 2016-08-09 12:22:47 -07:00
John-David Dalton
50b45d013a Fix typo in FP doc template. [ci skip] 2016-08-09 07:49:17 -07:00
John-David Dalton
93a047e77c Remove chatty npm update from lodash-cli in travis. 2016-08-09 00:01:22 -07:00
John-David Dalton
a3bf0e8888 Simplify _.size. 2016-08-08 23:39:02 -07:00
John-David Dalton
d8fa2f3e89 Fix safari test. 2016-08-08 20:47:21 -07:00
John-David Dalton
e361c5a5b3 Preserve lodash-cli node_modules in travis. 2016-08-08 18:58:46 -07:00
John-David Dalton
3ef032cbaf Add npm prune and update to travis. 2016-08-08 17:14:12 -07:00
John-David Dalton
36cf5a7ff3 Remove _.isFunction use from _.toNumber. 2016-08-08 16:38:56 -07:00
John-David Dalton
6d930d6920 Simplify _.isEmpty. 2016-08-08 16:38:51 -07:00
John-David Dalton
f676a8c9c1 Increment package version to enable ci tests. 2016-08-08 15:52:44 -07:00
John-David Dalton
941ffee2d3 Bump to v4.14.2. 2016-08-07 21:46:32 -07:00
John-David Dalton
0a71f3372f Rebuild lodash and docs. 2016-08-07 20:56:55 -07:00
John-David Dalton
f817f68487 Update docdown to 0.7.1. 2016-08-07 16:07:06 -07:00
John-David Dalton
826975f392 Add trailing newline to generated docs. 2016-08-07 14:40:28 -07:00
John-David Dalton
5f244d3c31 Remove em elements from code blocks. 2016-08-07 14:14:23 -07:00
John-David Dalton
71be34859f Wrap doc site in raw tags. 2016-08-07 13:55:38 -07:00
John-David Dalton
f9a4705c9c Add node_modules to travis cache. 2016-08-06 23:01:52 -07:00
John-David Dalton
a546842792 Upgrade travis to phantom.js v2. 2016-08-06 20:38:08 -07:00
John-David Dalton
ba86e20179 Fix IE 9 test fails. 2016-08-06 20:08:43 -07:00
John-David Dalton
b32fc6f6e6 Minor function/method nit. [ci skip] 2016-08-06 17:15:54 -07:00
John-David Dalton
1f13a34687 Add nativeKeysIn and cleanup object coercion. 2016-08-06 17:07:45 -07:00
John-David Dalton
f212b4850d Update links to ecma-262/7.0. [ci skip] 2016-08-04 21:54:03 -07:00
John-David Dalton
1b4555afb6 Restructure keys methods. 2016-08-04 21:53:55 -07:00
John-David Dalton
358013c67e Cleanup overArg description. [ci skip] 2016-08-04 09:40:01 -07:00
John-David Dalton
a98667ca05 Remove old JIT and engine bug guards. 2016-08-03 22:06:03 -07:00
John-David Dalton
02e9f4c333 Simplify _.isEmpty. 2016-08-03 21:42:52 -07:00
John-David Dalton
d7951db01b Fix test fail in es builds. 2016-08-03 17:22:20 -07:00
John-David Dalton
21fba2df9f Reduce deps of _.initial and _.tail. 2016-08-03 13:04:10 -07:00
John-David Dalton
a4947139a6 Overwrite primitives in paths of set methods. [closes #2558] 2016-08-03 10:48:22 -07:00
John-David Dalton
c01e7580cd Avoid error in Edge accessing localStorage when loading tests via the file: protocol. 2016-08-03 08:34:40 -07:00
John-David Dalton
8b4f22ed75 Update marky-markdown wrapping fix. 2016-08-02 12:07:06 -07:00
John-David Dalton
669b76bf99 Update marky-markdown. 2016-08-02 00:16:07 -07:00
Greenkeeper
efee02ace7 Update docdown to 0.7.0. 2016-08-01 20:20:31 -07:00
John-David Dalton
cd8adf5611 Minor doc formatting nits. [ci skip] 2016-08-01 17:28:22 -07:00
John-David Dalton
d216106b88 Add private tag to unexposed functions. [ci skip] 2016-08-01 17:25:16 -07:00
John-David Dalton
6dd8fb12ad Ensure fp.nthArg returns a curried function. 2016-08-01 16:55:12 -07:00
John-David Dalton
a4999575d0 Cleanup npm link creation. 2016-08-01 14:39:37 -07:00
John-David Dalton
fcaff8ff28 Update timeout related doc type tags. [closes #2553] [ci skip] 2016-08-01 08:53:30 -07:00
John-David Dalton
cf0b3e3212 Update docdown options. 2016-07-31 22:16:11 -07:00
John-David Dalton
bccb4150fd Add _.every doc note on matching empty collections. [ci skip] 2016-07-31 16:32:55 -07:00
John-David Dalton
9a297b0eb5 Cleanup partial comparison notes. [ci skip] 2016-07-31 16:32:08 -07:00
Dan J Miller
9c4baf7645 Clarify how comparison with empty sources is handled by _.matches, _.isMatch and _.matchesProperty. (#2548) 2016-07-31 00:54:48 -07:00
John-David Dalton
73b2f20509 Use lodash-doc-globals. 2016-07-30 23:48:17 -07:00
John-David Dalton
642690e692 Fix failing amd test. 2016-07-30 12:10:46 -07:00
John-David Dalton
1468c74c36 Make doubley sure Date.now, clearTimeout, and setTimeout are mockable. 2016-07-30 12:10:46 -07:00
Greenkeeper
0bfa1ec2d0 Update lodash to 4.14.1. 2016-07-30 12:10:46 -07:00
John-David Dalton
7c74464d7a Remove prepublish hook because we don’ publish this branch. [ci skip] 2016-07-30 12:10:46 -07:00
John-David Dalton
de051ac1ac Increment package version to enable ci tests. 2016-07-30 12:10:46 -07:00
John-David Dalton
ba0c4c413d Bump to v4.14.1. 2016-07-29 00:40:38 -07:00
John-David Dalton
7e6f5ef4f5 Rebuild lodash and docs. 2016-07-29 00:40:38 -07:00
John-David Dalton
712eeb009f Add missing semicolon. [ci skip] 2016-07-29 00:40:38 -07:00
Johannes Scharlach
b54e28deb7 Prevent failing circular reference detection. (#2543) 2016-07-28 23:12:53 -07:00
John-David Dalton
1f44cebac3 Update coveralls to 2.11.12. 2016-07-28 23:12:53 -07:00
John-David Dalton
9c05e8392b Add stack.delete for other in equalArrays and equalObjects. 2016-07-28 23:12:53 -07:00
John-David Dalton
9a67fec48a Remove stack.delete from baseMergeDeep. 2016-07-28 23:12:53 -07:00
John-David Dalton
1966ac7979 Prevent failed circular reference detection in _.defaultsDeep. [closes #2537] 2016-07-28 23:12:53 -07:00
John-David Dalton
8b624217c5 Cleanup _.debounce and _.throttle docs. [ci skip] 2016-07-28 23:12:53 -07:00
John-David Dalton
40499af9b9 Fix freeModule typo. 2016-07-28 23:12:53 -07:00
John-David Dalton
b3bd359a0d Use stubArray for easier readability. 2016-07-28 23:12:52 -07:00
John-David Dalton
de07e3f874 Add keys methods tests for array-like values. 2016-07-28 23:12:52 -07:00
John-David Dalton
c7e8953b68 Cleanup array-like tests. 2016-07-28 23:12:52 -07:00
John-David Dalton
80e7fe4bf9 Remove freeGlobal prerequisite for freeExports. [closes #2527] 2016-07-28 23:12:52 -07:00
John-David Dalton
2bc199d7fc Move method equivalence notes. [ci skip] 2016-07-28 23:12:52 -07:00
John-David Dalton
9b710d8e81 Use _.toFinite in random and range methods. 2016-07-28 23:12:52 -07:00
John-David Dalton
cc6a0ee98d Minor .gitignore cleanup. 2016-07-28 23:12:52 -07:00
Brad Buchanan
c9492d79a1 Document behavior of _.debounce when wait is 0 (#2530)
Clarify that when `leading` is false a debounced method with `wait=0` will not invoke immediately, but on the next tick (like `setTimeout`), but when `leading` is true the invocation will be immediate.
2016-07-28 23:12:52 -07:00
Brad Buchanan
94c4719c0d Fix missing semicolon (#2529)
I started on a documentation change but `npm run validate` after my initial pull revealed this linting error:

```
> jscs lodash.js

requireSemicolons: Missing semicolon after statement at lodash.js :
  5864 |    function isFlattenable(value) {
  5865 |      return isArray(value) || isArguments(value) ||
  5866 |        !!(spreadableSymbol && value && value[spreadableSymbol])
-----------------------------------------------------------------------^
  5867 |    }
  5868 |
```
2016-07-28 23:12:51 -07:00
John-David Dalton
c253e8d7b8 Ensure paths with consecutive empty brackets or dots are parsed correctly. 2016-07-28 23:12:51 -07:00
John-David Dalton
98f12fb8e1 Update qunitjs to 2.0.1. 2016-07-28 23:12:51 -07:00
John-David Dalton
e05a40bb16 Bump to v4.14.0. 2016-07-28 23:12:51 -07:00
John-David Dalton
c73bb67486 Rebuild lodash and docs. 2016-07-28 23:12:40 -07:00
John-David Dalton
3ad0cbc86d Minor _.includes test cleanup. 2016-07-24 08:38:09 -07:00
John-David Dalton
6402af7db9 Use String#slice instead of String#indexOf for _.endsWith and _.startsWith. 2016-07-24 08:38:09 -07:00
John-David Dalton
6a41a79ded Move switch optimization to negate. 2016-07-23 23:33:30 -07:00
John-David Dalton
fbd9a804a9 Use negate in reject. 2016-07-23 22:11:34 -07:00
John-David Dalton
694e1175a1 Remove arity hint from lazy reject. 2016-07-23 22:11:34 -07:00
John-David Dalton
80dbd4cbfa Add props param to basePickBy. 2016-07-23 22:11:34 -07:00
John-David Dalton
d459f4ac7c Add more arity hints. 2016-07-23 22:11:34 -07:00
John-David Dalton
2c5c4bfbea Remove switch statement from baseRest. 2016-07-22 21:06:15 -07:00
John-David Dalton
a1a68bb5d7 Update async to 2.0.1 and request to 2.74.0. 2016-07-22 18:51:57 -07:00
John-David Dalton
984a10c1b1 Add isConcatSpreadable to flatten methods. 2016-07-22 18:51:57 -07:00
John-David Dalton
3c4c06cb5e Update benchmark.js to 2.1.1. 2016-07-21 08:39:58 -07:00
John-David Dalton
8d28a5ca3f Minor var palcement nit. 2016-07-19 17:58:58 -07:00
John-David Dalton
801c4a56c3 Remove old browser addListener helper. 2016-07-19 17:58:26 -07:00
John-David Dalton
ea000e6ce7 Style nit in sauce helper. 2016-07-19 17:58:26 -07:00
John-David Dalton
6723cdfa07 Update tested firefox version in sauce. 2016-07-18 11:29:43 -07:00
John-David Dalton
2cf10711f5 Remove toc links from site. 2016-07-18 09:01:25 -07:00
John-David Dalton
bde171e947 Update doc options. 2016-07-18 09:01:25 -07:00
John-David Dalton
2696615523 Update docdown to 0.6.1 and jscs to 3.0.7. 2016-07-18 09:01:13 -07:00
John-David Dalton
f98028d1d8 Cleanup doc notes. [ci skip] 2016-07-17 21:33:41 -07:00
John-David Dalton
97475fc365 Remove checkGlobal helper. 2016-07-17 20:10:01 -07:00
John-David Dalton
ea7aa52ea3 Cleanup “coerce arguments” bits of function descriptions. 2016-07-17 20:10:01 -07:00
John-David Dalton
ec4ae5978b Add baseRest. 2016-07-17 20:10:01 -07:00
Samuel Greene
90d73143e1 Don't rearg zipObjectDeep (#2503) 2016-07-17 20:10:01 -07:00
John-David Dalton
249f0cd72c Add _.isEqual test for transitive equivalence. 2016-07-17 20:10:01 -07:00
John-David Dalton
232cc1ab34 Minor comment typo. [ci skip] 2016-07-17 20:10:01 -07:00
Greenkeeper
2cea31cb1b Update async to version 2.0.0 and coveralls to 2.11.11. 2016-07-17 20:10:01 -07:00
John-David Dalton
02c4d60861 Remove thisGlobal use. 2016-07-17 20:10:01 -07:00
John-David Dalton
8c9073308a Add back excused Underscore isSet test for IE11. 2016-07-17 20:10:01 -07:00
John-David Dalton
8cb5455671 Add fp.zipAll. 2016-07-17 20:10:00 -07:00
John-David Dalton
8bc44e3bff Update qunit-extras to 2.1.0. 2016-07-17 20:10:00 -07:00
John-David Dalton
73f84baaec Add more excused underscore debounce tests. 2016-07-17 20:10:00 -07:00
John-David Dalton
d3acace1c4 Update uglify options to disable negate_iffe. 2016-07-17 20:10:00 -07:00
Greenkeeper
7f3539d001 Update request to 2.73.0. 2016-07-17 20:10:00 -07:00
John-David Dalton
3ef19f1ab1 Add lodash-webpack-plugin reference to readme. [ci skip] 2016-07-17 20:10:00 -07:00
John-David Dalton
749b2db846 Update jquery to 3.1.0 and marky-markdown to 7.0.2.
chore(package): update jquery to version 3.1.0 (#2483)

https://greenkeeper.io/
2016-07-17 20:10:00 -07:00
John-David Dalton
a3e99b5d89 Use optional-dev-dependency. 2016-07-17 20:10:00 -07:00
John-David Dalton
dbbb3fbb55 Add comments and cleanup build-site.js. 2016-07-17 20:10:00 -07:00
John-David Dalton
6eeac45d23 Update vendors. 2016-07-17 20:10:00 -07:00
John-David Dalton
5669cc0a0b Remove hrs. 2016-07-17 20:09:59 -07:00
John-David Dalton
d986901a1c Narrow header anchor selector. 2016-07-17 20:09:59 -07:00
John-David Dalton
5394bbf06a Make newline formatting explicit. 2016-07-17 20:09:59 -07:00
John-David Dalton
d7b2f922b5 Remove "v" prefix from version. 2016-07-17 20:09:59 -07:00
John-David Dalton
9ab55443eb Fix _.isEqualWith and _.isMatchWith test fails. 2016-07-17 20:09:59 -07:00
John-David Dalton
67c7a43e6f Move marky-markdown to an optional dep. 2016-07-17 20:09:59 -07:00
Alex Wachira
26a4bfb838 Make "lodash/fp" doc link point to untagged branch. [ci skip] 2016-07-17 20:09:59 -07:00
John-David Dalton
e7a16b2e64 Make "Contributing" doc link point to untagged branch. [ci skip] 2016-07-17 20:09:45 -07:00
John-David Dalton
a5612ed668 Update uglify-js to 2.7.0 and jscs to 3.0.6. 2016-07-17 20:09:03 -07:00
John-David Dalton
f55d15692b Remove more markymark meta data. 2016-07-17 20:08:13 -07:00
John-David Dalton
107994859b Remove markymark links from h4s. 2016-07-17 20:08:13 -07:00
John-David Dalton
a8d3689061 Ensure _.isEqual works more consistently with circular references. 2016-07-17 20:08:12 -07:00
Y-Less
4fb4ec5328 Links to creation equivalents for in-place modification functions. (#2468)
See issue #2467
2016-07-17 20:08:12 -07:00
John-David Dalton
9bc8519656 Cleanup build-site script. 2016-07-17 20:08:12 -07:00
Benjamin Tan
af36d2d8e5 Ensure proper tags are generated. (#2465) 2016-07-17 20:08:12 -07:00
Zack Hall
6b0069f10f Add doc-site build script (#2461) 2016-07-17 20:08:12 -07:00
John-David Dalton
a64b629333 Combine _.isMatch and _.matches tests. 2016-06-29 12:31:07 -07:00
John-David Dalton
fc4cc977ed Remove backticks from package name. 2016-06-29 12:31:07 -07:00
John-David Dalton
7483520c8c Cleanup .gitignore. 2016-06-29 12:31:07 -07:00
John-David Dalton
5d18fb8c70 Simplify uglify options. 2016-06-29 12:31:07 -07:00
John-David Dalton
1163bfac5c Add _.conformsTo tests. 2016-06-29 12:31:07 -07:00
John-David Dalton
d643bbd7e4 Add conformsTo to lodash doc block. [ci skip] 2016-06-26 09:55:47 -07:00
Dan J Miller
32158935f8 Change second param of _.invokeMap as path in docs. [ci skip] 2016-06-24 19:41:01 -07:00
John-David Dalton
50bf1ea784 Ensure _.first supports shortcut fusion. [closes #2447] 2016-06-24 07:05:27 -07:00
Greenkeeper
fa29123c5e Update deps. 2016-06-22 07:15:55 -07:00
John-David Dalton
314c652818 Update Chrome versions in sauce. 2016-06-22 07:15:45 -07:00
John-David Dalton
a3dd60370e Cleanup fp tests. 2016-06-18 22:31:45 -07:00
John-David Dalton
3d82567118 Add isEvenIndex helper to fp tests. 2016-06-18 22:31:45 -07:00
John-David Dalton
eaac5e02c0 Add fp.propertyOf test. 2016-06-18 21:59:56 -07:00
John-David Dalton
3bd5703bdb Downgrade QUnit for Backbone test support. 2016-06-18 21:30:38 -07:00
John-David Dalton
bf80a75474 Make fp.propertyOf and remap of fp.get. 2016-06-18 12:49:48 -07:00
John-David Dalton
bea7016223 Make fp.property and alias of fp.get. 2016-06-18 12:49:48 -07:00
John-David Dalton
c8ff2b4612 Update qunit to 2.0.0. 2016-06-18 12:49:48 -07:00
John-David Dalton
6c673cd19b Cleanup wrapper details helpers. 2016-06-18 12:49:47 -07:00
John-David Dalton
c1ae43e041 Update glob to 7.0.4 and markdown-doctest to 0.8.0. 2016-06-18 12:49:38 -07:00
Brandon Horst
9605072200 Formalize which value is picked by _.unionBy and _.unionWith to pick the result from the first array in which it occurs. 2016-06-18 12:47:44 -07:00
John-David Dalton
9cabc7c222 Ensute _.assignWith respects customizer results of undefined. [closes #2424] 2016-06-18 12:47:44 -07:00
Dan J Miller
b2b3391827 Fixed display of transforms param in overArgs docs. (#2422) 2016-06-18 12:47:43 -07:00
John-David Dalton
19e94b8889 Move split out functions. 2016-06-18 12:47:43 -07:00
John-David Dalton
4bee8c9ead Add docs for split out functions. [ci skip] 2016-06-18 12:47:43 -07:00
John-David Dalton
3f1ae77306 Assign pair[0] to a variable. 2016-06-18 12:47:43 -07:00
John-David Dalton
9f6d6d7b37 Remove isFlattenableIteratee predicate to resolve regression. [closes #2418] 2016-06-18 12:47:43 -07:00
John-David Dalton
adac412f58 Split out setWrapToString. 2016-06-18 12:47:43 -07:00
John-David Dalton
31ca38515a Make wrap functions more debuggable. 2016-06-18 12:47:43 -07:00
John-David Dalton
4a35929979 Cleanup wrap comments. 2016-06-18 12:47:42 -07:00
John-David Dalton
4a0610f107 Replace _.result use with _.get. 2016-06-18 12:47:42 -07:00
John-David Dalton
9a1b3d813a Rename wrapper function. 2016-06-18 12:47:42 -07:00
John-David Dalton
a7a4862491 Add missing context references. 2016-06-18 12:47:42 -07:00
John-David Dalton
5783536837 Update dojo to 1.11.2 and jquery to 3.0.0. 2016-06-18 12:47:42 -07:00
John-David Dalton
f8646d1a5d Minor space nit. 2016-06-10 12:19:28 -07:00
John-David Dalton
39bb7064e7 Minor doc nits. [ci skip] 2016-06-10 12:19:28 -07:00
John-David Dalton
388bf6934d Ensure fp.rearg returns a curried function. [closes #2413] 2016-06-08 23:55:25 -07:00
John-David Dalton
5122e9271c Add conforms to aliasToReal fp mapping. 2016-06-08 23:26:57 -07:00
John-David Dalton
32b36435f8 Add baseIsXyz helpers. 2016-06-08 10:53:49 -07:00
John-David Dalton
807ad48bbc Add compat note to addSetEntry. [ci skip] 2016-06-07 12:19:35 -07:00
John-David Dalton
b5842314b4 Make LARGE_ARRAY_SIZE check in stackSet align with others. 2016-06-07 08:33:48 -07:00
John-David Dalton
efb4db2b86 Isolate caches of tests. 2016-06-07 07:20:01 -07:00
John-David Dalton
ecbf8cd722 Add map cache test for changing values. 2016-06-07 07:08:33 -07:00
John-David Dalton
9992144130 Cleanup clone tests. 2016-06-07 07:08:14 -07:00
Greenkeeper
1f9cba6f53 Update markdown-doctest to 0.7.0. 2016-06-06 23:46:34 -07:00
John-David Dalton
2465a6bdbd Add fp.mergeAllWith test. 2016-06-06 23:46:06 -07:00
John-David Dalton
1a7199fd6b Cleanup fp tests. 2016-06-06 23:20:13 -07:00
John-David Dalton
57f0a4c6d7 Add conformsTo to fp aryMethod mapping. 2016-06-06 20:00:15 -07:00
John-David Dalton
138cf77916 Add fp.assignAllWith, fp.extendAllWith, and fp.mergeAllWith. 2016-06-06 19:58:51 -07:00
John-David Dalton
43d1ca89c2 Add _.ary and _.unary tests for this binding and minimum arg count. 2016-06-06 17:49:33 -07:00
John-David Dalton
51e619b18f Cleanup this binding test labels. 2016-06-06 17:48:35 -07:00
John-David Dalton
21df7426e2 Ensure _.divide and _.multiply return 1 when no arguments are specified. [closes #2405] 2016-06-06 15:58:24 -07:00
John-David Dalton
2f6b2ca0c7 Add back clearTimeout use for debounced.cancel. 2016-06-06 10:03:43 -07:00
John-David Dalton
cf1b9f9595 Update jscs to 3.0.4. 2016-06-05 22:55:57 -07:00
John-David Dalton
b0ec8339fa Cleanup and simplify doc examples. [ci skip] 2016-06-05 16:43:19 -07:00
John-David Dalton
762748684e Add _.conformsTo. 2016-06-05 15:08:39 -07:00
John-David Dalton
bdfd5880e9 Adjust freeExports and freeModule assignment. 2016-06-03 10:01:46 -07:00
John-David Dalton
9e55e5bcea Move root exposure back to the AMD branch. 2016-06-03 06:27:30 -07:00
John-David Dalton
887576e4a5 Update sauce-tunnel to 2.5.0. 2016-06-02 15:31:48 -07:00
John-David Dalton
ccd1d6ab29 Simplify _.isBuffer. 2016-06-02 14:48:25 -07:00
John-David Dalton
fcbb63ad60 Ensure helpers work when provided < 1 or > 1 argument. 2016-06-02 09:06:02 -07:00
John-David Dalton
1607e7914c Use faster C++ helpers when available. 2016-06-02 08:42:00 -07:00
John-David Dalton
68e98397ab Add matches to aliasToReal fp mapping. 2016-06-01 07:33:57 -07:00
John-David Dalton
3983d4f473 Update whereEq alias. 2016-06-01 00:19:19 -07:00
John-David Dalton
9eda959489 Another round of fp aliases. 2016-06-01 00:18:49 -07:00
John-David Dalton
4880f9923c Add fp.assignAll, fp.assignInAll, fp.defaultsAll, fp.defaultsDeepAll, and fp.mergeAll. 2016-06-01 00:02:23 -07:00
John-David Dalton
87e8a4290e Add more fp aliases. 2016-05-31 20:37:50 -07:00
John-David Dalton
fd96d59963 Add strict mode directive to a few more files. 2016-05-31 10:47:29 -07:00
John-David Dalton
1a1771f0b5 Align method descriptions with "This method" instead of "A method". [ci skip] 2016-05-31 10:46:57 -07:00
John-David Dalton
22ed53260f Add basePropertyOf helper. 2016-05-31 08:27:24 -07:00
John-David Dalton
77cf88a3bf Add util.pitch. 2016-05-30 22:00:20 -07:00
John-David Dalton
695d74d7c5 Add jsdocs to fp build modules. 2016-05-29 17:14:01 -07:00
John-David Dalton
a164735369 Shorten return statement descriptions for isXyz methods. [ci skip] 2016-05-29 17:14:00 -07:00
John-David Dalton
6ccea636b1 Remove argument number specifier in methodSpread note. [closes #2390] [ci skip] 2016-05-29 15:02:27 -07:00
John-David Dalton
0ccaf76661 Cleanup common lib docs. [ci skip] 2016-05-28 23:15:12 -07:00
John-David Dalton
593f6f9f86 Correct doc block for overArg helper in _baseConvert. [ci skip] 2016-05-28 10:16:28 -07:00
John-David Dalton
fbdda6df03 Add overArg helper. 2016-05-27 15:36:48 -07:00
John-David Dalton
a7dcce3e8d Simplify jsdoc arg signatures. 2016-05-27 14:38:32 -07:00
John-David Dalton
ee5718003b Simplify getSymbols fallback. 2016-05-27 13:46:00 -07:00
John-David Dalton
a43065ec08 Add baseGetTag helper. 2016-05-26 08:59:01 -07:00
John-David Dalton
1740ee91da Minor space nit. [ci skip] 2016-05-26 07:15:18 -07:00
John-David Dalton
90f95306f9 Make _.defaultTo return the defaultValue for NaN and nullish values. 2016-05-26 07:15:18 -07:00
John-David Dalton
0964f9175e Cleanup test descriptions with NaN. [ci skip] 2016-05-26 07:15:17 -07:00
John-David Dalton
dbde3f8826 Add link for sorted feature requests to contributing.md. [ci skip] 2016-05-26 07:15:17 -07:00
John-David Dalton
33e08baf3f Update umd doc note. [ci skip] 2016-05-26 07:15:12 -07:00
John-David Dalton
6e67ebab05 Cleanup _.defaultTo. 2016-05-25 08:46:14 -07:00
Mateo Calle
5fbc5303ff Added _.defaultTo. (#2381) 2016-05-24 21:35:56 -07:00
John-David Dalton
e582ad226a Use heavy round-tipped rightwards arrow instead of the plain rightwards arrow. 2016-05-24 21:19:50 -07:00
John-David Dalton
dfb71a3a50 Pop stacks when possible. 2016-05-24 21:15:23 -07:00
John-David Dalton
5355f4f25e Remove indexOfNaN in favor of baseFindIndex. 2016-05-24 12:42:14 -07:00
John-David Dalton
98c422d227 Avoid inspecting the entire key-value array when adding values to a stack. 2016-05-24 09:43:00 -07:00
John-David Dalton
e18b577d20 Add Map guard to stackSet. 2016-05-24 00:23:21 -07:00
John-David Dalton
7226df593e Clarify createSet doc description. [ci skip] 2016-05-24 00:22:59 -07:00
John-David Dalton
8a376f647e Cleanup iteratee arguments test labels. 2016-05-23 23:56:55 -07:00
John-David Dalton
050087f6c4 Cleanup "find" tests. 2016-05-23 23:56:23 -07:00
John-David Dalton
c67e347255 Make _.isEqual treat invalid dates as equiv. 2016-05-23 16:39:54 -07:00
John-David Dalton
3fdac985c7 Reduce createFind. 2016-05-23 16:39:04 -07:00
John-David Dalton
02ff3e6258 Remove "unique" mention from _.difference docs. [ci skip] [closes #2372] 2016-05-23 11:03:10 -07:00
John-David Dalton
65ce1b0bb5 Remove unnecessary type tag. [ci skip] 2016-05-23 10:07:25 -07:00
John-David Dalton
7e8528104b Increment package version to enable ci tests. 2016-05-23 10:07:25 -07:00
John-David Dalton
40ac55acb6 Bump to v4.13.1. 2016-05-23 08:58:01 -07:00
John-David Dalton
42c639d252 Rebuild lodash and docs. 2016-05-23 08:57:55 -07:00
John-David Dalton
d110b64ee4 Ensure _.find and _.findLast pass the correct key param to predicate. [closes #2367] 2016-05-23 08:47:43 -07:00
John-David Dalton
a2617d810c Add failing tests for #2367. 2016-05-23 08:47:24 -07:00
John-David Dalton
90d07bc04c Simplify isMaskable assignment. 2016-05-22 22:11:15 -07:00
John-David Dalton
013d9db86f Bump to v4.13.0. 2016-05-22 19:30:21 -07:00
John-David Dalton
9d4d725bc7 Rebuild lodash and docs. 2016-05-22 19:30:13 -07:00
John-David Dalton
9881cc9e10 Add fp.unionBy, fp.unionWith, fp.uniqWith, fp.xorBy, and fp.xorWith tests. 2016-05-22 19:28:32 -07:00
John-David Dalton
01474fed0b Add fp.intersectionBy and fp.intersectionWith tests. 2016-05-22 19:06:32 -07:00
John-David Dalton
024e6d8ae8 Add fp.differenceBy and fp.differenceWith tests. 2016-05-22 19:05:54 -07:00
John-David Dalton
607ba653f7 Update doc examples and tests for _.difference, _.intersection, _.union, _.uniq, and _.xor methods. 2016-05-22 19:04:32 -07:00
John-David Dalton
9090c1904f Add _.property shorthand note to _.countBy docs. [ci skip] 2016-05-22 19:04:31 -07:00
John-David Dalton
158b762367 Split up "mutation" and "with" method tests. 2016-05-22 01:08:26 -07:00
John-David Dalton
e8b3b2dc31 Use isEven in _.remove test. 2016-05-22 01:08:26 -07:00
John-David Dalton
5d72eec742 Reorg find tests. 2016-05-22 01:08:26 -07:00
John-David Dalton
6fe020c920 Add fp.findFrom and fp.findLastFrom tests. 2016-05-22 01:08:26 -07:00
John-David Dalton
40c5a6af49 Remove without from skipRearg mapping. [closes #2365] 2016-05-21 14:26:54 -07:00
John-David Dalton
803dce242b Update sortedIndex method doc examples. [ci skip] 2016-05-21 11:57:02 -07:00
John-David Dalton
4ed722ccd8 Prefer array use for doc examples of params that accept arrays. [ci skip] 2016-05-21 11:57:02 -07:00
John-David Dalton
f35d479d5e Update jquery to 2.2.4 and webpack to 1.13.1. 2016-05-20 21:52:55 -07:00
John-David Dalton
f3af61de97 Use stubs in mask functions. 2016-05-20 21:32:03 -07:00
John-David Dalton
077fb89083 Simplify getNative. 2016-05-20 21:32:03 -07:00
John-David Dalton
d4d4390846 Use _.stubFalse in _.isBuffer. 2016-05-20 21:32:03 -07:00
John-David Dalton
33e54546fe Make stub functions hoistable. 2016-05-20 21:31:58 -07:00
John-David Dalton
bf008e0680 Add fp methodRearg mappings for set "with" and "by" methods. [closes #2359] 2016-05-20 10:36:18 -07:00
John-David Dalton
08694bd709 Fix markdown-doctest run. 2016-05-20 09:00:45 -07:00
John-David Dalton
91242440fc Should not ignore empty brackes and dots. 2016-05-20 08:42:03 -07:00
John-David Dalton
68ae6fc212 Ensure round methods don't return NaN for large precision values. 2016-05-20 08:15:24 -07:00
John-David Dalton
14a16c2a7a Remove unnecessary doctrine fixes. 2016-05-19 22:18:51 -07:00
John-David Dalton
9cbb50d3a6 Remove unnecessary defineProperty guards. 2016-05-19 21:36:29 -07:00
John-David Dalton
47635b9978 Assign setTimeout to itself to avoid leak detection. 2016-05-19 21:35:44 -07:00
John-David Dalton
f90c3f2483 Ensure _.pullAll works with the same value for array and values. [closes #2356] 2016-05-19 19:47:20 -07:00
John-David Dalton
5a67ecc142 Use setProperty to mock setTimeout to avoid global leak fails in older browsers. 2016-05-19 16:15:53 -07:00
John-David Dalton
a542f8ab54 Remove clearTimeout use. 2016-05-19 13:52:18 -07:00
John-David Dalton
f32349db7d Skip setTimout mock test in PhantomJS. 2016-05-19 13:39:36 -07:00
John-David Dalton
32f5db3f72 Fix failing _.delay test. 2016-05-19 13:39:36 -07:00
John-David Dalton
670e3983b4 Cleanup _.delay and _.defer tests. 2016-05-19 13:39:35 -07:00
John-David Dalton
e1cc4d8552 Add mock Date.now and setTimeout tests. 2016-05-19 13:39:31 -07:00
John-David Dalton
8422bb37b0 Group clearTimeout and setTimeout. 2016-05-19 08:28:49 -07:00
Arend van Beelen jr
ebf9b64062 Little doc correction for _.endsWith(). (#2355) 2016-05-19 08:01:17 -07:00
John-David Dalton
56b397b506 Simplify _.conforms doc example. [ci skip] 2016-05-18 17:40:12 -07:00
John-David Dalton
de6cc79ac8 Shorten _.defer doc comment. [ci skip] 2016-05-18 17:39:37 -07:00
John-David Dalton
d28395fdb9 Replace toPairs with keys in getMatchData. 2016-05-18 14:51:54 -07:00
John-David Dalton
84b8ee7bda Allow clearTimeout, setTimeout, and Date.now to be mocked. 2016-05-18 13:50:07 -07:00
John-David Dalton
b56c732332 Cleanup fp.findFrom and fp.indexOfFrom tests. 2016-05-18 00:31:25 -07:00
John-David Dalton
041c1b4586 Simplify find tests expected. 2016-05-17 23:23:53 -07:00
John-David Dalton
0edc480d17 Increment package version to enable ci tests. 2016-05-17 13:14:20 -07:00
John-David Dalton
1a3bcb4ebd Add _.findLast tests for fromIndex values. 2016-05-17 00:52:38 -07:00
John-David Dalton
7d8c2a84b7 Cleanup up from fromIndex and length test labels. 2016-05-17 00:52:25 -07:00
John-David Dalton
4faac431c4 Make _.debounce and _.throttle tests align on dummy args. 2016-05-16 18:34:10 -07:00
John-David Dalton
df9ded3282 Fix _.throttle test for system time of 0. 2016-05-16 18:33:36 -07:00
John-David Dalton
1fe8d1679e Add nullish guards to private methods used by lodash-webpack-plugin. 2016-05-16 18:31:33 -07:00
John-David Dalton
708505f2b1 Minor doc note fixes. [ci skip] 2016-05-16 18:31:02 -07:00
John-David Dalton
b2da5ee1a7 Add backticks to error message. [ci skip] 2016-05-16 18:30:12 -07:00
John-David Dalton
315e751f43 Add _.isNative doc note. [ci skip] 2016-05-16 18:29:30 -07:00
John-David Dalton
dc5544223f Use new operator when throwing an error for consistency. 2016-05-16 15:56:03 -07:00
John-David Dalton
c14728d31a More test cleanup. 2016-05-16 13:35:05 -07:00
John-David Dalton
7d4b154866 Use consistent results var name in debounce & throttle tests. 2016-05-16 10:47:27 -07:00
John-David Dalton
b69647a0c3 Add isModularize check for _.throttle test for system time of 0. 2016-05-16 10:37:00 -07:00
John-David Dalton
d054442e2c Cleanup date mocks. 2016-05-16 10:31:20 -07:00
John-David Dalton
e50bf1fb44 Add _.throttle test for a system time of 0. 2016-05-16 08:38:20 -07:00
John-David Dalton
d40b6a75da Test label cleanup for find methods. 2016-05-16 08:17:15 -07:00
John-David Dalton
e124e7fb5f Init lastCallTime as undefined to avoid issues when the sytem time is 0. [closes #2342] 2016-05-16 01:00:26 -07:00
John-David Dalton
7c3a163f9c Add back _.includes test for strings with a fromIndex. 2016-05-15 22:29:32 -07:00
John-David Dalton
03af0791aa Remove dead code from tests. 2016-05-15 21:46:33 -07:00
John-David Dalton
464885a539 Add getValue helper. 2016-05-15 20:57:10 -07:00
John-David Dalton
346579ac7a Add interopRequire test helper. 2016-05-15 15:48:52 -07:00
John-David Dalton
76ed206e9b Make _.isNative throw if core-js is detected. 2016-05-15 15:48:47 -07:00
John-David Dalton
06e7c963ef Combine _.find and _.includes tests for fromIndex. 2016-05-14 23:16:38 -07:00
John-David Dalton
573d902026 Simplify umd and exports. 2016-05-14 13:11:58 -07:00
John-David Dalton
66cdfe5896 Update markdown-doctest to 0.6.0. 2016-05-13 20:04:36 -07:00
John-David Dalton
9afd4659c7 Add fake source key detection. 2016-05-13 20:03:13 -07:00
John-David Dalton
7249217600 Add "findFrom" methods to fp dep mappings. 2016-05-12 22:44:26 -07:00
John-David Dalton
2f20c672e0 Update _.times doc example to not duplicate _.stubTrue. [ci skip] 2016-05-12 16:29:16 -07:00
John-David Dalton
6d02a64c47 Add fromIndex param to _.find and _.findLast. 2016-05-12 16:19:35 -07:00
Jeroen Engels
3d078383cb Add findIndexFrom, findLastIndexFrom, indexOfFrom, & lastIndexOfFrom in FP. 2016-05-12 15:08:05 -07:00
John-David Dalton
64e765bf7a Fix _.stubFalse doc example typo. [ci skip] 2016-05-12 13:57:14 -07:00
John-David Dalton
b5b6125730 Minor space nit. [ci skip] 2016-05-12 13:54:56 -07:00
John-David Dalton
e45984f6b8 Add npm prepublish hook. 2016-05-12 07:59:42 -07:00
John-David Dalton
a95cf1c26c Rename mock to stub. 2016-05-12 07:53:34 -07:00
Greenkeeper
4a19913726 Update markdown-doctest to 0.5.0. 2016-05-12 06:37:23 -07:00
John-David Dalton
52ae769bfa Add default accumulator note to _.transform docs. [ci skip] 2016-05-11 22:11:08 -07:00
John-David Dalton
44d7c3887d Rename test helper prop to resolve. 2016-05-11 00:28:36 -07:00
John-David Dalton
315271996c Cleanup _.constant tests. 2016-05-11 00:28:36 -07:00
John-David Dalton
2357704540 Add _.mockArray, _.mockFalse, _.mockObject, _.mockString, and _.mockTrue. 2016-05-11 00:28:31 -07:00
John-David Dalton
262049f737 Remove extraneous _.toPath examples. [ci skip] 2016-05-10 23:33:27 -07:00
John-David Dalton
04d6e351a6 Add fromIndex param to _.findIndex and _.findLastIndex. 2016-05-10 23:33:21 -07:00
Greenkeeper
9fa86ec712 Update ecstatic to 1.4.1. 2016-05-10 19:09:47 -07:00
John-David Dalton
901e3dcff2 Flip "n" and "index" in _.nth and _.nthArg docs. [ci skip] 2016-05-08 16:50:38 -07:00
John-David Dalton
43fffe3200 Bump to v4.12.0. 2016-05-07 22:02:47 -07:00
John-David Dalton
1123e13072 Rebuild lodash and docs. 2016-05-07 22:02:40 -07:00
John-David Dalton
996636d25b Update lodash dep. 2016-05-07 19:31:52 -07:00
John-David Dalton
8864095bab Update firefox version in sauce. 2016-05-07 19:31:52 -07:00
John-David Dalton
def9f5d84a Fix doc typo for _.toPairsIn. [closes #2314] 2016-05-07 10:07:10 -07:00
John-David Dalton
47d024ae7b Use "index" instead of "nth". [closes #2313] [ci skip] 2016-05-07 06:55:24 -07:00
John-David Dalton
05135ca171 Update chrome version in sauce. 2016-05-06 22:58:22 -07:00
John-David Dalton
ca1f22a7c6 Ensure trailing function sources aren't skipping for _.assign, _.assignIn, _.defaults, & _.merge. [closes #2311] 2016-05-06 21:24:57 -07:00
John-David Dalton
9a461a5e48 Add _.toFinite. 2016-05-04 21:09:28 -07:00
John-David Dalton
73e7bab839 Add tooling section. [ci skip] 2016-05-04 17:17:14 -07:00
John-David Dalton
572060aedc Update fp description. [ci skip] 2016-05-04 17:17:01 -07:00
John-David Dalton
f1b63d41f8 Fix test fails for npm package builds. 2016-05-02 21:34:19 -07:00
John-David Dalton
9ee423edcf Add _.toPairs test for sets. 2016-05-02 21:04:00 -07:00
John-David Dalton
70c8651182 Use consistent b values. 2016-05-02 21:03:13 -07:00
John-David Dalton
2b54f23dad Add more stack tests. 2016-05-02 20:17:41 -07:00
John-David Dalton
67ef2bb008 Cleanup customizer test labels. 2016-05-02 20:17:13 -07:00
John-David Dalton
f2b5e58500 Minor hyphen nit. 2016-05-02 19:42:33 -07:00
John-David Dalton
b8fa0d9b29 Add large stack test to other cache tests. 2016-05-02 19:42:23 -07:00
John-David Dalton
264d68dec9 Add support for sets to _.toPairs methods. 2016-05-02 16:53:17 -07:00
John-David Dalton
71f5264ee1 Cleanup returns tags. [ci skip] 2016-05-02 16:51:59 -07:00
John-David Dalton
ce8a1feb94 Avoid paving modified lodash for coverage runs in travis. 2016-05-02 13:31:03 -07:00
John-David Dalton
05c32044e9 Remove extraneous isArrayLikeObject check from isFlattenable. 2016-05-02 13:08:51 -07:00
John-David Dalton
44927be6e2 Drop version from license header. [ci skip] 2016-05-02 10:52:53 -07:00
John-David Dalton
d1779d6cdd Fix phantomjs test fails. 2016-05-02 10:01:17 -07:00
John-David Dalton
a13d640bcc Test internal caches instead of cache modules. 2016-05-02 08:51:44 -07:00
John-David Dalton
c7d4106f66 Add private tags back to map methods. [ci skip] 2016-05-02 07:15:32 -07:00
John-David Dalton
2e59faad8f Fix module paths. 2016-05-02 00:34:58 -07:00
John-David Dalton
6d70b64b2e Ensure module tests ran for coverage. 2016-05-02 00:00:19 -07:00
John-David Dalton
767f9c6bce Simplify module assignment. 2016-05-01 23:37:13 -07:00
John-David Dalton
edd7c2f0b1 Cleanup travis tests. 2016-05-01 23:24:30 -07:00
John-David Dalton
b9cfd31bd5 Add modular build to coverage tests. 2016-05-01 21:00:58 -07:00
John-David Dalton
6883f99141 Add tests for map caches. 2016-05-01 19:12:03 -07:00
John-David Dalton
c2aee218d2 Add promise case to code removal for coverage run. 2016-05-01 19:11:49 -07:00
Greenkeeper
8e44d73705 Update markdown-doctest to 0.4.0. 2016-05-01 19:10:44 -07:00
Anders D. Johnson
9e30cc4542 Fix docs typo space after sentence in _.merge. 2016-05-01 19:09:18 -07:00
John-David Dalton
963e2c23b0 Upgrade to qunit-extras 2.0. 2016-04-30 11:59:06 -07:00
Jeroen Engels
7ee4bf8d02 Remove duplicate method from FP mapping. 2016-04-30 10:43:42 -07:00
John-David Dalton
c3c6bc9666 Cleanup markdown-doctest-setup. 2016-04-29 11:57:41 -07:00
Nick Johnstone
ef1024bb60 Test documentation with markdown-doctest. 2016-04-29 10:32:43 -07:00
John-David Dalton
6c6e1c2be3 Use array and iteratee. [ci skip] 2016-04-28 22:08:28 -07:00
John-David Dalton
e9a08ba9a9 Use https for Alex's blog. [ci skip] 2016-04-28 21:30:22 -07:00
John-David Dalton
59546b9989 Update conduct link in contributing text. [ci skip] 2016-04-28 21:26:46 -07:00
John-David Dalton
816edcce2e Rename getPlaceholder to getHolder. 2016-04-28 14:55:25 -07:00
Greenkeeper
8accfb3372 Update fs-extra to 0.30.0. 2016-04-28 10:56:16 -07:00
John-David Dalton
da146a9afd Add map doc note to _.toPairs and _.toPairsIn. [ci skip] 2016-04-28 10:56:15 -07:00
John-David Dalton
cbcd5ffdc4 Add node_js v6 to travis. 2016-04-27 08:04:33 -07:00
Clinton Montague
6f600ebeac Add _.flip bitmask value to createWrapper documentation. [ci skip] 2016-04-26 16:58:50 -07:00
John-David Dalton
9aa456f26f Use lodashStable.toArray in more places. 2016-04-25 00:04:33 -07:00
John-David Dalton
dc77d7605d Add _.toArray tests for maps. 2016-04-24 23:56:22 -07:00
John-David Dalton
f7c4410f41 Add support for converting maps to _.toPairs and _.toPairsIn. 2016-04-24 23:56:00 -07:00
John-David Dalton
9fa0ec00b8 Remove unneeded var assignment. 2016-04-23 11:43:15 -07:00
John-David Dalton
0125ff7303 Cleanup fp test labels and args tests. 2016-04-23 11:31:14 -07:00
John-David Dalton
fbc91cf7ae Add iteratee arity hints to forEach methods. [closes #2277] 2016-04-23 11:29:52 -07:00
John-David Dalton
43c26b5d6f Ensure matches methods match arrays with duplicate values. [closes #2270] 2016-04-22 23:02:54 -07:00
John-David Dalton
4e38f70e0e Update cache implementations. 2016-04-22 23:02:46 -07:00
John-David Dalton
e2c86dac63 Ensure fp.update does not convert end of path to an object. [closes #2271] 2016-04-22 08:46:35 -07:00
John-David Dalton
aebc0650f8 Simplify _.concat. 2016-04-22 08:32:19 -07:00
John-David Dalton
44cf971405 Bump to v4.11.2. 2016-04-21 08:29:44 -07:00
John-David Dalton
c0d7418054 Rebuild lodash and docs. 2016-04-21 08:29:44 -07:00
John-David Dalton
a0db54b53f Add tests for _.sortedIndex with nulls and symbols. 2016-04-21 08:29:44 -07:00
John-David Dalton
32b813e42b Ensure sortedIndex methods align with sortBy for symbols. 2016-04-21 06:56:07 -07:00
John-David Dalton
3c144b8601 Ensure _.sortBy moves symbols to the end. 2016-04-21 01:01:00 -07:00
John-David Dalton
076e4e6db5 Add math operator method tests for objects. 2016-04-21 01:00:59 -07:00
John-David Dalton
2ea08ccd36 Add math operator method tests for symbols. 2016-04-21 00:44:56 -07:00
John-David Dalton
fc48518f2b Move toKey from baseProperty to property. 2016-04-20 18:12:16 -07:00
John-David Dalton
594c3b3406 Update @see tags. [ci skip] 2016-04-20 17:25:04 -07:00
John-David Dalton
38edd713e4 Ensure punctuation is not treated as words. [closes #2268] 2016-04-20 16:23:46 -07:00
John-David Dalton
6987d70dc2 Only avoid converting -0 to 0 if comparator is provided. 2016-04-20 16:05:21 -07:00
John-David Dalton
0e4b307585 Update full build kb. [ci skip] 2016-04-20 07:49:45 -07:00
John-David Dalton
c81bbe95c6 Use an anchor title. [ci skip] 2016-04-20 07:49:44 -07:00
John-David Dalton
b21a87b50f Fix createSet feature test for Safari 8. 2016-04-20 07:49:44 -07:00
John-David Dalton
e3566eb1ce Use Set only if it coerces -0 correctly. 2016-04-20 01:24:00 -07:00
John-David Dalton
0429434dbb Ensure -0 is treated as 0. 2016-04-20 00:51:25 -07:00
John-David Dalton
80f35ee713 Add _.uniq tests for -0. 2016-04-20 00:25:31 -07:00
John-David Dalton
224595c837 Move links to the top of the readme. 2016-04-19 23:59:20 -07:00
John-David Dalton
61ace9a24b Remove code of conduct doc. 2016-04-19 23:59:14 -07:00
John-David Dalton
8c630ede7e Cleanup package.json. 2016-04-19 23:07:06 -07:00
John-David Dalton
ca3b583695 Add wrapped values tests. 2016-04-19 17:42:46 -07:00
John-David Dalton
c2cbb06d57 Add _.difference and _.intersection tests for -0. 2016-04-19 16:57:41 -07:00
John-David Dalton
f6bf8d2e6d Cleanup -0 tests. 2016-04-19 12:38:00 -07:00
John-David Dalton
60c89b2754 Add _.invoke test for -0 key. 2016-04-19 12:37:47 -07:00
John-David Dalton
b72fba911d Cleanup wrapper resets and add assert for returning function object values. 2016-04-19 11:26:55 -07:00
John-David Dalton
3930c388e4 Fix Safari 9.0 flaky test fail. 2016-04-19 10:23:03 -07:00
John-David Dalton
ddf5ef0839 Add even more -0 tests. 2016-04-19 08:24:33 -07:00
John-David Dalton
c66947405b Add omit and pick tests for -0 keys. 2016-04-19 00:24:09 -07:00
John-David Dalton
ad27b62343 Add tests for -0 keys. 2016-04-19 00:23:16 -07:00
John-David Dalton
5283b0f407 Use _.startCase. 2016-04-18 22:30:24 -07:00
John-David Dalton
af41f9267a Add test for combining enclosing circle backslash. 2016-04-18 22:03:56 -07:00
John-David Dalton
6e8c984250 Use toKey in more functions. 2016-04-18 21:33:32 -07:00
John-David Dalton
c2e018b2ac Avoid rate limiting by Sauce. 2016-04-18 21:23:09 -07:00
John-David Dalton
a47ce3cf13 Simplify building lodash. 2016-04-18 20:56:58 -07:00
John-David Dalton
ba58f35f37 Add arguments object test for values methods. 2016-04-18 17:48:26 -07:00
Greenkeeper
30fd1693ee Update fs-extra to 0.28.0. 2016-04-18 08:30:33 -07:00
John-David Dalton
161c17ce7f Consolidate returns in trim methods. 2016-04-17 21:55:43 -07:00
John-David Dalton
27dfe542bd Use baseToString in _.truncate. 2016-04-17 07:18:39 -07:00
John-David Dalton
353113f17f Start to add @see tags. [ci skip] 2016-04-16 21:48:22 -07:00
John-David Dalton
762e858c48 Use isSymbol instead of baseToNumber to fix _.toNumber test fails. 2016-04-16 20:45:10 -07:00
John-David Dalton
db49702046 Remove unsafe_comps uglify option to fix minified builds. 2016-04-16 20:16:38 -07:00
John-David Dalton
7239bf791f Comma nit in _.inRange doc. [ci skip] 2016-04-16 18:16:27 -07:00
John-David Dalton
9cb75cae1d Add jsdocs for baseToNumber and baseToString. 2016-04-16 18:00:31 -07:00
John-David Dalton
fdb4cf1208 Use baseToString in more places and refactor isIndex and isKeyable. 2016-04-16 07:32:06 -07:00
John-David Dalton
714cf7b18c Add baseGt, baseLt, baseToNumber, baseToString, and createRelationalOperation. 2016-04-15 07:17:48 -07:00
John-David Dalton
1a1e0e1a6b Ensure _.pullAt sorts indexes greater than 9 correctly. [closes #2254] 2016-04-15 07:17:48 -07:00
John-David Dalton
f6c14ec31f Add jscs "disallowUnusedVariables" rule. 2016-04-15 07:17:48 -07:00
John-David Dalton
da7f413f6f Update jscs to 3.0.1 and fs-extra to 0.27.0. 2016-04-15 07:17:34 -07:00
John-David Dalton
3cf28953a7 Update code of conduct to point to the jQuery Foundation's policy. [ci skip] 2016-04-14 11:11:08 -07:00
John-David Dalton
080b761f7f Update export doc note. [ci skip] 2016-04-14 08:37:19 -07:00
John-David Dalton
7f6ad484ec Bump to v4.11.1. 2016-04-13 22:09:00 -07:00
John-David Dalton
391a930d49 Rebuild lodash and docs. 2016-04-13 22:09:00 -07:00
John-David Dalton
a532773703 Cleanup debounce and throttle tests. 2016-04-13 22:08:55 -07:00
John-David Dalton
49f8aa4289 Fix failing debounce test. 2016-04-13 18:17:07 -07:00
ben robbins
44b9b085c0 Add test for _.debounce with a wait of 0. 2016-04-13 18:16:50 -07:00
John-David Dalton
a447353977 Add pluck fp alias of map. 2016-04-13 14:22:40 -07:00
John-David Dalton
dea6ccbf43 Bump to v4.11.0. 2016-04-13 09:57:13 -07:00
John-David Dalton
0c4d8836e7 Rebuild lodash and docs. 2016-04-13 09:57:03 -07:00
Jeroen Engels
ef67e07732 Fix doc nits for _.nth. [ci skip] 2016-04-13 09:52:37 -07:00
John-David Dalton
7e885a4ddd Add _.words unit test for contractions. 2016-04-13 08:21:17 -07:00
John-David Dalton
a3c1f42708 Add _.nth and _.nthArg tests. 2016-04-13 01:09:12 -07:00
John-David Dalton
d3ef5a3acb Use noop instead of alwaysUndefined. 2016-04-13 01:09:12 -07:00
John-David Dalton
5098d63a22 Update qunit to 1.23.1. 2016-04-12 22:38:49 -07:00
John-David Dalton
4275a73170 Add support for contractions to case methods. 2016-04-12 21:48:52 -07:00
John-David Dalton
78a157d675 Move _.map test order around. 2016-04-12 21:48:52 -07:00
John-David Dalton
97a437e8e6 Return implicit undefined. 2016-04-12 10:02:24 -07:00
John-David Dalton
3c37f290a8 Add unwrapped chain test for nth. 2016-04-12 09:38:22 -07:00
John-David Dalton
dcd5d470e0 Use baseUnary to avoid passing incorrect arity hints to baseIteratee. 2016-04-12 08:27:41 -07:00
John-David Dalton
b424f3b60f Ensure fp.over doesn't cap its iteratee args. 2016-04-12 08:14:04 -07:00
John-David Dalton
201ea9a9f0 Add shorthand tests for sortBy and over methods. 2016-04-11 22:46:38 -07:00
John-David Dalton
2469af6c3f Add _.nth. 2016-04-11 22:46:33 -07:00
John-David Dalton
bfe6e06b5a Ensure _.sortBy works with the matchesProperty shorthand. 2016-04-11 17:38:03 -07:00
John-David Dalton
091b5fbe30 Make _.head avoid accessing array when its length is 0. 2016-04-11 17:34:49 -07:00
John-David Dalton
93168e6018 Use references to String#replace and String#split. 2016-04-11 17:29:22 -07:00
John-David Dalton
16ed081818 Absorb copyObjectWith into copyObject. 2016-04-11 17:28:19 -07:00
John-David Dalton
c38b4b29cf Avoid unnecessary array cloning in createRecurryWrapper and mergeData. 2016-04-11 17:27:04 -07:00
John-David Dalton
a20b88d114 Bump to v4.10.0. 2016-04-10 22:44:04 -07:00
John-David Dalton
87912a3b3f Rebuild lodash and docs. 2016-04-10 22:42:52 -07:00
John-David Dalton
53bde1238c Replace "invoking" with "and invokes". [ci skip] 2016-04-10 22:40:38 -07:00
John-David Dalton
fd365c27e2 Add doc comments to the minify file util. [ci skip] 2016-04-10 22:40:38 -07:00
John-David Dalton
4f43841699 Add doc comments to the common file util. [ci skip] 2016-04-10 22:40:38 -07:00
John-David Dalton
e60e97c03f Ensure _.debounce queues a trailing call after maxWait. [closes #2229] 2016-04-10 20:50:51 -07:00
Greenkeeper
e619f8ca83 Update webpack to 1.12.15. 2016-04-10 20:02:01 -07:00
John-David Dalton
cf2f538167 Add castSlice and rename cast related helpers. 2016-04-09 13:57:45 -07:00
John-David Dalton
17e1a6dbe8 Ensure _.slice handles a limit of 0 in Node 0.10. 2016-04-09 00:53:07 -07:00
John-David Dalton
74f6af8686 Update fp aliases. 2016-04-08 17:59:18 -07:00
John-David Dalton
351236f526 Rearrange regexp vars. 2016-04-08 16:32:15 -07:00
John-David Dalton
51ad056710 Remove redundant param descriptions. [ci skip] 2016-04-08 15:04:07 -07:00
John-David Dalton
6512b7f925 Update "over" method iteratee descriptions. [ci skip] 2016-04-08 15:03:06 -07:00
John-David Dalton
c7264e3f1f Add isIterateeCall check to _.split. 2016-04-08 11:03:18 -07:00
John-David Dalton
349ec35c48 Add flow test for handling an empty array. 2016-04-08 11:03:18 -07:00
John-David Dalton
057dd5b0a8 Minor escapeRegExp test nit. 2016-04-08 11:03:18 -07:00
John-David Dalton
f6ac7cb1a1 Shorten chars string coersion. 2016-04-08 11:03:18 -07:00
John-David Dalton
c1958daf65 Update handling of limit to the current es6 draft. 2016-04-08 11:03:10 -07:00
John-David Dalton
ee73c9b436 Bump to v4.9.0. 2016-04-08 02:07:13 -07:00
John-David Dalton
fac5e727e6 Rebuild lodash and docs. 2016-04-08 02:07:13 -07:00
John-David Dalton
977264f55b Fix split test fails across enviros. 2016-04-08 02:07:13 -07:00
John-David Dalton
e776e679af Ensure _.split works with emojis. 2016-04-08 01:20:49 -07:00
John-David Dalton
23901dfd45 Update docdown. 2016-04-07 21:43:33 -07:00
John-David Dalton
87444e1a45 Add sumBy tests. 2016-04-07 21:43:33 -07:00
John-David Dalton
dc63bc2bd9 Fix dynamic test labels for groups of methods. 2016-04-07 21:43:33 -07:00
John-David Dalton
f4ff4f29b1 Simplify toSource. 2016-04-07 21:43:32 -07:00
John-David Dalton
06412d5f12 Remove Hash use from Uglify options because it breaks it. 2016-04-07 21:43:32 -07:00
John-David Dalton
bbc84903a7 Update istanbul to 0.4.3. 2016-04-07 21:43:32 -07:00
John-David Dalton
e014592ea0 Fix typo in Hash descripton. [ci skip] 2016-04-07 21:43:32 -07:00
John-David Dalton
4305ffde18 Add commas. [ci skip] 2016-04-07 21:43:32 -07:00
John-David Dalton
0588dcb3e9 Add Hash util and split out file helper. 2016-04-07 21:43:27 -07:00
John-David Dalton
58afd8c364 Update debounce article links. [ci skip] 2016-04-06 14:10:56 -07:00
John-David Dalton
e120d63ee2 Add doc note about group ordering of _.groupBy. [ci skip] [closes #2212] 2016-04-06 07:59:05 -07:00
John-David Dalton
d7f43eba6a Make exceptions to fp argument ordering stand out. [ci skip] 2016-04-05 23:53:05 -07:00
John-David Dalton
786a92669e Update chaining note. [ci skip] 2016-04-05 23:53:05 -07:00
John-David Dalton
504aead673 Add placeholders section. [ci skip] 2016-04-05 23:52:49 -07:00
John-David Dalton
8c72ffc583 Add more fp browser usage examples. [ci skip] 2016-04-05 23:50:18 -07:00
John-David Dalton
27d3311b6a Don't spell out two hundred. [ci skip] 2016-04-05 23:50:18 -07:00
John-David Dalton
5e2f113d50 Update vendor/backbone to v1.3.3. 2016-04-05 23:50:18 -07:00
Greenkeeper
55e7b8764e Update jquery to 2.2.3. 2016-04-05 23:50:18 -07:00
John-David Dalton
513c0ae64d Update list of fp methods with spread arguments. [ci skip] 2016-04-05 23:50:17 -07:00
John-David Dalton
f0f6a1e382 Simplify deep path doc examples. [ci skip] 2016-04-05 08:44:14 -07:00
John-David Dalton
6f3fb587e2 Simplify deep property tests. 2016-04-05 08:39:09 -07:00
John-David Dalton
083c5b703a Add _.matchesProperty test for matching undefined values of nested objects. 2016-04-05 08:23:34 -07:00
John-David Dalton
3583c56067 Replace double quotes with ticks. [ci skip] 2016-04-05 08:08:31 -07:00
John-David Dalton
9999199d2b Enable over methods to accept matchesProperty shorthands. 2016-04-05 08:06:44 -07:00
John-David Dalton
c084e358bd Bump to v4.8.2. 2016-04-04 15:48:17 -07:00
John-David Dalton
238d45a2cb Rebuild lodash and docs. 2016-04-04 15:48:17 -07:00
John-David Dalton
21d056c470 Break code comments up to display better in the wiki. [ci skip] 2016-04-04 15:48:16 -07:00
John-David Dalton
0308d4de62 Remove skipFixed methods from fixed arity listings. [ci skip] 2016-04-04 11:47:52 -07:00
John-David Dalton
f2a6f6ce6a Update lodash dev dep. 2016-04-04 11:47:52 -07:00
John-David Dalton
cf5d6b5bc8 Revert #2193. 2016-04-04 11:47:46 -07:00
John-David Dalton
7a6b64b2f6 Bump to v4.8.1. 2016-04-04 11:43:03 -07:00
John-David Dalton
bca11bd21e Rebuild lodash and docs. 2016-04-04 11:42:50 -07:00
John-David Dalton
bf39a31907 Fix typo in _falseOptions.jst. 2016-04-04 08:51:04 -07:00
John-David Dalton
792bfbb604 Bump to v4.8.0. 2016-04-03 23:47:26 -07:00
John-David Dalton
1ef96896d5 Rebuild lodash and docs. 2016-04-03 23:47:26 -07:00
John-David Dalton
2293de07a7 Add _falseOptions module. 2016-04-03 23:47:26 -07:00
John-David Dalton
804ad3d805 Move private key higher. [ci skip] 2016-04-03 22:44:28 -07:00
John-David Dalton
c797f83ca5 Add fp convert test for unconverted methods. 2016-04-03 21:55:30 -07:00
John-David Dalton
a71ac53fa7 Add jsdoc comments to fp/_baseConvert. [ci skip] 2016-04-03 21:55:30 -07:00
John-David Dalton
7165ef6f5e Minor doc tweak to _.rearg. [ci skip] 2016-04-03 21:55:30 -07:00
John-David Dalton
c01e0cd7d1 Simplify references to partial or provided arguments. [ci skip] 2016-04-03 21:55:30 -07:00
John-David Dalton
a5990a4c4e Use thru instead of through in docs. [ci skip] 2016-04-03 21:55:30 -07:00
John-David Dalton
75d196b01b Allow convert to work on methods that aren't converted by default. 2016-04-03 21:55:08 -07:00
John-David Dalton
69ce7cde7d Convert methods not found in aryMethod mapping. 2016-04-02 22:49:17 -07:00
John-David Dalton
6861734010 Add matchesStrictComparable helper. 2016-04-02 14:49:25 -07:00
John-David Dalton
0f75d967d0 Add convert method to modules that pass thru. 2016-04-02 14:19:19 -07:00
John-David Dalton
012bff97e0 Add fp/placeholder module. 2016-04-02 14:19:13 -07:00
John-David Dalton
2b58525816 Update many es5 spec links to es6. [ci skip] 2016-04-02 10:33:13 -07:00
John-David Dalton
579cf00d10 Update _.isNaN doc note with a reference to Number.isNaN. [ci skip] 2016-04-02 08:02:36 -07:00
John-David Dalton
cfd25cec75 Minor Lodash letter case nit in readme. [ci skip] 2016-04-02 08:01:35 -07:00
John-David Dalton
c267c4e06b Excuse Underscore _.chunk test. 2016-04-01 20:56:19 -07:00
John-David Dalton
c4a78445b3 Add _.isNative test for Promise. 2016-04-01 19:17:52 -07:00
John-David Dalton
4c8836a24a Cleanup _.isNative. 2016-04-01 19:06:36 -07:00
John-David Dalton
972624297b Add variation to falsey _.slice test. 2016-04-01 18:18:37 -07:00
John-David Dalton
ebf9904e8a Add toSource helper. 2016-04-01 18:18:37 -07:00
John-David Dalton
64652c263f Update _.map doc note on guarded methods. [ci skip] 2016-04-01 18:18:37 -07:00
John-David Dalton
58f93567fc Make _.sampleSize default n to 1 instead of 0. 2016-04-01 18:18:37 -07:00
John-David Dalton
f599c4817a Make _.chunk default size to 1 instead of 0. 2016-04-01 18:18:36 -07:00
John-David Dalton
930b034da5 Make _.repeat default n to 1 instead of 0. 2016-04-01 18:18:36 -07:00
John-David Dalton
c21174f7f9 Add bizarro test for _.isEmpty. 2016-04-01 18:18:36 -07:00
John-David Dalton
e22be612e2 Remove dataViewCtorString branch of getTag for coverage tests. 2016-04-01 18:18:36 -07:00
Craig Martin
669bc1520e Run scripts synchronous in foreground. 2016-04-01 18:18:27 -07:00
John-David Dalton
b257bb9c9e Allow over, overEvery, and overSome to accept matchesProperty shorthands. [closes #2193] 2016-04-01 09:14:13 -07:00
John-David Dalton
b8096df6d8 Fix leaked var. 2016-04-01 09:13:54 -07:00
greenkeeperio-bot
43d530ead9 Update dojo to 1.11.1. 2016-04-01 09:10:36 -07:00
John-David Dalton
9dbd665d05 Space nit in _.toNumber. [ci skip] 2016-04-01 09:10:36 -07:00
John-David Dalton
3902fd1a67 Ensure has treats nested sparse arrays consistently. 2016-04-01 09:10:35 -07:00
John-David Dalton
642d248f99 Cleanup deep property tests of has methods. 2016-04-01 09:10:35 -07:00
John-David Dalton
8bd9a4d2c3 Ensure _.has returns false for nullish objects. [closes #2190] 2016-04-01 09:10:24 -07:00
John-David Dalton
e96ee69f1c Remove rogue comment delimiter from fp wiki template. [ci skip] 2016-04-01 09:10:24 -07:00
John-David Dalton
5bb899a700 Add array path examples to _.set and _.unset docs. [ci skip] 2016-04-01 09:10:24 -07:00
John-David Dalton
431e0fa2f6 Add line number to error message in web worker. 2016-04-01 09:10:24 -07:00
John-David Dalton
ec92292c38 Wrap funcToString call in _.isNative in a try-catch. 2016-04-01 09:10:24 -07:00
Oskar Segersvärd
45953b2ac1 Set the jsdoc type of apply's args parameter to Array. [ci skip] 2016-04-01 09:10:24 -07:00
John-David Dalton
d9f93d0895 Increment package version to enable ci tests. 2016-04-01 09:10:24 -07:00
John-David Dalton
252ea445ca Bump to v4.7.0. 2016-03-31 00:51:19 -07:00
John-David Dalton
9826d9bd46 Rebuild lodash and docs. 2016-03-31 00:51:19 -07:00
John-David Dalton
b53f178c46 Sort reargs and aliases in fp wiki template. 2016-03-31 00:51:19 -07:00
John-David Dalton
5ad5eb8f5d Add divide and multiply to lodash doc block. [ci skip] 2016-03-31 00:28:04 -07:00
John-David Dalton
7add87739a Add _.concat test for shallow cloning array. 2016-03-30 23:32:21 -07:00
John-David Dalton
2cd12c38e3 Temporarily remove ghooks. 2016-03-30 21:27:19 -07:00
Jordan Eldredge
ad72b5b565 Simplify _.result. 2016-03-30 19:52:46 -07:00
Craig Martin
608e74a111 Ensure all background jobs finish before continuing. 2016-03-30 19:50:23 -07:00
John-David Dalton
c36d0af5cd Avoid a JIT bug in Safari 9 for baseIteratee. 2016-03-30 19:50:13 -07:00
John-David Dalton
55c3299d5c Use getIteratee in more places. 2016-03-30 12:17:28 -07:00
greenkeeperio-bot
7a3dda6105 Update ghooks to 1.1.1. 2016-03-30 08:43:30 -07:00
John-David Dalton
171d9eab78 Use copyArray in concat. 2016-03-30 08:43:30 -07:00
John-David Dalton
ab9d2056da Add bindKey to fp aryMethod mapping. 2016-03-30 08:43:30 -07:00
John-David Dalton
4310329971 Add bind and bindKey to fp skipRearg mapping. 2016-03-30 08:43:30 -07:00
John-David Dalton
d038315f61 Add link to github reactions. [ci skip] 2016-03-30 00:54:28 -07:00
John-David Dalton
c0f91c9169 Minor newline nits. 2016-03-29 22:51:25 -07:00
John-David Dalton
519a02ff34 Update fred ages in doc examples. [ci skip] 2016-03-29 22:33:43 -07:00
John-David Dalton
643ce1da74 Revert createPadding behavior for chars that coerce to empty strings. 2016-03-29 22:23:00 -07:00
greenkeeperio-bot
4c789197f9 Update chalk to 1.1.3 and opt-cli to 1.4.0. 2016-03-29 22:22:12 -07:00
John-David Dalton
277c9bdc7c Make shouldInvoke explicitly return true if it's the first call. 2016-03-29 09:53:35 -07:00
John-David Dalton
455eace9c5 Cleanup _.debounce tests. 2016-03-29 00:28:43 -07:00
John-David Dalton
f263a87983 Update excused Underscore tests. 2016-03-28 22:11:56 -07:00
John-David Dalton
4f92fb7007 Ensure cancel resets lastCallTime and lastInvokeTime. 2016-03-28 21:06:11 -07:00
John-David Dalton
4fd43f7fe7 Minor value consistency nits. 2016-03-28 19:27:55 -07:00
John-David Dalton
3fe2efa311 Ensure _.concat cases wraps nullish array values in an array. 2016-03-28 17:44:13 -07:00
John-David Dalton
a7bf3352df Ensure _.concat casts non-array array values to arrays. 2016-03-28 12:34:09 -07:00
John-David Dalton
2ddd893ca2 Update vendor/underscore. 2016-03-28 09:35:41 -07:00
John-David Dalton
5d92b37550 Add updateWith to lodash sequence doc note. [ci skip] 2016-03-28 09:26:03 -07:00
John-David Dalton
dcec882262 Ensure _.words detects compound words where an all caps word is next to a capitalized word. [closes #2163] 2016-03-28 07:57:37 -07:00
John-David Dalton
de53132692 Add args param doc for _.attempt. [closes #2164] [ci skip] 2016-03-28 07:05:08 -07:00
greenkeeperio-bot
23a7871e2d Update docdown to 0.5.0. 2016-03-27 16:32:20 -07:00
John-David Dalton
792347978a Add shim path back to _.isEmpty. 2016-03-27 13:35:14 -07:00
John-David Dalton
61c740a4eb Move isObjectLike condition up in _.isEmpty. 2016-03-27 13:07:28 -07:00
John-David Dalton
c3a614858b Add support for maps and sets to _.isEmpty. [closes #2159] 2016-03-27 13:04:51 -07:00
John-David Dalton
75727d073b More pad optimizations. 2016-03-27 12:37:09 -07:00
John-David Dalton
b1d7450052 Fix typo in pad test label. 2016-03-27 12:31:14 -07:00
John-David Dalton
60e557b059 Reduce lines creeping over 80 characters in length. 2016-03-27 11:43:44 -07:00
John-David Dalton
071e13363c Add "Array" to predicate types. [ci skip] [closes #2157] 2016-03-27 09:59:48 -07:00
John-David Dalton
acf4651c0e Minor newline nit. [ci skip] 2016-03-27 09:59:37 -07:00
John-David Dalton
9b15dc2017 Fix fail in PhantomJS. 2016-03-27 01:23:58 -07:00
John-David Dalton
f4f0791e0c Fix fail in Node 0.10. 2016-03-27 01:23:58 -07:00
John-David Dalton
654976c826 Add DataView support to getTag. 2016-03-27 01:23:58 -07:00
John-David Dalton
50e86c70bd Add other realm tests for comparing array views with _.isEqual. 2016-03-27 01:23:58 -07:00
Dan Levy
d135b846db Adding support for cloning and comparing DataView. 2016-03-27 01:23:58 -07:00
John-David Dalton
ee2153364d Add bizarro Promise test. 2016-03-27 01:23:58 -07:00
John-David Dalton
6d76cdc1b7 Update snippet removals for coverage runs. 2016-03-27 01:23:52 -07:00
John-David Dalton
259bdb6151 Add realm tests for maps, promises, and sets. 2016-03-26 14:09:36 -07:00
John-David Dalton
12438fa0d7 Ensure _.isEqual compares promises by reference. 2016-03-26 13:59:53 -07:00
John-David Dalton
654df6f7f8 Optimize createPadding for the common case. 2016-03-26 13:21:54 -07:00
John-David Dalton
0dfe176fe6 Make pad methods default to a chars of " " if chars is an empty string. 2016-03-26 12:14:02 -07:00
John-David Dalton
0f3338013e Update sauce browsers. 2016-03-25 19:03:47 -07:00
John-David Dalton
dcc239b070 Add falsey iteratee tests. 2016-03-25 16:36:47 -07:00
John-David Dalton
613488eaf8 Use in instead of relying on behavior. 2016-03-25 15:50:49 -07:00
John-David Dalton
97193b9680 Update vendor/backbone. 2016-03-25 14:14:52 -07:00
greenkeeperio-bot
71c0861675 Update opt-cli to 1.3.0, coveralls to 2.11.9, & qunitjs to 1.23.0. 2016-03-25 14:13:42 -07:00
John-David Dalton
f3b35919ef Add baseMean helper. 2016-03-25 14:13:42 -07:00
Tucker Whitehouse
06316f1d47 Add _.meanBy. 2016-03-24 21:41:41 -07:00
Federico De Giuli
271f64ee3f Make _.isEmpty work as expected on buffers. 2016-03-24 21:41:41 -07:00
Kent C. Dodds
583b03ba5f Add git hook instructions to CONTRIBUTING.md. [ci skip] 2016-03-24 21:41:35 -07:00
John-David Dalton
16e2c06ab4 Remove dead code from baseClone. 2016-03-24 10:54:23 -07:00
John-David Dalton
016de80ce7 Add debounce/throttle test for calling cancel and flush without anything queued. 2016-03-24 10:54:23 -07:00
John-David Dalton
577226bbd0 Add number object tests to number coercion methods. 2016-03-24 10:54:23 -07:00
John-David Dalton
1670800df3 Add test for crawling functions with _.result. 2016-03-24 10:54:23 -07:00
Kent C. Dodds
9674d67693 add opt-in githook to config 2016-03-23 10:18:57 -06:00
John-David Dalton
f65d36b3c1 Make _.result resolve values of functions as it deep crawls over them. 2016-03-23 00:44:36 -07:00
John-David Dalton
8d93455076 Add more options docs. [ci skip] 2016-03-22 22:26:34 -07:00
John-David Dalton
cfe5ea264d Remove parens from default options value doc of _.truncate. [ci skip] 2016-03-22 08:44:23 -07:00
John-David Dalton
9a4e11f6f7 Add chars param fix to postprocess. [ci skip] 2016-03-21 22:11:40 -07:00
John-David Dalton
24cef1a919 Add other realm maps/sets tests for _.size. 2016-03-21 21:00:29 -07:00
John-David Dalton
5fe373f7aa Add support for deep cloning maps and sets. 2016-03-21 21:00:19 -07:00
John-David Dalton
25eb4df563 Add support for maps and sets to _.size. 2016-03-21 20:16:15 -07:00
John-David Dalton
6d587bdf34 Add -0 test for math operator methods. 2016-03-21 20:04:46 -07:00
John-David Dalton
03dd9df78e Remove unneeded assert in indexOf test. 2016-03-21 08:46:23 -07:00
greenkeeperio-bot
96c60bab46 Update dojo to 1.11.0. 2016-03-21 00:44:32 -07:00
John-David Dalton
811341efa1 Add code examples to fp wiki. [ci skip] 2016-03-20 14:18:24 -07:00
John-David Dalton
5f94723d7f Add always fp alias. 2016-03-20 11:53:38 -07:00
John-David Dalton
9d1536799b Add complement fp alias. 2016-03-20 11:43:32 -07:00
John-David Dalton
85057d588c Move "Chaining" section lower. [ci skip] 2016-03-20 11:40:34 -07:00
John-David Dalton
234e693d92 Flip priority of "object" and "collection" in _.isEmpty doc description. [ci skip] 2016-03-20 11:29:22 -07:00
John-David Dalton
51833b91d0 Add invertObj and juxt fp aliases. 2016-03-20 11:23:12 -07:00
John-David Dalton
dfb7a4c078 Don't make without an alias so it can be reverted with convert. 2016-03-20 11:16:18 -07:00
John-David Dalton
04ddaf49f5 Organize aliases. 2016-03-20 11:13:24 -07:00
John-David Dalton
b7a6560d90 Add identical fp alias. 2016-03-20 11:13:06 -07:00
John-David Dalton
7d8531d6ed Add _.divide and _.multiply tests. 2016-03-20 11:03:29 -07:00
John-David Dalton
ab77d9d83a Add more math operation method tests. 2016-03-20 10:16:03 -07:00
John-David Dalton
37454b8f42 Add eq and isEqual to fp skipRearg mapping. 2016-03-20 10:02:46 -07:00
John-David Dalton
ef95f165ff Fix npm build tests. 2016-03-20 01:10:23 -07:00
John-David Dalton
6494a072d2 Fix test fails in Safari. 2016-03-20 01:02:53 -07:00
John-David Dalton
984bcc556e Add fp.isMatchWith test. 2016-03-20 00:26:58 -07:00
John-David Dalton
be77e7366c Remove "with" methods from iterateeAry mapping. 2016-03-19 23:43:11 -07:00
John-David Dalton
01d961bad8 Ensure fp.isEqualWith rearg is (c,a,b). [closes #2131] 2016-03-19 23:40:14 -07:00
John-David Dalton
6eb0cb1565 Add _.divide and _.multiply. 2016-03-19 23:01:40 -07:00
John-David Dalton
b2bff1ad45 Ensure array sequence methods don't error for falsey values. 2016-03-19 22:51:32 -07:00
John-David Dalton
6ed9c005d7 Make fp.invokeArgs and fp.invokeArgsMap arg signature (b,c,a). 2016-03-18 08:29:41 -07:00
John-David Dalton
6ef8693bf0 Update case examples. 2016-03-17 21:11:32 -07:00
John-David Dalton
8c5025f935 Move upperFirst definition lower. 2016-03-17 21:11:32 -07:00
John-David Dalton
9735961090 Ensure _.startCase only uppercases the first character of each word. 2016-03-17 21:11:32 -07:00
greenkeeperio-bot
8d7058e6ad Update fs-extra to 0.26.7, jquery to 2.2.2, & requirejs to 2.2.0. 2016-03-17 21:10:36 -07:00
John-David Dalton
4d89d9a1b7 Add fp.convert to "Convert" section. 2016-03-17 21:10:36 -07:00
John-David Dalton
594f414b1a Move the "Convert" section to the bottom. 2016-03-17 21:10:36 -07:00
John-David Dalton
b61d30da1a Make fp.without an alias of fp.difference. [closes #2122] 2016-03-17 21:10:36 -07:00
John-David Dalton
412e19006b Fix fp aliases for all, any, and anyPass. 2016-03-17 21:10:36 -07:00
Jeroen Engels
b8ebceadaf Add missing param for _.reverse. [ci skip] 2016-03-17 21:10:36 -07:00
John-David Dalton
2b4f271899 Add fp.invokeArgsMap. 2016-03-17 21:10:36 -07:00
John-David Dalton
c83857c42a Minor non- nits. [ci skip] 2016-03-15 08:38:55 -07:00
John-David Dalton
b95d1d6123 Ensure _.mergeWith sources are cloned when customizer returns undefiend. [closes #2111] 2016-03-15 08:32:23 -07:00
John-David Dalton
7d1d7d909a Add fp padChars methods. 2016-03-14 22:17:46 -07:00
John-David Dalton
c89a80357c Cleanup fp convert tests. 2016-03-14 22:16:20 -07:00
John-David Dalton
1bbb24fa0c Add fp.convert. 2016-03-14 10:53:40 -07:00
John-David Dalton
dd0aa991ff Add since tag to _.isArray. [ci skip] 2016-03-13 19:59:50 -07:00
John-David Dalton
6f9b1b1822 Simplify _.method example. [ci skip] 2016-03-13 16:35:52 -07:00
John-David Dalton
65fd579ed2 Add fp.invokeArgs. 2016-03-13 16:34:07 -07:00
John-David Dalton
f3279b7ee1 Wrap fp.getOr test in an IIFE. 2016-03-13 15:30:32 -07:00
John-David Dalton
4d185ae7b5 Add fp.restFrom and fp.spreadFrom. 2016-03-13 15:30:01 -07:00
John-David Dalton
81ee5d76b8 Use "sequence" to descript chaining in more places. [ci skip] 2016-03-13 14:49:28 -07:00
John-David Dalton
8bed7137c7 Add chaining note to fp wiki template. [ci skip] 2016-03-13 14:44:58 -07:00
libreninja
f8bcc5b917 Break before unnecessary string concats in _.repeat. 2016-03-13 12:39:05 -07:00
John-David Dalton
81f8518d15 Simplify assocIndexOf description. [ci skip] 2016-03-12 09:01:06 -08:00
John-David Dalton
f88d27ccda Fix param descriptions for assocDelete, mapSet, and stackSet. [ci skip] 2016-03-11 20:00:08 -08:00
John-David Dalton
40ed92d2af More _.debounce cleanup. 2016-03-11 08:04:39 -08:00
John-David Dalton
c7319d004d Add non-function constructor tests for _.isMap, _.isSet, and _.isWeakMap. 2016-03-10 16:33:29 -08:00
John-David Dalton
51a3c5d4e8 Cleanup _.debounce. 2016-03-10 07:59:31 -08:00
John-David Dalton
ecfa002a05 Update Edge testing in Sauce. 2016-03-09 16:55:34 -08:00
John-David Dalton
62962791b3 Rename debounce helper to invokeFunc to fix builds. 2016-03-08 06:58:39 -08:00
Brandon Wallace
864e14cb20 Refactor debounce to simplify, reduce timers, fix bugs. 2016-03-07 22:24:04 -08:00
John-David Dalton
092f90d2fc Cleanup sorting test results. 2016-03-07 08:11:59 -08:00
John-David Dalton
49b33d667d Add toPairs test for inherited string keyed properties. 2016-03-07 08:04:11 -08:00
John-David Dalton
63b097329c Minor curried label nits. [ci skip] 2016-03-07 07:41:18 -08:00
John-David Dalton
2c3ab276ea Add _.entries and _.entriesIn aliases. 2016-03-06 22:56:48 -08:00
John-David Dalton
c30c43d69e Add more since tags. [ci skip] 2016-03-06 22:12:42 -08:00
John-David Dalton
230c18d5d6 Add fp.flatMapDepth test. 2016-03-06 19:13:43 -08:00
John-David Dalton
c16e64cd36 Remove unneeded flatMap lazy chaining tests. 2016-03-06 19:12:47 -08:00
John-David Dalton
64704e16c1 Add _.flatMapDeep and _.flatMapDepth. 2016-03-06 11:15:04 -08:00
greenkeeperio-bot
b41103ee6b Update glob to 7.0.3. 2016-03-05 18:35:22 -08:00
John-David Dalton
8ac1d54858 Add fast path for numbers in _.toNumber. 2016-03-05 16:56:59 -08:00
John-David Dalton
0a9af2968e Add primitives tests. 2016-03-05 16:54:37 -08:00
John-David Dalton
7eba5a2221 Ensure _.toNumber works with symbol objects without a valueOf method. 2016-03-05 16:16:49 -08:00
John-David Dalton
19a8b3886e Flip assignment order for consistency. [ci skip] 2016-03-05 08:43:42 -08:00
John-David Dalton
03716f62e8 Remove runInContext call in convert. 2016-03-05 08:39:00 -08:00
John-David Dalton
d38000bc33 Minor format nit for baseCastPath. [ci skip] 2016-03-05 08:38:34 -08:00
John-David Dalton
a6c88a173b Ensure _.toPath returns a new array. 2016-03-04 18:02:28 -08:00
John-David Dalton
0bad210dec Add tests for number coercion methods. 2016-03-04 18:00:05 -08:00
John-David Dalton
62cc7574fc Remove dead code branch from baseCastPath. 2016-03-04 10:41:09 -08:00
John-David Dalton
f5a134bcbd Remove unused baseForIn. 2016-03-04 10:37:29 -08:00
John-David Dalton
a7bb6b5383 Add getPrototype helper. 2016-03-04 09:17:00 -08:00
John-David Dalton
e02ce1ea8b Ensure _.toPath works with symbols. 2016-03-04 08:09:39 -08:00
John-David Dalton
760a00b82f Make a distinction between property names and identifiers. [ci skip] 2016-03-04 07:51:12 -08:00
John-David Dalton
e6929e801b Add getAllKeysIn helper. 2016-03-04 07:50:40 -08:00
John-David Dalton
8682da4962 Update V8 bug links. [ci skip] 2016-03-04 07:33:32 -08:00
John-David Dalton
8e6f3e48d0 Ensure getOwnPropertySymbols is passed an object to avoid errors in V8. 2016-03-04 07:33:16 -08:00
John-David Dalton
0589dd6909 Ensure _.omit works with symbols. 2016-03-04 02:03:23 -08:00
John-David Dalton
1b8071d2c4 Replace Dojo Foundation references with jQuery Foundation in contributing.md. [ci skip] 2016-03-04 01:24:43 -08:00
John-David Dalton
4debf155d7 Update and add tests for fp convert method. 2016-03-04 00:55:59 -08:00
John-David Dalton
f6df126c43 Cleanup license urls. 2016-03-03 22:58:41 -08:00
Esa-Matti Suuronen
c406e33fcc Add reconvert method to fp functions. 2016-03-03 22:47:30 -08:00
John-David Dalton
9e11ebb62a Ensure _.isPlainObject returns false for objects with a custom [[Prototype]]. [closes #2085] 2016-03-03 22:46:23 -08:00
John-David Dalton
16ed42b188 Add tests for symbol paths. 2016-03-03 22:42:58 -08:00
John-David Dalton
a19890469e Minor format nit. 2016-03-03 22:42:29 -08:00
John-David Dalton
cc1c1c127e Cleanup path test labels. 2016-03-03 22:41:56 -08:00
John-David Dalton
3c1e95a3c2 Cleanup foo references. 2016-03-03 22:41:22 -08:00
John-David Dalton
d4c0777d2c Minor format nits for Foo test functions. 2016-03-03 20:40:20 -08:00
John-David Dalton
8f00000676 Minor format nit of isIterateeCall. 2016-03-03 20:07:10 -08:00
John-David Dalton
4240f737d1 Add symbol support to baseCastPath, isKey, and toNumber. 2016-03-03 20:04:37 -08:00
John-David Dalton
25121a86bb Specify string keyed properties. [closes #2081] [ci skip] 2016-03-03 18:02:47 -08:00
John-David Dalton
e4b3cde0a4 Memoize stringToPath. 2016-03-03 15:58:23 -08:00
Dave Methvin
cf74ebeb71 Update license to the jQuery Foundation. [ci skip] 2016-03-03 12:03:26 -08:00
Jeroen Engels
d682357189 Add @since to the method jsdocs. [ci skip] 2016-03-03 07:47:26 -08:00
John-David Dalton
ddd4c391a1 Add _.updateWith test for a customizer. 2016-03-02 22:25:51 -08:00
greenkeeperio-bot
930ee1d650 Update jscs to 2.11.0. 2016-03-02 14:15:50 -08:00
John-David Dalton
c5344d5336 Ensure _.has returns false for nested inherited properties. [closes #2073] 2016-03-02 07:54:27 -08:00
John-David Dalton
d59c644a10 Use baseGet in parent and _.result. 2016-03-02 07:47:37 -08:00
John-David Dalton
28171945e9 Use smaller objects for _.assign bench. 2016-03-02 07:39:08 -08:00
John-David Dalton
ddf9354d26 Bump to v4.6.1. 2016-03-01 21:55:32 -08:00
John-David Dalton
5f58b65c04 Rebuild lodash and docs. 2016-03-01 21:55:09 -08:00
John-David Dalton
1ec20c5281 Use propertyIsEnumerable var. 2016-03-01 20:33:17 -08:00
John-David Dalton
3421fab58a Update lodash dev dep. 2016-03-01 19:40:05 -08:00
John-David Dalton
deeaf27b54 Avoid cloning symbols internally. 2016-03-01 19:37:44 -08:00
John-David Dalton
429be57b8a Bump to v4.6.0. 2016-03-01 10:58:13 -08:00
John-David Dalton
7f00e8f2f1 Rebuild lodash and docs. 2016-03-01 10:58:13 -08:00
John-David Dalton
89f891ac86 Ensure placeholder uses func when its a lib. 2016-03-01 10:58:13 -08:00
John-David Dalton
63147cd145 Update our code of conduct. [ci skip] 2016-02-29 22:04:07 -08:00
John-David Dalton
2c5f026d3c Add doc note to associate _.merge with _.assign. [ci skip] 2016-02-29 08:17:10 -08:00
John-David Dalton
c10146e2f0 Set constructor of lodash.prototype. 2016-02-29 00:02:13 -08:00
John-David Dalton
548fe881d6 Add _.pullAllWith comparator test. 2016-02-28 20:05:54 -08:00
John-David Dalton
b560b7047b Cleanup "With" tests. 2016-02-28 20:05:27 -08:00
John-David Dalton
6f470abdff Add _.pullAllWith test. 2016-02-28 12:23:32 -08:00
John-David Dalton
eabe95c4e3 Add _.updateWith fp support. 2016-02-28 12:16:21 -08:00
John-David Dalton
fab50ec384 Add _.updateWith tests. 2016-02-28 11:55:09 -08:00
John-David Dalton
0f298de36a Add _.updateWith. 2016-02-28 11:30:16 -08:00
John-David Dalton
f8132e3be4 Add more _.update tests. 2016-02-28 10:54:40 -08:00
John-David Dalton
dfd865dadc Only use SetCache in baseIntersection only when arrays[0] is large. 2016-02-27 21:26:51 -08:00
John-David Dalton
98bdd67cf2 Simplify array mapping in basePullAll and baseOrderBy. 2016-02-27 18:42:24 -08:00
John-David Dalton
e842bec025 Optimize _.intersection to stop search once it matches the size of its smallest array. 2016-02-27 18:35:18 -08:00
John-David Dalton
8278d38a8e Add update to lodash doc note. [ci skip] 2016-02-27 17:03:23 -08:00
John-David Dalton
0699d4cf3d Simplify regexp test. 2016-02-27 17:00:56 -08:00
John-David Dalton
8865633ccd Move baseUpdate and update definitions. 2016-02-27 17:00:46 -08:00
John-David Dalton
7066b9a5c7 Rearrange tests. 2016-02-27 17:00:11 -08:00
John-David Dalton
63f8b1dcec Ensure _.defaultsDeep does not overwrite regexp values. 2016-02-27 14:35:20 -08:00
John-David Dalton
2e790fb865 Add IE 11 doc note to addMapEntry. [ci skip] 2016-02-27 11:13:51 -08:00
John-David Dalton
ac62c24c4a Cleanup passing stack around since Stac#set returns the stack. 2016-02-27 11:06:01 -08:00
John-David Dalton
629de594d5 Avoid deep cloning source values if a customizer is provided. 2016-02-27 10:20:51 -08:00
John-David Dalton
7a69a45ccc Add template sentence tweaks from the wiki. 2016-02-27 10:20:51 -08:00
greenkeeperio-bot
916431118e Update coveralls to 2.11.8. 2016-02-27 10:20:50 -08:00
John-David Dalton
83e584d579 Split circular reference tests up. 2016-02-26 22:08:03 -08:00
Danny Fallon
bbd536fc04 Add test for mergeWith with multi-ref source object. 2016-02-26 22:07:24 -08:00
John-David Dalton
0b76654b71 Ensure stack is popped after recursive merge so that it doesn't affect sibling properties. [closes #2060] 2016-02-26 09:42:42 -08:00
Jeroen Engels
ff7d79d5fc Remove custom rearg for update. 2016-02-26 09:31:58 -08:00
Hassan Zamani
b40b555386 Add _.update. 2016-02-26 01:55:47 -08:00
John-David Dalton
efa1ebff16 Clarify result value order of _.xor. [ci skip] 2016-02-26 00:04:20 -08:00
John-David Dalton
8f0dcde98f Clarify result value origin and order of difference methods. [ci skip] 2016-02-26 00:01:52 -08:00
John-David Dalton
3b1efb635b Clarify result value origin and order of intersection methods. [ci skip] 2016-02-25 23:59:41 -08:00
John-David Dalton
055fdfa0b4 Add _.pullAllWith. 2016-02-25 23:24:13 -08:00
John-David Dalton
a5a21235dc Add mdn references to _.toLower and _.toUpper. [ci skip] 2016-02-25 08:34:43 -08:00
Francis De Brabandere
dfbcfdb0ae Clarify intersection docs on what is returned. [ci skip] 2016-02-24 10:24:40 -08:00
John-David Dalton
a1e917bac2 Remove the word "Added" from alias list. [ci skip] 2016-02-24 01:02:11 -08:00
John-David Dalton
62a9208944 Include aliases in lodash chain doc note. [ci skip] [closes #2044] 2016-02-24 00:48:57 -08:00
John-David Dalton
1bf8eb8cac Update qunit and qunit-extras. 2016-02-23 23:13:34 -08:00
John-David Dalton
893573485c Escape bang in pattern. 2016-02-23 21:22:07 -08:00
John-David Dalton
d5231ad94b Add source tests for _.assign and _.assignIn. 2016-02-23 21:16:32 -08:00
John-David Dalton
a578935621 Remove unhit condition in getNative. 2016-02-23 20:13:08 -08:00
Jeroen Engels
c88c7ff6bb Fix order of arguments in FP docs. [ci skip] 2016-02-23 14:19:48 -08:00
John-David Dalton
21f9cfa6d3 Remove unneeded Ctor variables. 2016-02-23 10:58:27 -08:00
John-David Dalton
45d2fb8a30 Fix _.transform test fail in Safari 8. 2016-02-23 10:58:27 -08:00
John-David Dalton
9c162624fe Cleanup symbolTag case in equalByTag. 2016-02-23 10:58:27 -08:00
John-David Dalton
80b5731709 Leak msWDfn in test/test-fp.js to prevent false fails in Edge on sauce. 2016-02-23 10:58:27 -08:00
John-David Dalton
bab4ffff62 Remove unstable test from local testing. 2016-02-23 08:31:04 -08:00
John-David Dalton
f644c82da4 Replace Symbol checks with Symbol methods as checks instead. [closes #2039] 2016-02-23 08:30:48 -08:00
John-David Dalton
54294f15ef Update _.assign and _.assignIn fast paths. 2016-02-23 08:23:13 -08:00
John-David Dalton
dfe77571fb Remove _.keys fast path. 2016-02-23 08:23:05 -08:00
John-David Dalton
f40f66d29b Remove a isTypedArray check and unnecessary stack creation from baseIsEqualDeep. 2016-02-22 23:38:19 -08:00
John-David Dalton
af06529283 Ensure _.isEqual works with maps and sets with circular references. 2016-02-22 23:38:18 -08:00
John-David Dalton
d8da7a2142 Use isFunction check without the typeof check. 2016-02-22 23:38:18 -08:00
John-David Dalton
c1f8e31775 Use typeof for function checks instead of isFunction. 2016-02-22 23:38:18 -08:00
John-David Dalton
cc4b49226b Use postfix increment operators. 2016-02-22 23:38:18 -08:00
John-David Dalton
f9a2f74716 Optimize _.assign, _.assignIn, & _.keys. 2016-02-22 23:38:18 -08:00
John-David Dalton
a326a6badf Update contributing text with 👍's. [ci skip] 2016-02-22 23:38:18 -08:00
John-David Dalton
e21f4862e1 Update contributing link to tagged release. [ci skip] 2016-02-22 23:38:18 -08:00
greenkeeperio-bot
f0c3ac1789 Update jquery to 2.2.1, uglify-js to 2.6.2, and webpack to 1.12.14. 2016-02-22 23:37:38 -08:00
John-David Dalton
e24513e6e2 Clarify _.isEmpty docs. [ci skip] 2016-02-22 12:19:08 -08:00
John-David Dalton
a224b6f1b0 Add core.min.js and lodash.min.js to the fp module ignored list. 2016-02-22 10:28:34 -08:00
John-David Dalton
26299eb364 Update _.isEmpty doc param type for value. [ci skip] 2016-02-22 10:24:20 -08:00
John-David Dalton
772c461a33 Bump to v4.5.1. 2016-02-21 22:58:49 -08:00
John-David Dalton
110ca4d1b5 Rebuild lodash and docs. 2016-02-21 22:58:49 -08:00
John-David Dalton
aafb05b675 Update for lodash v4 api. 2016-02-21 22:58:49 -08:00
John-David Dalton
ff6fc56a15 Use _baseConvert in fp module. 2016-02-21 21:07:21 -08:00
John-David Dalton
2dfbe9fe77 Use minified lodash in fp module. 2016-02-21 21:07:09 -08:00
John-David Dalton
4a0fe2c17b Use lodash in test/remove.js. 2016-02-21 19:35:08 -08:00
John-David Dalton
9f7e626b9a Make build-module create core.min.js and lodash.min.js. 2016-02-21 19:35:08 -08:00
John-David Dalton
f2985bda5f Add copyFile, minFile, and writeFile to lib/common/util.js. 2016-02-21 19:35:01 -08:00
John-David Dalton
1517745a6a Update placeholder param description of createRecurryWrapper. [ci skip] 2016-02-21 16:57:06 -08:00
John-David Dalton
887cb55919 Add _.placeholder tests. 2016-02-21 13:48:46 -08:00
John-David Dalton
5c42d0ef31 Add intersection tests for two arrays. 2016-02-21 09:59:51 -08:00
John-David Dalton
837d47a309 Update lodash paths travis.yml, test/test.js, and test/index.html. 2016-02-20 23:53:35 -08:00
John-David Dalton
f3766cf889 Add getPlaceholder helper. 2016-02-20 18:07:11 -08:00
John-David Dalton
2b8b63e59f Allow placeholders to persist through more than 1 curried call. 2016-02-20 18:07:05 -08:00
John-David Dalton
d64583b743 Cleanup bitmask groupings in mergeData. 2016-02-20 16:40:59 -08:00
John-David Dalton
9ec65d5ed5 Fix newHolders typo. 2016-02-20 11:28:11 -08:00
John-David Dalton
9fe6afcdcc Use lodashStable.bind in unzip/zip test. 2016-02-20 11:28:11 -08:00
Benjamim Sonntag
6a4e0fb41b Links _.remove and _.pull in the docs. [ci skip] 2016-02-20 11:28:00 -08:00
John-David Dalton
b570884bb3 Remove npm "prepublish" script to avoid running on npm i. 2016-02-19 10:51:48 -08:00
John-David Dalton
8f8f8e288c Update internal module references in tests. 2016-02-19 10:39:38 -08:00
John-David Dalton
8698a5e0e8 Add tests for setting the [[Prototype]] of clones for values where constructor is incorrect. 2016-02-19 08:18:56 -08:00
John-David Dalton
ad5e30e189 Move _.merge test for augmenting objects. 2016-02-19 08:17:44 -08:00
Benjamin Tan
19ee0c74f8 Update link to CONTRIBUTING.md in readme. [ci skip] 2016-02-19 08:02:57 -08:00
John-David Dalton
007e5aa27a Increment package version to enable ci tests. 2016-02-19 01:23:07 -08:00
John-David Dalton
2509f562b5 Update fp wiki template. 2016-02-19 01:23:02 -08:00
John-David Dalton
a58a276ffd Replace "iteratee function" with "iteratee". [ci skip] 2016-02-19 01:04:36 -08:00
John-David Dalton
1a5b9dcce1 Add iteratee signature to _.mapKeys. [ci skip] 2016-02-19 01:04:19 -08:00
John-David Dalton
1240a0dfdd Move contributing text to .github. [ci skip] 2016-02-19 00:46:06 -08:00
Henrik Hjelte
0194169e79 Clarify docs on omitBy predicate params. [ci skip] 2016-02-19 00:11:33 -08:00
John-David Dalton
a71c19e1b5 Avoid unnecessary cloning in fp set methods. [closes #2017] 2016-02-19 00:11:20 -08:00
John-David Dalton
bfbfa719ff Ensure assignValue assigns values if they aren't the same own value. [closes #2022] 2016-02-19 00:01:33 -08:00
John-David Dalton
49389d0a2f Ducktype in _.isError for ES6 support. 2016-02-18 21:52:53 -08:00
John-David Dalton
e380062403 Use getPrototypeOf to set inheritance when constructor is a function. [closes #2018] 2016-02-18 21:52:19 -08:00
John-David Dalton
b83abfa9c1 Make fp arity for orderBy three instead of two. [closes #2019] 2016-02-18 13:37:16 -08:00
John-David Dalton
48dbf203a5 Ensure fp pickBy and omitBy provide value and key arguments. 2016-02-18 01:08:19 -08:00
John-David Dalton
23768398c5 Add iterateeRearg fp mapping back for mapKeys. 2016-02-17 22:21:48 -08:00
John-David Dalton
ab73503859 Bump to v4.5.0. 2016-02-17 22:21:48 -08:00
John-David Dalton
a4f7d4cc2a Rebuild lodash and docs. 2016-02-17 22:21:47 -08:00
Myles Borins
cca5ac60d6 Fix npm-test by removing the call to test-docs. 2016-02-17 22:21:47 -08:00
John-David Dalton
9f7f9fc3c5 Adjust heading order. [ci skip] 2016-02-17 01:26:28 -08:00
John-David Dalton
6e2fb92e9a Remove unused baseArity. 2016-02-16 22:29:41 -08:00
John-David Dalton
4f702e2381 Specify utf8 encoding. 2016-02-16 22:04:47 -08:00
John-David Dalton
b188f903ce Add fp tests for iteratee shorthands. 2016-02-16 21:27:08 -08:00
John-David Dalton
7b93dc9c32 Ensure clone methods clone expando properties of boolean, number, & string objects. [closes #2008] 2016-02-16 21:27:03 -08:00
John-David Dalton
664d66a89e Make string tests more consistent. 2016-02-16 20:44:55 -08:00
John-David Dalton
d9dc0e6fd1 Add _.invertBy tests. 2016-02-16 19:30:23 -08:00
John-David Dalton
53168e4cfd Remove dup _.invertBy test. 2016-02-16 18:49:43 -08:00
John-David Dalton
7998632685 Add castArray chaining test. 2016-02-16 18:48:57 -08:00
John-David Dalton
86f2a1061c Simplify readme. [ci skip] 2016-02-16 18:48:11 -08:00
John-David Dalton
9ca02a448e Update cdn links. [ci skip] 2016-02-16 08:52:49 -08:00
John-David Dalton
17091d3a0e Simplify shorthand test labels. 2016-02-16 08:42:29 -08:00
John-David Dalton
c94b1488e9 Make iteraeeAry pass thru non-functions. [closes #2007] 2016-02-16 07:46:54 -08:00
John-David Dalton
7b2274cb44 Add methods to lodash doc notes. [ci skip] 2016-02-16 01:29:25 -08:00
John-David Dalton
7c27a6f51e Make wording of entries align closer to their titles. [ci skip] 2016-02-16 01:29:25 -08:00
John-David Dalton
e91371d406 Increment package version to enable ci tests. 2016-02-16 01:29:25 -08:00
John-David Dalton
e878559fb9 Bump to v4.4.0. 2016-02-15 23:08:19 -08:00
John-David Dalton
36af8de116 Rebuild lodash and docs. 2016-02-15 23:07:07 -08:00
John-David Dalton
09dd3a8fea Remove noConflict call from the node fp module template. 2016-02-15 23:07:07 -08:00
John-David Dalton
5dd6b90692 Minor comma nit from contributing.md. [ci skip] 2016-02-15 21:30:16 -08:00
John-David Dalton
97fd94744e Add mapping section to fp wiki template. [ci skip] 2016-02-15 17:38:30 -08:00
John-David Dalton
0da3674d5e Update fp doc template. 2016-02-15 17:00:01 -08:00
John-David Dalton
01d530d65e Cleanup fp/build-modules. 2016-02-15 16:59:43 -08:00
John-David Dalton
10dd42b6e4 Restore bizarro tests for Object.create. 2016-02-15 16:47:31 -08:00
John-David Dalton
ba2d3f7704 Use != instead of !== when value is guaranteed to be a string. 2016-02-15 16:36:20 -08:00
Graeme Yeates
607fe2a5f6 Use Object.create in baseCreate (even if shimmed). 2016-02-15 16:35:20 -08:00
John-David Dalton
4643679d79 Remove fp caps mapping. 2016-02-15 13:51:20 -08:00
greenkeeperio-bot
04180c7c96 Update jscs to 2.10.1. 2016-02-15 11:12:14 -08:00
John-David Dalton
3846348f8a Clarify how undefined source values are handled in _.merge. [ci skip] 2016-02-15 10:22:25 -08:00
John-David Dalton
dc2fc9428d Cross reference _.matches and _.isMatch in docs. [ci skip] 2016-02-15 10:22:04 -08:00
John-David Dalton
6e399ce311 Cleanup long lines in isEqualWith docs. [ci skip] 2016-02-15 10:21:19 -08:00
John-David Dalton
641b544801 Add castArray to lodash chaining doc note. [ci skip] 2016-02-15 10:20:40 -08:00
John-David Dalton
761a100397 Ensure _.valuesIn returns results. [closes #2000] 2016-02-15 09:14:10 -08:00
John-David Dalton
cf1a4f893f Update fp doc generation. 2016-02-15 00:18:12 -08:00
John-David Dalton
19613be861 Add isArray to _util.jst. 2016-02-14 23:47:45 -08:00
John-David Dalton
c163659713 Rename fp mapping rename to remap. 2016-02-14 23:47:45 -08:00
John-David Dalton
aae02af265 Cleanup Date shims. 2016-02-14 19:20:17 -08:00
John-David Dalton
cb96bf15b7 Reduce the length of some lines. 2016-02-14 19:14:17 -08:00
John-David Dalton
c006c28f55 Add lib/common/util. 2016-02-14 12:57:34 -08:00
John-David Dalton
d358d00531 Ensure fp castArray shallow clones arrays. 2016-02-14 12:09:17 -08:00
John-David Dalton
abcebb4f48 Remove exposed castFunction and castPath. 2016-02-14 11:02:11 -08:00
John-David Dalton
6e74724c0f Add _.compat test for lazy sequence with a custom _.iteratee. 2016-02-14 09:21:07 -08:00
John-David Dalton
c5f6c43326 Add default wrapper value to jsdoc of _.wrap. [ci skip] 2016-02-14 08:57:28 -08:00
John-David Dalton
a9e8c0ba76 Add changelog mention to the wiki link in readme. [ci skip] 2016-02-14 08:41:43 -08:00
John-David Dalton
5388d8a7b0 Rename _.asArray to _.castArray and add _.castFunction and _.castPath. 2016-02-13 13:40:04 -08:00
Graeme Yeates
ee499b36ea Add _.asArray method. 2016-02-13 09:04:19 -08:00
John-David Dalton
13e4b959a4 Rename skipTest to skipAssert. 2016-02-13 08:32:47 -08:00
John-David Dalton
5a336403f9 Fix fp browser test fails. 2016-02-13 08:31:04 -08:00
John-David Dalton
26265c011a Fix failing _.isError test in phantomjs. 2016-02-13 02:18:37 -08:00
John-David Dalton
4a390bca1c Update tests for es6. 2016-02-13 02:18:15 -08:00
John-David Dalton
af46ead30d Fix caller access in strict mode es6 modules. 2016-02-13 02:01:46 -08:00
John-David Dalton
de0f936e92 Ensure fp convert works with category modules. 2016-02-13 01:23:07 -08:00
John-David Dalton
bf9dcfe89c Add jsdoc constructor tags. [ci skip] 2016-02-12 22:51:26 -08:00
John-David Dalton
df0ecd2a93 Ensure _.isError works with subclasses values. [closes #1994] 2016-02-12 22:51:26 -08:00
John-David Dalton
b3ebb3c3d3 Add _.fromPairs to mention to _.toPairs and _.toPairsIn. [ci skip] 2016-02-12 22:51:26 -08:00
Jeroen Engels
0bead0c69a Update closed issue link in contributing.md to link to enhancement issues. [ci skip] 2016-02-12 22:51:26 -08:00
John-David Dalton
a055b0a04f Fix fp rearg order for zipWith. 2016-02-12 22:51:26 -08:00
John-David Dalton
d6f6007692 Add wiki link to "Further Reading" section of readme. [ci skip] 2016-02-12 22:51:26 -08:00
John-David Dalton
8ee7ffb2ab Add more currying to fp tests. 2016-02-12 22:51:26 -08:00
John-David Dalton
40ff04911e Remove unneeded copyArray from baseMergeDeep. 2016-02-12 22:51:25 -08:00
John-David Dalton
a3676618af Reorg templates. 2016-02-12 22:51:19 -08:00
John-David Dalton
b1ed66c6f5 Add another fp.inRange test. 2016-02-11 22:57:25 -08:00
John-David Dalton
53b3f81abe Ensure _.merge deep clones array/typed-array/plain-object sources. [closes #1987] 2016-02-11 22:56:33 -08:00
John-David Dalton
bd2428dde5 Remove fp doc to be simplified in a later commit. 2016-02-11 21:02:44 -08:00
Jeroen Engels
b7ae5f0885 Add paragraph about making feature requests in docs [ci skip] 2016-02-11 19:57:04 -08:00
John-David Dalton
8c5b64c7d7 Have browser fp convert auto wrap lodash if found. 2016-02-11 15:49:32 -08:00
John-David Dalton
641112dd4d Attempt two to fix bizarro buffer test in Node v0.12. 2016-02-11 10:55:26 -08:00
John-David Dalton
1c47acd040 Ensure maxWait isn't processed on a leading invocation ifleading is false and there isn't an max delay queued. [closes #1964] 2016-02-11 00:18:08 -08:00
greenkeeperio-bot
d58d6f45cc Update glob to 7.0.0. 2016-02-11 00:18:07 -08:00
Artur Baybulatov
7efa921bab Add a note about browser usage of lodash-fp. [ci skip] 2016-02-10 10:54:40 -08:00
John-David Dalton
feafdb3c6a Fix jsdoc type tags. [closes #1976] [ci skip] 2016-02-10 08:26:43 -08:00
John-David Dalton
784ee6a086 Remove fp iterateeRearg mapping. [closes #1971] 2016-02-10 08:19:59 -08:00
John-David Dalton
3014f20b6c Remove copyArray dep from _.flattenDepth. 2016-02-10 00:43:03 -08:00
John-David Dalton
40bb035b09 Minor label cleanup. 2016-02-10 00:15:08 -08:00
John-David Dalton
ba32bf3b8d Cleanup flatten methods and add more flattenDepth tests. 2016-02-10 00:14:10 -08:00
John-David Dalton
e9edc06aaf Enable convert to work when given lodash and options. 2016-02-09 21:56:49 -08:00
Jordan Eldredge
c91196d240 Run style checks before publishing. 2016-02-09 19:39:32 -08:00
Jeroen Engels
08c7bf3c85 Fix code style error and doc nit. [ci skip] 2016-02-09 19:39:32 -08:00
Michael Morgan
046470a8db Added _.flattenDepth for variable-depth flatten. 2016-02-09 19:39:32 -08:00
Billy Janitsch
2b1eedb036 Fix FP rearg for _.zipWith and _.inRange. 2016-02-09 19:39:31 -08:00
Jeroen Engels
02bea6534c fp docs - Remove notes about mutation in description. 2016-02-09 19:36:37 -08:00
Jeroen Engels
6f4099c20b fp docs - Split lib/doc/apply-fp-mapping into multiples files. 2016-02-09 19:36:37 -08:00
Jeroen Engels
39735df82f fp docs - Inject default values and cap args. 2016-02-09 19:36:37 -08:00
Jeroen Engels
5062f22839 fp docs - Remove console.log() from examples. 2016-02-09 19:36:36 -08:00
Jeroen Engels
e397707dc9 fp docs - translate ...args to args[] in example and params. 2016-02-09 19:36:36 -08:00
Jeroen Engels
66d6e226a9 Add scripts to generate the docs for lodash/fp. 2016-02-09 19:36:36 -08:00
Benjamin Tan
fbfa578c11 Write fp docs to a different file. 2016-02-09 19:36:36 -08:00
John-David Dalton
5cd7208ef3 Fix test fail in phantomjs. 2016-02-09 17:11:02 -08:00
John-David Dalton
e5bc6a0315 Fix bizarro buffer test in Node v0.12. 2016-02-09 17:11:02 -08:00
John-David Dalton
495c890aac Add bizarro test for _.isBuffer. 2016-02-09 17:11:02 -08:00
John-David Dalton
5fe4a1b05d Add fp placeholder test for converted partial. 2016-02-09 17:11:02 -08:00
John-David Dalton
d8bf62995b Ensure fp options works when applied individually. 2016-02-09 17:11:02 -08:00
John-David Dalton
e36f7e7161 Enable testing fp/convert in the browser. 2016-02-09 17:11:02 -08:00
John-David Dalton
285b667c3e Update "Why Lodash" section of readme. [ci skip] 2016-02-09 17:11:02 -08:00
John-David Dalton
aefbdbb6d5 Increment package version to enable ci tests. 2016-02-08 00:31:19 -08:00
John-David Dalton
8debfc6e6c Bump to v4.3.0. 2016-02-08 00:31:19 -08:00
John-David Dalton
c9ca772a32 Rebuild lodash and docs. 2016-02-08 00:31:19 -08:00
John-David Dalton
dc65792776 Add fp tests for add, subtract, gt, gte, lt, & lte. 2016-02-08 00:31:19 -08:00
John-David Dalton
18ae1d7c18 Ensure _.add and _.subtract return 0 when no arguments are given. 2016-02-08 00:31:19 -08:00
John-David Dalton
d790a1b3c6 Adjust "provided"/"given" use. [ci skip] 2016-02-08 00:31:18 -08:00
John-David Dalton
349c627110 Add options to baseConvert. 2016-02-08 00:31:13 -08:00
John-David Dalton
db23fcfe9f Rename num params to n. 2016-02-07 22:47:15 -08:00
John-David Dalton
d5a6a75639 Clarify pull request notes in contributing.md. [ci skip] 2016-02-07 22:47:15 -08:00
Robert T. Stewart
404a7181a8 Add 'What is Lodash' section to README.md. [ci skip] 2016-02-07 22:47:15 -08:00
Corbacho
e392b8e240 Improve accuracy of _.throttle. 2016-02-07 22:47:14 -08:00
John-David Dalton
6752d75ad0 Add _.isMap, _.isSet, _.isWeakMap, & _.isWeakSet. 2016-02-07 22:47:14 -08:00
John-David Dalton
e00d9821a8 Add gt, gte, lt, lte to fp skipRearg mapping. 2016-02-07 22:47:14 -08:00
John-David Dalton
1cf7093f46 Allow undefined realm values. 2016-02-07 22:47:14 -08:00
John-David Dalton
88708ec00f Minor test order nit. 2016-02-07 22:47:14 -08:00
John-David Dalton
984b0af883 Add deep clone test for buffers. 2016-02-07 22:47:14 -08:00
John-David Dalton
8810754ada Add _.isArrayBuffer test. 2016-02-07 22:47:14 -08:00
John-David Dalton
0d340b378b Add _.isBuffer test. 2016-02-07 22:47:14 -08:00
John-David Dalton
e30dc968ef Move _.isNull test. 2016-02-07 22:47:13 -08:00
John-David Dalton
ea942b0642 Upgrade sauce tested versions of Chrome and Firefox. 2016-02-07 22:47:13 -08:00
Tyler Garrett
7e9d49b300 Fix DevDoc link in readme. [ci skip] 2016-02-07 22:47:13 -08:00
John-David Dalton
ce60ac4274 Add isDeep flag to cloneBuffer. 2016-02-07 22:47:13 -08:00
John-David Dalton
a04fc310b4 Fix buffer test fails. 2016-02-07 22:47:13 -08:00
John-David Dalton
4a805ea666 Add _.isArrayBuffer and _.isBuffer. 2016-02-07 22:47:13 -08:00
John-David Dalton
1595651780 Add support for cloning buffers. [closes #1940] 2016-02-07 22:47:13 -08:00
John-David Dalton
fc85cac91d Update sauce-tunnel and webpack deps. 2016-02-07 22:47:13 -08:00
John-David Dalton
73134f9dcc Update the readme. 2016-02-07 22:47:13 -08:00
John-David Dalton
eb72bbe6f7 Update license to github formatting. 2016-02-07 22:47:12 -08:00
John-David Dalton
a5ae078f8f Increment package version to enable ci tests. 2016-02-05 00:24:51 -08:00
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
John-David Dalton
dfbd78f71d Bump to v3.10.1. 2015-07-20 11:25:53 -07:00
John-David Dalton
e132e878d6 Rebuild lodash and docs. 2015-07-20 11:25:39 -07:00
John-David Dalton
bb78c0ea6d Provide correct argsCount hint to customizer functions of clone methods. 2015-07-20 11:23:13 -07:00
Thomas Wienecke
1a772023d5 Documentation (includes): value -> target. [ci skip] 2015-07-20 11:23:13 -07:00
John-David Dalton
230f90173c Use strict equality checks for baseIndexOf comparisons. 2015-07-20 11:23:12 -07:00
jdalton
fbc7c28188 Cleanup Safari 8 bug note in isFunction. [ci skip] 2015-07-20 11:23:12 -07:00
jdalton
5d88cb7099 Code formatting nit for coercing to strings. 2015-07-20 11:23:12 -07:00
jdalton
caae7a5879 Ensure getFuncName returns a string. 2015-07-20 11:23:12 -07:00
jdalton
816f37bdc5 Move getData function guard to `isLaziable. 2015-07-20 11:23:12 -07:00
Graeme Yeates
a2dd7171a5 Let mozilla manage their i18n. [ci skip] 2015-07-20 11:23:12 -07:00
John-David Dalton
a80d0bc2ca Ensure _#reverse doesn't augment the original array if it was sliced before. [closes #1323] 2015-07-20 11:23:12 -07:00
jdalton
2e50d11be5 Ensure func is a function before querying the weakmap. [closes #1319] 2015-07-20 11:23:12 -07:00
jdalton
a5e2caf40b Add small array lazy chain tests for _.first and _.last. 2015-07-20 11:23:11 -07:00
jdalton
82f693a2bc Replace it is in docs with the contraction it's. [ci skip] 2015-07-20 11:23:11 -07:00
jdalton
349baa3550 Bump to v3.10.0. 2015-07-20 11:23:11 -07:00
jdalton
712761ab0a Rebuild lodash and docs. 2015-07-20 11:23:02 -07:00
91 changed files with 79411 additions and 39968 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

78
.github/CONTRIBUTING.md vendored Normal file
View File

@@ -0,0 +1,78 @@
# Contributing to Lodash
Contributions are always welcome. Before contributing please read the
[code of conduct](https://js.foundation/community/code-of-conduct) &
[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/).
## Feature Requests
Feature requests should be submitted in the
[issue tracker](https://github.com/lodash/lodash/issues), with a description of
the expected behavior & use case, where theyll remain closed until sufficient interest,
[e.g. :+1: reactions](https://help.github.com/articles/about-discussions-in-issues-and-pull-requests/),
has been [shown by the community](https://github.com/lodash/lodash/issues?q=label%3A%22votes+needed%22+sort%3Areactions-%2B1-desc).
Before submitting a request, please search for similar ones in the
[closed issues](https://github.com/lodash/lodash/issues?q=is%3Aissue+is%3Aclosed+label%3Aenhancement).
## Pull Requests
For additions or bug fixes you should only need to modify `lodash.js`. Include
updated unit tests in the `test` directory as part of your pull request. 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 `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
Lodash is a member of the [Open JS Foundation](https://openjsf.org/).
As such, we request that all contributors sign our
[contributor license agreement (CLA)](https://js.foundation/CLA/).
For more information about CLAs, please check out Alex Russells excellent post,
[“Why Do I Need to Sign This?”](https://infrequently.org/2008/06/why-do-i-need-to-sign-this/).
## Coding Guidelines
In addition to the following guidelines, please follow the conventions already
established in the code.
- **Spacing**:<br>
Use two spaces for indentation. No tabs.
- **Naming**:<br>
Keep variable & method names concise & descriptive.<br>
Variable names `index`, `array`, & `iteratee` are preferable to
`i`, `arr`, & `fn`.
- **Quotes**:<br>
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
functions.
Guidelines are enforced using [JSCS](https://www.npmjs.com/package/jscs):
```bash
$ npm run style
```
## Tips
You can opt-in to a pre-push git hook by adding an `.opt-in` file to the root of
the project containing:
```txt
pre-push
```
With that, when you `git push`, the pre-push git hook will trigger and execute
`npm run validate`.

4
.gitignore vendored
View File

@@ -1,6 +1,4 @@
.DS_Store
*.custom.*
*.log
*.map
lodash.compat.min.js
doc/*.html
node_modules

97
.jscsrc Normal file
View File

@@ -0,0 +1,97 @@
{
"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,
"disallowUnusedVariables": true,
"jsDoc": {
"checkRedundantAccess": true,
"checkTypes": true,
"requireNewlineAfterDescription": true,
"requireParamDescription": true,
"requireParamTypes": true,
"requireReturnTypes": true
}
}

View File

@@ -0,0 +1,11 @@
'use strict';
delete global['__core-js_shared__'];
const _ = require('./lodash.js');
const globals = require('lodash-doc-globals');
module.exports = {
'babel': false,
'globals': _.assign({ '_': _ }, globals)
};

View File

@@ -1,76 +1,135 @@
language: node_js
sudo: false
node_js:
- "0.12"
- 7
addons:
jwt:
secure: OYhRpW+8A0Iik+9GmHwa45ZwXeBXw/6zh6I+1w2H9g/LqPRp+Nhq3f4FSpvrrfno8lO8W4h+7s6+JOzF8C8NxNda5UUygKjF9pUphgiQdqls3YZMJlC9zXVl7gQXAHi3nG1s8vWSpwpzYD9fqczE1FX9n0+R63qX3eB6C/LbPeI=
cache:
directories:
- ~/.npm
- ~/.yarn-cache
- travis_phantomjs
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"
- secure: "tg1JFsIFnxzLaTboFPOnm+aJCuMm5+JdhLlESlqg9x3fwro++7KCnwHKLNovhchaPe4otC43ZMB/nfWhDnDm11dKbm/V6HlTkED+dadTsaLxVDg6J+7yK41QhokBPJOxLV78iDaNaAQVYEirAgZ0yn8kFubxmNKV+bpCGQNc9yU="
- BIN=node ISTANBUL=false OPTION=""
- SAUCE_LABS=false SAUCE_USERNAME=lodash
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"
-
- BIN=phantomjs
- ISTANBUL=true
- SAUCE_LABS=true
matrix:
include:
- node_js: "iojs"
- node_js: 6
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"
git:
depth: 10
branches:
only:
- master
- 4.17
notifications:
webhooks:
urls:
- https://webhooks.gitter.im/e/4aab6358b0e9aed0b628
on_success: change
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"
# Upgrade PhantomJS.
- |
export PHANTOMJS_VERSION=2.1.1
export PATH=$PWD/travis_phantomjs/phantomjs-$PHANTOMJS_VERSION-linux-x86_64/bin:$PATH
if [ $(phantomjs --version) != $PHANTOMJS_VERSION ]; then
rm -rf $PWD/travis_phantomjs
mkdir -p $PWD/travis_phantomjs
wget https://github.com/Medium/phantomjs/releases/download/v$PHANTOMJS_VERSION/phantomjs-$PHANTOMJS_VERSION-linux-x86_64.tar.bz2
tar -xvf phantomjs-$PHANTOMJS_VERSION-linux-x86_64.tar.bz2 -C $PWD/travis_phantomjs
fi
phantomjs -v
# Use exact Node version.
- nvm use $TRAVIS_NODE_VERSION
# Setup package managers.
- npm set loglevel error
- npm set progress false
- npm i -g yarn@0.16.1
- yarn -V
# Remove code skipped on the coverage run.
- |
PATTERN[0]="|\s*while\s*\([^)]+\)\s*\{\s*iteratee\(index\);\s*\}|"
PATTERN[1]="|\bindex,\s*iterable\)\s*===\s*false\)[^}]+?(break;)|"
PATTERN[2]="|\bcase\s+(?:dataView|promise|set|map|weakMap)CtorString:.+|g"
PATTERN[3]="|\s*if\s*\(cache\.size\b[\s\S]+?\}|"
PATTERN[4]="|\s*if\s*\(\!lodashFunc\)\s*\{\s*return;\s*\}|"
PATTERN[5]="|\s*define\([\s\S]+?\);|"
PATTERN[6]="|\s*root\._\s*=\s*_;|"
if [ $ISTANBUL = true ]; then
set -e
for PTRN in ${PATTERN[@]}; do
node ./test/remove.js $PTRN ./lodash.js
done
fi
install:
# Install packages.
- yarn
# Use lodash-cli from GitHub. Temporarily use a fork.
- git clone --depth=10 --branch=master git://github.com/bnjmnt4n/lodash-cli ./node_modules/lodash-cli
- cd ./node_modules/lodash-cli/; npm i --production; cd ../../
- mkdir -p ./node_modules/lodash-cli/node_modules/lodash; cd $_; cp ../../../../lodash.js ./lodash.js; cp ../../../../package.json ./package.json; cd ../../../../
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 ] || [ $TRAVIS_SECURE_ENV_VARS == false ] || (cat ./coverage/lcov.info | coveralls) || 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\""
# Detect code coverage.
- |
if [ $ISTANBUL = true ]; then
istanbul cover -x "**/vendor/**" --report lcovonly ./test/test.js -- ./lodash.js
if [ $TRAVIS_SECURE_ENV_VARS = true ]; then
cat ./coverage/lcov.info | coveralls
cat ./coverage/coverage.json | codecov
fi
fi
# Test in Node.js and PhantomJS.
- |
if [ $ISTANBUL = false ]; then
node ./node_modules/lodash-cli/bin/lodash -o ./dist/lodash.js
node ./node_modules/lodash-cli/bin/lodash modularize exports=node -o ./
node ./node_modules/lodash-cli/bin/lodash -d -o ./lodash.js
if [ $SAUCE_LABS = false ]; then
cd ./test
$BIN $OPTION ./test.js ../lodash.js
if [ $TRAVIS_SECURE_ENV_VARS = true ]; then
$BIN $OPTION ./test.js ../dist/lodash.min.js
fi
fi
fi
# Test in Sauce Labs.
- |
if [ $SAUCE_LABS = true ]; then
node ./node_modules/lodash-cli/bin/lodash core -o ./dist/lodash.core.js
npm run build
$BIN ./test/saucelabs.js name="lodash tests" runner="test/index.html?build=../dist/lodash.js&noglobals=true" tags=development
$BIN ./test/saucelabs.js name="lodash tests" runner="test/index.html?build=../dist/lodash.min.js&noglobals=true" tags=production
$BIN ./test/saucelabs.js name="lodash-fp tests" runner="test/fp.html?noglobals=true" tags=development
$BIN ./test/saucelabs.js name="underscore tests" runner="test/underscore.html?build=../dist/lodash.js" tags=development,underscore
$BIN ./test/saucelabs.js name="underscore tests" runner="test/underscore.html?build=../dist/lodash.min.js" tags=production,underscore
$BIN ./test/saucelabs.js name="backbone tests" runner="test/backbone.html?build=../dist/lodash.js" tags=development,backbone
$BIN ./test/saucelabs.js name="backbone tests" runner="test/backbone.html?build=../dist/lodash.min.js" tags=production,backbone
$BIN ./test/saucelabs.js name="backbone tests" runner="test/backbone.html?build=../dist/lodash.core.js" tags=development,backbone
$BIN ./test/saucelabs.js name="backbone tests" runner="test/backbone.html?build=../dist/lodash.core.min.js" tags=production,backbone
fi

1
CHANGELOG Normal file
View File

@@ -0,0 +1 @@
https://github.com/lodash/lodash/wiki/Changelog

View File

@@ -1,39 +0,0 @@
# 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`.
## 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.
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.
The [Backbone](http://backbonejs.org/) & [Underscore](http://underscorejs.org/) test suites are included as well.
## Contributor License Agreement
lodash is a member of the [Dojo Foundation](http://dojofoundation.org/).
As such, we request that all contributors sign the Dojo Foundation [contributor license agreement](http://dojofoundation.org/about/claForm).
For more information about CLAs, please check out Alex Russells excellent post, [“Why Do I Need to Sign This?”](http://infrequently.org/2008/06/why-do-i-need-to-sign-this/).
## Coding Guidelines
In addition to the following guidelines, please follow the conventions already established in the code.
- **Spacing**:<br>
Use two spaces for indentation. No tabs.
- **Naming**:<br>
Keep variable & method names concise & descriptive.<br>
Variable names `index`, `collection`, & `callback` are preferable to `i`, `arr`, & `fn`.
- **Quotes**:<br>
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.

29
LICENSE
View File

@@ -1,7 +1,17 @@
Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
Based on Underscore.js, copyright 2009-2015 Jeremy Ashkenas,
Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
Based on Underscore.js, copyright Jeremy Ashkenas,
DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
This software consists of voluntary contributions made by many
individuals. For exact contribution history, see the revision history
available at https://github.com/lodash/lodash
The following license applies to all parts of this software except as
documented below:
====
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
@@ -20,3 +30,18 @@ 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.
====
Copyright and related rights for sample code are waived via CC0. Sample
code is defined as all source code displayed within the prose of the
documentation.
CC0: http://creativecommons.org/publicdomain/zero/1.0/
====
Files located in the node_modules and vendor directories are externally
maintained libraries used by this software which have their own
licenses; we recommend you read them, as their terms may differ from the
terms above.

View File

@@ -1,29 +1,80 @@
# lodash v3.9.3
# lodash v4.17.21
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/).
[Site](https://lodash.com/) |
[Docs](https://lodash.com/docs) |
[FP Guide](https://github.com/lodash/lodash/wiki/FP-Guide) |
[Contributing](https://github.com/lodash/lodash/blob/master/.github/CONTRIBUTING.md) |
[Wiki](https://github.com/lodash/lodash/wiki "Changelog, Roadmap, etc.") |
[Code of Conduct](https://js.foundation/conduct/) |
[Twitter](https://twitter.com/bestiejs) |
[Chat](https://gitter.im/lodash/lodash)
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
```shell
$ npm run build
$ lodash -o ./dist/lodash.js
$ lodash core -o ./dist/lodash.core.js
```
## Community
## Download
[![Join the chat at https://gitter.im/lodash/lodash](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/lodash/lodash)
* [Core build](https://raw.githubusercontent.com/lodash/lodash/4.17.21/dist/lodash.core.js) ([~4 kB gzipped](https://raw.githubusercontent.com/lodash/lodash/4.17.21/dist/lodash.core.min.js))
* [Full build](https://raw.githubusercontent.com/lodash/lodash/4.17.21/dist/lodash.js) ([~24 kB gzipped](https://raw.githubusercontent.com/lodash/lodash/4.17.21/dist/lodash.min.js))
* [CDN copies](https://www.jsdelivr.com/projects/lodash)
## Module formats
Lodash is released under the [MIT license](https://raw.githubusercontent.com/lodash/lodash/4.17.21/LICENSE) & supports modern environments.<br>
Review the [build differences](https://github.com/lodash/lodash/wiki/build-differences) & pick one thats right for you.
lodash is also available in a variety of other builds & module formats.
## Installation
* 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.9.3-amd) & [compatibility](https://github.com/lodash/lodash-compat/tree/3.9.3-amd) builds
* ES modules for the [modern](https://github.com/lodash/lodash/tree/3.9.3-es) build
In a browser:
```html
<script src="lodash.js"></script>
```
## Further Reading
Using npm:
```shell
$ npm i -g npm
$ npm i --save lodash
```
* [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)
In Node.js:
```js
// Load the full build.
var _ = require('lodash');
// Load the core build.
var _ = require('lodash/core');
// Load the FP build for immutable auto-curried iteratee-first data-last methods.
var fp = require('lodash/fp');
// Load method categories.
var array = require('lodash/array');
var object = require('lodash/fp/object');
// Cherry-pick methods for smaller browserify/rollup/webpack bundles.
var at = require('lodash/at');
var curryN = require('lodash/fp/curryN');
```
**Note:**<br>
Install [n_](https://www.npmjs.com/package/n_) for Lodash use in the Node.js < 6 REPL.
## Why Lodash?
Lodash makes JavaScript easier by taking the hassle out of working with arrays,<br>
numbers, objects, strings, etc. Lodashs modular methods are great for:
* Iterating arrays, objects, & strings
* Manipulating & testing values
* Creating composite functions
## Module Formats
Lodash is available in a [variety of builds](https://lodash.com/custom-builds) & module formats.
* [lodash](https://www.npmjs.com/package/lodash) & [per method packages](https://www.npmjs.com/browse/keyword/lodash-modularized)
* [lodash-es](https://www.npmjs.com/package/lodash-es), [babel-plugin-lodash](https://www.npmjs.com/package/babel-plugin-lodash), & [lodash-webpack-plugin](https://www.npmjs.com/package/lodash-webpack-plugin)
* [lodash/fp](https://github.com/lodash/lodash/tree/npm/fp)
* [lodash-amd](https://www.npmjs.com/package/lodash-amd)

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.9.3",
"description": "The modern build of lodash.",
"license": "MIT",
"main": "lodash.js",
"keywords": ["stdlib", "util"],
"scripts": ["lodash.js"]
}

3877
dist/lodash.core.js vendored Normal file

File diff suppressed because it is too large Load Diff

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

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

1031
dist/lodash.fp.js vendored Normal file

File diff suppressed because it is too large Load Diff

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

@@ -0,0 +1,21 @@
(function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.fp=e():t.fp=e()})(this,function(){return function(t){function e(n){if(r[n])return r[n].exports;var i=r[n]={exports:{},id:n,loaded:!1};return t[n].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){function n(t,e){return i(t,t,e)}var i=r(1);"function"==typeof _&&"function"==typeof _.runInContext&&(_=n(_.runInContext())),
t.exports=n},function(t,e,r){function n(t,e){return 2==e?function(e,r){return t.apply(void 0,arguments)}:function(e){return t.apply(void 0,arguments)}}function i(t,e){return 2==e?function(e,r){return t(e,r)}:function(e){return t(e)}}function a(t){for(var e=t?t.length:0,r=Array(e);e--;)r[e]=t[e];return r}function o(t){return function(e){return t({},e)}}function s(t,e){return function(){for(var r=arguments.length,n=r-1,i=Array(r);r--;)i[r]=arguments[r];var a=i[e],o=i.slice(0,e);return a&&d.apply(o,a),
e!=n&&d.apply(o,i.slice(e+1)),t.apply(this,o)}}function l(t,e){return function(){var r=arguments.length;if(r){for(var n=Array(r);r--;)n[r]=arguments[r];var i=n[0]=e.apply(void 0,n);return t.apply(void 0,n),i}}}function u(t,e,r,d){function c(t,e){if(b.cap){var r=p.iterateeRearg[t];if(r)return x(e,r);var n=!O&&p.iterateeAry[t];if(n)return W(e,n)}return e}function h(t,e,r){return E||b.curry&&r>1?D(e,r):e}function g(t,e,r){if(b.fixed&&(F||!p.skipFixed[t])){var n=p.methodSpread[t],i=n&&n.start;return void 0===i?L(e,r):s(e,i);
}return e}function y(t,e,r){return b.rearg&&r>1&&(M||!p.skipRearg[t])?N(e,p.methodRearg[t]||p.aryRearg[r]):e}function m(t,e){e=U(e);for(var r=-1,n=e.length,i=n-1,a=w(Object(t)),o=a;null!=o&&++r<n;){var s=e[r],l=o[s];null==l||T(l)||P(l)||K(l)||(o[s]=w(r==i?l:Object(l))),o=o[s]}return a}function v(t){return J.runInContext.convert(t)(void 0)}function A(t,e){var r=p.aliasToReal[t]||t,n=p.remap[r]||r,i=d;return function(t){return u(O?j:C,r,O?j[n]:e,S(S({},i),t))}}function W(t,e){return I(t,function(t){
return"function"==typeof t?i(t,e):t})}function x(t,e){return I(t,function(t){var r=e.length;return n(N(i(t,r),e),r)})}function I(t,e){return function(){var r=arguments.length;if(!r)return t();for(var n=Array(r);r--;)n[r]=arguments[r];var i=b.rearg?0:r-1;return n[i]=e(n[i]),t.apply(void 0,n)}}function R(t,e,r){var n,i=p.aliasToReal[t]||t,s=e,u=H[i];return u?s=u(e):b.immutable&&(p.mutate.array[i]?s=l(e,a):p.mutate.object[i]?s=l(e,o(e)):p.mutate.set[i]&&(s=l(e,m))),z(G,function(t){return z(p.aryMethod[t],function(e){
if(i==e){var r=p.methodSpread[i];return n=r&&r.afterRearg?g(i,y(i,s,t),t):y(i,g(i,s,t),t),n=c(i,n),n=h(i,n,t),!1}}),!n}),n||(n=s),n==e&&(n=E?D(n,1):function(){return e.apply(this,arguments)}),n.convert=A(i,e),n.placeholder=e.placeholder=r,n}var O="function"==typeof e,k=e===Object(e);if(k&&(d=r,r=e,e=void 0),null==r)throw new TypeError;d||(d={});var b={cap:!("cap"in d)||d.cap,curry:!("curry"in d)||d.curry,fixed:!("fixed"in d)||d.fixed,immutable:!("immutable"in d)||d.immutable,rearg:!("rearg"in d)||d.rearg
},B=O?r:f,E="curry"in d&&d.curry,F="fixed"in d&&d.fixed,M="rearg"in d&&d.rearg,j=O?r.runInContext():void 0,C=O?r:{ary:t.ary,assign:t.assign,clone:t.clone,curry:t.curry,forEach:t.forEach,isArray:t.isArray,isError:t.isError,isFunction:t.isFunction,isWeakMap:t.isWeakMap,iteratee:t.iteratee,keys:t.keys,rearg:t.rearg,toInteger:t.toInteger,toPath:t.toPath},L=C.ary,S=C.assign,w=C.clone,D=C.curry,z=C.forEach,q=C.isArray,P=C.isError,T=C.isFunction,K=C.isWeakMap,_=C.keys,N=C.rearg,V=C.toInteger,U=C.toPath,G=_(p.aryMethod),H={
castArray:function(t){return function(){var e=arguments[0];return q(e)?t(a(e)):t.apply(void 0,arguments)}},iteratee:function(t){return function(){var e=arguments[0],r=arguments[1],n=t(e,r),a=n.length;return b.cap&&"number"==typeof r?(r=r>2?r-2:1,a&&a<=r?n:i(n,r)):n}},mixin:function(t){return function(e){var r=this;if(!T(r))return t(r,Object(e));var n=[];return z(_(e),function(t){T(e[t])&&n.push([t,r.prototype[t]])}),t(r,Object(e)),z(n,function(t){var e=t[1];T(e)?r.prototype[t[0]]=e:delete r.prototype[t[0]];
}),r}},nthArg:function(t){return function(e){var r=e<0?1:V(e)+1;return D(t(e),r)}},rearg:function(t){return function(e,r){var n=r?r.length:0;return D(t(e,r),n)}},runInContext:function(e){return function(r){return u(t,e(r),d)}}};if(!k)return R(e,r,B);var J=r,Q=[];return z(G,function(t){z(p.aryMethod[t],function(t){var e=J[p.remap[t]||t];e&&Q.push([t,R(t,e,J)])})}),z(_(J),function(t){var e=J[t];if("function"==typeof e){for(var r=Q.length;r--;)if(Q[r][0]==t)return;e.convert=A(t,e),Q.push([t,e])}}),z(Q,function(t){
J[t[0]]=t[1]}),J.convert=v,J.placeholder=J,z(_(J),function(t){z(p.realToAlias[t]||[],function(e){J[e]=J[t]})}),J}var p=r(2),f=r(3),d=Array.prototype.push;t.exports=u},function(t,e){e.aliasToReal={each:"forEach",eachRight:"forEachRight",entries:"toPairs",entriesIn:"toPairsIn",extend:"assignIn",extendAll:"assignInAll",extendAllWith:"assignInAllWith",extendWith:"assignInWith",first:"head",conforms:"conformsTo",matches:"isMatch",property:"get",__:"placeholder",F:"stubFalse",T:"stubTrue",all:"every",allPass:"overEvery",
always:"constant",any:"some",anyPass:"overSome",apply:"spread",assoc:"set",assocPath:"set",complement:"negate",compose:"flowRight",contains:"includes",dissoc:"unset",dissocPath:"unset",dropLast:"dropRight",dropLastWhile:"dropRightWhile",equals:"isEqual",identical:"eq",indexBy:"keyBy",init:"initial",invertObj:"invert",juxt:"over",omitAll:"omit",nAry:"ary",path:"get",pathEq:"matchesProperty",pathOr:"getOr",paths:"at",pickAll:"pick",pipe:"flow",pluck:"map",prop:"get",propEq:"matchesProperty",propOr:"getOr",
props:"at",symmetricDifference:"xor",symmetricDifferenceBy:"xorBy",symmetricDifferenceWith:"xorWith",takeLast:"takeRight",takeLastWhile:"takeRightWhile",unapply:"rest",unnest:"flatten",useWith:"overArgs",where:"conformsTo",whereEq:"isMatch",zipObj:"zipObject"},e.aryMethod={1:["assignAll","assignInAll","attempt","castArray","ceil","create","curry","curryRight","defaultsAll","defaultsDeepAll","floor","flow","flowRight","fromPairs","invert","iteratee","memoize","method","mergeAll","methodOf","mixin","nthArg","over","overEvery","overSome","rest","reverse","round","runInContext","spread","template","trim","trimEnd","trimStart","uniqueId","words","zipAll"],
2:["add","after","ary","assign","assignAllWith","assignIn","assignInAllWith","at","before","bind","bindAll","bindKey","chunk","cloneDeepWith","cloneWith","concat","conformsTo","countBy","curryN","curryRightN","debounce","defaults","defaultsDeep","defaultTo","delay","difference","divide","drop","dropRight","dropRightWhile","dropWhile","endsWith","eq","every","filter","find","findIndex","findKey","findLast","findLastIndex","findLastKey","flatMap","flatMapDeep","flattenDepth","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","meanBy","merge","mergeAllWith","minBy","multiply","nth","omit","omitBy","overArgs","pad","padEnd","padStart","parseInt","partial","partialRight","partition","pick","pickBy","propertyOf","pull","pullAll","pullAt","random","range","rangeRight","rearg","reject","remove","repeat","restFrom","result","sampleSize","some","sortBy","sortedIndex","sortedIndexOf","sortedLastIndex","sortedLastIndexOf","sortedUniqBy","split","spreadFrom","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","findFrom","findIndexFrom","findLastFrom","findLastIndexFrom","getOr","includesFrom","indexOfFrom","inRange","intersectionBy","intersectionWith","invokeArgs","invokeArgsMap","isEqualWith","isMatchWith","flatMapDepth","lastIndexOfFrom","mergeWith","orderBy","padChars","padCharsEnd","padCharsStart","pullAllBy","pullAllWith","rangeStep","rangeStepRight","reduce","reduceRight","replace","set","slice","sortedIndexBy","sortedLastIndexBy","transform","unionBy","unionWith","update","xorBy","xorWith","zipWith"],
4:["fill","setWith","updateWith"]},e.aryRearg={2:[1,0],3:[2,0,1],4:[3,2,0,1]},e.iterateeAry={dropRightWhile:1,dropWhile:1,every:1,filter:1,find:1,findFrom:1,findIndex:1,findIndexFrom:1,findKey:1,findLast:1,findLastFrom:1,findLastIndex:1,findLastIndexFrom:1,findLastKey:1,flatMap:1,flatMapDeep:1,flatMapDepth:1,forEach:1,forEachRight:1,forIn:1,forInRight:1,forOwn:1,forOwnRight:1,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},e.iterateeRearg={mapKeys:[1],reduceRight:[1,0]},e.methodRearg={assignInAllWith:[1,0],assignInWith:[1,2,0],assignAllWith:[1,0],assignWith:[1,2,0],differenceBy:[1,2,0],differenceWith:[1,2,0],getOr:[2,1,0],intersectionBy:[1,2,0],intersectionWith:[1,2,0],isEqualWith:[1,2,0],isMatchWith:[2,1,0],mergeAllWith:[1,0],mergeWith:[1,2,0],padChars:[2,1,0],padCharsEnd:[2,1,0],padCharsStart:[2,1,0],pullAllBy:[2,1,0],pullAllWith:[2,1,0],rangeStep:[1,2,0],rangeStepRight:[1,2,0],setWith:[3,1,2,0],sortedIndexBy:[2,1,0],
sortedLastIndexBy:[2,1,0],unionBy:[1,2,0],unionWith:[1,2,0],updateWith:[3,1,2,0],xorBy:[1,2,0],xorWith:[1,2,0],zipWith:[1,2,0]},e.methodSpread={assignAll:{start:0},assignAllWith:{start:0},assignInAll:{start:0},assignInAllWith:{start:0},defaultsAll:{start:0},defaultsDeepAll:{start:0},invokeArgs:{start:2},invokeArgsMap:{start:2},mergeAll:{start:0},mergeAllWith:{start:0},partial:{start:1},partialRight:{start:1},without:{start:1},zipAll:{start:0}},e.mutate={array:{fill:!0,pull:!0,pullAll:!0,pullAllBy:!0,
pullAllWith:!0,pullAt:!0,remove:!0,reverse:!0},object:{assign:!0,assignAll:!0,assignAllWith:!0,assignIn:!0,assignInAll:!0,assignInAllWith:!0,assignInWith:!0,assignWith:!0,defaults:!0,defaultsAll:!0,defaultsDeep:!0,defaultsDeepAll:!0,merge:!0,mergeAll:!0,mergeAllWith:!0,mergeWith:!0},set:{set:!0,setWith:!0,unset:!0,update:!0,updateWith:!0}},e.realToAlias=function(){var t=Object.prototype.hasOwnProperty,r=e.aliasToReal,n={};for(var i in r){var a=r[i];t.call(n,a)?n[a].push(i):n[a]=[i]}return n}(),e.remap={
assignAll:"assign",assignAllWith:"assignWith",assignInAll:"assignIn",assignInAllWith:"assignInWith",curryN:"curry",curryRightN:"curryRight",defaultsAll:"defaults",defaultsDeepAll:"defaultsDeep",findFrom:"find",findIndexFrom:"findIndex",findLastFrom:"findLast",findLastIndexFrom:"findLastIndex",getOr:"get",includesFrom:"includes",indexOfFrom:"indexOf",invokeArgs:"invoke",invokeArgsMap:"invokeMap",lastIndexOfFrom:"lastIndexOf",mergeAll:"merge",mergeAllWith:"mergeWith",padChars:"pad",padCharsEnd:"padEnd",
padCharsStart:"padStart",propertyOf:"get",rangeStep:"range",rangeStepRight:"rangeRight",restFrom:"rest",spreadFrom:"spread",trimChars:"trim",trimCharsEnd:"trimEnd",trimCharsStart:"trimStart",zipAll:"zip"},e.skipFixed={castArray:!0,flow:!0,flowRight:!0,iteratee:!0,mixin:!0,rearg:!0,runInContext:!0},e.skipRearg={add:!0,assign:!0,assignIn:!0,bind:!0,bindKey:!0,concat:!0,difference:!0,divide:!0,eq:!0,gt:!0,gte:!0,isEqual:!0,lt:!0,lte:!0,matchesProperty:!0,merge:!0,multiply:!0,overArgs:!0,partial:!0,partialRight:!0,
propertyOf:!0,random:!0,range:!0,rangeRight:!0,subtract:!0,zip:!0,zipObject:!0,zipObjectDeep:!0}},function(t,e){t.exports={}}])});

17209
dist/lodash.js vendored Normal file

File diff suppressed because it is too large Load Diff

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

@@ -0,0 +1,140 @@
/**
* @license
* Lodash <https://lodash.com/>
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
* Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
*/
(function(){function n(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 t(n,t,r,e){for(var u=-1,i=null==n?0:n.length;++u<i;){var o=n[u];t(e,o,r(o),n)}return e}function r(n,t){for(var r=-1,e=null==n?0:n.length;++r<e&&t(n[r],r,n)!==!1;);return n}function e(n,t){for(var r=null==n?0:n.length;r--&&t(n[r],r,n)!==!1;);return n}function u(n,t){for(var r=-1,e=null==n?0:n.length;++r<e;)if(!t(n[r],r,n))return!1;
return!0}function i(n,t){for(var r=-1,e=null==n?0:n.length,u=0,i=[];++r<e;){var o=n[r];t(o,r,n)&&(i[u++]=o)}return i}function o(n,t){return!!(null==n?0:n.length)&&y(n,t,0)>-1}function f(n,t,r){for(var e=-1,u=null==n?0:n.length;++e<u;)if(r(t,n[e]))return!0;return!1}function c(n,t){for(var r=-1,e=null==n?0:n.length,u=Array(e);++r<e;)u[r]=t(n[r],r,n);return u}function a(n,t){for(var r=-1,e=t.length,u=n.length;++r<e;)n[u+r]=t[r];return n}function l(n,t,r,e){var u=-1,i=null==n?0:n.length;for(e&&i&&(r=n[++u]);++u<i;)r=t(r,n[u],u,n);
return r}function s(n,t,r,e){var u=null==n?0:n.length;for(e&&u&&(r=n[--u]);u--;)r=t(r,n[u],u,n);return r}function h(n,t){for(var r=-1,e=null==n?0:n.length;++r<e;)if(t(n[r],r,n))return!0;return!1}function p(n){return n.split("")}function _(n){return n.match($t)||[]}function v(n,t,r){var e;return r(n,function(n,r,u){if(t(n,r,u))return e=r,!1}),e}function g(n,t,r,e){for(var u=n.length,i=r+(e?1:-1);e?i--:++i<u;)if(t(n[i],i,n))return i;return-1}function y(n,t,r){return t===t?Z(n,t,r):g(n,b,r)}function d(n,t,r,e){
for(var u=r-1,i=n.length;++u<i;)if(e(n[u],t))return u;return-1}function b(n){return n!==n}function w(n,t){var r=null==n?0:n.length;return r?k(n,t)/r:Cn}function m(n){return function(t){return null==t?X:t[n]}}function x(n){return function(t){return null==n?X:n[t]}}function j(n,t,r,e,u){return u(n,function(n,u,i){r=e?(e=!1,n):t(r,n,u,i)}),r}function A(n,t){var r=n.length;for(n.sort(t);r--;)n[r]=n[r].value;return n}function k(n,t){for(var r,e=-1,u=n.length;++e<u;){var i=t(n[e]);i!==X&&(r=r===X?i:r+i);
}return r}function O(n,t){for(var r=-1,e=Array(n);++r<n;)e[r]=t(r);return e}function I(n,t){return c(t,function(t){return[t,n[t]]})}function R(n){return n?n.slice(0,H(n)+1).replace(Lt,""):n}function z(n){return function(t){return n(t)}}function E(n,t){return c(t,function(t){return n[t]})}function S(n,t){return n.has(t)}function W(n,t){for(var r=-1,e=n.length;++r<e&&y(t,n[r],0)>-1;);return r}function L(n,t){for(var r=n.length;r--&&y(t,n[r],0)>-1;);return r}function C(n,t){for(var r=n.length,e=0;r--;)n[r]===t&&++e;
return e}function U(n){return"\\"+Yr[n]}function B(n,t){return null==n?X:n[t]}function T(n){return Nr.test(n)}function $(n){return Pr.test(n)}function D(n){for(var t,r=[];!(t=n.next()).done;)r.push(t.value);return r}function M(n){var t=-1,r=Array(n.size);return n.forEach(function(n,e){r[++t]=[e,n]}),r}function F(n,t){return function(r){return n(t(r))}}function N(n,t){for(var r=-1,e=n.length,u=0,i=[];++r<e;){var o=n[r];o!==t&&o!==cn||(n[r]=cn,i[u++]=r)}return i}function P(n){var t=-1,r=Array(n.size);
return n.forEach(function(n){r[++t]=n}),r}function q(n){var t=-1,r=Array(n.size);return n.forEach(function(n){r[++t]=[n,n]}),r}function Z(n,t,r){for(var e=r-1,u=n.length;++e<u;)if(n[e]===t)return e;return-1}function K(n,t,r){for(var e=r+1;e--;)if(n[e]===t)return e;return e}function V(n){return T(n)?J(n):_e(n)}function G(n){return T(n)?Y(n):p(n)}function H(n){for(var t=n.length;t--&&Ct.test(n.charAt(t)););return t}function J(n){for(var t=Mr.lastIndex=0;Mr.test(n);)++t;return t}function Y(n){return n.match(Mr)||[];
}function Q(n){return n.match(Fr)||[]}var X,nn="4.17.21",tn=200,rn="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",en="Expected a function",un="Invalid `variable` option passed into `_.template`",on="__lodash_hash_undefined__",fn=500,cn="__lodash_placeholder__",an=1,ln=2,sn=4,hn=1,pn=2,_n=1,vn=2,gn=4,yn=8,dn=16,bn=32,wn=64,mn=128,xn=256,jn=512,An=30,kn="...",On=800,In=16,Rn=1,zn=2,En=3,Sn=1/0,Wn=9007199254740991,Ln=1.7976931348623157e308,Cn=NaN,Un=4294967295,Bn=Un-1,Tn=Un>>>1,$n=[["ary",mn],["bind",_n],["bindKey",vn],["curry",yn],["curryRight",dn],["flip",jn],["partial",bn],["partialRight",wn],["rearg",xn]],Dn="[object Arguments]",Mn="[object Array]",Fn="[object AsyncFunction]",Nn="[object Boolean]",Pn="[object Date]",qn="[object DOMException]",Zn="[object Error]",Kn="[object Function]",Vn="[object GeneratorFunction]",Gn="[object Map]",Hn="[object Number]",Jn="[object Null]",Yn="[object Object]",Qn="[object Promise]",Xn="[object Proxy]",nt="[object RegExp]",tt="[object Set]",rt="[object String]",et="[object Symbol]",ut="[object Undefined]",it="[object WeakMap]",ot="[object WeakSet]",ft="[object ArrayBuffer]",ct="[object DataView]",at="[object Float32Array]",lt="[object Float64Array]",st="[object Int8Array]",ht="[object Int16Array]",pt="[object Int32Array]",_t="[object Uint8Array]",vt="[object Uint8ClampedArray]",gt="[object Uint16Array]",yt="[object Uint32Array]",dt=/\b__p \+= '';/g,bt=/\b(__p \+=) '' \+/g,wt=/(__e\(.*?\)|\b__t\)) \+\n'';/g,mt=/&(?:amp|lt|gt|quot|#39);/g,xt=/[&<>"']/g,jt=RegExp(mt.source),At=RegExp(xt.source),kt=/<%-([\s\S]+?)%>/g,Ot=/<%([\s\S]+?)%>/g,It=/<%=([\s\S]+?)%>/g,Rt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,zt=/^\w*$/,Et=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,St=/[\\^$.*+?()[\]{}|]/g,Wt=RegExp(St.source),Lt=/^\s+/,Ct=/\s/,Ut=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Bt=/\{\n\/\* \[wrapped with (.+)\] \*/,Tt=/,? & /,$t=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Dt=/[()=,{}\[\]\/\s]/,Mt=/\\(\\)?/g,Ft=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Nt=/\w*$/,Pt=/^[-+]0x[0-9a-f]+$/i,qt=/^0b[01]+$/i,Zt=/^\[object .+?Constructor\]$/,Kt=/^0o[0-7]+$/i,Vt=/^(?:0|[1-9]\d*)$/,Gt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Ht=/($^)/,Jt=/['\n\r\u2028\u2029\\]/g,Yt="\\ud800-\\udfff",Qt="\\u0300-\\u036f",Xt="\\ufe20-\\ufe2f",nr="\\u20d0-\\u20ff",tr=Qt+Xt+nr,rr="\\u2700-\\u27bf",er="a-z\\xdf-\\xf6\\xf8-\\xff",ur="\\xac\\xb1\\xd7\\xf7",ir="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",or="\\u2000-\\u206f",fr=" \\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",cr="A-Z\\xc0-\\xd6\\xd8-\\xde",ar="\\ufe0e\\ufe0f",lr=ur+ir+or+fr,sr="['\u2019]",hr="["+Yt+"]",pr="["+lr+"]",_r="["+tr+"]",vr="\\d+",gr="["+rr+"]",yr="["+er+"]",dr="[^"+Yt+lr+vr+rr+er+cr+"]",br="\\ud83c[\\udffb-\\udfff]",wr="(?:"+_r+"|"+br+")",mr="[^"+Yt+"]",xr="(?:\\ud83c[\\udde6-\\uddff]){2}",jr="[\\ud800-\\udbff][\\udc00-\\udfff]",Ar="["+cr+"]",kr="\\u200d",Or="(?:"+yr+"|"+dr+")",Ir="(?:"+Ar+"|"+dr+")",Rr="(?:"+sr+"(?:d|ll|m|re|s|t|ve))?",zr="(?:"+sr+"(?:D|LL|M|RE|S|T|VE))?",Er=wr+"?",Sr="["+ar+"]?",Wr="(?:"+kr+"(?:"+[mr,xr,jr].join("|")+")"+Sr+Er+")*",Lr="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Cr="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Ur=Sr+Er+Wr,Br="(?:"+[gr,xr,jr].join("|")+")"+Ur,Tr="(?:"+[mr+_r+"?",_r,xr,jr,hr].join("|")+")",$r=RegExp(sr,"g"),Dr=RegExp(_r,"g"),Mr=RegExp(br+"(?="+br+")|"+Tr+Ur,"g"),Fr=RegExp([Ar+"?"+yr+"+"+Rr+"(?="+[pr,Ar,"$"].join("|")+")",Ir+"+"+zr+"(?="+[pr,Ar+Or,"$"].join("|")+")",Ar+"?"+Or+"+"+Rr,Ar+"+"+zr,Cr,Lr,vr,Br].join("|"),"g"),Nr=RegExp("["+kr+Yt+tr+ar+"]"),Pr=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,qr=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Zr=-1,Kr={};
Kr[at]=Kr[lt]=Kr[st]=Kr[ht]=Kr[pt]=Kr[_t]=Kr[vt]=Kr[gt]=Kr[yt]=!0,Kr[Dn]=Kr[Mn]=Kr[ft]=Kr[Nn]=Kr[ct]=Kr[Pn]=Kr[Zn]=Kr[Kn]=Kr[Gn]=Kr[Hn]=Kr[Yn]=Kr[nt]=Kr[tt]=Kr[rt]=Kr[it]=!1;var Vr={};Vr[Dn]=Vr[Mn]=Vr[ft]=Vr[ct]=Vr[Nn]=Vr[Pn]=Vr[at]=Vr[lt]=Vr[st]=Vr[ht]=Vr[pt]=Vr[Gn]=Vr[Hn]=Vr[Yn]=Vr[nt]=Vr[tt]=Vr[rt]=Vr[et]=Vr[_t]=Vr[vt]=Vr[gt]=Vr[yt]=!0,Vr[Zn]=Vr[Kn]=Vr[it]=!1;var Gr={"\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","\u0100":"A","\u0102":"A","\u0104":"A","\u0101":"a","\u0103":"a","\u0105":"a","\u0106":"C","\u0108":"C","\u010a":"C","\u010c":"C","\u0107":"c","\u0109":"c","\u010b":"c","\u010d":"c","\u010e":"D","\u0110":"D","\u010f":"d","\u0111":"d","\u0112":"E","\u0114":"E","\u0116":"E","\u0118":"E","\u011a":"E","\u0113":"e","\u0115":"e","\u0117":"e","\u0119":"e","\u011b":"e","\u011c":"G","\u011e":"G","\u0120":"G","\u0122":"G","\u011d":"g","\u011f":"g","\u0121":"g",
"\u0123":"g","\u0124":"H","\u0126":"H","\u0125":"h","\u0127":"h","\u0128":"I","\u012a":"I","\u012c":"I","\u012e":"I","\u0130":"I","\u0129":"i","\u012b":"i","\u012d":"i","\u012f":"i","\u0131":"i","\u0134":"J","\u0135":"j","\u0136":"K","\u0137":"k","\u0138":"k","\u0139":"L","\u013b":"L","\u013d":"L","\u013f":"L","\u0141":"L","\u013a":"l","\u013c":"l","\u013e":"l","\u0140":"l","\u0142":"l","\u0143":"N","\u0145":"N","\u0147":"N","\u014a":"N","\u0144":"n","\u0146":"n","\u0148":"n","\u014b":"n","\u014c":"O",
"\u014e":"O","\u0150":"O","\u014d":"o","\u014f":"o","\u0151":"o","\u0154":"R","\u0156":"R","\u0158":"R","\u0155":"r","\u0157":"r","\u0159":"r","\u015a":"S","\u015c":"S","\u015e":"S","\u0160":"S","\u015b":"s","\u015d":"s","\u015f":"s","\u0161":"s","\u0162":"T","\u0164":"T","\u0166":"T","\u0163":"t","\u0165":"t","\u0167":"t","\u0168":"U","\u016a":"U","\u016c":"U","\u016e":"U","\u0170":"U","\u0172":"U","\u0169":"u","\u016b":"u","\u016d":"u","\u016f":"u","\u0171":"u","\u0173":"u","\u0174":"W","\u0175":"w",
"\u0176":"Y","\u0177":"y","\u0178":"Y","\u0179":"Z","\u017b":"Z","\u017d":"Z","\u017a":"z","\u017c":"z","\u017e":"z","\u0132":"IJ","\u0133":"ij","\u0152":"Oe","\u0153":"oe","\u0149":"'n","\u017f":"s"},Hr={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Jr={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},Yr={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Qr=parseFloat,Xr=parseInt,ne="object"==typeof global&&global&&global.Object===Object&&global,te="object"==typeof self&&self&&self.Object===Object&&self,re=ne||te||Function("return this")(),ee="object"==typeof exports&&exports&&!exports.nodeType&&exports,ue=ee&&"object"==typeof module&&module&&!module.nodeType&&module,ie=ue&&ue.exports===ee,oe=ie&&ne.process,fe=function(){
try{var n=ue&&ue.require&&ue.require("util").types;return n?n:oe&&oe.binding&&oe.binding("util")}catch(n){}}(),ce=fe&&fe.isArrayBuffer,ae=fe&&fe.isDate,le=fe&&fe.isMap,se=fe&&fe.isRegExp,he=fe&&fe.isSet,pe=fe&&fe.isTypedArray,_e=m("length"),ve=x(Gr),ge=x(Hr),ye=x(Jr),de=function p(x){function Z(n){if(cc(n)&&!bh(n)&&!(n instanceof Ct)){if(n instanceof Y)return n;if(bl.call(n,"__wrapped__"))return eo(n)}return new Y(n)}function J(){}function Y(n,t){this.__wrapped__=n,this.__actions__=[],this.__chain__=!!t,
this.__index__=0,this.__values__=X}function Ct(n){this.__wrapped__=n,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=Un,this.__views__=[]}function $t(){var n=new Ct(this.__wrapped__);return n.__actions__=Tu(this.__actions__),n.__dir__=this.__dir__,n.__filtered__=this.__filtered__,n.__iteratees__=Tu(this.__iteratees__),n.__takeCount__=this.__takeCount__,n.__views__=Tu(this.__views__),n}function Yt(){if(this.__filtered__){var n=new Ct(this);n.__dir__=-1,
n.__filtered__=!0}else n=this.clone(),n.__dir__*=-1;return n}function Qt(){var n=this.__wrapped__.value(),t=this.__dir__,r=bh(n),e=t<0,u=r?n.length:0,i=Oi(0,u,this.__views__),o=i.start,f=i.end,c=f-o,a=e?f:o-1,l=this.__iteratees__,s=l.length,h=0,p=Hl(c,this.__takeCount__);if(!r||!e&&u==c&&p==c)return wu(n,this.__actions__);var _=[];n:for(;c--&&h<p;){a+=t;for(var v=-1,g=n[a];++v<s;){var y=l[v],d=y.iteratee,b=y.type,w=d(g);if(b==zn)g=w;else if(!w){if(b==Rn)continue n;break n}}_[h++]=g}return _}function Xt(n){
var t=-1,r=null==n?0:n.length;for(this.clear();++t<r;){var e=n[t];this.set(e[0],e[1])}}function nr(){this.__data__=is?is(null):{},this.size=0}function tr(n){var t=this.has(n)&&delete this.__data__[n];return this.size-=t?1:0,t}function rr(n){var t=this.__data__;if(is){var r=t[n];return r===on?X:r}return bl.call(t,n)?t[n]:X}function er(n){var t=this.__data__;return is?t[n]!==X:bl.call(t,n)}function ur(n,t){var r=this.__data__;return this.size+=this.has(n)?0:1,r[n]=is&&t===X?on:t,this}function ir(n){
var t=-1,r=null==n?0:n.length;for(this.clear();++t<r;){var e=n[t];this.set(e[0],e[1])}}function or(){this.__data__=[],this.size=0}function fr(n){var t=this.__data__,r=Wr(t,n);return!(r<0)&&(r==t.length-1?t.pop():Ll.call(t,r,1),--this.size,!0)}function cr(n){var t=this.__data__,r=Wr(t,n);return r<0?X:t[r][1]}function ar(n){return Wr(this.__data__,n)>-1}function lr(n,t){var r=this.__data__,e=Wr(r,n);return e<0?(++this.size,r.push([n,t])):r[e][1]=t,this}function sr(n){var t=-1,r=null==n?0:n.length;for(this.clear();++t<r;){
var e=n[t];this.set(e[0],e[1])}}function hr(){this.size=0,this.__data__={hash:new Xt,map:new(ts||ir),string:new Xt}}function pr(n){var t=xi(this,n).delete(n);return this.size-=t?1:0,t}function _r(n){return xi(this,n).get(n)}function vr(n){return xi(this,n).has(n)}function gr(n,t){var r=xi(this,n),e=r.size;return r.set(n,t),this.size+=r.size==e?0:1,this}function yr(n){var t=-1,r=null==n?0:n.length;for(this.__data__=new sr;++t<r;)this.add(n[t])}function dr(n){return this.__data__.set(n,on),this}function br(n){
return this.__data__.has(n)}function wr(n){this.size=(this.__data__=new ir(n)).size}function mr(){this.__data__=new ir,this.size=0}function xr(n){var t=this.__data__,r=t.delete(n);return this.size=t.size,r}function jr(n){return this.__data__.get(n)}function Ar(n){return this.__data__.has(n)}function kr(n,t){var r=this.__data__;if(r instanceof ir){var e=r.__data__;if(!ts||e.length<tn-1)return e.push([n,t]),this.size=++r.size,this;r=this.__data__=new sr(e)}return r.set(n,t),this.size=r.size,this}function Or(n,t){
var r=bh(n),e=!r&&dh(n),u=!r&&!e&&mh(n),i=!r&&!e&&!u&&Oh(n),o=r||e||u||i,f=o?O(n.length,hl):[],c=f.length;for(var a in n)!t&&!bl.call(n,a)||o&&("length"==a||u&&("offset"==a||"parent"==a)||i&&("buffer"==a||"byteLength"==a||"byteOffset"==a)||Ci(a,c))||f.push(a);return f}function Ir(n){var t=n.length;return t?n[tu(0,t-1)]:X}function Rr(n,t){return Xi(Tu(n),Mr(t,0,n.length))}function zr(n){return Xi(Tu(n))}function Er(n,t,r){(r===X||Gf(n[t],r))&&(r!==X||t in n)||Br(n,t,r)}function Sr(n,t,r){var e=n[t];
bl.call(n,t)&&Gf(e,r)&&(r!==X||t in n)||Br(n,t,r)}function Wr(n,t){for(var r=n.length;r--;)if(Gf(n[r][0],t))return r;return-1}function Lr(n,t,r,e){return ys(n,function(n,u,i){t(e,n,r(n),i)}),e}function Cr(n,t){return n&&$u(t,Pc(t),n)}function Ur(n,t){return n&&$u(t,qc(t),n)}function Br(n,t,r){"__proto__"==t&&Tl?Tl(n,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):n[t]=r}function Tr(n,t){for(var r=-1,e=t.length,u=il(e),i=null==n;++r<e;)u[r]=i?X:Mc(n,t[r]);return u}function Mr(n,t,r){return n===n&&(r!==X&&(n=n<=r?n:r),
t!==X&&(n=n>=t?n:t)),n}function Fr(n,t,e,u,i,o){var f,c=t&an,a=t&ln,l=t&sn;if(e&&(f=i?e(n,u,i,o):e(n)),f!==X)return f;if(!fc(n))return n;var s=bh(n);if(s){if(f=zi(n),!c)return Tu(n,f)}else{var h=zs(n),p=h==Kn||h==Vn;if(mh(n))return Iu(n,c);if(h==Yn||h==Dn||p&&!i){if(f=a||p?{}:Ei(n),!c)return a?Mu(n,Ur(f,n)):Du(n,Cr(f,n))}else{if(!Vr[h])return i?n:{};f=Si(n,h,c)}}o||(o=new wr);var _=o.get(n);if(_)return _;o.set(n,f),kh(n)?n.forEach(function(r){f.add(Fr(r,t,e,r,n,o))}):jh(n)&&n.forEach(function(r,u){
f.set(u,Fr(r,t,e,u,n,o))});var v=l?a?di:yi:a?qc:Pc,g=s?X:v(n);return r(g||n,function(r,u){g&&(u=r,r=n[u]),Sr(f,u,Fr(r,t,e,u,n,o))}),f}function Nr(n){var t=Pc(n);return function(r){return Pr(r,n,t)}}function Pr(n,t,r){var e=r.length;if(null==n)return!e;for(n=ll(n);e--;){var u=r[e],i=t[u],o=n[u];if(o===X&&!(u in n)||!i(o))return!1}return!0}function Gr(n,t,r){if("function"!=typeof n)throw new pl(en);return Ws(function(){n.apply(X,r)},t)}function Hr(n,t,r,e){var u=-1,i=o,a=!0,l=n.length,s=[],h=t.length;
if(!l)return s;r&&(t=c(t,z(r))),e?(i=f,a=!1):t.length>=tn&&(i=S,a=!1,t=new yr(t));n:for(;++u<l;){var p=n[u],_=null==r?p:r(p);if(p=e||0!==p?p:0,a&&_===_){for(var v=h;v--;)if(t[v]===_)continue n;s.push(p)}else i(t,_,e)||s.push(p)}return s}function Jr(n,t){var r=!0;return ys(n,function(n,e,u){return r=!!t(n,e,u)}),r}function Yr(n,t,r){for(var e=-1,u=n.length;++e<u;){var i=n[e],o=t(i);if(null!=o&&(f===X?o===o&&!bc(o):r(o,f)))var f=o,c=i}return c}function ne(n,t,r,e){var u=n.length;for(r=kc(r),r<0&&(r=-r>u?0:u+r),
e=e===X||e>u?u:kc(e),e<0&&(e+=u),e=r>e?0:Oc(e);r<e;)n[r++]=t;return n}function te(n,t){var r=[];return ys(n,function(n,e,u){t(n,e,u)&&r.push(n)}),r}function ee(n,t,r,e,u){var i=-1,o=n.length;for(r||(r=Li),u||(u=[]);++i<o;){var f=n[i];t>0&&r(f)?t>1?ee(f,t-1,r,e,u):a(u,f):e||(u[u.length]=f)}return u}function ue(n,t){return n&&bs(n,t,Pc)}function oe(n,t){return n&&ws(n,t,Pc)}function fe(n,t){return i(t,function(t){return uc(n[t])})}function _e(n,t){t=ku(t,n);for(var r=0,e=t.length;null!=n&&r<e;)n=n[no(t[r++])];
return r&&r==e?n:X}function de(n,t,r){var e=t(n);return bh(n)?e:a(e,r(n))}function we(n){return null==n?n===X?ut:Jn:Bl&&Bl in ll(n)?ki(n):Ki(n)}function me(n,t){return n>t}function xe(n,t){return null!=n&&bl.call(n,t)}function je(n,t){return null!=n&&t in ll(n)}function Ae(n,t,r){return n>=Hl(t,r)&&n<Gl(t,r)}function ke(n,t,r){for(var e=r?f:o,u=n[0].length,i=n.length,a=i,l=il(i),s=1/0,h=[];a--;){var p=n[a];a&&t&&(p=c(p,z(t))),s=Hl(p.length,s),l[a]=!r&&(t||u>=120&&p.length>=120)?new yr(a&&p):X}p=n[0];
var _=-1,v=l[0];n:for(;++_<u&&h.length<s;){var g=p[_],y=t?t(g):g;if(g=r||0!==g?g:0,!(v?S(v,y):e(h,y,r))){for(a=i;--a;){var d=l[a];if(!(d?S(d,y):e(n[a],y,r)))continue n}v&&v.push(y),h.push(g)}}return h}function Oe(n,t,r,e){return ue(n,function(n,u,i){t(e,r(n),u,i)}),e}function Ie(t,r,e){r=ku(r,t),t=Gi(t,r);var u=null==t?t:t[no(jo(r))];return null==u?X:n(u,t,e)}function Re(n){return cc(n)&&we(n)==Dn}function ze(n){return cc(n)&&we(n)==ft}function Ee(n){return cc(n)&&we(n)==Pn}function Se(n,t,r,e,u){
return n===t||(null==n||null==t||!cc(n)&&!cc(t)?n!==n&&t!==t:We(n,t,r,e,Se,u))}function We(n,t,r,e,u,i){var o=bh(n),f=bh(t),c=o?Mn:zs(n),a=f?Mn:zs(t);c=c==Dn?Yn:c,a=a==Dn?Yn:a;var l=c==Yn,s=a==Yn,h=c==a;if(h&&mh(n)){if(!mh(t))return!1;o=!0,l=!1}if(h&&!l)return i||(i=new wr),o||Oh(n)?pi(n,t,r,e,u,i):_i(n,t,c,r,e,u,i);if(!(r&hn)){var p=l&&bl.call(n,"__wrapped__"),_=s&&bl.call(t,"__wrapped__");if(p||_){var v=p?n.value():n,g=_?t.value():t;return i||(i=new wr),u(v,g,r,e,i)}}return!!h&&(i||(i=new wr),vi(n,t,r,e,u,i));
}function Le(n){return cc(n)&&zs(n)==Gn}function Ce(n,t,r,e){var u=r.length,i=u,o=!e;if(null==n)return!i;for(n=ll(n);u--;){var f=r[u];if(o&&f[2]?f[1]!==n[f[0]]:!(f[0]in n))return!1}for(;++u<i;){f=r[u];var c=f[0],a=n[c],l=f[1];if(o&&f[2]){if(a===X&&!(c in n))return!1}else{var s=new wr;if(e)var h=e(a,l,c,n,t,s);if(!(h===X?Se(l,a,hn|pn,e,s):h))return!1}}return!0}function Ue(n){return!(!fc(n)||Di(n))&&(uc(n)?kl:Zt).test(to(n))}function Be(n){return cc(n)&&we(n)==nt}function Te(n){return cc(n)&&zs(n)==tt;
}function $e(n){return cc(n)&&oc(n.length)&&!!Kr[we(n)]}function De(n){return"function"==typeof n?n:null==n?La:"object"==typeof n?bh(n)?Ze(n[0],n[1]):qe(n):Fa(n)}function Me(n){if(!Mi(n))return Vl(n);var t=[];for(var r in ll(n))bl.call(n,r)&&"constructor"!=r&&t.push(r);return t}function Fe(n){if(!fc(n))return Zi(n);var t=Mi(n),r=[];for(var e in n)("constructor"!=e||!t&&bl.call(n,e))&&r.push(e);return r}function Ne(n,t){return n<t}function Pe(n,t){var r=-1,e=Hf(n)?il(n.length):[];return ys(n,function(n,u,i){
e[++r]=t(n,u,i)}),e}function qe(n){var t=ji(n);return 1==t.length&&t[0][2]?Ni(t[0][0],t[0][1]):function(r){return r===n||Ce(r,n,t)}}function Ze(n,t){return Bi(n)&&Fi(t)?Ni(no(n),t):function(r){var e=Mc(r,n);return e===X&&e===t?Nc(r,n):Se(t,e,hn|pn)}}function Ke(n,t,r,e,u){n!==t&&bs(t,function(i,o){if(u||(u=new wr),fc(i))Ve(n,t,o,r,Ke,e,u);else{var f=e?e(Ji(n,o),i,o+"",n,t,u):X;f===X&&(f=i),Er(n,o,f)}},qc)}function Ve(n,t,r,e,u,i,o){var f=Ji(n,r),c=Ji(t,r),a=o.get(c);if(a)return Er(n,r,a),X;var l=i?i(f,c,r+"",n,t,o):X,s=l===X;
if(s){var h=bh(c),p=!h&&mh(c),_=!h&&!p&&Oh(c);l=c,h||p||_?bh(f)?l=f:Jf(f)?l=Tu(f):p?(s=!1,l=Iu(c,!0)):_?(s=!1,l=Wu(c,!0)):l=[]:gc(c)||dh(c)?(l=f,dh(f)?l=Rc(f):fc(f)&&!uc(f)||(l=Ei(c))):s=!1}s&&(o.set(c,l),u(l,c,e,i,o),o.delete(c)),Er(n,r,l)}function Ge(n,t){var r=n.length;if(r)return t+=t<0?r:0,Ci(t,r)?n[t]:X}function He(n,t,r){t=t.length?c(t,function(n){return bh(n)?function(t){return _e(t,1===n.length?n[0]:n)}:n}):[La];var e=-1;return t=c(t,z(mi())),A(Pe(n,function(n,r,u){return{criteria:c(t,function(t){
return t(n)}),index:++e,value:n}}),function(n,t){return Cu(n,t,r)})}function Je(n,t){return Ye(n,t,function(t,r){return Nc(n,r)})}function Ye(n,t,r){for(var e=-1,u=t.length,i={};++e<u;){var o=t[e],f=_e(n,o);r(f,o)&&fu(i,ku(o,n),f)}return i}function Qe(n){return function(t){return _e(t,n)}}function Xe(n,t,r,e){var u=e?d:y,i=-1,o=t.length,f=n;for(n===t&&(t=Tu(t)),r&&(f=c(n,z(r)));++i<o;)for(var a=0,l=t[i],s=r?r(l):l;(a=u(f,s,a,e))>-1;)f!==n&&Ll.call(f,a,1),Ll.call(n,a,1);return n}function nu(n,t){for(var r=n?t.length:0,e=r-1;r--;){
var u=t[r];if(r==e||u!==i){var i=u;Ci(u)?Ll.call(n,u,1):yu(n,u)}}return n}function tu(n,t){return n+Nl(Ql()*(t-n+1))}function ru(n,t,r,e){for(var u=-1,i=Gl(Fl((t-n)/(r||1)),0),o=il(i);i--;)o[e?i:++u]=n,n+=r;return o}function eu(n,t){var r="";if(!n||t<1||t>Wn)return r;do t%2&&(r+=n),t=Nl(t/2),t&&(n+=n);while(t);return r}function uu(n,t){return Ls(Vi(n,t,La),n+"")}function iu(n){return Ir(ra(n))}function ou(n,t){var r=ra(n);return Xi(r,Mr(t,0,r.length))}function fu(n,t,r,e){if(!fc(n))return n;t=ku(t,n);
for(var u=-1,i=t.length,o=i-1,f=n;null!=f&&++u<i;){var c=no(t[u]),a=r;if("__proto__"===c||"constructor"===c||"prototype"===c)return n;if(u!=o){var l=f[c];a=e?e(l,c,f):X,a===X&&(a=fc(l)?l:Ci(t[u+1])?[]:{})}Sr(f,c,a),f=f[c]}return n}function cu(n){return Xi(ra(n))}function au(n,t,r){var e=-1,u=n.length;t<0&&(t=-t>u?0:u+t),r=r>u?u:r,r<0&&(r+=u),u=t>r?0:r-t>>>0,t>>>=0;for(var i=il(u);++e<u;)i[e]=n[e+t];return i}function lu(n,t){var r;return ys(n,function(n,e,u){return r=t(n,e,u),!r}),!!r}function su(n,t,r){
var e=0,u=null==n?e:n.length;if("number"==typeof t&&t===t&&u<=Tn){for(;e<u;){var i=e+u>>>1,o=n[i];null!==o&&!bc(o)&&(r?o<=t:o<t)?e=i+1:u=i}return u}return hu(n,t,La,r)}function hu(n,t,r,e){var u=0,i=null==n?0:n.length;if(0===i)return 0;t=r(t);for(var o=t!==t,f=null===t,c=bc(t),a=t===X;u<i;){var l=Nl((u+i)/2),s=r(n[l]),h=s!==X,p=null===s,_=s===s,v=bc(s);if(o)var g=e||_;else g=a?_&&(e||h):f?_&&h&&(e||!p):c?_&&h&&!p&&(e||!v):!p&&!v&&(e?s<=t:s<t);g?u=l+1:i=l}return Hl(i,Bn)}function pu(n,t){for(var r=-1,e=n.length,u=0,i=[];++r<e;){
var o=n[r],f=t?t(o):o;if(!r||!Gf(f,c)){var c=f;i[u++]=0===o?0:o}}return i}function _u(n){return"number"==typeof n?n:bc(n)?Cn:+n}function vu(n){if("string"==typeof n)return n;if(bh(n))return c(n,vu)+"";if(bc(n))return vs?vs.call(n):"";var t=n+"";return"0"==t&&1/n==-Sn?"-0":t}function gu(n,t,r){var e=-1,u=o,i=n.length,c=!0,a=[],l=a;if(r)c=!1,u=f;else if(i>=tn){var s=t?null:ks(n);if(s)return P(s);c=!1,u=S,l=new yr}else l=t?[]:a;n:for(;++e<i;){var h=n[e],p=t?t(h):h;if(h=r||0!==h?h:0,c&&p===p){for(var _=l.length;_--;)if(l[_]===p)continue n;
t&&l.push(p),a.push(h)}else u(l,p,r)||(l!==a&&l.push(p),a.push(h))}return a}function yu(n,t){return t=ku(t,n),n=Gi(n,t),null==n||delete n[no(jo(t))]}function du(n,t,r,e){return fu(n,t,r(_e(n,t)),e)}function bu(n,t,r,e){for(var u=n.length,i=e?u:-1;(e?i--:++i<u)&&t(n[i],i,n););return r?au(n,e?0:i,e?i+1:u):au(n,e?i+1:0,e?u:i)}function wu(n,t){var r=n;return r instanceof Ct&&(r=r.value()),l(t,function(n,t){return t.func.apply(t.thisArg,a([n],t.args))},r)}function mu(n,t,r){var e=n.length;if(e<2)return e?gu(n[0]):[];
for(var u=-1,i=il(e);++u<e;)for(var o=n[u],f=-1;++f<e;)f!=u&&(i[u]=Hr(i[u]||o,n[f],t,r));return gu(ee(i,1),t,r)}function xu(n,t,r){for(var e=-1,u=n.length,i=t.length,o={};++e<u;){r(o,n[e],e<i?t[e]:X)}return o}function ju(n){return Jf(n)?n:[]}function Au(n){return"function"==typeof n?n:La}function ku(n,t){return bh(n)?n:Bi(n,t)?[n]:Cs(Ec(n))}function Ou(n,t,r){var e=n.length;return r=r===X?e:r,!t&&r>=e?n:au(n,t,r)}function Iu(n,t){if(t)return n.slice();var r=n.length,e=zl?zl(r):new n.constructor(r);
return n.copy(e),e}function Ru(n){var t=new n.constructor(n.byteLength);return new Rl(t).set(new Rl(n)),t}function zu(n,t){return new n.constructor(t?Ru(n.buffer):n.buffer,n.byteOffset,n.byteLength)}function Eu(n){var t=new n.constructor(n.source,Nt.exec(n));return t.lastIndex=n.lastIndex,t}function Su(n){return _s?ll(_s.call(n)):{}}function Wu(n,t){return new n.constructor(t?Ru(n.buffer):n.buffer,n.byteOffset,n.length)}function Lu(n,t){if(n!==t){var r=n!==X,e=null===n,u=n===n,i=bc(n),o=t!==X,f=null===t,c=t===t,a=bc(t);
if(!f&&!a&&!i&&n>t||i&&o&&c&&!f&&!a||e&&o&&c||!r&&c||!u)return 1;if(!e&&!i&&!a&&n<t||a&&r&&u&&!e&&!i||f&&r&&u||!o&&u||!c)return-1}return 0}function Cu(n,t,r){for(var e=-1,u=n.criteria,i=t.criteria,o=u.length,f=r.length;++e<o;){var c=Lu(u[e],i[e]);if(c){if(e>=f)return c;return c*("desc"==r[e]?-1:1)}}return n.index-t.index}function Uu(n,t,r,e){for(var u=-1,i=n.length,o=r.length,f=-1,c=t.length,a=Gl(i-o,0),l=il(c+a),s=!e;++f<c;)l[f]=t[f];for(;++u<o;)(s||u<i)&&(l[r[u]]=n[u]);for(;a--;)l[f++]=n[u++];return l;
}function Bu(n,t,r,e){for(var u=-1,i=n.length,o=-1,f=r.length,c=-1,a=t.length,l=Gl(i-f,0),s=il(l+a),h=!e;++u<l;)s[u]=n[u];for(var p=u;++c<a;)s[p+c]=t[c];for(;++o<f;)(h||u<i)&&(s[p+r[o]]=n[u++]);return s}function Tu(n,t){var r=-1,e=n.length;for(t||(t=il(e));++r<e;)t[r]=n[r];return t}function $u(n,t,r,e){var u=!r;r||(r={});for(var i=-1,o=t.length;++i<o;){var f=t[i],c=e?e(r[f],n[f],f,r,n):X;c===X&&(c=n[f]),u?Br(r,f,c):Sr(r,f,c)}return r}function Du(n,t){return $u(n,Is(n),t)}function Mu(n,t){return $u(n,Rs(n),t);
}function Fu(n,r){return function(e,u){var i=bh(e)?t:Lr,o=r?r():{};return i(e,n,mi(u,2),o)}}function Nu(n){return uu(function(t,r){var e=-1,u=r.length,i=u>1?r[u-1]:X,o=u>2?r[2]:X;for(i=n.length>3&&"function"==typeof i?(u--,i):X,o&&Ui(r[0],r[1],o)&&(i=u<3?X:i,u=1),t=ll(t);++e<u;){var f=r[e];f&&n(t,f,e,i)}return t})}function Pu(n,t){return function(r,e){if(null==r)return r;if(!Hf(r))return n(r,e);for(var u=r.length,i=t?u:-1,o=ll(r);(t?i--:++i<u)&&e(o[i],i,o)!==!1;);return r}}function qu(n){return function(t,r,e){
for(var u=-1,i=ll(t),o=e(t),f=o.length;f--;){var c=o[n?f:++u];if(r(i[c],c,i)===!1)break}return t}}function Zu(n,t,r){function e(){return(this&&this!==re&&this instanceof e?i:n).apply(u?r:this,arguments)}var u=t&_n,i=Gu(n);return e}function Ku(n){return function(t){t=Ec(t);var r=T(t)?G(t):X,e=r?r[0]:t.charAt(0),u=r?Ou(r,1).join(""):t.slice(1);return e[n]()+u}}function Vu(n){return function(t){return l(Ra(ca(t).replace($r,"")),n,"")}}function Gu(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=gs(n.prototype),e=n.apply(r,t);return fc(e)?e:r}}function Hu(t,r,e){function u(){for(var o=arguments.length,f=il(o),c=o,a=wi(u);c--;)f[c]=arguments[c];var l=o<3&&f[0]!==a&&f[o-1]!==a?[]:N(f,a);
return o-=l.length,o<e?oi(t,r,Qu,u.placeholder,X,f,l,X,X,e-o):n(this&&this!==re&&this instanceof u?i:t,this,f)}var i=Gu(t);return u}function Ju(n){return function(t,r,e){var u=ll(t);if(!Hf(t)){var i=mi(r,3);t=Pc(t),r=function(n){return i(u[n],n,u)}}var o=n(t,r,e);return o>-1?u[i?t[o]:o]:X}}function Yu(n){return gi(function(t){var r=t.length,e=r,u=Y.prototype.thru;for(n&&t.reverse();e--;){var i=t[e];if("function"!=typeof i)throw new pl(en);if(u&&!o&&"wrapper"==bi(i))var o=new Y([],!0)}for(e=o?e:r;++e<r;){
i=t[e];var f=bi(i),c="wrapper"==f?Os(i):X;o=c&&$i(c[0])&&c[1]==(mn|yn|bn|xn)&&!c[4].length&&1==c[9]?o[bi(c[0])].apply(o,c[3]):1==i.length&&$i(i)?o[f]():o.thru(i)}return function(){var n=arguments,e=n[0];if(o&&1==n.length&&bh(e))return o.plant(e).value();for(var u=0,i=r?t[u].apply(this,n):e;++u<r;)i=t[u].call(this,i);return i}})}function Qu(n,t,r,e,u,i,o,f,c,a){function l(){for(var y=arguments.length,d=il(y),b=y;b--;)d[b]=arguments[b];if(_)var w=wi(l),m=C(d,w);if(e&&(d=Uu(d,e,u,_)),i&&(d=Bu(d,i,o,_)),
y-=m,_&&y<a){return oi(n,t,Qu,l.placeholder,r,d,N(d,w),f,c,a-y)}var x=h?r:this,j=p?x[n]:n;return y=d.length,f?d=Hi(d,f):v&&y>1&&d.reverse(),s&&c<y&&(d.length=c),this&&this!==re&&this instanceof l&&(j=g||Gu(j)),j.apply(x,d)}var s=t&mn,h=t&_n,p=t&vn,_=t&(yn|dn),v=t&jn,g=p?X:Gu(n);return l}function Xu(n,t){return function(r,e){return Oe(r,n,t(e),{})}}function ni(n,t){return function(r,e){var u;if(r===X&&e===X)return t;if(r!==X&&(u=r),e!==X){if(u===X)return e;"string"==typeof r||"string"==typeof e?(r=vu(r),
e=vu(e)):(r=_u(r),e=_u(e)),u=n(r,e)}return u}}function ti(t){return gi(function(r){return r=c(r,z(mi())),uu(function(e){var u=this;return t(r,function(t){return n(t,u,e)})})})}function ri(n,t){t=t===X?" ":vu(t);var r=t.length;if(r<2)return r?eu(t,n):t;var e=eu(t,Fl(n/V(t)));return T(t)?Ou(G(e),0,n).join(""):e.slice(0,n)}function ei(t,r,e,u){function i(){for(var r=-1,c=arguments.length,a=-1,l=u.length,s=il(l+c),h=this&&this!==re&&this instanceof i?f:t;++a<l;)s[a]=u[a];for(;c--;)s[a++]=arguments[++r];
return n(h,o?e:this,s)}var o=r&_n,f=Gu(t);return i}function ui(n){return function(t,r,e){return e&&"number"!=typeof e&&Ui(t,r,e)&&(r=e=X),t=Ac(t),r===X?(r=t,t=0):r=Ac(r),e=e===X?t<r?1:-1:Ac(e),ru(t,r,e,n)}}function ii(n){return function(t,r){return"string"==typeof t&&"string"==typeof r||(t=Ic(t),r=Ic(r)),n(t,r)}}function oi(n,t,r,e,u,i,o,f,c,a){var l=t&yn,s=l?o:X,h=l?X:o,p=l?i:X,_=l?X:i;t|=l?bn:wn,t&=~(l?wn:bn),t&gn||(t&=~(_n|vn));var v=[n,t,u,p,s,_,h,f,c,a],g=r.apply(X,v);return $i(n)&&Ss(g,v),g.placeholder=e,
Yi(g,n,t)}function fi(n){var t=al[n];return function(n,r){if(n=Ic(n),r=null==r?0:Hl(kc(r),292),r&&Zl(n)){var e=(Ec(n)+"e").split("e");return e=(Ec(t(e[0]+"e"+(+e[1]+r)))+"e").split("e"),+(e[0]+"e"+(+e[1]-r))}return t(n)}}function ci(n){return function(t){var r=zs(t);return r==Gn?M(t):r==tt?q(t):I(t,n(t))}}function ai(n,t,r,e,u,i,o,f){var c=t&vn;if(!c&&"function"!=typeof n)throw new pl(en);var a=e?e.length:0;if(a||(t&=~(bn|wn),e=u=X),o=o===X?o:Gl(kc(o),0),f=f===X?f:kc(f),a-=u?u.length:0,t&wn){var l=e,s=u;
e=u=X}var h=c?X:Os(n),p=[n,t,r,e,u,l,s,i,o,f];if(h&&qi(p,h),n=p[0],t=p[1],r=p[2],e=p[3],u=p[4],f=p[9]=p[9]===X?c?0:n.length:Gl(p[9]-a,0),!f&&t&(yn|dn)&&(t&=~(yn|dn)),t&&t!=_n)_=t==yn||t==dn?Hu(n,t,f):t!=bn&&t!=(_n|bn)||u.length?Qu.apply(X,p):ei(n,t,r,e);else var _=Zu(n,t,r);return Yi((h?ms:Ss)(_,p),n,t)}function li(n,t,r,e){return n===X||Gf(n,gl[r])&&!bl.call(e,r)?t:n}function si(n,t,r,e,u,i){return fc(n)&&fc(t)&&(i.set(t,n),Ke(n,t,X,si,i),i.delete(t)),n}function hi(n){return gc(n)?X:n}function pi(n,t,r,e,u,i){
var o=r&hn,f=n.length,c=t.length;if(f!=c&&!(o&&c>f))return!1;var a=i.get(n),l=i.get(t);if(a&&l)return a==t&&l==n;var s=-1,p=!0,_=r&pn?new yr:X;for(i.set(n,t),i.set(t,n);++s<f;){var v=n[s],g=t[s];if(e)var y=o?e(g,v,s,t,n,i):e(v,g,s,n,t,i);if(y!==X){if(y)continue;p=!1;break}if(_){if(!h(t,function(n,t){if(!S(_,t)&&(v===n||u(v,n,r,e,i)))return _.push(t)})){p=!1;break}}else if(v!==g&&!u(v,g,r,e,i)){p=!1;break}}return i.delete(n),i.delete(t),p}function _i(n,t,r,e,u,i,o){switch(r){case ct:if(n.byteLength!=t.byteLength||n.byteOffset!=t.byteOffset)return!1;
n=n.buffer,t=t.buffer;case ft:return!(n.byteLength!=t.byteLength||!i(new Rl(n),new Rl(t)));case Nn:case Pn:case Hn:return Gf(+n,+t);case Zn:return n.name==t.name&&n.message==t.message;case nt:case rt:return n==t+"";case Gn:var f=M;case tt:var c=e&hn;if(f||(f=P),n.size!=t.size&&!c)return!1;var a=o.get(n);if(a)return a==t;e|=pn,o.set(n,t);var l=pi(f(n),f(t),e,u,i,o);return o.delete(n),l;case et:if(_s)return _s.call(n)==_s.call(t)}return!1}function vi(n,t,r,e,u,i){var o=r&hn,f=yi(n),c=f.length;if(c!=yi(t).length&&!o)return!1;
for(var a=c;a--;){var l=f[a];if(!(o?l in t:bl.call(t,l)))return!1}var s=i.get(n),h=i.get(t);if(s&&h)return s==t&&h==n;var p=!0;i.set(n,t),i.set(t,n);for(var _=o;++a<c;){l=f[a];var v=n[l],g=t[l];if(e)var y=o?e(g,v,l,t,n,i):e(v,g,l,n,t,i);if(!(y===X?v===g||u(v,g,r,e,i):y)){p=!1;break}_||(_="constructor"==l)}if(p&&!_){var d=n.constructor,b=t.constructor;d!=b&&"constructor"in n&&"constructor"in t&&!("function"==typeof d&&d instanceof d&&"function"==typeof b&&b instanceof b)&&(p=!1)}return i.delete(n),
i.delete(t),p}function gi(n){return Ls(Vi(n,X,_o),n+"")}function yi(n){return de(n,Pc,Is)}function di(n){return de(n,qc,Rs)}function bi(n){for(var t=n.name+"",r=fs[t],e=bl.call(fs,t)?r.length:0;e--;){var u=r[e],i=u.func;if(null==i||i==n)return u.name}return t}function wi(n){return(bl.call(Z,"placeholder")?Z:n).placeholder}function mi(){var n=Z.iteratee||Ca;return n=n===Ca?De:n,arguments.length?n(arguments[0],arguments[1]):n}function xi(n,t){var r=n.__data__;return Ti(t)?r["string"==typeof t?"string":"hash"]:r.map;
}function ji(n){for(var t=Pc(n),r=t.length;r--;){var e=t[r],u=n[e];t[r]=[e,u,Fi(u)]}return t}function Ai(n,t){var r=B(n,t);return Ue(r)?r:X}function ki(n){var t=bl.call(n,Bl),r=n[Bl];try{n[Bl]=X;var e=!0}catch(n){}var u=xl.call(n);return e&&(t?n[Bl]=r:delete n[Bl]),u}function Oi(n,t,r){for(var e=-1,u=r.length;++e<u;){var i=r[e],o=i.size;switch(i.type){case"drop":n+=o;break;case"dropRight":t-=o;break;case"take":t=Hl(t,n+o);break;case"takeRight":n=Gl(n,t-o)}}return{start:n,end:t}}function Ii(n){var t=n.match(Bt);
return t?t[1].split(Tt):[]}function Ri(n,t,r){t=ku(t,n);for(var e=-1,u=t.length,i=!1;++e<u;){var o=no(t[e]);if(!(i=null!=n&&r(n,o)))break;n=n[o]}return i||++e!=u?i:(u=null==n?0:n.length,!!u&&oc(u)&&Ci(o,u)&&(bh(n)||dh(n)))}function zi(n){var t=n.length,r=new n.constructor(t);return t&&"string"==typeof n[0]&&bl.call(n,"index")&&(r.index=n.index,r.input=n.input),r}function Ei(n){return"function"!=typeof n.constructor||Mi(n)?{}:gs(El(n))}function Si(n,t,r){var e=n.constructor;switch(t){case ft:return Ru(n);
case Nn:case Pn:return new e(+n);case ct:return zu(n,r);case at:case lt:case st:case ht:case pt:case _t:case vt:case gt:case yt:return Wu(n,r);case Gn:return new e;case Hn:case rt:return new e(n);case nt:return Eu(n);case tt:return new e;case et:return Su(n)}}function Wi(n,t){var r=t.length;if(!r)return n;var e=r-1;return t[e]=(r>1?"& ":"")+t[e],t=t.join(r>2?", ":" "),n.replace(Ut,"{\n/* [wrapped with "+t+"] */\n")}function Li(n){return bh(n)||dh(n)||!!(Cl&&n&&n[Cl])}function Ci(n,t){var r=typeof n;
return t=null==t?Wn:t,!!t&&("number"==r||"symbol"!=r&&Vt.test(n))&&n>-1&&n%1==0&&n<t}function Ui(n,t,r){if(!fc(r))return!1;var e=typeof t;return!!("number"==e?Hf(r)&&Ci(t,r.length):"string"==e&&t in r)&&Gf(r[t],n)}function Bi(n,t){if(bh(n))return!1;var r=typeof n;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=n&&!bc(n))||(zt.test(n)||!Rt.test(n)||null!=t&&n in ll(t))}function Ti(n){var t=typeof n;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==n:null===n}function $i(n){
var t=bi(n),r=Z[t];if("function"!=typeof r||!(t in Ct.prototype))return!1;if(n===r)return!0;var e=Os(r);return!!e&&n===e[0]}function Di(n){return!!ml&&ml in n}function Mi(n){var t=n&&n.constructor;return n===("function"==typeof t&&t.prototype||gl)}function Fi(n){return n===n&&!fc(n)}function Ni(n,t){return function(r){return null!=r&&(r[n]===t&&(t!==X||n in ll(r)))}}function Pi(n){var t=Cf(n,function(n){return r.size===fn&&r.clear(),n}),r=t.cache;return t}function qi(n,t){var r=n[1],e=t[1],u=r|e,i=u<(_n|vn|mn),o=e==mn&&r==yn||e==mn&&r==xn&&n[7].length<=t[8]||e==(mn|xn)&&t[7].length<=t[8]&&r==yn;
if(!i&&!o)return n;e&_n&&(n[2]=t[2],u|=r&_n?0:gn);var f=t[3];if(f){var c=n[3];n[3]=c?Uu(c,f,t[4]):f,n[4]=c?N(n[3],cn):t[4]}return f=t[5],f&&(c=n[5],n[5]=c?Bu(c,f,t[6]):f,n[6]=c?N(n[5],cn):t[6]),f=t[7],f&&(n[7]=f),e&mn&&(n[8]=null==n[8]?t[8]:Hl(n[8],t[8])),null==n[9]&&(n[9]=t[9]),n[0]=t[0],n[1]=u,n}function Zi(n){var t=[];if(null!=n)for(var r in ll(n))t.push(r);return t}function Ki(n){return xl.call(n)}function Vi(t,r,e){return r=Gl(r===X?t.length-1:r,0),function(){for(var u=arguments,i=-1,o=Gl(u.length-r,0),f=il(o);++i<o;)f[i]=u[r+i];
i=-1;for(var c=il(r+1);++i<r;)c[i]=u[i];return c[r]=e(f),n(t,this,c)}}function Gi(n,t){return t.length<2?n:_e(n,au(t,0,-1))}function Hi(n,t){for(var r=n.length,e=Hl(t.length,r),u=Tu(n);e--;){var i=t[e];n[e]=Ci(i,r)?u[i]:X}return n}function Ji(n,t){if(("constructor"!==t||"function"!=typeof n[t])&&"__proto__"!=t)return n[t]}function Yi(n,t,r){var e=t+"";return Ls(n,Wi(e,ro(Ii(e),r)))}function Qi(n){var t=0,r=0;return function(){var e=Jl(),u=In-(e-r);if(r=e,u>0){if(++t>=On)return arguments[0]}else t=0;
return n.apply(X,arguments)}}function Xi(n,t){var r=-1,e=n.length,u=e-1;for(t=t===X?e:t;++r<t;){var i=tu(r,u),o=n[i];n[i]=n[r],n[r]=o}return n.length=t,n}function no(n){if("string"==typeof n||bc(n))return n;var t=n+"";return"0"==t&&1/n==-Sn?"-0":t}function to(n){if(null!=n){try{return dl.call(n)}catch(n){}try{return n+""}catch(n){}}return""}function ro(n,t){return r($n,function(r){var e="_."+r[0];t&r[1]&&!o(n,e)&&n.push(e)}),n.sort()}function eo(n){if(n instanceof Ct)return n.clone();var t=new Y(n.__wrapped__,n.__chain__);
return t.__actions__=Tu(n.__actions__),t.__index__=n.__index__,t.__values__=n.__values__,t}function uo(n,t,r){t=(r?Ui(n,t,r):t===X)?1:Gl(kc(t),0);var e=null==n?0:n.length;if(!e||t<1)return[];for(var u=0,i=0,o=il(Fl(e/t));u<e;)o[i++]=au(n,u,u+=t);return o}function io(n){for(var t=-1,r=null==n?0:n.length,e=0,u=[];++t<r;){var i=n[t];i&&(u[e++]=i)}return u}function oo(){var n=arguments.length;if(!n)return[];for(var t=il(n-1),r=arguments[0],e=n;e--;)t[e-1]=arguments[e];return a(bh(r)?Tu(r):[r],ee(t,1));
}function fo(n,t,r){var e=null==n?0:n.length;return e?(t=r||t===X?1:kc(t),au(n,t<0?0:t,e)):[]}function co(n,t,r){var e=null==n?0:n.length;return e?(t=r||t===X?1:kc(t),t=e-t,au(n,0,t<0?0:t)):[]}function ao(n,t){return n&&n.length?bu(n,mi(t,3),!0,!0):[]}function lo(n,t){return n&&n.length?bu(n,mi(t,3),!0):[]}function so(n,t,r,e){var u=null==n?0:n.length;return u?(r&&"number"!=typeof r&&Ui(n,t,r)&&(r=0,e=u),ne(n,t,r,e)):[]}function ho(n,t,r){var e=null==n?0:n.length;if(!e)return-1;var u=null==r?0:kc(r);
return u<0&&(u=Gl(e+u,0)),g(n,mi(t,3),u)}function po(n,t,r){var e=null==n?0:n.length;if(!e)return-1;var u=e-1;return r!==X&&(u=kc(r),u=r<0?Gl(e+u,0):Hl(u,e-1)),g(n,mi(t,3),u,!0)}function _o(n){return(null==n?0:n.length)?ee(n,1):[]}function vo(n){return(null==n?0:n.length)?ee(n,Sn):[]}function go(n,t){return(null==n?0:n.length)?(t=t===X?1:kc(t),ee(n,t)):[]}function yo(n){for(var t=-1,r=null==n?0:n.length,e={};++t<r;){var u=n[t];e[u[0]]=u[1]}return e}function bo(n){return n&&n.length?n[0]:X}function wo(n,t,r){
var e=null==n?0:n.length;if(!e)return-1;var u=null==r?0:kc(r);return u<0&&(u=Gl(e+u,0)),y(n,t,u)}function mo(n){return(null==n?0:n.length)?au(n,0,-1):[]}function xo(n,t){return null==n?"":Kl.call(n,t)}function jo(n){var t=null==n?0:n.length;return t?n[t-1]:X}function Ao(n,t,r){var e=null==n?0:n.length;if(!e)return-1;var u=e;return r!==X&&(u=kc(r),u=u<0?Gl(e+u,0):Hl(u,e-1)),t===t?K(n,t,u):g(n,b,u,!0)}function ko(n,t){return n&&n.length?Ge(n,kc(t)):X}function Oo(n,t){return n&&n.length&&t&&t.length?Xe(n,t):n;
}function Io(n,t,r){return n&&n.length&&t&&t.length?Xe(n,t,mi(r,2)):n}function Ro(n,t,r){return n&&n.length&&t&&t.length?Xe(n,t,X,r):n}function zo(n,t){var r=[];if(!n||!n.length)return r;var e=-1,u=[],i=n.length;for(t=mi(t,3);++e<i;){var o=n[e];t(o,e,n)&&(r.push(o),u.push(e))}return nu(n,u),r}function Eo(n){return null==n?n:Xl.call(n)}function So(n,t,r){var e=null==n?0:n.length;return e?(r&&"number"!=typeof r&&Ui(n,t,r)?(t=0,r=e):(t=null==t?0:kc(t),r=r===X?e:kc(r)),au(n,t,r)):[]}function Wo(n,t){
return su(n,t)}function Lo(n,t,r){return hu(n,t,mi(r,2))}function Co(n,t){var r=null==n?0:n.length;if(r){var e=su(n,t);if(e<r&&Gf(n[e],t))return e}return-1}function Uo(n,t){return su(n,t,!0)}function Bo(n,t,r){return hu(n,t,mi(r,2),!0)}function To(n,t){if(null==n?0:n.length){var r=su(n,t,!0)-1;if(Gf(n[r],t))return r}return-1}function $o(n){return n&&n.length?pu(n):[]}function Do(n,t){return n&&n.length?pu(n,mi(t,2)):[]}function Mo(n){var t=null==n?0:n.length;return t?au(n,1,t):[]}function Fo(n,t,r){
return n&&n.length?(t=r||t===X?1:kc(t),au(n,0,t<0?0:t)):[]}function No(n,t,r){var e=null==n?0:n.length;return e?(t=r||t===X?1:kc(t),t=e-t,au(n,t<0?0:t,e)):[]}function Po(n,t){return n&&n.length?bu(n,mi(t,3),!1,!0):[]}function qo(n,t){return n&&n.length?bu(n,mi(t,3)):[]}function Zo(n){return n&&n.length?gu(n):[]}function Ko(n,t){return n&&n.length?gu(n,mi(t,2)):[]}function Vo(n,t){return t="function"==typeof t?t:X,n&&n.length?gu(n,X,t):[]}function Go(n){if(!n||!n.length)return[];var t=0;return n=i(n,function(n){
if(Jf(n))return t=Gl(n.length,t),!0}),O(t,function(t){return c(n,m(t))})}function Ho(t,r){if(!t||!t.length)return[];var e=Go(t);return null==r?e:c(e,function(t){return n(r,X,t)})}function Jo(n,t){return xu(n||[],t||[],Sr)}function Yo(n,t){return xu(n||[],t||[],fu)}function Qo(n){var t=Z(n);return t.__chain__=!0,t}function Xo(n,t){return t(n),n}function nf(n,t){return t(n)}function tf(){return Qo(this)}function rf(){return new Y(this.value(),this.__chain__)}function ef(){this.__values__===X&&(this.__values__=jc(this.value()));
var n=this.__index__>=this.__values__.length;return{done:n,value:n?X:this.__values__[this.__index__++]}}function uf(){return this}function of(n){for(var t,r=this;r instanceof J;){var e=eo(r);e.__index__=0,e.__values__=X,t?u.__wrapped__=e:t=e;var u=e;r=r.__wrapped__}return u.__wrapped__=n,t}function ff(){var n=this.__wrapped__;if(n instanceof Ct){var t=n;return this.__actions__.length&&(t=new Ct(this)),t=t.reverse(),t.__actions__.push({func:nf,args:[Eo],thisArg:X}),new Y(t,this.__chain__)}return this.thru(Eo);
}function cf(){return wu(this.__wrapped__,this.__actions__)}function af(n,t,r){var e=bh(n)?u:Jr;return r&&Ui(n,t,r)&&(t=X),e(n,mi(t,3))}function lf(n,t){return(bh(n)?i:te)(n,mi(t,3))}function sf(n,t){return ee(yf(n,t),1)}function hf(n,t){return ee(yf(n,t),Sn)}function pf(n,t,r){return r=r===X?1:kc(r),ee(yf(n,t),r)}function _f(n,t){return(bh(n)?r:ys)(n,mi(t,3))}function vf(n,t){return(bh(n)?e:ds)(n,mi(t,3))}function gf(n,t,r,e){n=Hf(n)?n:ra(n),r=r&&!e?kc(r):0;var u=n.length;return r<0&&(r=Gl(u+r,0)),
dc(n)?r<=u&&n.indexOf(t,r)>-1:!!u&&y(n,t,r)>-1}function yf(n,t){return(bh(n)?c:Pe)(n,mi(t,3))}function df(n,t,r,e){return null==n?[]:(bh(t)||(t=null==t?[]:[t]),r=e?X:r,bh(r)||(r=null==r?[]:[r]),He(n,t,r))}function bf(n,t,r){var e=bh(n)?l:j,u=arguments.length<3;return e(n,mi(t,4),r,u,ys)}function wf(n,t,r){var e=bh(n)?s:j,u=arguments.length<3;return e(n,mi(t,4),r,u,ds)}function mf(n,t){return(bh(n)?i:te)(n,Uf(mi(t,3)))}function xf(n){return(bh(n)?Ir:iu)(n)}function jf(n,t,r){return t=(r?Ui(n,t,r):t===X)?1:kc(t),
(bh(n)?Rr:ou)(n,t)}function Af(n){return(bh(n)?zr:cu)(n)}function kf(n){if(null==n)return 0;if(Hf(n))return dc(n)?V(n):n.length;var t=zs(n);return t==Gn||t==tt?n.size:Me(n).length}function Of(n,t,r){var e=bh(n)?h:lu;return r&&Ui(n,t,r)&&(t=X),e(n,mi(t,3))}function If(n,t){if("function"!=typeof t)throw new pl(en);return n=kc(n),function(){if(--n<1)return t.apply(this,arguments)}}function Rf(n,t,r){return t=r?X:t,t=n&&null==t?n.length:t,ai(n,mn,X,X,X,X,t)}function zf(n,t){var r;if("function"!=typeof t)throw new pl(en);
return n=kc(n),function(){return--n>0&&(r=t.apply(this,arguments)),n<=1&&(t=X),r}}function Ef(n,t,r){t=r?X:t;var e=ai(n,yn,X,X,X,X,X,t);return e.placeholder=Ef.placeholder,e}function Sf(n,t,r){t=r?X:t;var e=ai(n,dn,X,X,X,X,X,t);return e.placeholder=Sf.placeholder,e}function Wf(n,t,r){function e(t){var r=h,e=p;return h=p=X,d=t,v=n.apply(e,r)}function u(n){return d=n,g=Ws(f,t),b?e(n):v}function i(n){var r=n-y,e=n-d,u=t-r;return w?Hl(u,_-e):u}function o(n){var r=n-y,e=n-d;return y===X||r>=t||r<0||w&&e>=_;
}function f(){var n=fh();return o(n)?c(n):(g=Ws(f,i(n)),X)}function c(n){return g=X,m&&h?e(n):(h=p=X,v)}function a(){g!==X&&As(g),d=0,h=y=p=g=X}function l(){return g===X?v:c(fh())}function s(){var n=fh(),r=o(n);if(h=arguments,p=this,y=n,r){if(g===X)return u(y);if(w)return As(g),g=Ws(f,t),e(y)}return g===X&&(g=Ws(f,t)),v}var h,p,_,v,g,y,d=0,b=!1,w=!1,m=!0;if("function"!=typeof n)throw new pl(en);return t=Ic(t)||0,fc(r)&&(b=!!r.leading,w="maxWait"in r,_=w?Gl(Ic(r.maxWait)||0,t):_,m="trailing"in r?!!r.trailing:m),
s.cancel=a,s.flush=l,s}function Lf(n){return ai(n,jn)}function Cf(n,t){if("function"!=typeof n||null!=t&&"function"!=typeof t)throw new pl(en);var r=function(){var e=arguments,u=t?t.apply(this,e):e[0],i=r.cache;if(i.has(u))return i.get(u);var o=n.apply(this,e);return r.cache=i.set(u,o)||i,o};return r.cache=new(Cf.Cache||sr),r}function Uf(n){if("function"!=typeof n)throw new pl(en);return function(){var t=arguments;switch(t.length){case 0:return!n.call(this);case 1:return!n.call(this,t[0]);case 2:
return!n.call(this,t[0],t[1]);case 3:return!n.call(this,t[0],t[1],t[2])}return!n.apply(this,t)}}function Bf(n){return zf(2,n)}function Tf(n,t){if("function"!=typeof n)throw new pl(en);return t=t===X?t:kc(t),uu(n,t)}function $f(t,r){if("function"!=typeof t)throw new pl(en);return r=null==r?0:Gl(kc(r),0),uu(function(e){var u=e[r],i=Ou(e,0,r);return u&&a(i,u),n(t,this,i)})}function Df(n,t,r){var e=!0,u=!0;if("function"!=typeof n)throw new pl(en);return fc(r)&&(e="leading"in r?!!r.leading:e,u="trailing"in r?!!r.trailing:u),
Wf(n,t,{leading:e,maxWait:t,trailing:u})}function Mf(n){return Rf(n,1)}function Ff(n,t){return ph(Au(t),n)}function Nf(){if(!arguments.length)return[];var n=arguments[0];return bh(n)?n:[n]}function Pf(n){return Fr(n,sn)}function qf(n,t){return t="function"==typeof t?t:X,Fr(n,sn,t)}function Zf(n){return Fr(n,an|sn)}function Kf(n,t){return t="function"==typeof t?t:X,Fr(n,an|sn,t)}function Vf(n,t){return null==t||Pr(n,t,Pc(t))}function Gf(n,t){return n===t||n!==n&&t!==t}function Hf(n){return null!=n&&oc(n.length)&&!uc(n);
}function Jf(n){return cc(n)&&Hf(n)}function Yf(n){return n===!0||n===!1||cc(n)&&we(n)==Nn}function Qf(n){return cc(n)&&1===n.nodeType&&!gc(n)}function Xf(n){if(null==n)return!0;if(Hf(n)&&(bh(n)||"string"==typeof n||"function"==typeof n.splice||mh(n)||Oh(n)||dh(n)))return!n.length;var t=zs(n);if(t==Gn||t==tt)return!n.size;if(Mi(n))return!Me(n).length;for(var r in n)if(bl.call(n,r))return!1;return!0}function nc(n,t){return Se(n,t)}function tc(n,t,r){r="function"==typeof r?r:X;var e=r?r(n,t):X;return e===X?Se(n,t,X,r):!!e;
}function rc(n){if(!cc(n))return!1;var t=we(n);return t==Zn||t==qn||"string"==typeof n.message&&"string"==typeof n.name&&!gc(n)}function ec(n){return"number"==typeof n&&Zl(n)}function uc(n){if(!fc(n))return!1;var t=we(n);return t==Kn||t==Vn||t==Fn||t==Xn}function ic(n){return"number"==typeof n&&n==kc(n)}function oc(n){return"number"==typeof n&&n>-1&&n%1==0&&n<=Wn}function fc(n){var t=typeof n;return null!=n&&("object"==t||"function"==t)}function cc(n){return null!=n&&"object"==typeof n}function ac(n,t){
return n===t||Ce(n,t,ji(t))}function lc(n,t,r){return r="function"==typeof r?r:X,Ce(n,t,ji(t),r)}function sc(n){return vc(n)&&n!=+n}function hc(n){if(Es(n))throw new fl(rn);return Ue(n)}function pc(n){return null===n}function _c(n){return null==n}function vc(n){return"number"==typeof n||cc(n)&&we(n)==Hn}function gc(n){if(!cc(n)||we(n)!=Yn)return!1;var t=El(n);if(null===t)return!0;var r=bl.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&dl.call(r)==jl}function yc(n){
return ic(n)&&n>=-Wn&&n<=Wn}function dc(n){return"string"==typeof n||!bh(n)&&cc(n)&&we(n)==rt}function bc(n){return"symbol"==typeof n||cc(n)&&we(n)==et}function wc(n){return n===X}function mc(n){return cc(n)&&zs(n)==it}function xc(n){return cc(n)&&we(n)==ot}function jc(n){if(!n)return[];if(Hf(n))return dc(n)?G(n):Tu(n);if(Ul&&n[Ul])return D(n[Ul]());var t=zs(n);return(t==Gn?M:t==tt?P:ra)(n)}function Ac(n){if(!n)return 0===n?n:0;if(n=Ic(n),n===Sn||n===-Sn){return(n<0?-1:1)*Ln}return n===n?n:0}function kc(n){
var t=Ac(n),r=t%1;return t===t?r?t-r:t:0}function Oc(n){return n?Mr(kc(n),0,Un):0}function Ic(n){if("number"==typeof n)return n;if(bc(n))return Cn;if(fc(n)){var t="function"==typeof n.valueOf?n.valueOf():n;n=fc(t)?t+"":t}if("string"!=typeof n)return 0===n?n:+n;n=R(n);var r=qt.test(n);return r||Kt.test(n)?Xr(n.slice(2),r?2:8):Pt.test(n)?Cn:+n}function Rc(n){return $u(n,qc(n))}function zc(n){return n?Mr(kc(n),-Wn,Wn):0===n?n:0}function Ec(n){return null==n?"":vu(n)}function Sc(n,t){var r=gs(n);return null==t?r:Cr(r,t);
}function Wc(n,t){return v(n,mi(t,3),ue)}function Lc(n,t){return v(n,mi(t,3),oe)}function Cc(n,t){return null==n?n:bs(n,mi(t,3),qc)}function Uc(n,t){return null==n?n:ws(n,mi(t,3),qc)}function Bc(n,t){return n&&ue(n,mi(t,3))}function Tc(n,t){return n&&oe(n,mi(t,3))}function $c(n){return null==n?[]:fe(n,Pc(n))}function Dc(n){return null==n?[]:fe(n,qc(n))}function Mc(n,t,r){var e=null==n?X:_e(n,t);return e===X?r:e}function Fc(n,t){return null!=n&&Ri(n,t,xe)}function Nc(n,t){return null!=n&&Ri(n,t,je);
}function Pc(n){return Hf(n)?Or(n):Me(n)}function qc(n){return Hf(n)?Or(n,!0):Fe(n)}function Zc(n,t){var r={};return t=mi(t,3),ue(n,function(n,e,u){Br(r,t(n,e,u),n)}),r}function Kc(n,t){var r={};return t=mi(t,3),ue(n,function(n,e,u){Br(r,e,t(n,e,u))}),r}function Vc(n,t){return Gc(n,Uf(mi(t)))}function Gc(n,t){if(null==n)return{};var r=c(di(n),function(n){return[n]});return t=mi(t),Ye(n,r,function(n,r){return t(n,r[0])})}function Hc(n,t,r){t=ku(t,n);var e=-1,u=t.length;for(u||(u=1,n=X);++e<u;){var i=null==n?X:n[no(t[e])];
i===X&&(e=u,i=r),n=uc(i)?i.call(n):i}return n}function Jc(n,t,r){return null==n?n:fu(n,t,r)}function Yc(n,t,r,e){return e="function"==typeof e?e:X,null==n?n:fu(n,t,r,e)}function Qc(n,t,e){var u=bh(n),i=u||mh(n)||Oh(n);if(t=mi(t,4),null==e){var o=n&&n.constructor;e=i?u?new o:[]:fc(n)&&uc(o)?gs(El(n)):{}}return(i?r:ue)(n,function(n,r,u){return t(e,n,r,u)}),e}function Xc(n,t){return null==n||yu(n,t)}function na(n,t,r){return null==n?n:du(n,t,Au(r))}function ta(n,t,r,e){return e="function"==typeof e?e:X,
null==n?n:du(n,t,Au(r),e)}function ra(n){return null==n?[]:E(n,Pc(n))}function ea(n){return null==n?[]:E(n,qc(n))}function ua(n,t,r){return r===X&&(r=t,t=X),r!==X&&(r=Ic(r),r=r===r?r:0),t!==X&&(t=Ic(t),t=t===t?t:0),Mr(Ic(n),t,r)}function ia(n,t,r){return t=Ac(t),r===X?(r=t,t=0):r=Ac(r),n=Ic(n),Ae(n,t,r)}function oa(n,t,r){if(r&&"boolean"!=typeof r&&Ui(n,t,r)&&(t=r=X),r===X&&("boolean"==typeof t?(r=t,t=X):"boolean"==typeof n&&(r=n,n=X)),n===X&&t===X?(n=0,t=1):(n=Ac(n),t===X?(t=n,n=0):t=Ac(t)),n>t){
var e=n;n=t,t=e}if(r||n%1||t%1){var u=Ql();return Hl(n+u*(t-n+Qr("1e-"+((u+"").length-1))),t)}return tu(n,t)}function fa(n){return Qh(Ec(n).toLowerCase())}function ca(n){return n=Ec(n),n&&n.replace(Gt,ve).replace(Dr,"")}function aa(n,t,r){n=Ec(n),t=vu(t);var e=n.length;r=r===X?e:Mr(kc(r),0,e);var u=r;return r-=t.length,r>=0&&n.slice(r,u)==t}function la(n){return n=Ec(n),n&&At.test(n)?n.replace(xt,ge):n}function sa(n){return n=Ec(n),n&&Wt.test(n)?n.replace(St,"\\$&"):n}function ha(n,t,r){n=Ec(n),t=kc(t);
var e=t?V(n):0;if(!t||e>=t)return n;var u=(t-e)/2;return ri(Nl(u),r)+n+ri(Fl(u),r)}function pa(n,t,r){n=Ec(n),t=kc(t);var e=t?V(n):0;return t&&e<t?n+ri(t-e,r):n}function _a(n,t,r){n=Ec(n),t=kc(t);var e=t?V(n):0;return t&&e<t?ri(t-e,r)+n:n}function va(n,t,r){return r||null==t?t=0:t&&(t=+t),Yl(Ec(n).replace(Lt,""),t||0)}function ga(n,t,r){return t=(r?Ui(n,t,r):t===X)?1:kc(t),eu(Ec(n),t)}function ya(){var n=arguments,t=Ec(n[0]);return n.length<3?t:t.replace(n[1],n[2])}function da(n,t,r){return r&&"number"!=typeof r&&Ui(n,t,r)&&(t=r=X),
(r=r===X?Un:r>>>0)?(n=Ec(n),n&&("string"==typeof t||null!=t&&!Ah(t))&&(t=vu(t),!t&&T(n))?Ou(G(n),0,r):n.split(t,r)):[]}function ba(n,t,r){return n=Ec(n),r=null==r?0:Mr(kc(r),0,n.length),t=vu(t),n.slice(r,r+t.length)==t}function wa(n,t,r){var e=Z.templateSettings;r&&Ui(n,t,r)&&(t=X),n=Ec(n),t=Sh({},t,e,li);var u,i,o=Sh({},t.imports,e.imports,li),f=Pc(o),c=E(o,f),a=0,l=t.interpolate||Ht,s="__p += '",h=sl((t.escape||Ht).source+"|"+l.source+"|"+(l===It?Ft:Ht).source+"|"+(t.evaluate||Ht).source+"|$","g"),p="//# sourceURL="+(bl.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Zr+"]")+"\n";
n.replace(h,function(t,r,e,o,f,c){return e||(e=o),s+=n.slice(a,c).replace(Jt,U),r&&(u=!0,s+="' +\n__e("+r+") +\n'"),f&&(i=!0,s+="';\n"+f+";\n__p += '"),e&&(s+="' +\n((__t = ("+e+")) == null ? '' : __t) +\n'"),a=c+t.length,t}),s+="';\n";var _=bl.call(t,"variable")&&t.variable;if(_){if(Dt.test(_))throw new fl(un)}else s="with (obj) {\n"+s+"\n}\n";s=(i?s.replace(dt,""):s).replace(bt,"$1").replace(wt,"$1;"),s="function("+(_||"obj")+") {\n"+(_?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(u?", __e = _.escape":"")+(i?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+s+"return __p\n}";
var v=Xh(function(){return cl(f,p+"return "+s).apply(X,c)});if(v.source=s,rc(v))throw v;return v}function ma(n){return Ec(n).toLowerCase()}function xa(n){return Ec(n).toUpperCase()}function ja(n,t,r){if(n=Ec(n),n&&(r||t===X))return R(n);if(!n||!(t=vu(t)))return n;var e=G(n),u=G(t);return Ou(e,W(e,u),L(e,u)+1).join("")}function Aa(n,t,r){if(n=Ec(n),n&&(r||t===X))return n.slice(0,H(n)+1);if(!n||!(t=vu(t)))return n;var e=G(n);return Ou(e,0,L(e,G(t))+1).join("")}function ka(n,t,r){if(n=Ec(n),n&&(r||t===X))return n.replace(Lt,"");
if(!n||!(t=vu(t)))return n;var e=G(n);return Ou(e,W(e,G(t))).join("")}function Oa(n,t){var r=An,e=kn;if(fc(t)){var u="separator"in t?t.separator:u;r="length"in t?kc(t.length):r,e="omission"in t?vu(t.omission):e}n=Ec(n);var i=n.length;if(T(n)){var o=G(n);i=o.length}if(r>=i)return n;var f=r-V(e);if(f<1)return e;var c=o?Ou(o,0,f).join(""):n.slice(0,f);if(u===X)return c+e;if(o&&(f+=c.length-f),Ah(u)){if(n.slice(f).search(u)){var a,l=c;for(u.global||(u=sl(u.source,Ec(Nt.exec(u))+"g")),u.lastIndex=0;a=u.exec(l);)var s=a.index;
c=c.slice(0,s===X?f:s)}}else if(n.indexOf(vu(u),f)!=f){var h=c.lastIndexOf(u);h>-1&&(c=c.slice(0,h))}return c+e}function Ia(n){return n=Ec(n),n&&jt.test(n)?n.replace(mt,ye):n}function Ra(n,t,r){return n=Ec(n),t=r?X:t,t===X?$(n)?Q(n):_(n):n.match(t)||[]}function za(t){var r=null==t?0:t.length,e=mi();return t=r?c(t,function(n){if("function"!=typeof n[1])throw new pl(en);return[e(n[0]),n[1]]}):[],uu(function(e){for(var u=-1;++u<r;){var i=t[u];if(n(i[0],this,e))return n(i[1],this,e)}})}function Ea(n){
return Nr(Fr(n,an))}function Sa(n){return function(){return n}}function Wa(n,t){return null==n||n!==n?t:n}function La(n){return n}function Ca(n){return De("function"==typeof n?n:Fr(n,an))}function Ua(n){return qe(Fr(n,an))}function Ba(n,t){return Ze(n,Fr(t,an))}function Ta(n,t,e){var u=Pc(t),i=fe(t,u);null!=e||fc(t)&&(i.length||!u.length)||(e=t,t=n,n=this,i=fe(t,Pc(t)));var o=!(fc(e)&&"chain"in e&&!e.chain),f=uc(n);return r(i,function(r){var e=t[r];n[r]=e,f&&(n.prototype[r]=function(){var t=this.__chain__;
if(o||t){var r=n(this.__wrapped__);return(r.__actions__=Tu(this.__actions__)).push({func:e,args:arguments,thisArg:n}),r.__chain__=t,r}return e.apply(n,a([this.value()],arguments))})}),n}function $a(){return re._===this&&(re._=Al),this}function Da(){}function Ma(n){return n=kc(n),uu(function(t){return Ge(t,n)})}function Fa(n){return Bi(n)?m(no(n)):Qe(n)}function Na(n){return function(t){return null==n?X:_e(n,t)}}function Pa(){return[]}function qa(){return!1}function Za(){return{}}function Ka(){return"";
}function Va(){return!0}function Ga(n,t){if(n=kc(n),n<1||n>Wn)return[];var r=Un,e=Hl(n,Un);t=mi(t),n-=Un;for(var u=O(e,t);++r<n;)t(r);return u}function Ha(n){return bh(n)?c(n,no):bc(n)?[n]:Tu(Cs(Ec(n)))}function Ja(n){var t=++wl;return Ec(n)+t}function Ya(n){return n&&n.length?Yr(n,La,me):X}function Qa(n,t){return n&&n.length?Yr(n,mi(t,2),me):X}function Xa(n){return w(n,La)}function nl(n,t){return w(n,mi(t,2))}function tl(n){return n&&n.length?Yr(n,La,Ne):X}function rl(n,t){return n&&n.length?Yr(n,mi(t,2),Ne):X;
}function el(n){return n&&n.length?k(n,La):0}function ul(n,t){return n&&n.length?k(n,mi(t,2)):0}x=null==x?re:be.defaults(re.Object(),x,be.pick(re,qr));var il=x.Array,ol=x.Date,fl=x.Error,cl=x.Function,al=x.Math,ll=x.Object,sl=x.RegExp,hl=x.String,pl=x.TypeError,_l=il.prototype,vl=cl.prototype,gl=ll.prototype,yl=x["__core-js_shared__"],dl=vl.toString,bl=gl.hasOwnProperty,wl=0,ml=function(){var n=/[^.]+$/.exec(yl&&yl.keys&&yl.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""}(),xl=gl.toString,jl=dl.call(ll),Al=re._,kl=sl("^"+dl.call(bl).replace(St,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ol=ie?x.Buffer:X,Il=x.Symbol,Rl=x.Uint8Array,zl=Ol?Ol.allocUnsafe:X,El=F(ll.getPrototypeOf,ll),Sl=ll.create,Wl=gl.propertyIsEnumerable,Ll=_l.splice,Cl=Il?Il.isConcatSpreadable:X,Ul=Il?Il.iterator:X,Bl=Il?Il.toStringTag:X,Tl=function(){
try{var n=Ai(ll,"defineProperty");return n({},"",{}),n}catch(n){}}(),$l=x.clearTimeout!==re.clearTimeout&&x.clearTimeout,Dl=ol&&ol.now!==re.Date.now&&ol.now,Ml=x.setTimeout!==re.setTimeout&&x.setTimeout,Fl=al.ceil,Nl=al.floor,Pl=ll.getOwnPropertySymbols,ql=Ol?Ol.isBuffer:X,Zl=x.isFinite,Kl=_l.join,Vl=F(ll.keys,ll),Gl=al.max,Hl=al.min,Jl=ol.now,Yl=x.parseInt,Ql=al.random,Xl=_l.reverse,ns=Ai(x,"DataView"),ts=Ai(x,"Map"),rs=Ai(x,"Promise"),es=Ai(x,"Set"),us=Ai(x,"WeakMap"),is=Ai(ll,"create"),os=us&&new us,fs={},cs=to(ns),as=to(ts),ls=to(rs),ss=to(es),hs=to(us),ps=Il?Il.prototype:X,_s=ps?ps.valueOf:X,vs=ps?ps.toString:X,gs=function(){
function n(){}return function(t){if(!fc(t))return{};if(Sl)return Sl(t);n.prototype=t;var r=new n;return n.prototype=X,r}}();Z.templateSettings={escape:kt,evaluate:Ot,interpolate:It,variable:"",imports:{_:Z}},Z.prototype=J.prototype,Z.prototype.constructor=Z,Y.prototype=gs(J.prototype),Y.prototype.constructor=Y,Ct.prototype=gs(J.prototype),Ct.prototype.constructor=Ct,Xt.prototype.clear=nr,Xt.prototype.delete=tr,Xt.prototype.get=rr,Xt.prototype.has=er,Xt.prototype.set=ur,ir.prototype.clear=or,ir.prototype.delete=fr,
ir.prototype.get=cr,ir.prototype.has=ar,ir.prototype.set=lr,sr.prototype.clear=hr,sr.prototype.delete=pr,sr.prototype.get=_r,sr.prototype.has=vr,sr.prototype.set=gr,yr.prototype.add=yr.prototype.push=dr,yr.prototype.has=br,wr.prototype.clear=mr,wr.prototype.delete=xr,wr.prototype.get=jr,wr.prototype.has=Ar,wr.prototype.set=kr;var ys=Pu(ue),ds=Pu(oe,!0),bs=qu(),ws=qu(!0),ms=os?function(n,t){return os.set(n,t),n}:La,xs=Tl?function(n,t){return Tl(n,"toString",{configurable:!0,enumerable:!1,value:Sa(t),
writable:!0})}:La,js=uu,As=$l||function(n){return re.clearTimeout(n)},ks=es&&1/P(new es([,-0]))[1]==Sn?function(n){return new es(n)}:Da,Os=os?function(n){return os.get(n)}:Da,Is=Pl?function(n){return null==n?[]:(n=ll(n),i(Pl(n),function(t){return Wl.call(n,t)}))}:Pa,Rs=Pl?function(n){for(var t=[];n;)a(t,Is(n)),n=El(n);return t}:Pa,zs=we;(ns&&zs(new ns(new ArrayBuffer(1)))!=ct||ts&&zs(new ts)!=Gn||rs&&zs(rs.resolve())!=Qn||es&&zs(new es)!=tt||us&&zs(new us)!=it)&&(zs=function(n){var t=we(n),r=t==Yn?n.constructor:X,e=r?to(r):"";
if(e)switch(e){case cs:return ct;case as:return Gn;case ls:return Qn;case ss:return tt;case hs:return it}return t});var Es=yl?uc:qa,Ss=Qi(ms),Ws=Ml||function(n,t){return re.setTimeout(n,t)},Ls=Qi(xs),Cs=Pi(function(n){var t=[];return 46===n.charCodeAt(0)&&t.push(""),n.replace(Et,function(n,r,e,u){t.push(e?u.replace(Mt,"$1"):r||n)}),t}),Us=uu(function(n,t){return Jf(n)?Hr(n,ee(t,1,Jf,!0)):[]}),Bs=uu(function(n,t){var r=jo(t);return Jf(r)&&(r=X),Jf(n)?Hr(n,ee(t,1,Jf,!0),mi(r,2)):[]}),Ts=uu(function(n,t){
var r=jo(t);return Jf(r)&&(r=X),Jf(n)?Hr(n,ee(t,1,Jf,!0),X,r):[]}),$s=uu(function(n){var t=c(n,ju);return t.length&&t[0]===n[0]?ke(t):[]}),Ds=uu(function(n){var t=jo(n),r=c(n,ju);return t===jo(r)?t=X:r.pop(),r.length&&r[0]===n[0]?ke(r,mi(t,2)):[]}),Ms=uu(function(n){var t=jo(n),r=c(n,ju);return t="function"==typeof t?t:X,t&&r.pop(),r.length&&r[0]===n[0]?ke(r,X,t):[]}),Fs=uu(Oo),Ns=gi(function(n,t){var r=null==n?0:n.length,e=Tr(n,t);return nu(n,c(t,function(n){return Ci(n,r)?+n:n}).sort(Lu)),e}),Ps=uu(function(n){
return gu(ee(n,1,Jf,!0))}),qs=uu(function(n){var t=jo(n);return Jf(t)&&(t=X),gu(ee(n,1,Jf,!0),mi(t,2))}),Zs=uu(function(n){var t=jo(n);return t="function"==typeof t?t:X,gu(ee(n,1,Jf,!0),X,t)}),Ks=uu(function(n,t){return Jf(n)?Hr(n,t):[]}),Vs=uu(function(n){return mu(i(n,Jf))}),Gs=uu(function(n){var t=jo(n);return Jf(t)&&(t=X),mu(i(n,Jf),mi(t,2))}),Hs=uu(function(n){var t=jo(n);return t="function"==typeof t?t:X,mu(i(n,Jf),X,t)}),Js=uu(Go),Ys=uu(function(n){var t=n.length,r=t>1?n[t-1]:X;return r="function"==typeof r?(n.pop(),
r):X,Ho(n,r)}),Qs=gi(function(n){var t=n.length,r=t?n[0]:0,e=this.__wrapped__,u=function(t){return Tr(t,n)};return!(t>1||this.__actions__.length)&&e instanceof Ct&&Ci(r)?(e=e.slice(r,+r+(t?1:0)),e.__actions__.push({func:nf,args:[u],thisArg:X}),new Y(e,this.__chain__).thru(function(n){return t&&!n.length&&n.push(X),n})):this.thru(u)}),Xs=Fu(function(n,t,r){bl.call(n,r)?++n[r]:Br(n,r,1)}),nh=Ju(ho),th=Ju(po),rh=Fu(function(n,t,r){bl.call(n,r)?n[r].push(t):Br(n,r,[t])}),eh=uu(function(t,r,e){var u=-1,i="function"==typeof r,o=Hf(t)?il(t.length):[];
return ys(t,function(t){o[++u]=i?n(r,t,e):Ie(t,r,e)}),o}),uh=Fu(function(n,t,r){Br(n,r,t)}),ih=Fu(function(n,t,r){n[r?0:1].push(t)},function(){return[[],[]]}),oh=uu(function(n,t){if(null==n)return[];var r=t.length;return r>1&&Ui(n,t[0],t[1])?t=[]:r>2&&Ui(t[0],t[1],t[2])&&(t=[t[0]]),He(n,ee(t,1),[])}),fh=Dl||function(){return re.Date.now()},ch=uu(function(n,t,r){var e=_n;if(r.length){var u=N(r,wi(ch));e|=bn}return ai(n,e,t,r,u)}),ah=uu(function(n,t,r){var e=_n|vn;if(r.length){var u=N(r,wi(ah));e|=bn;
}return ai(t,e,n,r,u)}),lh=uu(function(n,t){return Gr(n,1,t)}),sh=uu(function(n,t,r){return Gr(n,Ic(t)||0,r)});Cf.Cache=sr;var hh=js(function(t,r){r=1==r.length&&bh(r[0])?c(r[0],z(mi())):c(ee(r,1),z(mi()));var e=r.length;return uu(function(u){for(var i=-1,o=Hl(u.length,e);++i<o;)u[i]=r[i].call(this,u[i]);return n(t,this,u)})}),ph=uu(function(n,t){return ai(n,bn,X,t,N(t,wi(ph)))}),_h=uu(function(n,t){return ai(n,wn,X,t,N(t,wi(_h)))}),vh=gi(function(n,t){return ai(n,xn,X,X,X,t)}),gh=ii(me),yh=ii(function(n,t){
return n>=t}),dh=Re(function(){return arguments}())?Re:function(n){return cc(n)&&bl.call(n,"callee")&&!Wl.call(n,"callee")},bh=il.isArray,wh=ce?z(ce):ze,mh=ql||qa,xh=ae?z(ae):Ee,jh=le?z(le):Le,Ah=se?z(se):Be,kh=he?z(he):Te,Oh=pe?z(pe):$e,Ih=ii(Ne),Rh=ii(function(n,t){return n<=t}),zh=Nu(function(n,t){if(Mi(t)||Hf(t))return $u(t,Pc(t),n),X;for(var r in t)bl.call(t,r)&&Sr(n,r,t[r])}),Eh=Nu(function(n,t){$u(t,qc(t),n)}),Sh=Nu(function(n,t,r,e){$u(t,qc(t),n,e)}),Wh=Nu(function(n,t,r,e){$u(t,Pc(t),n,e);
}),Lh=gi(Tr),Ch=uu(function(n,t){n=ll(n);var r=-1,e=t.length,u=e>2?t[2]:X;for(u&&Ui(t[0],t[1],u)&&(e=1);++r<e;)for(var i=t[r],o=qc(i),f=-1,c=o.length;++f<c;){var a=o[f],l=n[a];(l===X||Gf(l,gl[a])&&!bl.call(n,a))&&(n[a]=i[a])}return n}),Uh=uu(function(t){return t.push(X,si),n(Mh,X,t)}),Bh=Xu(function(n,t,r){null!=t&&"function"!=typeof t.toString&&(t=xl.call(t)),n[t]=r},Sa(La)),Th=Xu(function(n,t,r){null!=t&&"function"!=typeof t.toString&&(t=xl.call(t)),bl.call(n,t)?n[t].push(r):n[t]=[r]},mi),$h=uu(Ie),Dh=Nu(function(n,t,r){
Ke(n,t,r)}),Mh=Nu(function(n,t,r,e){Ke(n,t,r,e)}),Fh=gi(function(n,t){var r={};if(null==n)return r;var e=!1;t=c(t,function(t){return t=ku(t,n),e||(e=t.length>1),t}),$u(n,di(n),r),e&&(r=Fr(r,an|ln|sn,hi));for(var u=t.length;u--;)yu(r,t[u]);return r}),Nh=gi(function(n,t){return null==n?{}:Je(n,t)}),Ph=ci(Pc),qh=ci(qc),Zh=Vu(function(n,t,r){return t=t.toLowerCase(),n+(r?fa(t):t)}),Kh=Vu(function(n,t,r){return n+(r?"-":"")+t.toLowerCase()}),Vh=Vu(function(n,t,r){return n+(r?" ":"")+t.toLowerCase()}),Gh=Ku("toLowerCase"),Hh=Vu(function(n,t,r){
return n+(r?"_":"")+t.toLowerCase()}),Jh=Vu(function(n,t,r){return n+(r?" ":"")+Qh(t)}),Yh=Vu(function(n,t,r){return n+(r?" ":"")+t.toUpperCase()}),Qh=Ku("toUpperCase"),Xh=uu(function(t,r){try{return n(t,X,r)}catch(n){return rc(n)?n:new fl(n)}}),np=gi(function(n,t){return r(t,function(t){t=no(t),Br(n,t,ch(n[t],n))}),n}),tp=Yu(),rp=Yu(!0),ep=uu(function(n,t){return function(r){return Ie(r,n,t)}}),up=uu(function(n,t){return function(r){return Ie(n,r,t)}}),ip=ti(c),op=ti(u),fp=ti(h),cp=ui(),ap=ui(!0),lp=ni(function(n,t){
return n+t},0),sp=fi("ceil"),hp=ni(function(n,t){return n/t},1),pp=fi("floor"),_p=ni(function(n,t){return n*t},1),vp=fi("round"),gp=ni(function(n,t){return n-t},0);return Z.after=If,Z.ary=Rf,Z.assign=zh,Z.assignIn=Eh,Z.assignInWith=Sh,Z.assignWith=Wh,Z.at=Lh,Z.before=zf,Z.bind=ch,Z.bindAll=np,Z.bindKey=ah,Z.castArray=Nf,Z.chain=Qo,Z.chunk=uo,Z.compact=io,Z.concat=oo,Z.cond=za,Z.conforms=Ea,Z.constant=Sa,Z.countBy=Xs,Z.create=Sc,Z.curry=Ef,Z.curryRight=Sf,Z.debounce=Wf,Z.defaults=Ch,Z.defaultsDeep=Uh,
Z.defer=lh,Z.delay=sh,Z.difference=Us,Z.differenceBy=Bs,Z.differenceWith=Ts,Z.drop=fo,Z.dropRight=co,Z.dropRightWhile=ao,Z.dropWhile=lo,Z.fill=so,Z.filter=lf,Z.flatMap=sf,Z.flatMapDeep=hf,Z.flatMapDepth=pf,Z.flatten=_o,Z.flattenDeep=vo,Z.flattenDepth=go,Z.flip=Lf,Z.flow=tp,Z.flowRight=rp,Z.fromPairs=yo,Z.functions=$c,Z.functionsIn=Dc,Z.groupBy=rh,Z.initial=mo,Z.intersection=$s,Z.intersectionBy=Ds,Z.intersectionWith=Ms,Z.invert=Bh,Z.invertBy=Th,Z.invokeMap=eh,Z.iteratee=Ca,Z.keyBy=uh,Z.keys=Pc,Z.keysIn=qc,
Z.map=yf,Z.mapKeys=Zc,Z.mapValues=Kc,Z.matches=Ua,Z.matchesProperty=Ba,Z.memoize=Cf,Z.merge=Dh,Z.mergeWith=Mh,Z.method=ep,Z.methodOf=up,Z.mixin=Ta,Z.negate=Uf,Z.nthArg=Ma,Z.omit=Fh,Z.omitBy=Vc,Z.once=Bf,Z.orderBy=df,Z.over=ip,Z.overArgs=hh,Z.overEvery=op,Z.overSome=fp,Z.partial=ph,Z.partialRight=_h,Z.partition=ih,Z.pick=Nh,Z.pickBy=Gc,Z.property=Fa,Z.propertyOf=Na,Z.pull=Fs,Z.pullAll=Oo,Z.pullAllBy=Io,Z.pullAllWith=Ro,Z.pullAt=Ns,Z.range=cp,Z.rangeRight=ap,Z.rearg=vh,Z.reject=mf,Z.remove=zo,Z.rest=Tf,
Z.reverse=Eo,Z.sampleSize=jf,Z.set=Jc,Z.setWith=Yc,Z.shuffle=Af,Z.slice=So,Z.sortBy=oh,Z.sortedUniq=$o,Z.sortedUniqBy=Do,Z.split=da,Z.spread=$f,Z.tail=Mo,Z.take=Fo,Z.takeRight=No,Z.takeRightWhile=Po,Z.takeWhile=qo,Z.tap=Xo,Z.throttle=Df,Z.thru=nf,Z.toArray=jc,Z.toPairs=Ph,Z.toPairsIn=qh,Z.toPath=Ha,Z.toPlainObject=Rc,Z.transform=Qc,Z.unary=Mf,Z.union=Ps,Z.unionBy=qs,Z.unionWith=Zs,Z.uniq=Zo,Z.uniqBy=Ko,Z.uniqWith=Vo,Z.unset=Xc,Z.unzip=Go,Z.unzipWith=Ho,Z.update=na,Z.updateWith=ta,Z.values=ra,Z.valuesIn=ea,
Z.without=Ks,Z.words=Ra,Z.wrap=Ff,Z.xor=Vs,Z.xorBy=Gs,Z.xorWith=Hs,Z.zip=Js,Z.zipObject=Jo,Z.zipObjectDeep=Yo,Z.zipWith=Ys,Z.entries=Ph,Z.entriesIn=qh,Z.extend=Eh,Z.extendWith=Sh,Ta(Z,Z),Z.add=lp,Z.attempt=Xh,Z.camelCase=Zh,Z.capitalize=fa,Z.ceil=sp,Z.clamp=ua,Z.clone=Pf,Z.cloneDeep=Zf,Z.cloneDeepWith=Kf,Z.cloneWith=qf,Z.conformsTo=Vf,Z.deburr=ca,Z.defaultTo=Wa,Z.divide=hp,Z.endsWith=aa,Z.eq=Gf,Z.escape=la,Z.escapeRegExp=sa,Z.every=af,Z.find=nh,Z.findIndex=ho,Z.findKey=Wc,Z.findLast=th,Z.findLastIndex=po,
Z.findLastKey=Lc,Z.floor=pp,Z.forEach=_f,Z.forEachRight=vf,Z.forIn=Cc,Z.forInRight=Uc,Z.forOwn=Bc,Z.forOwnRight=Tc,Z.get=Mc,Z.gt=gh,Z.gte=yh,Z.has=Fc,Z.hasIn=Nc,Z.head=bo,Z.identity=La,Z.includes=gf,Z.indexOf=wo,Z.inRange=ia,Z.invoke=$h,Z.isArguments=dh,Z.isArray=bh,Z.isArrayBuffer=wh,Z.isArrayLike=Hf,Z.isArrayLikeObject=Jf,Z.isBoolean=Yf,Z.isBuffer=mh,Z.isDate=xh,Z.isElement=Qf,Z.isEmpty=Xf,Z.isEqual=nc,Z.isEqualWith=tc,Z.isError=rc,Z.isFinite=ec,Z.isFunction=uc,Z.isInteger=ic,Z.isLength=oc,Z.isMap=jh,
Z.isMatch=ac,Z.isMatchWith=lc,Z.isNaN=sc,Z.isNative=hc,Z.isNil=_c,Z.isNull=pc,Z.isNumber=vc,Z.isObject=fc,Z.isObjectLike=cc,Z.isPlainObject=gc,Z.isRegExp=Ah,Z.isSafeInteger=yc,Z.isSet=kh,Z.isString=dc,Z.isSymbol=bc,Z.isTypedArray=Oh,Z.isUndefined=wc,Z.isWeakMap=mc,Z.isWeakSet=xc,Z.join=xo,Z.kebabCase=Kh,Z.last=jo,Z.lastIndexOf=Ao,Z.lowerCase=Vh,Z.lowerFirst=Gh,Z.lt=Ih,Z.lte=Rh,Z.max=Ya,Z.maxBy=Qa,Z.mean=Xa,Z.meanBy=nl,Z.min=tl,Z.minBy=rl,Z.stubArray=Pa,Z.stubFalse=qa,Z.stubObject=Za,Z.stubString=Ka,
Z.stubTrue=Va,Z.multiply=_p,Z.nth=ko,Z.noConflict=$a,Z.noop=Da,Z.now=fh,Z.pad=ha,Z.padEnd=pa,Z.padStart=_a,Z.parseInt=va,Z.random=oa,Z.reduce=bf,Z.reduceRight=wf,Z.repeat=ga,Z.replace=ya,Z.result=Hc,Z.round=vp,Z.runInContext=p,Z.sample=xf,Z.size=kf,Z.snakeCase=Hh,Z.some=Of,Z.sortedIndex=Wo,Z.sortedIndexBy=Lo,Z.sortedIndexOf=Co,Z.sortedLastIndex=Uo,Z.sortedLastIndexBy=Bo,Z.sortedLastIndexOf=To,Z.startCase=Jh,Z.startsWith=ba,Z.subtract=gp,Z.sum=el,Z.sumBy=ul,Z.template=wa,Z.times=Ga,Z.toFinite=Ac,Z.toInteger=kc,
Z.toLength=Oc,Z.toLower=ma,Z.toNumber=Ic,Z.toSafeInteger=zc,Z.toString=Ec,Z.toUpper=xa,Z.trim=ja,Z.trimEnd=Aa,Z.trimStart=ka,Z.truncate=Oa,Z.unescape=Ia,Z.uniqueId=Ja,Z.upperCase=Yh,Z.upperFirst=Qh,Z.each=_f,Z.eachRight=vf,Z.first=bo,Ta(Z,function(){var n={};return ue(Z,function(t,r){bl.call(Z.prototype,r)||(n[r]=t)}),n}(),{chain:!1}),Z.VERSION=nn,r(["bind","bindKey","curry","curryRight","partial","partialRight"],function(n){Z[n].placeholder=Z}),r(["drop","take"],function(n,t){Ct.prototype[n]=function(r){
r=r===X?1:Gl(kc(r),0);var e=this.__filtered__&&!t?new Ct(this):this.clone();return e.__filtered__?e.__takeCount__=Hl(r,e.__takeCount__):e.__views__.push({size:Hl(r,Un),type:n+(e.__dir__<0?"Right":"")}),e},Ct.prototype[n+"Right"]=function(t){return this.reverse()[n](t).reverse()}}),r(["filter","map","takeWhile"],function(n,t){var r=t+1,e=r==Rn||r==En;Ct.prototype[n]=function(n){var t=this.clone();return t.__iteratees__.push({iteratee:mi(n,3),type:r}),t.__filtered__=t.__filtered__||e,t}}),r(["head","last"],function(n,t){
var r="take"+(t?"Right":"");Ct.prototype[n]=function(){return this[r](1).value()[0]}}),r(["initial","tail"],function(n,t){var r="drop"+(t?"":"Right");Ct.prototype[n]=function(){return this.__filtered__?new Ct(this):this[r](1)}}),Ct.prototype.compact=function(){return this.filter(La)},Ct.prototype.find=function(n){return this.filter(n).head()},Ct.prototype.findLast=function(n){return this.reverse().find(n)},Ct.prototype.invokeMap=uu(function(n,t){return"function"==typeof n?new Ct(this):this.map(function(r){
return Ie(r,n,t)})}),Ct.prototype.reject=function(n){return this.filter(Uf(mi(n)))},Ct.prototype.slice=function(n,t){n=kc(n);var r=this;return r.__filtered__&&(n>0||t<0)?new Ct(r):(n<0?r=r.takeRight(-n):n&&(r=r.drop(n)),t!==X&&(t=kc(t),r=t<0?r.dropRight(-t):r.take(t-n)),r)},Ct.prototype.takeRightWhile=function(n){return this.reverse().takeWhile(n).reverse()},Ct.prototype.toArray=function(){return this.take(Un)},ue(Ct.prototype,function(n,t){var r=/^(?:filter|find|map|reject)|While$/.test(t),e=/^(?:head|last)$/.test(t),u=Z[e?"take"+("last"==t?"Right":""):t],i=e||/^find/.test(t);
u&&(Z.prototype[t]=function(){var t=this.__wrapped__,o=e?[1]:arguments,f=t instanceof Ct,c=o[0],l=f||bh(t),s=function(n){var t=u.apply(Z,a([n],o));return e&&h?t[0]:t};l&&r&&"function"==typeof c&&1!=c.length&&(f=l=!1);var h=this.__chain__,p=!!this.__actions__.length,_=i&&!h,v=f&&!p;if(!i&&l){t=v?t:new Ct(this);var g=n.apply(t,o);return g.__actions__.push({func:nf,args:[s],thisArg:X}),new Y(g,h)}return _&&v?n.apply(this,o):(g=this.thru(s),_?e?g.value()[0]:g.value():g)})}),r(["pop","push","shift","sort","splice","unshift"],function(n){
var t=_l[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:pop|shift)$/.test(n);Z.prototype[n]=function(){var n=arguments;if(e&&!this.__chain__){var u=this.value();return t.apply(bh(u)?u:[],n)}return this[r](function(r){return t.apply(bh(r)?r:[],n)})}}),ue(Ct.prototype,function(n,t){var r=Z[t];if(r){var e=r.name+"";bl.call(fs,e)||(fs[e]=[]),fs[e].push({name:t,func:r})}}),fs[Qu(X,vn).name]=[{name:"wrapper",func:X}],Ct.prototype.clone=$t,Ct.prototype.reverse=Yt,Ct.prototype.value=Qt,Z.prototype.at=Qs,
Z.prototype.chain=tf,Z.prototype.commit=rf,Z.prototype.next=ef,Z.prototype.plant=of,Z.prototype.reverse=ff,Z.prototype.toJSON=Z.prototype.valueOf=Z.prototype.value=cf,Z.prototype.first=Z.prototype.head,Ul&&(Z.prototype[Ul]=uf),Z},be=de();"function"==typeof define&&"object"==typeof define.amd&&define.amd?(re._=be,define(function(){return be})):ue?((ue.exports=be)._=be,ee._=be):re._=be}).call(this);

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

@@ -0,0 +1,420 @@
(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 = {
// Lodash aliases.
'each': 'forEach',
'eachRight': 'forEachRight',
'entries': 'toPairs',
'entriesIn': 'toPairsIn',
'extend': 'assignIn',
'extendAll': 'assignInAll',
'extendAllWith': 'assignInAllWith',
'extendWith': 'assignInWith',
'first': 'head',
// Methods that are curried variants of others.
'conforms': 'conformsTo',
'matches': 'isMatch',
'property': 'get',
// Ramda aliases.
'__': 'placeholder',
'F': 'stubFalse',
'T': 'stubTrue',
'all': 'every',
'allPass': 'overEvery',
'always': 'constant',
'any': 'some',
'anyPass': 'overSome',
'apply': 'spread',
'assoc': 'set',
'assocPath': 'set',
'complement': 'negate',
'compose': 'flowRight',
'contains': 'includes',
'dissoc': 'unset',
'dissocPath': 'unset',
'dropLast': 'dropRight',
'dropLastWhile': 'dropRightWhile',
'equals': 'isEqual',
'identical': 'eq',
'indexBy': 'keyBy',
'init': 'initial',
'invertObj': 'invert',
'juxt': 'over',
'omitAll': 'omit',
'nAry': 'ary',
'path': 'get',
'pathEq': 'matchesProperty',
'pathOr': 'getOr',
'paths': 'at',
'pickAll': 'pick',
'pipe': 'flow',
'pluck': 'map',
'prop': 'get',
'propEq': 'matchesProperty',
'propOr': 'getOr',
'props': 'at',
'symmetricDifference': 'xor',
'symmetricDifferenceBy': 'xorBy',
'symmetricDifferenceWith': 'xorWith',
'takeLast': 'takeRight',
'takeLastWhile': 'takeRightWhile',
'unapply': 'rest',
'unnest': 'flatten',
'useWith': 'overArgs',
'where': 'conformsTo',
'whereEq': 'isMatch',
'zipObj': 'zipObject'
};
/** Used to map ary to method names. */
exports.aryMethod = {
'1': [
'assignAll', 'assignInAll', 'attempt', 'castArray', 'ceil', 'create',
'curry', 'curryRight', 'defaultsAll', 'defaultsDeepAll', 'floor', 'flow',
'flowRight', 'fromPairs', 'invert', 'iteratee', 'memoize', 'method', 'mergeAll',
'methodOf', 'mixin', 'nthArg', 'over', 'overEvery', 'overSome','rest', 'reverse',
'round', 'runInContext', 'spread', 'template', 'trim', 'trimEnd', 'trimStart',
'uniqueId', 'words', 'zipAll'
],
'2': [
'add', 'after', 'ary', 'assign', 'assignAllWith', 'assignIn', 'assignInAllWith',
'at', 'before', 'bind', 'bindAll', 'bindKey', 'chunk', 'cloneDeepWith',
'cloneWith', 'concat', 'conformsTo', 'countBy', 'curryN', 'curryRightN',
'debounce', 'defaults', 'defaultsDeep', 'defaultTo', 'delay', 'difference',
'divide', 'drop', 'dropRight', 'dropRightWhile', 'dropWhile', 'endsWith', 'eq',
'every', 'filter', 'find', 'findIndex', 'findKey', 'findLast', 'findLastIndex',
'findLastKey', 'flatMap', 'flatMapDeep', 'flattenDepth', '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', 'meanBy', 'merge', 'mergeAllWith', 'minBy', 'multiply', 'nth', 'omit',
'omitBy', 'overArgs', 'pad', 'padEnd', 'padStart', 'parseInt', 'partial',
'partialRight', 'partition', 'pick', 'pickBy', 'propertyOf', 'pull', 'pullAll',
'pullAt', 'random', 'range', 'rangeRight', 'rearg', 'reject', 'remove',
'repeat', 'restFrom', 'result', 'sampleSize', 'some', 'sortBy', 'sortedIndex',
'sortedIndexOf', 'sortedLastIndex', 'sortedLastIndexOf', 'sortedUniqBy',
'split', 'spreadFrom', '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',
'findFrom', 'findIndexFrom', 'findLastFrom', 'findLastIndexFrom', 'getOr',
'includesFrom', 'indexOfFrom', 'inRange', 'intersectionBy', 'intersectionWith',
'invokeArgs', 'invokeArgsMap', 'isEqualWith', 'isMatchWith', 'flatMapDepth',
'lastIndexOfFrom', 'mergeWith', 'orderBy', 'padChars', 'padCharsEnd',
'padCharsStart', 'pullAllBy', 'pullAllWith', 'rangeStep', 'rangeStepRight',
'reduce', 'reduceRight', 'replace', 'set', 'slice', 'sortedIndexBy',
'sortedLastIndexBy', 'transform', 'unionBy', 'unionWith', 'update', 'xorBy',
'xorWith', 'zipWith'
],
'4': [
'fill', 'setWith', 'updateWith'
]
};
/** Used to map ary to rearg configs. */
exports.aryRearg = {
'2': [1, 0],
'3': [2, 0, 1],
'4': [3, 2, 0, 1]
};
/** Used to map method names to their iteratee ary. */
exports.iterateeAry = {
'dropRightWhile': 1,
'dropWhile': 1,
'every': 1,
'filter': 1,
'find': 1,
'findFrom': 1,
'findIndex': 1,
'findIndexFrom': 1,
'findKey': 1,
'findLast': 1,
'findLastFrom': 1,
'findLastIndex': 1,
'findLastIndexFrom': 1,
'findLastKey': 1,
'flatMap': 1,
'flatMapDeep': 1,
'flatMapDepth': 1,
'forEach': 1,
'forEachRight': 1,
'forIn': 1,
'forInRight': 1,
'forOwn': 1,
'forOwnRight': 1,
'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 = {
'mapKeys': [1],
'reduceRight': [1, 0]
};
/** Used to map method names to rearg configs. */
exports.methodRearg = {
'assignInAllWith': [1, 0],
'assignInWith': [1, 2, 0],
'assignAllWith': [1, 0],
'assignWith': [1, 2, 0],
'differenceBy': [1, 2, 0],
'differenceWith': [1, 2, 0],
'getOr': [2, 1, 0],
'intersectionBy': [1, 2, 0],
'intersectionWith': [1, 2, 0],
'isEqualWith': [1, 2, 0],
'isMatchWith': [2, 1, 0],
'mergeAllWith': [1, 0],
'mergeWith': [1, 2, 0],
'padChars': [2, 1, 0],
'padCharsEnd': [2, 1, 0],
'padCharsStart': [2, 1, 0],
'pullAllBy': [2, 1, 0],
'pullAllWith': [2, 1, 0],
'rangeStep': [1, 2, 0],
'rangeStepRight': [1, 2, 0],
'setWith': [3, 1, 2, 0],
'sortedIndexBy': [2, 1, 0],
'sortedLastIndexBy': [2, 1, 0],
'unionBy': [1, 2, 0],
'unionWith': [1, 2, 0],
'updateWith': [3, 1, 2, 0],
'xorBy': [1, 2, 0],
'xorWith': [1, 2, 0],
'zipWith': [1, 2, 0]
};
/** Used to map method names to spread configs. */
exports.methodSpread = {
'assignAll': { 'start': 0 },
'assignAllWith': { 'start': 0 },
'assignInAll': { 'start': 0 },
'assignInAllWith': { 'start': 0 },
'defaultsAll': { 'start': 0 },
'defaultsDeepAll': { 'start': 0 },
'invokeArgs': { 'start': 2 },
'invokeArgsMap': { 'start': 2 },
'mergeAll': { 'start': 0 },
'mergeAllWith': { 'start': 0 },
'partial': { 'start': 1 },
'partialRight': { 'start': 1 },
'without': { 'start': 1 },
'zipAll': { 'start': 0 }
};
/** Used to identify methods which mutate arrays or objects. */
exports.mutate = {
'array': {
'fill': true,
'pull': true,
'pullAll': true,
'pullAllBy': true,
'pullAllWith': true,
'pullAt': true,
'remove': true,
'reverse': true
},
'object': {
'assign': true,
'assignAll': true,
'assignAllWith': true,
'assignIn': true,
'assignInAll': true,
'assignInAllWith': true,
'assignInWith': true,
'assignWith': true,
'defaults': true,
'defaultsAll': true,
'defaultsDeep': true,
'defaultsDeepAll': true,
'merge': true,
'mergeAll': true,
'mergeAllWith': true,
'mergeWith': true,
},
'set': {
'set': true,
'setWith': true,
'unset': true,
'update': true,
'updateWith': 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.remap = {
'assignAll': 'assign',
'assignAllWith': 'assignWith',
'assignInAll': 'assignIn',
'assignInAllWith': 'assignInWith',
'curryN': 'curry',
'curryRightN': 'curryRight',
'defaultsAll': 'defaults',
'defaultsDeepAll': 'defaultsDeep',
'findFrom': 'find',
'findIndexFrom': 'findIndex',
'findLastFrom': 'findLast',
'findLastIndexFrom': 'findLastIndex',
'getOr': 'get',
'includesFrom': 'includes',
'indexOfFrom': 'indexOf',
'invokeArgs': 'invoke',
'invokeArgsMap': 'invokeMap',
'lastIndexOfFrom': 'lastIndexOf',
'mergeAll': 'merge',
'mergeAllWith': 'mergeWith',
'padChars': 'pad',
'padCharsEnd': 'padEnd',
'padCharsStart': 'padStart',
'propertyOf': 'get',
'rangeStep': 'range',
'rangeStepRight': 'rangeRight',
'restFrom': 'rest',
'spreadFrom': 'spread',
'trimChars': 'trim',
'trimCharsEnd': 'trimEnd',
'trimCharsStart': 'trimStart',
'zipAll': 'zip'
};
/** Used to track methods that skip fixing their arity. */
exports.skipFixed = {
'castArray': true,
'flow': true,
'flowRight': true,
'iteratee': true,
'mixin': true,
'rearg': true,
'runInContext': true
};
/** Used to track methods that skip rearranging arguments. */
exports.skipRearg = {
'add': true,
'assign': true,
'assignIn': true,
'bind': true,
'bindKey': true,
'concat': true,
'difference': true,
'divide': true,
'eq': true,
'gt': true,
'gte': true,
'isEqual': true,
'lt': true,
'lte': true,
'matchesProperty': true,
'merge': true,
'multiply': true,
'overArgs': true,
'partial': true,
'partialRight': true,
'propertyOf': true,
'random': true,
'range': true,
'rangeRight': true,
'subtract': true,
'zip': true,
'zipObject': true,
'zipObjectDeep': true
};
/***/ })
/******/ ])
});
;

File diff suppressed because it is too large Load Diff

569
fp/_baseConvert.js Normal file
View File

@@ -0,0 +1,569 @@
var mapping = require('./_mapping'),
fallbackHolder = require('./placeholder');
/** Built-in value reference. */
var push = Array.prototype.push;
/**
* Creates a function, with an arity of `n`, that invokes `func` with the
* arguments it receives.
*
* @private
* @param {Function} func The function to wrap.
* @param {number} n The arity of the new function.
* @returns {Function} Returns the new function.
*/
function baseArity(func, n) {
return n == 2
? function(a, b) { return func.apply(undefined, arguments); }
: function(a) { return func.apply(undefined, arguments); };
}
/**
* Creates a function that invokes `func`, with up to `n` arguments, ignoring
* any additional arguments.
*
* @private
* @param {Function} func The function to cap arguments for.
* @param {number} n The arity cap.
* @returns {Function} Returns the new function.
*/
function baseAry(func, n) {
return n == 2
? function(a, b) { return func(a, b); }
: function(a) { return func(a); };
}
/**
* Creates a clone of `array`.
*
* @private
* @param {Array} array The array to clone.
* @returns {Array} Returns the cloned array.
*/
function cloneArray(array) {
var length = array ? array.length : 0,
result = Array(length);
while (length--) {
result[length] = array[length];
}
return result;
}
/**
* Creates a function that clones a given object using the assignment `func`.
*
* @private
* @param {Function} func The assignment function.
* @returns {Function} Returns the new cloner function.
*/
function createCloner(func) {
return function(object) {
return func({}, object);
};
}
/**
* A specialized version of `_.spread` which flattens the spread array into
* the arguments of the invoked `func`.
*
* @private
* @param {Function} func The function to spread arguments over.
* @param {number} start The start position of the spread.
* @returns {Function} Returns the new function.
*/
function flatSpread(func, start) {
return function() {
var length = arguments.length,
lastIndex = length - 1,
args = Array(length);
while (length--) {
args[length] = arguments[length];
}
var array = args[start],
otherArgs = args.slice(0, start);
if (array) {
push.apply(otherArgs, array);
}
if (start != lastIndex) {
push.apply(otherArgs, args.slice(start + 1));
}
return func.apply(this, otherArgs);
};
}
/**
* Creates a function that wraps `func` and uses `cloner` to clone the first
* argument it receives.
*
* @private
* @param {Function} func The function to wrap.
* @param {Function} cloner The function to clone arguments.
* @returns {Function} Returns the new immutable function.
*/
function wrapImmutable(func, cloner) {
return function() {
var length = arguments.length;
if (!length) {
return;
}
var args = Array(length);
while (length--) {
args[length] = arguments[length];
}
var result = args[0] = cloner.apply(undefined, args);
func.apply(undefined, args);
return result;
};
}
/**
* 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 convert.
* @param {Function} func The function to convert.
* @param {Object} [options] The options object.
* @param {boolean} [options.cap=true] Specify capping iteratee arguments.
* @param {boolean} [options.curry=true] Specify currying.
* @param {boolean} [options.fixed=true] Specify fixed arity.
* @param {boolean} [options.immutable=true] Specify immutable operations.
* @param {boolean} [options.rearg=true] Specify rearranging arguments.
* @returns {Function|Object} Returns the converted function or object.
*/
function baseConvert(util, name, func, options) {
var isLib = typeof name == 'function',
isObj = name === Object(name);
if (isObj) {
options = func;
func = name;
name = undefined;
}
if (func == null) {
throw new TypeError;
}
options || (options = {});
var config = {
'cap': 'cap' in options ? options.cap : true,
'curry': 'curry' in options ? options.curry : true,
'fixed': 'fixed' in options ? options.fixed : true,
'immutable': 'immutable' in options ? options.immutable : true,
'rearg': 'rearg' in options ? options.rearg : true
};
var defaultHolder = isLib ? func : fallbackHolder,
forceCurry = ('curry' in options) && options.curry,
forceFixed = ('fixed' in options) && options.fixed,
forceRearg = ('rearg' in options) && options.rearg,
pristine = isLib ? func.runInContext() : undefined;
var helpers = isLib ? func : {
'ary': util.ary,
'assign': util.assign,
'clone': util.clone,
'curry': util.curry,
'forEach': util.forEach,
'isArray': util.isArray,
'isError': util.isError,
'isFunction': util.isFunction,
'isWeakMap': util.isWeakMap,
'iteratee': util.iteratee,
'keys': util.keys,
'rearg': util.rearg,
'toInteger': util.toInteger,
'toPath': util.toPath
};
var ary = helpers.ary,
assign = helpers.assign,
clone = helpers.clone,
curry = helpers.curry,
each = helpers.forEach,
isArray = helpers.isArray,
isError = helpers.isError,
isFunction = helpers.isFunction,
isWeakMap = helpers.isWeakMap,
keys = helpers.keys,
rearg = helpers.rearg,
toInteger = helpers.toInteger,
toPath = helpers.toPath;
var aryMethodKeys = keys(mapping.aryMethod);
var wrappers = {
'castArray': function(castArray) {
return function() {
var value = arguments[0];
return isArray(value)
? castArray(cloneArray(value))
: castArray.apply(undefined, arguments);
};
},
'iteratee': function(iteratee) {
return function() {
var func = arguments[0],
arity = arguments[1],
result = iteratee(func, arity),
length = result.length;
if (config.cap && typeof arity == 'number') {
arity = arity > 2 ? (arity - 2) : 1;
return (length && length <= arity) ? result : baseAry(result, arity);
}
return result;
};
},
'mixin': function(mixin) {
return function(source) {
var func = this;
if (!isFunction(func)) {
return mixin(func, Object(source));
}
var pairs = [];
each(keys(source), function(key) {
if (isFunction(source[key])) {
pairs.push([key, func.prototype[key]]);
}
});
mixin(func, Object(source));
each(pairs, function(pair) {
var value = pair[1];
if (isFunction(value)) {
func.prototype[pair[0]] = value;
} else {
delete func.prototype[pair[0]];
}
});
return func;
};
},
'nthArg': function(nthArg) {
return function(n) {
var arity = n < 0 ? 1 : (toInteger(n) + 1);
return curry(nthArg(n), arity);
};
},
'rearg': function(rearg) {
return function(func, indexes) {
var arity = indexes ? indexes.length : 0;
return curry(rearg(func, indexes), arity);
};
},
'runInContext': function(runInContext) {
return function(context) {
return baseConvert(util, runInContext(context), options);
};
}
};
/*--------------------------------------------------------------------------*/
/**
* Casts `func` to a function with an arity capped iteratee if needed.
*
* @private
* @param {string} name The name of the function to inspect.
* @param {Function} func The function to inspect.
* @returns {Function} Returns the cast function.
*/
function castCap(name, func) {
if (config.cap) {
var indexes = mapping.iterateeRearg[name];
if (indexes) {
return iterateeRearg(func, indexes);
}
var n = !isLib && mapping.iterateeAry[name];
if (n) {
return iterateeAry(func, n);
}
}
return func;
}
/**
* Casts `func` to a curried function if needed.
*
* @private
* @param {string} name The name of the function to inspect.
* @param {Function} func The function to inspect.
* @param {number} n The arity of `func`.
* @returns {Function} Returns the cast function.
*/
function castCurry(name, func, n) {
return (forceCurry || (config.curry && n > 1))
? curry(func, n)
: func;
}
/**
* Casts `func` to a fixed arity function if needed.
*
* @private
* @param {string} name The name of the function to inspect.
* @param {Function} func The function to inspect.
* @param {number} n The arity cap.
* @returns {Function} Returns the cast function.
*/
function castFixed(name, func, n) {
if (config.fixed && (forceFixed || !mapping.skipFixed[name])) {
var data = mapping.methodSpread[name],
start = data && data.start;
return start === undefined ? ary(func, n) : flatSpread(func, start);
}
return func;
}
/**
* Casts `func` to an rearged function if needed.
*
* @private
* @param {string} name The name of the function to inspect.
* @param {Function} func The function to inspect.
* @param {number} n The arity of `func`.
* @returns {Function} Returns the cast function.
*/
function castRearg(name, func, n) {
return (config.rearg && n > 1 && (forceRearg || !mapping.skipRearg[name]))
? rearg(func, mapping.methodRearg[name] || mapping.aryRearg[n])
: func;
}
/**
* Creates a clone of `object` by `path`.
*
* @private
* @param {Object} object The object to clone.
* @param {Array|string} path The path to clone by.
* @returns {Object} Returns the cloned object.
*/
function cloneByPath(object, path) {
path = toPath(path);
var index = -1,
length = path.length,
lastIndex = length - 1,
result = clone(Object(object)),
nested = result;
while (nested != null && ++index < length) {
var key = path[index],
value = nested[key];
if (value != null &&
!(isFunction(value) || isError(value) || isWeakMap(value))) {
nested[key] = clone(index == lastIndex ? value : Object(value));
}
nested = nested[key];
}
return result;
}
/**
* Converts `lodash` to an immutable auto-curried iteratee-first data-last
* version with conversion `options` applied.
*
* @param {Object} [options] The options object. See `baseConvert` for more details.
* @returns {Function} Returns the converted `lodash`.
*/
function convertLib(options) {
return _.runInContext.convert(options)(undefined);
}
/**
* Create a converter function for `func` of `name`.
*
* @param {string} name The name of the function to convert.
* @param {Function} func The function to convert.
* @returns {Function} Returns the new converter function.
*/
function createConverter(name, func) {
var realName = mapping.aliasToReal[name] || name,
methodName = mapping.remap[realName] || realName,
oldOptions = options;
return function(options) {
var newUtil = isLib ? pristine : helpers,
newFunc = isLib ? pristine[methodName] : func,
newOptions = assign(assign({}, oldOptions), options);
return baseConvert(newUtil, realName, newFunc, newOptions);
};
}
/**
* Creates a function that wraps `func` to invoke its iteratee, with up to `n`
* arguments, ignoring any additional arguments.
*
* @private
* @param {Function} func The function to cap iteratee arguments for.
* @param {number} n The arity cap.
* @returns {Function} Returns the new function.
*/
function iterateeAry(func, n) {
return overArg(func, function(func) {
return typeof func == 'function' ? baseAry(func, n) : func;
});
}
/**
* Creates a function that wraps `func` to invoke its iteratee with arguments
* arranged according to the specified `indexes` where the argument value at
* the first index is provided as the first argument, the argument value at
* the second index is provided as the second argument, and so on.
*
* @private
* @param {Function} func The function to rearrange iteratee arguments for.
* @param {number[]} indexes The arranged argument indexes.
* @returns {Function} Returns the new function.
*/
function iterateeRearg(func, indexes) {
return overArg(func, function(func) {
var n = indexes.length;
return baseArity(rearg(baseAry(func, n), indexes), n);
});
}
/**
* Creates a function that invokes `func` with its first argument transformed.
*
* @private
* @param {Function} func The function to wrap.
* @param {Function} transform The argument transform.
* @returns {Function} Returns the new function.
*/
function overArg(func, transform) {
return function() {
var length = arguments.length;
if (!length) {
return func();
}
var args = Array(length);
while (length--) {
args[length] = arguments[length];
}
var index = config.rearg ? 0 : (length - 1);
args[index] = transform(args[index]);
return func.apply(undefined, args);
};
}
/**
* Creates a function that wraps `func` and applys the conversions
* rules by `name`.
*
* @private
* @param {string} name The name of the function to wrap.
* @param {Function} func The function to wrap.
* @returns {Function} Returns the converted function.
*/
function wrap(name, func, placeholder) {
var result,
realName = mapping.aliasToReal[name] || name,
wrapped = func,
wrapper = wrappers[realName];
if (wrapper) {
wrapped = wrapper(func);
}
else if (config.immutable) {
if (mapping.mutate.array[realName]) {
wrapped = wrapImmutable(func, cloneArray);
}
else if (mapping.mutate.object[realName]) {
wrapped = wrapImmutable(func, createCloner(func));
}
else if (mapping.mutate.set[realName]) {
wrapped = wrapImmutable(func, cloneByPath);
}
}
each(aryMethodKeys, function(aryKey) {
each(mapping.aryMethod[aryKey], function(otherName) {
if (realName == otherName) {
var data = mapping.methodSpread[realName],
afterRearg = data && data.afterRearg;
result = afterRearg
? castFixed(realName, castRearg(realName, wrapped, aryKey), aryKey)
: castRearg(realName, castFixed(realName, wrapped, aryKey), aryKey);
result = castCap(realName, result);
result = castCurry(realName, result, aryKey);
return false;
}
});
return !result;
});
result || (result = wrapped);
if (result == func) {
result = forceCurry ? curry(result, 1) : function() {
return func.apply(this, arguments);
};
}
result.convert = createConverter(realName, func);
result.placeholder = func.placeholder = placeholder;
return result;
}
/*--------------------------------------------------------------------------*/
if (!isObj) {
return wrap(name, func, defaultHolder);
}
var _ = func;
// Convert methods by ary cap.
var pairs = [];
each(aryMethodKeys, function(aryKey) {
each(mapping.aryMethod[aryKey], function(key) {
var func = _[mapping.remap[key] || key];
if (func) {
pairs.push([key, wrap(key, func, _)]);
}
});
});
// Convert remaining methods.
each(keys(_), function(key) {
var func = _[key];
if (typeof func == 'function') {
var length = pairs.length;
while (length--) {
if (pairs[length][0] == key) {
return;
}
}
func.convert = createConverter(key, func);
pairs.push([key, func]);
}
});
// Assign to `_` leaving `_.prototype` unchanged to allow chaining.
each(pairs, function(pair) {
_[pair[0]] = pair[1];
});
_.convert = convertLib;
_.placeholder = _;
// Assign aliases.
each(keys(_), function(key) {
each(mapping.realToAlias[key] || [], function(alias) {
_[alias] = _[key];
});
});
return _;
}
module.exports = baseConvert;

18
fp/_convertBrowser.js Normal file
View File

@@ -0,0 +1,18 @@
var baseConvert = require('./_baseConvert');
/**
* Converts `lodash` to an immutable auto-curried iteratee-first data-last
* version with conversion `options` applied.
*
* @param {Function} lodash The lodash function to convert.
* @param {Object} [options] The options object. See `baseConvert` for more details.
* @returns {Function} Returns the converted `lodash`.
*/
function browserConvert(lodash, options) {
return baseConvert(lodash, lodash, options);
}
if (typeof _ == 'function' && typeof _.runInContext == 'function') {
_ = browserConvert(_.runInContext());
}
module.exports = browserConvert;

358
fp/_mapping.js Normal file
View File

@@ -0,0 +1,358 @@
/** Used to map aliases to their real names. */
exports.aliasToReal = {
// Lodash aliases.
'each': 'forEach',
'eachRight': 'forEachRight',
'entries': 'toPairs',
'entriesIn': 'toPairsIn',
'extend': 'assignIn',
'extendAll': 'assignInAll',
'extendAllWith': 'assignInAllWith',
'extendWith': 'assignInWith',
'first': 'head',
// Methods that are curried variants of others.
'conforms': 'conformsTo',
'matches': 'isMatch',
'property': 'get',
// Ramda aliases.
'__': 'placeholder',
'F': 'stubFalse',
'T': 'stubTrue',
'all': 'every',
'allPass': 'overEvery',
'always': 'constant',
'any': 'some',
'anyPass': 'overSome',
'apply': 'spread',
'assoc': 'set',
'assocPath': 'set',
'complement': 'negate',
'compose': 'flowRight',
'contains': 'includes',
'dissoc': 'unset',
'dissocPath': 'unset',
'dropLast': 'dropRight',
'dropLastWhile': 'dropRightWhile',
'equals': 'isEqual',
'identical': 'eq',
'indexBy': 'keyBy',
'init': 'initial',
'invertObj': 'invert',
'juxt': 'over',
'omitAll': 'omit',
'nAry': 'ary',
'path': 'get',
'pathEq': 'matchesProperty',
'pathOr': 'getOr',
'paths': 'at',
'pickAll': 'pick',
'pipe': 'flow',
'pluck': 'map',
'prop': 'get',
'propEq': 'matchesProperty',
'propOr': 'getOr',
'props': 'at',
'symmetricDifference': 'xor',
'symmetricDifferenceBy': 'xorBy',
'symmetricDifferenceWith': 'xorWith',
'takeLast': 'takeRight',
'takeLastWhile': 'takeRightWhile',
'unapply': 'rest',
'unnest': 'flatten',
'useWith': 'overArgs',
'where': 'conformsTo',
'whereEq': 'isMatch',
'zipObj': 'zipObject'
};
/** Used to map ary to method names. */
exports.aryMethod = {
'1': [
'assignAll', 'assignInAll', 'attempt', 'castArray', 'ceil', 'create',
'curry', 'curryRight', 'defaultsAll', 'defaultsDeepAll', 'floor', 'flow',
'flowRight', 'fromPairs', 'invert', 'iteratee', 'memoize', 'method', 'mergeAll',
'methodOf', 'mixin', 'nthArg', 'over', 'overEvery', 'overSome','rest', 'reverse',
'round', 'runInContext', 'spread', 'template', 'trim', 'trimEnd', 'trimStart',
'uniqueId', 'words', 'zipAll'
],
'2': [
'add', 'after', 'ary', 'assign', 'assignAllWith', 'assignIn', 'assignInAllWith',
'at', 'before', 'bind', 'bindAll', 'bindKey', 'chunk', 'cloneDeepWith',
'cloneWith', 'concat', 'conformsTo', 'countBy', 'curryN', 'curryRightN',
'debounce', 'defaults', 'defaultsDeep', 'defaultTo', 'delay', 'difference',
'divide', 'drop', 'dropRight', 'dropRightWhile', 'dropWhile', 'endsWith', 'eq',
'every', 'filter', 'find', 'findIndex', 'findKey', 'findLast', 'findLastIndex',
'findLastKey', 'flatMap', 'flatMapDeep', 'flattenDepth', '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', 'meanBy', 'merge', 'mergeAllWith', 'minBy', 'multiply', 'nth', 'omit',
'omitBy', 'overArgs', 'pad', 'padEnd', 'padStart', 'parseInt', 'partial',
'partialRight', 'partition', 'pick', 'pickBy', 'propertyOf', 'pull', 'pullAll',
'pullAt', 'random', 'range', 'rangeRight', 'rearg', 'reject', 'remove',
'repeat', 'restFrom', 'result', 'sampleSize', 'some', 'sortBy', 'sortedIndex',
'sortedIndexOf', 'sortedLastIndex', 'sortedLastIndexOf', 'sortedUniqBy',
'split', 'spreadFrom', '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',
'findFrom', 'findIndexFrom', 'findLastFrom', 'findLastIndexFrom', 'getOr',
'includesFrom', 'indexOfFrom', 'inRange', 'intersectionBy', 'intersectionWith',
'invokeArgs', 'invokeArgsMap', 'isEqualWith', 'isMatchWith', 'flatMapDepth',
'lastIndexOfFrom', 'mergeWith', 'orderBy', 'padChars', 'padCharsEnd',
'padCharsStart', 'pullAllBy', 'pullAllWith', 'rangeStep', 'rangeStepRight',
'reduce', 'reduceRight', 'replace', 'set', 'slice', 'sortedIndexBy',
'sortedLastIndexBy', 'transform', 'unionBy', 'unionWith', 'update', 'xorBy',
'xorWith', 'zipWith'
],
'4': [
'fill', 'setWith', 'updateWith'
]
};
/** Used to map ary to rearg configs. */
exports.aryRearg = {
'2': [1, 0],
'3': [2, 0, 1],
'4': [3, 2, 0, 1]
};
/** Used to map method names to their iteratee ary. */
exports.iterateeAry = {
'dropRightWhile': 1,
'dropWhile': 1,
'every': 1,
'filter': 1,
'find': 1,
'findFrom': 1,
'findIndex': 1,
'findIndexFrom': 1,
'findKey': 1,
'findLast': 1,
'findLastFrom': 1,
'findLastIndex': 1,
'findLastIndexFrom': 1,
'findLastKey': 1,
'flatMap': 1,
'flatMapDeep': 1,
'flatMapDepth': 1,
'forEach': 1,
'forEachRight': 1,
'forIn': 1,
'forInRight': 1,
'forOwn': 1,
'forOwnRight': 1,
'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 = {
'mapKeys': [1],
'reduceRight': [1, 0]
};
/** Used to map method names to rearg configs. */
exports.methodRearg = {
'assignInAllWith': [1, 0],
'assignInWith': [1, 2, 0],
'assignAllWith': [1, 0],
'assignWith': [1, 2, 0],
'differenceBy': [1, 2, 0],
'differenceWith': [1, 2, 0],
'getOr': [2, 1, 0],
'intersectionBy': [1, 2, 0],
'intersectionWith': [1, 2, 0],
'isEqualWith': [1, 2, 0],
'isMatchWith': [2, 1, 0],
'mergeAllWith': [1, 0],
'mergeWith': [1, 2, 0],
'padChars': [2, 1, 0],
'padCharsEnd': [2, 1, 0],
'padCharsStart': [2, 1, 0],
'pullAllBy': [2, 1, 0],
'pullAllWith': [2, 1, 0],
'rangeStep': [1, 2, 0],
'rangeStepRight': [1, 2, 0],
'setWith': [3, 1, 2, 0],
'sortedIndexBy': [2, 1, 0],
'sortedLastIndexBy': [2, 1, 0],
'unionBy': [1, 2, 0],
'unionWith': [1, 2, 0],
'updateWith': [3, 1, 2, 0],
'xorBy': [1, 2, 0],
'xorWith': [1, 2, 0],
'zipWith': [1, 2, 0]
};
/** Used to map method names to spread configs. */
exports.methodSpread = {
'assignAll': { 'start': 0 },
'assignAllWith': { 'start': 0 },
'assignInAll': { 'start': 0 },
'assignInAllWith': { 'start': 0 },
'defaultsAll': { 'start': 0 },
'defaultsDeepAll': { 'start': 0 },
'invokeArgs': { 'start': 2 },
'invokeArgsMap': { 'start': 2 },
'mergeAll': { 'start': 0 },
'mergeAllWith': { 'start': 0 },
'partial': { 'start': 1 },
'partialRight': { 'start': 1 },
'without': { 'start': 1 },
'zipAll': { 'start': 0 }
};
/** Used to identify methods which mutate arrays or objects. */
exports.mutate = {
'array': {
'fill': true,
'pull': true,
'pullAll': true,
'pullAllBy': true,
'pullAllWith': true,
'pullAt': true,
'remove': true,
'reverse': true
},
'object': {
'assign': true,
'assignAll': true,
'assignAllWith': true,
'assignIn': true,
'assignInAll': true,
'assignInAllWith': true,
'assignInWith': true,
'assignWith': true,
'defaults': true,
'defaultsAll': true,
'defaultsDeep': true,
'defaultsDeepAll': true,
'merge': true,
'mergeAll': true,
'mergeAllWith': true,
'mergeWith': true,
},
'set': {
'set': true,
'setWith': true,
'unset': true,
'update': true,
'updateWith': 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.remap = {
'assignAll': 'assign',
'assignAllWith': 'assignWith',
'assignInAll': 'assignIn',
'assignInAllWith': 'assignInWith',
'curryN': 'curry',
'curryRightN': 'curryRight',
'defaultsAll': 'defaults',
'defaultsDeepAll': 'defaultsDeep',
'findFrom': 'find',
'findIndexFrom': 'findIndex',
'findLastFrom': 'findLast',
'findLastIndexFrom': 'findLastIndex',
'getOr': 'get',
'includesFrom': 'includes',
'indexOfFrom': 'indexOf',
'invokeArgs': 'invoke',
'invokeArgsMap': 'invokeMap',
'lastIndexOfFrom': 'lastIndexOf',
'mergeAll': 'merge',
'mergeAllWith': 'mergeWith',
'padChars': 'pad',
'padCharsEnd': 'padEnd',
'padCharsStart': 'padStart',
'propertyOf': 'get',
'rangeStep': 'range',
'rangeStepRight': 'rangeRight',
'restFrom': 'rest',
'spreadFrom': 'spread',
'trimChars': 'trim',
'trimCharsEnd': 'trimEnd',
'trimCharsStart': 'trimStart',
'zipAll': 'zip'
};
/** Used to track methods that skip fixing their arity. */
exports.skipFixed = {
'castArray': true,
'flow': true,
'flowRight': true,
'iteratee': true,
'mixin': true,
'rearg': true,
'runInContext': true
};
/** Used to track methods that skip rearranging arguments. */
exports.skipRearg = {
'add': true,
'assign': true,
'assignIn': true,
'bind': true,
'bindKey': true,
'concat': true,
'difference': true,
'divide': true,
'eq': true,
'gt': true,
'gte': true,
'isEqual': true,
'lt': true,
'lte': true,
'matchesProperty': true,
'merge': true,
'multiply': true,
'overArgs': true,
'partial': true,
'partialRight': true,
'propertyOf': true,
'random': true,
'range': true,
'rangeRight': true,
'subtract': true,
'zip': true,
'zipObject': true,
'zipObjectDeep': true
};

6
fp/placeholder.js Normal file
View File

@@ -0,0 +1,6 @@
/**
* The default argument placeholder value for methods.
*
* @type {Object}
*/
module.exports = {};

71
lib/common/file.js Normal file
View File

@@ -0,0 +1,71 @@
'use strict';
const _ = require('lodash');
const fs = require('fs-extra');
const glob = require('glob');
const path = require('path');
const minify = require('../common/minify.js');
/*----------------------------------------------------------------------------*/
/**
* Creates a [fs.copy](https://github.com/jprichardson/node-fs-extra#copy)
* function with `srcPath` and `destPath` partially applied.
*
* @memberOf file
* @param {string} srcPath The path of the file to copy.
* @param {string} destPath The path to copy the file to.
* @returns {Function} Returns the partially applied function.
*/
function copy(srcPath, destPath) {
return _.partial(fs.copy, srcPath, destPath);
}
/**
* Creates an object of base name and compiled template pairs that match `pattern`.
*
* @memberOf file
* @param {string} pattern The glob pattern to be match.
* @returns {Object} Returns the object of compiled templates.
*/
function globTemplate(pattern) {
return _.transform(glob.sync(pattern), (result, filePath) => {
const key = path.basename(filePath, path.extname(filePath));
result[key] = _.template(fs.readFileSync(filePath, 'utf8'));
}, {});
}
/**
* Creates a `minify` function with `srcPath` and `destPath` partially applied.
*
* @memberOf file
* @param {string} srcPath The path of the file to minify.
* @param {string} destPath The path to write the file to.
* @returns {Function} Returns the partially applied function.
*/
function min(srcPath, destPath) {
return _.partial(minify, srcPath, destPath);
}
/**
* Creates a [fs.writeFile](https://nodejs.org/api/fs.html#fs_fs_writefile_file_data_options_callback)
* function with `filePath` and `data` partially applied.
*
* @memberOf file
* @param {string} destPath The path to write the file to.
* @param {string} data The data to write to the file.
* @returns {Function} Returns the partially applied function.
*/
function write(destPath, data) {
return _.partial(fs.writeFile, destPath, data);
}
/*----------------------------------------------------------------------------*/
module.exports = {
copy,
globTemplate,
min,
write
};

9
lib/common/mapping.js Normal file
View File

@@ -0,0 +1,9 @@
'use strict';
const _mapping = require('../../fp/_mapping');
const util = require('./util');
const Hash = util.Hash;
/*----------------------------------------------------------------------------*/
module.exports = new Hash(_mapping);

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

@@ -0,0 +1,39 @@
'use strict';
const _ = require('lodash');
const fs = require('fs-extra');
const uglify = require('uglify-js');
const uglifyOptions = require('./uglify.options');
/*----------------------------------------------------------------------------*/
/**
* Asynchronously minifies the file at `srcPath`, writes it to `destPath`, and
* invokes `callback` upon completion. The callback is invoked with one argument:
* (error).
*
* If unspecified, `destPath` is `srcPath` with an extension of `.min.js`.
* (e.g. the `destPath` of `path/to/foo.js` would be `path/to/foo.min.js`)
*
* @param {string} srcPath The path of the file to minify.
* @param {string} [destPath] The path to write the file to.
* @param {Function} callback The function invoked upon completion.
* @param {Object} [option] The UglifyJS options object.
*/
function minify(srcPath, destPath, callback, options) {
if (_.isFunction(destPath)) {
if (_.isObject(callback)) {
options = callback;
}
callback = destPath;
destPath = undefined;
}
if (!destPath) {
destPath = srcPath.replace(/(?=\.js$)/, '.min');
}
const output = uglify.minify(srcPath, _.defaults(options || {}, uglifyOptions));
fs.writeFile(destPath, output.code, 'utf-8', callback);
}
module.exports = minify;

View File

@@ -0,0 +1,22 @@
'use strict';
/**
* The UglifyJS options object for
* [compress](https://github.com/mishoo/UglifyJS2#compressor-options),
* [mangle](https://github.com/mishoo/UglifyJS2#mangler-options), and
* [output](https://github.com/mishoo/UglifyJS2#beautifier-options) options.
*/
module.exports = {
'compress': {
'collapse_vars': true,
'negate_iife': false,
'pure_getters': true,
'unsafe': true,
'warnings': false
},
'output': {
'ascii_only': true,
'comments': /@license/,
'max_line_len': 500
}
};

40
lib/common/util.js Normal file
View File

@@ -0,0 +1,40 @@
'use strict';
const _ = require('lodash');
/*----------------------------------------------------------------------------*/
/**
* Creates a hash object. If a `properties` object is provided, its own
* enumerable properties are assigned to the created hash.
*
* @memberOf util
* @param {Object} [properties] The properties to assign to the hash.
* @returns {Object} Returns the new hash object.
*/
function Hash(properties) {
return _.transform(properties, (result, value, key) => {
result[key] = (_.isPlainObject(value) && !(value instanceof Hash))
? new Hash(value)
: value;
}, this);
}
Hash.prototype = Object.create(null);
/**
* This method throws any error it receives.
*
* @memberOf util
* @param {Object} [error] The error object.
*/
function pitch(error) {
if (error != null) {
throw error;
}
}
module.exports = {
Hash,
pitch
};

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

@@ -0,0 +1,56 @@
'use strict';
const _ = require('lodash');
const async = require('async');
const path = require('path');
const webpack = require('webpack');
const file = require('../common/file');
const util = require('../common/util');
const basePath = path.join(__dirname, '..', '..');
const distPath = path.join(basePath, 'dist');
const fpPath = path.join(basePath, 'fp');
const filename = 'lodash.fp.js';
const 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
]
};
const mappingConfig = {
'entry': path.join(fpPath, '_mapping.js'),
'output': {
'path': distPath,
'filename': 'mapping.fp.js',
'library': 'mapping',
'libraryTarget': 'umd'
}
};
/*----------------------------------------------------------------------------*/
/**
* Creates browser builds of the FP converter and mappings at the `target` path.
*
* @private
* @param {string} target The output directory path.
*/
function build() {
async.series([
_.partial(webpack, mappingConfig),
_.partial(webpack, fpConfig),
file.min(path.join(distPath, filename))
], util.pitch);
}
build();

78
lib/fp/build-doc.js Normal file
View File

@@ -0,0 +1,78 @@
'use strict';
const _ = require('lodash');
const fs = require('fs-extra');
const path = require('path');
const file = require('../common/file');
const mapping = require('../common/mapping');
const util = require('../common/util');
const templatePath = path.join(__dirname, 'template/doc');
const template = file.globTemplate(path.join(templatePath, '*.jst'));
const argNames = ['a', 'b', 'c', 'd'];
const templateData = {
mapping,
toArgOrder,
toFuncList
};
/**
* Converts arranged argument `indexes` into a named argument string
* representation of their order.
*
* @private
* @param {number[]} indexes The arranged argument indexes.
* @returns {string} Returns the named argument string.
*/
function toArgOrder(indexes) {
const reordered = [];
_.each(indexes, (newIndex, index) => {
reordered[newIndex] = argNames[index];
});
return '`(' + reordered.join(', ') + ')`';
}
/**
* Converts `funcNames` into a chunked list string representation.
*
* @private
* @param {string[]} funcNames The function names.
* @returns {string} Returns the function list string.
*/
function toFuncList(funcNames) {
let chunks = _.chunk(funcNames.slice().sort(), 5);
let lastChunk = _.last(chunks);
const lastName = lastChunk ? lastChunk.pop() : undefined;
chunks = _.reject(chunks, _.isEmpty);
lastChunk = _.last(chunks);
let result = '`' + _.map(chunks, chunk => chunk.join('`, `') + '`').join(',\n`');
if (lastName == null) {
return result;
}
if (_.size(chunks) > 1 || _.size(lastChunk) > 1) {
result += ',';
}
result += ' &';
result += _.size(lastChunk) < 5 ? ' ' : '\n';
return result + '`' + lastName + '`';
}
/*----------------------------------------------------------------------------*/
/**
* Creates the FP-Guide wiki at the `target` path.
*
* @private
* @param {string} target The output file path.
*/
function build(target) {
target = path.resolve(target);
fs.writeFile(target, template.wiki(templateData), util.pitch);
}
build(_.last(process.argv));

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

@@ -0,0 +1,150 @@
'use strict';
const _ = require('lodash');
const async = require('async');
const glob = require('glob');
const path = require('path');
const file = require('../common/file');
const mapping = require('../common/mapping');
const util = require('../common/util');
const templatePath = path.join(__dirname, 'template/modules');
const template = file.globTemplate(path.join(templatePath, '*.jst'));
const aryMethods = _.union(
mapping.aryMethod[1],
mapping.aryMethod[2],
mapping.aryMethod[3],
mapping.aryMethod[4]
);
const categories = [
'array',
'collection',
'date',
'function',
'lang',
'math',
'number',
'object',
'seq',
'string',
'util'
];
const ignored = [
'_*.js',
'core.js',
'core.min.js',
'fp.js',
'index.js',
'lodash.js',
'lodash.min.js'
];
/**
* Checks if `name` is a method alias.
*
* @private
* @param {string} name The name to check.
* @returns {boolean} Returns `true` if `name` is a method alias, else `false`.
*/
function isAlias(name) {
return _.has(mapping.aliasToReal, name);
}
/**
* Checks if `name` is a category name.
*
* @private
* @param {string} name The name to check.
* @returns {boolean} Returns `true` if `name` is a category name, else `false`.
*/
function isCategory(name) {
return _.includes(categories, name);
}
/**
* Checks if `name` belongs to a method that's passed thru and not wrapped.
*
* @private
* @param {string} name The name to check.
* @returns {boolean} Returns `true` if `name` is of a pass thru method,
* else `false`.
*/
function isThru(name) {
return !_.includes(aryMethods, name);
}
/**
* Gets metadata for `func`.
*
* @private
* @param {Function} func The function to query.
* @returns {*} Returns the metadata for `func`.
*/
function getTemplate(moduleName) {
const data = {
'name': _.get(mapping.aliasToReal, moduleName, moduleName),
'mapping': mapping
};
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);
}
/*----------------------------------------------------------------------------*/
/**
* Creates FP modules at the `target` path.
*
* @private
* @param {string} target The output directory path.
*/
function build(target) {
target = path.resolve(target);
const fpPath = path.join(target, 'fp');
// Glob existing lodash module paths.
const modulePaths = glob.sync(path.join(target, '*.js'), {
'nodir': true,
'ignore': ignored.map(filename => {
return path.join(target, filename);
})
});
// Add FP alias and remapped module paths.
_.each([mapping.aliasToReal, mapping.remap], data => {
_.forOwn(data, (realName, alias) => {
const modulePath = path.join(target, alias + '.js');
if (!_.includes(modulePaths, modulePath)) {
modulePaths.push(modulePath);
}
});
});
const actions = modulePaths.map(modulePath => {
const moduleName = path.basename(modulePath, '.js');
return file.write(path.join(fpPath, moduleName + '.js'), getTemplate(moduleName));
});
actions.unshift(file.copy(path.join(__dirname, '../../fp'), fpPath));
actions.push(file.write(path.join(fpPath, '_falseOptions.js'), template._falseOptions()));
actions.push(file.write(path.join(fpPath, '_util.js'), template._util()));
actions.push(file.write(path.join(target, 'fp.js'), template.fp()));
actions.push(file.write(path.join(fpPath, 'convert.js'), template.convert()));
async.series(actions, util.pitch);
}
build(_.last(process.argv));

View File

@@ -0,0 +1,228 @@
## lodash/fp
The `lodash/fp` module promotes a more
[functional programming](https://en.wikipedia.org/wiki/Functional_programming)
(FP) friendly style by exporting an instance of `lodash` with its methods wrapped
to produce immutable auto-curried iteratee-first data-last methods.
## Installation
In a browser:
```html
<script src='https://cdn.jsdelivr.net/g/lodash@4(lodash.min.js+lodash.fp.min.js)'></script>
<script>
// Loading `lodash.fp.js` converts `_` to its fp variant.
_.defaults({ 'a': 2, 'b': 2 })({ 'a': 1 });
// ➜ { 'a': 1, 'b': 2 }
// Use `noConflict` to restore the pre-fp variant.
var fp = _.noConflict();
_.defaults({ 'a': 1 }, { 'a': 2, 'b': 2 });
// ➜ { 'a': 1, 'b': 2 }
fp.defaults({ 'a': 2, 'b': 2 })({ 'a': 1 });
// ➜ { 'a': 1, 'b': 2 }
</script>
```
In Node.js:
```js
// Load the fp build.
var fp = require('lodash/fp');
// Load a method category.
var object = require('lodash/fp/object');
// Load a single method for smaller builds with browserify/rollup/webpack.
var extend = require('lodash/fp/extend');
```
## Mapping
Immutable auto-curried iteratee-first data-last methods sound great, but what
does that really mean for each method? Below is a breakdown of the mapping used
to convert each method.
#### Capped Iteratee Arguments
Iteratee arguments are capped to avoid gotchas with variadic iteratees.
```js
// The `lodash/map` iteratee receives three arguments:
// (value, index|key, collection)
_.map(['6', '8', '10'], parseInt);
// ➜ [6, NaN, 2]
// The `lodash/fp/map` iteratee is capped at one argument:
// (value)
fp.map(parseInt)(['6', '8', '10']);
// ➜ [6, 8, 10]
```
Methods that cap iteratees to one argument:<br>
<%= toFuncList(_.keys(_.pickBy(mapping.iterateeAry, _.partial(_.eq, _, 1)))) %>
Methods that cap iteratees to two arguments:<br>
<%= toFuncList(_.keys(_.pickBy(mapping.iterateeAry, _.partial(_.eq, _, 2)))) %>
The iteratee of `mapKeys` is capped to one argument: `(key)`
#### Fixed Arity
Methods have fixed arities to support auto-currying.
```js
// `lodash/padStart` accepts an optional `chars` param.
_.padStart('a', 3, '-')
// ➜ '--a'
// `lodash/fp/padStart` does not.
fp.padStart(3)('a');
// ➜ ' a'
fp.padCharsStart('-')(3)('a');
// ➜ '--a'
```
Methods with a fixed arity of one:<br>
<%= toFuncList(_.difference(mapping.aryMethod[1], _.keys(mapping.skipFixed))) %>
Methods with a fixed arity of two:<br>
<%= toFuncList(_.difference(mapping.aryMethod[2], _.keys(mapping.skipFixed))) %>
Methods with a fixed arity of three:<br>
<%= toFuncList(_.difference(mapping.aryMethod[3], _.keys(mapping.skipFixed))) %>
Methods with a fixed arity of four:<br>
<%= toFuncList(_.difference(mapping.aryMethod[4], _.keys(mapping.skipFixed))) %>
#### Rearranged Arguments
Method arguments are rearranged to make composition easier.
```js
// `lodash/filter` is data-first iteratee-last:
// (collection, iteratee)
var compact = _.partial(_.filter, _, Boolean);
compact(['a', null, 'c']);
// ➜ ['a', 'c']
// `lodash/fp/filter` is iteratee-first data-last:
// (iteratee, collection)
var compact = fp.filter(Boolean);
compact(['a', null, 'c']);
// ➜ ['a', 'c']
```
##### Most methods follow these rules
A fixed arity of two has an argument order of:<br>
<%= toArgOrder(mapping.aryRearg[2]) %>
A fixed arity of three has an argument order of:<br>
<%= toArgOrder(mapping.aryRearg[3]) %>
A fixed arity of four has an argument order of:<br>
<%= toArgOrder(mapping.aryRearg[4]) %>
##### Exceptions to the rules
Methods that accept an array as their last, second to last, or only argument:<br>
<%= toFuncList(_.keys(mapping.methodSpread)) %>
Methods with unchanged argument orders:<br>
<%= toFuncList(_.keys(mapping.skipRearg)) %>
Methods with custom argument orders:<br>
<%= _.map(_.keys(mapping.methodRearg), methodName => {
const orders = mapping.methodRearg[methodName];
return ' * `_.' + methodName + '` has an order of ' + toArgOrder(orders);
}).join('\n') %>
The iteratee of `reduceRight` has an argument order of: `(b, a)`
#### New Methods
Not all variadic methods have corresponding new method variants. Feel free to
[request](https://github.com/lodash/lodash/blob/master/.github/CONTRIBUTING.md#feature-requests)
any additions.
Methods created to accommodate Lodashs variadic methods:<br>
<%= toFuncList(_.keys(mapping.remap)) %>
#### Aliases
There are <%= _.size(mapping.aliasToReal) %> method aliases:<br>
<%= _.map(_.keys(mapping.aliasToReal).sort(), alias => {
const realName = mapping.aliasToReal[alias];
return ' * `_.' + alias + '` is an alias of `_.' + realName + '`';
}).join('\n') %>
## Placeholders
The placeholder argument, which defaults to `_`, may be used to fill in method
arguments in a different order. Placeholders are filled by the first available
arguments of the curried returned function.
```js
// The equivalent of `2 > 5`.
_.gt(2)(5);
// ➜ false
// The equivalent of `_.gt(5, 2)` or `5 > 2`.
_.gt(_, 2)(5);
// ➜ true
```
## Chaining
The `lodash/fp` module **does not** convert chain sequence methods. See
[Izaak Schroeders article](https://medium.com/making-internets/why-using-chain-is-a-mistake-9bc1f80d51ba)
on using functional composition as an alternative to method chaining.
## Convert
Although `lodash/fp` & its method modules come pre-converted, there are times
when you may want to customize the conversion. Thats when the `convert` method
comes in handy.
```js
// Every option is `true` by default.
var _fp = fp.convert({
// Specify capping iteratee arguments.
'cap': true,
// Specify currying.
'curry': true,
// Specify fixed arity.
'fixed': true,
// Specify immutable operations.
'immutable': true,
// Specify rearranging arguments.
'rearg': true
});
// The `convert` method is available on each method too.
var mapValuesWithKey = fp.mapValues.convert({ 'cap': false });
// Heres an example of disabling iteratee argument caps to access the `key` param.
mapValuesWithKey(function(value, key) {
return key == 'a' ? -1 : value;
})({ 'a': 1, 'b': 1 });
// => { 'a': -1, 'b': 1 }
```
Manual conversions are also possible with the `convert` module.
```js
var convert = require('lodash/fp/convert');
// Convert by name.
var assign = convert('assign', require('lodash.assign'));
// Convert by object.
var fp = convert({
'assign': require('lodash.assign'),
'chunk': require('lodash.chunk')
});
// Convert by `lodash` instance.
var fp = convert(lodash.runInContext());
```
## Tooling
Use [eslint-plugin-lodash-fp](https://www.npmjs.com/package/eslint-plugin-lodash-fp)
to help use `lodash/fp` more efficiently.

View File

@@ -0,0 +1,7 @@
module.exports = {
'cap': false,
'curry': false,
'fixed': false,
'immutable': false,
'rearg': false
};

View File

@@ -0,0 +1,16 @@
module.exports = {
'ary': require('../ary'),
'assign': require('../_baseAssign'),
'clone': require('../clone'),
'curry': require('../curry'),
'forEach': require('../_arrayEach'),
'isArray': require('../isArray'),
'isError': require('../isError'),
'isFunction': require('../isFunction'),
'isWeakMap': require('../isWeakMap'),
'iteratee': require('../iteratee'),
'keys': require('../_baseKeys'),
'rearg': require('../rearg'),
'toInteger': require('../toInteger'),
'toPath': require('../toPath')
};

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,18 @@
var baseConvert = require('./_baseConvert'),
util = require('./_util');
/**
* Converts `func` of `name` to an immutable auto-curried iteratee-first data-last
* version with conversion `options` applied. 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.
* @param {Object} [options] The options object. See `baseConvert` for more details.
* @returns {Function|Object} Returns the converted function or object.
*/
function convert(name, func, options) {
return baseConvert(util, name, func, options);
}
module.exports = convert;

View File

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

View File

@@ -0,0 +1,5 @@
var convert = require('./convert'),
func = convert('<%= name %>', require('../<%= _.get(mapping.remap, name, name) %>'));
func.placeholder = require('./placeholder');
module.exports = func;

View File

@@ -0,0 +1,5 @@
var convert = require('./convert'),
func = convert('<%= name %>', require('../<%= _.get(mapping.remap, name, name) %>'), require('./_falseOptions'));
func.placeholder = require('./placeholder');
module.exports = func;

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

@@ -0,0 +1,31 @@
'use strict';
const async = require('async');
const path = require('path');
const file = require('../common/file');
const util = require('../common/util');
const basePath = path.join(__dirname, '..', '..');
const distPath = path.join(basePath, 'dist');
const filename = 'lodash.js';
const baseLodash = path.join(basePath, filename);
const distLodash = path.join(distPath, filename);
/*----------------------------------------------------------------------------*/
/**
* Creates browser builds of Lodash at the `target` path.
*
* @private
* @param {string} target The output directory path.
*/
function build() {
async.series([
file.copy(baseLodash, distLodash),
file.min(distLodash)
], util.pitch);
}
build();

83
lib/main/build-doc.js Normal file
View File

@@ -0,0 +1,83 @@
'use strict';
const _ = require('lodash');
const docdown = require('docdown');
const fs = require('fs-extra');
const path = require('path');
const util = require('../common/util');
const basePath = path.join(__dirname, '..', '..');
const docPath = path.join(basePath, 'doc');
const readmePath = path.join(docPath, 'README.md');
const pkg = require('../../package.json');
const version = pkg.version;
const config = {
'base': {
'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': {
'style': 'github',
'sublinks': [npmLink('&#x24C3;', 'See the npm package')]
},
'site': {
'entryLink': '<a href="${entryHref}" class="fa fa-link"></a>',
'sourceLink': '[source](${sourceHref})',
'tocHref': '',
'tocLink': '',
'sublinks': [npmLink('npm package')]
}
};
/**
* Composes a npm link from `text` and optional `title`.
*
* @private
* @param {string} text The link text.
* @param {string} [title] The link title.
* @returns {string} Returns the composed npm link.
*/
function npmLink(text, title) {
return (
'<% if (name == "templateSettings" || !/^(?:methods|properties|seq)$/i.test(category)) {' +
'print(' +
'"[' + text + '](https://www.npmjs.com/package/lodash." + name.toLowerCase() + ' +
'"' + (title == null ? '' : ' \\"' + title + '\\"') + ')"' +
');' +
'} %>'
);
}
/**
* Post-process `markdown` to make adjustments.
*
* @private
* @param {string} markdown The markdown to process.
* @returns {string} Returns the processed markdown.
*/
function postprocess(markdown) {
// Wrap symbol property identifiers in brackets.
return markdown.replace(/\.(Symbol\.(?:[a-z]+[A-Z]?)+)/g, '[$1]');
}
/*----------------------------------------------------------------------------*/
/**
* Creates the documentation markdown formatted for 'github' or 'site'.
*
* @private
* @param {string} type The format type.
*/
function build(type) {
const options = _.defaults({}, config.base, config[type]);
const markdown = docdown(options);
fs.writeFile(readmePath, postprocess(markdown), util.pitch);
}
build(_.last(process.argv));

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

@@ -0,0 +1,34 @@
'use strict';
const _ = require('lodash');
const async = require('async');
const path = require('path');
const file = require('../common/file');
const util = require('../common/util');
const basePath = path.join(__dirname, '..', '..');
const distPath = path.join(basePath, 'dist');
const filePairs = [
[path.join(distPath, 'lodash.core.js'), 'core.js'],
[path.join(distPath, 'lodash.core.min.js'), 'core.min.js'],
[path.join(distPath, 'lodash.min.js'), 'lodash.min.js']
];
/*----------------------------------------------------------------------------*/
/**
* Creates supplementary Lodash modules at the `target` path.
*
* @private
* @param {string} target The output directory path.
*/
function build(target) {
const actions = _.map(filePairs, pair =>
file.copy(pair[0], path.join(target, pair[1])));
async.series(actions, util.pitch);
}
build(_.last(process.argv));

224
lib/main/build-site.js Normal file
View File

@@ -0,0 +1,224 @@
'use strict';
const _ = require('lodash');
const cheerio = require('cheerio');
const fs = require('fs');
const marky = require('marky-markdown');
const path = require('path');
const util = require('../common/util');
const basePath = path.join(__dirname, '..', '..');
const docPath = path.join(basePath, 'doc');
const readmePath = path.join(docPath, 'README.md');
const highlights = {
'html': [
'string'
],
'js': [
'comment',
'console',
'delimiter',
'method',
'modifier',
'name',
'numeric',
'string',
'support',
'type'
]
};
const exts = _.keys(highlights);
/**
* Converts Lodash method references into documentation links.
*
* @private
* @param {Object} $ The Cheerio object.
*/
function autoLink($) {
$('.doc-container code').each(function() {
const $code = $(this);
const html = $code.html();
if (/^_\.\w+$/.test(html)) {
const id = html.split('.')[1];
$code.replaceWith(`<a href="#${ id }"><code>_.${ id }</code></a>`);
}
});
}
/**
* Removes horizontal rules from the document.
*
* @private
* @param {Object} $ The Cheerio object.
*/
function removeHorizontalRules($) {
$('hr').remove();
}
/**
* Removes marky-markdown specific ids and class names.
*
* @private
* @param {Object} $ The Cheerio object.
*/
function removeMarkyAttributes($) {
$('[id^="user-content-"]')
.attr('class', null)
.attr('id', null);
$(':header:not(h3) > a').each(function() {
const $a = $(this);
$a.replaceWith($a.html());
});
}
/**
* Renames "_" id and anchor references to "lodash".
*
* @private
* @param {Object} $ The Cheerio object.
*/
function renameLodashId($) {
$('#_').attr('id', 'lodash');
$('[href="#_"]').attr('href', '#lodash');
}
/**
* Repairs broken marky-markdown headers.
* See https://github.com/npm/marky-markdown/issues/217 for more details.
*
* @private
* @param {Object} $ The Cheerio object.
*/
function repairMarkyHeaders($) {
$('p:empty + h3').prev().remove();
$('h3 ~ p:empty').each(function() {
const $p = $(this);
let node = this.prev;
while ((node = node.prev) && node.name != 'h3' && node.name != 'p') {
$p.prepend(node.next);
}
});
$('h3 code em').parent().each(function() {
const $code = $(this);
$code.html($code.html().replace(/<\/?em>/g, '_'));
});
}
/**
* Cleans up highlights blocks by removing extraneous class names and elements.
*
* @private
* @param {Object} $ The Cheerio object.
*/
function tidyHighlights($) {
$('.highlight').each(function() {
let $spans;
const $parent = $(this);
const classes = $parent.find('.source,.text').first().attr('class').split(' ');
const ext = _(classes).intersection(exts).last();
$parent.addClass(ext);
// Remove line indicators for single line snippets.
$parent.children('pre').each(function() {
const $divs = $(this).children('div');
if ($divs.length == 1) {
$divs.replaceWith($divs.html());
}
});
// Remove extraneous class names.
$parent.find('[class]').each(function() {
const $element = $(this);
const classes = $element.attr('class').split(' ');
const attr = _(classes).intersection(highlights[ext]).join(' ');
$element.attr('class', attr || null);
});
// Collapse nested comment highlights.
$parent.find(`[class~="comment"]`).each(function() {
const $element = $(this);
$element.text($element.text().trim());
});
// Collapse nested string highlights.
$parent.find(`[class~="string"]`).each(function() {
const $element = $(this);
$element.text($element.text());
});
// Collapse nested spans.
while (($spans = $parent.find('span:not([class])')).length) {
$spans.each(function() {
let $span = $(this);
while ($span[0] && $span[0].name == 'span' && !$span.attr('class')) {
const $parent = $span.parent();
$span.replaceWith($span.html());
$span = $parent;
}
});
}
});
}
/*----------------------------------------------------------------------------*/
/**
* Creates the documentation HTML.
*
* @private
*/
function build() {
const markdown = fs
// Load markdown.
.readFileSync(readmePath, 'utf8')
// Uncomment docdown HTML hints.
.replace(/(<)!--\s*|\s*--(>)/g, '$1$2')
// Convert source and npm package links to anchors.
.replace(/\[source\]\(([^)]+)\) \[npm package\]\(([^)]+)\)/g, (match, href1, href2) =>
`<p><a href="${ href1 }">source</a> <a href="${ href2 }">npm package</a></p>`
);
const $ = cheerio.load(marky(markdown, {
'enableHeadingLinkIcons': false,
'sanitize': false
}));
const $header = $('h1').first().remove();
const version = $header.find('span').first().text().trim().slice(1);
// Auto-link Lodash method references.
autoLink($);
// Rename "_" id references to "lodash".
renameLodashId($);
// Remove docdown horizontal rules.
removeHorizontalRules($);
// Remove marky-markdown attribute additions.
removeMarkyAttributes($);
// Repair marky-markdown wrapping around headers.
repairMarkyHeaders($);
// Cleanup highlights.
tidyHighlights($);
const html = [
// Append YAML front matter.
'---',
'id: docs',
'layout: docs',
'title: Lodash Documentation',
'version: ' + (version || null),
'---',
'',
// Wrap in raw tags to avoid Liquid template tag processing.
'{% raw %}',
$.html().trim(),
'{% endraw %}',
''
].join('\n');
fs.writeFile(path.join(docPath, version + '.html'), html, util.pitch);
}
build();

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

File diff suppressed because it is too large Load Diff

5845
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,33 +1,66 @@
{
"name": "lodash",
"version": "3.9.3",
"main": "lodash.src.js",
"version": "4.17.21",
"license": "MIT",
"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"
"main": "lodash.js",
"engines": {
"node": ">=4.0.0"
},
"volo": {
"type": "directory",
"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/main/build-doc github && npm run test:doc",
"doc:fp": "node lib/fp/build-doc",
"doc:site": "node lib/main/build-doc site",
"doc:sitehtml": "optional-dev-dependency marky-markdown@^9.0.1 && npm run doc:site && node lib/main/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:doc": "markdown-doctest doc/*.md",
"test:fp": "node test/test-fp",
"test:main": "node test/test",
"validate": "npm run style && npm run test"
},
"devDependencies": {
"async": "^2.6.3",
"benchmark": "^2.1.3",
"chalk": "^1.1.3",
"cheerio": "^0.22.0",
"codecov.io": "~0.1.6",
"coveralls": "^2.11.15",
"curl-amd": "~0.8.12",
"docdown": "~0.7.2",
"dojo": "^1.15.0",
"ecstatic": "^2.2.2",
"fs-extra": "~1.0.0",
"glob": "^7.1.4",
"istanbul": "0.4.5",
"jquery": "^3.4.1",
"jscs": "^3.0.7",
"lodash": "4.17.20",
"lodash-doc-globals": "^0.1.1",
"markdown-doctest": "^0.9.1",
"optional-dev-dependency": "^2.0.0",
"platform": "^1.3.3",
"qunit-extras": "^3.0.0",
"qunitjs": "^2.1.0",
"request": "^2.88.0",
"requirejs": "^2.3.6",
"sauce-tunnel": "^2.5.0",
"uglify-js": "2.7.5",
"webpack": "^1.14.0"
},
"greenkeeper": {
"ignore": [
".*",
"*.custom.*",
"*.log",
"*.map",
"*.md",
"lodash.src.js",
"bower.json",
"component.json",
"doc",
"node_modules",
"perf",
"test",
"vendor"
"lodash"
]
}
}

View File

@@ -15,27 +15,8 @@
/*--------------------------------------------------------------------------*/
/**
* Registers an event listener on an element.
*
* @private
* @param {Element} element The element.
* @param {string} eventName The name of the event.
* @param {Function} handler The event handler.
* @returns {Element} The element.
*/
function addListener(element, eventName, handler) {
if (typeof element.addEventListener != 'undefined') {
element.addEventListener(eventName, handler, false);
} else if (typeof element.attachEvent != 'undefined') {
element.attachEvent('on' + eventName, handler);
}
}
/*--------------------------------------------------------------------------*/
// Initialize controls.
addListener(window, 'load', function() {
addEventListener('load', function() {
function eventHandler(event) {
var buildIndex = buildList.selectedIndex,
otherIndex = otherList.selectedIndex,
@@ -58,10 +39,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 (production)</option>' +
'</select>';
var span2 = document.createElement('span');
@@ -71,10 +49,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 +61,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,29 +70,23 @@
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;
}
return -1;
}());
addListener(buildList, 'change', eventHandler);
addListener(otherList, 'change', eventHandler);
buildList.addEventListener('change', eventHandler);
otherList.addEventListener('change', eventHandler);
});
// The lodash build file path.
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 +96,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,28 +9,35 @@
padding: 0;
height: 100%;
}
applet {
position: absolute;
left: -9999em;
}
#FirebugUI {
top: 2em;
top: 2.5em;
}
#perf-toolbar {
background-color: #EEE;
color: #5E740B;
font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial, sans-serif;
font-size: small;
padding: 0.5em 0 0.5em 2em;
padding: 0.5em 1em 0.5em 1em;
overflow: hidden;
}
#perf-toolbar label {
display: inline-block;
margin-right: 0.5em;
}
#perf-toolbar span {
display: inline-block;
float: right;
line-height: 2.1em;
margin-left: 1em;
margin-top: 0;
}
</style>
</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 +73,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

@@ -1,4 +1,5 @@
;(function() {
'use strict';
/** Used to access the Firebug Lite panel (set by `run`). */
var fbPanel;
@@ -38,16 +39,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;
}());
@@ -82,19 +83,10 @@
/** Used to queue benchmark suites. */
var suites = [];
/** Used to resolve a value's internal [[Class]]. */
var toString = Object.prototype.toString;
/** 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 +96,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 +197,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 +250,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 +276,7 @@
lodash.extend(Benchmark.options, {
'async': true,
'setup': '\
var _ = global._,\
var _ = global.underscore,\
lodash = global.lodash,\
belt = this.name == buildName ? lodash : _;\
\
@@ -351,8 +343,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 +352,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 +453,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)),\
@@ -571,11 +560,11 @@
suites.push(
Benchmark.Suite('`_.assign`')
.add(buildName, {
'fn': 'lodashAssign({}, object)',
'fn': 'lodashAssign({}, { "a": 1, "b": 2, "c": 3 })',
'teardown': 'function assign(){}'
})
.add(otherName, {
'fn': '_assign({}, object)',
'fn': '_assign({}, { "a": 1, "b": 2, "c": 3 })',
'teardown': 'function assign(){}'
})
);
@@ -583,11 +572,11 @@
suites.push(
Benchmark.Suite('`_.assign` with multiple sources')
.add(buildName, {
'fn': 'lodashAssign({}, object, object)',
'fn': 'lodashAssign({}, { "a": 1, "b": 2 }, { "c": 3, "d": 4 })',
'teardown': 'function assign(){}'
})
.add(otherName, {
'fn': '_assign({}, object, object)',
'fn': '_assign({}, { "a": 1, "b": 2 }, { "c": 3, "d": 4 })',
'teardown': 'function assign(){}'
})
);
@@ -645,25 +634,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 +683,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 +783,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 +845,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 +859,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 +914,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 +940,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 +1045,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 +1088,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 +1127,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 +1324,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 +1340,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 +1354,16 @@
)
);
suites.push(
Benchmark.Suite('`_.map` with `_.property` shorthand')
.add(buildName, '\
lodash.map(objects, "num")'
)
.add(otherName, '\
_.map(objects, "num")'
)
);
/*--------------------------------------------------------------------------*/
suites.push(
@@ -1519,18 +1414,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 +1454,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 +1482,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 +1564,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 +1581,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 +1630,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 +1656,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 +1680,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 +1702,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 +1792,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 +1816,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 +1884,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 +1898,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 +1926,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

@@ -15,27 +15,8 @@
/*--------------------------------------------------------------------------*/
/**
* Registers an event listener on an element.
*
* @private
* @param {Element} element The element.
* @param {string} eventName The name of the event.
* @param {Function} handler The event handler.
* @returns {Element} The element.
*/
function addListener(element, eventName, handler) {
if (typeof element.addEventListener != 'undefined') {
element.addEventListener(eventName, handler, false);
} else if (typeof element.attachEvent != 'undefined') {
element.attachEvent('on' + eventName, handler);
}
}
/*--------------------------------------------------------------------------*/
// Initialize controls.
addListener(window, 'load', function() {
addEventListener('load', function() {
function eventHandler(event) {
var buildIndex = buildList.selectedIndex,
loaderIndex = loaderList.selectedIndex,
@@ -59,17 +40,15 @@
setTimeout(init, 15);
return;
}
toolbar.appendChild(span1);
toolbar.appendChild(span2);
toolbar.insertBefore(span2, toolbar.lastChild);
toolbar.insertBefore(span1, span2);
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;
@@ -86,25 +65,21 @@
return -1;
}());
addListener(buildList, 'change', eventHandler);
addListener(loaderList, 'change', eventHandler);
buildList.addEventListener('change', eventHandler);
loaderList.addEventListener('change', eventHandler);
}
var span1 = document.createElement('span');
span1.style.cssText = 'float:right';
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');
span2.style.cssText = 'float:right';
span2.innerHTML =
'<label for="qunit-loader">Loader: </label>' +
'<select id="qunit-loader">' +
@@ -114,6 +89,12 @@
'<option value="requirejs">RequireJS</option>' +
'</select>';
span1.style.cssText =
span2.style.cssText = 'display:inline-block;float:right;line-height:2.1em;margin-left:1em;margin-top:0;';
span1.firstChild.style.cssText =
span2.firstChild.style.cssText = 'display:inline-block;margin-right:.5em;';
var buildList = span1.lastChild,
loaderList = span2.lastChild;
@@ -124,29 +105,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 +132,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|es|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 = /\bes\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

@@ -1,12 +1,17 @@
'use strict';
self.console || (self.console = { 'log': function() {} });
addEventListener('message', function(e) {
if (e.data) {
try {
importScripts('../' + e.data);
} catch(e) {
self._ = { 'VERSION': e.message };
} catch (e) {
var lineNumber = e.lineNumber,
message = (lineNumber == null ? '' : (lineNumber + ': ')) + e.message;
self._ = { 'VERSION': message };
}
postMessage(_.VERSION);
}
}, false);
});

View File

@@ -22,27 +22,69 @@
<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>
var mixinPrereqs = (function() {
var lodash = _.noConflict();
return function(_) {
_.mixin({
'debounce': _.debounce || lodash.debounce,
'defer': _.defer || lodash.defer,
'pluck': _.pluck || lodash.pluck
});
};
}());
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>',
var mixinPrereqs = (function() {
var aliasToReal = {
'indexBy': 'keyBy',
'invoke': 'invokeMap'
};
var keyMap = {
'rest': 'tail'
};
var lodash = _.noConflict();
return function(_) {
lodash(_)
.defaultsDeep({ 'templateSettings': lodash.templateSettings })
.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(_))))
.value();
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];
});
return _;
};
}());
// 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 +96,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 +105,6 @@
curl.config({ 'apiName': 'require' });
}
if (!window.require) {
mixinPrereqs(_);
return;
}
var reBasename = /[\w.-]+$/,
@@ -107,24 +148,20 @@
QUnit.config.autostart = false;
require(getConfig(), ['underscore', 'backbone'], 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(), ['underscore'], function(lodash) {
_ = mixinPrereqs(lodash);
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'
], 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/lodash.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,42 @@
funcProto._method = noop;
// Set bad shims.
setProperty(Array, '_isArray', Array.isArray);
setProperty(Array, 'isArray', noop);
setProperty(Object, '_create', Object.create);
setProperty(Object, 'create', undefined);
setProperty(Date, '_now', Date.now);
setProperty(Date, 'now', noop);
setProperty(Object, '_keys', Object.keys);
setProperty(Object, 'keys', noop);
setProperty(Object, '_getOwnPropertySymbols', Object.getOwnPropertySymbols);
setProperty(Object, 'getOwnPropertySymbols', undefined);
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(window, '_Promise', window.Promise);
setProperty(window, 'Promise', noop);
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,46 +132,58 @@
function removeBizarroMethods() {
var funcProto = Function.prototype,
objectProto = Object.prototype,
stringProto = String.prototype;
objectProto = Object.prototype;
if (Array._isArray) {
setProperty(Array, 'isArray', Array._isArray);
setProperty(objectProto, 'propertyIsEnumerable', objectProto._propertyIsEnumerable);
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 (_Promise) {
Promise = _Promise;
} else {
setProperty(window, 'Promise', undefined);
}
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(window, '_Map', undefined);
setProperty(window, '_Promise', 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 Object._create;
delete Object._getOwnPropertySymbols;
delete objectProto._propertyIsEnumerable;
}
@@ -266,20 +291,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/_baseEach',
'lodash/_isIndex',
'lodash/_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 _ = require('../lodash'),
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;
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(arguments, -3, -2)[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

@@ -4,11 +4,6 @@
/** Environment shortcut. */
var env = process.env;
if (env.TRAVIS_SECURE_ENV_VARS == 'false') {
console.log('Skipping Sauce Labs jobs; secure environment variables are unavailable');
process.exit(0);
}
/** Load Node.js modules. */
var EventEmitter = require('events').EventEmitter,
http = require('http'),
@@ -17,7 +12,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'),
@@ -97,31 +92,23 @@ var browserNameMap = {
'googlechrome': 'Chrome',
'iehta': 'Internet Explorer',
'ipad': 'iPad',
'iphone': 'iPhone'
'iphone': 'iPhone',
'microsoftedge': 'Edge'
};
/** 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', '54'],
['Windows 10', 'chrome', '53'],
['Windows 10', 'firefox', '50'],
['Windows 10', 'firefox', '49'],
['Windows 10', 'microsoftedge', '14'],
['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']
['macOS 10.12', 'safari', '10'],
['OS X 10.11', 'safari', '9']
];
/** Used to tailor the `platforms` array. */
@@ -132,7 +119,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']
@@ -221,18 +208,7 @@ if (tunneled) {
* @returns {string} Returns the formal browser name.
*/
function browserName(identifier) {
return browserNameMap[identifier] || capitalizeWords(identifier);
}
/**
* Capitalizes the first character of each word in `string`.
*
* @private
* @param {string} string The string to augment.
* @returns {string} Returns the augmented string.
*/
function capitalizeWords(string) {
return _.map(string.split(' '), _.capitalize).join(' ');
return browserNameMap[identifier] || _.startCase(identifier);
}
/**
@@ -276,7 +252,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 +274,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'));
}
/**
@@ -312,7 +288,7 @@ function optionToArray(name, string) {
function optionToValue(name, string) {
var result = string.match(RegExp('^' + name + '(?:=([\\s\\S]+))?$'));
if (result) {
result = _.result(result, 1);
result = _.get(result, 1);
result = result ? _.trim(result) : true;
}
if (result === 'false') {
@@ -384,8 +360,8 @@ function onJobStart(error, res, body) {
if (this.stopping) {
return;
}
var statusCode = _.result(res, 'statusCode'),
taskId = _.first(_.result(body, 'js tests'));
var statusCode = _.get(res, 'statusCode'),
taskId = _.first(_.get(body, 'js tests'));
if (error || !taskId || statusCode != 200) {
if (this.attempts < this.retries) {
@@ -426,19 +402,19 @@ function onJobStatus(error, res, body) {
if (!this.running || this.stopping) {
return;
}
var completed = _.result(body, 'completed', false),
data = _.first(_.result(body, 'js tests')),
var completed = _.get(body, 'completed', false),
data = _.first(_.get(body, 'js tests')),
elapsed = (_.now() - this.timestamp) / 1000,
jobId = _.result(data, 'job_id', null),
jobResult = _.result(data, 'result', null),
jobStatus = _.result(data, 'status', ''),
jobUrl = _.result(data, 'url', null),
jobId = _.get(data, 'job_id', null),
jobResult = _.get(data, 'result', null),
jobStatus = _.get(data, 'status', ''),
jobUrl = _.get(data, 'url', null),
expired = (elapsed >= queueTimeout && !_.includes(jobStatus, 'in progress')),
options = this.options,
platform = options.platforms[0];
if (_.isObject(jobResult)) {
var message = _.result(jobResult, 'message');
var message = _.get(jobResult, 'message');
} else {
if (typeof jobResult == 'string') {
message = jobResult;
@@ -458,9 +434,9 @@ function onJobStatus(error, res, body) {
this._pollerId = _.delay(_.bind(this.status, this), this.statusInterval * 1000);
return;
}
var description = browserName(platform[1]) + ' ' + platform[2] + ' on ' + capitalizeWords(platform[0]),
var description = browserName(platform[1]) + ' ' + platform[2] + ' on ' + _.startCase(platform[0]),
errored = !jobResult || !jobResult.passed || reError.test(message) || reError.test(jobStatus),
failures = _.result(jobResult, 'failed'),
failures = _.get(jobResult, 'failed'),
label = options.name + ':',
tunnel = this.tunnel;
@@ -481,7 +457,7 @@ function onJobStatus(error, res, body) {
return;
}
else {
if (typeof message == 'undefined') {
if (message === undefined) {
message = 'Results are unavailable. ' + details;
}
console.error(label, description, chalk.red('failed') + ';', message);
@@ -560,7 +536,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 +561,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 +577,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;
}
@@ -609,7 +585,7 @@ Job.prototype.restart = function(callback) {
var options = this.options,
platform = options.platforms[0],
description = browserName(platform[1]) + ' ' + platform[2] + ' on ' + capitalizeWords(platform[0]),
description = browserName(platform[1]) + ' ' + platform[2] + ' on ' + _.startCase(platform[0]),
label = options.name + ':';
logInline();
@@ -626,7 +602,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 +623,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 +645,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 +683,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 +698,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 +710,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 +744,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 +758,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 +766,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 +786,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;
}
@@ -834,13 +810,16 @@ Tunnel.prototype.start = function(callback) {
* @param {Object} Returns the tunnel instance.
*/
Tunnel.prototype.dequeue = function() {
var jobs = this.jobs,
var count = 0,
jobs = this.jobs,
active = jobs.active,
queue = jobs.queue,
throttled = this.throttled;
while (queue.length && (active.length < throttled)) {
active.push(queue.shift().start());
var job = queue.shift();
active.push(job);
_.delay(_.bind(job.start, job), ++count * 1000);
}
return this;
};
@@ -853,7 +832,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 +857,7 @@ Tunnel.prototype.stop = function(callback) {
if (_.isEmpty(active)) {
_.defer(stop);
}
_.invoke(active, 'stop', function() {
_.invokeMap(active, 'stop', function() {
_.pull(active, this);
stop();
});

2322
test/test-fp.js Normal file

File diff suppressed because it is too large Load Diff

29015
test/test.js

File diff suppressed because it is too large Load Diff

View File

@@ -23,50 +23,91 @@
<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': {
'chunk': [
'defaults to empty array (chunk size 0)'
],
'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'
],
'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'
],
'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,69 +119,190 @@
]
},
'Collections': {
'lookupIterator with contexts': true,
'Iterating objects with sketchy length properties': true,
'Resistant to collection length and properties changing while iterating': true,
'countBy': [
'{}',
'[{}]'
],
'each': [
'context object property accessed'
],
'every': [
'Can be called with object',
'Died on test #15',
'context works'
],
'filter': [
'given context',
'OO-filter'
],
'find': [
'called with context'
],
'findWhere': [
'checks properties given function'
],
'groupBy': [
'{}',
'[{}]'
],
'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'
],
'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>'
]
},
'Functions': {
'debounce asap': true,
'debounce asap cancel': true,
'debounce asap recursively': true,
'debounce after system time is set backwards': true,
'debounce re-entrant': 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': true,
'bind': [
'Died on test #2'
],
'bindAll': [
'throws an error for bindAll with no functions named'
],
'debounce': [
'incr was debounced'
],
'iteratee': [
'"bbiz"',
'"foo"',
'1'
],
'memoize': [
'{"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
]
},
'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',
'[]'
],
'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`',
'Invalid dates are not equal',
'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'
'isSet': [
'Died on test #9'
],
'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'
],
'omit': [
'can accept a predicate',
'function is given context'
],
'pick': [
'can accept a predicate and context',
'function is given context'
]
},
'Utility': {
'_.escape & unescape': [
'` is escaped',
'` can be unescaped',
'can escape multiple occurances of `',
'multiple occurrences of ` can be unescaped'
],
'now': [
'Produces the correct time in milliseconds'
],
@@ -150,19 +312,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 })
.mixin(lodash.pick(lodash, lodash.difference(lodash.functions(lodash), lodash.functions(_))))
.value();
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];
});
return _;
};
}());
// 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 +388,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 +399,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$/, ''),
@@ -219,11 +444,12 @@
}
QUnit.config.autostart = false;
QUnit.config.excused.Functions.iteratee = true;
QUnit.config.excused.Utility.noConflict = true;
QUnit.config.excused.Utility['noConflict (node vm)'] = true;
require(getConfig(), [moduleId], function(lodash) {
if (ui.isModularize) {
window._ = lodash;
}
_ = mixinPrereqs(lodash);
require(getConfig(), [
'test/collections',
'test/arrays',
@@ -232,9 +458,7 @@
'test/cross-document',
'test/utility',
'test/chaining'
], function() {
QUnit.start();
});
], QUnit.start);
});
}());
</script>

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.3.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.3.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;
@@ -224,14 +242,12 @@
listening.obj.off(name, callback, this);
}
if (_.isEmpty(listeningTo)) this._listeningTo = void 0;
return this;
};
// 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;
@@ -282,21 +298,22 @@
delete events[name];
}
}
if (_.size(events)) return events;
return events;
};
// 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);
if (typeof name === 'string' && context == null) callback = void 0;
return this.on(events, callback, 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;
@@ -377,11 +394,13 @@
var Model = Backbone.Model = function(attributes, options) {
var attrs = attributes || {};
options || (options = {});
this.preinitialize.apply(this, arguments);
this.cid = _.uniqueId(this.cidPrefix);
this.attributes = {};
if (options.collection) this.collection = options.collection;
if (options.parse) attrs = this.parse(attrs, options) || {};
attrs = _.defaults({}, attrs, _.result(this, 'defaults'));
var defaults = _.result(this, 'defaults');
attrs = _.defaults(_.extend({}, defaults, attrs), defaults);
this.set(attrs, options);
this.changed = {};
this.initialize.apply(this, arguments);
@@ -404,6 +423,10 @@
// You may want to override this if you're experiencing name clashes with model ids.
cidPrefix: 'c',
// preinitialize is an empty function by default. You can override it with a function
// or object. preinitialize will run before any instantiation logic is run in the Model.
preinitialize: function(){},
// Initialize is an empty function by default. Override it with your own
// initialization logic.
initialize: function(){},
@@ -476,9 +499,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 +511,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;
@@ -544,12 +567,14 @@
if (!diff) return this.hasChanged() ? _.clone(this.changed) : false;
var old = this._changing ? this._previousAttributes : this.attributes;
var changed = {};
var hasChanged;
for (var attr in diff) {
var val = diff[attr];
if (_.isEqual(old[attr], val)) continue;
changed[attr] = val;
hasChanged = true;
}
return _.size(changed) ? changed : false;
return hasChanged ? changed : false;
},
// Get the previous value of an attribute, recorded at the time the last
@@ -602,8 +627,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)
@@ -697,7 +722,7 @@
// Check if the model is currently in a valid state.
isValid: function(options) {
return this._validate({}, _.defaults({validate: true}, options));
return this._validate({}, _.extend({}, options, {validate: true}));
},
// Run validation against the next complete set of model attributes,
@@ -713,9 +738,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');
@@ -735,6 +761,7 @@
// its models in sort order, as they're added and removed.
var Collection = Backbone.Collection = function(models, options) {
options || (options = {});
this.preinitialize.apply(this, arguments);
if (options.model) this.model = options.model;
if (options.comparator !== void 0) this.comparator = options.comparator;
this._reset();
@@ -746,6 +773,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, {
@@ -753,6 +791,11 @@
// This should be overridden in most cases.
model: Model,
// preinitialize is an empty function by default. You can override it with a function
// or object. preinitialize will run before any instantiation logic is run in the Collection.
preinitialize: function(){},
// Initialize is an empty function by default. Override it with your own
// initialization logic.
initialize: function(){},
@@ -768,7 +811,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 +822,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 +836,114 @@
// 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) {
options = _.defaults({}, options, setOptions);
if (options.parse && !this._isModel(models)) models = this.parse(models, options);
if (models == null) return;
options = _.extend({}, setOptions, 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 > this.length) at = this.length;
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).
@@ -928,11 +993,18 @@
return slice.apply(this.models, arguments);
},
// Get a model from the set by id.
// Get a model from the set by id, cid, model object with id or cid
// properties, or an attributes object that is transformed through modelId.
get: function(obj) {
if (obj == null) return void 0;
var id = this.modelId(this._isModel(obj) ? obj.attributes : obj);
return this._byId[obj] || this._byId[id] || this._byId[obj.cid];
return this._byId[obj] ||
this._byId[this.modelId(obj.attributes || obj)] ||
obj.cid && 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.
@@ -944,10 +1016,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 +1029,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 +1079,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 +1102,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 +1130,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 +1140,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 +1154,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 +1185,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 +1205,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
// -------------
@@ -1166,6 +1232,7 @@
// if an existing element is not provided...
var View = Backbone.View = function(options) {
this.cid = _.uniqueId('view');
this.preinitialize.apply(this, arguments);
_.extend(this, _.pick(options, viewOptions));
this._ensureElement();
this.initialize.apply(this, arguments);
@@ -1174,7 +1241,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.
@@ -1189,6 +1256,10 @@
return this.$el.find(selector);
},
// preinitialize is an empty function by default. You can override it with a function
// or object. preinitialize will run before any instantiation logic is run in the View
preinitialize: function(){},
// Initialize is an empty function by default. Override it with your own
// initialization logic.
initialize: function(){},
@@ -1396,9 +1467,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 `$`.
@@ -1414,6 +1485,7 @@
// matched. Creating a new one sets its `routes` hash, if not set statically.
var Router = Backbone.Router = function(options) {
options || (options = {});
this.preinitialize.apply(this, arguments);
if (options.routes) this.routes = options.routes;
this._bindRoutes();
this.initialize.apply(this, arguments);
@@ -1429,6 +1501,10 @@
// Set up all inheritable **Backbone.Router** properties and methods.
_.extend(Router.prototype, Events, {
// preinitialize is an empty function by default. You can override it with a function
// or object. preinitialize will run before any instantiation logic is run in the Router.
preinitialize: function(){},
// Initialize is an empty function by default. Override it with your own
// initialization logic.
initialize: function(){},
@@ -1518,7 +1594,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 +1631,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 +1687,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 +1704,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 +1734,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 +1755,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 +1806,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,17 +1829,20 @@
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, ''));
// Strip the fragment of the query and hash for matching.
fragment = fragment.replace(pathStripper, '');
if (this.fragment === fragment) return;
this.fragment = fragment;
// Decode for matching.
var decodedFragment = this.decodeFragment(fragment);
if (this.fragment === decodedFragment) return;
this.fragment = decodedFragment;
// If pushState is available, we use it to set the fragment as a real URL.
if (this._usePushState) {
@@ -1773,7 +1852,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 +1914,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.
@@ -1869,5 +1943,4 @@
};
return Backbone;
}));
});

File diff suppressed because it is too large Load Diff

View File

@@ -1,42 +1,44 @@
(function() {
(function(QUnit) {
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,64 @@
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 () {
return this;
};
TestClass.prototype.assertTrue = function () {
ok(true, '`this` was bound to the callback');
};
QUnit.test('bind a callback with a default context when none supplied', function(assert) {
assert.expect(1);
var obj = _.extend({
assertTrue: function() {
assert.equal(this, obj, '`this` was bound to the callback');
}
}, Backbone.Events);
var obj = _.extend({},Backbone.Events);
obj.on('event', function () { this.assertTrue(); }, (new TestClass));
obj.once('event', obj.assertTrue);
obj.trigger('event');
});
test("nested trigger with unbind", 1, function () {
var obj = { counter: 0 };
QUnit.test('bind a callback with a supplied context', function(assert) {
assert.expect(1);
var TestClass = function() {
return this;
};
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);
obj.trigger('event');
});
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 +478,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 +550,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 +562,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 +572,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,98 +587,120 @@
}, 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('bind a callback with a supplied context using once with object notation', function(assert) {
assert.expect(1);
var obj = {counter: 0};
var context = {};
_.extend(obj, Backbone.Events);
obj.once({
a: function() {
assert.strictEqual(this, context, 'defaults `context` to `callback` param');
}
}, context).trigger('a');
});
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);
two.trigger('y', 2);
});
})();
})(QUnit);

File diff suppressed because it is too large Load Diff

View File

@@ -1,12 +1,13 @@
(function() {
(function(QUnit) {
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');
});
})();
})(QUnit);

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

@@ -1,4 +1,4 @@
(function() {
(function(QUnit) {
var sync = Backbone.sync;
var ajax = Backbone.ajax;
@@ -8,11 +8,13 @@
var pushState = history.pushState;
var replaceState = history.replaceState;
QUnit.config.noglobals = true;
QUnit.testStart(function() {
var env = QUnit.config.current.testEnvironment;
// We never want to actually call these during tests.
history.pushState = history.replaceState = function(){};
history.pushState = history.replaceState = function() {};
// Capture ajax settings for comparison.
Backbone.ajax = function(settings) {
@@ -40,4 +42,4 @@
history.replaceState = replaceState;
});
})();
})(QUnit);

View File

@@ -1,221 +1,239 @@
(function() {
(function(QUnit) {
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() {
Backbone.ajax = function(settings){
strictEqual(settings.url, '/test');
QUnit.test('Backbone.ajax', function(assert) {
assert.expect(1);
Backbone.ajax = function(settings) {
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');
});
})();
})(QUnit);

View File

@@ -1,98 +1,137 @@
(function() {
(function(QUnit) {
var view;
module("Backbone.View", {
QUnit.module('Backbone.View', {
beforeEach: function() {
$('#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'
});
},
afterEach: function() {
$('#testElement').remove();
$('#test-view').remove();
}
});
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('preinitialize', function(assert) {
assert.expect(1);
var View = Backbone.View.extend({
preinitialize: function() {
this.one = 1;
}
});
assert.strictEqual(new View().one, 1);
});
test("delegateEvents", 6, function() {
QUnit.test('preinitialize occurs before the view is set up', function(assert) {
assert.expect(2);
var View = Backbone.View.extend({
preinitialize: function() {
assert.equal(this.el, undefined);
}
});
var _view = new View({});
assert.notEqual(_view.el, undefined);
});
QUnit.test('render', function(assert) {
assert.expect(1);
var myView = new Backbone.View;
assert.equal(myView.render(), myView, '#render returns the view instance');
});
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 +139,147 @@
}
};
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 +289,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 +350,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 +465,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);
});
})();
})(QUnit);

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,407 @@
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]);
assert.deepEqual(result, [1, 1], 'works well with _.map');
assert.equal(_.first(null), void 0, 'returns undefined when called on null');
equal(_.first(null), undefined, 'handles nulls');
strictEqual(_.first([1, 2, 3], -1).length, 0);
Array.prototype[0] = 'boo';
assert.equal(_.first([]), void 0, 'return undefined when called on a empty array');
delete Array.prototype[0];
});
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');
assert.deepEqual(result, [3, 3], 'works well with _.map');
assert.equal(_.last(null), void 0, 'returns undefined when called on null');
equal(_.last(null), undefined, 'handles nulls');
strictEqual(_.last([1, 2, 3], -1).length, 0);
var arr = [];
arr[-1] = 'boo';
assert.equal(_.last(arr), void 0, 'return undefined when called on a empty array');
});
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 +414,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.notOk(_.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.notOk(_([iNumber]).isEmpty(), '[1] is not empty');
assert.notOk(_.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.notOk(_.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.notOk(_.isNumber(xml));
assert.notOk(_.isBoolean(xml));
assert.notOk(_.isNaN(xml));
assert.notOk(_.isFunction(xml));
assert.notOk(_.isNull(xml));
assert.notOk(_.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.notOk(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,120 @@
};
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() {
var a, b;
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(6);
var done = assert.async();
var a, b, c;
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');
c = debouncedIncr();
assert.equal(c, 2);
assert.equal(counter, 2, 'incr was called again');
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 +540,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 +571,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 +655,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 +669,97 @@
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));
});
// Test custom iteratee
var builtinIteratee = _.iteratee;
_.iteratee = function(value) {
// RegEx values return a function that returns the number of matches
if (_.isRegExp(value)) return function(obj) {
return (obj.match(value) || []).length;
};
return value;
};
var collection = ['foo', 'bar', 'bbiz'];
// Test all methods that claim to be transformed through `_.iteratee`
assert.deepEqual(_.countBy(collection, /b/g), {0: 1, 1: 1, 2: 1});
assert.equal(_.every(collection, /b/g), false);
assert.deepEqual(_.filter(collection, /b/g), ['bar', 'bbiz']);
assert.equal(_.find(collection, /b/g), 'bar');
assert.equal(_.findIndex(collection, /b/g), 1);
assert.equal(_.findKey(collection, /b/g), 1);
assert.equal(_.findLastIndex(collection, /b/g), 2);
assert.deepEqual(_.groupBy(collection, /b/g), {0: ['foo'], 1: ['bar'], 2: ['bbiz']});
assert.deepEqual(_.indexBy(collection, /b/g), {0: 'foo', 1: 'bar', 2: 'bbiz'});
assert.deepEqual(_.map(collection, /b/g), [0, 1, 2]);
assert.equal(_.max(collection, /b/g), 'bbiz');
assert.equal(_.min(collection, /b/g), 'foo');
assert.deepEqual(_.partition(collection, /b/g), [['bar', 'bbiz'], ['foo']]);
assert.deepEqual(_.reject(collection, /b/g), ['foo']);
assert.equal(_.some(collection, /b/g), true);
assert.deepEqual(_.sortBy(collection, /b/g), ['foo', 'bar', 'bbiz']);
assert.equal(_.sortedIndex(collection, 'blah', /b/g), 1);
assert.deepEqual(_.uniq(collection, /b/g), ['foo', 'bar', 'bbiz']);
var objCollection = {a: 'foo', b: 'bar', c: 'bbiz'};
assert.deepEqual(_.mapObject(objCollection, /b/g), {a: 0, b: 1, c: 2});
// Restore the builtin iteratee
_.iteratee = builtinIteratee;
});
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,218 @@
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.strictEqual(_(instance), instance);
assert.strictEqual(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() {
_.mixin({
QUnit.test('mixin', function(assert) {
var ret = _.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(ret, _, 'returns the _ object to facilitate chaining');
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.notStrictEqual(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 +226,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 +259,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.notOk(_.templateSettings.variable);
_.template('', {}, {variable: 'x'});
ok(!_.templateSettings.variable);
assert.notOk(_.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.notOk(count++); }});
var countEscaped = 0;
var templateEscaped = _.template('<%- f() %>');
templateEscaped({f: function(){ ok(!countEscaped++); }});
templateEscaped({f: function(){ assert.notOk(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

3346
yarn.lock Normal file

File diff suppressed because it is too large Load Diff