mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 14:37:49 +00:00
Compare commits
2031 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d942189bc6 | ||
|
|
eb16051b1e | ||
|
|
7749a7e41d | ||
|
|
dc4cef17d4 | ||
|
|
89ed40e4a4 | ||
|
|
10ee74d872 | ||
|
|
474ae1e91c | ||
|
|
0dc70ca5f3 | ||
|
|
633b1663ca | ||
|
|
153fe61b4b | ||
|
|
9734fd0353 | ||
|
|
6209c120c0 | ||
|
|
3516881e7a | ||
|
|
15398555b3 | ||
|
|
cb132fcbf4 | ||
|
|
f42f46c7d6 | ||
|
|
f1046f1cf1 | ||
|
|
4a62287139 | ||
|
|
69cd56357f | ||
|
|
b66a886682 | ||
|
|
249504b7d6 | ||
|
|
fa0086404d | ||
|
|
f243ebba91 | ||
|
|
540afb193b | ||
|
|
8294acdf1c | ||
|
|
7733d02938 | ||
|
|
9b6342e7fa | ||
|
|
22c09cb31b | ||
|
|
21e79cb54a | ||
|
|
b8cc829f4a | ||
|
|
ace0dacf15 | ||
|
|
5ca13098e3 | ||
|
|
07b13eedec | ||
|
|
d9168ed9ec | ||
|
|
fb4e2c167c | ||
|
|
10ee3585f6 | ||
|
|
5d4ba820dd | ||
|
|
a51e00e69f | ||
|
|
4dfa963851 | ||
|
|
f2d4f6ccf6 | ||
|
|
182cb8ab25 | ||
|
|
ece341d868 | ||
|
|
d72e8c2687 | ||
|
|
b0ff6f4c7b | ||
|
|
6ec5249492 | ||
|
|
c44cd76c5a | ||
|
|
37f711d72a | ||
|
|
fcf18fb965 | ||
|
|
2efd6250fb | ||
|
|
1b4bd8523d | ||
|
|
60c44910df | ||
|
|
faf67fae03 | ||
|
|
e95f547950 | ||
|
|
96b663b783 | ||
|
|
ce44f7e4b0 | ||
|
|
16a9c7d492 | ||
|
|
fc369c3448 | ||
|
|
b1a33edf0f | ||
|
|
3b805f1a24 | ||
|
|
954b4d8075 | ||
|
|
d073e2a881 | ||
|
|
044dd2af94 | ||
|
|
ee489fa8c0 | ||
|
|
035ed5f49b | ||
|
|
7dcd690f61 | ||
|
|
1c9290aded | ||
|
|
0b922b1ed1 | ||
|
|
34eec362e5 | ||
|
|
b829383864 | ||
|
|
3960235428 | ||
|
|
e91a662491 | ||
|
|
ba4da24984 | ||
|
|
70378432b7 | ||
|
|
6b63009b14 | ||
|
|
dd45fea732 | ||
|
|
ee09425cfb | ||
|
|
af02a1e024 | ||
|
|
2a86f0776c | ||
|
|
c6f73d9df8 | ||
|
|
5ab79f292b | ||
|
|
82c7a22d27 | ||
|
|
35fa977981 | ||
|
|
ecbc46a91d | ||
|
|
d2f6416e45 | ||
|
|
97a885a05c | ||
|
|
aa1edd6b94 | ||
|
|
083e401717 | ||
|
|
bdeca2edce | ||
|
|
c84e14db46 | ||
|
|
919c5bd0b3 | ||
|
|
af8a8f1e3f | ||
|
|
41d08e123f | ||
|
|
67d9656e35 | ||
|
|
1a58a70494 | ||
|
|
a477b2efd1 | ||
|
|
59c4546b8c | ||
|
|
ed1a75ef4c | ||
|
|
0cd942f152 | ||
|
|
fe7f082083 | ||
|
|
849fd71f76 | ||
|
|
4e3a72388d | ||
|
|
29e3d9eff5 | ||
|
|
64280f4285 | ||
|
|
98c6eaac3b | ||
|
|
22d965c66c | ||
|
|
2eb932ebc1 | ||
|
|
2ee0634db3 | ||
|
|
db3b6a1252 | ||
|
|
24810aeca3 | ||
|
|
c888319f22 | ||
|
|
13ee78a9c9 | ||
|
|
acaa07cf7c | ||
|
|
1a3c9939e8 | ||
|
|
56afe21022 | ||
|
|
b58bfa82e6 | ||
|
|
a6257b5901 | ||
|
|
16ad7e53ff | ||
|
|
3e4e4f2664 | ||
|
|
dc0c4fe8fb | ||
|
|
0c050bb266 | ||
|
|
47a5b227cc | ||
|
|
ed61d0c591 | ||
|
|
8ff856ecf8 | ||
|
|
93a607bea0 | ||
|
|
7bec7ba49d | ||
|
|
4c8f3bd392 | ||
|
|
74ba9eb159 | ||
|
|
d28ca4eda7 | ||
|
|
9563b5a7df | ||
|
|
d3a049c6e0 | ||
|
|
a52a3eb42f | ||
|
|
c54b21a754 | ||
|
|
cc8995cd5c | ||
|
|
2e222fbae2 | ||
|
|
cdf3b15336 | ||
|
|
a9a95de02d | ||
|
|
d4bcd4ab0c | ||
|
|
3b2ed06864 | ||
|
|
ab210b3988 | ||
|
|
70617be903 | ||
|
|
f039d5bbcb | ||
|
|
e0adb3cf9a | ||
|
|
4dd6e07b8d | ||
|
|
d69b7951e0 | ||
|
|
d915ece2e7 | ||
|
|
f1be3df112 | ||
|
|
29b7ca4c25 | ||
|
|
f478d916aa | ||
|
|
d2e50b09db | ||
|
|
23c2dd33f2 | ||
|
|
ce0c3c935c | ||
|
|
bdbafb7a2a | ||
|
|
edffe2a6fc | ||
|
|
cd69a53406 | ||
|
|
439ffa5849 | ||
|
|
4518c30cbe | ||
|
|
6683809447 | ||
|
|
cccd43a16b | ||
|
|
91d44147bb | ||
|
|
777311bbf5 | ||
|
|
9ded5dc78d | ||
|
|
5b81c4573c | ||
|
|
32b2e9f6cf | ||
|
|
a6dba44561 | ||
|
|
03fc317a3f | ||
|
|
00a8130201 | ||
|
|
74fc15cccd | ||
|
|
1d4d919f6d | ||
|
|
1826cc8870 | ||
|
|
8a6dab03c4 | ||
|
|
dffad444c3 | ||
|
|
d6f1b164f7 | ||
|
|
4011f054d6 | ||
|
|
14e9978359 | ||
|
|
98535638a2 | ||
|
|
8861c04e77 | ||
|
|
42b6f320d8 | ||
|
|
31b4a9197f | ||
|
|
f06c9d5b9b | ||
|
|
130fafd7c2 | ||
|
|
e76f79cd56 | ||
|
|
ba21718cb9 | ||
|
|
6dfb2997cb | ||
|
|
ae9ac3b439 | ||
|
|
d70b5a9886 | ||
|
|
fb2a20201c | ||
|
|
d1761558b4 | ||
|
|
5bd0a53edd | ||
|
|
53ea73238a | ||
|
|
28560cb887 | ||
|
|
0bcd12aa4e | ||
|
|
a7dfdebed6 | ||
|
|
aca07530aa | ||
|
|
c0110c6bab | ||
|
|
0ef9e0fa75 | ||
|
|
ba0751917d | ||
|
|
e3c1bfbcba | ||
|
|
5aaa0a7b5f | ||
|
|
2ca75970c0 | ||
|
|
d9c92288be | ||
|
|
e4f231502a | ||
|
|
04a61e6fd6 | ||
|
|
dc5c7d2ee8 | ||
|
|
87ac6812a3 | ||
|
|
8d4d2d62c1 | ||
|
|
68fc036b7a | ||
|
|
f053c4d532 | ||
|
|
06e4a2dbde | ||
|
|
9e0ecab0c1 | ||
|
|
996e61a383 | ||
|
|
309aa4a3f3 | ||
|
|
0906fbf995 | ||
|
|
2348ec40ee | ||
|
|
c6852f4b96 | ||
|
|
8b01139738 | ||
|
|
5ea3717152 | ||
|
|
d01a673adb | ||
|
|
571ec44c33 | ||
|
|
e5a3c12026 | ||
|
|
bb2f1aa4be | ||
|
|
59070bcd5b | ||
|
|
2f52dd88a9 | ||
|
|
79fec3ac40 | ||
|
|
6247bbf4b1 | ||
|
|
11de155432 | ||
|
|
bfe833c132 | ||
|
|
1fd1da72f4 | ||
|
|
f4c994d182 | ||
|
|
d81a6e6e89 | ||
|
|
fab5daacf8 | ||
|
|
b714c6b746 | ||
|
|
af1355a94e | ||
|
|
ebc08fd6f5 | ||
|
|
30b1445195 | ||
|
|
0d1c7a1414 | ||
|
|
7e8e7757f4 | ||
|
|
42eb180b6c | ||
|
|
dff35bc9b7 | ||
|
|
6a87ed2853 | ||
|
|
1266d49c65 | ||
|
|
c8b130b232 | ||
|
|
67a6b0f383 | ||
|
|
e7c176f904 | ||
|
|
4cc8363b5f | ||
|
|
93193d7e76 | ||
|
|
d68321ac27 | ||
|
|
b2e8359d31 | ||
|
|
a302ca3d6c | ||
|
|
670358f235 | ||
|
|
10e329f762 | ||
|
|
6a3c1bdb99 | ||
|
|
90923c965b | ||
|
|
d555241d03 | ||
|
|
3d2b6b7620 | ||
|
|
0b943b418c | ||
|
|
db12aaad11 | ||
|
|
860aa65d10 | ||
|
|
2e5e279a14 | ||
|
|
df87b9ff56 | ||
|
|
6c06ff3ca0 | ||
|
|
40d6e9c841 | ||
|
|
6a4f06f325 | ||
|
|
f7d306cb02 | ||
|
|
34bc182c22 | ||
|
|
3f8dd7e658 | ||
|
|
46341fea96 | ||
|
|
4319cdbba1 | ||
|
|
3453236830 | ||
|
|
fa2058ec77 | ||
|
|
7f823fe2a8 | ||
|
|
58e14705b5 | ||
|
|
99b7613206 | ||
|
|
545e614c04 | ||
|
|
5ea04a388d | ||
|
|
8922372f4b | ||
|
|
ceaa2c1619 | ||
|
|
4e73daab79 | ||
|
|
5b29d987c8 | ||
|
|
1cd53c051d | ||
|
|
5460d0030f | ||
|
|
d14a0ce592 | ||
|
|
a4000a3286 | ||
|
|
85fd650f5c | ||
|
|
b19033a375 | ||
|
|
33e19ce9f6 | ||
|
|
d21218fd57 | ||
|
|
9f2279c675 | ||
|
|
06bfbfaff4 | ||
|
|
562834e0d0 | ||
|
|
bdf2285f14 | ||
|
|
1780682a8d | ||
|
|
9b48bd27dd | ||
|
|
0b1e2a6107 | ||
|
|
c78edf3fff | ||
|
|
6fcd99c6da | ||
|
|
b42f3a5400 | ||
|
|
bb543920a6 | ||
|
|
0845758023 | ||
|
|
816f81260a | ||
|
|
a9583f4440 | ||
|
|
4e52c9cc65 | ||
|
|
8299dded0b | ||
|
|
5d83cafc50 | ||
|
|
9819e60aae | ||
|
|
1182eb4a9f | ||
|
|
48a0986c14 | ||
|
|
6c2f7046d1 | ||
|
|
9735bffae5 | ||
|
|
56a11910db | ||
|
|
70b00dc4e3 | ||
|
|
56c1bf01a4 | ||
|
|
022b295aaa | ||
|
|
fd977895ab | ||
|
|
ad1f3ddbad | ||
|
|
c8b159e38c | ||
|
|
7405e3c12a | ||
|
|
1b8ca164c9 | ||
|
|
74cdaa9fcb | ||
|
|
0ba331485a | ||
|
|
f5b3c0affc | ||
|
|
316ae0c785 | ||
|
|
c2d2fa2579 | ||
|
|
d683eb2dd1 | ||
|
|
470d35e96c | ||
|
|
7464d82243 | ||
|
|
c61fed32db | ||
|
|
c4cdec5531 | ||
|
|
3ad9d38063 | ||
|
|
f8b95abf0c | ||
|
|
579794666a | ||
|
|
2ef25b6338 | ||
|
|
faddd94518 | ||
|
|
cd5f9b8bd4 | ||
|
|
94fd20e864 | ||
|
|
3558eef66b | ||
|
|
ee66e2154d | ||
|
|
5500a86f0b | ||
|
|
9b1c1774cd | ||
|
|
a8e31469c5 | ||
|
|
b70bafaf51 | ||
|
|
d393349b4d | ||
|
|
0904724694 | ||
|
|
eff4825000 | ||
|
|
091c00229a | ||
|
|
126f0d6036 | ||
|
|
f99bc6d8f9 | ||
|
|
3da0117838 | ||
|
|
3d8cf6a90b | ||
|
|
ac44663f04 | ||
|
|
57113b21ed | ||
|
|
57d5ace61c | ||
|
|
f4da80e7c6 | ||
|
|
df3ca5c7c8 | ||
|
|
4b676df37f | ||
|
|
5dc04266ea | ||
|
|
dbcfe3f5d2 | ||
|
|
fdbec5b0d2 | ||
|
|
3ea129b4f8 | ||
|
|
48a7e40520 | ||
|
|
08b956cf88 | ||
|
|
93b1e1f5ac | ||
|
|
bdecf6baf5 | ||
|
|
4528311d77 | ||
|
|
0bc1761dae | ||
|
|
f690b0edf6 | ||
|
|
10851772af | ||
|
|
66e7b28195 | ||
|
|
76021fb582 | ||
|
|
db50adbd9f | ||
|
|
5c7cc146a1 | ||
|
|
fa3b384c6f | ||
|
|
3f9a878b03 | ||
|
|
ab3b972185 | ||
|
|
fb9118a044 | ||
|
|
5cce5b6707 | ||
|
|
3256c9b3f5 | ||
|
|
8b43b2b69d | ||
|
|
02a862684d | ||
|
|
c15f5b5106 | ||
|
|
0f06d51065 | ||
|
|
8abfa419e8 | ||
|
|
c3c90ab78b | ||
|
|
666be21f59 | ||
|
|
0fe8197100 | ||
|
|
d8a7a7792a | ||
|
|
82b9a0c949 | ||
|
|
a3083d2990 | ||
|
|
3c62914304 | ||
|
|
a094768469 | ||
|
|
3965f063d3 | ||
|
|
2b7c295bf1 | ||
|
|
2fd297c1e1 | ||
|
|
263c04aeb2 | ||
|
|
8f2b5e195e | ||
|
|
7e3dd2b8cc | ||
|
|
49c027537e | ||
|
|
a1a6095295 | ||
|
|
5f7dcc9b78 | ||
|
|
1705bf4f3c | ||
|
|
8612946bf5 | ||
|
|
7cf40576dd | ||
|
|
239f35d830 | ||
|
|
05ff42b767 | ||
|
|
7bab4817f2 | ||
|
|
0d87b7d720 | ||
|
|
6b72adbeee | ||
|
|
db97ae46e5 | ||
|
|
fc6c084693 | ||
|
|
9e01cc5705 | ||
|
|
f9ce45c058 | ||
|
|
056ff4b6ea | ||
|
|
52653f73b9 | ||
|
|
a06207b814 | ||
|
|
3b3ef411a4 | ||
|
|
6418f78fdb | ||
|
|
5d4187bf03 | ||
|
|
cfffad73eb | ||
|
|
ef7db87b82 | ||
|
|
212eea9cf5 | ||
|
|
da792cc272 | ||
|
|
2ae2142b35 | ||
|
|
a00f5f308a | ||
|
|
81cfde12f3 | ||
|
|
1a53d38dae | ||
|
|
b834fdbc5e | ||
|
|
1cb2db03ed | ||
|
|
57bca50ed0 | ||
|
|
94386583e2 | ||
|
|
b1ab63d549 | ||
|
|
ad56bdd354 | ||
|
|
65e30c13e2 | ||
|
|
0c54fac651 | ||
|
|
9660c22a9f | ||
|
|
31e8df4a59 | ||
|
|
8e6ecaf8d4 | ||
|
|
4d69a0ce29 | ||
|
|
1b842f86ca | ||
|
|
a2330fb630 | ||
|
|
30f0232d71 | ||
|
|
404e658a5d | ||
|
|
f5682397c2 | ||
|
|
4896810258 | ||
|
|
dd0de8b6e1 | ||
|
|
2a9f9f7ebd | ||
|
|
2f3afd3637 | ||
|
|
f0a2c88fdc | ||
|
|
c3a5b12cd3 | ||
|
|
d7b0e66270 | ||
|
|
1871ed5441 | ||
|
|
5ea6948127 | ||
|
|
9bd77d36f1 | ||
|
|
3ffa6cd1ac | ||
|
|
ad87df3168 | ||
|
|
8bd0d32fd2 | ||
|
|
f182675a6e | ||
|
|
56ce89e04f | ||
|
|
062ec036f8 | ||
|
|
8089242b2f | ||
|
|
8efa1a0032 | ||
|
|
7ce8304ce6 | ||
|
|
233adab647 | ||
|
|
475c86d100 | ||
|
|
f754654dae | ||
|
|
53ce20c0df | ||
|
|
ad91e3a344 | ||
|
|
4f2b33f80f | ||
|
|
2b24d42f8d | ||
|
|
ab70f306cd | ||
|
|
4fb83fe0a5 | ||
|
|
9c6ef34270 | ||
|
|
481eb8e5dc | ||
|
|
7cf65b899b | ||
|
|
dd70fcb9bc | ||
|
|
6dd8c05533 | ||
|
|
0b900d94f7 | ||
|
|
cf724c43cb | ||
|
|
cdf5ac4fc4 | ||
|
|
b768ce4ca4 | ||
|
|
0115503af9 | ||
|
|
08dd30c5bf | ||
|
|
72270013c8 | ||
|
|
a2a59cbeae | ||
|
|
20a38d2dbe | ||
|
|
9aade0a2da | ||
|
|
9af1d1af52 | ||
|
|
8bb69cd6da | ||
|
|
84a84a1687 | ||
|
|
462c43434b | ||
|
|
b830691611 | ||
|
|
204f1747cf | ||
|
|
13c9d80a3b | ||
|
|
64f45b061b | ||
|
|
c1202fd127 | ||
|
|
2060f3f59a | ||
|
|
1fb92df2e7 | ||
|
|
848301bf70 | ||
|
|
08b5b71fcb | ||
|
|
5414d4a9e4 | ||
|
|
b930bd7326 | ||
|
|
d1d1be49ba | ||
|
|
6ad7963347 | ||
|
|
2dcda2487a | ||
|
|
55911eac7a | ||
|
|
176b109ae7 | ||
|
|
0f12d43a59 | ||
|
|
6dfc2aca4b | ||
|
|
f5a34d5191 | ||
|
|
bc3a7f70e4 | ||
|
|
dcabee8d5e | ||
|
|
d7e290dc68 | ||
|
|
2e2341c8b2 | ||
|
|
0ee717342b | ||
|
|
9f372b3146 | ||
|
|
dd92e36feb | ||
|
|
c25738c62c | ||
|
|
c264e98e6e | ||
|
|
f2780bcbc2 | ||
|
|
050b703fc0 | ||
|
|
eed09f64f7 | ||
|
|
28c4ad1501 | ||
|
|
28d1dad629 | ||
|
|
b5f0672888 | ||
|
|
71fc4faae7 | ||
|
|
8bff1e8bc4 | ||
|
|
af67dd6610 | ||
|
|
c46c700f7c | ||
|
|
2a2de2efdc | ||
|
|
f384c42de5 | ||
|
|
bf1c54e5a3 | ||
|
|
d8f2cc50df | ||
|
|
06c25ba998 | ||
|
|
58654a3f3a | ||
|
|
32521cd1b6 | ||
|
|
e072fe6ea9 | ||
|
|
b5897fdb62 | ||
|
|
55df525f1b | ||
|
|
e6dde68924 | ||
|
|
b3e2305dea | ||
|
|
ec3e3ed1fd | ||
|
|
30fc97eef6 | ||
|
|
5939692616 | ||
|
|
9ce3176b59 | ||
|
|
497d35b03b | ||
|
|
6a1191de31 | ||
|
|
6c3a17de71 | ||
|
|
22cf82e44b | ||
|
|
10c7e49273 | ||
|
|
4900eae751 | ||
|
|
5334c599f0 | ||
|
|
ad10a1eba5 | ||
|
|
3ca626f2a9 | ||
|
|
e7ad40d8f4 | ||
|
|
d38ab1145a | ||
|
|
f31360e1a4 | ||
|
|
059fead736 | ||
|
|
4e8360c030 | ||
|
|
fbd80746a5 | ||
|
|
072a5de1c5 | ||
|
|
5c3c5a5521 | ||
|
|
461b294bc7 | ||
|
|
71de0f2d08 | ||
|
|
2ffdc4f2ef | ||
|
|
dc9b320c4a | ||
|
|
a6a93148b4 | ||
|
|
f7dc3b9ce4 | ||
|
|
12ad5d53c9 | ||
|
|
54dc1e2e15 | ||
|
|
073f715f17 | ||
|
|
7ff50893dc | ||
|
|
d128082b23 | ||
|
|
1b8f89c3f1 | ||
|
|
8eb138e0b3 | ||
|
|
8256579310 | ||
|
|
41f1fb8d95 | ||
|
|
277d91afce | ||
|
|
aaa840ebef | ||
|
|
29ffdadabb | ||
|
|
e5f19fe037 | ||
|
|
5791d71e9f | ||
|
|
104a7022fb | ||
|
|
6210b613be | ||
|
|
2ba9380616 | ||
|
|
59042bc2e2 | ||
|
|
ccfd8e51ea | ||
|
|
1aafb6c2c1 | ||
|
|
7976aa4b28 | ||
|
|
1b4e175c0c | ||
|
|
3ef955c139 | ||
|
|
51990ed0e5 | ||
|
|
138523bab3 | ||
|
|
995ec2b104 | ||
|
|
d13f8749d4 | ||
|
|
0350443810 | ||
|
|
c5841dccbb | ||
|
|
a0c50f9ef5 | ||
|
|
120020b4db | ||
|
|
676747467a | ||
|
|
e2d13541dc | ||
|
|
057cbc76b3 | ||
|
|
48035187d2 | ||
|
|
f05f60f929 | ||
|
|
3ab19e81ac | ||
|
|
532be6cd87 | ||
|
|
21a492fa43 | ||
|
|
edf83823f1 | ||
|
|
8d6f7de046 | ||
|
|
a7de4f3663 | ||
|
|
e538f16315 | ||
|
|
3f8b3e2baa | ||
|
|
a90ecde389 | ||
|
|
1ad65bb66b | ||
|
|
d85bb3bce1 | ||
|
|
8cd4732321 | ||
|
|
6957b02c27 | ||
|
|
adcadf08d1 | ||
|
|
3b36145257 | ||
|
|
c3e5eaf8da | ||
|
|
fd176107ae | ||
|
|
ad203e1461 | ||
|
|
1fe9ba5879 | ||
|
|
678321bb2f | ||
|
|
967ce824f7 | ||
|
|
336e5e0ff7 | ||
|
|
7a94f472c7 | ||
|
|
70b41a2a6e | ||
|
|
216e7f3b10 | ||
|
|
0717da6e37 | ||
|
|
3f64316e00 | ||
|
|
172eaf84b5 | ||
|
|
0c20889a17 | ||
|
|
62523d537b | ||
|
|
6643252019 | ||
|
|
13022a6bb0 | ||
|
|
fc018691e5 | ||
|
|
56666c4bf4 | ||
|
|
379da81f85 | ||
|
|
9ce6d4b72a | ||
|
|
be46c31c74 | ||
|
|
cd4029dc61 | ||
|
|
d2aa55a3bd | ||
|
|
838be0846d | ||
|
|
9414cb97b5 | ||
|
|
d6883a077a | ||
|
|
aa60b8399b | ||
|
|
cbe504df77 | ||
|
|
e0efcc1f25 | ||
|
|
c6e536a768 | ||
|
|
77ba53bda7 | ||
|
|
c2c6f1493a | ||
|
|
debaed6e5e | ||
|
|
0d6279617b | ||
|
|
3435314400 | ||
|
|
f248a8383b | ||
|
|
5458b007d1 | ||
|
|
6735291c99 | ||
|
|
6ad7a20c07 | ||
|
|
3191825ecc | ||
|
|
baee6b9738 | ||
|
|
c4a7f899db | ||
|
|
c01623ba56 | ||
|
|
81d0d5c59f | ||
|
|
cc4fdfd852 | ||
|
|
ba7be29153 | ||
|
|
4eae95b88d | ||
|
|
06d8281f16 | ||
|
|
87c21ba75e | ||
|
|
7f88a7c9bb | ||
|
|
38c57a662c | ||
|
|
36f5ddc543 | ||
|
|
8b873b6b1b | ||
|
|
68bd881ca8 | ||
|
|
c3e717a3ef | ||
|
|
d9be6f8a9a | ||
|
|
3bfb9d65f4 | ||
|
|
9ad26f943f | ||
|
|
c5112cb24e | ||
|
|
c17e1f9e75 | ||
|
|
b48b454909 | ||
|
|
6b59a924e8 | ||
|
|
87879a6784 | ||
|
|
fca5fda9da | ||
|
|
691d566482 | ||
|
|
61578f4dca | ||
|
|
9f4a7fc0da | ||
|
|
200a5d84c7 | ||
|
|
309a2ad0a3 | ||
|
|
e696331e2a | ||
|
|
c3126e24ce | ||
|
|
bde931f2f5 | ||
|
|
58b3e9f201 | ||
|
|
1423dcb619 | ||
|
|
df3540b0f9 | ||
|
|
921209580a | ||
|
|
d4e058a844 | ||
|
|
8f9eed154e | ||
|
|
1416655d53 | ||
|
|
9a147218ce | ||
|
|
34b575da03 | ||
|
|
54d22a23b5 | ||
|
|
ee10e17ce7 | ||
|
|
8ff97468cc | ||
|
|
6f898c6c97 | ||
|
|
cfeb8d053f | ||
|
|
d317171a45 | ||
|
|
9b0aadccf8 | ||
|
|
d6850ab358 | ||
|
|
c139a0d9ed | ||
|
|
67b0c4cddd | ||
|
|
ce36bf6134 | ||
|
|
e2dd65a403 | ||
|
|
a2595d5107 | ||
|
|
6dc0cf0c44 | ||
|
|
faac630001 | ||
|
|
0deacc7229 | ||
|
|
c849fe1496 | ||
|
|
4238e84ec4 | ||
|
|
df4e306c64 | ||
|
|
916c728d70 | ||
|
|
476d85915b | ||
|
|
e54b8ead72 | ||
|
|
d2444d2992 | ||
|
|
48acda2c3c | ||
|
|
264f7b1d30 | ||
|
|
fc44d54607 | ||
|
|
afc3698578 | ||
|
|
c3cd94b695 | ||
|
|
ea219f683e | ||
|
|
faf6584652 | ||
|
|
4dc41749fb | ||
|
|
2aa94301a8 | ||
|
|
d2870b6df7 | ||
|
|
5cbc44610c | ||
|
|
9032cc0ecc | ||
|
|
e48b314ad0 | ||
|
|
6fdaf905c4 | ||
|
|
79b706fb5c | ||
|
|
eaee188244 | ||
|
|
a6ac62d628 | ||
|
|
7a7f12504b | ||
|
|
55c83d17e1 | ||
|
|
8009c1b7eb | ||
|
|
1580453f4b | ||
|
|
9cc8f5dd07 | ||
|
|
7e326b8431 | ||
|
|
8bddb47fab | ||
|
|
b1b462d22b | ||
|
|
d5847faaba | ||
|
|
4c9f3aee74 | ||
|
|
ff4e0cb1c2 | ||
|
|
c159da1fbc | ||
|
|
d5e55f9dbd | ||
|
|
642ed4061a | ||
|
|
5178c3e67f | ||
|
|
e402347d73 | ||
|
|
3004c58798 | ||
|
|
15a44fe650 | ||
|
|
e37a96a94a | ||
|
|
e475a3b64c | ||
|
|
663ebd25ea | ||
|
|
e6bec0de72 | ||
|
|
f513effd47 | ||
|
|
dd05e898cc | ||
|
|
49a88e75e6 | ||
|
|
14a99471f4 | ||
|
|
bdbc181e38 | ||
|
|
133b1151bd | ||
|
|
653aab2358 | ||
|
|
13669313d4 | ||
|
|
e84d79ccf3 | ||
|
|
34077f9624 | ||
|
|
28ba64a4db | ||
|
|
0eefd3e140 | ||
|
|
20bbfc5917 | ||
|
|
9d6832224e | ||
|
|
2cf17b19dc | ||
|
|
390cf2114a | ||
|
|
8bff019b5d | ||
|
|
7d221f3be9 | ||
|
|
b8628b9772 | ||
|
|
cda4d9e1b2 | ||
|
|
f5d7a4d41e | ||
|
|
94486302f5 | ||
|
|
4f4a7409f6 | ||
|
|
60f57f9e4b | ||
|
|
2f98cd9eb0 | ||
|
|
f77586f13d | ||
|
|
fa82091989 | ||
|
|
66e9c68da4 | ||
|
|
c97c2fee37 | ||
|
|
fd03500786 | ||
|
|
83d5c31a0c | ||
|
|
7f19c10da9 | ||
|
|
c10ea527a0 | ||
|
|
5a54c1520a | ||
|
|
3f2732be7b | ||
|
|
d504b1f90f | ||
|
|
210dac058d | ||
|
|
ccb3012e5a | ||
|
|
c94f2e6f07 | ||
|
|
e31d7178b4 | ||
|
|
b3a4b8085c | ||
|
|
b56d7ab9c3 | ||
|
|
c63e270921 | ||
|
|
cffbae3a13 | ||
|
|
d2d03228ee | ||
|
|
30458fa536 | ||
|
|
0e60831f46 | ||
|
|
69238bf8e8 | ||
|
|
db483df9a6 | ||
|
|
1dc95f5d3a | ||
|
|
37caef10b1 | ||
|
|
381ecd8f70 | ||
|
|
f2a829362b | ||
|
|
fe2e994f2d | ||
|
|
95ba6bf040 | ||
|
|
6f937e8958 | ||
|
|
12f04650de | ||
|
|
f7330cce14 | ||
|
|
ba56f95da8 | ||
|
|
46704724e3 | ||
|
|
caadd5bb32 | ||
|
|
faa221f162 | ||
|
|
a814d5438a | ||
|
|
ab43c4cf2a | ||
|
|
d781e2dfb8 | ||
|
|
968ef1560f | ||
|
|
1631ceedb3 | ||
|
|
884c2af17d | ||
|
|
51ab030541 | ||
|
|
2a1e063641 | ||
|
|
62b3120ffd | ||
|
|
ea17b3d7c9 | ||
|
|
f3e98fc71c | ||
|
|
5034e11f22 | ||
|
|
560473d70b | ||
|
|
10e53509bd | ||
|
|
27afb02482 | ||
|
|
07fd0989ea | ||
|
|
d7c38aea50 | ||
|
|
20d57e27c9 | ||
|
|
4606c8092f | ||
|
|
30f256aad2 | ||
|
|
1b9dbd0e62 | ||
|
|
225c8871f9 | ||
|
|
d0333134d5 | ||
|
|
b24b8315d3 | ||
|
|
4ddc3b518b | ||
|
|
479a7e441d | ||
|
|
af5ae8d656 | ||
|
|
1365882de4 | ||
|
|
7854cd1f94 | ||
|
|
12a1a14527 | ||
|
|
a71cc552c9 | ||
|
|
e42d091502 | ||
|
|
d89d5befa0 | ||
|
|
92e5ae29c9 | ||
|
|
65aeb97e3e | ||
|
|
08a9ef1072 | ||
|
|
9c3f297e97 | ||
|
|
2554871c64 | ||
|
|
404edebdff | ||
|
|
2f2030babf | ||
|
|
b560b35175 | ||
|
|
3063b19e1d | ||
|
|
a17fb54c37 | ||
|
|
c1b8a8594d | ||
|
|
0a7fc6c48c | ||
|
|
79d59ff9ca | ||
|
|
c7d3c78e72 | ||
|
|
d56322a032 | ||
|
|
aac3c4d5c7 | ||
|
|
9ba1ddc2dd | ||
|
|
61eeaa0496 | ||
|
|
d3b6f9975c | ||
|
|
5200c8d659 | ||
|
|
e2c6f57859 | ||
|
|
b084210705 | ||
|
|
6622922468 | ||
|
|
caf31eb6d3 | ||
|
|
464691f129 | ||
|
|
afcf539e6e | ||
|
|
bf2c1a2df2 | ||
|
|
7400064cd5 | ||
|
|
7eb3754807 | ||
|
|
a9cc2fdb54 | ||
|
|
212282e77c | ||
|
|
1e8a820108 | ||
|
|
0117341b7e | ||
|
|
d21eac8b18 | ||
|
|
af4edc3b76 | ||
|
|
8a959896bf | ||
|
|
ba5107e801 | ||
|
|
d7de4a3579 | ||
|
|
175b14860e | ||
|
|
72fcb4ebda | ||
|
|
3a221f9b6e | ||
|
|
1241fb54f3 | ||
|
|
b291dcadc6 | ||
|
|
4105b19f75 | ||
|
|
b7b8ad7760 | ||
|
|
8465e3061a | ||
|
|
6b09cd61d2 | ||
|
|
aac609cc38 | ||
|
|
0b1d16f9db | ||
|
|
7374f6dc4f | ||
|
|
9577d80fc2 | ||
|
|
c550e27d21 | ||
|
|
423730da76 | ||
|
|
78a4c6f525 | ||
|
|
0d3ac21ae0 | ||
|
|
2cae3245aa | ||
|
|
e143a0ec6b | ||
|
|
35ce087f3b | ||
|
|
e787bc8ae4 | ||
|
|
4937052475 | ||
|
|
739eb67bec | ||
|
|
a3049b6f94 | ||
|
|
2f1346fefa | ||
|
|
f116db3108 | ||
|
|
87a8780cca | ||
|
|
d2de62283b | ||
|
|
11c16139c2 | ||
|
|
1c91ec69ba | ||
|
|
73429e7779 | ||
|
|
fe5aff0c72 | ||
|
|
c36d29a896 | ||
|
|
e3b5395905 | ||
|
|
3a25ecbbc9 | ||
|
|
7d63970293 | ||
|
|
ee267d23ba | ||
|
|
e0e4eed26b | ||
|
|
5b280bd60d | ||
|
|
2f9cc91b64 | ||
|
|
36bcced355 | ||
|
|
9a9b17d38d | ||
|
|
e2cd275ac5 | ||
|
|
61eb5d906c | ||
|
|
a113dc0861 | ||
|
|
6a164a235d | ||
|
|
c1eaa90c2b | ||
|
|
00e00eb7b5 | ||
|
|
0d2db28908 | ||
|
|
20202b793b | ||
|
|
62e84e73ae | ||
|
|
73f6fd49d0 | ||
|
|
4f9da35b76 | ||
|
|
cc7b413a2a | ||
|
|
fcf29f357d | ||
|
|
4fd1eae84f | ||
|
|
1c770a3c66 | ||
|
|
e152f54903 | ||
|
|
5d3a9d817a | ||
|
|
e884916275 | ||
|
|
5b7b16416b | ||
|
|
04b93aeaf2 | ||
|
|
39bdd37615 | ||
|
|
4ccb3810c2 | ||
|
|
1065ebb0aa | ||
|
|
74c08de530 | ||
|
|
b195fdbf60 | ||
|
|
f68efe6674 | ||
|
|
ed309182bf | ||
|
|
50c6b276f9 | ||
|
|
4c1a8f358a | ||
|
|
05ff79f347 | ||
|
|
3ae328898d | ||
|
|
7d35c43def | ||
|
|
d4f857b739 | ||
|
|
b6bc844b4d | ||
|
|
d06a477371 | ||
|
|
c128c029f3 | ||
|
|
a58ad5006f | ||
|
|
3c5655fc3d | ||
|
|
6ab04866ec | ||
|
|
1f07f9d127 | ||
|
|
e5ccfc4446 | ||
|
|
ec89382e35 | ||
|
|
4a7873ef77 | ||
|
|
ff2fd45ff0 | ||
|
|
e8cfeec0cf | ||
|
|
c72171d1da | ||
|
|
885b56000b | ||
|
|
3d1ee9dcf0 | ||
|
|
5d2133a483 | ||
|
|
52bb56ba43 | ||
|
|
d2edf11726 | ||
|
|
9a152c23bb | ||
|
|
8572445f57 | ||
|
|
9940d73167 | ||
|
|
8b8a9ae854 | ||
|
|
036bf92223 | ||
|
|
410969743f | ||
|
|
14da67121c | ||
|
|
681d3e09ba | ||
|
|
0ce130efa7 | ||
|
|
d14d7ade85 | ||
|
|
7b4fd28ef1 | ||
|
|
b2280b2d72 | ||
|
|
b41826c332 | ||
|
|
3d93ed9059 | ||
|
|
35a0756e5a | ||
|
|
10419366f9 | ||
|
|
8373d31013 | ||
|
|
0c89a8f145 | ||
|
|
257ac4d37e | ||
|
|
653aee8b07 | ||
|
|
88726aff8c | ||
|
|
baabdb4ac2 | ||
|
|
6277510557 | ||
|
|
e9ab17fcb1 | ||
|
|
2f9ba719d4 | ||
|
|
e259f300b1 | ||
|
|
fcc357ddd1 | ||
|
|
e613198af7 | ||
|
|
e3c1214971 | ||
|
|
1c3f9f7fbf | ||
|
|
f4a1573586 | ||
|
|
95db668c3c | ||
|
|
691e21fa78 | ||
|
|
c555681c8b | ||
|
|
ae7ef24196 | ||
|
|
f935b141f1 | ||
|
|
a893d43d16 | ||
|
|
7cb47c8494 | ||
|
|
5ef4c763b6 | ||
|
|
459b5bd89c | ||
|
|
c5237a926d | ||
|
|
2e5052a7fa | ||
|
|
cd8d9bf07c | ||
|
|
7da022ebb4 | ||
|
|
67f9c7e0f0 | ||
|
|
1812d557b6 | ||
|
|
34cde430a5 | ||
|
|
12a6b58614 | ||
|
|
cb81fccfaf | ||
|
|
1ce0fffd25 | ||
|
|
0c1c4b08c7 | ||
|
|
c875b61003 | ||
|
|
f4b34c8ca5 | ||
|
|
a6b4b5e30c | ||
|
|
64fb8f0c53 | ||
|
|
78a312f61c | ||
|
|
2c6c4426e8 | ||
|
|
a9df0601a6 | ||
|
|
4345f353a0 | ||
|
|
96b525658e | ||
|
|
9525952573 | ||
|
|
76828a87ee | ||
|
|
789eb59904 | ||
|
|
c0265f8fd9 | ||
|
|
891ebb8ff6 | ||
|
|
1111c20d54 | ||
|
|
387176e83d | ||
|
|
80a38b285d | ||
|
|
aa0c02a243 | ||
|
|
3c5932af75 | ||
|
|
f40a7d47f5 | ||
|
|
f85543c7ff | ||
|
|
36d2ff7c3b | ||
|
|
7ba673ed89 | ||
|
|
a0cba79df2 | ||
|
|
c91e8d7aa7 | ||
|
|
e85b0a81ba | ||
|
|
bfc40498bd | ||
|
|
41ac7062f8 | ||
|
|
71c19b566b | ||
|
|
0de72f3abb | ||
|
|
ce3c78d30b | ||
|
|
7152308c25 | ||
|
|
cd838d4902 | ||
|
|
f7799eee59 | ||
|
|
247718bc6c | ||
|
|
6b5521fbf7 | ||
|
|
13e00379ae | ||
|
|
347663716c | ||
|
|
69415ea966 | ||
|
|
6c71e3c583 | ||
|
|
06861ceb55 | ||
|
|
6e286473ab | ||
|
|
6091219aaf | ||
|
|
76cee1287a | ||
|
|
ff138c6d47 | ||
|
|
a89f8b8098 | ||
|
|
f4009a9944 | ||
|
|
16b479d21e | ||
|
|
0f8c20c3ab | ||
|
|
d5c3b258f3 | ||
|
|
ee4a703407 | ||
|
|
e901208721 | ||
|
|
5deb7371ab | ||
|
|
f999195f47 | ||
|
|
9b920cf813 | ||
|
|
4155e8e0ce | ||
|
|
b583530c66 | ||
|
|
43c13c22a8 | ||
|
|
32167b45ce | ||
|
|
f09ae1e2e3 | ||
|
|
086e1e1a74 | ||
|
|
1020637d79 | ||
|
|
9c30d69d55 | ||
|
|
ff673f053b | ||
|
|
2514987d3e | ||
|
|
e332a916b0 | ||
|
|
5eb7faec29 | ||
|
|
8cfebee922 | ||
|
|
f4a22f8aef | ||
|
|
5fd641e8c7 | ||
|
|
4cde537a7f | ||
|
|
56ee4c1ae5 | ||
|
|
1874ad2ff2 | ||
|
|
907ed641bf | ||
|
|
a23ccd863d | ||
|
|
8d145d7a32 | ||
|
|
4a0419e554 | ||
|
|
f23a458319 | ||
|
|
1e324103cc | ||
|
|
85d8ced299 | ||
|
|
0631b8f052 | ||
|
|
649994464c | ||
|
|
8c618780b7 | ||
|
|
0dc2e8994b | ||
|
|
d25ab4f204 | ||
|
|
ff26080c5c | ||
|
|
95bd2dde19 | ||
|
|
6ad31a5441 | ||
|
|
702a82bb38 | ||
|
|
a5e91385b0 | ||
|
|
4c690b9d4c | ||
|
|
695d6e14d4 | ||
|
|
c19f87134e | ||
|
|
3de50e8dd4 | ||
|
|
fb20dae0a8 | ||
|
|
0f8db11f53 | ||
|
|
e3f94156f1 | ||
|
|
cf468fc4d1 | ||
|
|
849cf30b95 | ||
|
|
d08febc711 | ||
|
|
53bfafb84c | ||
|
|
40809e40c2 | ||
|
|
925197ae09 | ||
|
|
07f72de63d | ||
|
|
f17f62b532 | ||
|
|
b97bbe0572 | ||
|
|
9e4cc7fdbc | ||
|
|
7dcb56ea5c | ||
|
|
a814c6d152 | ||
|
|
cbe3a0fde7 | ||
|
|
7e375370fa | ||
|
|
1d149b100b | ||
|
|
1bce75ed53 | ||
|
|
d8a72fe797 | ||
|
|
5bd8319f99 | ||
|
|
d8221b880b | ||
|
|
1316ce5ca8 | ||
|
|
d5562767a2 | ||
|
|
1a03ee8b9b | ||
|
|
d07e53e9a0 | ||
|
|
04160e6acc | ||
|
|
6f4c7ca171 | ||
|
|
2d397efcf5 | ||
|
|
ba8e59e1bd | ||
|
|
568faa526f | ||
|
|
b761fbaabe | ||
|
|
4a493a96d7 | ||
|
|
601244ba74 | ||
|
|
d606197264 | ||
|
|
1fee10e167 | ||
|
|
674802abe4 | ||
|
|
179422a84b | ||
|
|
5c9e4685db | ||
|
|
c59f8c734a | ||
|
|
d2fa2be5af | ||
|
|
2d3d66e9d1 | ||
|
|
21713801ad | ||
|
|
598e2adebe | ||
|
|
8bbb84fdc7 | ||
|
|
59b7bc7b98 | ||
|
|
55d52be3c2 | ||
|
|
3aa4e45bdb | ||
|
|
534976e64f | ||
|
|
3efa9d2030 | ||
|
|
2c4657355f | ||
|
|
68702ca43f | ||
|
|
54a0de9b52 | ||
|
|
94832f3f81 | ||
|
|
fb00ba9efd | ||
|
|
96736cf1de | ||
|
|
834c55ec6f | ||
|
|
6528a434ce | ||
|
|
a24ee0a331 | ||
|
|
e86144bb06 | ||
|
|
ce7cb16cfe | ||
|
|
754bafc069 | ||
|
|
7eff6fde7c | ||
|
|
626dac600a | ||
|
|
f1b2d4340d | ||
|
|
aea4d73e61 | ||
|
|
3d6c74ead1 | ||
|
|
c606f80fe3 | ||
|
|
250ca36f05 | ||
|
|
4c63be066f | ||
|
|
b559eeb7e6 | ||
|
|
a9742dbdc6 | ||
|
|
5feaade1c7 | ||
|
|
31747dfecd | ||
|
|
eda9484413 | ||
|
|
7e904c1d15 | ||
|
|
5f8527ba04 | ||
|
|
082e95b700 | ||
|
|
aef5c61415 | ||
|
|
68fdac532f | ||
|
|
f718284538 | ||
|
|
966283dd6d | ||
|
|
0f3ec9ad73 | ||
|
|
cb685904ef | ||
|
|
5bf545ee90 | ||
|
|
b018ada5c8 | ||
|
|
976e81be43 | ||
|
|
694cb18256 | ||
|
|
a715a5fa37 | ||
|
|
1e10c9d508 | ||
|
|
2aacfea8ea | ||
|
|
43c2cb4ba8 | ||
|
|
c93f708bc8 | ||
|
|
353416a088 | ||
|
|
93b98abb8d | ||
|
|
5e28e38c98 | ||
|
|
0e828e5b3b | ||
|
|
c331d12678 | ||
|
|
f0817b2461 | ||
|
|
d3f2cd5321 | ||
|
|
7017766591 | ||
|
|
841890c178 | ||
|
|
4f5189b0dd | ||
|
|
250ecd13bd | ||
|
|
34133b094b | ||
|
|
75c3939c88 | ||
|
|
cb44430a3f | ||
|
|
be88b5aba2 | ||
|
|
3d0f7b8e7e | ||
|
|
a53d5dc791 | ||
|
|
7f1164b6a6 | ||
|
|
2174f10db5 | ||
|
|
e3c218092c | ||
|
|
cf73ba2905 | ||
|
|
d653b951e3 | ||
|
|
900c0eafac | ||
|
|
bf6eaaf625 | ||
|
|
32f3d214cb | ||
|
|
cd62b2a209 | ||
|
|
ff25b4cb46 | ||
|
|
5c07dd995e | ||
|
|
f54cc28a43 | ||
|
|
9b1c7bb1e3 | ||
|
|
ffe8a729b7 | ||
|
|
a47f356021 | ||
|
|
7d7a34c733 | ||
|
|
e306959ebe | ||
|
|
ce16c4d37f | ||
|
|
565cc05b48 | ||
|
|
287839e498 | ||
|
|
4be0969098 | ||
|
|
f1008b1abf | ||
|
|
8d8b3c2194 | ||
|
|
6631b57fc0 | ||
|
|
88b4bc3753 | ||
|
|
23a4dde10f | ||
|
|
5a47eb8559 | ||
|
|
81cd990052 | ||
|
|
dd9e7cf665 | ||
|
|
b2f50b5327 | ||
|
|
b21fe4b2fc | ||
|
|
5f23a3143c | ||
|
|
ef136c9d00 | ||
|
|
c7e8b724c7 | ||
|
|
0243e7ba8b | ||
|
|
b3f5375283 | ||
|
|
f90f683be5 | ||
|
|
bd23666b45 | ||
|
|
a620c2ec1a | ||
|
|
a723612141 | ||
|
|
2d7d4212c1 | ||
|
|
52cca034cf | ||
|
|
79ec1f5a02 | ||
|
|
68729a9696 | ||
|
|
93383204b3 | ||
|
|
78f17bd083 | ||
|
|
ea87006150 | ||
|
|
c0027c377b | ||
|
|
77b84c1de0 | ||
|
|
a14e2fedcf | ||
|
|
0341399e54 | ||
|
|
1dcf3585fb | ||
|
|
dbb48cf086 | ||
|
|
064c8adcf2 | ||
|
|
cff83e095a | ||
|
|
ff9aecca48 | ||
|
|
53c529a12c | ||
|
|
78454ba876 | ||
|
|
c3c1702d2b | ||
|
|
bffc777b58 | ||
|
|
fcec6a8fdf | ||
|
|
a842f25f89 | ||
|
|
9f2bea8ac1 | ||
|
|
7f9a2a2d34 | ||
|
|
3225f17f5a | ||
|
|
2f8b1dff27 | ||
|
|
7884f972ea | ||
|
|
bfce264537 | ||
|
|
dee5f4c96a | ||
|
|
6bd83137fb | ||
|
|
6c6c38679a | ||
|
|
ca0c700afa | ||
|
|
cc2e434f3d | ||
|
|
4d337f0bee | ||
|
|
539c10883b | ||
|
|
ae8796a570 | ||
|
|
141227d846 | ||
|
|
bb42b87f4e | ||
|
|
866d9dacb6 | ||
|
|
006e32077c | ||
|
|
0aca1c6c7c | ||
|
|
d906d56505 | ||
|
|
3b9ebf358c | ||
|
|
1c643cda5b | ||
|
|
e5697a8070 | ||
|
|
07f1a13cbf | ||
|
|
4c88f3ad64 | ||
|
|
c099d60393 | ||
|
|
5e0d48b40f | ||
|
|
c4f8e83d02 | ||
|
|
a768c1e6c0 | ||
|
|
540325dc20 | ||
|
|
2e57f76c12 | ||
|
|
e71fd6f8b4 | ||
|
|
c721721fc5 | ||
|
|
0ab5d6a7b8 | ||
|
|
66599e5770 | ||
|
|
d7c7463380 | ||
|
|
491a4468dc | ||
|
|
c85150aaea | ||
|
|
c7ba6d2a82 | ||
|
|
ace64cf50f | ||
|
|
cd6d4f6f47 | ||
|
|
1bdf74951a | ||
|
|
eda2b38f46 | ||
|
|
f14e85d6c4 | ||
|
|
76f668dddd | ||
|
|
ce01d696a0 | ||
|
|
8179a3a349 | ||
|
|
e5c397203e | ||
|
|
60aeba732d | ||
|
|
de70ef1ef6 | ||
|
|
1d02c288b3 | ||
|
|
3776920807 | ||
|
|
7d54cde8eb | ||
|
|
1bab2061bd | ||
|
|
34e30cba0d | ||
|
|
ed600c9077 | ||
|
|
30dc6d2b19 | ||
|
|
77c3b4636e | ||
|
|
25edcbaff9 | ||
|
|
553b8fb2e0 | ||
|
|
461b401e28 | ||
|
|
d2a4611d1e | ||
|
|
65c3dbba2c | ||
|
|
7ef0b5b428 | ||
|
|
89589d7ef5 | ||
|
|
70b782c7e7 | ||
|
|
9732b0a636 | ||
|
|
00acaa56b9 | ||
|
|
1cea2be9c1 | ||
|
|
94381bd899 | ||
|
|
23d935d7ec | ||
|
|
69da13b261 | ||
|
|
a6519e0ff7 | ||
|
|
b701a36e21 | ||
|
|
24a34088d8 | ||
|
|
0eeb092aad | ||
|
|
7d4726d12e | ||
|
|
e13bf164ea | ||
|
|
07434b19ae | ||
|
|
819fa88eb7 | ||
|
|
95976814f5 | ||
|
|
0a2dd2a330 | ||
|
|
65f125d998 | ||
|
|
7a2f6ebfd5 | ||
|
|
5d89fa3f07 | ||
|
|
4a66e28584 | ||
|
|
85990bbeb3 | ||
|
|
e0311e1530 | ||
|
|
6eb4dbf9cd | ||
|
|
a90453461e | ||
|
|
7e04c9a909 | ||
|
|
e51602ccfa | ||
|
|
ca7adb59db | ||
|
|
3a12802a4b | ||
|
|
c770eab3e3 | ||
|
|
079b8e7337 | ||
|
|
2e4593eee7 | ||
|
|
3ca80a7bf3 | ||
|
|
a4c15e5fa5 | ||
|
|
a40748e3aa | ||
|
|
029aac8059 | ||
|
|
2970f66218 | ||
|
|
ef238de7a7 | ||
|
|
af05313dc5 | ||
|
|
df0d1b57a0 | ||
|
|
23cff25ed5 | ||
|
|
c70b13a650 | ||
|
|
a51c6a7670 | ||
|
|
0bdb643e14 | ||
|
|
0cbbbf1287 | ||
|
|
9a00b62d28 | ||
|
|
05dce760d6 | ||
|
|
4eaf91c3dc | ||
|
|
818c3d6140 | ||
|
|
5e19cd0084 | ||
|
|
7b06257955 | ||
|
|
2af21c8003 | ||
|
|
db6f907946 | ||
|
|
125ed8bff2 | ||
|
|
1d0f2e9d31 | ||
|
|
43efc930f4 | ||
|
|
737e18d2de | ||
|
|
445445603f | ||
|
|
5957c94958 | ||
|
|
1c41661712 | ||
|
|
1b2909605e | ||
|
|
c6a13f970f | ||
|
|
f2f57dc5a5 | ||
|
|
c6de1ab56c | ||
|
|
0392e37eed | ||
|
|
f630c4ec6c | ||
|
|
e668642b23 | ||
|
|
c4c0c050af | ||
|
|
b4ff8360ba | ||
|
|
708a2ec703 | ||
|
|
407cb2f7e6 | ||
|
|
0b22e76b85 | ||
|
|
7671187160 | ||
|
|
5695e0e6b6 | ||
|
|
e22b2f00dc | ||
|
|
2a017c3a7c | ||
|
|
ce65c3113a | ||
|
|
65a2ebb8ad | ||
|
|
f0a542b154 | ||
|
|
dfe1c940bc | ||
|
|
3cd8708368 | ||
|
|
e677161e49 | ||
|
|
818c6711d8 | ||
|
|
f60cc76f3e | ||
|
|
685321fdc5 | ||
|
|
303215d42f | ||
|
|
f313752888 | ||
|
|
28b83a486e | ||
|
|
80289bd452 | ||
|
|
054be39feb | ||
|
|
6448e049d1 | ||
|
|
8e1f7c8d6f | ||
|
|
c4e31e7a58 | ||
|
|
0860d9712e | ||
|
|
1a17cbd26b | ||
|
|
c2b1d3b551 | ||
|
|
d4fac798fc | ||
|
|
b009b23245 | ||
|
|
f276f1e2f5 | ||
|
|
154e57748f | ||
|
|
6854fee73e | ||
|
|
24240bfba4 | ||
|
|
40e32daabe | ||
|
|
008cbc8972 | ||
|
|
8a1d2b614a | ||
|
|
b79d03d9a4 | ||
|
|
83fb9f84ed | ||
|
|
c634830b9f | ||
|
|
24edd68833 | ||
|
|
6913798250 | ||
|
|
131bd2c2cd | ||
|
|
55ae55c803 | ||
|
|
63f0eea70c | ||
|
|
38aeef0760 | ||
|
|
88d5f5d76c | ||
|
|
486ba5fe0a | ||
|
|
76f85389ae | ||
|
|
3d311496e0 | ||
|
|
fdbfe0f84b | ||
|
|
8a25592904 | ||
|
|
7edf024c71 | ||
|
|
ee4d9890e7 | ||
|
|
9cc06a94ec | ||
|
|
dd6dc1d334 | ||
|
|
fb2bafb49e | ||
|
|
bc3b8e73fe | ||
|
|
4d48441102 | ||
|
|
c0fa980f70 | ||
|
|
bb3bac9933 | ||
|
|
1ac5fa544b | ||
|
|
91bb4d4b00 | ||
|
|
aecdd0fdd5 | ||
|
|
2e5f3cd25c | ||
|
|
8558c55284 | ||
|
|
b16b49aea4 | ||
|
|
09678eeef4 | ||
|
|
fad43842a4 | ||
|
|
4b448a877c | ||
|
|
f090af2292 | ||
|
|
7faaac94dd | ||
|
|
dae0b25717 | ||
|
|
de3d9dca72 | ||
|
|
a91abb3e8d | ||
|
|
dabea8b972 | ||
|
|
dedffb3560 | ||
|
|
5eb2306e9a | ||
|
|
8a2e06a713 | ||
|
|
23b495aee8 | ||
|
|
b9d314e64c | ||
|
|
5a4826e660 | ||
|
|
20bf67d352 | ||
|
|
8b4f1e1383 | ||
|
|
20297e359d | ||
|
|
de7409fd07 | ||
|
|
8498f12a9d | ||
|
|
e949eb8623 | ||
|
|
201d17bc31 | ||
|
|
143e9bd210 | ||
|
|
9ec874d8a6 | ||
|
|
2543afebf1 | ||
|
|
81a859604c | ||
|
|
d3be4bba37 | ||
|
|
6779c9eb36 | ||
|
|
733da570c8 | ||
|
|
65258d5b6a | ||
|
|
618c8bb5ad | ||
|
|
ba8684dfc7 | ||
|
|
36a1bd9e0f | ||
|
|
fe56c1c6f2 | ||
|
|
86a37e6f8d | ||
|
|
da1aad7b92 | ||
|
|
876621f8af | ||
|
|
8a908b720f | ||
|
|
dadde52c40 | ||
|
|
369dd98cbe | ||
|
|
8cdd6cd131 | ||
|
|
973bc21f37 | ||
|
|
2ba327345d | ||
|
|
138ecc4ee1 | ||
|
|
5b9a8e9bf9 | ||
|
|
e520486892 | ||
|
|
ecb91613e8 | ||
|
|
d4ac76081e | ||
|
|
63727b67ee | ||
|
|
d969dcecbf | ||
|
|
49c9a202e0 | ||
|
|
512c8de526 | ||
|
|
012a929067 | ||
|
|
bec4e8d8e4 | ||
|
|
9f0993f29b | ||
|
|
1b79448ac2 | ||
|
|
6cef7d5060 | ||
|
|
752545ec0e | ||
|
|
adbebf7ecc | ||
|
|
4d57ac0ce1 | ||
|
|
24b77d9dcb | ||
|
|
cc0f431c35 | ||
|
|
1e7927fbff | ||
|
|
129e56e570 | ||
|
|
5beef690ad | ||
|
|
b0383b0978 | ||
|
|
16c6a11b77 | ||
|
|
9117b13576 | ||
|
|
af55978918 | ||
|
|
0446a1b3a8 | ||
|
|
3986dd4c32 | ||
|
|
79afa16a7f | ||
|
|
087ed0aa6a | ||
|
|
44fa3d2d07 | ||
|
|
8654d83a33 | ||
|
|
efb78c823c | ||
|
|
3bb7f0c291 | ||
|
|
62e0db7c9b | ||
|
|
130695fcb3 | ||
|
|
05fa301ecb | ||
|
|
ee90f730b5 | ||
|
|
7b8a23453f | ||
|
|
cb44479420 | ||
|
|
afb3806326 | ||
|
|
d96bfd21b7 | ||
|
|
bbc3100bb3 | ||
|
|
ac1bb2a6bd | ||
|
|
41ef391d15 | ||
|
|
e51aa5899a | ||
|
|
38bb975abd | ||
|
|
a249b315ca | ||
|
|
eba85e1ec3 | ||
|
|
c1c92256ea | ||
|
|
58ce97c0b4 | ||
|
|
ca58bab1f0 | ||
|
|
052c484abd | ||
|
|
7a213c9d6f | ||
|
|
f4de7422b3 | ||
|
|
a3d18d0429 | ||
|
|
77fbffdc4b | ||
|
|
63ea01104b | ||
|
|
cad0f1f396 | ||
|
|
677fb93494 | ||
|
|
55cbb12701 | ||
|
|
14099813f0 | ||
|
|
b1fd4e853c | ||
|
|
c1d3fc1b78 | ||
|
|
829980a941 | ||
|
|
d1e1a90d08 | ||
|
|
d56de091f6 | ||
|
|
87bb926fef | ||
|
|
e983f93859 | ||
|
|
c721acc2fa | ||
|
|
16fd4c83ac | ||
|
|
999dfb84ee | ||
|
|
c6557e5078 | ||
|
|
f7aab02978 | ||
|
|
fdcd67dd6b | ||
|
|
6c611d71dd | ||
|
|
b7e2396269 | ||
|
|
ab62875ab1 | ||
|
|
a499fdbb13 | ||
|
|
bf2f0c38ed | ||
|
|
b14c05ccae | ||
|
|
66e7cd41b7 | ||
|
|
e9a15d9189 | ||
|
|
e4aee13e9e | ||
|
|
551f9fcdf9 | ||
|
|
2ec5e948b4 | ||
|
|
60b7f504e6 | ||
|
|
f99668f551 | ||
|
|
8ade41b270 | ||
|
|
a36a5363b4 | ||
|
|
cb22fb54e8 | ||
|
|
1dcfdfdb65 | ||
|
|
d309eb8fa1 | ||
|
|
16dfdbe314 | ||
|
|
b926ed7b00 | ||
|
|
67a6b88104 | ||
|
|
631699bf80 | ||
|
|
80801bf7d0 | ||
|
|
4850a033fa | ||
|
|
0b4029f7a1 | ||
|
|
c07ef0d92a | ||
|
|
ca48c5ddff | ||
|
|
a20c362983 | ||
|
|
7beb204b9d | ||
|
|
3e4f9451a0 | ||
|
|
6e5846d206 | ||
|
|
5965591934 | ||
|
|
78f8a03da5 | ||
|
|
4d10584233 | ||
|
|
106fa64060 | ||
|
|
95be8b2cf3 | ||
|
|
53d7c6c085 | ||
|
|
e4df75519c | ||
|
|
0438fa6816 | ||
|
|
2dab4ccf85 | ||
|
|
b338e76649 | ||
|
|
c737ab764e | ||
|
|
990e73fce6 | ||
|
|
99fac3ae1c | ||
|
|
ad0bcc7de9 | ||
|
|
8069853dda | ||
|
|
14ed669eba | ||
|
|
9ff5fa4acf | ||
|
|
d026024e8c | ||
|
|
25d1491e6b | ||
|
|
4e1415faf2 | ||
|
|
692f64a78a | ||
|
|
b20b8af5a6 | ||
|
|
d34cf636d8 | ||
|
|
3c72ea40b4 | ||
|
|
f87c7833a3 | ||
|
|
f3931140fe | ||
|
|
8459117c23 | ||
|
|
bbc0c97329 | ||
|
|
1d8b152758 | ||
|
|
1c4652448c | ||
|
|
3a34e606b8 | ||
|
|
ca55748103 | ||
|
|
43fa199cfa | ||
|
|
f288ca23ae | ||
|
|
4026714461 | ||
|
|
39a8652708 | ||
|
|
fb432465ea | ||
|
|
42bccfe1ec | ||
|
|
98566150d2 | ||
|
|
676e1705c1 | ||
|
|
172cc1ffea | ||
|
|
6845a52e92 | ||
|
|
b5dc89f0e6 | ||
|
|
ecaea51fe0 | ||
|
|
77baf08092 | ||
|
|
63ff5a2fe3 | ||
|
|
97662f4b3e | ||
|
|
38869d5035 | ||
|
|
08047d4ab7 | ||
|
|
cf33853e68 | ||
|
|
768e618ed9 | ||
|
|
025ed51f11 | ||
|
|
ab9dae3bf3 | ||
|
|
74da5dfd4b | ||
|
|
aaaf452fdc | ||
|
|
d2b97d8aea | ||
|
|
8b95216493 | ||
|
|
f933fa8c78 | ||
|
|
f955309139 | ||
|
|
9c65a82430 | ||
|
|
7b4dda9c73 | ||
|
|
9ad7d2d977 | ||
|
|
e3b4b2f667 | ||
|
|
60a1374fb4 | ||
|
|
7fcbc3c003 | ||
|
|
40421f4321 | ||
|
|
ad2683b610 | ||
|
|
7d49699e5f | ||
|
|
b34a239096 | ||
|
|
02d1251fe4 | ||
|
|
95e58ebb9f | ||
|
|
1cb2704f1b | ||
|
|
dea71f1aa9 | ||
|
|
aee975b7d8 | ||
|
|
18b6d51644 | ||
|
|
3a5ff851af | ||
|
|
cd929345e6 | ||
|
|
de232dd726 | ||
|
|
8ebe99d4f5 | ||
|
|
32f760a461 | ||
|
|
65eaab5cf4 | ||
|
|
51698944e0 | ||
|
|
64fc924357 | ||
|
|
c61a0cdd22 | ||
|
|
9a1de81fc5 | ||
|
|
3633d3cd73 | ||
|
|
9a0465eb05 | ||
|
|
088e199aa2 | ||
|
|
bc4c043d7e | ||
|
|
764299ea8a | ||
|
|
2abc87a1f2 | ||
|
|
75fa116c88 | ||
|
|
cc7575adab | ||
|
|
efb1a2c8e0 | ||
|
|
c2972fcaa0 | ||
|
|
250fd71e16 | ||
|
|
783c165201 | ||
|
|
326a3c5932 | ||
|
|
0af1a85442 | ||
|
|
10e7bb97ee | ||
|
|
c319bbc5f3 | ||
|
|
9e42f70e5f | ||
|
|
ff47152187 | ||
|
|
94b6ce5ca0 | ||
|
|
8e1020f134 | ||
|
|
be7a0fef41 | ||
|
|
9fe7bb7362 | ||
|
|
5d4b121ac1 | ||
|
|
cb424a5f78 | ||
|
|
88ab9d0756 | ||
|
|
29f4fd40ed | ||
|
|
b7f7ba06b9 | ||
|
|
94f8ac8d1d | ||
|
|
72ab38bd2f | ||
|
|
b3d5466131 | ||
|
|
bafbd8f1b6 | ||
|
|
8c1ce03183 | ||
|
|
97490b272f | ||
|
|
2afbe9514b | ||
|
|
603be609a1 | ||
|
|
4590be7b65 | ||
|
|
097a2f6582 | ||
|
|
f818e5bc51 | ||
|
|
34cf8fc43c | ||
|
|
7712765c3a | ||
|
|
eaf1304eda | ||
|
|
f97f32df0f | ||
|
|
79eecd6db4 | ||
|
|
5a75d8e788 | ||
|
|
42e58fb73a | ||
|
|
dba996b2c4 | ||
|
|
647f0dd34b | ||
|
|
a691a519e8 | ||
|
|
86075973b5 | ||
|
|
97ea15300c | ||
|
|
a150a8fd52 | ||
|
|
ad4e20da52 | ||
|
|
e43ab1e46f | ||
|
|
e32e280cf1 | ||
|
|
c1a07e0943 | ||
|
|
93fe641dbf | ||
|
|
d8194c0886 | ||
|
|
75ce4766d3 | ||
|
|
7eff3bf854 | ||
|
|
af143ae7dc | ||
|
|
a0e9140dde | ||
|
|
33e5d46c87 | ||
|
|
f74b206864 | ||
|
|
f334ebe577 | ||
|
|
9c39394d7f | ||
|
|
8ea0e6977a | ||
|
|
bf006473c0 | ||
|
|
568af27be4 | ||
|
|
bd55f86203 | ||
|
|
d95e577639 | ||
|
|
a904e54122 | ||
|
|
2a97655a8d | ||
|
|
d878718510 | ||
|
|
416227a2a2 | ||
|
|
7d1baa8798 | ||
|
|
fe2ee64ec9 | ||
|
|
96819628d6 | ||
|
|
1b30d7909c | ||
|
|
baf253d44e | ||
|
|
b7a4d50007 | ||
|
|
625b4befb5 | ||
|
|
30678f51bd | ||
|
|
7a4103dd48 | ||
|
|
bca3ff2eac | ||
|
|
28e2934a89 | ||
|
|
0563af682d | ||
|
|
5ccd63250b | ||
|
|
f262a0745d | ||
|
|
c42b63b008 | ||
|
|
e7ffb80877 | ||
|
|
919166212f | ||
|
|
deb124f645 | ||
|
|
86b1ff5125 | ||
|
|
2c8c96149f | ||
|
|
82e4cc9951 | ||
|
|
04df06404f | ||
|
|
f6fcf5fce4 | ||
|
|
ac5e92c879 | ||
|
|
37ccc80ba4 | ||
|
|
8153f97899 | ||
|
|
8dedc6d3dc | ||
|
|
807d75e13a | ||
|
|
feac1786e1 | ||
|
|
09e0f4e36c | ||
|
|
9999332107 | ||
|
|
d4ec7e5357 | ||
|
|
064b3caf08 | ||
|
|
c83d2e9513 | ||
|
|
48ff516215 | ||
|
|
cdccbb59ab | ||
|
|
2fe5a863ac | ||
|
|
7d1fccf474 | ||
|
|
0a8dbc8831 | ||
|
|
177a3c2cbd | ||
|
|
9f22e634f5 | ||
|
|
55a8c7b540 | ||
|
|
76c11fe65a | ||
|
|
b15ed00feb | ||
|
|
fc3ff34c2d | ||
|
|
5faa0f55bc | ||
|
|
77f0731c3e | ||
|
|
ffff623852 | ||
|
|
a6bc40b506 | ||
|
|
a034515019 | ||
|
|
49c8f23bf7 | ||
|
|
29b7a71812 | ||
|
|
8de3283dd1 | ||
|
|
4bbe5b3358 | ||
|
|
3dd3af4a73 | ||
|
|
7e7b129822 | ||
|
|
8bcc1d81d2 | ||
|
|
aa8e92e9a5 | ||
|
|
a8196ec99e | ||
|
|
bd3034819e | ||
|
|
7bb86c4e2a | ||
|
|
94ed21d1cf | ||
|
|
1bb7c31ee4 | ||
|
|
06d12b376c | ||
|
|
e9c8137fd8 | ||
|
|
eaaddf40d2 | ||
|
|
3e0c565019 | ||
|
|
984603112f | ||
|
|
fe29246256 | ||
|
|
84d0664112 | ||
|
|
3d3c59cea6 | ||
|
|
7940428b9b | ||
|
|
2e485b9ac5 | ||
|
|
b76aa926f6 | ||
|
|
58d81546da | ||
|
|
7a480990c6 | ||
|
|
afb10efd83 | ||
|
|
e2f05e137f | ||
|
|
d72ade9c70 | ||
|
|
64650fcdee | ||
|
|
e1acb7df13 | ||
|
|
319a30cf3a | ||
|
|
e631f1b313 | ||
|
|
617f31b47f | ||
|
|
61e9aac92d | ||
|
|
75812804f4 | ||
|
|
b60f36f211 | ||
|
|
e342c878d0 | ||
|
|
c6b3cadf55 | ||
|
|
869a361d09 | ||
|
|
f83119e188 | ||
|
|
578c4b444c | ||
|
|
d63f9be03f | ||
|
|
62fe02415a | ||
|
|
481970c763 | ||
|
|
7c8dc66ba1 | ||
|
|
20ffbf5a82 | ||
|
|
2b6f26b214 | ||
|
|
d743ec2d2b | ||
|
|
dfab332285 | ||
|
|
bbbce8a981 | ||
|
|
0dc4ccb42f | ||
|
|
b46c2c2527 | ||
|
|
3b128f844b | ||
|
|
d38b3d09ba | ||
|
|
d35c5ffa04 | ||
|
|
eb7243233e | ||
|
|
21bf629505 | ||
|
|
702022001d | ||
|
|
d9549ad634 | ||
|
|
daf91dbf95 | ||
|
|
2bc19120d9 | ||
|
|
8ddfa8cd68 | ||
|
|
076d10358e | ||
|
|
5930983641 | ||
|
|
a0c5cb51aa | ||
|
|
8e659745fd | ||
|
|
87297d2a07 | ||
|
|
8f23611f1a | ||
|
|
e2affb0f38 | ||
|
|
26e6041b7a | ||
|
|
81707a45d5 | ||
|
|
805f2b28a9 | ||
|
|
22aa02895e | ||
|
|
6bb89778b2 | ||
|
|
6631b9e78f | ||
|
|
7f7d5b32da | ||
|
|
52def444ab | ||
|
|
7d52ab7c54 | ||
|
|
852b324819 | ||
|
|
e019441ede | ||
|
|
ac8f8d0dd6 | ||
|
|
3fa2e7e12e | ||
|
|
5d099491df | ||
|
|
d7ca0f7734 | ||
|
|
5d31338b02 | ||
|
|
a44b81d240 | ||
|
|
742e499de0 | ||
|
|
eb395d6d2d | ||
|
|
a1383c34b5 | ||
|
|
e538da3959 | ||
|
|
687a072dc8 | ||
|
|
5dc9881241 | ||
|
|
0b3a7e2f0f | ||
|
|
123455a5bb | ||
|
|
34c8d8dd2e | ||
|
|
3f4c92d739 | ||
|
|
eb10245df1 | ||
|
|
2dbfcbb378 | ||
|
|
a717f5c030 | ||
|
|
3a711790c5 | ||
|
|
5d77cb0396 | ||
|
|
9972ea578b | ||
|
|
0bb3762397 | ||
|
|
fbd6e21152 | ||
|
|
bea62537df | ||
|
|
fdbe4c5bd5 | ||
|
|
91e779a52c | ||
|
|
e2c5e92cd3 | ||
|
|
5929676ea2 | ||
|
|
36e180ab91 | ||
|
|
1e8fe22553 | ||
|
|
8e1bd2d8f3 | ||
|
|
239ce262ef | ||
|
|
5be66e98c2 | ||
|
|
cacd072c15 | ||
|
|
14c6a1bf23 | ||
|
|
b27dfd4c77 | ||
|
|
4622e9658d | ||
|
|
f8bda517c3 | ||
|
|
de3d9fdb8b | ||
|
|
c6291bea52 | ||
|
|
a266e3c898 | ||
|
|
f9c34d6808 | ||
|
|
10a91cac2f | ||
|
|
f7e25e9c63 | ||
|
|
5f821a58a3 | ||
|
|
4a2ad4e6f9 | ||
|
|
4a2bbb52c1 | ||
|
|
ed401199bd | ||
|
|
eee3a263f5 | ||
|
|
eca1d9aabd | ||
|
|
33ff9cfbb6 | ||
|
|
de8e6d7174 | ||
|
|
cd9332cddf | ||
|
|
fb4a861c0d | ||
|
|
c30460df4c | ||
|
|
31e86a36f8 | ||
|
|
0b4fe85b33 | ||
|
|
99e7a1705a | ||
|
|
27c6259b53 | ||
|
|
1ecae14bae | ||
|
|
c56a09f318 | ||
|
|
ffec2699ea | ||
|
|
46faf0280c | ||
|
|
3b774ed507 | ||
|
|
9c62bbbc05 | ||
|
|
dc6b1ef47b | ||
|
|
1f8e1d2a29 | ||
|
|
b30a948601 | ||
|
|
e90568e044 | ||
|
|
c74b5ba3a2 | ||
|
|
2085d6afad | ||
|
|
8bfdbd0fed | ||
|
|
cc3dc6aff0 | ||
|
|
d01284d147 | ||
|
|
7b7d5118d6 | ||
|
|
a03a7dcb4a | ||
|
|
dfae413afc | ||
|
|
253642a85e | ||
|
|
ce64c8e7d1 | ||
|
|
d7ae0105c3 | ||
|
|
e7320e7bd3 | ||
|
|
a214565803 | ||
|
|
61f1290bea | ||
|
|
ba5e512d10 | ||
|
|
624e4bca40 | ||
|
|
613237727d | ||
|
|
fd2ddca6f2 | ||
|
|
e114c18031 |
18
.editorconfig
Normal file
18
.editorconfig
Normal file
@@ -0,0 +1,18 @@
|
||||
# This file is for unifying the coding style for different editors and IDEs
|
||||
# editorconfig.org
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[**.{js,json,md}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
insert_final_newline = true
|
||||
|
||||
[**.html]
|
||||
indent_style = tab
|
||||
insert_final_newline = false
|
||||
4
.gitattributes
vendored
4
.gitattributes
vendored
@@ -1,5 +1 @@
|
||||
* text=auto
|
||||
*.html text eol=lf
|
||||
*.js text eol=lf
|
||||
*.md text eol=lf
|
||||
*.sh text eol=lf
|
||||
|
||||
8
.gitignore
vendored
8
.gitignore
vendored
@@ -1,10 +1,6 @@
|
||||
.DS_Store
|
||||
*.custom.*
|
||||
*.template.*
|
||||
*.log
|
||||
*.map
|
||||
/*.min.*
|
||||
modularize
|
||||
lodash.compat.min.js
|
||||
node_modules
|
||||
dist/*.backbone.*
|
||||
dist/*.legacy.*
|
||||
dist/*.mobile.*
|
||||
|
||||
97
.travis.yml
97
.travis.yml
@@ -1,58 +1,73 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.6"
|
||||
- "0.8"
|
||||
- "0.10"
|
||||
- "0.12"
|
||||
env:
|
||||
global:
|
||||
- BIN="node" BUILD=false MAKE=false OPTION=""
|
||||
- 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="
|
||||
matrix:
|
||||
- BUILD="compat"
|
||||
- BUILD="modern"
|
||||
- BUILD="legacy"
|
||||
- BUILD="mobile"
|
||||
- BIN="phantomjs" BUILD="compat"
|
||||
- BIN="phantomjs" BUILD="legacy"
|
||||
- BIN="phantomjs" BUILD="mobile"
|
||||
- BUILD="modern"
|
||||
- BUILD="modern" ISTANBUL=true
|
||||
- BIN="phantomjs"
|
||||
- BIN="rhino"
|
||||
- BIN="rhino" OPTION="-require"
|
||||
- BIN="ringo"
|
||||
matrix:
|
||||
include:
|
||||
- node_js: "io.js"
|
||||
env:
|
||||
- node_js: "io.js"
|
||||
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: BIN="istanbul"
|
||||
env:
|
||||
- node_js: "0.10"
|
||||
env: BIN="narwhal" BUILD="compat"
|
||||
- node_js: "0.10"
|
||||
env: BIN="narwhal" BUILD="legacy"
|
||||
- node_js: "0.10"
|
||||
env: BIN="rhino" BUILD="compat"
|
||||
- node_js: "0.10"
|
||||
env: BIN="rhino" BUILD="legacy"
|
||||
- node_js: "0.10"
|
||||
env: BIN="rhino" BUILD="compat" OPTION="-require"
|
||||
- node_js: "0.10"
|
||||
env: BIN="rhino" BUILD="legacy" OPTION="-require"
|
||||
- node_js: "0.10"
|
||||
env: BIN="ringo" BUILD="compat"
|
||||
- node_js: "0.10"
|
||||
env: BIN="ringo" BUILD="legacy"
|
||||
env: BUILD="modern"
|
||||
- node_js: "0.12"
|
||||
env: SAUCE_LABS=true
|
||||
- node_js: "0.12"
|
||||
env: SAUCE_LABS=true BUILD="modern"
|
||||
git:
|
||||
depth: 1
|
||||
depth: 10
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
notifications:
|
||||
webhooks:
|
||||
urls:
|
||||
- https://webhooks.gitter.im/e/4aab6358b0e9aed0b628
|
||||
on_success: change
|
||||
on_failure: always
|
||||
before_install:
|
||||
- "[ $BIN == 'istanbul' ] && npm install -g istanbul || true"
|
||||
- "[ $BIN == 'narwhal' ] && wget https://github.com/280north/narwhal/archive/v0.3.2.zip && sudo unzip v0.3.2 -d /opt/ && rm v0.3.2.zip || true"
|
||||
- "[ $BIN == 'narwhal' ] && sudo ln -s /opt/narwhal-0.3.2/bin/narwhal /usr/local/bin/narwhal && sudo chmod +x /usr/local/bin/narwhal || true"
|
||||
- "[ $BIN == 'rhino' ] && sudo mkdir /opt/rhino-1.7R5 && sudo wget -O /opt/rhino-1.7R5/js.jar https://oss.sonatype.org/content/repositories/snapshots/org/mozilla/rhino/1.7R5-SNAPSHOT/rhino-1.7R5-20120629.144839-4.jar || true"
|
||||
- "[ $BIN == 'rhino' ] && echo -e '#!/bin/sh\\njava -jar /opt/rhino-1.7R5/js.jar $@' | sudo tee /usr/local/bin/rhino && sudo chmod +x /usr/local/bin/rhino || true"
|
||||
- "[ $BIN == 'ringo' ] && wget http://ringojs.org/downloads/ringojs-0.9.zip && sudo unzip ringojs-0.9 -d /opt && rm ringojs-0.9.zip || true"
|
||||
- "[ $BIN == 'ringo' ] && sudo ln -s /opt/ringojs-0.9/bin/ringo /usr/local/bin/ringo && sudo chmod +x /usr/local/bin/ringo || true"
|
||||
- "nvm use $TRAVIS_NODE_VERSION"
|
||||
- "npm config set loglevel error"
|
||||
- "npm i -g npm@\"$NPM_VERSION\""
|
||||
- "[ $SAUCE_LABS == false ] || npm i chalk@\"0.5.1\" ecstatic@\"0.6.0\" request@\"^2.0.0\" sauce-tunnel@\"2.2.2\""
|
||||
- "[ $ISTANBUL == false ] || (npm i -g coveralls@\"^2.0.0\" && npm i istanbul@\"0.3.6\")"
|
||||
- "[ $BIN != 'rhino' ] || (sudo mkdir /opt/rhino-1.7R5 && sudo wget --no-check-certificate -O $_/js.jar https://lodash.com/_travis/rhino-1.7R5.jar)"
|
||||
- "[ $BIN != 'rhino' ] || (echo -e '#!/bin/sh\\njava -jar /opt/rhino-1.7R5/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 $_)"
|
||||
- "sed -i'' 's|\"lodash\"|\"lodash-compat\"|' ./package.json"
|
||||
- "git clone --depth=10 --branch=master git://github.com/lodash/lodash-cli.git ./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"
|
||||
script:
|
||||
- "[ $BIN == 'istanbul' ] && $BIN cover ./test/test.js || true"
|
||||
- "[ $BUILD != false ] && [ $BUILD != 'compat' ] && [ $BUILD != 'modern' ] && MAKE=true || true"
|
||||
- "[ $MAKE != false ] && git clone --depth=1 --branch=master git://github.com/lodash/lodash-cli.git ./node_modules/lodash-cli || true"
|
||||
- "[ $MAKE != false ] && mkdir ./node_modules/lodash-cli/node_modules && cd ./node_modules/lodash-cli/node_modules/ && ln -s ../../../ ./lodash && cd ../ && npm i . && cd ../../ || true"
|
||||
- "[ $MAKE != false ] && node ./node_modules/lodash-cli/bin/lodash $BUILD -o ./dist/lodash.$BUILD.js || true"
|
||||
- "[ $BUILD != false ] && cd ./test || true"
|
||||
- "[ $BUILD != false ] && $BIN $OPTION ./test.js ../dist/lodash.$BUILD.js || true"
|
||||
- "[ $BUILD != false ] && $BIN $OPTION ./test.js ../dist/lodash.$BUILD.min.js || true"
|
||||
- "[ $ISTANBUL == false ] || (cp ./lodash.$BUILD.js ./lodash.js && 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)"
|
||||
- "[ $SAUCE_LABS == true ] || [ $ISTANBUL == true ] || cd ./test"
|
||||
- "[ $SAUCE_LABS == true ] || [ $ISTANBUL == true ] || $BIN $OPTION ./test.js ../lodash.$BUILD.js"
|
||||
- "[ $SAUCE_LABS == true ] || [ $ISTANBUL == true ] || $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\""
|
||||
|
||||
@@ -1,18 +1,20 @@
|
||||
# Contributing to Lo-Dash
|
||||
# Contributing to lodash
|
||||
|
||||
If you’d like to contribute a feature or bug fix, you can [fork](https://help.github.com/articles/fork-a-repo) Lo-Dash, commit your changes, and [send a pull request](https://help.github.com/articles/using-pull-requests).
|
||||
If you’d 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.
|
||||
Don’t worry about regenerating the documentation, lodash.js, or lodash.min.js.
|
||||
|
||||
You can run the 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/Rhino), [Narwhal](https://github.com/280north/narwhal), [RingoJS](http://ringojs.org/), [PhantomJS](http://phantomjs.org/), and [Node](http://nodejs.org/), before running them in your default browser.
|
||||
The [Backbone](http://backbonejs.org/) and [Underscore](http://http://underscorejs.org/) test suites are included as well.
|
||||
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
|
||||
|
||||
Lo-Dash is a member of the [Dojo Foundation](http://dojofoundation.org/).
|
||||
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 Russell’s excellent post, [“Why Do I Need to Sign This?”](http://infrequently.org/2008/06/why-do-i-need-to-sign-this/).
|
||||
@@ -25,11 +27,11 @@ In addition to the following guidelines, please follow the conventions already e
|
||||
Use two spaces for indentation. No tabs.
|
||||
|
||||
- **Naming**:<br>
|
||||
Keep variable and method names concise and descriptive.<br>
|
||||
Variable names `index`, `collection`, and `callback` are preferable to `i`, `arr`, and `fn`.
|
||||
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, and [JSDoc-style](http://www.2ality.com/2011/08/jsdoc-intro.html) comments for new methods.
|
||||
Please use single-line comments to annotate significant additions, & [JSDoc-style](http://www.2ality.com/2011/08/jsdoc-intro.html) comments for new methods.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/>
|
||||
Based on Underscore.js 1.5.2, copyright 2009-2013 Jeremy Ashkenas,
|
||||
Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
|
||||
Based on Underscore.js 1.7.0, copyright 2009-2015 Jeremy Ashkenas,
|
||||
DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
@@ -19,4 +19,4 @@ 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.
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
150
README.md
150
README.md
@@ -1,143 +1,25 @@
|
||||
# Lo-Dash v2.2.1
|
||||
A utility library delivering consistency, [customization](http://lodash.com/custom-builds), [performance](http://lodash.com/benchmarks), & [extras](http://lodash.com/#features).
|
||||
# lodash v3.3.0
|
||||
|
||||
## Download
|
||||
|
||||
* Modern builds perfect for newer browsers/environments:<br>
|
||||
[Development](https://raw.github.com/lodash/lodash/2.2.1/dist/lodash.js) &
|
||||
[Production](https://raw.github.com/lodash/lodash/2.2.1/dist/lodash.min.js)
|
||||
|
||||
* Compatibility builds for older environment support too:<br>
|
||||
[Development](https://raw.github.com/lodash/lodash/2.2.1/dist/lodash.compat.js) &
|
||||
[Production](https://raw.github.com/lodash/lodash/2.2.1/dist/lodash.compat.min.js)
|
||||
|
||||
* Underscore builds to use as a drop-in replacement:<br>
|
||||
[Development](https://raw.github.com/lodash/lodash/2.2.1/dist/lodash.underscore.js) &
|
||||
[Production](https://raw.github.com/lodash/lodash/2.2.1/dist/lodash.underscore.min.js)
|
||||
|
||||
CDN copies are available on [cdnjs](http://cdnjs.com/libraries/lodash.js/) & [jsDelivr](http://www.jsdelivr.com/#!lodash).<br>
|
||||
For smaller file sizes, create [custom builds](http://lodash.com/custom-builds) with only the features needed.<br>
|
||||
Love modules? We’ve got you covered with [lodash-amd](https://npmjs.org/package/lodash-amd), [lodash-node](https://npmjs.org/package/lodash-node), & [npm packages](https://npmjs.org/browse/keyword/lodash-modularized) per method.
|
||||
|
||||
## Dive in
|
||||
|
||||
There’s plenty of [documentation](http://lodash.com/docs), [unit tests](http://lodash.com/tests), & [benchmarks](http://lodash.com/benchmarks).<br>
|
||||
For a list of upcoming features, check out our [roadmap](https://github.com/lodash/lodash/wiki/Roadmap).<br>
|
||||
The full changelog for this release is available on our [wiki](https://github.com/lodash/lodash/wiki/Changelog).
|
||||
|
||||
## Features *not* in Underscore
|
||||
|
||||
* AMD loader support ([curl](https://github.com/cujojs/curl), [dojo](http://dojotoolkit.org/), [requirejs](http://requirejs.org/), etc.)
|
||||
* [_(…)](http://lodash.com/docs#_) supports intuitive chaining
|
||||
* [_.at](http://lodash.com/docs#at) for cherry-picking collection values
|
||||
* [_.bindKey](http://lodash.com/docs#bindKey) for binding [*“lazy”*](http://michaux.ca/articles/lazy-function-definition-pattern) defined methods
|
||||
* [_.clone](http://lodash.com/docs#clone) supports shallow cloning of `Date` & `RegExp` objects
|
||||
* [_.cloneDeep](http://lodash.com/docs#cloneDeep) for deep cloning arrays & objects
|
||||
* [_.contains](http://lodash.com/docs#contains) accepts a `fromIndex`
|
||||
* [_.createCallback](http://lodash.com/docs#createCallback) for extending callbacks in methods & mixins
|
||||
* [_.curry](http://lodash.com/docs#curry) for creating [curried](http://hughfdjackson.com/javascript/2013/07/06/why-curry-helps/) functions
|
||||
* [_.debounce](http://lodash.com/docs#debounce) & [_.throttle](http://lodash.com/docs#throttle) accept additional `options` for more control
|
||||
* [_.findIndex](http://lodash.com/docs#findIndex) & [_.findKey](http://lodash.com/docs#findKey) for finding indexes & keys
|
||||
* [_.forEach](http://lodash.com/docs#forEach) is chainable & supports exiting early
|
||||
* [_.forIn](http://lodash.com/docs#forIn) for iterating own & inherited properties
|
||||
* [_.forOwn](http://lodash.com/docs#forOwn) for iterating own properties
|
||||
* [_.isPlainObject](http://lodash.com/docs#isPlainObject) for checking if values are created by `Object`
|
||||
* [_.memoize](http://lodash.com/docs#memoize) exposes the `cache` of memoized functions
|
||||
* [_.merge](http://lodash.com/docs#merge) for a deep [_.extend](http://lodash.com/docs#extend)
|
||||
* [_.parseInt](http://lodash.com/docs#parseInt) for consistent behavior
|
||||
* [_.partialRight](http://lodash.com/docs#partialRight) for [partial application](http://lodash.com/docs#partial) from the right
|
||||
* [_.pull](http://lodash.com/docs#pull) & [_.remove](http://lodash.com/docs#remove) for mutating arrays
|
||||
* [_.random](http://lodash.com/docs#random) supports returning floating-point numbers
|
||||
* [_.runInContext](http://lodash.com/docs#runInContext) for easier mocking
|
||||
* [_.support](http://lodash.com/docs#support) for flagging environment features
|
||||
* [_.template](http://lodash.com/docs#template) supports [*“imports”*](http://lodash.com/docs#templateSettings_imports) options & [ES6 template delimiters](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-7.8.6)
|
||||
* [_.transform](http://lodash.com/docs#transform) as a powerful alternative to [_.reduce](http://lodash.com/docs#reduce) for transforming objects
|
||||
* [_.where](http://lodash.com/docs#where) supports deep object comparisons
|
||||
* [_.zip](http://lodash.com/docs#zip) is capable of unzipping values
|
||||
* [_.omit](http://lodash.com/docs#omit), [_.pick](http://lodash.com/docs#pick), &
|
||||
[more](http://lodash.com/docs "_.assign, _.clone, _.cloneDeep, _.first, _.initial, _.isEqual, _.last, _.merge, _.rest") accept callbacks
|
||||
* [_.contains](http://lodash.com/docs#contains), [_.toArray](http://lodash.com/docs#toArray), &
|
||||
[more](http://lodash.com/docs "_.at, _.countBy, _.every, _.filter, _.find, _.forEach, _.forEachRight, _.groupBy, _.invoke, _.map, _.max, _.min, _.pluck, _.reduce, _.reduceRight, _.reject, _.shuffle, _.size, _.some, _.sortBy, _.where") accept strings
|
||||
* [_.filter](http://lodash.com/docs#filter), [_.map](http://lodash.com/docs#map), &
|
||||
[more](http://lodash.com/docs "_.countBy, _.every, _.find, _.findKey, _.findLast, _.findLastIndex, _.findLastKey, _.first, _.groupBy, _.initial, _.last, _.max, _.min, _.reject, _.rest, _.some, _.sortBy, _.sortedIndex, _.uniq") support *“_.pluck”* & *“_.where”* shorthands
|
||||
* [_.findLast](http://lodash.com/docs#findLast), [_.findLastIndex](http://lodash.com/docs#findLastIndex), &
|
||||
[more](http://lodash.com/docs "_.findLastKey, _.forEachRight, _.forInRight, _.forOwnRight") right-associative methods
|
||||
|
||||
## Resources
|
||||
|
||||
* Posts
|
||||
- [Say “Hello” to Lo-Dash](http://kitcambridge.be/blog/say-hello-to-lo-dash/)
|
||||
- [Custom builds in Lo-Dash 2.0](http://kitcambridge.be/blog/custom-builds-in-lo-dash-2-dot-0/)
|
||||
|
||||
* Videos
|
||||
- [Introduction](https://vimeo.com/44154599)
|
||||
- [Origins](https://vimeo.com/44154600)
|
||||
- [Optimizations & builds](https://vimeo.com/44154601)
|
||||
- [Native method use](https://vimeo.com/48576012)
|
||||
- [Testing](https://vimeo.com/45865290)
|
||||
- [CascadiaJS ’12](http://www.youtube.com/watch?v=dpPy4f_SeEk)
|
||||
|
||||
## Support
|
||||
|
||||
Tested in Chrome 5~29, Firefox 2~24, IE 6-10, Opera 9.25~16, Safari 3-6, Node.js 0.6.8-0.10.20, Narwhal 0.3.2, PhantomJS 1.9.2, RingoJS 0.9, & Rhino 1.7RC5.
|
||||
|
||||
## Installation & usage
|
||||
|
||||
In browsers:
|
||||
|
||||
```html
|
||||
<script src="lodash.js"></script>
|
||||
```
|
||||
|
||||
Using [`npm`](http://npmjs.org/):
|
||||
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/).
|
||||
|
||||
Generated using [lodash-cli](https://www.npmjs.com/package/lodash-cli):
|
||||
```bash
|
||||
npm i --save lodash
|
||||
|
||||
{sudo} npm i -g lodash
|
||||
npm ln lodash
|
||||
$ lodash modern -o ./lodash.js
|
||||
```
|
||||
|
||||
In [Node.js](http://nodejs.org/) & [Ringo](http://ringojs.org/):
|
||||
## Module formats
|
||||
|
||||
```js
|
||||
var _ = require('lodash');
|
||||
// or as Underscore
|
||||
var _ = require('lodash/dist/lodash.underscore');
|
||||
```
|
||||
lodash is also available in a variety of other builds & module formats.
|
||||
|
||||
**Notes:**
|
||||
* Don’t assign values to [special variable](http://nodejs.org/api/repl.html#repl_repl_features) `_` when in the REPL
|
||||
* If Lo-Dash is installed globally, run [`npm ln lodash`](http://blog.nodejs.org/2011/03/23/npm-1-0-global-vs-local-installation/) in your project’s root directory *before* requiring it
|
||||
* Node.js 0.10.8-0.10.11 [have](https://github.com/joyent/node/issues/5622) [bugs](https://github.com/joyent/node/issues/5688) preventing minified builds
|
||||
* 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.3.0-amd) & [compatibility](https://github.com/lodash/lodash-compat/tree/3.3.0-amd) builds
|
||||
* ES modules for the [modern](https://github.com/lodash/lodash/tree/3.3.0-es) build
|
||||
|
||||
In [Rhino](http://www.mozilla.org/rhino/):
|
||||
## Further Reading
|
||||
|
||||
```js
|
||||
load('lodash.js');
|
||||
```
|
||||
|
||||
In an AMD loader:
|
||||
|
||||
```js
|
||||
require({
|
||||
'packages': [
|
||||
{ 'name': 'lodash', 'location': 'path/to/lodash', 'main': 'lodash' }
|
||||
]
|
||||
},
|
||||
['lodash'], function(_) {
|
||||
console.log(_.VERSION);
|
||||
});
|
||||
```
|
||||
|
||||
## Author
|
||||
|
||||
| [](http://twitter.com/jdalton "Follow @jdalton on Twitter") |
|
||||
|---|
|
||||
| [John-David Dalton](http://allyoucanleet.com/) |
|
||||
|
||||
## Contributors
|
||||
|
||||
| [](http://twitter.com/blainebublitz "Follow @BlaineBublitz on Twitter") | [](https://twitter.com/kitcambridge "Follow @kitcambridge on Twitter") | [](http://twitter.com/mathias "Follow @mathias on Twitter") |
|
||||
|---|---|---|
|
||||
| [Blaine Bublitz](http://iceddev.com/) | [Kit Cambridge](http://kitcambridge.github.io/) | [Mathias Bynens](http://mathiasbynens.be/) |
|
||||
* [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)
|
||||
|
||||
11
bower.json
11
bower.json
@@ -1,20 +1,17 @@
|
||||
{
|
||||
"name": "lodash",
|
||||
"version": "2.2.1",
|
||||
"main": "dist/lodash.compat.js",
|
||||
"version": "3.3.0",
|
||||
"main": "lodash.js",
|
||||
"ignore": [
|
||||
".*",
|
||||
"*.custom.*",
|
||||
"*.template.*",
|
||||
"*.log",
|
||||
"*.map",
|
||||
"*.md",
|
||||
"/*.min.*",
|
||||
"/lodash.js",
|
||||
"index.js",
|
||||
"lodash.src.js",
|
||||
"component.json",
|
||||
"package.json",
|
||||
"doc",
|
||||
"modularize",
|
||||
"node_modules",
|
||||
"perf",
|
||||
"test",
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
{
|
||||
"name": "lodash",
|
||||
"repo": "lodash/lodash",
|
||||
"version": "2.2.1",
|
||||
"description": "A utility library delivering consistency, customization, performance, & extras.",
|
||||
"version": "3.3.0",
|
||||
"description": "The modern build of lodash.",
|
||||
"license": "MIT",
|
||||
"keywords": ["amd", "browser", "client", "functional", "server", "util"],
|
||||
"scripts": [
|
||||
"index.js",
|
||||
"dist/lodash.compat.js"
|
||||
]
|
||||
"main": "lodash.js",
|
||||
"keywords": ["stdlib", "util"],
|
||||
"scripts": ["lodash.js"]
|
||||
}
|
||||
|
||||
6721
dist/lodash.compat.js
vendored
6721
dist/lodash.compat.js
vendored
File diff suppressed because it is too large
Load Diff
56
dist/lodash.compat.min.js
vendored
56
dist/lodash.compat.min.js
vendored
@@ -1,56 +0,0 @@
|
||||
/**
|
||||
* @license
|
||||
* Lo-Dash 2.2.1 (Custom Build) lodash.com/license | Underscore.js 1.5.2 underscorejs.org/LICENSE
|
||||
* Build: `lodash -o ./dist/lodash.compat.js`
|
||||
*/
|
||||
;(function(){function n(n,t,e){e=(e||0)-1;for(var r=n?n.length:0;++e<r;)if(n[e]===t)return e;return-1}function t(t,e){var r=typeof e;if(t=t.l,"boolean"==r||null==e)return t[e]?0:-1;"number"!=r&&"string"!=r&&(r="object");var u="number"==r?e:b+e;return t=(t=t[r])&&t[u],"object"==r?t&&-1<n(t,e)?0:-1:t?0:-1}function e(n){var t=this.l,e=typeof n;if("boolean"==e||null==n)t[n]=!0;else{"number"!=e&&"string"!=e&&(e="object");var r="number"==e?n:b+n,t=t[e]||(t[e]={});"object"==e?(t[r]||(t[r]=[])).push(n):t[r]=!0
|
||||
}}function r(n){return n.charCodeAt(0)}function u(n,t){var e=n.m,r=t.m;if(e!==r){if(e>r||typeof e=="undefined")return 1;if(e<r||typeof r=="undefined")return-1}return n.n-t.n}function o(n){var t=-1,r=n.length,u=n[0],o=n[0|r/2],a=n[r-1];if(u&&typeof u=="object"&&o&&typeof o=="object"&&a&&typeof a=="object")return!1;for(u=l(),u["false"]=u["null"]=u["true"]=u.undefined=!1,o=l(),o.k=n,o.l=u,o.push=e;++t<r;)o.push(n[t]);return o}function a(n){return"\\"+Z[n]}function i(){return y.pop()||[]}function l(){return m.pop()||{k:null,l:null,m:null,"false":!1,n:0,"null":!1,number:null,object:null,push:null,string:null,"true":!1,undefined:!1,o:null}
|
||||
}function f(n){return typeof n.toString!="function"&&typeof(n+"")=="string"}function c(){}function p(n){n.length=0,y.length<j&&y.push(n)}function s(n){var t=n.l;t&&s(t),n.k=n.l=n.m=n.object=n.number=n.string=n.o=null,m.length<j&&m.push(n)}function g(n,t,e){t||(t=0),typeof e=="undefined"&&(e=n?n.length:0);var r=-1;e=e-t||0;for(var u=Array(0>e?0:e);++r<e;)u[r]=n[t+r];return u}function h(e){function y(n){return n&&typeof n=="object"&&!Je(n)&&de.call(n,"__wrapped__")?n:new m(n)}function m(n,t){this.__chain__=!!t,this.__wrapped__=n
|
||||
}function j(n,t,e,r,u){if(e){var o=e(n);if(typeof o!="undefined")return o}if(!bt(n))return n;var a=ke.call(n);if(!U[a]||!We.nodeClass&&f(n))return n;var l=qe[a];switch(a){case z:case q:return new l(+n);case G:case H:return new l(n);case M:return o=l(n.source,I.exec(n)),o.lastIndex=n.lastIndex,o}if(a=Je(n),t){var c=!r;r||(r=i()),u||(u=i());for(var s=r.length;s--;)if(r[s]==n)return u[s];o=a?l(n.length):{}}else o=a?g(n):er({},n);return a&&(de.call(n,"index")&&(o.index=n.index),de.call(n,"input")&&(o.input=n.input)),t?(r.push(n),u.push(o),(a?tr:or)(n,function(n,a){o[a]=j(n,t,e,r,u)
|
||||
}),c&&(p(r),p(u)),o):o}function Z(n,t,e){if(typeof n!="function")return Ht;if(typeof t=="undefined")return n;var r=n.__bindData__||We.funcNames&&!n.name;if(typeof r=="undefined"){var u=P&&ye.call(n);We.funcNames||!u||A.test(u)||(r=!0),(We.funcNames||!r)&&(r=!We.funcDecomp||P.test(u),Ge(n,r))}if(true!==r&&r&&1&r[1])return n;switch(e){case 1:return function(e){return n.call(t,e)};case 2:return function(e,r){return n.call(t,e,r)};case 3:return function(e,r,u){return n.call(t,e,r,u)};case 4:return function(e,r,u,o){return n.call(t,e,r,u,o)
|
||||
}}return Gt(n,t)}function tt(n,t,e,r){r=(r||0)-1;for(var u=n?n.length:0,o=[];++r<u;){var a=n[r];if(a&&typeof a=="object"&&typeof a.length=="number"&&(Je(a)||vt(a))){t||(a=tt(a,t,e));var i=-1,l=a.length,f=o.length;for(o.length+=l;++i<l;)o[f++]=a[i]}else e||o.push(a)}return o}function et(n,t,e,r,u,o){if(e){var a=e(n,t);if(typeof a!="undefined")return!!a}if(n===t)return 0!==n||1/n==1/t;if(n===n&&!(n&&Y[typeof n]||t&&Y[typeof t]))return!1;if(null==n||null==t)return n===t;var l=ke.call(n),c=ke.call(t);
|
||||
if(l==L&&(l=J),c==L&&(c=J),l!=c)return!1;switch(l){case z:case q:return+n==+t;case G:return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case M:case H:return n==oe(t)}if(c=l==T,!c){if(de.call(n,"__wrapped__")||de.call(t,"__wrapped__"))return et(n.__wrapped__||n,t.__wrapped__||t,e,r,u,o);if(l!=J||!We.nodeClass&&(f(n)||f(t)))return!1;var l=!We.argsObject&&vt(n)?re:n.constructor,s=!We.argsObject&&vt(t)?re:t.constructor;if(l!=s&&!(_t(l)&&l instanceof l&&_t(s)&&s instanceof s))return!1}for(s=!u,u||(u=i()),o||(o=i()),l=u.length;l--;)if(u[l]==n)return o[l]==t;
|
||||
var g=0,a=!0;if(u.push(n),o.push(t),c){if(l=n.length,g=t.length,a=g==n.length,!a&&!r)return a;for(;g--;)if(c=l,s=t[g],r)for(;c--&&!(a=et(n[c],s,e,r,u,o)););else if(!(a=et(n[g],s,e,r,u,o)))break;return a}return ur(t,function(t,i,l){return de.call(l,i)?(g++,a=de.call(n,i)&&et(n[i],t,e,r,u,o)):void 0}),a&&!r&&ur(n,function(n,t,e){return de.call(e,t)?a=-1<--g:void 0}),s&&(p(u),p(o)),a}function ut(n,t,e,r,u){(Je(t)?St:or)(t,function(t,o){var a,i,l=t,f=n[o];if(t&&((i=Je(t))||ar(t))){for(l=r.length;l--;)if(a=r[l]==t){f=u[l];
|
||||
break}if(!a){var c;e&&(l=e(f,t),c=typeof l!="undefined")&&(f=l),c||(f=i?Je(f)?f:[]:ar(f)?f:{}),r.push(t),u.push(f),c||ut(f,t,e,r,u)}}else e&&(l=e(f,t),typeof l=="undefined"&&(l=t)),typeof l!="undefined"&&(f=l);n[o]=f})}function at(e,r,u){var a=-1,l=st(),f=e?e.length:0,c=[],g=!r&&f>=w&&l===n,h=u||g?i():c;if(g){var v=o(h);v?(l=t,h=v):(g=!1,h=u?h:(p(h),c))}for(;++a<f;){var v=e[a],y=u?u(v,a,e):v;(r?!a||h[h.length-1]!==y:0>l(h,y))&&((u||g)&&h.push(y),c.push(v))}return g?(p(h.k),s(h)):u&&p(h),c}function it(n){return function(t,e,r){var u={};
|
||||
if(e=y.createCallback(e,r,3),Je(t)){r=-1;for(var o=t.length;++r<o;){var a=t[r];n(u,a,e(a,r,t),t)}}else tr(t,function(t,r,o){n(u,t,e(t,r,o),o)});return u}}function lt(n,t,e,r,u,o){var a=1&t,i=2&t,l=4&t,f=8&t,c=16&t,p=32&t,s=n;if(!i&&!_t(n))throw new ae;c&&!e.length&&(t&=-17,c=e=!1),p&&!r.length&&(t&=-33,p=r=!1);var g=n&&n.__bindData__;if(g)return!a||1&g[1]||(g[4]=u),!a&&1&g[1]&&(t|=8),!l||4&g[1]||(g[5]=o),c&&be.apply(g[2]||(g[2]=[]),e),p&&be.apply(g[3]||(g[3]=[]),r),g[1]|=t,lt.apply(null,g);if(!a||i||l||p||!(We.fastBind||Se&&c))v=function(){var g=arguments,h=a?u:this;
|
||||
return(l||c||p)&&(g=Le.call(g),c&&Ee.apply(g,e),p&&be.apply(g,r),l&&g.length<o)?(t|=16,lt(n,f?t:-4&t,g,null,u,o)):(i&&(n=h[s]),this instanceof v?(h=ct(n.prototype),g=n.apply(h,g),bt(g)?g:h):n.apply(h,g))};else{if(c){var h=[u];be.apply(h,e)}var v=c?Se.apply(n,h):Se.call(n,u)}return Ge(v,Le.call(arguments)),v}function ft(){X.h=$,X.b=X.c=X.g=X.i="",X.e="t",X.j=!0;for(var n,t=0;n=arguments[t];t++)for(var e in n)X[e]=n[e];t=X.a,X.d=/^[^,]+/.exec(t)[0],n=ne,t="return function("+t+"){",e=X;var r="var n,t="+e.d+",E="+e.e+";if(!t)return E;"+e.i+";";
|
||||
e.b?(r+="var u=t.length;n=-1;if("+e.b+"){",We.unindexedChars&&(r+="if(s(t)){t=t.split('')}"),r+="while(++n<u){"+e.g+";}}else{"):We.nonEnumArgs&&(r+="var u=t.length;n=-1;if(u&&p(t)){while(++n<u){n+='';"+e.g+";}}else{"),We.enumPrototypes&&(r+="var G=typeof t=='function';"),We.enumErrorProps&&(r+="var F=t===k||t instanceof Error;");var u=[];if(We.enumPrototypes&&u.push('!(G&&n=="prototype")'),We.enumErrorProps&&u.push('!(F&&(n=="message"||n=="name"))'),e.j&&e.f)r+="var C=-1,D=B[typeof t]&&v(t),u=D?D.length:0;while(++C<u){n=D[C];",u.length&&(r+="if("+u.join("&&")+"){"),r+=e.g+";",u.length&&(r+="}"),r+="}";
|
||||
else if(r+="for(n in t){",e.j&&u.push("m.call(t, n)"),u.length&&(r+="if("+u.join("&&")+"){"),r+=e.g+";",u.length&&(r+="}"),r+="}",We.nonEnumShadows){for(r+="if(t!==A){var i=t.constructor,r=t===(i&&i.prototype),f=t===J?I:t===k?j:L.call(t),x=y[f];",k=0;7>k;k++)r+="n='"+e.h[k]+"';if((!(r&&x[n])&&m.call(t,n))",e.j||(r+="||(!x[n]&&t[n]!==A[n])"),r+="){"+e.g+"}";r+="}"}return(e.b||We.nonEnumArgs)&&(r+="}"),r+=e.c+";return E",n("d,j,k,m,o,p,q,s,v,A,B,y,I,J,L",t+r+"}")(Z,K,le,de,_,vt,Je,jt,X.f,fe,Y,Ke,H,ce,ke)
|
||||
}function ct(n){return bt(n)?Ie(n):{}}function pt(n){return Xe[n]}function st(){var t=(t=y.indexOf)===Lt?n:t;return t}function gt(n){var t,e;return!n||ke.call(n)!=J||(t=n.constructor,_t(t)&&!(t instanceof t))||!We.argsClass&&vt(n)||!We.nodeClass&&f(n)?!1:We.ownLast?(ur(n,function(n,t,r){return e=de.call(r,t),!1}),false!==e):(ur(n,function(n,t){e=t}),typeof e=="undefined"||de.call(n,e))}function ht(n){return Ye[n]}function vt(n){return n&&typeof n=="object"&&typeof n.length=="number"&&ke.call(n)==L||!1
|
||||
}function yt(n,t,e){var r=He(n),u=r.length;for(t=Z(t,e,3);u--&&(e=r[u],false!==t(n[e],e,n)););return n}function mt(n){var t=[];return ur(n,function(n,e){_t(n)&&t.push(e)}),t.sort()}function dt(n){for(var t=-1,e=He(n),r=e.length,u={};++t<r;){var o=e[t];u[n[o]]=o}return u}function _t(n){return typeof n=="function"}function bt(n){return!(!n||!Y[typeof n])}function wt(n){return typeof n=="number"||ke.call(n)==G}function jt(n){return typeof n=="string"||ke.call(n)==H}function xt(n){for(var t=-1,e=He(n),r=e.length,u=Xt(r);++t<r;)u[t]=n[e[t]];
|
||||
return u}function Ct(n,t,e){var r=-1,u=st(),o=n?n.length:0,a=!1;return e=(0>e?Pe(0,o+e):e)||0,Je(n)?a=-1<u(n,t,e):typeof o=="number"?a=-1<(jt(n)?n.indexOf(t,e):u(n,t,e)):tr(n,function(n){return++r<e?void 0:!(a=n===t)}),a}function kt(n,t,e){var r=!0;if(t=y.createCallback(t,e,3),Je(n)){e=-1;for(var u=n.length;++e<u&&(r=!!t(n[e],e,n)););}else tr(n,function(n,e,u){return r=!!t(n,e,u)});return r}function Et(n,t,e){var r=[];if(t=y.createCallback(t,e,3),Je(n)){e=-1;for(var u=n.length;++e<u;){var o=n[e];
|
||||
t(o,e,n)&&r.push(o)}}else tr(n,function(n,e,u){t(n,e,u)&&r.push(n)});return r}function Ot(n,t,e){if(t=y.createCallback(t,e,3),!Je(n)){var r;return tr(n,function(n,e,u){return t(n,e,u)?(r=n,!1):void 0}),r}e=-1;for(var u=n.length;++e<u;){var o=n[e];if(t(o,e,n))return o}}function St(n,t,e){if(t&&typeof e=="undefined"&&Je(n)){e=-1;for(var r=n.length;++e<r&&false!==t(n[e],e,n););}else tr(n,t,e);return n}function It(n,t,e){var r=n,u=n?n.length:0;if(t=t&&typeof e=="undefined"?t:Z(t,e,3),Je(n))for(;u--&&false!==t(n[u],u,n););else{if(typeof u!="number")var o=He(n),u=o.length;
|
||||
else We.unindexedChars&&jt(n)&&(r=n.split(""));tr(n,function(n,e,a){return e=o?o[--u]:--u,t(r[e],e,a)})}return n}function At(n,t,e){var r=-1,u=n?n.length:0,o=Xt(typeof u=="number"?u:0);if(t=y.createCallback(t,e,3),Je(n))for(;++r<u;)o[r]=t(n[r],r,n);else tr(n,function(n,e,u){o[++r]=t(n,e,u)});return o}function Nt(n,t,e){var u=-1/0,o=u;if(!t&&Je(n)){e=-1;for(var a=n.length;++e<a;){var i=n[e];i>o&&(o=i)}}else t=!t&&jt(n)?r:y.createCallback(t,e,3),tr(n,function(n,e,r){e=t(n,e,r),e>u&&(u=e,o=n)});return o
|
||||
}function Bt(n,t,e,r){var u=3>arguments.length;if(t=Z(t,r,4),Je(n)){var o=-1,a=n.length;for(u&&(e=n[++o]);++o<a;)e=t(e,n[o],o,n)}else tr(n,function(n,r,o){e=u?(u=!1,n):t(e,n,r,o)});return e}function Dt(n,t,e,r){var u=3>arguments.length;return t=Z(t,r,4),It(n,function(n,r,o){e=u?(u=!1,n):t(e,n,r,o)}),e}function Pt(n){var t=-1,e=n?n.length:0,r=Xt(typeof e=="number"?e:0);return St(n,function(n){var e=Vt(++t);r[t]=r[e],r[e]=n}),r}function Rt(n,t,e){var r;if(t=y.createCallback(t,e,3),Je(n)){e=-1;for(var u=n.length;++e<u&&!(r=t(n[e],e,n)););}else tr(n,function(n,e,u){return!(r=t(n,e,u))
|
||||
});return!!r}function Ft(e){var r=-1,u=st(),a=e?e.length:0,i=tt(arguments,!0,!0,1),l=[],f=a>=w&&u===n;if(f){var c=o(i);c?(u=t,i=c):f=!1}for(;++r<a;)c=e[r],0>u(i,c)&&l.push(c);return f&&s(i),l}function $t(n,t,e){var r=0,u=n?n.length:0;if(typeof t!="number"&&null!=t){var o=-1;for(t=y.createCallback(t,e,3);++o<u&&t(n[o],o,n);)r++}else if(r=t,null==r||e)return n?n[0]:v;return g(n,0,Re(Pe(0,r),u))}function Lt(t,e,r){if(typeof r=="number"){var u=t?t.length:0;r=0>r?Pe(0,u+r):r||0}else if(r)return r=zt(t,e),t[r]===e?r:-1;
|
||||
return n(t,e,r)}function Tt(n,t,e){if(typeof t!="number"&&null!=t){var r=0,u=-1,o=n?n.length:0;for(t=y.createCallback(t,e,3);++u<o&&t(n[u],u,n);)r++}else r=null==t||e?1:Pe(0,t);return g(n,r)}function zt(n,t,e,r){var u=0,o=n?n.length:u;for(e=e?y.createCallback(e,r,1):Ht,t=e(t);u<o;)r=u+o>>>1,e(n[r])<t?u=r+1:o=r;return u}function qt(n,t,e,r){return typeof t!="boolean"&&null!=t&&(e=(r=e)&&r[t]===n?null:t,t=!1),null!=e&&(e=y.createCallback(e,r,3)),at(n,t,e)}function Kt(){for(var n=1<arguments.length?arguments:arguments[0],t=-1,e=n?Nt(cr(n,"length")):0,r=Xt(0>e?0:e);++t<e;)r[t]=cr(n,t);
|
||||
return r}function Wt(n,t){for(var e=-1,r=n?n.length:0,u={};++e<r;){var o=n[e];t?u[o]=t[e]:o&&(u[o[0]]=o[1])}return u}function Gt(n,t){return 2<arguments.length?lt(n,17,Le.call(arguments,2),null,t):lt(n,1,null,null,t)}function Jt(n,t,e){function r(){c&&he(c),a=c=p=v,(h||g!==t)&&(s=_e(),i=n.apply(f,o))}function u(){var e=t-(_e()-l);0<e?c=xe(u,e):(a&&he(a),e=p,a=c=p=v,e&&(s=_e(),i=n.apply(f,o)))}var o,a,i,l,f,c,p,s=0,g=!1,h=!0;if(!_t(n))throw new ae;if(t=Pe(0,t)||0,true===e)var y=!0,h=!1;else bt(e)&&(y=e.leading,g="maxWait"in e&&(Pe(t,e.maxWait)||0),h="trailing"in e?e.trailing:h);
|
||||
return function(){if(o=arguments,l=_e(),f=this,p=h&&(c||!y),false===g)var e=y&&!c;else{a||y||(s=l);var v=g-(l-s);0<v?a||(a=xe(r,v)):(a&&(a=he(a)),s=l,i=n.apply(f,o))}return c||t===g||(c=xe(u,t)),e&&(i=n.apply(f,o)),i}}function Mt(n){if(!_t(n))throw new ae;var t=Le.call(arguments,1);return xe(function(){n.apply(v,t)},1)}function Ht(n){return n}function Ut(n,t){var e=n,r=!t||_t(e);t||(e=m,t=n,n=y),St(mt(t),function(u){var o=n[u]=t[u];r&&(e.prototype[u]=function(){var t=this.__wrapped__,r=[t];return be.apply(r,arguments),r=o.apply(n,r),t&&typeof t=="object"&&t===r?this:(r=new e(r),r.__chain__=this.__chain__,r)
|
||||
})})}function Vt(n,t,e){var r=null==n,u=null==t;return null==e&&(typeof n=="boolean"&&u?(e=n,n=1):u||typeof t!="boolean"||(e=t,u=!0)),r&&u&&(t=1),n=+n||0,u?(t=n,n=0):t=+t||0,r=$e(),e||n%1||t%1?Re(n+r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+ve(r*(t-n+1))}function Qt(){return this.__wrapped__}e=e?ot.defaults(nt.Object(),e,ot.pick(nt,F)):nt;var Xt=e.Array,Yt=e.Boolean,Zt=e.Date,ne=e.Function,te=e.Math,ee=e.Number,re=e.Object,ue=e.RegExp,oe=e.String,ae=e.TypeError,ie=[],le=e.Error.prototype,fe=re.prototype,ce=oe.prototype,pe=e._,se=ue("^"+oe(fe.valueOf).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),ge=te.ceil,he=e.clearTimeout,ve=te.floor,ye=ne.prototype.toString,me=se.test(me=re.getPrototypeOf)&&me,de=fe.hasOwnProperty,_e=se.test(_e=Zt.now)&&_e||function(){return+new Zt
|
||||
},be=ie.push,we=fe.propertyIsEnumerable,je=e.setImmediate,xe=e.setTimeout,Ce=ie.splice,ke=fe.toString,Ee=ie.unshift,Oe=function(){try{var n={},t=se.test(t=re.defineProperty)&&t,e=t(n,n,n)&&t}catch(r){}return e}(),Se=se.test(Se=ke.bind)&&Se,Ie=se.test(Ie=re.create)&&Ie,Ae=se.test(Ae=Xt.isArray)&&Ae,Ne=e.isFinite,Be=e.isNaN,De=se.test(De=re.keys)&&De,Pe=te.max,Re=te.min,Fe=e.parseInt,$e=te.random,Le=ie.slice,Te=se.test(e.attachEvent),ze=Se&&!/\n|true/.test(Se+Te),qe={};qe[T]=Xt,qe[z]=Yt,qe[q]=Zt,qe[W]=ne,qe[J]=re,qe[G]=ee,qe[M]=ue,qe[H]=oe;
|
||||
var Ke={};Ke[T]=Ke[q]=Ke[G]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},Ke[z]=Ke[H]={constructor:!0,toString:!0,valueOf:!0},Ke[K]=Ke[W]=Ke[M]={constructor:!0,toString:!0},Ke[J]={constructor:!0},function(){for(var n=$.length;n--;){var t,e=$[n];for(t in Ke)de.call(Ke,t)&&!de.call(Ke[t],e)&&(Ke[t][e]=!1)}}(),m.prototype=y.prototype;var We=y.support={};!function(){function n(){this.x=1}var t={0:1,length:1},r=[];n.prototype={valueOf:1};for(var u in new n)r.push(u);for(u in arguments);We.argsClass=ke.call(arguments)==L,We.argsObject=arguments.constructor==re&&!(arguments instanceof Xt),We.enumErrorProps=we.call(le,"message")||we.call(le,"name"),We.enumPrototypes=we.call(n,"prototype"),We.fastBind=Se&&!ze,We.funcDecomp=!se.test(e.p)&&P.test(h),We.funcNames=typeof ne.name=="string",We.nonEnumArgs=0!=u,We.nonEnumShadows=!/valueOf/.test(r),We.ownLast="x"!=r[0],We.spliceObjects=(ie.splice.call(t,0,1),!t[0]),We.unindexedChars="xx"!="x"[0]+re("x")[0];
|
||||
try{We.nodeClass=!(ke.call(document)==J&&!({toString:0}+""))}catch(o){We.nodeClass=!0}}(1),y.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:N,variable:"",imports:{_:y}},Ie||(ct=function(n){if(bt(n)){c.prototype=n;var t=new c;c.prototype=null}return t||{}});var Ge=Oe?function(n,t){Q.value=t,Oe(n,"__bindData__",Q)}:c;We.argsClass||(vt=function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&de.call(n,"callee")||!1});var Je=Ae||function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&ke.call(n)==T||!1
|
||||
},Me=ft({a:"z",e:"[]",i:"if(!(B[typeof z]))return E",g:"E.push(n)"}),He=De?function(n){return bt(n)?We.enumPrototypes&&typeof n=="function"||We.nonEnumArgs&&n.length&&vt(n)?Me(n):De(n):[]}:Me,Ue={a:"g,e,K",i:"e=e&&typeof K=='undefined'?e:d(e,K,3)",b:"typeof u=='number'",v:He,g:"if(e(t[n],n,g)===false)return E"},Ve={a:"z,H,l",i:"var a=arguments,b=0,c=typeof l=='number'?2:a.length;while(++b<c){t=a[b];if(t&&B[typeof t]){",v:He,g:"if(typeof E[n]=='undefined')E[n]=t[n]",c:"}}"},Qe={i:"if(!B[typeof t])return E;"+Ue.i,b:!1},Xe={"&":"&","<":"<",">":">",'"':""","'":"'"},Ye=dt(Xe),Ze=ue("("+He(Ye).join("|")+")","g"),nr=ue("["+He(Xe).join("")+"]","g"),tr=ft(Ue),er=ft(Ve,{i:Ve.i.replace(";",";if(c>3&&typeof a[c-2]=='function'){var e=d(a[--c-1],a[c--],2)}else if(c>2&&typeof a[c-1]=='function'){e=a[--c]}"),g:"E[n]=e?e(E[n],t[n]):t[n]"}),rr=ft(Ve),ur=ft(Ue,Qe,{j:!1}),or=ft(Ue,Qe);
|
||||
_t(/x/)&&(_t=function(n){return typeof n=="function"&&ke.call(n)==W});var ar=me?function(n){if(!n||ke.call(n)!=J||!We.argsClass&&vt(n))return!1;var t=n.valueOf,e=typeof t=="function"&&(e=me(t))&&me(e);return e?n==e||me(n)==e:gt(n)}:gt,ir=it(function(n,t,e){de.call(n,e)?n[e]++:n[e]=1}),lr=it(function(n,t,e){(de.call(n,e)?n[e]:n[e]=[]).push(t)}),fr=it(function(n,t,e){n[e]=t}),cr=At;ze&&rt&&typeof je=="function"&&(Mt=function(n){if(!_t(n))throw new ae;return je.apply(e,arguments)});var pr=8==Fe(x+"08")?Fe:function(n,t){return Fe(jt(n)?n.replace(B,""):n,t||0)
|
||||
};return y.after=function(n,t){if(!_t(t))throw new ae;return function(){return 1>--n?t.apply(this,arguments):void 0}},y.assign=er,y.at=function(n){var t=arguments,e=-1,r=tt(t,!0,!1,1),t=t[2]&&t[2][t[1]]===n?1:r.length,u=Xt(t);for(We.unindexedChars&&jt(n)&&(n=n.split(""));++e<t;)u[e]=n[r[e]];return u},y.bind=Gt,y.bindAll=function(n){for(var t=1<arguments.length?tt(arguments,!0,!1,1):mt(n),e=-1,r=t.length;++e<r;){var u=t[e];n[u]=lt(n[u],1,null,null,n)}return n},y.bindKey=function(n,t){return 2<arguments.length?lt(t,19,Le.call(arguments,2),null,n):lt(t,3,null,null,n)
|
||||
},y.chain=function(n){return n=new m(n),n.__chain__=!0,n},y.compact=function(n){for(var t=-1,e=n?n.length:0,r=[];++t<e;){var u=n[t];u&&r.push(u)}return r},y.compose=function(){for(var n=arguments,t=n.length;t--;)if(!_t(n[t]))throw new ae;return function(){for(var t=arguments,e=n.length;e--;)t=[n[e].apply(this,t)];return t[0]}},y.countBy=ir,y.createCallback=function(n,t,e){var r=typeof n;if(null==n||"function"==r)return Z(n,t,e);if("object"!=r)return function(t){return t[n]};var u=He(n),o=u[0],a=n[o];
|
||||
return 1!=u.length||a!==a||bt(a)?function(t){for(var e=u.length,r=!1;e--&&(r=et(t[u[e]],n[u[e]],null,!0)););return r}:function(n){return n=n[o],a===n&&(0!==a||1/a==1/n)}},y.curry=function(n,t){return t=typeof t=="number"?t:+t||n.length,lt(n,4,null,null,null,t)},y.debounce=Jt,y.defaults=rr,y.defer=Mt,y.delay=function(n,t){if(!_t(n))throw new ae;var e=Le.call(arguments,2);return xe(function(){n.apply(v,e)},t)},y.difference=Ft,y.filter=Et,y.flatten=function(n,t,e,r){return typeof t!="boolean"&&null!=t&&(e=(r=e)&&r[t]===n?null:t,t=!1),null!=e&&(n=At(n,e,r)),tt(n,t)
|
||||
},y.forEach=St,y.forEachRight=It,y.forIn=ur,y.forInRight=function(n,t,e){var r=[];ur(n,function(n,t){r.push(t,n)});var u=r.length;for(t=Z(t,e,3);u--&&false!==t(r[u--],r[u],n););return n},y.forOwn=or,y.forOwnRight=yt,y.functions=mt,y.groupBy=lr,y.indexBy=fr,y.initial=function(n,t,e){var r=0,u=n?n.length:0;if(typeof t!="number"&&null!=t){var o=u;for(t=y.createCallback(t,e,3);o--&&t(n[o],o,n);)r++}else r=null==t||e?1:t||r;return g(n,0,Re(Pe(0,u-r),u))},y.intersection=function(e){for(var r=arguments,u=r.length,a=-1,l=i(),f=-1,c=st(),g=e?e.length:0,h=[],v=i();++a<u;){var y=r[a];
|
||||
l[a]=c===n&&(y?y.length:0)>=w&&o(a?r[a]:v)}n:for(;++f<g;){var m=l[0],y=e[f];if(0>(m?t(m,y):c(v,y))){for(a=u,(m||v).push(y);--a;)if(m=l[a],0>(m?t(m,y):c(r[a],y)))continue n;h.push(y)}}for(;u--;)(m=l[u])&&s(m);return p(l),p(v),h},y.invert=dt,y.invoke=function(n,t){var e=Le.call(arguments,2),r=-1,u=typeof t=="function",o=n?n.length:0,a=Xt(typeof o=="number"?o:0);return St(n,function(n){a[++r]=(u?t:n[t]).apply(n,e)}),a},y.keys=He,y.map=At,y.max=Nt,y.memoize=function(n,t){function e(){var r=e.cache,u=t?t.apply(this,arguments):b+arguments[0];
|
||||
return de.call(r,u)?r[u]:r[u]=n.apply(this,arguments)}if(!_t(n))throw new ae;return e.cache={},e},y.merge=function(n){var t=arguments,e=2;if(!bt(n))return n;if("number"!=typeof t[2]&&(e=t.length),3<e&&"function"==typeof t[e-2])var r=Z(t[--e-1],t[e--],2);else 2<e&&"function"==typeof t[e-1]&&(r=t[--e]);for(var t=Le.call(arguments,1,e),u=-1,o=i(),a=i();++u<e;)ut(n,t[u],r,o,a);return p(o),p(a),n},y.min=function(n,t,e){var u=1/0,o=u;if(!t&&Je(n)){e=-1;for(var a=n.length;++e<a;){var i=n[e];i<o&&(o=i)}}else t=!t&&jt(n)?r:y.createCallback(t,e,3),tr(n,function(n,e,r){e=t(n,e,r),e<u&&(u=e,o=n)
|
||||
});return o},y.omit=function(n,t,e){var r=st(),u=typeof t=="function",o={};if(u)t=y.createCallback(t,e,3);else var a=tt(arguments,!0,!1,1);return ur(n,function(n,e,i){(u?!t(n,e,i):0>r(a,e))&&(o[e]=n)}),o},y.once=function(n){var t,e;if(!_t(n))throw new ae;return function(){return t?e:(t=!0,e=n.apply(this,arguments),n=null,e)}},y.pairs=function(n){for(var t=-1,e=He(n),r=e.length,u=Xt(r);++t<r;){var o=e[t];u[t]=[o,n[o]]}return u},y.partial=function(n){return lt(n,16,Le.call(arguments,1))},y.partialRight=function(n){return lt(n,32,null,Le.call(arguments,1))
|
||||
},y.pick=function(n,t,e){var r={};if(typeof t!="function")for(var u=-1,o=tt(arguments,!0,!1,1),a=bt(n)?o.length:0;++u<a;){var i=o[u];i in n&&(r[i]=n[i])}else t=y.createCallback(t,e,3),ur(n,function(n,e,u){t(n,e,u)&&(r[e]=n)});return r},y.pluck=cr,y.pull=function(n){for(var t=arguments,e=0,r=t.length,u=n?n.length:0;++e<r;)for(var o=-1,a=t[e];++o<u;)n[o]===a&&(Ce.call(n,o--,1),u--);return n},y.range=function(n,t,e){n=+n||0,e=typeof e=="number"?e:+e||1,null==t&&(t=n,n=0);var r=-1;t=Pe(0,ge((t-n)/(e||1)));
|
||||
for(var u=Xt(t);++r<t;)u[r]=n,n+=e;return u},y.reject=function(n,t,e){return t=y.createCallback(t,e,3),Et(n,function(n,e,r){return!t(n,e,r)})},y.remove=function(n,t,e){var r=-1,u=n?n.length:0,o=[];for(t=y.createCallback(t,e,3);++r<u;)e=n[r],t(e,r,n)&&(o.push(e),Ce.call(n,r--,1),u--);return o},y.rest=Tt,y.shuffle=Pt,y.sortBy=function(n,t,e){var r=-1,o=n?n.length:0,a=Xt(typeof o=="number"?o:0);for(t=y.createCallback(t,e,3),St(n,function(n,e,u){var o=a[++r]=l();o.m=t(n,e,u),o.n=r,o.o=n}),o=a.length,a.sort(u);o--;)n=a[o],a[o]=n.o,s(n);
|
||||
return a},y.tap=function(n,t){return t(n),n},y.throttle=function(n,t,e){var r=!0,u=!0;if(!_t(n))throw new ae;return false===e?r=!1:bt(e)&&(r="leading"in e?e.leading:r,u="trailing"in e?e.trailing:u),V.leading=r,V.maxWait=t,V.trailing=u,Jt(n,t,V)},y.times=function(n,t,e){n=-1<(n=+n)?n:0;var r=-1,u=Xt(n);for(t=Z(t,e,1);++r<n;)u[r]=t(r);return u},y.toArray=function(n){return n&&typeof n.length=="number"?We.unindexedChars&&jt(n)?n.split(""):g(n):xt(n)},y.transform=function(n,t,e,r){var u=Je(n);return t=Z(t,r,4),null==e&&(u?e=[]:(r=n&&n.constructor,e=ct(r&&r.prototype))),(u?tr:or)(n,function(n,r,u){return t(e,n,r,u)
|
||||
}),e},y.union=function(){return at(tt(arguments,!0,!0))},y.uniq=qt,y.values=xt,y.where=Et,y.without=function(n){return Ft(n,Le.call(arguments,1))},y.wrap=function(n,t){if(!_t(t))throw new ae;return function(){var e=[n];return be.apply(e,arguments),t.apply(this,e)}},y.zip=Kt,y.zipObject=Wt,y.collect=At,y.drop=Tt,y.each=St,y.q=It,y.extend=er,y.methods=mt,y.object=Wt,y.select=Et,y.tail=Tt,y.unique=qt,y.unzip=Kt,Ut(y),y.clone=function(n,t,e,r){return typeof t!="boolean"&&null!=t&&(r=e,e=t,t=!1),j(n,t,typeof e=="function"&&Z(e,r,1))
|
||||
},y.cloneDeep=function(n,t,e){return j(n,!0,typeof t=="function"&&Z(t,e,1))},y.contains=Ct,y.escape=function(n){return null==n?"":oe(n).replace(nr,pt)},y.every=kt,y.find=Ot,y.findIndex=function(n,t,e){var r=-1,u=n?n.length:0;for(t=y.createCallback(t,e,3);++r<u;)if(t(n[r],r,n))return r;return-1},y.findKey=function(n,t,e){var r;return t=y.createCallback(t,e,3),or(n,function(n,e,u){return t(n,e,u)?(r=e,!1):void 0}),r},y.findLast=function(n,t,e){var r;return t=y.createCallback(t,e,3),It(n,function(n,e,u){return t(n,e,u)?(r=n,!1):void 0
|
||||
}),r},y.findLastIndex=function(n,t,e){var r=n?n.length:0;for(t=y.createCallback(t,e,3);r--;)if(t(n[r],r,n))return r;return-1},y.findLastKey=function(n,t,e){var r;return t=y.createCallback(t,e,3),yt(n,function(n,e,u){return t(n,e,u)?(r=e,!1):void 0}),r},y.has=function(n,t){return n?de.call(n,t):!1},y.identity=Ht,y.indexOf=Lt,y.isArguments=vt,y.isArray=Je,y.isBoolean=function(n){return true===n||false===n||ke.call(n)==z},y.isDate=function(n){return n?typeof n=="object"&&ke.call(n)==q:!1},y.isElement=function(n){return n?1===n.nodeType:!1
|
||||
},y.isEmpty=function(n){var t=!0;if(!n)return t;var e=ke.call(n),r=n.length;return e==T||e==H||(We.argsClass?e==L:vt(n))||e==J&&typeof r=="number"&&_t(n.splice)?!r:(or(n,function(){return t=!1}),t)},y.isEqual=function(n,t,e,r){return et(n,t,typeof e=="function"&&Z(e,r,2))},y.isFinite=function(n){return Ne(n)&&!Be(parseFloat(n))},y.isFunction=_t,y.isNaN=function(n){return wt(n)&&n!=+n},y.isNull=function(n){return null===n},y.isNumber=wt,y.isObject=bt,y.isPlainObject=ar,y.isRegExp=function(n){return n&&Y[typeof n]?ke.call(n)==M:!1
|
||||
},y.isString=jt,y.isUndefined=function(n){return typeof n=="undefined"},y.lastIndexOf=function(n,t,e){var r=n?n.length:0;for(typeof e=="number"&&(r=(0>e?Pe(0,r+e):Re(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},y.mixin=Ut,y.noConflict=function(){return e._=pe,this},y.parseInt=pr,y.random=Vt,y.reduce=Bt,y.reduceRight=Dt,y.result=function(n,t){if(n){var e=n[t];return _t(e)?n[t]():e}},y.runInContext=h,y.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:He(n).length},y.some=Rt,y.sortedIndex=zt,y.template=function(n,t,e){var r=y.templateSettings;
|
||||
n||(n=""),e=rr({},e,r);var u,o=rr({},e.imports,r.imports),r=He(o),o=xt(o),i=0,l=e.interpolate||D,f="__p+='",l=ue((e.escape||D).source+"|"+l.source+"|"+(l===N?S:D).source+"|"+(e.evaluate||D).source+"|$","g");n.replace(l,function(t,e,r,o,l,c){return r||(r=o),f+=n.slice(i,c).replace(R,a),e&&(f+="'+__e("+e+")+'"),l&&(u=!0,f+="';"+l+";__p+='"),r&&(f+="'+((__t=("+r+"))==null?'':__t)+'"),i=c+t.length,t}),f+="';\n",l=e=e.variable,l||(e="obj",f="with("+e+"){"+f+"}"),f=(u?f.replace(C,""):f).replace(E,"$1").replace(O,"$1;"),f="function("+e+"){"+(l?"":e+"||("+e+"={});")+"var __t,__p='',__e=_.escape"+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+f+"return __p}";
|
||||
try{var c=ne(r,"return "+f).apply(v,o)}catch(p){throw p.source=f,p}return t?c(t):(c.source=f,c)},y.unescape=function(n){return null==n?"":oe(n).replace(Ze,ht)},y.uniqueId=function(n){var t=++d;return oe(null==n?"":n)+t},y.all=kt,y.any=Rt,y.detect=Ot,y.findWhere=Ot,y.foldl=Bt,y.foldr=Dt,y.include=Ct,y.inject=Bt,or(y,function(n,t){y.prototype[t]||(y.prototype[t]=function(){var t=[this.__wrapped__],e=this.__chain__;return be.apply(t,arguments),t=n.apply(y,t),e?new m(t,e):t})}),y.first=$t,y.last=function(n,t,e){var r=0,u=n?n.length:0;
|
||||
if(typeof t!="number"&&null!=t){var o=u;for(t=y.createCallback(t,e,3);o--&&t(n[o],o,n);)r++}else if(r=t,null==r||e)return n?n[u-1]:v;return g(n,Pe(0,u-r))},y.sample=function(n,t,e){var r=n?n.length:0;return typeof r!="number"?n=xt(n):We.unindexedChars&&jt(n)&&(n=n.split("")),null==t||e?n?n[Vt(r-1)]:v:(n=Pt(n),n.length=Re(Pe(0,t),n.length),n)},y.take=$t,y.head=$t,or(y,function(n,t){var e="sample"!==t;y.prototype[t]||(y.prototype[t]=function(t,r){var u=this.__chain__,o=n(this.__wrapped__,t,r);return u||null!=t&&(!r||e&&typeof t=="function")?new m(o,u):o
|
||||
})}),y.VERSION="2.2.1",y.prototype.chain=function(){return this.__chain__=!0,this},y.prototype.toString=function(){return oe(this.__wrapped__)},y.prototype.value=Qt,y.prototype.valueOf=Qt,tr(["join","pop","shift"],function(n){var t=ie[n];y.prototype[n]=function(){var n=this.__chain__,e=t.apply(this.__wrapped__,arguments);return n?new m(e,n):e}}),tr(["push","reverse","sort","unshift"],function(n){var t=ie[n];y.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),tr(["concat","slice","splice"],function(n){var t=ie[n];
|
||||
y.prototype[n]=function(){return new m(t.apply(this.__wrapped__,arguments),this.__chain__)}}),We.spliceObjects||tr(["pop","shift","splice"],function(n){var t=ie[n],e="splice"==n;y.prototype[n]=function(){var n=this.__chain__,r=this.__wrapped__,u=t.apply(r,arguments);return 0===r.length&&delete r[0],n||e?new m(u,n):u}}),y}var v,y=[],m=[],d=0,_={},b=+new Date+"",w=75,j=40,x=" \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",C=/\b__p\+='';/g,E=/\b(__p\+=)''\+/g,O=/(__e\(.*?\)|\b__t\))\+'';/g,S=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,I=/\w*$/,A=/^function[ \n\r\t]+\w/,N=/<%=([\s\S]+?)%>/g,B=RegExp("^["+x+"]*0+(?=.$)"),D=/($^)/,P=/\bthis\b/,R=/['\n\r\t\u2028\u2029\\]/g,F="Array Boolean Date Error Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),$="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),L="[object Arguments]",T="[object Array]",z="[object Boolean]",q="[object Date]",K="[object Error]",W="[object Function]",G="[object Number]",J="[object Object]",M="[object RegExp]",H="[object String]",U={};
|
||||
U[W]=!1,U[L]=U[T]=U[z]=U[q]=U[G]=U[J]=U[M]=U[H]=!0;var V={leading:!1,maxWait:0,trailing:!1},Q={configurable:!1,enumerable:!1,value:null,writable:!1},X={a:"",b:null,c:"",d:"",e:"",v:null,g:"",h:null,support:null,i:"",j:!1},Y={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},Z={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},nt=Y[typeof window]&&window||this,tt=Y[typeof exports]&&exports&&!exports.nodeType&&exports,et=Y[typeof module]&&module&&!module.nodeType&&module,rt=et&&et.exports===tt&&tt,ut=Y[typeof global]&&global;
|
||||
!ut||ut.global!==ut&&ut.window!==ut||(nt=ut);var ot=h();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(nt._=ot, define(function(){return ot})):tt&&et?rt?(et.exports=ot)._=ot:tt._=ot:nt._=ot}).call(this);
|
||||
6360
dist/lodash.js
vendored
6360
dist/lodash.js
vendored
File diff suppressed because it is too large
Load Diff
54
dist/lodash.min.js
vendored
54
dist/lodash.min.js
vendored
@@ -1,54 +0,0 @@
|
||||
/**
|
||||
* @license
|
||||
* Lo-Dash 2.2.1 (Custom Build) lodash.com/license | Underscore.js 1.5.2 underscorejs.org/LICENSE
|
||||
* Build: `lodash modern -o ./dist/lodash.js`
|
||||
*/
|
||||
;(function(){function n(n,t,e){e=(e||0)-1;for(var r=n?n.length:0;++e<r;)if(n[e]===t)return e;return-1}function t(t,e){var r=typeof e;if(t=t.l,"boolean"==r||null==e)return t[e]?0:-1;"number"!=r&&"string"!=r&&(r="object");var u="number"==r?e:_+e;return t=(t=t[r])&&t[u],"object"==r?t&&-1<n(t,e)?0:-1:t?0:-1}function e(n){var t=this.l,e=typeof n;if("boolean"==e||null==n)t[n]=!0;else{"number"!=e&&"string"!=e&&(e="object");var r="number"==e?n:_+n,t=t[e]||(t[e]={});"object"==e?(t[r]||(t[r]=[])).push(n):t[r]=!0
|
||||
}}function r(n){return n.charCodeAt(0)}function u(n,t){var e=n.m,r=t.m;if(e!==r){if(e>r||typeof e=="undefined")return 1;if(e<r||typeof r=="undefined")return-1}return n.n-t.n}function o(n){var t=-1,r=n.length,u=n[0],o=n[0|r/2],a=n[r-1];if(u&&typeof u=="object"&&o&&typeof o=="object"&&a&&typeof a=="object")return!1;for(u=f(),u["false"]=u["null"]=u["true"]=u.undefined=!1,o=f(),o.k=n,o.l=u,o.push=e;++t<r;)o.push(n[t]);return o}function a(n){return"\\"+G[n]}function i(){return g.pop()||[]}function f(){return y.pop()||{k:null,l:null,m:null,"false":!1,n:0,"null":!1,number:null,object:null,push:null,string:null,"true":!1,undefined:!1,o:null}
|
||||
}function l(){}function c(n){n.length=0,g.length<d&&g.push(n)}function p(n){var t=n.l;t&&p(t),n.k=n.l=n.m=n.object=n.number=n.string=n.o=null,y.length<d&&y.push(n)}function s(n,t,e){t||(t=0),typeof e=="undefined"&&(e=n?n.length:0);var r=-1;e=e-t||0;for(var u=Array(0>e?0:e);++r<e;)u[r]=n[t+r];return u}function v(e){function g(n){if(!n||je.call(n)!=z)return!1;var t=n.valueOf,e=typeof t=="function"&&(e=ge(t))&&ge(e);return e?n==e||ge(n)==e:st(n)}function y(n,t,e){if(!n||!V[typeof n])return n;t=t&&typeof e=="undefined"?t:et(t,e,3);
|
||||
for(var r=-1,u=V[typeof n]&&Ke(n),o=u?u.length:0;++r<o&&(e=u[r],false!==t(n[e],e,n)););return n}function d(n,t,e){var r;if(!n||!V[typeof n])return n;t=t&&typeof e=="undefined"?t:et(t,e,3);for(r in n)if(false===t(n[r],r,n))break;return n}function G(n,t,e){var r,u=n,o=u;if(!u)return o;for(var a=arguments,i=0,f=typeof e=="number"?2:a.length;++i<f;)if((u=a[i])&&V[typeof u])for(var l=-1,c=V[typeof u]&&Ke(u),p=c?c.length:0;++l<p;)r=c[l],"undefined"==typeof o[r]&&(o[r]=u[r]);return o}function J(n,t,e){var r,u=n,o=u;
|
||||
if(!u)return o;var a=arguments,i=0,f=typeof e=="number"?2:a.length;if(3<f&&"function"==typeof a[f-2])var l=et(a[--f-1],a[f--],2);else 2<f&&"function"==typeof a[f-1]&&(l=a[--f]);for(;++i<f;)if((u=a[i])&&V[typeof u])for(var c=-1,p=V[typeof u]&&Ke(u),s=p?p.length:0;++c<s;)r=p[c],o[r]=l?l(o[r],u[r]):u[r];return o}function Q(n){var t,e=[];if(!n||!V[typeof n])return e;for(t in n)ye.call(n,t)&&e.push(t);return e}function Y(n){return n&&typeof n=="object"&&!Pe(n)&&ye.call(n,"__wrapped__")?n:new nt(n)}function nt(n,t){this.__chain__=!!t,this.__wrapped__=n
|
||||
}function tt(n,t,e,r,u){if(e){var o=e(n);if(typeof o!="undefined")return o}if(!bt(n))return n;var a=je.call(n);if(!L[a])return n;var f=We[a];switch(a){case F:case T:return new f(+n);case q:case K:return new f(n);case P:return o=f(n.source,O.exec(n)),o.lastIndex=n.lastIndex,o}if(a=Pe(n),t){var l=!r;r||(r=i()),u||(u=i());for(var p=r.length;p--;)if(r[p]==n)return u[p];o=a?f(n.length):{}}else o=a?s(n):J({},n);return a&&(ye.call(n,"index")&&(o.index=n.index),ye.call(n,"input")&&(o.input=n.input)),t?(r.push(n),u.push(o),(a?It:y)(n,function(n,a){o[a]=tt(n,t,e,r,u)
|
||||
}),l&&(c(r),c(u)),o):o}function et(n,t,e){if(typeof n!="function")return Gt;if(typeof t=="undefined")return n;var r=n.__bindData__||qe.funcNames&&!n.name;if(typeof r=="undefined"){var u=R&&he.call(n);qe.funcNames||!u||I.test(u)||(r=!0),(qe.funcNames||!r)&&(r=!qe.funcDecomp||R.test(u),ze(n,r))}if(true!==r&&r&&1&r[1])return n;switch(e){case 1:return function(e){return n.call(t,e)};case 2:return function(e,r){return n.call(t,e,r)};case 3:return function(e,r,u){return n.call(t,e,r,u)};case 4:return function(e,r,u,o){return n.call(t,e,r,u,o)
|
||||
}}return Mt(n,t)}function rt(n,t,e,r){r=(r||0)-1;for(var u=n?n.length:0,o=[];++r<u;){var a=n[r];if(a&&typeof a=="object"&&typeof a.length=="number"&&(Pe(a)||ht(a))){t||(a=rt(a,t,e));var i=-1,f=a.length,l=o.length;for(o.length+=f;++i<f;)o[l++]=a[i]}else e||o.push(a)}return o}function ut(n,t,e,r,u,o){if(e){var a=e(n,t);if(typeof a!="undefined")return!!a}if(n===t)return 0!==n||1/n==1/t;if(n===n&&!(n&&V[typeof n]||t&&V[typeof t]))return!1;if(null==n||null==t)return n===t;var f=je.call(n),l=je.call(t);
|
||||
if(f==B&&(f=z),l==B&&(l=z),f!=l)return!1;switch(f){case F:case T:return+n==+t;case q:return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case P:case K:return n==oe(t)}if(l=f==$,!l){if(ye.call(n,"__wrapped__")||ye.call(t,"__wrapped__"))return ut(n.__wrapped__||n,t.__wrapped__||t,e,r,u,o);if(f!=z)return!1;var f=n.constructor,p=t.constructor;if(f!=p&&!(_t(f)&&f instanceof f&&_t(p)&&p instanceof p))return!1}for(p=!u,u||(u=i()),o||(o=i()),f=u.length;f--;)if(u[f]==n)return o[f]==t;var s=0,a=!0;if(u.push(n),o.push(t),l){if(f=n.length,s=t.length,a=s==n.length,!a&&!r)return a;
|
||||
for(;s--;)if(l=f,p=t[s],r)for(;l--&&!(a=ut(n[l],p,e,r,u,o)););else if(!(a=ut(n[s],p,e,r,u,o)))break;return a}return d(t,function(t,i,f){return ye.call(f,i)?(s++,a=ye.call(n,i)&&ut(n[i],t,e,r,u,o)):void 0}),a&&!r&&d(n,function(n,t,e){return ye.call(e,t)?a=-1<--s:void 0}),p&&(c(u),c(o)),a}function ot(n,t,e,r,u){(Pe(t)?It:y)(t,function(t,o){var a,i,f=t,l=n[o];if(t&&((i=Pe(t))||g(t))){for(f=r.length;f--;)if(a=r[f]==t){l=u[f];break}if(!a){var c;e&&(f=e(l,t),c=typeof f!="undefined")&&(l=f),c||(l=i?Pe(l)?l:[]:g(l)?l:{}),r.push(t),u.push(l),c||ot(l,t,e,r,u)
|
||||
}}else e&&(f=e(l,t),typeof f=="undefined"&&(f=t)),typeof f!="undefined"&&(l=f);n[o]=l})}function at(e,r,u){var a=-1,f=pt(),l=e?e.length:0,s=[],v=!r&&l>=b&&f===n,h=u||v?i():s;if(v){var g=o(h);g?(f=t,h=g):(v=!1,h=u?h:(c(h),s))}for(;++a<l;){var g=e[a],y=u?u(g,a,e):g;(r?!a||h[h.length-1]!==y:0>f(h,y))&&((u||v)&&h.push(y),s.push(g))}return v?(c(h.k),p(h)):u&&c(h),s}function it(n){return function(t,e,r){var u={};e=Y.createCallback(e,r,3),r=-1;var o=t?t.length:0;if(typeof o=="number")for(;++r<o;){var a=t[r];
|
||||
n(u,a,e(a,r,t),t)}else y(t,function(t,r,o){n(u,t,e(t,r,o),o)});return u}}function ft(n,t,e,r,u,o){var a=1&t,i=2&t,f=4&t,l=8&t,c=16&t,p=32&t,s=n;if(!i&&!_t(n))throw new ae;c&&!e.length&&(t&=-17,c=e=!1),p&&!r.length&&(t&=-33,p=r=!1);var v=n&&n.__bindData__;if(v)return!a||1&v[1]||(v[4]=u),!a&&1&v[1]&&(t|=8),!f||4&v[1]||(v[5]=o),c&&_e.apply(v[2]||(v[2]=[]),e),p&&_e.apply(v[3]||(v[3]=[]),r),v[1]|=t,ft.apply(null,v);if(!a||i||f||p||!(qe.fastBind||Ce&&c))g=function(){var v=arguments,h=a?u:this;return(f||c||p)&&(v=$e.call(v),c&&ke.apply(v,e),p&&_e.apply(v,r),f&&v.length<o)?(t|=16,ft(n,l?t:-4&t,v,null,u,o)):(i&&(n=h[s]),this instanceof g?(h=lt(n.prototype),v=n.apply(h,v),bt(v)?v:h):n.apply(h,v))
|
||||
};else{if(c){var h=[u];_e.apply(h,e)}var g=c?Ce.apply(n,h):Ce.call(n,u)}return ze(g,$e.call(arguments)),g}function lt(n){return bt(n)?Oe(n):{}}function ct(n){return Le[n]}function pt(){var t=(t=Y.indexOf)===Wt?n:t;return t}function st(n){var t,e;return n&&je.call(n)==z&&(t=n.constructor,!_t(t)||t instanceof t)?(d(n,function(n,t){e=t}),typeof e=="undefined"||ye.call(n,e)):!1}function vt(n){return Me[n]}function ht(n){return n&&typeof n=="object"&&typeof n.length=="number"&&je.call(n)==B||!1}function gt(n,t,e){var r=Ke(n),u=r.length;
|
||||
for(t=et(t,e,3);u--&&(e=r[u],false!==t(n[e],e,n)););return n}function yt(n){var t=[];return d(n,function(n,e){_t(n)&&t.push(e)}),t.sort()}function mt(n){for(var t=-1,e=Ke(n),r=e.length,u={};++t<r;){var o=e[t];u[n[o]]=o}return u}function _t(n){return typeof n=="function"}function bt(n){return!(!n||!V[typeof n])}function dt(n){return typeof n=="number"||je.call(n)==q}function wt(n){return typeof n=="string"||je.call(n)==K}function jt(n){for(var t=-1,e=Ke(n),r=e.length,u=Xt(r);++t<r;)u[t]=n[e[t]];return u
|
||||
}function kt(n,t,e){var r=-1,u=pt(),o=n?n.length:0,a=!1;return e=(0>e?Re(0,o+e):e)||0,Pe(n)?a=-1<u(n,t,e):typeof o=="number"?a=-1<(wt(n)?n.indexOf(t,e):u(n,t,e)):y(n,function(n){return++r<e?void 0:!(a=n===t)}),a}function xt(n,t,e){var r=!0;t=Y.createCallback(t,e,3),e=-1;var u=n?n.length:0;if(typeof u=="number")for(;++e<u&&(r=!!t(n[e],e,n)););else y(n,function(n,e,u){return r=!!t(n,e,u)});return r}function Ct(n,t,e){var r=[];t=Y.createCallback(t,e,3),e=-1;var u=n?n.length:0;if(typeof u=="number")for(;++e<u;){var o=n[e];
|
||||
t(o,e,n)&&r.push(o)}else y(n,function(n,e,u){t(n,e,u)&&r.push(n)});return r}function Ot(n,t,e){t=Y.createCallback(t,e,3),e=-1;var r=n?n.length:0;if(typeof r!="number"){var u;return y(n,function(n,e,r){return t(n,e,r)?(u=n,!1):void 0}),u}for(;++e<r;){var o=n[e];if(t(o,e,n))return o}}function It(n,t,e){var r=-1,u=n?n.length:0;if(t=t&&typeof e=="undefined"?t:et(t,e,3),typeof u=="number")for(;++r<u&&false!==t(n[r],r,n););else y(n,t);return n}function Nt(n,t,e){var r=n?n.length:0;if(t=t&&typeof e=="undefined"?t:et(t,e,3),typeof r=="number")for(;r--&&false!==t(n[r],r,n););else{var u=Ke(n),r=u.length;
|
||||
y(n,function(n,e,o){return e=u?u[--r]:--r,t(o[e],e,o)})}return n}function Et(n,t,e){var r=-1,u=n?n.length:0;if(t=Y.createCallback(t,e,3),typeof u=="number")for(var o=Xt(u);++r<u;)o[r]=t(n[r],r,n);else o=[],y(n,function(n,e,u){o[++r]=t(n,e,u)});return o}function St(n,t,e){var u=-1/0,o=u;if(!t&&Pe(n)){e=-1;for(var a=n.length;++e<a;){var i=n[e];i>o&&(o=i)}}else t=!t&&wt(n)?r:Y.createCallback(t,e,3),It(n,function(n,e,r){e=t(n,e,r),e>u&&(u=e,o=n)});return o}function Rt(n,t){var e=-1,r=n?n.length:0;if(typeof r=="number")for(var u=Xt(r);++e<r;)u[e]=n[e][t];
|
||||
return u||Et(n,t)}function At(n,t,e,r){if(!n)return e;var u=3>arguments.length;t=et(t,r,4);var o=-1,a=n.length;if(typeof a=="number")for(u&&(e=n[++o]);++o<a;)e=t(e,n[o],o,n);else y(n,function(n,r,o){e=u?(u=!1,n):t(e,n,r,o)});return e}function Dt(n,t,e,r){var u=3>arguments.length;return t=et(t,r,4),Nt(n,function(n,r,o){e=u?(u=!1,n):t(e,n,r,o)}),e}function Bt(n){var t=-1,e=n?n.length:0,r=Xt(typeof e=="number"?e:0);return It(n,function(n){var e=Jt(++t);r[t]=r[e],r[e]=n}),r}function $t(n,t,e){var r;t=Y.createCallback(t,e,3),e=-1;
|
||||
var u=n?n.length:0;if(typeof u=="number")for(;++e<u&&!(r=t(n[e],e,n)););else y(n,function(n,e,u){return!(r=t(n,e,u))});return!!r}function Ft(e){var r=-1,u=pt(),a=e?e.length:0,i=rt(arguments,!0,!0,1),f=[],l=a>=b&&u===n;if(l){var c=o(i);c?(u=t,i=c):l=!1}for(;++r<a;)c=e[r],0>u(i,c)&&f.push(c);return l&&p(i),f}function Tt(n,t,e){var r=0,u=n?n.length:0;if(typeof t!="number"&&null!=t){var o=-1;for(t=Y.createCallback(t,e,3);++o<u&&t(n[o],o,n);)r++}else if(r=t,null==r||e)return n?n[0]:h;return s(n,0,Ae(Re(0,r),u))
|
||||
}function Wt(t,e,r){if(typeof r=="number"){var u=t?t.length:0;r=0>r?Re(0,u+r):r||0}else if(r)return r=zt(t,e),t[r]===e?r:-1;return n(t,e,r)}function qt(n,t,e){if(typeof t!="number"&&null!=t){var r=0,u=-1,o=n?n.length:0;for(t=Y.createCallback(t,e,3);++u<o&&t(n[u],u,n);)r++}else r=null==t||e?1:Re(0,t);return s(n,r)}function zt(n,t,e,r){var u=0,o=n?n.length:u;for(e=e?Y.createCallback(e,r,1):Gt,t=e(t);u<o;)r=u+o>>>1,e(n[r])<t?u=r+1:o=r;return u}function Pt(n,t,e,r){return typeof t!="boolean"&&null!=t&&(e=(r=e)&&r[t]===n?null:t,t=!1),null!=e&&(e=Y.createCallback(e,r,3)),at(n,t,e)
|
||||
}function Kt(){for(var n=1<arguments.length?arguments:arguments[0],t=-1,e=n?St(Rt(n,"length")):0,r=Xt(0>e?0:e);++t<e;)r[t]=Rt(n,t);return r}function Lt(n,t){for(var e=-1,r=n?n.length:0,u={};++e<r;){var o=n[e];t?u[o]=t[e]:o&&(u[o[0]]=o[1])}return u}function Mt(n,t){return 2<arguments.length?ft(n,17,$e.call(arguments,2),null,t):ft(n,1,null,null,t)}function Ut(n,t,e){function r(){c&&se(c),a=c=p=h,(g||v!==t)&&(s=me(),i=n.apply(l,o))}function u(){var e=t-(me()-f);0<e?c=de(u,e):(a&&se(a),e=p,a=c=p=h,e&&(s=me(),i=n.apply(l,o)))
|
||||
}var o,a,i,f,l,c,p,s=0,v=!1,g=!0;if(!_t(n))throw new ae;if(t=Re(0,t)||0,true===e)var y=!0,g=!1;else bt(e)&&(y=e.leading,v="maxWait"in e&&(Re(t,e.maxWait)||0),g="trailing"in e?e.trailing:g);return function(){if(o=arguments,f=me(),l=this,p=g&&(c||!y),false===v)var e=y&&!c;else{a||y||(s=f);var h=v-(f-s);0<h?a||(a=de(r,h)):(a&&(a=se(a)),s=f,i=n.apply(l,o))}return c||t===v||(c=de(u,t)),e&&(i=n.apply(l,o)),i}}function Vt(n){if(!_t(n))throw new ae;var t=$e.call(arguments,1);return de(function(){n.apply(h,t)},1)
|
||||
}function Gt(n){return n}function Ht(n,t){var e=n,r=!t||_t(e);t||(e=nt,t=n,n=Y),It(yt(t),function(u){var o=n[u]=t[u];r&&(e.prototype[u]=function(){var t=this.__wrapped__,r=[t];return _e.apply(r,arguments),r=o.apply(n,r),t&&typeof t=="object"&&t===r?this:(r=new e(r),r.__chain__=this.__chain__,r)})})}function Jt(n,t,e){var r=null==n,u=null==t;return null==e&&(typeof n=="boolean"&&u?(e=n,n=1):u||typeof t!="boolean"||(e=t,u=!0)),r&&u&&(t=1),n=+n||0,u?(t=n,n=0):t=+t||0,r=Be(),e||n%1||t%1?Ae(n+r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+ve(r*(t-n+1))
|
||||
}function Qt(){return this.__wrapped__}e=e?Z.defaults(H.Object(),e,Z.pick(H,D)):H;var Xt=e.Array,Yt=e.Boolean,Zt=e.Date,ne=e.Function,te=e.Math,ee=e.Number,re=e.Object,ue=e.RegExp,oe=e.String,ae=e.TypeError,ie=[],fe=re.prototype,le=e._,ce=ue("^"+oe(fe.valueOf).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),pe=te.ceil,se=e.clearTimeout,ve=te.floor,he=ne.prototype.toString,ge=ce.test(ge=re.getPrototypeOf)&&ge,ye=fe.hasOwnProperty,me=ce.test(me=Zt.now)&&me||function(){return+new Zt
|
||||
},_e=ie.push,be=e.setImmediate,de=e.setTimeout,we=ie.splice,je=fe.toString,ke=ie.unshift,xe=function(){try{var n={},t=ce.test(t=re.defineProperty)&&t,e=t(n,n,n)&&t}catch(r){}return e}(),Ce=ce.test(Ce=je.bind)&&Ce,Oe=ce.test(Oe=re.create)&&Oe,Ie=ce.test(Ie=Xt.isArray)&&Ie,Ne=e.isFinite,Ee=e.isNaN,Se=ce.test(Se=re.keys)&&Se,Re=te.max,Ae=te.min,De=e.parseInt,Be=te.random,$e=ie.slice,Fe=ce.test(e.attachEvent),Te=Ce&&!/\n|true/.test(Ce+Fe),We={};We[$]=Xt,We[F]=Yt,We[T]=Zt,We[W]=ne,We[z]=re,We[q]=ee,We[P]=ue,We[K]=oe,nt.prototype=Y.prototype;
|
||||
var qe=Y.support={};qe.fastBind=Ce&&!Te,qe.funcDecomp=!ce.test(e.a)&&R.test(v),qe.funcNames=typeof ne.name=="string",Y.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:N,variable:"",imports:{_:Y}},Oe||(lt=function(n){if(bt(n)){l.prototype=n;var t=new l;l.prototype=null}return t||{}});var ze=xe?function(n,t){U.value=t,xe(n,"__bindData__",U)}:l,Pe=Ie||function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&je.call(n)==$||!1},Ke=Se?function(n){return bt(n)?Se(n):[]
|
||||
}:Q,Le={"&":"&","<":"<",">":">",'"':""","'":"'"},Me=mt(Le),Ue=ue("("+Ke(Me).join("|")+")","g"),Ve=ue("["+Ke(Le).join("")+"]","g"),Ge=it(function(n,t,e){ye.call(n,e)?n[e]++:n[e]=1}),He=it(function(n,t,e){(ye.call(n,e)?n[e]:n[e]=[]).push(t)}),Je=it(function(n,t,e){n[e]=t});Te&&X&&typeof be=="function"&&(Vt=function(n){if(!_t(n))throw new ae;return be.apply(e,arguments)});var Qe=8==De(w+"08")?De:function(n,t){return De(wt(n)?n.replace(E,""):n,t||0)};return Y.after=function(n,t){if(!_t(t))throw new ae;
|
||||
return function(){return 1>--n?t.apply(this,arguments):void 0}},Y.assign=J,Y.at=function(n){for(var t=arguments,e=-1,r=rt(t,!0,!1,1),t=t[2]&&t[2][t[1]]===n?1:r.length,u=Xt(t);++e<t;)u[e]=n[r[e]];return u},Y.bind=Mt,Y.bindAll=function(n){for(var t=1<arguments.length?rt(arguments,!0,!1,1):yt(n),e=-1,r=t.length;++e<r;){var u=t[e];n[u]=ft(n[u],1,null,null,n)}return n},Y.bindKey=function(n,t){return 2<arguments.length?ft(t,19,$e.call(arguments,2),null,n):ft(t,3,null,null,n)},Y.chain=function(n){return n=new nt(n),n.__chain__=!0,n
|
||||
},Y.compact=function(n){for(var t=-1,e=n?n.length:0,r=[];++t<e;){var u=n[t];u&&r.push(u)}return r},Y.compose=function(){for(var n=arguments,t=n.length;t--;)if(!_t(n[t]))throw new ae;return function(){for(var t=arguments,e=n.length;e--;)t=[n[e].apply(this,t)];return t[0]}},Y.countBy=Ge,Y.createCallback=function(n,t,e){var r=typeof n;if(null==n||"function"==r)return et(n,t,e);if("object"!=r)return function(t){return t[n]};var u=Ke(n),o=u[0],a=n[o];return 1!=u.length||a!==a||bt(a)?function(t){for(var e=u.length,r=!1;e--&&(r=ut(t[u[e]],n[u[e]],null,!0)););return r
|
||||
}:function(n){return n=n[o],a===n&&(0!==a||1/a==1/n)}},Y.curry=function(n,t){return t=typeof t=="number"?t:+t||n.length,ft(n,4,null,null,null,t)},Y.debounce=Ut,Y.defaults=G,Y.defer=Vt,Y.delay=function(n,t){if(!_t(n))throw new ae;var e=$e.call(arguments,2);return de(function(){n.apply(h,e)},t)},Y.difference=Ft,Y.filter=Ct,Y.flatten=function(n,t,e,r){return typeof t!="boolean"&&null!=t&&(e=(r=e)&&r[t]===n?null:t,t=!1),null!=e&&(n=Et(n,e,r)),rt(n,t)},Y.forEach=It,Y.forEachRight=Nt,Y.forIn=d,Y.forInRight=function(n,t,e){var r=[];
|
||||
d(n,function(n,t){r.push(t,n)});var u=r.length;for(t=et(t,e,3);u--&&false!==t(r[u--],r[u],n););return n},Y.forOwn=y,Y.forOwnRight=gt,Y.functions=yt,Y.groupBy=He,Y.indexBy=Je,Y.initial=function(n,t,e){var r=0,u=n?n.length:0;if(typeof t!="number"&&null!=t){var o=u;for(t=Y.createCallback(t,e,3);o--&&t(n[o],o,n);)r++}else r=null==t||e?1:t||r;return s(n,0,Ae(Re(0,u-r),u))},Y.intersection=function(e){for(var r=arguments,u=r.length,a=-1,f=i(),l=-1,s=pt(),v=e?e.length:0,h=[],g=i();++a<u;){var y=r[a];f[a]=s===n&&(y?y.length:0)>=b&&o(a?r[a]:g)
|
||||
}n:for(;++l<v;){var m=f[0],y=e[l];if(0>(m?t(m,y):s(g,y))){for(a=u,(m||g).push(y);--a;)if(m=f[a],0>(m?t(m,y):s(r[a],y)))continue n;h.push(y)}}for(;u--;)(m=f[u])&&p(m);return c(f),c(g),h},Y.invert=mt,Y.invoke=function(n,t){var e=$e.call(arguments,2),r=-1,u=typeof t=="function",o=n?n.length:0,a=Xt(typeof o=="number"?o:0);return It(n,function(n){a[++r]=(u?t:n[t]).apply(n,e)}),a},Y.keys=Ke,Y.map=Et,Y.max=St,Y.memoize=function(n,t){function e(){var r=e.cache,u=t?t.apply(this,arguments):_+arguments[0];return ye.call(r,u)?r[u]:r[u]=n.apply(this,arguments)
|
||||
}if(!_t(n))throw new ae;return e.cache={},e},Y.merge=function(n){var t=arguments,e=2;if(!bt(n))return n;if("number"!=typeof t[2]&&(e=t.length),3<e&&"function"==typeof t[e-2])var r=et(t[--e-1],t[e--],2);else 2<e&&"function"==typeof t[e-1]&&(r=t[--e]);for(var t=$e.call(arguments,1,e),u=-1,o=i(),a=i();++u<e;)ot(n,t[u],r,o,a);return c(o),c(a),n},Y.min=function(n,t,e){var u=1/0,o=u;if(!t&&Pe(n)){e=-1;for(var a=n.length;++e<a;){var i=n[e];i<o&&(o=i)}}else t=!t&&wt(n)?r:Y.createCallback(t,e,3),It(n,function(n,e,r){e=t(n,e,r),e<u&&(u=e,o=n)
|
||||
});return o},Y.omit=function(n,t,e){var r=pt(),u=typeof t=="function",o={};if(u)t=Y.createCallback(t,e,3);else var a=rt(arguments,!0,!1,1);return d(n,function(n,e,i){(u?!t(n,e,i):0>r(a,e))&&(o[e]=n)}),o},Y.once=function(n){var t,e;if(!_t(n))throw new ae;return function(){return t?e:(t=!0,e=n.apply(this,arguments),n=null,e)}},Y.pairs=function(n){for(var t=-1,e=Ke(n),r=e.length,u=Xt(r);++t<r;){var o=e[t];u[t]=[o,n[o]]}return u},Y.partial=function(n){return ft(n,16,$e.call(arguments,1))},Y.partialRight=function(n){return ft(n,32,null,$e.call(arguments,1))
|
||||
},Y.pick=function(n,t,e){var r={};if(typeof t!="function")for(var u=-1,o=rt(arguments,!0,!1,1),a=bt(n)?o.length:0;++u<a;){var i=o[u];i in n&&(r[i]=n[i])}else t=Y.createCallback(t,e,3),d(n,function(n,e,u){t(n,e,u)&&(r[e]=n)});return r},Y.pluck=Rt,Y.pull=function(n){for(var t=arguments,e=0,r=t.length,u=n?n.length:0;++e<r;)for(var o=-1,a=t[e];++o<u;)n[o]===a&&(we.call(n,o--,1),u--);return n},Y.range=function(n,t,e){n=+n||0,e=typeof e=="number"?e:+e||1,null==t&&(t=n,n=0);var r=-1;t=Re(0,pe((t-n)/(e||1)));
|
||||
for(var u=Xt(t);++r<t;)u[r]=n,n+=e;return u},Y.reject=function(n,t,e){return t=Y.createCallback(t,e,3),Ct(n,function(n,e,r){return!t(n,e,r)})},Y.remove=function(n,t,e){var r=-1,u=n?n.length:0,o=[];for(t=Y.createCallback(t,e,3);++r<u;)e=n[r],t(e,r,n)&&(o.push(e),we.call(n,r--,1),u--);return o},Y.rest=qt,Y.shuffle=Bt,Y.sortBy=function(n,t,e){var r=-1,o=n?n.length:0,a=Xt(typeof o=="number"?o:0);for(t=Y.createCallback(t,e,3),It(n,function(n,e,u){var o=a[++r]=f();o.m=t(n,e,u),o.n=r,o.o=n}),o=a.length,a.sort(u);o--;)n=a[o],a[o]=n.o,p(n);
|
||||
return a},Y.tap=function(n,t){return t(n),n},Y.throttle=function(n,t,e){var r=!0,u=!0;if(!_t(n))throw new ae;return false===e?r=!1:bt(e)&&(r="leading"in e?e.leading:r,u="trailing"in e?e.trailing:u),M.leading=r,M.maxWait=t,M.trailing=u,Ut(n,t,M)},Y.times=function(n,t,e){n=-1<(n=+n)?n:0;var r=-1,u=Xt(n);for(t=et(t,e,1);++r<n;)u[r]=t(r);return u},Y.toArray=function(n){return n&&typeof n.length=="number"?s(n):jt(n)},Y.transform=function(n,t,e,r){var u=Pe(n);return t=et(t,r,4),null==e&&(u?e=[]:(r=n&&n.constructor,e=lt(r&&r.prototype))),(u?It:y)(n,function(n,r,u){return t(e,n,r,u)
|
||||
}),e},Y.union=function(){return at(rt(arguments,!0,!0))},Y.uniq=Pt,Y.values=jt,Y.where=Ct,Y.without=function(n){return Ft(n,$e.call(arguments,1))},Y.wrap=function(n,t){if(!_t(t))throw new ae;return function(){var e=[n];return _e.apply(e,arguments),t.apply(this,e)}},Y.zip=Kt,Y.zipObject=Lt,Y.collect=Et,Y.drop=qt,Y.each=It,Y.b=Nt,Y.extend=J,Y.methods=yt,Y.object=Lt,Y.select=Ct,Y.tail=qt,Y.unique=Pt,Y.unzip=Kt,Ht(Y),Y.clone=function(n,t,e,r){return typeof t!="boolean"&&null!=t&&(r=e,e=t,t=!1),tt(n,t,typeof e=="function"&&et(e,r,1))
|
||||
},Y.cloneDeep=function(n,t,e){return tt(n,!0,typeof t=="function"&&et(t,e,1))},Y.contains=kt,Y.escape=function(n){return null==n?"":oe(n).replace(Ve,ct)},Y.every=xt,Y.find=Ot,Y.findIndex=function(n,t,e){var r=-1,u=n?n.length:0;for(t=Y.createCallback(t,e,3);++r<u;)if(t(n[r],r,n))return r;return-1},Y.findKey=function(n,t,e){var r;return t=Y.createCallback(t,e,3),y(n,function(n,e,u){return t(n,e,u)?(r=e,!1):void 0}),r},Y.findLast=function(n,t,e){var r;return t=Y.createCallback(t,e,3),Nt(n,function(n,e,u){return t(n,e,u)?(r=n,!1):void 0
|
||||
}),r},Y.findLastIndex=function(n,t,e){var r=n?n.length:0;for(t=Y.createCallback(t,e,3);r--;)if(t(n[r],r,n))return r;return-1},Y.findLastKey=function(n,t,e){var r;return t=Y.createCallback(t,e,3),gt(n,function(n,e,u){return t(n,e,u)?(r=e,!1):void 0}),r},Y.has=function(n,t){return n?ye.call(n,t):!1},Y.identity=Gt,Y.indexOf=Wt,Y.isArguments=ht,Y.isArray=Pe,Y.isBoolean=function(n){return true===n||false===n||je.call(n)==F},Y.isDate=function(n){return n?typeof n=="object"&&je.call(n)==T:!1},Y.isElement=function(n){return n?1===n.nodeType:!1
|
||||
},Y.isEmpty=function(n){var t=!0;if(!n)return t;var e=je.call(n),r=n.length;return e==$||e==K||e==B||e==z&&typeof r=="number"&&_t(n.splice)?!r:(y(n,function(){return t=!1}),t)},Y.isEqual=function(n,t,e,r){return ut(n,t,typeof e=="function"&&et(e,r,2))},Y.isFinite=function(n){return Ne(n)&&!Ee(parseFloat(n))},Y.isFunction=_t,Y.isNaN=function(n){return dt(n)&&n!=+n},Y.isNull=function(n){return null===n},Y.isNumber=dt,Y.isObject=bt,Y.isPlainObject=g,Y.isRegExp=function(n){return n?typeof n=="object"&&je.call(n)==P:!1
|
||||
},Y.isString=wt,Y.isUndefined=function(n){return typeof n=="undefined"},Y.lastIndexOf=function(n,t,e){var r=n?n.length:0;for(typeof e=="number"&&(r=(0>e?Re(0,r+e):Ae(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},Y.mixin=Ht,Y.noConflict=function(){return e._=le,this},Y.parseInt=Qe,Y.random=Jt,Y.reduce=At,Y.reduceRight=Dt,Y.result=function(n,t){if(n){var e=n[t];return _t(e)?n[t]():e}},Y.runInContext=v,Y.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Ke(n).length},Y.some=$t,Y.sortedIndex=zt,Y.template=function(n,t,e){var r=Y.templateSettings;
|
||||
n||(n=""),e=G({},e,r);var u,o=G({},e.imports,r.imports),r=Ke(o),o=jt(o),i=0,f=e.interpolate||S,l="__p+='",f=ue((e.escape||S).source+"|"+f.source+"|"+(f===N?C:S).source+"|"+(e.evaluate||S).source+"|$","g");n.replace(f,function(t,e,r,o,f,c){return r||(r=o),l+=n.slice(i,c).replace(A,a),e&&(l+="'+__e("+e+")+'"),f&&(u=!0,l+="';"+f+";__p+='"),r&&(l+="'+((__t=("+r+"))==null?'':__t)+'"),i=c+t.length,t}),l+="';\n",f=e=e.variable,f||(e="obj",l="with("+e+"){"+l+"}"),l=(u?l.replace(j,""):l).replace(k,"$1").replace(x,"$1;"),l="function("+e+"){"+(f?"":e+"||("+e+"={});")+"var __t,__p='',__e=_.escape"+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}";
|
||||
try{var c=ne(r,"return "+l).apply(h,o)}catch(p){throw p.source=l,p}return t?c(t):(c.source=l,c)},Y.unescape=function(n){return null==n?"":oe(n).replace(Ue,vt)},Y.uniqueId=function(n){var t=++m;return oe(null==n?"":n)+t},Y.all=xt,Y.any=$t,Y.detect=Ot,Y.findWhere=Ot,Y.foldl=At,Y.foldr=Dt,Y.include=kt,Y.inject=At,y(Y,function(n,t){Y.prototype[t]||(Y.prototype[t]=function(){var t=[this.__wrapped__],e=this.__chain__;return _e.apply(t,arguments),t=n.apply(Y,t),e?new nt(t,e):t})}),Y.first=Tt,Y.last=function(n,t,e){var r=0,u=n?n.length:0;
|
||||
if(typeof t!="number"&&null!=t){var o=u;for(t=Y.createCallback(t,e,3);o--&&t(n[o],o,n);)r++}else if(r=t,null==r||e)return n?n[u-1]:h;return s(n,Re(0,u-r))},Y.sample=function(n,t,e){var r=n?n.length:0;return typeof r!="number"&&(n=jt(n)),null==t||e?n?n[Jt(r-1)]:h:(n=Bt(n),n.length=Ae(Re(0,t),n.length),n)},Y.take=Tt,Y.head=Tt,y(Y,function(n,t){var e="sample"!==t;Y.prototype[t]||(Y.prototype[t]=function(t,r){var u=this.__chain__,o=n(this.__wrapped__,t,r);return u||null!=t&&(!r||e&&typeof t=="function")?new nt(o,u):o
|
||||
})}),Y.VERSION="2.2.1",Y.prototype.chain=function(){return this.__chain__=!0,this},Y.prototype.toString=function(){return oe(this.__wrapped__)},Y.prototype.value=Qt,Y.prototype.valueOf=Qt,It(["join","pop","shift"],function(n){var t=ie[n];Y.prototype[n]=function(){var n=this.__chain__,e=t.apply(this.__wrapped__,arguments);return n?new nt(e,n):e}}),It(["push","reverse","sort","unshift"],function(n){var t=ie[n];Y.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),It(["concat","slice","splice"],function(n){var t=ie[n];
|
||||
Y.prototype[n]=function(){return new nt(t.apply(this.__wrapped__,arguments),this.__chain__)}}),Y}var h,g=[],y=[],m=0,_=+new Date+"",b=75,d=40,w=" \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",j=/\b__p\+='';/g,k=/\b(__p\+=)''\+/g,x=/(__e\(.*?\)|\b__t\))\+'';/g,C=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,O=/\w*$/,I=/^function[ \n\r\t]+\w/,N=/<%=([\s\S]+?)%>/g,E=RegExp("^["+w+"]*0+(?=.$)"),S=/($^)/,R=/\bthis\b/,A=/['\n\r\t\u2028\u2029\\]/g,D="Array Boolean Date Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),B="[object Arguments]",$="[object Array]",F="[object Boolean]",T="[object Date]",W="[object Function]",q="[object Number]",z="[object Object]",P="[object RegExp]",K="[object String]",L={};
|
||||
L[W]=!1,L[B]=L[$]=L[F]=L[T]=L[q]=L[z]=L[P]=L[K]=!0;var M={leading:!1,maxWait:0,trailing:!1},U={configurable:!1,enumerable:!1,value:null,writable:!1},V={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},G={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},H=V[typeof window]&&window||this,J=V[typeof exports]&&exports&&!exports.nodeType&&exports,Q=V[typeof module]&&module&&!module.nodeType&&module,X=Q&&Q.exports===J&&J,Y=V[typeof global]&&global;!Y||Y.global!==Y&&Y.window!==Y||(H=Y);
|
||||
var Z=v();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(H._=Z, define(function(){return Z})):J&&Q?X?(Q.exports=Z)._=Z:J._=Z:H._=Z}).call(this);
|
||||
4779
dist/lodash.underscore.js
vendored
4779
dist/lodash.underscore.js
vendored
File diff suppressed because it is too large
Load Diff
38
dist/lodash.underscore.min.js
vendored
38
dist/lodash.underscore.min.js
vendored
@@ -1,38 +0,0 @@
|
||||
/**
|
||||
* @license
|
||||
* Lo-Dash 2.2.1 (Custom Build) lodash.com/license | Underscore.js 1.5.2 underscorejs.org/LICENSE
|
||||
* Build: `lodash underscore exports="amd,commonjs,global,node" -o ./dist/lodash.underscore.js`
|
||||
*/
|
||||
;(function(){function n(n,r,t){t=(t||0)-1;for(var e=n?n.length:0;++t<e;)if(n[t]===r)return t;return-1}function r(n,r){var t=n.m,e=r.m;if(t!==e){if(t>e||typeof t=="undefined")return 1;if(t<e||typeof e=="undefined")return-1}return n.n-r.n}function t(n){return"\\"+vr[n]}function e(){}function u(n){return n instanceof u?n:new o(n)}function o(n,r){this.__chain__=!!r,this.__wrapped__=n}function i(n,r,t){if(typeof n!="function")return Q;if(typeof r=="undefined")return n;switch(t){case 1:return function(t){return n.call(r,t)
|
||||
};case 2:return function(t,e){return n.call(r,t,e)};case 3:return function(t,e,u){return n.call(r,t,e,u)};case 4:return function(t,e,u,o){return n.call(r,t,e,u,o)}}return J(n,r)}function f(n,r,t,e){e=(e||0)-1;for(var u=n?n.length:0,o=[];++e<u;){var i=n[e];if(i&&typeof i=="object"&&typeof i.length=="number"&&(Vr(i)||y(i))){r||(i=f(i,r,t));var a=-1,l=i.length,c=o.length;for(o.length+=l;++a<l;)o[c++]=i[a]}else t||o.push(i)}return o}function a(n,r,t,e){if(n===r)return 0!==n||1/n==1/r;if(n===n&&!(n&&hr[typeof n]||r&&hr[typeof r]))return!1;
|
||||
if(null==n||null==r)return n===r;var o=Br.call(n),i=Br.call(r);if(o!=i)return!1;switch(o){case fr:case ar:return+n==+r;case lr:return n!=+n?r!=+r:0==n?1/n==1/r:n==+r;case pr:case sr:return n==r+""}if(i=o==ir,!i){if(Ar.call(n,"__wrapped__")||r instanceof u)return a(n.__wrapped__||n,r.__wrapped__||r,t,e);if(o!=cr)return!1;var o=n.constructor,f=r.constructor;if(o!=f&&!(j(o)&&o instanceof o&&j(f)&&f instanceof f))return!1}for(t||(t=[]),e||(e=[]),o=t.length;o--;)if(t[o]==n)return e[o]==r;var l=!0,c=0;
|
||||
if(t.push(n),e.push(r),i){if(c=r.length,l=c==n.length)for(;c--&&(l=a(n[c],r[c],t,e)););return l}return Xr(r,function(r,u,o){return Ar.call(o,u)?(c++,!(l=Ar.call(n,u)&&a(n[u],r,t,e))&&rr):void 0}),l&&Xr(n,function(n,r,t){return Ar.call(t,r)?!(l=-1<--c)&&rr:void 0}),l}function l(n,r,t){for(var e=-1,u=v(),o=n?n.length:0,i=[],f=t?[]:i;++e<o;){var a=n[e],l=t?t(a,e,n):a;(r?!e||f[f.length-1]!==l:0>u(f,l))&&(t&&f.push(l),i.push(a))}return i}function c(n){return function(r,t,e){var u={};t=K(t,e,3),e=-1;var o=r?r.length:0;
|
||||
if(typeof o=="number")for(;++e<o;){var i=r[e];n(u,i,t(i,e,r),r)}else Yr(r,function(r,e,o){n(u,r,t(r,e,o),o)});return u}}function p(n,r,t,e,u,o){var i=1&r,f=2&r,a=4&r,l=8&r,c=16&r,h=32&r,v=n;if(!f&&!j(n))throw new TypeError;if(c&&!t.length&&(r&=-17,c=t=!1),h&&!e.length&&(r&=-33,h=e=!1),!i||f||a||h||!(Ur.fastBind||Rr&&c))y=function(){var g=arguments,m=i?u:this;return(a||c||h)&&(g=zr.call(g),c&&Nr.apply(g,t),h&&Sr.apply(g,e),a&&g.length<o)?(r|=16,p(n,l?r:-4&r,g,null,u,o)):(f&&(n=m[v]),this instanceof y?(m=s(n.prototype),g=n.apply(m,g),x(g)?g:m):n.apply(m,g))
|
||||
};else{if(c){var g=[u];Sr.apply(g,t)}var y=c?Rr.apply(n,g):Rr.call(n,u)}return y}function s(n){return x(n)?kr(n):{}}function h(n){return Jr[n]}function v(){var r=(r=u.indexOf)===U?n:r;return r}function g(n){return Kr[n]}function y(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Br.call(n)==or||!1}function m(n){if(!n)return n;for(var r=1,t=arguments.length;r<t;r++){var e=arguments[r];if(e)for(var u in e)n[u]=e[u]}return n}function _(n){if(!n)return n;for(var r=1,t=arguments.length;r<t;r++){var e=arguments[r];
|
||||
if(e)for(var u in e)"undefined"==typeof n[u]&&(n[u]=e[u])}return n}function d(n){var r=[];return Xr(n,function(n,t){j(n)&&r.push(t)}),r.sort()}function b(n){for(var r=-1,t=Hr(n),e=t.length,u={};++r<e;){var o=t[r];u[n[o]]=o}return u}function w(n){if(!n)return!0;if(Vr(n)||T(n))return!n.length;for(var r in n)if(Ar.call(n,r))return!1;return!0}function j(n){return typeof n=="function"}function x(n){return!(!n||!hr[typeof n])}function E(n){return typeof n=="number"||Br.call(n)==lr}function T(n){return typeof n=="string"||Br.call(n)==sr
|
||||
}function A(n){for(var r=-1,t=Hr(n),e=t.length,u=Array(e);++r<e;)u[r]=n[t[r]];return u}function O(n,r){var t=v(),e=n?n.length:0,u=!1;return e&&typeof e=="number"?u=-1<t(n,r):Yr(n,function(n){return(u=n===r)&&rr}),u}function S(n,r,t){var e=!0;r=K(r,t,3),t=-1;var u=n?n.length:0;if(typeof u=="number")for(;++t<u&&(e=!!r(n[t],t,n)););else Yr(n,function(n,t,u){return!(e=!!r(n,t,u))&&rr});return e}function B(n,r,t){var e=[];r=K(r,t,3),t=-1;var u=n?n.length:0;if(typeof u=="number")for(;++t<u;){var o=n[t];
|
||||
r(o,t,n)&&e.push(o)}else Yr(n,function(n,t,u){r(n,t,u)&&e.push(n)});return e}function N(n,r,t){r=K(r,t,3),t=-1;var e=n?n.length:0;if(typeof e!="number"){var u;return Yr(n,function(n,t,e){return r(n,t,e)?(u=n,rr):void 0}),u}for(;++t<e;){var o=n[t];if(r(o,t,n))return o}}function R(n,r,t){var e=-1,u=n?n.length:0;if(r=r&&typeof t=="undefined"?r:i(r,t,3),typeof u=="number")for(;++e<u&&r(n[e],e,n)!==rr;);else Yr(n,r)}function k(n,r){var t=n?n.length:0;if(typeof t=="number")for(;t--&&false!==r(n[t],t,n););else{var e=Hr(n),t=e.length;
|
||||
Yr(n,function(n,u,o){return u=e?e[--t]:--t,false===r(o[u],u,o)&&rr})}}function F(n,r,t){var e=-1,u=n?n.length:0;if(r=K(r,t,3),typeof u=="number")for(var o=Array(u);++e<u;)o[e]=r(n[e],e,n);else o=[],Yr(n,function(n,t,u){o[++e]=r(n,t,u)});return o}function q(n,r,t){var e=-1/0,u=e,o=-1,i=n?n.length:0;if(r||typeof i!="number")r=K(r,t,3),R(n,function(n,t,o){t=r(n,t,o),t>e&&(e=t,u=n)});else for(;++o<i;)t=n[o],t>u&&(u=t);return u}function D(n,r){var t=-1,e=n?n.length:0;if(typeof e=="number")for(var u=Array(e);++t<e;)u[t]=n[t][r];
|
||||
return u||F(n,r)}function M(n,r,t,e){if(!n)return t;var u=3>arguments.length;r=i(r,e,4);var o=-1,f=n.length;if(typeof f=="number")for(u&&(t=n[++o]);++o<f;)t=r(t,n[o],o,n);else Yr(n,function(n,e,o){t=u?(u=!1,n):r(t,n,e,o)});return t}function $(n,r,t,e){var u=3>arguments.length;return r=i(r,e,4),k(n,function(n,e,o){t=u?(u=!1,n):r(t,n,e,o)}),t}function I(n){var r=-1,t=n?n.length:0,e=Array(typeof t=="number"?t:0);return R(n,function(n){var t=Y(++r);e[r]=e[t],e[t]=n}),e}function W(n,r,t){var e;r=K(r,t,3),t=-1;
|
||||
var u=n?n.length:0;if(typeof u=="number")for(;++t<u&&!(e=r(n[t],t,n)););else Yr(n,function(n,t,u){return(e=r(n,t,u))&&rr});return!!e}function z(n,r,t){return t&&w(r)?Z:(t?N:B)(n,r)}function C(n){for(var r=-1,t=v(),e=n.length,u=f(arguments,!0,!0,1),o=[];++r<e;){var i=n[r];0>t(u,i)&&o.push(i)}return o}function P(n,r,t){var e=0,u=n?n.length:0;if(typeof r!="number"&&null!=r){var o=-1;for(r=K(r,t,3);++o<u&&r(n[o],o,n);)e++}else if(e=r,null==e||t)return n?n[0]:Z;return zr.call(n,0,Ir($r(0,e),u))}function U(r,t,e){if(typeof e=="number"){var u=r?r.length:0;
|
||||
e=0>e?$r(0,u+e):e||0}else if(e)return e=G(r,t),r[e]===t?e:-1;return n(r,t,e)}function V(n,r,t){if(typeof r!="number"&&null!=r){var e=0,u=-1,o=n?n.length:0;for(r=K(r,t,3);++u<o&&r(n[u],u,n);)e++}else e=null==r||t?1:$r(0,r);return zr.call(n,e)}function G(n,r,t,e){var u=0,o=n?n.length:u;for(t=t?K(t,e,1):Q,r=t(r);u<o;)e=u+o>>>1,t(n[e])<r?u=e+1:o=e;return u}function H(n,r,t,e){return typeof r!="boolean"&&null!=r&&(t=(e=t)&&e[r]===n?null:r,r=!1),null!=t&&(t=K(t,e,3)),l(n,r,t)}function J(n,r){return 2<arguments.length?p(n,17,zr.call(arguments,2),null,r):p(n,1,null,null,r)
|
||||
}function K(n,r,t){var e=typeof n;if(null==n||"function"==e)return i(n,r,t);if("object"!=e)return function(r){return r[n]};var u=Hr(n);return function(r){for(var t=u.length,e=!1;t--&&(e=r[u[t]]===n[u[t]]););return e}}function L(n,r,t){var e,u,o,i,f,a,l,c=0,p=!1,s=!0;if(!j(n))throw new TypeError;if(r=$r(0,r)||0,true===t)var h=!0,s=!1;else x(t)&&(h=t.leading,p="maxWait"in t&&($r(r,t.maxWait)||0),s="trailing"in t?t.trailing:s);var v=function(){var t=r-(Or()-i);0<t?a=setTimeout(v,t):(u&&clearTimeout(u),t=l,u=a=l=Z,t&&(c=Or(),o=n.apply(f,e)))
|
||||
},g=function(){a&&clearTimeout(a),u=a=l=Z,(s||p!==r)&&(c=Or(),o=n.apply(f,e))};return function(){if(e=arguments,i=Or(),f=this,l=s&&(a||!h),false===p)var t=h&&!a;else{u||h||(c=i);var y=p-(i-c);0<y?u||(u=setTimeout(g,y)):(u&&(u=clearTimeout(u)),c=i,o=n.apply(f,e))}return a||r===p||(a=setTimeout(v,r)),t&&(o=n.apply(f,e)),o}}function Q(n){return n}function X(n){R(d(n),function(r){var t=u[r]=n[r];u.prototype[r]=function(){var n=[this.__wrapped__];return Sr.apply(n,arguments),n=t.apply(u,n),this.__chain__?new o(n,!0):n
|
||||
}})}function Y(n,r){return null==n&&null==r&&(r=1),n=+n||0,null==r?(r=n,n=0):r=+r||0,n+Tr(Wr()*(r-n+1))}var Z,nr=0,rr={},tr=+new Date+"",er=/($^)/,ur=/['\n\r\t\u2028\u2029\\]/g,or="[object Arguments]",ir="[object Array]",fr="[object Boolean]",ar="[object Date]",lr="[object Number]",cr="[object Object]",pr="[object RegExp]",sr="[object String]",hr={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},vr={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},gr=hr[typeof window]&&window||this,yr=hr[typeof exports]&&exports&&!exports.nodeType&&exports,mr=hr[typeof module]&&module&&!module.nodeType&&module,_r=mr&&mr.exports===yr&&yr,dr=hr[typeof global]&&global;
|
||||
!dr||dr.global!==dr&&dr.window!==dr||(gr=dr);var br=[],wr=Object.prototype,jr=gr._,xr=RegExp("^"+(wr.valueOf+"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),Er=Math.ceil,Tr=Math.floor,Ar=wr.hasOwnProperty,Or=xr.test(Or=Date.now)&&Or||function(){return+new Date},Sr=br.push,Br=wr.toString,Nr=br.unshift,Rr=xr.test(Rr=Br.bind)&&Rr,kr=xr.test(kr=Object.create)&&kr,Fr=xr.test(Fr=Array.isArray)&&Fr,qr=gr.isFinite,Dr=gr.isNaN,Mr=xr.test(Mr=Object.keys)&&Mr,$r=Math.max,Ir=Math.min,Wr=Math.random,zr=br.slice,Cr=xr.test(gr.attachEvent),Pr=Rr&&!/\n|true/.test(Rr+Cr);
|
||||
o.prototype=u.prototype;var Ur={};!function(){var n={0:1,length:1};Ur.fastBind=Rr&&!Pr,Ur.spliceObjects=(br.splice.call(n,0,1),!n[0])}(1),u.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},kr||(s=function(n){if(x(n)){e.prototype=n;var r=new e;e.prototype=null}return r||{}}),y(arguments)||(y=function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Ar.call(n,"callee")||!1});var Vr=Fr||function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Br.call(n)==ir||!1
|
||||
},Gr=function(n){var r,t=[];if(!n||!hr[typeof n])return t;for(r in n)Ar.call(n,r)&&t.push(r);return t},Hr=Mr?function(n){return x(n)?Mr(n):[]}:Gr,Jr={"&":"&","<":"<",">":">",'"':""","'":"'"},Kr=b(Jr),Lr=RegExp("("+Hr(Kr).join("|")+")","g"),Qr=RegExp("["+Hr(Jr).join("")+"]","g"),Xr=function(n,r){var t;if(!n||!hr[typeof n])return n;for(t in n)if(r(n[t],t,n)===rr)break;return n},Yr=function(n,r){var t;if(!n||!hr[typeof n])return n;for(t in n)if(Ar.call(n,t)&&r(n[t],t,n)===rr)break;
|
||||
return n};j(/x/)&&(j=function(n){return typeof n=="function"&&"[object Function]"==Br.call(n)});var Zr=c(function(n,r,t){Ar.call(n,t)?n[t]++:n[t]=1}),nt=c(function(n,r,t){(Ar.call(n,t)?n[t]:n[t]=[]).push(r)}),rt=c(function(n,r,t){n[t]=r});u.after=function(n,r){if(!j(r))throw new TypeError;return function(){return 1>--n?r.apply(this,arguments):void 0}},u.bind=J,u.bindAll=function(n){for(var r=1<arguments.length?f(arguments,!0,!1,1):d(n),t=-1,e=r.length;++t<e;){var u=r[t];n[u]=p(n[u],1,null,null,n)}return n
|
||||
},u.chain=function(n){return n=new o(n),n.__chain__=!0,n},u.compact=function(n){for(var r=-1,t=n?n.length:0,e=[];++r<t;){var u=n[r];u&&e.push(u)}return e},u.compose=function(){for(var n=arguments,r=n.length;r--;)if(!j(n[r]))throw new TypeError;return function(){for(var r=arguments,t=n.length;t--;)r=[n[t].apply(this,r)];return r[0]}},u.countBy=Zr,u.debounce=L,u.defaults=_,u.defer=function(n){if(!j(n))throw new TypeError;var r=zr.call(arguments,1);return setTimeout(function(){n.apply(Z,r)},1)},u.delay=function(n,r){if(!j(n))throw new TypeError;
|
||||
var t=zr.call(arguments,2);return setTimeout(function(){n.apply(Z,t)},r)},u.difference=C,u.filter=B,u.flatten=function(n,r){return f(n,r)},u.forEach=R,u.functions=d,u.groupBy=nt,u.indexBy=rt,u.initial=function(n,r,t){var e=0,u=n?n.length:0;if(typeof r!="number"&&null!=r){var o=u;for(r=K(r,t,3);o--&&r(n[o],o,n);)e++}else e=null==r||t?1:r||e;return zr.call(n,0,Ir($r(0,u-e),u))},u.intersection=function(n){var r=arguments,t=r.length,e=-1,u=v(),o=n?n.length:0,i=[];n:for(;++e<o;){var f=n[e];if(0>u(i,f)){for(var a=t;--a;)if(0>u(r[a],f))continue n;
|
||||
i.push(f)}}return i},u.invert=b,u.invoke=function(n,r){var t=zr.call(arguments,2),e=-1,u=typeof r=="function",o=n?n.length:0,i=Array(typeof o=="number"?o:0);return R(n,function(n){i[++e]=(u?r:n[r]).apply(n,t)}),i},u.keys=Hr,u.map=F,u.max=q,u.memoize=function(n,r){var t={};return function(){var e=r?r.apply(this,arguments):tr+arguments[0];return Ar.call(t,e)?t[e]:t[e]=n.apply(this,arguments)}},u.min=function(n,r,t){var e=1/0,u=e,o=-1,i=n?n.length:0;if(r||typeof i!="number")r=K(r,t,3),R(n,function(n,t,o){t=r(n,t,o),t<e&&(e=t,u=n)
|
||||
});else for(;++o<i;)t=n[o],t<u&&(u=t);return u},u.omit=function(n){var r=v(),t=f(arguments,!0,!1,1),e={};return Xr(n,function(n,u){0>r(t,u)&&(e[u]=n)}),e},u.once=function(n){var r,t;if(!j(n))throw new TypeError;return function(){return r?t:(r=!0,t=n.apply(this,arguments),n=null,t)}},u.pairs=function(n){for(var r=-1,t=Hr(n),e=t.length,u=Array(e);++r<e;){var o=t[r];u[r]=[o,n[o]]}return u},u.partial=function(n){return p(n,16,zr.call(arguments,1))},u.pick=function(n){for(var r=-1,t=f(arguments,!0,!1,1),e=t.length,u={};++r<e;){var o=t[r];
|
||||
o in n&&(u[o]=n[o])}return u},u.pluck=D,u.range=function(n,r,t){n=+n||0,t=+t||1,null==r&&(r=n,n=0);var e=-1;r=$r(0,Er((r-n)/t));for(var u=Array(r);++e<r;)u[e]=n,n+=t;return u},u.reject=function(n,r,t){return r=K(r,t,3),B(n,function(n,t,e){return!r(n,t,e)})},u.rest=V,u.shuffle=I,u.sortBy=function(n,t,e){var u=-1,o=n?n.length:0,i=Array(typeof o=="number"?o:0);for(t=K(t,e,3),R(n,function(n,r,e){i[++u]={m:t(n,r,e),n:u,o:n}}),o=i.length,i.sort(r);o--;)i[o]=i[o].o;return i},u.tap=function(n,r){return r(n),n
|
||||
},u.throttle=function(n,r,t){var e=!0,u=!0;if(!j(n))throw new TypeError;return false===t?e=!1:x(t)&&(e="leading"in t?t.leading:e,u="trailing"in t?t.trailing:u),t={},t.leading=e,t.maxWait=r,t.trailing=u,L(n,r,t)},u.times=function(n,r,t){n=-1<(n=+n)?n:0;var e=-1,u=Array(n);for(r=i(r,t,1);++e<n;)u[e]=r(e);return u},u.toArray=function(n){return Vr(n)?zr.call(n):n&&typeof n.length=="number"?F(n):A(n)},u.union=function(){return l(f(arguments,!0,!0))},u.uniq=H,u.values=A,u.where=z,u.without=function(n){return C(n,zr.call(arguments,1))
|
||||
},u.wrap=function(n,r){if(!j(r))throw new TypeError;return function(){var t=[n];return Sr.apply(t,arguments),r.apply(this,t)}},u.zip=function(){for(var n=-1,r=q(D(arguments,"length")),t=Array(0>r?0:r);++n<r;)t[n]=D(arguments,n);return t},u.collect=F,u.drop=V,u.each=R,u.extend=m,u.methods=d,u.object=function(n,r){for(var t=-1,e=n?n.length:0,u={};++t<e;){var o=n[t];r?u[o]=r[t]:o&&(u[o[0]]=o[1])}return u},u.select=B,u.tail=V,u.unique=H,u.clone=function(n){return x(n)?Vr(n)?zr.call(n):m({},n):n},u.contains=O,u.escape=function(n){return null==n?"":(n+"").replace(Qr,h)
|
||||
},u.every=S,u.find=N,u.has=function(n,r){return n?Ar.call(n,r):!1},u.identity=Q,u.indexOf=U,u.isArguments=y,u.isArray=Vr,u.isBoolean=function(n){return true===n||false===n||Br.call(n)==fr},u.isDate=function(n){return n?typeof n=="object"&&Br.call(n)==ar:!1},u.isElement=function(n){return n?1===n.nodeType:!1},u.isEmpty=w,u.isEqual=function(n,r){return a(n,r)},u.isFinite=function(n){return qr(n)&&!Dr(parseFloat(n))},u.isFunction=j,u.isNaN=function(n){return E(n)&&n!=+n},u.isNull=function(n){return null===n
|
||||
},u.isNumber=E,u.isObject=x,u.isRegExp=function(n){return n&&hr[typeof n]?Br.call(n)==pr:!1},u.isString=T,u.isUndefined=function(n){return typeof n=="undefined"},u.lastIndexOf=function(n,r,t){var e=n?n.length:0;for(typeof t=="number"&&(e=(0>t?$r(0,e+t):Ir(t,e-1))+1);e--;)if(n[e]===r)return e;return-1},u.mixin=X,u.noConflict=function(){return gr._=jr,this},u.random=Y,u.reduce=M,u.reduceRight=$,u.result=function(n,r){if(n){var t=n[r];return j(t)?n[r]():t}},u.size=function(n){var r=n?n.length:0;return typeof r=="number"?r:Hr(n).length
|
||||
},u.some=W,u.sortedIndex=G,u.template=function(n,r,e){var o=u,i=o.templateSettings;n||(n=""),e=_({},e,i);var f=0,a="__p+='",i=e.variable;n.replace(RegExp((e.escape||er).source+"|"+(e.interpolate||er).source+"|"+(e.evaluate||er).source+"|$","g"),function(r,e,u,o,i){return a+=n.slice(f,i).replace(ur,t),e&&(a+="'+_.escape("+e+")+'"),o&&(a+="';"+o+";__p+='"),u&&(a+="'+((__t=("+u+"))==null?'':__t)+'"),f=i+r.length,r}),a+="';\n",i||(i="obj",a="with("+i+"||{}){"+a+"}"),a="function("+i+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+a+"return __p}";
|
||||
try{var l=Function("_","return "+a)(o)}catch(c){throw c.source=a,c}return r?l(r):(l.source=a,l)},u.unescape=function(n){return null==n?"":(n+"").replace(Lr,g)},u.uniqueId=function(n){var r=++nr+"";return n?n+r:r},u.all=S,u.any=W,u.detect=N,u.findWhere=function(n,r){return z(n,r,!0)},u.foldl=M,u.foldr=$,u.include=O,u.inject=M,u.first=P,u.last=function(n,r,t){var e=0,u=n?n.length:0;if(typeof r!="number"&&null!=r){var o=u;for(r=K(r,t,3);o--&&r(n[o],o,n);)e++}else if(e=r,null==e||t)return n?n[u-1]:Z;
|
||||
return zr.call(n,$r(0,u-e))},u.sample=function(n,r,t){var e=n?n.length:0;return typeof e!="number"&&(n=A(n)),null==r||t?n?n[Y(e-1)]:Z:(n=I(n),n.length=Ir($r(0,r),n.length),n)},u.take=P,u.head=P,X(u),u.VERSION="2.2.1",u.prototype.chain=function(){return this.__chain__=!0,this},u.prototype.value=function(){return this.__wrapped__},R("pop push reverse shift sort splice unshift".split(" "),function(n){var r=br[n];u.prototype[n]=function(){var n=this.__wrapped__;return r.apply(n,arguments),Ur.spliceObjects||0!==n.length||delete n[0],this
|
||||
}}),R(["concat","join","slice"],function(n){var r=br[n];u.prototype[n]=function(){var n=r.apply(this.__wrapped__,arguments);return this.__chain__&&(n=new o(n),n.__chain__=!0),n}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(gr._=u, define(function(){return u})):yr&&mr?_r?(mr.exports=u)._=u:yr._=u:gr._=u}).call(this);
|
||||
8059
doc/README.md
8059
doc/README.md
File diff suppressed because it is too large
Load Diff
@@ -1,38 +0,0 @@
|
||||
<?php
|
||||
|
||||
// cleanup requested file path
|
||||
$filePath = isset($_GET['f']) ? $_GET['f'] : 'lodash';
|
||||
$filePath = preg_replace('#(\.*[\/])+#', '', $filePath);
|
||||
$filePath .= preg_match('/\.[a-z]+$/', $filePath) ? '' : '.js';
|
||||
|
||||
// output filename
|
||||
if (isset($_GET['o'])) {
|
||||
$outputName = $_GET['o'];
|
||||
} else if (isset($_SERVER['argv'][1])) {
|
||||
$outputName = $_SERVER['argv'][1];
|
||||
} else {
|
||||
$outputName = basename($filePath);
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
require('../vendor/docdown/docdown.php');
|
||||
|
||||
// get package version
|
||||
$version = json_decode(file_get_contents('../package.json'))->version;
|
||||
|
||||
// generate Markdown
|
||||
$markdown = docdown(array(
|
||||
'path' => '../' . $filePath,
|
||||
'title' => 'Lo-Dash <span>v' . $version . '</span>',
|
||||
'toc' => 'categories',
|
||||
'url' => 'https://github.com/lodash/lodash/blob/master/lodash.js'
|
||||
));
|
||||
|
||||
// save to a `.md` file
|
||||
file_put_contents($outputName . '.md', $markdown);
|
||||
|
||||
// print
|
||||
header('Content-Type: text/plain;charset=utf-8');
|
||||
echo $markdown . PHP_EOL;
|
||||
?>
|
||||
88
lodash.min.js
vendored
Normal file
88
lodash.min.js
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
/**
|
||||
* @license
|
||||
* lodash 3.3.0 (Custom Build) lodash.com/license | Underscore.js 1.7.0 underscorejs.org/LICENSE
|
||||
* Build: `lodash modern -o ./lodash.js`
|
||||
*/
|
||||
;(function(){function n(n,t){if(n!==t){var r=n===n,e=t===t;if(n>t||!r||typeof n=="undefined"&&e)return 1;if(n<t||!e||typeof t=="undefined"&&r)return-1}return 0}function t(n,t,r){if(t!==t)return h(n,r);r=(r||0)-1;for(var e=n.length;++r<e;)if(n[r]===t)return r;return-1}function r(n){return typeof n=="function"||false}function e(n,t){var r=n.length;for(n.sort(t);r--;)n[r]=n[r].c;return n}function u(n){return typeof n=="string"?n:null==n?"":n+""}function o(n){return n.charCodeAt(0)}function i(n,t){for(var r=-1,e=n.length;++r<e&&-1<t.indexOf(n.charAt(r)););return r
|
||||
}function f(n,t){for(var r=n.length;r--&&-1<t.indexOf(n.charAt(r)););return r}function a(t,r){return n(t.a,r.a)||t.b-r.b}function c(t,r){for(var e=-1,u=t.a,o=r.a,i=u.length;++e<i;){var f=n(u[e],o[e]);if(f)return f}return t.b-r.b}function l(n){return Nt[n]}function s(n){return Ut[n]}function p(n){return"\\"+$t[n]}function h(n,t,r){var e=n.length;for(t=r?t||e:(t||0)-1;r?t--:++t<e;){var u=n[t];if(u!==u)return t}return-1}function _(n){return n&&typeof n=="object"||false}function g(n){return 160>=n&&9<=n&&13>=n||32==n||160==n||5760==n||6158==n||8192<=n&&(8202>=n||8232==n||8233==n||8239==n||8287==n||12288==n||65279==n)
|
||||
}function v(n,t){for(var r=-1,e=n.length,u=-1,o=[];++r<e;)n[r]===t&&(n[r]=z,o[++u]=r);return o}function y(n){for(var t=-1,r=n.length;++t<r&&g(n.charCodeAt(t)););return t}function d(n){for(var t=n.length;t--&&g(n.charCodeAt(t)););return t}function m(n){return Ft[n]}function w(g){function Nt(n){if(_(n)&&!(Wo(n)||n instanceof Lt)){if(n instanceof Ft)return n;if(Fu.call(n,"__chain__")&&Fu.call(n,"__wrapped__"))return ge(n)}return new Ft(n)}function Ut(){}function Ft(n,t,r){this.__wrapped__=n,this.__actions__=r||[],this.__chain__=!!t
|
||||
}function Lt(n){this.__wrapped__=n,this.__actions__=null,this.__dir__=1,this.__dropCount__=0,this.__filtered__=false,this.__iteratees__=null,this.__takeCount__=po,this.__views__=null}function $t(){this.__data__={}}function zt(n){var t=n?n.length:0;for(this.data={hash:ro(null),set:new Gu};t--;)this.push(n[t])}function Dt(n,t){var r=n.data;return(typeof t=="string"||He(t)?r.set.has(t):r.hash[t])?0:-1}function qt(n,t){var r=-1,e=n.length;for(t||(t=bu(e));++r<e;)t[r]=n[r];return t}function Pt(n,t){for(var r=-1,e=n.length;++r<e&&false!==t(n[r],r,n););return n
|
||||
}function Kt(n,t){for(var r=-1,e=n.length;++r<e;)if(!t(n[r],r,n))return false;return true}function Vt(n,t){for(var r=-1,e=n.length,u=-1,o=[];++r<e;){var i=n[r];t(i,r,n)&&(o[++u]=i)}return o}function Yt(n,t){for(var r=-1,e=n.length,u=bu(e);++r<e;)u[r]=t(n[r],r,n);return u}function Zt(n){for(var t=-1,r=n.length,e=so;++t<r;){var u=n[t];u>e&&(e=u)}return e}function Gt(n,t,r,e){var u=-1,o=n.length;for(e&&o&&(r=n[++u]);++u<o;)r=t(r,n[u],u,n);return r}function Jt(n,t,r,e){var u=n.length;for(e&&u&&(r=n[--u]);u--;)r=t(r,n[u],u,n);
|
||||
return r}function Xt(n,t){for(var r=-1,e=n.length;++r<e;)if(t(n[r],r,n))return true;return false}function Ht(n,t){return typeof n=="undefined"?t:n}function Qt(n,t,r,e){return typeof n!="undefined"&&Fu.call(e,r)?n:t}function nr(n,t,r){var e=$o(t);if(!r)return rr(t,n,e);for(var u=-1,o=e.length;++u<o;){var i=e[u],f=n[i],a=r(f,t[i],i,n,t);(a===a?a===f:f!==f)&&(typeof f!="undefined"||i in n)||(n[i]=a)}return n}function tr(n,t){for(var r=-1,e=n.length,u=fe(e),o=t.length,i=bu(o);++r<o;){var f=t[r];u?(f=parseFloat(f),i[r]=oe(f,e)?n[f]:b):i[r]=n[f]
|
||||
}return i}function rr(n,t,r){r||(r=t,t={});for(var e=-1,u=r.length;++e<u;){var o=r[e];t[o]=n[o]}return t}function er(n,t,r){var e=typeof n;if("function"==e){if(e=typeof t!="undefined"){var e=Nt.support,u=!(e.funcNames?n.name:e.funcDecomp);if(!u){var o=Nu.call(n);e.funcNames||(u=!mt.test(o)),u||(u=Et.test(o)||Qe(n),xo(n,u))}e=u}n=e?Fr(n,t,r):n}else n=null==n?yu:"object"==e?Ar(n):typeof t=="undefined"?Er(n+""):jr(n+"",t);return n}function ur(n,t,r,e,u,o,i){var f;if(r&&(f=u?r(n,e,u):r(n)),typeof f!="undefined")return f;
|
||||
if(!He(n))return n;if(e=Wo(n)){if(f=re(n),!t)return qt(n,f)}else{var a=$u.call(n),c=a==V;if(a!=Z&&a!=D&&(!c||u))return St[a]?ue(n,a,t):u?n:{};if(f=ee(c?{}:n),!t)return rr(n,f,$o(n))}for(o||(o=[]),i||(i=[]),u=o.length;u--;)if(o[u]==n)return i[u];return o.push(n),i.push(f),(e?Pt:vr)(n,function(e,u){f[u]=ur(e,t,r,u,n,o,i)}),f}function or(n,t,r,e){if(typeof n!="function")throw new Cu(B);return Ju(function(){n.apply(b,Or(r,e))},t)}function ir(n,r){var e=n?n.length:0,u=[];if(!e)return u;var o=-1,i=te(),f=i==t,a=f&&200<=r.length&&Ao(r),c=r.length;
|
||||
a&&(i=Dt,f=false,r=a);n:for(;++o<e;)if(a=n[o],f&&a===a){for(var l=c;l--;)if(r[l]===a)continue n;u.push(a)}else 0>i(r,a)&&u.push(a);return u}function fr(n,t){var r=n?n.length:0;if(!fe(r))return vr(n,t);for(var e=-1,u=_e(n);++e<r&&false!==t(u[e],e,u););return n}function ar(n,t){var r=n?n.length:0;if(!fe(r))return yr(n,t);for(var e=_e(n);r--&&false!==t(e[r],r,e););return n}function cr(n,t){var r=true;return fr(n,function(n,e,u){return r=!!t(n,e,u)}),r}function lr(n,t){var r=[];return fr(n,function(n,e,u){t(n,e,u)&&r.push(n)
|
||||
}),r}function sr(n,t,r,e){var u;return r(n,function(n,r,o){return t(n,r,o)?(u=e?r:n,false):void 0}),u}function pr(n,t,r,e){e=(e||0)-1;for(var u=n.length,o=-1,i=[];++e<u;){var f=n[e];if(_(f)&&fe(f.length)&&(Wo(f)||Ge(f))){t&&(f=pr(f,t,r));var a=-1,c=f.length;for(i.length+=c;++a<c;)i[++o]=f[a]}else r||(i[++o]=f)}return i}function hr(n,t,r){var e=-1,u=_e(n);r=r(n);for(var o=r.length;++e<o;){var i=r[e];if(false===t(u[i],i,u))break}return n}function _r(n,t,r){var e=_e(n);r=r(n);for(var u=r.length;u--;){var o=r[u];
|
||||
if(false===t(e[o],o,e))break}return n}function gr(n,t){hr(n,t,iu)}function vr(n,t){return hr(n,t,$o)}function yr(n,t){return _r(n,t,$o)}function dr(n,t){for(var r=-1,e=t.length,u=-1,o=[];++r<e;){var i=t[r];Uo(n[i])&&(o[++u]=i)}return o}function mr(n,t,r){var e=-1,u=typeof t=="function",o=n?n.length:0,i=fe(o)?bu(o):[];return fr(n,function(n){var o=u?t:null!=n&&n[t];i[++e]=o?o.apply(n,r):b}),i}function wr(n,t,r,e,u,o){if(n===t)return 0!==n||1/n==1/t;var i=typeof n,f=typeof t;if("function"!=i&&"object"!=i&&"function"!=f&&"object"!=f||null==n||null==t)n=n!==n&&t!==t;
|
||||
else n:{var i=wr,f=Wo(n),a=Wo(t),c=M,l=M;f||(c=$u.call(n),c==D?c=Z:c!=Z&&(f=eu(n))),a||(l=$u.call(t),l==D?l=Z:l!=Z&&eu(t));var s=c==Z,a=l==Z,l=c==l;if(!l||f||s)if(c=s&&Fu.call(n,"__wrapped__"),a=a&&Fu.call(t,"__wrapped__"),c||a)n=i(c?n.value():n,a?t.value():t,r,e,u,o);else if(l){for(u||(u=[]),o||(o=[]),c=u.length;c--;)if(u[c]==n){n=o[c]==t;break n}u.push(n),o.push(t),n=(f?Jr:Hr)(n,t,i,r,e,u,o),u.pop(),o.pop()}else n=false;else n=Xr(n,t,c)}return n}function br(n,t,r,e,u){var o=t.length;if(null==n)return!o;
|
||||
for(var i=-1,f=!u;++i<o;)if(f&&e[i]?r[i]!==n[t[i]]:!Fu.call(n,t[i]))return false;for(i=-1;++i<o;){var a=t[i];if(f&&e[i])a=Fu.call(n,a);else{var c=n[a],l=r[i],a=u?u(c,l,a):b;typeof a=="undefined"&&(a=wr(l,c,u,true))}if(!a)return false}return true}function xr(n,t){var r=[];return fr(n,function(n,e,u){r.push(t(n,e,u))}),r}function Ar(n){var t=$o(n),r=t.length;if(1==r){var e=t[0],u=n[e];if(ae(u))return function(n){return null!=n&&n[e]===u&&Fu.call(n,e)}}for(var o=bu(r),i=bu(r);r--;)u=n[t[r]],o[r]=u,i[r]=ae(u);return function(n){return br(n,t,o,i)
|
||||
}}function jr(n,t){return ae(t)?function(r){return null!=r&&r[n]===t}:function(r){return null!=r&&wr(t,r[n],null,true)}}function kr(n,t,r,e,u){if(!He(n))return n;var o=fe(t.length)&&(Wo(t)||eu(t));return(o?Pt:vr)(t,function(t,i,f){if(_(t)){e||(e=[]),u||(u=[]);n:{t=e;for(var a=u,c=t.length,l=f[i];c--;)if(t[c]==l){n[i]=a[c],i=void 0;break n}c=n[i],f=r?r(c,l,i,n,f):b;var s=typeof f=="undefined";s&&(f=l,fe(l.length)&&(Wo(l)||eu(l))?f=Wo(c)?c:c?qt(c):[]:Fo(l)||Ge(l)?f=Ge(c)?uu(c):Fo(c)?c:{}:s=false),t.push(l),a.push(f),s?n[i]=kr(f,l,r,t,a):(f===f?f!==c:c===c)&&(n[i]=f),i=void 0
|
||||
}return i}a=n[i],f=r?r(a,t,i,n,f):b,(l=typeof f=="undefined")&&(f=t),!o&&typeof f=="undefined"||!l&&(f===f?f===a:a!==a)||(n[i]=f)}),n}function Er(n){return function(t){return null==t?b:t[n]}}function Rr(n,t){return n+Ku(lo()*(t-n+1))}function Ir(n,t,r,e,u){return u(n,function(n,u,o){r=e?(e=false,n):t(r,n,u,o)}),r}function Or(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=typeof r=="undefined"||r>u?u:+r||0,0>r&&(r+=u),u=t>r?0:r-t>>>0,t>>>=0,r=bu(u);++e<u;)r[e]=n[e+t];return r}function Cr(n,t){var r;
|
||||
return fr(n,function(n,e,u){return r=t(n,e,u),!r}),!!r}function Tr(n,r){var e=-1,u=te(),o=n.length,i=u==t,f=i&&200<=o,a=f&&Ao(),c=[];a?(u=Dt,i=false):(f=false,a=r?[]:c);n:for(;++e<o;){var l=n[e],s=r?r(l,e,n):l;if(i&&l===l){for(var p=a.length;p--;)if(a[p]===s)continue n;r&&a.push(s),c.push(l)}else 0>u(a,s)&&((r||f)&&a.push(s),c.push(l))}return c}function Sr(n,t){for(var r=-1,e=t.length,u=bu(e);++r<e;)u[r]=n[t[r]];return u}function Wr(n,t){var r=n;r instanceof Lt&&(r=r.value());for(var e=-1,u=t.length;++e<u;){var r=[r],o=t[e];
|
||||
Yu.apply(r,o.args),r=o.func.apply(o.thisArg,r)}return r}function Nr(n,t,r){var e=0,u=n?n.length:e;if(typeof t=="number"&&t===t&&u<=go){for(;e<u;){var o=e+u>>>1,i=n[o];(r?i<=t:i<t)?e=o+1:u=o}return u}return Ur(n,t,yu,r)}function Ur(n,t,r,e){t=r(t);for(var u=0,o=n?n.length:0,i=t!==t,f=typeof t=="undefined";u<o;){var a=Ku((u+o)/2),c=r(n[a]),l=c===c;(i?l||e:f?l&&(e||typeof c!="undefined"):e?c<=t:c<t)?u=a+1:o=a}return io(o,_o)}function Fr(n,t,r){if(typeof n!="function")return yu;if(typeof t=="undefined")return n;
|
||||
switch(r){case 1:return function(r){return n.call(t,r)};case 3:return function(r,e,u){return n.call(t,r,e,u)};case 4:return function(r,e,u,o){return n.call(t,r,e,u,o)};case 5:return function(r,e,u,o,i){return n.call(t,r,e,u,o,i)}}return function(){return n.apply(t,arguments)}}function Lr(n){return Mu.call(n,0)}function $r(n,t,r){for(var e=r.length,u=-1,o=oo(n.length-e,0),i=-1,f=t.length,a=bu(o+f);++i<f;)a[i]=t[i];for(;++u<e;)a[r[u]]=n[u];for(;o--;)a[i++]=n[u++];return a}function Br(n,t,r){for(var e=-1,u=r.length,o=-1,i=oo(n.length-u,0),f=-1,a=t.length,c=bu(i+a);++o<i;)c[o]=n[o];
|
||||
for(i=o;++f<a;)c[i+f]=t[f];for(;++e<u;)c[i+r[e]]=n[o++];return c}function zr(n,t){return function(r,e,u){var o=t?t():{};if(e=ne(e,u,3),Wo(r)){u=-1;for(var i=r.length;++u<i;){var f=r[u];n(o,f,e(f,u,r),r)}}else fr(r,function(t,r,u){n(o,t,e(t,r,u),u)});return o}}function Dr(n){return function(){var t=arguments.length,r=arguments[0];if(2>t||null==r)return r;if(3<t&&ie(arguments[1],arguments[2],arguments[3])&&(t=2),3<t&&"function"==typeof arguments[t-2])var e=Fr(arguments[--t-1],arguments[t--],5);else 2<t&&"function"==typeof arguments[t-1]&&(e=arguments[--t]);
|
||||
for(var u=0;++u<t;){var o=arguments[u];o&&n(r,o,e)}return r}}function Mr(n,t){function r(){return(this instanceof r?e:n).apply(t,arguments)}var e=Pr(n);return r}function qr(n){return function(t){var r=-1;t=hu(au(t));for(var e=t.length,u="";++r<e;)u=n(u,t[r],r);return u}}function Pr(n){return function(){var t=bo(n.prototype),r=n.apply(t,arguments);return He(r)?r:t}}function Kr(n,t){return function(r,e,u){u&&ie(r,e,u)&&(e=null);var i=ne(),f=null==e;if(i===er&&f||(f=false,e=i(e,u,3)),f){if(e=Wo(r),e||!ru(r))return n(e?r:he(r));
|
||||
e=o}return Qr(r,e,t)}}function Vr(n,t,r,e,u,o,i,f,a,c){function l(){for(var w=arguments.length,x=w,k=bu(w);x--;)k[x]=arguments[x];if(e&&(k=$r(k,e,u)),o&&(k=Br(k,o,i)),_||y){var x=l.placeholder,E=v(k,x),w=w-E.length;if(w<c){var R=f?qt(f):null,w=oo(c-w,0),C=_?E:null,E=_?null:E,T=_?k:null,k=_?null:k;return t|=_?I:O,t&=~(_?O:I),g||(t&=~(A|j)),k=Vr(n,t,r,T,C,k,E,R,a,w),k.placeholder=x,k}}if(x=p?r:this,h&&(n=x[m]),f)for(R=k.length,w=io(f.length,R),C=qt(k);w--;)E=f[w],k[w]=oe(E,R)?C[E]:b;return s&&a<k.length&&(k.length=a),(this instanceof l?d||Pr(n):n).apply(x,k)
|
||||
}var s=t&T,p=t&A,h=t&j,_=t&E,g=t&k,y=t&R,d=!h&&Pr(n),m=n;return l}function Yr(n,t,r){return n=n.length,t=+t,n<t&&eo(t)?(t-=n,r=null==r?" ":r+"",su(r,qu(t/r.length)).slice(0,t)):""}function Zr(n,t,r,e){function u(){for(var t=-1,f=arguments.length,a=-1,c=e.length,l=bu(f+c);++a<c;)l[a]=e[a];for(;f--;)l[a++]=arguments[++t];return(this instanceof u?i:n).apply(o?r:this,l)}var o=t&A,i=Pr(n);return u}function Gr(n,t,r,e,u,o,i,f){var a=t&j;if(!a&&typeof n!="function")throw new Cu(B);var c=e?e.length:0;if(c||(t&=~(I|O),e=u=null),c-=u?u.length:0,t&O){var l=e,s=u;
|
||||
e=u=null}var p=!a&&jo(n);if(r=[n,t,r,e,u,l,s,o,i,f],p&&true!==p){e=r[1],t=p[1],f=e|t,o=T|C,u=A|j,i=o|u|k|R;var l=e&T&&!(t&T),s=e&C&&!(t&C),h=(s?r:p)[7],_=(l?r:p)[8];o=f>=o&&f<=i&&(e<C||(s||l)&&h.length<=_),(!(e>=C&&t>u||e>u&&t>=C)||o)&&(t&A&&(r[2]=p[2],f|=e&A?0:k),(e=p[3])&&(u=r[3],r[3]=u?$r(u,e,p[4]):qt(e),r[4]=u?v(r[3],z):qt(p[4])),(e=p[5])&&(u=r[5],r[5]=u?Br(u,e,p[6]):qt(e),r[6]=u?v(r[5],z):qt(p[6])),(e=p[7])&&(r[7]=qt(e)),t&T&&(r[8]=null==r[8]?p[8]:io(r[8],p[8])),null==r[9]&&(r[9]=p[9]),r[0]=p[0],r[1]=f),t=r[1],f=r[9]
|
||||
}return r[9]=null==f?a?0:n.length:oo(f-c,0)||0,(p?xo:ko)(t==A?Mr(r[0],r[2]):t!=I&&t!=(A|I)||r[4].length?Vr.apply(b,r):Zr.apply(b,r),r)}function Jr(n,t,r,e,u,o,i){var f=-1,a=n.length,c=t.length,l=true;if(a!=c&&(!u||c<=a))return false;for(;l&&++f<a;){var s=n[f],p=t[f],l=b;if(e&&(l=u?e(p,s,f):e(s,p,f)),typeof l=="undefined")if(u)for(var h=c;h--&&(p=t[h],!(l=s&&s===p||r(s,p,e,u,o,i))););else l=s&&s===p||r(s,p,e,u,o,i)}return!!l}function Xr(n,t,r){switch(r){case q:case P:return+n==+t;case K:return n.name==t.name&&n.message==t.message;
|
||||
case Y:return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case G:case J:return n==t+""}return false}function Hr(n,t,r,e,u,o,i){var f=$o(n),a=f.length,c=$o(t).length;if(a!=c&&!u)return false;for(var l,c=-1;++c<a;){var s=f[c],p=Fu.call(t,s);if(p){var h=n[s],_=t[s],p=b;e&&(p=u?e(_,h,s):e(h,_,s)),typeof p=="undefined"&&(p=h&&h===_||r(h,_,e,u,o,i))}if(!p)return false;l||(l="constructor"==s)}return l||(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 Qr(n,t,r){var e=r?po:so,u=e,o=u;return fr(n,function(n,i,f){i=t(n,i,f),((r?i<u:i>u)||i===e&&i===o)&&(u=i,o=n)}),o}function ne(n,t,r){var e=Nt.callback||gu,e=e===gu?er:e;return r?e(n,t,r):e}function te(n,r,e){var u=Nt.indexOf||we,u=u===we?t:u;return n?u(n,r,e):u}function re(n){var t=n.length,r=new n.constructor(t);return t&&"string"==typeof n[0]&&Fu.call(n,"index")&&(r.index=n.index,r.input=n.input),r}function ee(n){return n=n.constructor,typeof n=="function"&&n instanceof n||(n=Ru),new n
|
||||
}function ue(n,t,r){var e=n.constructor;switch(t){case X:return Lr(n);case q:case P:return new e(+n);case H:case Q:case nt:case tt:case rt:case et:case ut:case ot:case it:return t=n.buffer,new e(r?Lr(t):t,n.byteOffset,n.length);case Y:case J:return new e(n);case G:var u=new e(n.source,dt.exec(n));u.lastIndex=n.lastIndex}return u}function oe(n,t){return n=+n,t=null==t?yo:t,-1<n&&0==n%1&&n<t}function ie(n,t,r){if(!He(r))return false;var e=typeof t;return"number"==e?(e=r.length,e=fe(e)&&oe(t,e)):e="string"==e&&t in r,t=r[t],e&&(n===n?n===t:t!==t)
|
||||
}function fe(n){return typeof n=="number"&&-1<n&&0==n%1&&n<=yo}function ae(n){return n===n&&(0===n?0<1/n:!He(n))}function ce(n,t){n=_e(n);for(var r=-1,e=t.length,u={};++r<e;){var o=t[r];o in n&&(u[o]=n[o])}return u}function le(n,t){var r={};return gr(n,function(n,e,u){t(n,e,u)&&(r[e]=n)}),r}function se(n){var t;if(!_(n)||$u.call(n)!=Z||!(Fu.call(n,"constructor")||(t=n.constructor,typeof t!="function"||t instanceof t)))return false;var r;return gr(n,function(n,t){r=t}),typeof r=="undefined"||Fu.call(n,r)
|
||||
}function pe(n){for(var t=iu(n),r=t.length,e=r&&n.length,u=Nt.support,u=e&&fe(e)&&(Wo(n)||u.nonEnumArgs&&Ge(n)),o=-1,i=[];++o<r;){var f=t[o];(u&&oe(f,e)||Fu.call(n,f))&&i.push(f)}return i}function he(n){return null==n?[]:fe(n.length)?He(n)?n:Ru(n):fu(n)}function _e(n){return He(n)?n:Ru(n)}function ge(n){return n instanceof Lt?n.clone():new Ft(n.__wrapped__,n.__chain__,qt(n.__actions__))}function ve(n,t,r){return n&&n.length?((r?ie(n,t,r):null==t)&&(t=1),Or(n,0>t?0:t)):[]}function ye(n,t,r){var e=n?n.length:0;
|
||||
return e?((r?ie(n,t,r):null==t)&&(t=1),t=e-(+t||0),Or(n,0,0>t?0:t)):[]}function de(n,t,r){var e=-1,u=n?n.length:0;for(t=ne(t,r,3);++e<u;)if(t(n[e],e,n))return e;return-1}function me(n){return n?n[0]:b}function we(n,r,e){var u=n?n.length:0;if(!u)return-1;if(typeof e=="number")e=0>e?oo(u+e,0):e||0;else if(e)return e=Nr(n,r),n=n[e],(r===r?r===n:n!==n)?e:-1;return t(n,r,e)}function be(n){return ve(n,1)}function xe(n,r,e,u){if(!n||!n.length)return[];null!=r&&typeof r!="boolean"&&(u=e,e=ie(n,r,u)?null:r,r=false);
|
||||
var o=ne();if((o!==er||null!=e)&&(e=o(e,u,3)),r&&te()==t){r=e;var i;e=-1,u=n.length;for(var o=-1,f=[];++e<u;){var a=n[e],c=r?r(a,e,n):a;e&&i===c||(i=c,f[++o]=a)}n=f}else n=Tr(n,e);return n}function Ae(n){for(var t=-1,r=(n&&n.length&&Zt(Yt(n,Uu)))>>>0,e=bu(r);++t<r;)e[t]=Yt(n,Er(t));return e}function je(n,t){var r=-1,e=n?n.length:0,u={};for(!e||t||Wo(n[0])||(t=[]);++r<e;){var o=n[r];t?u[o]=t[r]:o&&(u[o[0]]=o[1])}return u}function ke(n){return n=Nt(n),n.__chain__=true,n}function Ee(n,t,r){return t.call(r,n)
|
||||
}function Re(n,t,r){var e=Wo(n)?Kt:cr;return(typeof t!="function"||typeof r!="undefined")&&(t=ne(t,r,3)),e(n,t)}function Ie(n,t,r){var e=Wo(n)?Vt:lr;return t=ne(t,r,3),e(n,t)}function Oe(n,t,r){return Wo(n)?(t=de(n,t,r),-1<t?n[t]:b):(t=ne(t,r,3),sr(n,t,fr))}function Ce(n,t,r){return typeof t=="function"&&typeof r=="undefined"&&Wo(n)?Pt(n,t):fr(n,Fr(t,r,3))}function Te(n,t,r){if(typeof t=="function"&&typeof r=="undefined"&&Wo(n))for(r=n.length;r--&&false!==t(n[r],r,n););else n=ar(n,Fr(t,r,3));return n
|
||||
}function Se(n,t,r){var e=n?n.length:0;return fe(e)||(n=fu(n),e=n.length),e?(r=typeof r=="number"?0>r?oo(e+r,0):r||0:0,typeof n=="string"||!Wo(n)&&ru(n)?r<e&&-1<n.indexOf(t,r):-1<te(n,t,r)):false}function We(n,t,r){var e=Wo(n)?Yt:xr;return t=ne(t,r,3),e(n,t)}function Ne(n,t,r,e){return(Wo(n)?Gt:Ir)(n,ne(t,e,4),r,3>arguments.length,fr)}function Ue(n,t,r,e){return(Wo(n)?Jt:Ir)(n,ne(t,e,4),r,3>arguments.length,ar)}function Fe(n,t,r){return(r?ie(n,t,r):null==t)?(n=he(n),t=n.length,0<t?n[Rr(0,t-1)]:b):(n=Le(n),n.length=io(0>t?0:+t||0,n.length),n)
|
||||
}function Le(n){n=he(n);for(var t=-1,r=n.length,e=bu(r);++t<r;){var u=Rr(0,t);t!=u&&(e[t]=e[u]),e[u]=n[t]}return e}function $e(n,t,r){var e=Wo(n)?Xt:Cr;return(typeof t!="function"||typeof r!="undefined")&&(t=ne(t,r,3)),e(n,t)}function Be(n,t){var r;if(typeof t!="function"){if(typeof n!="function")throw new Cu(B);var e=n;n=t,t=e}return function(){return 0<--n?r=t.apply(this,arguments):t=null,r}}function ze(n,t){var r=A;if(2<arguments.length)var e=Or(arguments,2),u=v(e,ze.placeholder),r=r|I;return Gr(n,r,t,e,u)
|
||||
}function De(n,t){var r=A|j;if(2<arguments.length)var e=Or(arguments,2),u=v(e,De.placeholder),r=r|I;return Gr(t,r,n,e,u)}function Me(n,t,r){return r&&ie(n,t,r)&&(t=null),n=Gr(n,E,null,null,null,null,null,t),n.placeholder=Me.placeholder,n}function qe(n,t,r){return r&&ie(n,t,r)&&(t=null),n=Gr(n,R,null,null,null,null,null,t),n.placeholder=qe.placeholder,n}function Pe(n,t,r){function e(){var r=t-(So()-c);0>=r||r>t?(f&&Pu(f),r=p,f=s=p=b,r&&(h=So(),a=n.apply(l,i),s||f||(i=l=null))):s=Ju(e,r)}function u(){s&&Pu(s),f=s=p=b,(g||_!==t)&&(h=So(),a=n.apply(l,i),s||f||(i=l=null))
|
||||
}function o(){if(i=arguments,c=So(),l=this,p=g&&(s||!v),false===_)var r=v&&!s;else{f||v||(h=c);var o=_-(c-h),y=0>=o||o>_;y?(f&&(f=Pu(f)),h=c,a=n.apply(l,i)):f||(f=Ju(u,o))}return y&&s?s=Pu(s):s||t===_||(s=Ju(e,t)),r&&(y=true,a=n.apply(l,i)),!y||s||f||(i=l=null),a}var i,f,a,c,l,s,p,h=0,_=false,g=true;if(typeof n!="function")throw new Cu(B);if(t=0>t?0:t,true===r)var v=true,g=false;else He(r)&&(v=r.leading,_="maxWait"in r&&oo(+r.maxWait||0,t),g="trailing"in r?r.trailing:g);return o.cancel=function(){s&&Pu(s),f&&Pu(f),f=s=p=b
|
||||
},o}function Ke(){var n=arguments,t=n.length-1;if(0>t)return function(n){return n};if(!Kt(n,r))throw new Cu(B);return function(){for(var r=t,e=n[r].apply(this,arguments);r--;)e=n[r].call(this,e);return e}}function Ve(n,t){function r(){var e=r.cache,u=t?t.apply(this,arguments):arguments[0];if(e.has(u))return e.get(u);var o=n.apply(this,arguments);return e.set(u,o),o}if(typeof n!="function"||t&&typeof t!="function")throw new Cu(B);return r.cache=new Ve.Cache,r}function Ye(n){var t=Or(arguments,1),r=v(t,Ye.placeholder);
|
||||
return Gr(n,I,null,t,r)}function Ze(n){var t=Or(arguments,1),r=v(t,Ze.placeholder);return Gr(n,O,null,t,r)}function Ge(n){return fe(_(n)?n.length:b)&&$u.call(n)==D||false}function Je(n){return n&&1===n.nodeType&&_(n)&&-1<$u.call(n).indexOf("Element")||false}function Xe(n){return _(n)&&typeof n.message=="string"&&$u.call(n)==K||false}function He(n){var t=typeof n;return"function"==t||n&&"object"==t||false}function Qe(n){return null==n?false:$u.call(n)==V?zu.test(Nu.call(n)):_(n)&&bt.test(n)||false}function nu(n){return typeof n=="number"||_(n)&&$u.call(n)==Y||false
|
||||
}function tu(n){return _(n)&&$u.call(n)==G||false}function ru(n){return typeof n=="string"||_(n)&&$u.call(n)==J||false}function eu(n){return _(n)&&fe(n.length)&&Tt[$u.call(n)]||false}function uu(n){return rr(n,iu(n))}function ou(n){return dr(n,iu(n))}function iu(n){if(null==n)return[];He(n)||(n=Ru(n));for(var t=n.length,t=t&&fe(t)&&(Wo(n)||wo.nonEnumArgs&&Ge(n))&&t||0,r=n.constructor,e=-1,r=typeof r=="function"&&r.prototype===n,u=bu(t),o=0<t;++e<t;)u[e]=e+"";for(var i in n)o&&oe(i,t)||"constructor"==i&&(r||!Fu.call(n,i))||u.push(i);
|
||||
return u}function fu(n){return Sr(n,$o(n))}function au(n){return(n=u(n))&&n.replace(xt,l)}function cu(n){return(n=u(n))&&kt.test(n)?n.replace(jt,"\\$&"):n}function lu(n,t,r){return r&&ie(n,t,r)&&(t=0),co(n,t)}function su(n,t){var r="";if(n=u(n),t=+t,1>t||!n||!eo(t))return r;do t%2&&(r+=n),t=Ku(t/2),n+=n;while(t);return r}function pu(n,t,r){var e=n;return(n=u(n))?(r?ie(e,t,r):null==t)?n.slice(y(n),d(n)+1):(t+="",n.slice(i(n,t),f(n,t)+1)):n}function hu(n,t,r){return r&&ie(n,t,r)&&(t=null),n=u(n),n.match(t||It)||[]
|
||||
}function _u(){var n=arguments.length,t=arguments[0];try{for(var r=bu(n?n-1:0);0<--n;)r[n-1]=arguments[n];return t.apply(b,r)}catch(e){return Xe(e)?e:new Au(e)}}function gu(n,t,r){return r&&ie(n,t,r)&&(t=null),_(n)?du(n):er(n,t)}function vu(n){return function(){return n}}function yu(n){return n}function du(n){return Ar(ur(n,true))}function mu(n,t,r){if(null==r){var e=He(t),u=e&&$o(t);((u=u&&u.length&&dr(t,u))?u.length:e)||(u=false,r=t,t=n,n=this)}u||(u=dr(t,$o(t)));var o=true,e=-1,i=Uo(n),f=u.length;false===r?o=false:He(r)&&"chain"in r&&(o=r.chain);
|
||||
for(;++e<f;){r=u[e];var a=t[r];n[r]=a,i&&(n.prototype[r]=function(t){return function(){var r=this.__chain__;if(o||r){var e=n(this.__wrapped__);return(e.__actions__=qt(this.__actions__)).push({func:t,args:arguments,thisArg:n}),e.__chain__=r,e}return r=[this.value()],Yu.apply(r,arguments),t.apply(n,r)}}(a))}return n}function wu(){}g=g?Mt.defaults(Bt.Object(),g,Mt.pick(Bt,Ct)):Bt;var bu=g.Array,xu=g.Date,Au=g.Error,ju=g.Function,ku=g.Math,Eu=g.Number,Ru=g.Object,Iu=g.RegExp,Ou=g.String,Cu=g.TypeError,Tu=bu.prototype,Su=Ru.prototype,Wu=(Wu=g.window)&&Wu.document,Nu=ju.prototype.toString,Uu=Er("length"),Fu=Su.hasOwnProperty,Lu=0,$u=Su.toString,Bu=g._,zu=Iu("^"+cu($u).replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Du=Qe(Du=g.ArrayBuffer)&&Du,Mu=Qe(Mu=Du&&new Du(0).slice)&&Mu,qu=ku.ceil,Pu=g.clearTimeout,Ku=ku.floor,Vu=Qe(Vu=Ru.getPrototypeOf)&&Vu,Yu=Tu.push,Zu=Su.propertyIsEnumerable,Gu=Qe(Gu=g.Set)&&Gu,Ju=g.setTimeout,Xu=Tu.splice,Hu=Qe(Hu=g.Uint8Array)&&Hu,Qu=Qe(Qu=g.WeakMap)&&Qu,no=function(){try{var n=Qe(n=g.Float64Array)&&n,t=new n(new Du(10),0,1)&&n
|
||||
}catch(r){}return t}(),to=Qe(to=bu.isArray)&&to,ro=Qe(ro=Ru.create)&&ro,eo=g.isFinite,uo=Qe(uo=Ru.keys)&&uo,oo=ku.max,io=ku.min,fo=Qe(fo=xu.now)&&fo,ao=Qe(ao=Eu.isFinite)&&ao,co=g.parseInt,lo=ku.random,so=Eu.NEGATIVE_INFINITY,po=Eu.POSITIVE_INFINITY,ho=ku.pow(2,32)-1,_o=ho-1,go=ho>>>1,vo=no?no.BYTES_PER_ELEMENT:0,yo=ku.pow(2,53)-1,mo=Qu&&new Qu,wo=Nt.support={};!function(n){wo.funcDecomp=!Qe(g.WinRTError)&&Et.test(w),wo.funcNames=typeof ju.name=="string";try{wo.dom=11===Wu.createDocumentFragment().nodeType
|
||||
}catch(t){wo.dom=false}try{wo.nonEnumArgs=!Zu.call(arguments,1)}catch(r){wo.nonEnumArgs=true}}(0,0),Nt.templateSettings={escape:_t,evaluate:gt,interpolate:vt,variable:"",imports:{_:Nt}};var bo=function(){function n(){}return function(t){if(He(t)){n.prototype=t;var r=new n;n.prototype=null}return r||g.Object()}}(),xo=mo?function(n,t){return mo.set(n,t),n}:yu;Mu||(Lr=Du&&Hu?function(n){var t=n.byteLength,r=no?Ku(t/vo):0,e=r*vo,u=new Du(t);if(r){var o=new no(u,0,r);o.set(new no(n,0,r))}return t!=e&&(o=new Hu(u,e),o.set(new Hu(n,e))),u
|
||||
}:vu(null));var Ao=ro&&Gu?function(n){return new zt(n)}:vu(null),jo=mo?function(n){return mo.get(n)}:wu,ko=function(){var n=0,t=0;return function(r,e){var u=So(),o=U-(u-t);if(t=u,0<o){if(++n>=N)return r}else n=0;return xo(r,e)}}(),Eo=zr(function(n,t,r){Fu.call(n,r)?++n[r]:n[r]=1}),Ro=zr(function(n,t,r){Fu.call(n,r)?n[r].push(t):n[r]=[t]}),Io=zr(function(n,t,r){n[r]=t}),Oo=Kr(Zt),Co=Kr(function(n){for(var t=-1,r=n.length,e=po;++t<r;){var u=n[t];u<e&&(e=u)}return e},true),To=zr(function(n,t,r){n[r?0:1].push(t)
|
||||
},function(){return[[],[]]}),So=fo||function(){return(new xu).getTime()},Wo=to||function(n){return _(n)&&fe(n.length)&&$u.call(n)==M||false};wo.dom||(Je=function(n){return n&&1===n.nodeType&&_(n)&&!Fo(n)||false});var No=ao||function(n){return typeof n=="number"&&eo(n)},Uo=r(/x/)||Hu&&!r(Hu)?function(n){return $u.call(n)==V}:r,Fo=Vu?function(n){if(!n||$u.call(n)!=Z)return false;var t=n.valueOf,r=Qe(t)&&(r=Vu(t))&&Vu(r);return r?n==r||Vu(n)==r:se(n)}:se,Lo=Dr(nr),$o=uo?function(n){if(n)var t=n.constructor,r=n.length;
|
||||
return typeof t=="function"&&t.prototype===n||typeof n!="function"&&r&&fe(r)?pe(n):He(n)?uo(n):[]}:pe,Bo=Dr(kr),zo=qr(function(n,t,r){return t=t.toLowerCase(),n+(r?t.charAt(0).toUpperCase()+t.slice(1):t)}),Do=qr(function(n,t,r){return n+(r?"-":"")+t.toLowerCase()});8!=co(Ot+"08")&&(lu=function(n,t,r){return(r?ie(n,t,r):null==t)?t=0:t&&(t=+t),n=pu(n),co(n,t||(wt.test(n)?16:10))});var Mo=qr(function(n,t,r){return n+(r?"_":"")+t.toLowerCase()}),qo=qr(function(n,t,r){return n+(r?" ":"")+(t.charAt(0).toUpperCase()+t.slice(1))
|
||||
});return Nt.prototype=Ut.prototype,Ft.prototype=bo(Ut.prototype),Ft.prototype.constructor=Ft,Lt.prototype=bo(Ut.prototype),Lt.prototype.constructor=Lt,$t.prototype["delete"]=function(n){return this.has(n)&&delete this.__data__[n]},$t.prototype.get=function(n){return"__proto__"==n?b:this.__data__[n]},$t.prototype.has=function(n){return"__proto__"!=n&&Fu.call(this.__data__,n)},$t.prototype.set=function(n,t){return"__proto__"!=n&&(this.__data__[n]=t),this},zt.prototype.push=function(n){var t=this.data;
|
||||
typeof n=="string"||He(n)?t.set.add(n):t.hash[n]=true},Ve.Cache=$t,Nt.after=function(n,t){if(typeof t!="function"){if(typeof n!="function")throw new Cu(B);var r=n;n=t,t=r}return n=eo(n=+n)?n:0,function(){return 1>--n?t.apply(this,arguments):void 0}},Nt.ary=function(n,t,r){return r&&ie(n,t,r)&&(t=null),t=n&&null==t?n.length:oo(+t||0,0),Gr(n,T,null,null,null,null,t)},Nt.assign=Lo,Nt.at=function(n){return fe(n?n.length:0)&&(n=he(n)),tr(n,pr(arguments,false,false,1))},Nt.before=Be,Nt.bind=ze,Nt.bindAll=function(n){for(var t=n,r=1<arguments.length?pr(arguments,false,false,1):ou(n),e=-1,u=r.length;++e<u;){var o=r[e];
|
||||
t[o]=Gr(t[o],A,t)}return t},Nt.bindKey=De,Nt.callback=gu,Nt.chain=ke,Nt.chunk=function(n,t,r){t=(r?ie(n,t,r):null==t)?1:oo(+t||1,1),r=0;for(var e=n?n.length:0,u=-1,o=bu(qu(e/t));r<e;)o[++u]=Or(n,r,r+=t);return o},Nt.compact=function(n){for(var t=-1,r=n?n.length:0,e=-1,u=[];++t<r;){var o=n[t];o&&(u[++e]=o)}return u},Nt.constant=vu,Nt.countBy=Eo,Nt.create=function(n,t,r){var e=bo(n);return r&&ie(n,t,r)&&(t=null),t?rr(t,e,$o(t)):e},Nt.curry=Me,Nt.curryRight=qe,Nt.debounce=Pe,Nt.defaults=function(n){if(null==n)return n;
|
||||
var t=qt(arguments);return t.push(Ht),Lo.apply(b,t)},Nt.defer=function(n){return or(n,1,arguments,1)},Nt.delay=function(n,t){return or(n,t,arguments,2)},Nt.difference=function(){for(var n=-1,t=arguments.length;++n<t;){var r=arguments[n];if(Wo(r)||Ge(r))break}return ir(r,pr(arguments,false,true,++n))},Nt.drop=ve,Nt.dropRight=ye,Nt.dropRightWhile=function(n,t,r){var e=n?n.length:0;if(!e)return[];for(t=ne(t,r,3);e--&&t(n[e],e,n););return Or(n,0,e+1)},Nt.dropWhile=function(n,t,r){var e=n?n.length:0;if(!e)return[];
|
||||
var u=-1;for(t=ne(t,r,3);++u<e&&t(n[u],u,n););return Or(n,u)},Nt.fill=function(n,t,r,e){var u=n?n.length:0;if(!u)return[];for(r&&typeof r!="number"&&ie(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=typeof e=="undefined"||e>u?u:+e||0,0>e&&(e+=u),u=r>e?0:e>>>0,r>>>=0;r<u;)n[r++]=t;return n},Nt.filter=Ie,Nt.flatten=function(n,t,r){var e=n?n.length:0;return r&&ie(n,t,r)&&(t=false),e?pr(n,t):[]},Nt.flattenDeep=function(n){return n&&n.length?pr(n,true):[]},Nt.flow=function(){var n=arguments,t=n.length;
|
||||
if(!t)return function(n){return n};if(!Kt(n,r))throw new Cu(B);return function(){for(var r=0,e=n[r].apply(this,arguments);++r<t;)e=n[r].call(this,e);return e}},Nt.flowRight=Ke,Nt.forEach=Ce,Nt.forEachRight=Te,Nt.forIn=function(n,t,r){return(typeof t!="function"||typeof r!="undefined")&&(t=Fr(t,r,3)),hr(n,t,iu)},Nt.forInRight=function(n,t,r){return t=Fr(t,r,3),_r(n,t,iu)},Nt.forOwn=function(n,t,r){return(typeof t!="function"||typeof r!="undefined")&&(t=Fr(t,r,3)),vr(n,t)},Nt.forOwnRight=function(n,t,r){return t=Fr(t,r,3),_r(n,t,$o)
|
||||
},Nt.functions=ou,Nt.groupBy=Ro,Nt.indexBy=Io,Nt.initial=function(n){return ye(n,1)},Nt.intersection=function(){for(var n=[],r=-1,e=arguments.length,u=[],o=te(),i=o==t;++r<e;){var f=arguments[r];(Wo(f)||Ge(f))&&(n.push(f),u.push(i&&120<=f.length&&Ao(r&&f)))}var e=n.length,i=n[0],a=-1,c=i?i.length:0,l=[],s=u[0];n:for(;++a<c;)if(f=i[a],0>(s?Dt(s,f):o(l,f))){for(r=e;--r;){var p=u[r];if(0>(p?Dt(p,f):o(n[r],f)))continue n}s&&s.push(f),l.push(f)}return l},Nt.invert=function(n,t,r){r&&ie(n,t,r)&&(t=null),r=-1;
|
||||
for(var e=$o(n),u=e.length,o={};++r<u;){var i=e[r],f=n[i];t?Fu.call(o,f)?o[f].push(i):o[f]=[i]:o[f]=i}return o},Nt.invoke=function(n,t){return mr(n,t,Or(arguments,2))},Nt.keys=$o,Nt.keysIn=iu,Nt.map=We,Nt.mapValues=function(n,t,r){var e={};return t=ne(t,r,3),vr(n,function(n,r,u){e[r]=t(n,r,u)}),e},Nt.matches=du,Nt.matchesProperty=function(n,t){return jr(n+"",ur(t,true))},Nt.memoize=Ve,Nt.merge=Bo,Nt.mixin=mu,Nt.negate=function(n){if(typeof n!="function")throw new Cu(B);return function(){return!n.apply(this,arguments)
|
||||
}},Nt.omit=function(n,t,r){if(null==n)return{};if(typeof t!="function"){var e=Yt(pr(arguments,false,false,1),Ou);return ce(n,ir(iu(n),e))}return t=Fr(t,r,3),le(n,function(n,r,e){return!t(n,r,e)})},Nt.once=function(n){return Be(n,2)},Nt.pairs=function(n){for(var t=-1,r=$o(n),e=r.length,u=bu(e);++t<e;){var o=r[t];u[t]=[o,n[o]]}return u},Nt.partial=Ye,Nt.partialRight=Ze,Nt.partition=To,Nt.pick=function(n,t,r){return null==n?{}:typeof t=="function"?le(n,Fr(t,r,3)):ce(n,pr(arguments,false,false,1))},Nt.pluck=function(n,t){return We(n,Er(t))
|
||||
},Nt.property=function(n){return Er(n+"")},Nt.propertyOf=function(n){return function(t){return null==n?b:n[t]}},Nt.pull=function(){var n=arguments[0];if(!n||!n.length)return n;for(var t=0,r=te(),e=arguments.length;++t<e;)for(var u=0,o=arguments[t];-1<(u=r(n,o,u));)Xu.call(n,u,1);return n},Nt.pullAt=function(t){var r=t||[],e=pr(arguments,false,false,1),u=e.length,o=tr(r,e);for(e.sort(n);u--;){var i=parseFloat(e[u]);if(i!=f&&oe(i)){var f=i;Xu.call(r,i,1)}}return o},Nt.range=function(n,t,r){r&&ie(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=oo(qu((t-n)/(r||1)),0);for(var u=bu(t);++e<t;)u[e]=n,n+=r;return u},Nt.rearg=function(n){var t=pr(arguments,false,false,1);return Gr(n,C,null,null,null,t)},Nt.reject=function(n,t,r){var e=Wo(n)?Vt:lr;return t=ne(t,r,3),e(n,function(n,r,e){return!t(n,r,e)})},Nt.remove=function(n,t,r){var e=-1,u=n?n.length:0,o=[];for(t=ne(t,r,3);++e<u;)r=n[e],t(r,e,n)&&(o.push(r),Xu.call(n,e--,1),u--);return o},Nt.rest=be,Nt.shuffle=Le,Nt.slice=function(n,t,r){var e=n?n.length:0;return e?(r&&typeof r!="number"&&ie(n,t,r)&&(t=0,r=e),Or(n,t,r)):[]
|
||||
},Nt.sortBy=function(n,t,r){var u=-1,o=n?n.length:0,i=fe(o)?bu(o):[];return r&&ie(n,t,r)&&(t=null),t=ne(t,r,3),fr(n,function(n,r,e){i[++u]={a:t(n,r,e),b:u,c:n}}),e(i,a)},Nt.sortByAll=function(n){var t=arguments;3<t.length&&ie(t[1],t[2],t[3])&&(t=[n,t[1]]);var r=-1,u=n?n.length:0,o=pr(t,false,false,1),i=fe(u)?bu(u):[];return fr(n,function(n){for(var t=o.length,e=bu(t);t--;)e[t]=null==n?b:n[o[t]];i[++r]={a:e,b:r,c:n}}),e(i,c)},Nt.spread=function(n){if(typeof n!="function")throw new Cu(B);return function(t){return n.apply(this,t)
|
||||
}},Nt.take=function(n,t,r){return n&&n.length?((r?ie(n,t,r):null==t)&&(t=1),Or(n,0,0>t?0:t)):[]},Nt.takeRight=function(n,t,r){var e=n?n.length:0;return e?((r?ie(n,t,r):null==t)&&(t=1),t=e-(+t||0),Or(n,0>t?0:t)):[]},Nt.takeRightWhile=function(n,t,r){var e=n?n.length:0;if(!e)return[];for(t=ne(t,r,3);e--&&t(n[e],e,n););return Or(n,e+1)},Nt.takeWhile=function(n,t,r){var e=n?n.length:0;if(!e)return[];var u=-1;for(t=ne(t,r,3);++u<e&&t(n[u],u,n););return Or(n,0,u)},Nt.tap=function(n,t,r){return t.call(r,n),n
|
||||
},Nt.throttle=function(n,t,r){var e=true,u=true;if(typeof n!="function")throw new Cu(B);return false===r?e=false:He(r)&&(e="leading"in r?!!r.leading:e,u="trailing"in r?!!r.trailing:u),Wt.leading=e,Wt.maxWait=+t,Wt.trailing=u,Pe(n,t,Wt)},Nt.thru=Ee,Nt.times=function(n,t,r){if(n=+n,1>n||!eo(n))return[];var e=-1,u=bu(io(n,ho));for(t=Fr(t,r,1);++e<n;)e<ho?u[e]=t(e):t(e);return u},Nt.toArray=function(n){var t=n?n.length:0;return fe(t)?t?qt(n):[]:fu(n)},Nt.toPlainObject=uu,Nt.transform=function(n,t,r,e){var u=Wo(n)||eu(n);
|
||||
return t=ne(t,e,4),null==r&&(u||He(n)?(e=n.constructor,r=u?Wo(n)?new e:[]:bo(Uo(e)&&e.prototype)):r={}),(u?Pt:vr)(n,function(n,e,u){return t(r,n,e,u)}),r},Nt.union=function(){return Tr(pr(arguments,false,true))},Nt.uniq=xe,Nt.unzip=Ae,Nt.values=fu,Nt.valuesIn=function(n){return Sr(n,iu(n))},Nt.where=function(n,t){return Ie(n,Ar(t))},Nt.without=function(n){return ir(n,Or(arguments,1))},Nt.wrap=function(n,t){return t=null==t?yu:t,Gr(t,I,null,[n],[])},Nt.xor=function(){for(var n=-1,t=arguments.length;++n<t;){var r=arguments[n];
|
||||
if(Wo(r)||Ge(r))var e=e?ir(e,r).concat(ir(r,e)):r}return e?Tr(e):[]},Nt.zip=function(){for(var n=arguments.length,t=bu(n);n--;)t[n]=arguments[n];return Ae(t)},Nt.zipObject=je,Nt.backflow=Ke,Nt.collect=We,Nt.compose=Ke,Nt.each=Ce,Nt.eachRight=Te,Nt.extend=Lo,Nt.iteratee=gu,Nt.methods=ou,Nt.object=je,Nt.select=Ie,Nt.tail=be,Nt.unique=xe,mu(Nt,Nt),Nt.attempt=_u,Nt.camelCase=zo,Nt.capitalize=function(n){return(n=u(n))&&n.charAt(0).toUpperCase()+n.slice(1)},Nt.clone=function(n,t,r,e){return t&&typeof t!="boolean"&&ie(n,t,r)?t=false:typeof t=="function"&&(e=r,r=t,t=false),r=typeof r=="function"&&Fr(r,e,1),ur(n,t,r)
|
||||
},Nt.cloneDeep=function(n,t,r){return t=typeof t=="function"&&Fr(t,r,1),ur(n,true,t)},Nt.deburr=au,Nt.endsWith=function(n,t,r){n=u(n),t+="";var e=n.length;return r=(typeof r=="undefined"?e:io(0>r?0:+r||0,e))-t.length,0<=r&&n.indexOf(t,r)==r},Nt.escape=function(n){return(n=u(n))&&ht.test(n)?n.replace(st,s):n},Nt.escapeRegExp=cu,Nt.every=Re,Nt.find=Oe,Nt.findIndex=de,Nt.findKey=function(n,t,r){return t=ne(t,r,3),sr(n,t,vr,true)},Nt.findLast=function(n,t,r){return t=ne(t,r,3),sr(n,t,ar)},Nt.findLastIndex=function(n,t,r){var e=n?n.length:0;
|
||||
for(t=ne(t,r,3);e--;)if(t(n[e],e,n))return e;return-1},Nt.findLastKey=function(n,t,r){return t=ne(t,r,3),sr(n,t,yr,true)},Nt.findWhere=function(n,t){return Oe(n,Ar(t))},Nt.first=me,Nt.has=function(n,t){return n?Fu.call(n,t):false},Nt.identity=yu,Nt.includes=Se,Nt.indexOf=we,Nt.inRange=function(n,t,r){return t=+t||0,"undefined"===typeof r?(r=t,t=0):r=+r||0,n>=t&&n<r},Nt.isArguments=Ge,Nt.isArray=Wo,Nt.isBoolean=function(n){return true===n||false===n||_(n)&&$u.call(n)==q||false},Nt.isDate=function(n){return _(n)&&$u.call(n)==P||false
|
||||
},Nt.isElement=Je,Nt.isEmpty=function(n){if(null==n)return true;var t=n.length;return fe(t)&&(Wo(n)||ru(n)||Ge(n)||_(n)&&Uo(n.splice))?!t:!$o(n).length},Nt.isEqual=function(n,t,r,e){return r=typeof r=="function"&&Fr(r,e,3),!r&&ae(n)&&ae(t)?n===t:(e=r?r(n,t):b,typeof e=="undefined"?wr(n,t,r):!!e)},Nt.isError=Xe,Nt.isFinite=No,Nt.isFunction=Uo,Nt.isMatch=function(n,t,r,e){var u=$o(t),o=u.length;if(r=typeof r=="function"&&Fr(r,e,3),!r&&1==o){var i=u[0];if(e=t[i],ae(e))return null!=n&&e===n[i]&&Fu.call(n,i)
|
||||
}for(var i=bu(o),f=bu(o);o--;)e=i[o]=t[u[o]],f[o]=ae(e);return br(n,u,i,f,r)},Nt.isNaN=function(n){return nu(n)&&n!=+n},Nt.isNative=Qe,Nt.isNull=function(n){return null===n},Nt.isNumber=nu,Nt.isObject=He,Nt.isPlainObject=Fo,Nt.isRegExp=tu,Nt.isString=ru,Nt.isTypedArray=eu,Nt.isUndefined=function(n){return typeof n=="undefined"},Nt.kebabCase=Do,Nt.last=function(n){var t=n?n.length:0;return t?n[t-1]:b},Nt.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?oo(e+r,0):io(r||0,e-1))+1;
|
||||
else if(r)return u=Nr(n,t,true)-1,n=n[u],(t===t?t===n:n!==n)?u:-1;if(t!==t)return h(n,u,true);for(;u--;)if(n[u]===t)return u;return-1},Nt.max=Oo,Nt.min=Co,Nt.noConflict=function(){return g._=Bu,this},Nt.noop=wu,Nt.now=So,Nt.pad=function(n,t,r){n=u(n),t=+t;var e=n.length;return e<t&&eo(t)?(e=(t-e)/2,t=Ku(e),e=qu(e),r=Yr("",e,r),r.slice(0,t)+n+r):n},Nt.padLeft=function(n,t,r){return(n=u(n))&&Yr(n,t,r)+n},Nt.padRight=function(n,t,r){return(n=u(n))&&n+Yr(n,t,r)},Nt.parseInt=lu,Nt.random=function(n,t,r){r&&ie(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=lo(),io(n+r*(t-n+parseFloat("1e-"+((r+"").length-1))),t)):Rr(n,t)},Nt.reduce=Ne,Nt.reduceRight=Ue,Nt.repeat=su,Nt.result=function(n,t,r){return t=null==n?b:n[t],typeof t=="undefined"&&(t=r),Uo(t)?t.call(n):t},Nt.runInContext=w,Nt.size=function(n){var t=n?n.length:0;return fe(t)?t:$o(n).length},Nt.snakeCase=Mo,Nt.some=$e,Nt.sortedIndex=function(n,t,r,e){var u=ne(r);
|
||||
return u===er&&null==r?Nr(n,t):Ur(n,t,u(r,e,1))},Nt.sortedLastIndex=function(n,t,r,e){var u=ne(r);return u===er&&null==r?Nr(n,t,true):Ur(n,t,u(r,e,1),true)},Nt.startCase=qo,Nt.startsWith=function(n,t,r){return n=u(n),r=null==r?0:io(0>r?0:+r||0,n.length),n.lastIndexOf(t,r)==r},Nt.template=function(n,t,r){var e=Nt.templateSettings;r&&ie(n,t,r)&&(t=r=null),n=u(n),t=nr(nr({},r||t),e,Qt),r=nr(nr({},t.imports),e.imports,Qt);var o,i,f=$o(r),a=Sr(r,f),c=0;r=t.interpolate||At;var l="__p+='";r=Iu((t.escape||At).source+"|"+r.source+"|"+(r===vt?yt:At).source+"|"+(t.evaluate||At).source+"|$","g");
|
||||
var s="sourceURL"in t?"//# sourceURL="+t.sourceURL+"\n":"";if(n.replace(r,function(t,r,e,u,f,a){return e||(e=u),l+=n.slice(c,a).replace(Rt,p),r&&(o=true,l+="'+__e("+r+")+'"),f&&(i=true,l+="';"+f+";\n__p+='"),e&&(l+="'+((__t=("+e+"))==null?'':__t)+'"),c=a+t.length,t}),l+="';",(t=t.variable)||(l="with(obj){"+l+"}"),l=(i?l.replace(ft,""):l).replace(at,"$1").replace(ct,"$1;"),l="function("+(t||"obj")+"){"+(t?"":"obj||(obj={});")+"var __t,__p=''"+(o?",__e=_.escape":"")+(i?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}",t=_u(function(){return ju(f,s+"return "+l).apply(b,a)
|
||||
}),t.source=l,Xe(t))throw t;return t},Nt.trim=pu,Nt.trimLeft=function(n,t,r){var e=n;return(n=u(n))?n.slice((r?ie(e,t,r):null==t)?y(n):i(n,t+"")):n},Nt.trimRight=function(n,t,r){var e=n;return(n=u(n))?(r?ie(e,t,r):null==t)?n.slice(0,d(n)+1):n.slice(0,f(n,t+"")+1):n},Nt.trunc=function(n,t,r){r&&ie(n,t,r)&&(t=null);var e=S;if(r=W,null!=t)if(He(t)){var o="separator"in t?t.separator:o,e="length"in t?+t.length||0:e;r="omission"in t?u(t.omission):r}else e=+t||0;if(n=u(n),e>=n.length)return n;if(e-=r.length,1>e)return r;
|
||||
if(t=n.slice(0,e),null==o)return t+r;if(tu(o)){if(n.slice(e).search(o)){var i,f=n.slice(0,e);for(o.global||(o=Iu(o.source,(dt.exec(o)||"")+"g")),o.lastIndex=0;n=o.exec(f);)i=n.index;t=t.slice(0,null==i?e:i)}}else n.indexOf(o,e)!=e&&(o=t.lastIndexOf(o),-1<o&&(t=t.slice(0,o)));return t+r},Nt.unescape=function(n){return(n=u(n))&&pt.test(n)?n.replace(lt,m):n},Nt.uniqueId=function(n){var t=++Lu;return u(n)+t},Nt.words=hu,Nt.all=Re,Nt.any=$e,Nt.contains=Se,Nt.detect=Oe,Nt.foldl=Ne,Nt.foldr=Ue,Nt.head=me,Nt.include=Se,Nt.inject=Ne,mu(Nt,function(){var n={};
|
||||
return vr(Nt,function(t,r){Nt.prototype[r]||(n[r]=t)}),n}(),false),Nt.sample=Fe,Nt.prototype.sample=function(n){return this.__chain__||null!=n?this.thru(function(t){return Fe(t,n)}):Fe(this.value())},Nt.VERSION=x,Pt("bind bindKey curry curryRight partial partialRight".split(" "),function(n){Nt[n].placeholder=Nt}),Pt(["filter","map","takeWhile"],function(n,t){var r=t==F,e=t==$;Lt.prototype[n]=function(n,u){var o=this.clone(),i=o.__filtered__,f=o.__iteratees__||(o.__iteratees__=[]);return o.__filtered__=i||r||e&&0>o.__dir__,f.push({iteratee:ne(n,u,3),type:t}),o
|
||||
}}),Pt(["drop","take"],function(n,t){var r="__"+n+"Count__",e=n+"While";Lt.prototype[n]=function(e){e=null==e?1:oo(Ku(e)||0,0);var u=this.clone();if(u.__filtered__){var o=u[r];u[r]=t?io(o,e):o+e}else(u.__views__||(u.__views__=[])).push({size:e,type:n+(0>u.__dir__?"Right":"")});return u},Lt.prototype[n+"Right"]=function(t){return this.reverse()[n](t).reverse()},Lt.prototype[n+"RightWhile"]=function(n,t){return this.reverse()[e](n,t).reverse()}}),Pt(["first","last"],function(n,t){var r="take"+(t?"Right":"");
|
||||
Lt.prototype[n]=function(){return this[r](1).value()[0]}}),Pt(["initial","rest"],function(n,t){var r="drop"+(t?"":"Right");Lt.prototype[n]=function(){return this[r](1)}}),Pt(["pluck","where"],function(n,t){var r=t?"filter":"map",e=t?Ar:Er;Lt.prototype[n]=function(n){return this[r](e(n))}}),Lt.prototype.compact=function(){return this.filter(yu)},Lt.prototype.dropWhile=function(n,t){var r;return n=ne(n,t,3),this.filter(function(t,e,u){return r||(r=!n(t,e,u))})},Lt.prototype.reject=function(n,t){return n=ne(n,t,3),this.filter(function(t,r,e){return!n(t,r,e)
|
||||
})},Lt.prototype.slice=function(n,t){n=null==n?0:+n||0;var r=0>n?this.takeRight(-n):this.drop(n);return typeof t!="undefined"&&(t=+t||0,r=0>t?r.dropRight(-t):r.take(t-n)),r},Lt.prototype.toArray=function(){return this.drop(0)},vr(Lt.prototype,function(n,t){var r=Nt[t],e=/^(?:first|last)$/.test(t);Nt.prototype[t]=function(){function t(n){return n=[n],Yu.apply(n,o),r.apply(Nt,n)}var u=this.__wrapped__,o=arguments,i=this.__chain__,f=!!this.__actions__.length,a=u instanceof Lt,c=a&&!f;return e&&!i?c?n.call(u):r.call(Nt,this.value()):a||Wo(u)?(u=n.apply(c?u:new Lt(this),o),e||!f&&!u.__actions__||(u.__actions__||(u.__actions__=[])).push({func:Ee,args:[t],thisArg:Nt}),new Ft(u,i)):this.thru(t)
|
||||
}}),Pt("concat join pop push shift sort splice unshift".split(" "),function(n){var t=Tu[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:join|pop|shift)$/.test(n);Nt.prototype[n]=function(){var n=arguments;return e&&!this.__chain__?t.apply(this.value(),n):this[r](function(r){return t.apply(r,n)})}}),Lt.prototype.clone=function(){var n=this.__actions__,t=this.__iteratees__,r=this.__views__,e=new Lt(this.__wrapped__);return e.__actions__=n?qt(n):null,e.__dir__=this.__dir__,e.__dropCount__=this.__dropCount__,e.__filtered__=this.__filtered__,e.__iteratees__=t?qt(t):null,e.__takeCount__=this.__takeCount__,e.__views__=r?qt(r):null,e
|
||||
},Lt.prototype.reverse=function(){if(this.__filtered__){var n=new Lt(this);n.__dir__=-1,n.__filtered__=true}else n=this.clone(),n.__dir__*=-1;return n},Lt.prototype.value=function(){var n=this.__wrapped__.value();if(!Wo(n))return Wr(n,this.__actions__);var t,r=this.__dir__,e=0>r;t=n.length;for(var u=this.__views__,o=0,i=-1,f=u?u.length:0;++i<f;){var a=u[i],c=a.size;switch(a.type){case"drop":o+=c;break;case"dropRight":t-=c;break;case"take":t=io(t,o+c);break;case"takeRight":o=oo(o,t-c)}}t={start:o,end:t},i=t.start,f=t.end,t=f-i,u=this.__dropCount__,o=io(t,this.__takeCount__),e=e?f:i-1,f=(i=this.__iteratees__)?i.length:0,a=0,c=[];
|
||||
n:for(;t--&&a<o;){for(var e=e+r,l=-1,s=n[e];++l<f;){var p=i[l],h=p.iteratee(s,e,n),p=p.type;if(p==L)s=h;else if(!h){if(p==F)continue n;break n}}u?u--:c[a++]=s}return c},Nt.prototype.chain=function(){return ke(this)},Nt.prototype.commit=function(){return new Ft(this.value(),this.__chain__)},Nt.prototype.plant=function(n){for(var t,r=this;r instanceof Ut;){var e=ge(r);t?u.__wrapped__=e:t=e;var u=e,r=r.__wrapped__}return u.__wrapped__=n,t},Nt.prototype.reverse=function(){var n=this.__wrapped__;return n instanceof Lt?(this.__actions__.length&&(n=new Lt(this)),new Ft(n.reverse(),this.__chain__)):this.thru(function(n){return n.reverse()
|
||||
})},Nt.prototype.toString=function(){return this.value()+""},Nt.prototype.run=Nt.prototype.toJSON=Nt.prototype.valueOf=Nt.prototype.value=function(){return Wr(this.__wrapped__,this.__actions__)},Nt.prototype.collect=Nt.prototype.map,Nt.prototype.head=Nt.prototype.first,Nt.prototype.select=Nt.prototype.filter,Nt.prototype.tail=Nt.prototype.rest,Nt}var b,x="3.3.0",A=1,j=2,k=4,E=8,R=16,I=32,O=64,C=128,T=256,S=30,W="...",N=150,U=16,F=0,L=1,$=2,B="Expected a function",z="__lodash_placeholder__",D="[object Arguments]",M="[object Array]",q="[object Boolean]",P="[object Date]",K="[object Error]",V="[object Function]",Y="[object Number]",Z="[object Object]",G="[object RegExp]",J="[object String]",X="[object ArrayBuffer]",H="[object Float32Array]",Q="[object Float64Array]",nt="[object Int8Array]",tt="[object Int16Array]",rt="[object Int32Array]",et="[object Uint8Array]",ut="[object Uint8ClampedArray]",ot="[object Uint16Array]",it="[object Uint32Array]",ft=/\b__p\+='';/g,at=/\b(__p\+=)''\+/g,ct=/(__e\(.*?\)|\b__t\))\+'';/g,lt=/&(?:amp|lt|gt|quot|#39|#96);/g,st=/[&<>"'`]/g,pt=RegExp(lt.source),ht=RegExp(st.source),_t=/<%-([\s\S]+?)%>/g,gt=/<%([\s\S]+?)%>/g,vt=/<%=([\s\S]+?)%>/g,yt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,dt=/\w*$/,mt=/^\s*function[ \n\r\t]+\w/,wt=/^0[xX]/,bt=/^\[object .+?Constructor\]$/,xt=/[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g,At=/($^)/,jt=/[.*+?^${}()|[\]\/\\]/g,kt=RegExp(jt.source),Et=/\bthis\b/,Rt=/['\n\r\u2028\u2029\\]/g,It=RegExp("[A-Z\\xc0-\\xd6\\xd8-\\xde]{2,}(?=[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"),Ot=" \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",Ct="Array ArrayBuffer Date Error Float32Array Float64Array Function Int8Array Int16Array Int32Array Math Number Object RegExp Set String _ clearTimeout document isFinite parseInt setTimeout TypeError Uint8Array Uint8ClampedArray Uint16Array Uint32Array WeakMap window WinRTError".split(" "),Tt={};
|
||||
Tt[H]=Tt[Q]=Tt[nt]=Tt[tt]=Tt[rt]=Tt[et]=Tt[ut]=Tt[ot]=Tt[it]=true,Tt[D]=Tt[M]=Tt[X]=Tt[q]=Tt[P]=Tt[K]=Tt[V]=Tt["[object Map]"]=Tt[Y]=Tt[Z]=Tt[G]=Tt["[object Set]"]=Tt[J]=Tt["[object WeakMap]"]=false;var St={};St[D]=St[M]=St[X]=St[q]=St[P]=St[H]=St[Q]=St[nt]=St[tt]=St[rt]=St[Y]=St[Z]=St[G]=St[J]=St[et]=St[ut]=St[ot]=St[it]=true,St[K]=St[V]=St["[object Map]"]=St["[object Set]"]=St["[object WeakMap]"]=false;var Wt={leading:false,maxWait:0,trailing:false},Nt={"\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"},Ut={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},Ft={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},Lt={"function":true,object:true},$t={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Bt=Lt[typeof window]&&window!==(this&&this.window)?window:this,zt=Lt[typeof exports]&&exports&&!exports.nodeType&&exports,Lt=Lt[typeof module]&&module&&!module.nodeType&&module,Dt=zt&&Lt&&typeof global=="object"&&global;
|
||||
!Dt||Dt.global!==Dt&&Dt.window!==Dt&&Dt.self!==Dt||(Bt=Dt);var Dt=Lt&&Lt.exports===zt&&zt,Mt=w();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(Bt._=Mt, define(function(){return Mt})):zt&&Lt?Dt?(Lt.exports=Mt)._=Mt:zt._=Mt:Bt._=Mt}).call(this);
|
||||
11657
lodash.src.js
Normal file
11657
lodash.src.js
Normal file
File diff suppressed because it is too large
Load Diff
55
package.json
55
package.json
@@ -1,58 +1,29 @@
|
||||
{
|
||||
"name": "lodash",
|
||||
"version": "2.2.1",
|
||||
"description": "A utility library delivering consistency, customization, performance, & extras.",
|
||||
"homepage": "http://lodash.com/",
|
||||
"license": "MIT",
|
||||
"main": "dist/lodash.js",
|
||||
"keywords": ["amd", "browser", "client", "customize", "functional", "server", "util"],
|
||||
"author": "John-David Dalton <john.david.dalton@gmail.com> (http://allyoucanleet.com/)",
|
||||
"contributors": [
|
||||
"John-David Dalton <john.david.dalton@gmail.com> (http://allyoucanleet.com/)",
|
||||
"Blaine Bublitz <blaine@iceddev.com> (http://iceddev.com/)",
|
||||
"Kit Cambridge <github@kitcambridge.be> (http://kitcambridge.be/)",
|
||||
"Mathias Bynens <mathias@qiwi.be> (http://mathiasbynens.be/)"
|
||||
],
|
||||
"bugs": "https://github.com/lodash/lodash/issues",
|
||||
"repository": { "type": "git", "url": "https://github.com/lodash/lodash.git" },
|
||||
"engines": ["node", "rhino"],
|
||||
"files": [
|
||||
"LICENSE.txt",
|
||||
"lodash.js",
|
||||
"dist/lodash.js",
|
||||
"dist/lodash.min.js",
|
||||
"dist/lodash.compat.js",
|
||||
"dist/lodash.compat.min.js",
|
||||
"dist/lodash.underscore.js",
|
||||
"dist/lodash.underscore.min.js"
|
||||
],
|
||||
"jam": {
|
||||
"main": "dist/lodash.compat.js",
|
||||
"include": [
|
||||
"LICENSE.txt",
|
||||
"dist/lodash.js",
|
||||
"dist/lodash.min.js",
|
||||
"dist/lodash.compat.js",
|
||||
"dist/lodash.compat.min.js",
|
||||
"dist/lodash.underscore.js",
|
||||
"dist/lodash.underscore.min.js"
|
||||
]
|
||||
"version": "3.3.0",
|
||||
"main": "lodash.src.js",
|
||||
"private": true,
|
||||
"devDependencies": {
|
||||
"curl-amd": "0.8.12",
|
||||
"dojo": "~1.10.0",
|
||||
"jquery": "~1.11.0",
|
||||
"platform": "~1.3.0",
|
||||
"qunit-extras": "~1.4.0",
|
||||
"qunitjs": "~1.17.0",
|
||||
"requirejs": "~2.1.0"
|
||||
},
|
||||
"volo": {
|
||||
"type": "directory",
|
||||
"ignore": [
|
||||
".*",
|
||||
"*.custom.*",
|
||||
"*.min.*",
|
||||
"*.template.*",
|
||||
"*.log",
|
||||
"*.map",
|
||||
"*.md",
|
||||
"lodash.js",
|
||||
"index.js",
|
||||
"lodash.src.js",
|
||||
"bower.json",
|
||||
"component.json",
|
||||
"doc",
|
||||
"modularize",
|
||||
"node_modules",
|
||||
"perf",
|
||||
"test",
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
;(function(window) {
|
||||
'use strict';
|
||||
|
||||
/** The base path of the builds */
|
||||
/** The base path of the lodash builds. */
|
||||
var basePath = '../';
|
||||
|
||||
/** The Lo-Dash build to load */
|
||||
/** The lodash build to load. */
|
||||
var build = (build = /build=([^&]+)/.exec(location.search)) && decodeURIComponent(build[1]);
|
||||
|
||||
/** The other library to load */
|
||||
/** The other library to load. */
|
||||
var other = (other = /other=([^&]+)/.exec(location.search)) && decodeURIComponent(other[1]);
|
||||
|
||||
/** The `ui` object */
|
||||
/** The `ui` object. */
|
||||
var ui = {};
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
@@ -34,49 +34,7 @@
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
// expose `ui.urlParams` properties
|
||||
ui.urlParams = {
|
||||
'build': build,
|
||||
'other': other
|
||||
};
|
||||
|
||||
// expose Lo-Dash build file path
|
||||
ui.buildPath = (function() {
|
||||
var result;
|
||||
switch (build) {
|
||||
case 'lodash-compat': result = 'dist/lodash.compat.min.js'; break;
|
||||
case 'lodash-legacy': result = 'dist/lodash.legacy.min.js'; break;
|
||||
case 'lodash-mobile': result = 'dist/lodash.mobile.min.js'; break;
|
||||
case 'lodash-underscore': result = 'dist/lodash.underscore.min.js'; break;
|
||||
case 'lodash-custom-dev': result = 'lodash.custom.js'; break;
|
||||
case 'lodash-custom': result = 'lodash.custom.min.js'; break;
|
||||
case 'lodash-modern':
|
||||
case null: result = 'dist/lodash.min.js'; break;
|
||||
default: return build;
|
||||
}
|
||||
return basePath + result;
|
||||
}());
|
||||
|
||||
// expose other library file path
|
||||
ui.otherPath = (function() {
|
||||
var result;
|
||||
switch (other) {
|
||||
case 'lodash-compat': result = 'dist/lodash.compat.min.js'; break;
|
||||
case 'lodash-legacy': result = 'dist/lodash.legacy.min.js'; break;
|
||||
case 'lodash-mobile': result = 'dist/lodash.mobile.min.js'; break;
|
||||
case 'lodash-modern': result = 'dist/lodash.min.js'; break;
|
||||
case 'lodash-underscore': result = 'dist/lodash.underscore.min.js'; break;
|
||||
case 'lodash-custom-dev': result = 'lodash.custom.js'; break;
|
||||
case 'lodash-custom': result = 'lodash.custom.min.js'; break;
|
||||
case 'underscore-dev': result = 'vendor/underscore/underscore.js'; break;
|
||||
case 'underscore':
|
||||
case null: result = 'vendor/underscore/underscore-min.js'; break;
|
||||
default: return other;
|
||||
}
|
||||
return basePath + result;
|
||||
}());
|
||||
|
||||
// initialize controls
|
||||
// Initialize controls.
|
||||
addListener(window, 'load', function() {
|
||||
function eventHandler(event) {
|
||||
var buildIndex = buildList.selectedIndex,
|
||||
@@ -100,13 +58,10 @@
|
||||
span1.innerHTML =
|
||||
'<label for="perf-build">Build: </label>' +
|
||||
'<select id="perf-build">' +
|
||||
'<option value="lodash-compat">Lo-Dash (compat)</option>' +
|
||||
'<option value="lodash-legacy">Lo-Dash (legacy)</option>' +
|
||||
'<option value="lodash-mobile">Lo-Dash (mobile)</option>' +
|
||||
'<option value="lodash-modern">Lo-Dash (modern)</option>' +
|
||||
'<option value="lodash-underscore">Lo-Dash (underscore)</option>' +
|
||||
'<option value="lodash-custom-dev">Lo-Dash (custom development)</option>' +
|
||||
'<option value="lodash-custom">Lo-Dash (custom 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>' +
|
||||
'</select>';
|
||||
|
||||
var span2 = document.createElement('span');
|
||||
@@ -116,13 +71,10 @@
|
||||
'<select id="perf-other">' +
|
||||
'<option value="underscore-dev">Underscore (development)</option>' +
|
||||
'<option value="underscore">Underscore (production)</option>' +
|
||||
'<option value="lodash-compat">Lo-Dash (compat)</option>' +
|
||||
'<option value="lodash-legacy">Lo-Dash (legacy)</option>' +
|
||||
'<option value="lodash-mobile">Lo-Dash (mobile)</option>' +
|
||||
'<option value="lodash-modern">Lo-Dash (modern)</option>' +
|
||||
'<option value="lodash-underscore">Lo-Dash (underscore)</option>' +
|
||||
'<option value="lodash-custom-dev">Lo-Dash (custom development)</option>' +
|
||||
'<option value="lodash-custom">Lo-Dash (custom 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>' +
|
||||
'</select>';
|
||||
|
||||
var buildList = span1.lastChild,
|
||||
@@ -135,13 +87,10 @@
|
||||
buildList.selectedIndex = (function() {
|
||||
switch (build) {
|
||||
case 'lodash-compat': return 0;
|
||||
case 'lodash-legacy': return 1;
|
||||
case 'lodash-mobile': return 2;
|
||||
case 'lodash-underscore': return 4;
|
||||
case 'lodash-custom-dev': return 5;
|
||||
case 'lodash-custom': return 6;
|
||||
case 'lodash-custom-dev': return 2;
|
||||
case 'lodash-custom': return 3;
|
||||
case 'lodash-modern':
|
||||
case null: return 3;
|
||||
case null: return 1;
|
||||
}
|
||||
return -1;
|
||||
}());
|
||||
@@ -150,12 +99,9 @@
|
||||
switch (other) {
|
||||
case 'underscore-dev': return 0;
|
||||
case 'lodash-compat': return 2;
|
||||
case 'lodash-legacy': return 3;
|
||||
case 'lodash-mobile': return 4;
|
||||
case 'lodash-modern': return 5;
|
||||
case 'lodash-underscore': return 6;
|
||||
case 'lodash-custom-dev': return 7;
|
||||
case 'lodash-custom': return 8;
|
||||
case 'lodash-modern': return 3;
|
||||
case 'lodash-custom-dev': return 4;
|
||||
case 'lodash-custom': return 5;
|
||||
case 'underscore':
|
||||
case null: return 1;
|
||||
}
|
||||
@@ -166,7 +112,38 @@
|
||||
addListener(otherList, 'change', eventHandler);
|
||||
});
|
||||
|
||||
// expose `ui`
|
||||
// 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;
|
||||
default: return build;
|
||||
}
|
||||
return basePath + result;
|
||||
}());
|
||||
|
||||
// The other library file path.
|
||||
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 'underscore-dev': result = 'vendor/underscore/underscore.js'; break;
|
||||
case null: other = 'underscore';
|
||||
case 'underscore': result = 'vendor/underscore/underscore-min.js'; break;
|
||||
default: return other;
|
||||
}
|
||||
return basePath + result;
|
||||
}());
|
||||
|
||||
ui.urlParams = { 'build': build, 'other': other };
|
||||
|
||||
window.ui = ui;
|
||||
|
||||
}(this));
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Lo-Dash Performance Suite</title>
|
||||
<title>lodash Performance Suite</title>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
@@ -28,11 +28,11 @@
|
||||
</head>
|
||||
<body>
|
||||
<div id="perf-toolbar"></div>
|
||||
<script src="../vendor/platform.js/platform.js"></script>
|
||||
<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="../vendor/firebug-lite/src/firebug-lite-debug.js"></script>
|
||||
<script src="perf-ui.js"></script>
|
||||
<script src="./asset/perf-ui.js"></script>
|
||||
<script>
|
||||
document.write('<script src="' + ui.buildPath + '"><\/script>');
|
||||
</script>
|
||||
@@ -69,8 +69,8 @@
|
||||
// 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')) {
|
||||
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>');
|
||||
}
|
||||
|
||||
901
perf/perf.js
901
perf/perf.js
File diff suppressed because it is too large
Load Diff
@@ -1,12 +1,12 @@
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
echo "Running performance suite in node..."
|
||||
node perf.js ../dist/lodash.js && node perf.js ../dist/lodash.min.js
|
||||
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 ../dist/lodash.compat.js && $cmd perf.js ../dist/lodash.compat.min.js
|
||||
$cmd perf.js ../lodash.src.js
|
||||
done
|
||||
|
||||
echo ""
|
||||
|
||||
146
test/asset/set.js
Normal file
146
test/asset/set.js
Normal file
@@ -0,0 +1,146 @@
|
||||
;(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');
|
||||
|
||||
/** Used as a reference to the global object. */
|
||||
var root = (objectTypes[typeof window] && window) || this;
|
||||
|
||||
/** Detect free variable `exports`. */
|
||||
var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports;
|
||||
|
||||
/** Detect free variable `global` from Node.js or Browserified code and use it as `root`. */
|
||||
var freeGlobal = objectTypes[typeof global] && global;
|
||||
if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal)) {
|
||||
root = freeGlobal;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* 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));
|
||||
@@ -1,16 +1,16 @@
|
||||
;(function(window) {
|
||||
'use strict';
|
||||
|
||||
/** The base path of the builds */
|
||||
/** The base path of the lodash builds. */
|
||||
var basePath = '../';
|
||||
|
||||
/** The Lo-Dash build to load */
|
||||
/** The lodash build to load. */
|
||||
var build = (build = /build=([^&]+)/.exec(location.search)) && decodeURIComponent(build[1]);
|
||||
|
||||
/** The module loader to use */
|
||||
/** The module loader to use. */
|
||||
var loader = (loader = /loader=([^&]+)/.exec(location.search)) && decodeURIComponent(loader[1]);
|
||||
|
||||
/** The `ui` object */
|
||||
/** The `ui` object. */
|
||||
var ui = {};
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
@@ -34,48 +34,7 @@
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
// expose `ui.urlParams` properties
|
||||
ui.urlParams = {
|
||||
'build': build,
|
||||
'loader': loader
|
||||
};
|
||||
|
||||
// expose Lo-Dash build file path
|
||||
ui.buildPath = (function() {
|
||||
var result;
|
||||
switch (build) {
|
||||
case 'lodash-compat': result = 'dist/lodash.compat.min.js'; break;
|
||||
case 'lodash-modern-dev': result = 'dist/lodash.js'; break;
|
||||
case 'lodash-modern': result = 'dist/lodash.min.js'; break;
|
||||
case 'lodash-legacy': result = 'dist/lodash.legacy.min.js'; break;
|
||||
case 'lodash-mobile': result = 'dist/lodash.mobile.min.js'; break;
|
||||
case 'lodash-underscore': result = 'dist/lodash.underscore.min.js'; break;
|
||||
case 'lodash-custom-dev': result = 'lodash.custom.js'; break;
|
||||
case 'lodash-custom': result = 'lodash.custom.min.js'; break;
|
||||
case 'lodash-compat-dev':
|
||||
case null: result = 'lodash.js'; break;
|
||||
default: return build;
|
||||
}
|
||||
return basePath + result;
|
||||
}());
|
||||
|
||||
// expose module loader file path
|
||||
ui.loaderPath = (function() {
|
||||
var result;
|
||||
switch (loader) {
|
||||
case 'curl': result = 'vendor/curl/dist/curl-kitchen-sink/curl.js'; break;
|
||||
case 'dojo': result = 'vendor/dojo/dojo.js'; break;
|
||||
case 'requirejs':
|
||||
case null: result = 'vendor/requirejs/require.js'; break;
|
||||
default: return loader;
|
||||
}
|
||||
return basePath + result;
|
||||
}());
|
||||
|
||||
// used to indicate testing a modularized build
|
||||
ui.isModularize = /\b(?:commonjs|(index|main)\.js|lodash-(?:amd|node)|modularize|npm)\b/.test([location.pathname, location.search, ui.buildPath]);
|
||||
|
||||
// initialize controls
|
||||
// Initialize controls.
|
||||
addListener(window, 'load', function() {
|
||||
function eventHandler(event) {
|
||||
var buildIndex = buildList.selectedIndex,
|
||||
@@ -96,43 +55,39 @@
|
||||
|
||||
function init() {
|
||||
var toolbar = document.getElementById('qunit-testrunner-toolbar');
|
||||
if (toolbar) {
|
||||
toolbar.appendChild(span1);
|
||||
toolbar.appendChild(span2);
|
||||
|
||||
buildList.selectedIndex = (function() {
|
||||
switch (build) {
|
||||
case 'lodash-compat': return 1;
|
||||
case 'lodash-modern-dev': return 2;
|
||||
case 'lodash-modern': return 3;
|
||||
case 'lodash-legacy': return 4;
|
||||
case 'lodash-mobile': return 5;
|
||||
case 'lodash-underscore': return 6;
|
||||
case 'lodash-custom-dev': return 7;
|
||||
case 'lodash-custom': return 8;
|
||||
case 'lodash-compat-dev':
|
||||
case null: return 0;
|
||||
}
|
||||
return -1;
|
||||
}());
|
||||
|
||||
loaderList.selectedIndex = (function() {
|
||||
switch (loader) {
|
||||
case 'none': return 0
|
||||
case 'curl': return 1;
|
||||
case 'dojo': return 2;
|
||||
case 'requirejs':
|
||||
case null: return 3;
|
||||
}
|
||||
return -1;
|
||||
}());
|
||||
|
||||
addListener(buildList, 'change', eventHandler);
|
||||
addListener(loaderList, 'change', eventHandler);
|
||||
}
|
||||
else {
|
||||
if (!toolbar) {
|
||||
setTimeout(init, 15);
|
||||
return;
|
||||
}
|
||||
toolbar.appendChild(span1);
|
||||
toolbar.appendChild(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 null: return 0;
|
||||
}
|
||||
return -1;
|
||||
}());
|
||||
|
||||
loaderList.selectedIndex = (function() {
|
||||
switch (loader) {
|
||||
case 'curl': return 1;
|
||||
case 'dojo': return 2;
|
||||
case 'requirejs': return 3;
|
||||
case 'none':
|
||||
case null: return 0;
|
||||
}
|
||||
return -1;
|
||||
}());
|
||||
|
||||
addListener(buildList, 'change', eventHandler);
|
||||
addListener(loaderList, 'change', eventHandler);
|
||||
}
|
||||
|
||||
var span1 = document.createElement('span');
|
||||
@@ -140,15 +95,12 @@
|
||||
span1.innerHTML =
|
||||
'<label for="qunit-build">Build: </label>' +
|
||||
'<select id="qunit-build">' +
|
||||
'<option value="lodash-compat-dev">Lo-Dash (compat development)</option>' +
|
||||
'<option value="lodash-compat">Lo-Dash (compat production)</option>' +
|
||||
'<option value="lodash-modern-dev">Lo-Dash (modern development)</option>' +
|
||||
'<option value="lodash-modern">Lo-Dash (modern production)</option>' +
|
||||
'<option value="lodash-legacy">Lo-Dash (legacy)</option>' +
|
||||
'<option value="lodash-mobile">Lo-Dash (mobile)</option>' +
|
||||
'<option value="lodash-underscore">Lo-Dash (underscore)</option>' +
|
||||
'<option value="lodash-custom-dev">Lo-Dash (custom development)</option>' +
|
||||
'<option value="lodash-custom">Lo-Dash (custom production)</option>' +
|
||||
'<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>' +
|
||||
'</select>';
|
||||
|
||||
var span2 = document.createElement('span');
|
||||
@@ -165,10 +117,57 @@
|
||||
var buildList = span1.lastChild,
|
||||
loaderList = span2.lastChild;
|
||||
|
||||
setTimeout(function() {
|
||||
ui.timing.loadEventEnd = +new Date;
|
||||
}, 1);
|
||||
|
||||
init();
|
||||
});
|
||||
|
||||
// expose `ui`
|
||||
// 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;
|
||||
default: return build;
|
||||
}
|
||||
return basePath + result;
|
||||
}());
|
||||
|
||||
// The module loader file path.
|
||||
ui.loaderPath = (function() {
|
||||
var result;
|
||||
switch (loader) {
|
||||
case 'curl': result = 'node_modules/curl-amd/dist/curl-kitchen-sink/curl.js'; break;
|
||||
case 'dojo': result = 'node_modules/dojo/dojo.js'; break;
|
||||
case 'requirejs': result = 'node_modules/requirejs/require.js'; break;
|
||||
case null: loader = 'none'; return '';
|
||||
default: return loader;
|
||||
}
|
||||
return basePath + result;
|
||||
}());
|
||||
|
||||
ui.urlParams = { 'build': build, 'loader': loader };
|
||||
ui.timing = { 'loadEventEnd': 0 };
|
||||
|
||||
window.ui = ui;
|
||||
|
||||
}(this));
|
||||
|
||||
91
test/asset/weakmap.js
Normal file
91
test/asset/weakmap.js
Normal file
@@ -0,0 +1,91 @@
|
||||
;(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');
|
||||
|
||||
/** Used as a reference to the global object. */
|
||||
var root = (objectTypes[typeof window] && window) || this;
|
||||
|
||||
/** Detect free variable `exports`. */
|
||||
var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports;
|
||||
|
||||
/** Detect free variable `global` from Node.js or Browserified code and use it as `root`. */
|
||||
var freeGlobal = objectTypes[typeof global] && global;
|
||||
if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal)) {
|
||||
root = freeGlobal;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* 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));
|
||||
@@ -1,6 +1,12 @@
|
||||
self.console || (self.console = { 'log': function() {} });
|
||||
|
||||
addEventListener('message', function(e) {
|
||||
if (e.data) {
|
||||
importScripts('../' + e.data);
|
||||
try {
|
||||
importScripts('../' + e.data);
|
||||
} catch(e) {
|
||||
self._ = { 'VERSION': e.message };
|
||||
}
|
||||
postMessage(_.VERSION);
|
||||
}
|
||||
}, false);
|
||||
|
||||
@@ -3,46 +3,139 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Backbone Test Suite</title>
|
||||
<link rel="stylesheet" href="../vendor/qunit/qunit/qunit.css">
|
||||
<style>
|
||||
body > #qunit-header {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
<link rel="stylesheet" href="../node_modules/qunitjs/qunit/qunit.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="qunit"></div>
|
||||
<h1 id="qunit-header"></h1>
|
||||
<div id="qunit-fixture">
|
||||
<div id='testElement'>
|
||||
<h1>Test</h1>
|
||||
</div>
|
||||
</div>
|
||||
<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="../node_modules/qunitjs/qunit/qunit.js"></script>
|
||||
<script src="../node_modules/qunit-extras/qunit-extras.js"></script>
|
||||
<script src="../vendor/json-js/json2.js"></script>
|
||||
<script src="../vendor/jquery/jquery.js"></script>
|
||||
<script src="../vendor/platform.js/platform.js"></script>
|
||||
<script src="../vendor/qunit/qunit/qunit.js"></script>
|
||||
<script src="../node_modules/platform/platform.js"></script>
|
||||
<script src="./asset/test-ui.js"></script>
|
||||
<script src="../lodash.js"></script>
|
||||
<script src="../lodash.src.js"></script>
|
||||
<script>
|
||||
var lodash = _.noConflict();
|
||||
document.write('<script src="' + ui.buildPath + '"><\/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 lodash
|
||||
if (!ui.isModularize) {
|
||||
document.write('<script src="' + ui.buildPath + '"><\/script>');
|
||||
}
|
||||
// load test scripts
|
||||
document.write(ui.urlParams.loader != 'none'
|
||||
? '<script data-dojo-config="async:1" src="' + ui.loaderPath + '"><\/script>'
|
||||
: ([
|
||||
'<script src="' + ui.buildPath + '"><\/script>',
|
||||
'<script src="../node_modules/jquery/dist/jquery.js"><\/script>',
|
||||
'<script src="../vendor/backbone/backbone.js"><\/script>',
|
||||
'<script src="../vendor/backbone/test/environment.js"><\/script>',
|
||||
'<script src="../vendor/backbone/test/noconflict.js"><\/script>',
|
||||
'<script src="../vendor/backbone/test/events.js"><\/script>',
|
||||
'<script src="../vendor/backbone/test/model.js"><\/script>',
|
||||
'<script src="../vendor/backbone/test/collection.js"><\/script>',
|
||||
'<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'))
|
||||
);
|
||||
</script>
|
||||
<script>
|
||||
_.mixin({
|
||||
'debounce': _.debounce || lodash.debounce,
|
||||
'defer': _.defer || lodash.defer,
|
||||
'pluck': _.pluck || lodash.pluck
|
||||
});
|
||||
(function() {
|
||||
if (window.curl) {
|
||||
curl.config({ 'apiName': 'require' });
|
||||
}
|
||||
if (!window.require) {
|
||||
mixinPrereqs(_);
|
||||
return;
|
||||
}
|
||||
var reBasename = /[\w.-]+$/,
|
||||
basePath = ('//' + location.host + location.pathname.replace(reBasename, '')).replace(/\btest\/$/, ''),
|
||||
modulePath = ui.buildPath.replace(/\.js$/, ''),
|
||||
locationPath = modulePath.replace(reBasename, '').replace(/^\/|\/$/g, ''),
|
||||
moduleMain = modulePath.match(reBasename)[0],
|
||||
uid = +new Date;
|
||||
|
||||
function getConfig() {
|
||||
var result = {
|
||||
'baseUrl': './',
|
||||
'urlArgs': 't=' + uid++,
|
||||
'waitSeconds': 0,
|
||||
'paths': {
|
||||
'backbone': '../vendor/backbone/backbone',
|
||||
'jquery': '../node_modules/jquery/dist/jquery'
|
||||
},
|
||||
'packages': [{
|
||||
'name': 'test',
|
||||
'location': '../vendor/backbone/test',
|
||||
'config': {
|
||||
// work around no global being exported
|
||||
'exports': 'QUnit',
|
||||
'loader': 'curl/loader/legacy'
|
||||
}
|
||||
}]
|
||||
};
|
||||
|
||||
if (ui.isModularize) {
|
||||
result.packages.push({
|
||||
'name': 'underscore',
|
||||
'location': locationPath,
|
||||
'main': moduleMain
|
||||
});
|
||||
} else {
|
||||
result.paths.underscore = modulePath;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
QUnit.config.autostart = false;
|
||||
|
||||
require(getConfig(), ['underscore', 'backbone'], function(lodash) {
|
||||
mixinPrereqs(lodash);
|
||||
|
||||
if (ui.isModularize) {
|
||||
window._ = lodash;
|
||||
}
|
||||
require(getConfig(), [
|
||||
'test/environment',
|
||||
'test/noconflict',
|
||||
'test/events',
|
||||
'test/model',
|
||||
'test/collection',
|
||||
'test/router',
|
||||
'test/view',
|
||||
'test/sync'
|
||||
], function() {
|
||||
QUnit.start();
|
||||
});
|
||||
});
|
||||
}());
|
||||
</script>
|
||||
<script src="../vendor/backbone/backbone.js"></script>
|
||||
<script src="../vendor/backbone/test/environment.js"></script>
|
||||
<script src="../vendor/backbone/test/noconflict.js"></script>
|
||||
<script src="../vendor/backbone/test/events.js"></script>
|
||||
<script src="../vendor/backbone/test/model.js"></script>
|
||||
<script src="../vendor/backbone/test/collection.js"></script>
|
||||
<script src="../vendor/backbone/test/router.js"></script>
|
||||
<script src="../vendor/backbone/test/view.js"></script>
|
||||
<script src="../vendor/backbone/test/sync.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
443
test/index.html
443
test/index.html
@@ -2,8 +2,8 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Lo-Dash Test Suite</title>
|
||||
<link rel="stylesheet" href="../vendor/qunit/qunit/qunit.css">
|
||||
<title>lodash Test Suite</title>
|
||||
<link rel="stylesheet" href="../node_modules/qunitjs/qunit/qunit.css">
|
||||
<style>
|
||||
#exports {
|
||||
display: none;
|
||||
@@ -11,73 +11,258 @@
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<script src="../vendor/qunit/qunit/qunit.js"></script>
|
||||
<script src="../vendor/platform.js/platform.js"></script>
|
||||
<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="../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>
|
||||
<script>
|
||||
// set bad shims
|
||||
Array._isArray = Array.isArray;
|
||||
Array.isArray = function() { return false; };
|
||||
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.prototype._bind = Function.prototype.bind;
|
||||
Function.prototype.bind = function() { return function() {}; };
|
||||
function addBizarroMethods() {
|
||||
var funcProto = Function.prototype,
|
||||
objectProto = Object.prototype,
|
||||
stringProto = String.prototype;
|
||||
|
||||
Object._create = Object.create;
|
||||
Object.create = function() {};
|
||||
var hasOwnProperty = objectProto.hasOwnProperty,
|
||||
fnToString = funcProto.toString,
|
||||
nativeString = fnToString.call(objectProto.toString),
|
||||
noop = function() {},
|
||||
propertyIsEnumerable = objectProto.propertyIsEnumerable,
|
||||
reToString = /toString/g,
|
||||
whitespace = ' \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';
|
||||
|
||||
Object._defineProperty = Object.defineProperty;
|
||||
Object.defineProperty = function() {};
|
||||
function constant(value) {
|
||||
return function() {
|
||||
return value;
|
||||
};
|
||||
}
|
||||
function createToString(funcName) {
|
||||
return constant(nativeString.replace(reToString, funcName));
|
||||
}
|
||||
// allow bypassing native checks
|
||||
setProperty(funcProto, 'toString', (function() {
|
||||
function wrapper() {
|
||||
setProperty(funcProto, 'toString', fnToString);
|
||||
var result = hasOwnProperty.call(this, 'toString') ? this.toString() : fnToString.call(this);
|
||||
setProperty(funcProto, 'toString', wrapper);
|
||||
return result;
|
||||
}
|
||||
return wrapper;
|
||||
}()));
|
||||
|
||||
Object._keys = Object.keys;
|
||||
Object.keys = function() { return []; };
|
||||
// add extensions
|
||||
funcProto._method = noop;
|
||||
|
||||
// load Lo-Dash and expose it to the bad `Object.keys` shim
|
||||
document.write('<script src="' + (ui.isModularize ? '../lodash.js' : ui.buildPath) + '"><\/script>');
|
||||
// set bad shims
|
||||
setProperty(Array, '_isArray', Array.isArray);
|
||||
setProperty(Array, 'isArray', noop);
|
||||
|
||||
setProperty(Date, '_now', Date.now);
|
||||
setProperty(Date, 'now', noop);
|
||||
|
||||
setProperty(Object, '_getPrototypeOf', Object.getPrototypeOf);
|
||||
setProperty(Object, 'getPrototypeOf', noop);
|
||||
|
||||
setProperty(Object, '_keys', Object.keys);
|
||||
setProperty(Object, 'keys', noop);
|
||||
|
||||
setProperty(objectProto, '_propertyIsEnumerable', propertyIsEnumerable);
|
||||
setProperty(objectProto, 'propertyIsEnumerable', function(key) {
|
||||
if (key == '1' && this && typeof this == 'object' && this.length === 2 &&
|
||||
hasOwnProperty.call(this, 'callee') &&
|
||||
!propertyIsEnumerable.call(this, 'callee') &&
|
||||
this[0] === 0 && this[1] === 0) {
|
||||
throw new Error;
|
||||
}
|
||||
return propertyIsEnumerable.call(this, key);
|
||||
});
|
||||
|
||||
setProperty(Number, '_isFinite', Number.isFinite);
|
||||
setProperty(Number, 'isFinite', noop);
|
||||
|
||||
setProperty(window, '_ArrayBuffer', window.ArrayBuffer);
|
||||
if (window.ArrayBuffer && window.Uint8Array) {
|
||||
ArrayBuffer = (function(_ArrayBuffer) {
|
||||
function ArrayBuffer(byteLength) {
|
||||
var buffer = new _ArrayBuffer(byteLength);
|
||||
if (!byteLength) {
|
||||
setProperty(buffer, 'slice', buffer.slice ? null : bufferSlice);
|
||||
}
|
||||
return buffer;
|
||||
}
|
||||
function bufferSlice() {
|
||||
var newBuffer = new _ArrayBuffer(this.byteLength),
|
||||
view = new Uint8Array(newBuffer);
|
||||
|
||||
view.set(new Uint8Array(this));
|
||||
return newBuffer;
|
||||
}
|
||||
setProperty(ArrayBuffer, 'toString', createToString('ArrayBuffer'));
|
||||
setProperty(bufferSlice, 'toString', createToString('slice'));
|
||||
return ArrayBuffer;
|
||||
}(_ArrayBuffer));
|
||||
}
|
||||
if (!window.Float64Array && window.Uint8Array) {
|
||||
Float64Array = (function() {
|
||||
function Float64Array(buffer, byteOffset, length) {
|
||||
return arguments.length == 1
|
||||
? new Uint8Array(buffer)
|
||||
: new Uint8Array(buffer, byteOffset || 0, length || buffer.byteLength);
|
||||
}
|
||||
setProperty(Float64Array, 'BYTES_PER_ELEMENT', 8);
|
||||
setProperty(Float64Array, 'toString', createToString('Float64Array'));
|
||||
return Float64Array;
|
||||
}());
|
||||
}
|
||||
setProperty(window, '_Set', window.Set);
|
||||
setProperty(window, 'Set', noop);
|
||||
|
||||
setProperty(window, '_WeakMap', window.WeakMap);
|
||||
setProperty(window, 'WeakMap', noop);
|
||||
|
||||
setProperty(window, '_parseInt', parseInt);
|
||||
setProperty(window, 'parseInt', (function(_parseInt) {
|
||||
var checkStr = whitespace + '08',
|
||||
isFaked = _parseInt(checkStr) != 8,
|
||||
reHexPrefix = /^0[xX]/,
|
||||
reTrim = RegExp('^[' + whitespace + ']+|[' + whitespace + ']+$');
|
||||
|
||||
return function(value, radix) {
|
||||
if (value == checkStr && !isFaked) {
|
||||
isFaked = true;
|
||||
return 0;
|
||||
}
|
||||
value = String(value == null ? '' : value).replace(reTrim, '');
|
||||
return _parseInt(value, +radix || (reHexPrefix.test(value) ? 16 : 10));
|
||||
};
|
||||
}(_parseInt)));
|
||||
|
||||
// fake lack of DOM support
|
||||
setProperty(document, '_createDocumentFragment', document.createDocumentFragment);
|
||||
document.createDocumentFragment = noop;
|
||||
|
||||
// fake `WinRTError`
|
||||
setProperty(window, 'WinRTError', Error);
|
||||
|
||||
// fake free variable `global`
|
||||
setProperty(window, 'exports', window);
|
||||
setProperty(window, 'global', window);
|
||||
setProperty(window, 'module', {});
|
||||
}
|
||||
|
||||
function removeBizarroMethods() {
|
||||
var funcProto = Function.prototype,
|
||||
objectProto = Object.prototype,
|
||||
stringProto = String.prototype;
|
||||
|
||||
if (Array._isArray) {
|
||||
setProperty(Array, 'isArray', Array._isArray);
|
||||
} else {
|
||||
delete Array.isArray;
|
||||
}
|
||||
if (Date._now) {
|
||||
setProperty(Date, 'now', Date._now);
|
||||
} else {
|
||||
delete Date.now;
|
||||
}
|
||||
if (Object._getPrototypeOf) {
|
||||
setProperty(Object, 'getPrototypeOf', Object._getPrototypeOf);
|
||||
} else {
|
||||
delete Object.getPrototypeOf;
|
||||
}
|
||||
if (Object._keys) {
|
||||
setProperty(Object, 'keys', Object._keys);
|
||||
} else {
|
||||
delete Object.keys;
|
||||
}
|
||||
if (Number._isFinite) {
|
||||
setProperty(Number, 'isFinite', Number._isFinite);
|
||||
} else {
|
||||
delete Number.isFinite;
|
||||
}
|
||||
if (window._ArrayBuffer) {
|
||||
ArrayBuffer = _ArrayBuffer;
|
||||
}
|
||||
setProperty(window, '_ArrayBuffer', undefined);
|
||||
|
||||
if (window._Set) {
|
||||
Set = _Set;
|
||||
}
|
||||
setProperty(window, '_Set', undefined);
|
||||
|
||||
if (window._WeakMap) {
|
||||
WeakMap = _WeakMap;
|
||||
}
|
||||
setProperty(window, '_WeakMap', undefined);
|
||||
|
||||
setProperty(window, 'parseInt', window._parseInt);
|
||||
setProperty(window, '_parseInt', undefined);
|
||||
|
||||
document.createDocumentFragment = document._createDocumentFragment;
|
||||
setProperty(document, '_createDocumentFragment', undefined);
|
||||
|
||||
setProperty(window, 'WinRTError', undefined);
|
||||
|
||||
setProperty(window, 'exports', undefined);
|
||||
setProperty(window, 'global', undefined);
|
||||
setProperty(window, 'module', undefined);
|
||||
|
||||
setProperty(objectProto, 'propertyIsEnumerable', objectProto._propertyIsEnumerable);
|
||||
|
||||
delete Array._isArray;
|
||||
delete Date._now;
|
||||
delete funcProto._method;
|
||||
delete Object._create;
|
||||
delete Object._getPrototypeOf;
|
||||
delete Object._keys;
|
||||
delete objectProto._propertyIsEnumerable;
|
||||
}
|
||||
|
||||
// load lodash and expose it to the bad extensions/shims
|
||||
if (!ui.isModularize) {
|
||||
addBizarroMethods();
|
||||
document.write('<script src="' + ui.buildPath + '"><\/script>');
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
// store Lo-Dash to test for bad shim detection
|
||||
var lodashBadShim = window._;
|
||||
|
||||
// restore native methods
|
||||
if (Array._isArray) {
|
||||
Array.isArray = Array._isArray;
|
||||
} else {
|
||||
delete Array.isArray;
|
||||
// store lodash to test for bad extensions/shims
|
||||
if (!ui.isModularize) {
|
||||
var lodashBizarro = window._;
|
||||
window._ = undefined;
|
||||
removeBizarroMethods();
|
||||
}
|
||||
if (Function.prototype._bind) {
|
||||
Function.prototype.bind = Function.prototype._bind;
|
||||
} else {
|
||||
delete Function.prototype.bind;
|
||||
}
|
||||
if (Object._create) {
|
||||
Object.create = Object._create;
|
||||
} else {
|
||||
delete Object.create;
|
||||
}
|
||||
if (Object._defineProperty) {
|
||||
Object.defineProperty = Object._defineProperty;
|
||||
} else {
|
||||
delete Object.defineProperty;
|
||||
}
|
||||
if (Object._keys) {
|
||||
Object.keys = Object._keys;
|
||||
} else {
|
||||
delete Object.keys;
|
||||
}
|
||||
delete Array._isArray;
|
||||
delete Function.prototype._bind;
|
||||
delete Object._create;
|
||||
delete Object._defineProperty;
|
||||
delete Object._keys;
|
||||
|
||||
// load Lo-Dash again to overwrite the existing `_` value
|
||||
document.write('<script src="' + (ui.isModularize ? '../lodash.js' : ui.buildPath) + '"><\/script>');
|
||||
|
||||
// load test.js if not using require.js
|
||||
document.write(ui.urlParams.loader == 'none'
|
||||
? '<script src="test.js"><\/script>'
|
||||
// load test scripts
|
||||
document.write((ui.isForeign || ui.urlParams.loader == 'none')
|
||||
? '<script src="' + ui.buildPath + '"><\/script><script src="test.js"><\/script>'
|
||||
: '<script data-dojo-config="async:1" src="' + ui.loaderPath + '"><\/script>'
|
||||
);
|
||||
</script>
|
||||
@@ -90,74 +275,118 @@
|
||||
if (window.curl) {
|
||||
curl.config({ 'apiName': 'require' });
|
||||
}
|
||||
if (!window.require) {
|
||||
if (ui.isForeign || !window.require) {
|
||||
return;
|
||||
}
|
||||
var reBasename = /[\w.-]+$/,
|
||||
basePath = ('//' + location.host + location.pathname.replace(reBasename, '')).replace(/\btest\/$/, ''),
|
||||
modulePath = ui.buildPath.replace(/\.js$/, ''),
|
||||
locationPath = modulePath.replace(reBasename, ''),
|
||||
moduleMain = modulePath.match(reBasename)[0];
|
||||
moduleMain = modulePath.match(reBasename)[0],
|
||||
locationPath = modulePath.replace(reBasename, '').replace(/^\/|\/$/g, ''),
|
||||
shimmedLocationPath = './abc/../' + locationPath,
|
||||
underscoreLocationPath = './xyz/../' + locationPath,
|
||||
uid = +new Date;
|
||||
|
||||
QUnit.config.autostart = false;
|
||||
|
||||
// load Lo-Dash as a module
|
||||
require({
|
||||
'baseUrl': './',
|
||||
'urlArgs': 't=' + (+new Date),
|
||||
'packages': [
|
||||
{
|
||||
'name': 'lodash',
|
||||
'location': locationPath,
|
||||
'main': moduleMain
|
||||
},
|
||||
{
|
||||
'name': 'shimmed',
|
||||
'location': './abc/../' + locationPath,
|
||||
'main': moduleMain
|
||||
},
|
||||
{
|
||||
'name': 'underscore',
|
||||
'location': './xyz/../' + locationPath,
|
||||
'main': moduleMain
|
||||
},
|
||||
{
|
||||
function getConfig() {
|
||||
var result = {
|
||||
'baseUrl': './',
|
||||
'urlArgs': 't=' + uid++,
|
||||
'waitSeconds': 0,
|
||||
'paths': {},
|
||||
'packages': [{
|
||||
'name': 'test',
|
||||
'location': basePath + '/test',
|
||||
'location': basePath + 'test',
|
||||
'main': 'test',
|
||||
'config': {
|
||||
// work around no global being exported
|
||||
'exports': 'QUnit',
|
||||
'loader': 'curl/loader/legacy'
|
||||
}
|
||||
}],
|
||||
'shim': {
|
||||
'shimmed': {
|
||||
'exports': '_'
|
||||
}
|
||||
}
|
||||
],
|
||||
'shim': {
|
||||
'shimmed': {
|
||||
'exports': '_'
|
||||
}
|
||||
}
|
||||
},
|
||||
['lodash', 'shimmed', 'underscore'], function(lodash, shimmed, underscore) {
|
||||
if (shimmed && shimmed.noConflict) {
|
||||
shimmedModule = shimmed.noConflict();
|
||||
shimmedModule.moduleName = 'shimmed';
|
||||
}
|
||||
if (underscore && underscore.noConflict) {
|
||||
underscoreModule = underscore.noConflict();
|
||||
underscoreModule.moduleName = 'underscore';
|
||||
}
|
||||
if (lodash && lodash.noConflict) {
|
||||
lodashModule = lodash.noConflict();
|
||||
lodashModule.moduleName = 'lodash';
|
||||
}
|
||||
};
|
||||
|
||||
if (ui.isModularize) {
|
||||
window._ = lodash;
|
||||
result.packages.push({
|
||||
'name': 'lodash',
|
||||
'location': locationPath,
|
||||
'main': moduleMain
|
||||
}, {
|
||||
'name': 'shimmed',
|
||||
'location': shimmedLocationPath,
|
||||
'main': moduleMain
|
||||
}, {
|
||||
'name': 'underscore',
|
||||
'location': underscoreLocationPath,
|
||||
'main': moduleMain
|
||||
});
|
||||
} else {
|
||||
result.paths.lodash = modulePath;
|
||||
result.paths.shimmed = shimmedLocationPath + '/' + moduleMain;
|
||||
result.paths.underscore = underscoreLocationPath + '/' + moduleMain;
|
||||
}
|
||||
require(['test'], function() {
|
||||
return result;
|
||||
}
|
||||
|
||||
function loadTests() {
|
||||
require(getConfig(), ['test'], function() {
|
||||
QUnit.start();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function loadModulesAndTests() {
|
||||
require(getConfig(), ['lodash', 'shimmed', 'underscore'], function(lodash, shimmed, underscore) {
|
||||
lodashModule = lodash;
|
||||
lodashModule.moduleName = 'lodash';
|
||||
|
||||
if (shimmed) {
|
||||
shimmedModule = shimmed.result(shimmed, 'noConflict') || shimmed;
|
||||
shimmedModule.moduleName = 'shimmed';
|
||||
}
|
||||
if (underscore) {
|
||||
underscoreModule = underscore.result(underscore, 'noConflict') || underscore;
|
||||
underscoreModule.moduleName = 'underscore';
|
||||
}
|
||||
if (ui.isModularize) {
|
||||
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 = baseEach;
|
||||
lodash._isIndex = isIndex;
|
||||
lodash._isIterateeCall = isIterateeCall;
|
||||
lodash._isLength = isLength;
|
||||
loadTests();
|
||||
});
|
||||
} else {
|
||||
loadTests();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
QUnit.config.autostart = false;
|
||||
|
||||
if (window.requirejs) {
|
||||
addBizarroMethods();
|
||||
require(getConfig(), ['lodash'], function(lodash) {
|
||||
lodashBizarro = lodash.result(lodash, 'noConflict') || lodash;
|
||||
delete requirejs.s.contexts._;
|
||||
|
||||
removeBizarroMethods();
|
||||
loadModulesAndTests();
|
||||
});
|
||||
} else {
|
||||
loadModulesAndTests();
|
||||
}
|
||||
}());
|
||||
|
||||
// set a more readable browser name
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
for cmd in rhino "rhino -require" narwhal ringo phantomjs; do
|
||||
echo "Testing in $cmd..."
|
||||
$cmd test.js ../dist/lodash.compat.js && $cmd test.js ../dist/lodash.compat.min.js
|
||||
echo ""
|
||||
done
|
||||
|
||||
echo "Testing in node..."
|
||||
node test.js ../dist/lodash.js && node test.js ../dist/lodash.min.js
|
||||
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..."
|
||||
|
||||
934
test/saucelabs.js
Normal file
934
test/saucelabs.js
Normal file
@@ -0,0 +1,934 @@
|
||||
#!/usr/bin/env node
|
||||
'use strict';
|
||||
|
||||
/** 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'),
|
||||
path = require('path'),
|
||||
url = require('url'),
|
||||
util = require('util');
|
||||
|
||||
/** Load other modules. */
|
||||
var _ = require('../lodash.src.js'),
|
||||
chalk = require('chalk'),
|
||||
ecstatic = require('ecstatic'),
|
||||
request = require('request'),
|
||||
SauceTunnel = require('sauce-tunnel');
|
||||
|
||||
/** Used for Sauce Labs credentials. */
|
||||
var accessKey = env.SAUCE_ACCESS_KEY,
|
||||
username = env.SAUCE_USERNAME;
|
||||
|
||||
/** Used as the default maximum number of times to retry a job and tunnel. */
|
||||
var maxJobRetries = 3,
|
||||
maxTunnelRetries = 3;
|
||||
|
||||
/** Used as the static file server middleware. */
|
||||
var mount = ecstatic({
|
||||
'cache': 'no-cache',
|
||||
'root': process.cwd()
|
||||
});
|
||||
|
||||
/** Used as the list of ports supported by Sauce Connect. */
|
||||
var ports = [
|
||||
80, 443, 888, 2000, 2001, 2020, 2109, 2222, 2310, 3000, 3001, 3030, 3210,
|
||||
3333, 4000, 4001, 4040, 4321, 4502, 4503, 4567, 5000, 5001, 5050, 5555, 5432,
|
||||
6000, 6001, 6060, 6666, 6543, 7000, 7070, 7774, 7777, 8000, 8001, 8003, 8031,
|
||||
8080, 8081, 8765, 8777, 8888, 9000, 9001, 9080, 9090, 9876, 9877, 9999, 49221,
|
||||
55001
|
||||
];
|
||||
|
||||
/** Used by `logInline` to clear previously logged messages. */
|
||||
var prevLine = '';
|
||||
|
||||
/** Method shortcut. */
|
||||
var push = Array.prototype.push;
|
||||
|
||||
/** Used to detect error messages. */
|
||||
var reError = /(?:\be|E)rror\b/;
|
||||
|
||||
/** Used to detect valid job ids. */
|
||||
var reJobId = /^[a-z0-9]{32}$/;
|
||||
|
||||
/** Used to display the wait throbber. */
|
||||
var throbberDelay = 500,
|
||||
waitCount = -1;
|
||||
|
||||
/**
|
||||
* Used as Sauce Labs config values.
|
||||
* See the [Sauce Labs documentation](https://docs.saucelabs.com/reference/test-configuration/)
|
||||
* for more details.
|
||||
*/
|
||||
var advisor = getOption('advisor', false),
|
||||
build = getOption('build', (env.TRAVIS_COMMIT || '').slice(0, 10)),
|
||||
commandTimeout = getOption('commandTimeout', 90),
|
||||
compatMode = getOption('compatMode', null),
|
||||
customData = Function('return {' + getOption('customData', '').replace(/^\{|}$/g, '') + '}')(),
|
||||
deviceOrientation = getOption('deviceOrientation', 'portrait'),
|
||||
framework = getOption('framework', 'qunit'),
|
||||
idleTimeout = getOption('idleTimeout', 60),
|
||||
jobName = getOption('name', 'unit tests'),
|
||||
maxDuration = getOption('maxDuration', 120),
|
||||
port = ports[Math.min(_.sortedIndex(ports, getOption('port', 9001)), ports.length - 1)],
|
||||
publicAccess = getOption('public', true),
|
||||
queueTimeout = getOption('queueTimeout', 240),
|
||||
recordVideo = getOption('recordVideo', true),
|
||||
recordScreenshots = getOption('recordScreenshots', false),
|
||||
runner = getOption('runner', 'test/index.html').replace(/^\W+/, ''),
|
||||
runnerUrl = getOption('runnerUrl', 'http://localhost:' + port + '/' + runner),
|
||||
statusInterval = getOption('statusInterval', 5),
|
||||
tags = getOption('tags', []),
|
||||
throttled = getOption('throttled', 10),
|
||||
tunneled = getOption('tunneled', true),
|
||||
tunnelId = getOption('tunnelId', 'tunnel_' + (env.TRAVIS_JOB_ID || 0)),
|
||||
tunnelTimeout = getOption('tunnelTimeout', 120),
|
||||
videoUploadOnPass = getOption('videoUploadOnPass', false);
|
||||
|
||||
/** Used to convert Sauce Labs browser identifiers to their formal names. */
|
||||
var browserNameMap = {
|
||||
'googlechrome': 'Chrome',
|
||||
'iehta': 'Internet Explorer',
|
||||
'ipad': 'iPad',
|
||||
'iphone': 'iPhone'
|
||||
};
|
||||
|
||||
/** 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', '35'],
|
||||
['Windows 8.1', 'firefox', '34'],
|
||||
['Windows 8.1', 'firefox', '20'],
|
||||
['Windows 8.1', 'chrome', '40'],
|
||||
['Windows 8.1', 'chrome', '39'],
|
||||
['Windows 8.1', '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'],
|
||||
['Windows 7', 'opera', '12'],
|
||||
['Windows 7', 'opera', '11'],
|
||||
['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']
|
||||
];
|
||||
|
||||
/** Used to tailor the `platforms` array. */
|
||||
var isAMD = _.includes(tags, 'amd'),
|
||||
isBackbone = _.includes(tags, 'backbone'),
|
||||
isModern = _.includes(tags, 'modern');
|
||||
|
||||
// The platforms to test IE compatibility modes.
|
||||
if (compatMode) {
|
||||
platforms = [
|
||||
['Windows 8.1', 'internet explorer', '11'],
|
||||
['Windows 8', 'internet explorer', '10'],
|
||||
['Windows 7', 'internet explorer', '9'],
|
||||
['Windows 7', 'internet explorer', '8']
|
||||
];
|
||||
}
|
||||
// The platforms for AMD tests.
|
||||
if (isAMD) {
|
||||
platforms = _.filter(platforms, function(platform) {
|
||||
var browser = browserName(platform[1]),
|
||||
version = +platform[2];
|
||||
|
||||
switch (browser) {
|
||||
case 'Android': return version >= 4.4;
|
||||
case 'Opera': return version >= 10;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
// The platforms for Backbone tests.
|
||||
if (isBackbone) {
|
||||
platforms = _.filter(platforms, function(platform) {
|
||||
var browser = browserName(platform[1]),
|
||||
version = +platform[2];
|
||||
|
||||
switch (browser) {
|
||||
case 'Firefox': return version >= 4;
|
||||
case 'iPad': return version >= 5;
|
||||
case 'Opera': return version >= 12;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
// The platforms for modern builds.
|
||||
if (isModern) {
|
||||
platforms = _.filter(platforms, function(platform) {
|
||||
var browser = browserName(platform[1]),
|
||||
version = +platform[2];
|
||||
|
||||
switch (browser) {
|
||||
case 'Android': return version >= 4.1;
|
||||
case 'Firefox': return version >= 10;
|
||||
case 'Internet Explorer': return version >= 9;
|
||||
case 'iPad': return version >= 6;
|
||||
case 'Opera': return version >= 12;
|
||||
case 'Safari': return version >= 6;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
/** Used as the default `Job` options object. */
|
||||
var jobOptions = {
|
||||
'build': build,
|
||||
'command-timeout': commandTimeout,
|
||||
'custom-data': customData,
|
||||
'device-orientation': deviceOrientation,
|
||||
'framework': framework,
|
||||
'idle-timeout': idleTimeout,
|
||||
'max-duration': maxDuration,
|
||||
'name': jobName,
|
||||
'public': publicAccess,
|
||||
'platforms': platforms,
|
||||
'record-screenshots': recordScreenshots,
|
||||
'record-video': recordVideo,
|
||||
'sauce-advisor': advisor,
|
||||
'tags': tags,
|
||||
'url': runnerUrl,
|
||||
'video-upload-on-pass': videoUploadOnPass
|
||||
};
|
||||
|
||||
if (publicAccess === true) {
|
||||
jobOptions['public'] = 'public';
|
||||
}
|
||||
if (tunneled) {
|
||||
jobOptions['tunnel-identifier'] = tunnelId;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Resolves the formal browser name for a given Sauce Labs browser identifier.
|
||||
*
|
||||
* @private
|
||||
* @param {string} identifier The browser identifier.
|
||||
* @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(' ');
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value for the given option name. If no value is available the
|
||||
* `defaultValue` is returned.
|
||||
*
|
||||
* @private
|
||||
* @param {string} name The name of the option.
|
||||
* @param {*} defaultValue The default option value.
|
||||
* @returns {*} Returns the option value.
|
||||
*/
|
||||
function getOption(name, defaultValue) {
|
||||
var isArr = _.isArray(defaultValue);
|
||||
return _.reduce(process.argv, function(result, value) {
|
||||
if (isArr) {
|
||||
value = optionToArray(name, value);
|
||||
return _.isEmpty(value) ? result : value;
|
||||
}
|
||||
value = optionToValue(name, value);
|
||||
|
||||
return value == null ? result : value;
|
||||
}, defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if `value` is a job ID.
|
||||
*
|
||||
* @private
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is a job ID, else `false`.
|
||||
*/
|
||||
function isJobId(value) {
|
||||
return reJobId.test(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes an inline message to standard output.
|
||||
*
|
||||
* @private
|
||||
* @param {string} [text=''] The text to log.
|
||||
*/
|
||||
function logInline(text) {
|
||||
var blankLine = _.repeat(' ', _.size(prevLine));
|
||||
prevLine = text = _.trunc(text, 40);
|
||||
process.stdout.write(text + blankLine.slice(text.length) + '\r');
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes the wait throbber to standard output.
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
function logThrobber() {
|
||||
logInline('Please wait' + _.repeat('.', (++waitCount % 3) + 1));
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a comma separated option value into an array.
|
||||
*
|
||||
* @private
|
||||
* @param {string} name The name of the option to inspect.
|
||||
* @param {string} string The options string.
|
||||
* @returns {Array} Returns the new converted array.
|
||||
*/
|
||||
function optionToArray(name, string) {
|
||||
return _.compact(_.invoke((optionToValue(name, string) || '').split(/, */), 'trim'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts the option value from an option string.
|
||||
*
|
||||
* @private
|
||||
* @param {string} name The name of the option to inspect.
|
||||
* @param {string} string The options string.
|
||||
* @returns {string|undefined} Returns the option value, else `undefined`.
|
||||
*/
|
||||
function optionToValue(name, string) {
|
||||
var result = string.match(RegExp('^' + name + '(?:=([\\s\\S]+))?$'));
|
||||
if (result) {
|
||||
result = _.result(result, 1);
|
||||
result = result ? _.trim(result) : true;
|
||||
}
|
||||
if (result === 'false') {
|
||||
return false;
|
||||
}
|
||||
return result || undefined;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* The `Job#remove` and `Tunnel#stop` callback used by `Jobs#restart`
|
||||
* and `Tunnel#restart` respectively.
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
function onGenericRestart() {
|
||||
this.restarting = false;
|
||||
this.emit('restart');
|
||||
this.start();
|
||||
}
|
||||
|
||||
/**
|
||||
* The `request.put` and `SauceTunnel#stop` callback used by `Jobs#stop`
|
||||
* and `Tunnel#stop` respectively.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} [error] The error object.
|
||||
*/
|
||||
function onGenericStop(error) {
|
||||
this.running = this.stopping = false;
|
||||
this.emit('stop', error);
|
||||
}
|
||||
|
||||
/**
|
||||
* The `request.del` callback used by `Jobs#remove`.
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
function onJobRemove(error, res, body) {
|
||||
this.id = this.taskId = this.url = null;
|
||||
this.removing = false;
|
||||
this.emit('remove');
|
||||
}
|
||||
|
||||
/**
|
||||
* The `Job#remove` callback used by `Jobs#reset`.
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
function onJobReset() {
|
||||
this.attempts = 0;
|
||||
this.failed = this.resetting = false;
|
||||
this._pollerId = this.id = this.result = this.taskId = this.url = null;
|
||||
this.emit('reset');
|
||||
}
|
||||
|
||||
/**
|
||||
* The `request.post` callback used by `Jobs#start`.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} [error] The error object.
|
||||
* @param {Object} res The response data object.
|
||||
* @param {Object} body The response body JSON object.
|
||||
*/
|
||||
function onJobStart(error, res, body) {
|
||||
this.starting = false;
|
||||
|
||||
if (this.stopping) {
|
||||
return;
|
||||
}
|
||||
var statusCode = _.result(res, 'statusCode'),
|
||||
taskId = _.first(_.result(body, 'js tests'));
|
||||
|
||||
if (error || !taskId || statusCode != 200) {
|
||||
if (this.attempts < this.retries) {
|
||||
this.restart();
|
||||
return;
|
||||
}
|
||||
var na = 'unavailable',
|
||||
bodyStr = _.isObject(body) ? '\n' + JSON.stringify(body) : na,
|
||||
statusStr = _.isFinite(statusCode) ? statusCode : na;
|
||||
|
||||
logInline();
|
||||
console.error('Failed to start job; status: %s, body: %s', statusStr, bodyStr);
|
||||
if (error) {
|
||||
console.error(error);
|
||||
}
|
||||
this.failed = true;
|
||||
this.emit('complete');
|
||||
return;
|
||||
}
|
||||
this.running = true;
|
||||
this.taskId = taskId;
|
||||
this.timestamp = _.now();
|
||||
this.emit('start');
|
||||
this.status();
|
||||
}
|
||||
|
||||
/**
|
||||
* The `request.post` callback used by `Job#status`.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} [error] The error object.
|
||||
* @param {Object} res The response data object.
|
||||
* @param {Object} body The response body JSON object.
|
||||
*/
|
||||
function onJobStatus(error, res, body) {
|
||||
this.checking = false;
|
||||
|
||||
if (!this.running || this.stopping) {
|
||||
return;
|
||||
}
|
||||
var completed = _.result(body, 'completed', false),
|
||||
data = _.first(_.result(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),
|
||||
expired = (elapsed >= queueTimeout && !_.includes(jobStatus, 'in progress')),
|
||||
options = this.options,
|
||||
platform = options.platforms[0];
|
||||
|
||||
if (_.isObject(jobResult)) {
|
||||
var message = _.result(jobResult, 'message');
|
||||
} else {
|
||||
if (typeof jobResult == 'string') {
|
||||
message = jobResult;
|
||||
}
|
||||
jobResult = null;
|
||||
}
|
||||
if (isJobId(jobId)) {
|
||||
this.id = jobId;
|
||||
this.result = jobResult;
|
||||
this.url = jobUrl;
|
||||
} else {
|
||||
completed = false;
|
||||
}
|
||||
this.emit('status', jobStatus);
|
||||
|
||||
if (!completed && !expired) {
|
||||
this._pollerId = _.delay(_.bind(this.status, this), this.statusInterval * 1000);
|
||||
return;
|
||||
}
|
||||
var description = browserName(platform[1]) + ' ' + platform[2] + ' on ' + capitalizeWords(platform[0]),
|
||||
errored = !jobResult || !jobResult.passed || reError.test(message) || reError.test(jobStatus),
|
||||
failures = _.result(jobResult, 'failed'),
|
||||
label = options.name + ':',
|
||||
tunnel = this.tunnel;
|
||||
|
||||
if (errored || failures) {
|
||||
if (errored && this.attempts < this.retries) {
|
||||
this.restart();
|
||||
return;
|
||||
}
|
||||
var details = 'See ' + jobUrl + ' for details.';
|
||||
this.failed = true;
|
||||
|
||||
logInline();
|
||||
if (failures) {
|
||||
console.error(label + ' %s ' + chalk.red('failed') + ' %d test' + (failures > 1 ? 's' : '') + '. %s', description, failures, details);
|
||||
}
|
||||
else if (tunnel.attempts < tunnel.retries) {
|
||||
tunnel.restart();
|
||||
return;
|
||||
}
|
||||
else {
|
||||
if (typeof message == 'undefined') {
|
||||
message = 'Results are unavailable. ' + details;
|
||||
}
|
||||
console.error(label, description, chalk.red('failed') + ';', message);
|
||||
}
|
||||
}
|
||||
else {
|
||||
logInline();
|
||||
console.log(label, description, chalk.green('passed'));
|
||||
}
|
||||
this.running = false;
|
||||
this.emit('complete');
|
||||
}
|
||||
|
||||
/**
|
||||
* The `SauceTunnel#start` callback used by `Tunnel#start`.
|
||||
*
|
||||
* @private
|
||||
* @param {boolean} success The connection success indicator.
|
||||
*/
|
||||
function onTunnelStart(success) {
|
||||
this.starting = false;
|
||||
|
||||
if (this._timeoutId) {
|
||||
clearTimeout(this._timeoutId);
|
||||
this._timeoutId = null;
|
||||
}
|
||||
if (!success) {
|
||||
if (this.attempts < this.retries) {
|
||||
this.restart();
|
||||
return;
|
||||
}
|
||||
logInline();
|
||||
console.error('Failed to open Sauce Connect tunnel');
|
||||
process.exit(2);
|
||||
}
|
||||
logInline();
|
||||
console.log('Sauce Connect tunnel opened');
|
||||
|
||||
var jobs = this.jobs;
|
||||
push.apply(jobs.queue, jobs.all);
|
||||
|
||||
this.running = true;
|
||||
this.emit('start');
|
||||
|
||||
console.log('Starting jobs...');
|
||||
this.dequeue();
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* The Job constructor.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} [properties] The properties to initialize a job with.
|
||||
*/
|
||||
function Job(properties) {
|
||||
EventEmitter.call(this);
|
||||
|
||||
this.options = {};
|
||||
this.retries = maxJobRetries;
|
||||
this.statusInterval = statusInterval;
|
||||
|
||||
_.merge(this, properties);
|
||||
_.defaults(this.options, _.cloneDeep(jobOptions));
|
||||
|
||||
this.attempts = 0;
|
||||
this.checking = this.failed = this.removing = this.resetting = this.restarting = this.running = this.starting = this.stopping = false;
|
||||
this._pollerId = this.id = this.result = this.taskId = this.url = null;
|
||||
}
|
||||
|
||||
util.inherits(Job, EventEmitter);
|
||||
|
||||
/**
|
||||
* Removes the job.
|
||||
*
|
||||
* @memberOf Job
|
||||
* @param {Function} callback The function called once the job is removed.
|
||||
* @param {Object} Returns the job instance.
|
||||
*/
|
||||
Job.prototype.remove = function(callback) {
|
||||
this.once('remove', _.callback(callback));
|
||||
if (this.removing) {
|
||||
return this;
|
||||
}
|
||||
this.removing = true;
|
||||
return this.stop(function() {
|
||||
var onRemove = _.bind(onJobRemove, this);
|
||||
if (!this.id) {
|
||||
_.defer(onRemove);
|
||||
return;
|
||||
}
|
||||
request.del(_.template('https://saucelabs.com/rest/v1/${user}/jobs/${id}')(this), {
|
||||
'auth': { 'user': this.user, 'pass': this.pass }
|
||||
}, onRemove);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Resets the job.
|
||||
*
|
||||
* @memberOf Job
|
||||
* @param {Function} callback The function called once the job is reset.
|
||||
* @param {Object} Returns the job instance.
|
||||
*/
|
||||
Job.prototype.reset = function(callback) {
|
||||
this.once('reset', _.callback(callback));
|
||||
if (this.resetting) {
|
||||
return this;
|
||||
}
|
||||
this.resetting = true;
|
||||
return this.remove(onJobReset);
|
||||
};
|
||||
|
||||
/**
|
||||
* Restarts the job.
|
||||
*
|
||||
* @memberOf Job
|
||||
* @param {Function} callback The function called once the job is restarted.
|
||||
* @param {Object} Returns the job instance.
|
||||
*/
|
||||
Job.prototype.restart = function(callback) {
|
||||
this.once('restart', _.callback(callback));
|
||||
if (this.restarting) {
|
||||
return this;
|
||||
}
|
||||
this.restarting = true;
|
||||
|
||||
var options = this.options,
|
||||
platform = options.platforms[0],
|
||||
description = browserName(platform[1]) + ' ' + platform[2] + ' on ' + capitalizeWords(platform[0]),
|
||||
label = options.name + ':';
|
||||
|
||||
logInline();
|
||||
console.log('%s %s restart %d of %d', label, description, ++this.attempts, this.retries);
|
||||
|
||||
return this.remove(onGenericRestart);
|
||||
};
|
||||
|
||||
/**
|
||||
* Starts the job.
|
||||
*
|
||||
* @memberOf Job
|
||||
* @param {Function} callback The function called once the job is started.
|
||||
* @param {Object} Returns the job instance.
|
||||
*/
|
||||
Job.prototype.start = function(callback) {
|
||||
this.once('start', _.callback(callback));
|
||||
if (this.starting || this.running) {
|
||||
return this;
|
||||
}
|
||||
this.starting = true;
|
||||
request.post(_.template('https://saucelabs.com/rest/v1/${user}/js-tests')(this), {
|
||||
'auth': { 'user': this.user, 'pass': this.pass },
|
||||
'json': this.options
|
||||
}, _.bind(onJobStart, this));
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks the status of a job.
|
||||
*
|
||||
* @memberOf Job
|
||||
* @param {Function} callback The function called once the status is resolved.
|
||||
* @param {Object} Returns the job instance.
|
||||
*/
|
||||
Job.prototype.status = function(callback) {
|
||||
this.once('status', _.callback(callback));
|
||||
if (this.checking || this.removing || this.resetting || this.restarting || this.starting || this.stopping) {
|
||||
return this;
|
||||
}
|
||||
this._pollerId = null;
|
||||
this.checking = true;
|
||||
request.post(_.template('https://saucelabs.com/rest/v1/${user}/js-tests/status')(this), {
|
||||
'auth': { 'user': this.user, 'pass': this.pass },
|
||||
'json': { 'js tests': [this.taskId] }
|
||||
}, _.bind(onJobStatus, this));
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Stops the job.
|
||||
*
|
||||
* @memberOf Job
|
||||
* @param {Function} callback The function called once the job is stopped.
|
||||
* @param {Object} Returns the job instance.
|
||||
*/
|
||||
Job.prototype.stop = function(callback) {
|
||||
this.once('stop', _.callback(callback));
|
||||
if (this.stopping) {
|
||||
return this;
|
||||
}
|
||||
this.stopping = true;
|
||||
if (this._pollerId) {
|
||||
clearTimeout(this._pollerId);
|
||||
this._pollerId = null;
|
||||
this.checking = false;
|
||||
}
|
||||
var onStop = _.bind(onGenericStop, this);
|
||||
if (!this.running || !this.id) {
|
||||
_.defer(onStop);
|
||||
return this;
|
||||
}
|
||||
request.put(_.template('https://saucelabs.com/rest/v1/${user}/jobs/${id}/stop')(this), {
|
||||
'auth': { 'user': this.user, 'pass': this.pass }
|
||||
}, onStop);
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* The Tunnel constructor.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} [properties] The properties to initialize the tunnel with.
|
||||
*/
|
||||
function Tunnel(properties) {
|
||||
EventEmitter.call(this);
|
||||
|
||||
this.retries = maxTunnelRetries;
|
||||
_.merge(this, properties);
|
||||
|
||||
var active = [],
|
||||
queue = [];
|
||||
|
||||
var all = _.map(this.platforms, function(platform) {
|
||||
return new Job(_.merge({
|
||||
'user': this.user,
|
||||
'pass': this.pass,
|
||||
'tunnel': this,
|
||||
'options': { 'platforms': [platform] }
|
||||
}, this.job));
|
||||
}, this);
|
||||
|
||||
var completed = 0,
|
||||
restarted = [],
|
||||
success = true,
|
||||
total = all.length,
|
||||
tunnel = this;
|
||||
|
||||
_.invoke(all, 'on', 'complete', function() {
|
||||
_.pull(active, this);
|
||||
if (success) {
|
||||
success = !this.failed;
|
||||
}
|
||||
if (++completed == total) {
|
||||
tunnel.stop(_.partial(tunnel.emit, 'complete', success));
|
||||
return;
|
||||
}
|
||||
tunnel.dequeue();
|
||||
});
|
||||
|
||||
_.invoke(all, 'on', 'restart', function() {
|
||||
if (!_.includes(restarted, this)) {
|
||||
restarted.push(this);
|
||||
}
|
||||
// Restart tunnel if all active jobs have restarted.
|
||||
var threshold = Math.min(all.length, _.isFinite(throttled) ? throttled : 3);
|
||||
if (tunnel.attempts < tunnel.retries &&
|
||||
active.length >= threshold && _.isEmpty(_.difference(active, restarted))) {
|
||||
tunnel.restart();
|
||||
}
|
||||
});
|
||||
|
||||
this.on('restart', function() {
|
||||
completed = 0;
|
||||
success = true;
|
||||
restarted.length = 0;
|
||||
});
|
||||
|
||||
this._timeoutId = null;
|
||||
this.attempts = 0;
|
||||
this.restarting = this.running = this.starting = this.stopping = false;
|
||||
this.jobs = { 'active': active, 'all': all, 'queue': queue };
|
||||
this.connection = new SauceTunnel(this.user, this.pass, this.id, this.tunneled, ['-P', '0']);
|
||||
}
|
||||
|
||||
util.inherits(Tunnel, EventEmitter);
|
||||
|
||||
/**
|
||||
* Restarts the tunnel.
|
||||
*
|
||||
* @memberOf Tunnel
|
||||
* @param {Function} callback The function called once the tunnel is restarted.
|
||||
*/
|
||||
Tunnel.prototype.restart = function(callback) {
|
||||
this.once('restart', _.callback(callback));
|
||||
if (this.restarting) {
|
||||
return this;
|
||||
}
|
||||
this.restarting = true;
|
||||
|
||||
logInline();
|
||||
console.log('Tunnel %s: restart %d of %d', this.id, ++this.attempts, this.retries);
|
||||
|
||||
var jobs = this.jobs,
|
||||
active = jobs.active,
|
||||
all = jobs.all;
|
||||
|
||||
var reset = _.after(all.length, _.bind(this.stop, this, onGenericRestart)),
|
||||
stop = _.after(active.length, _.partial(_.invoke, all, 'reset', reset));
|
||||
|
||||
if (_.isEmpty(active)) {
|
||||
_.defer(stop);
|
||||
}
|
||||
if (_.isEmpty(all)) {
|
||||
_.defer(reset);
|
||||
}
|
||||
_.invoke(active, 'stop', function() {
|
||||
_.pull(active, this);
|
||||
stop();
|
||||
});
|
||||
|
||||
if (this._timeoutId) {
|
||||
clearTimeout(this._timeoutId);
|
||||
this._timeoutId = null;
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Starts the tunnel.
|
||||
*
|
||||
* @memberOf Tunnel
|
||||
* @param {Function} callback The function called once the tunnel is started.
|
||||
* @param {Object} Returns the tunnel instance.
|
||||
*/
|
||||
Tunnel.prototype.start = function(callback) {
|
||||
this.once('start', _.callback(callback));
|
||||
if (this.starting || this.running) {
|
||||
return this;
|
||||
}
|
||||
this.starting = true;
|
||||
|
||||
logInline();
|
||||
console.log('Opening Sauce Connect tunnel...');
|
||||
|
||||
var onStart = _.bind(onTunnelStart, this);
|
||||
if (this.timeout) {
|
||||
this._timeoutId = _.delay(onStart, this.timeout * 1000, false);
|
||||
}
|
||||
this.connection.start(onStart);
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Removes jobs from the queue and starts them.
|
||||
*
|
||||
* @memberOf Tunnel
|
||||
* @param {Object} Returns the tunnel instance.
|
||||
*/
|
||||
Tunnel.prototype.dequeue = function() {
|
||||
var jobs = this.jobs,
|
||||
active = jobs.active,
|
||||
queue = jobs.queue,
|
||||
throttled = this.throttled;
|
||||
|
||||
while (queue.length && (active.length < throttled)) {
|
||||
active.push(queue.shift().start());
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Stops the tunnel.
|
||||
*
|
||||
* @memberOf Tunnel
|
||||
* @param {Function} callback The function called once the tunnel is stopped.
|
||||
* @param {Object} Returns the tunnel instance.
|
||||
*/
|
||||
Tunnel.prototype.stop = function(callback) {
|
||||
this.once('stop', _.callback(callback));
|
||||
if (this.stopping) {
|
||||
return this;
|
||||
}
|
||||
this.stopping = true;
|
||||
|
||||
logInline();
|
||||
console.log('Shutting down Sauce Connect tunnel...');
|
||||
|
||||
var jobs = this.jobs,
|
||||
active = jobs.active;
|
||||
|
||||
var stop = _.after(active.length, _.bind(function() {
|
||||
var onStop = _.bind(onGenericStop, this);
|
||||
if (this.running) {
|
||||
this.connection.stop(onStop);
|
||||
} else {
|
||||
onStop();
|
||||
}
|
||||
}, this));
|
||||
|
||||
jobs.queue.length = 0;
|
||||
if (_.isEmpty(active)) {
|
||||
_.defer(stop);
|
||||
}
|
||||
_.invoke(active, 'stop', function() {
|
||||
_.pull(active, this);
|
||||
stop();
|
||||
});
|
||||
|
||||
if (this._timeoutId) {
|
||||
clearTimeout(this._timeoutId);
|
||||
this._timeoutId = null;
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
// Cleanup any inline logs when exited via `ctrl+c`.
|
||||
process.on('SIGINT', function() {
|
||||
logInline();
|
||||
process.exit();
|
||||
});
|
||||
|
||||
// Create a web server for the current working directory.
|
||||
http.createServer(function(req, res) {
|
||||
// See http://msdn.microsoft.com/en-us/library/ff955275(v=vs.85).aspx.
|
||||
if (compatMode && path.extname(url.parse(req.url).pathname) == '.html') {
|
||||
res.setHeader('X-UA-Compatible', 'IE=' + compatMode);
|
||||
}
|
||||
mount(req, res);
|
||||
}).listen(port);
|
||||
|
||||
// Setup Sauce Connect so we can use this server from Sauce Labs.
|
||||
var tunnel = new Tunnel({
|
||||
'user': username,
|
||||
'pass': accessKey,
|
||||
'id': tunnelId,
|
||||
'job': { 'retries': maxJobRetries, 'statusInterval': statusInterval },
|
||||
'platforms': platforms,
|
||||
'retries': maxTunnelRetries,
|
||||
'throttled': throttled,
|
||||
'tunneled': tunneled,
|
||||
'timeout': tunnelTimeout
|
||||
});
|
||||
|
||||
tunnel.on('complete', function(success) {
|
||||
process.exit(success ? 0 : 1);
|
||||
});
|
||||
|
||||
tunnel.start();
|
||||
|
||||
setInterval(logThrobber, throbberDelay);
|
||||
14976
test/test.js
14976
test/test.js
File diff suppressed because it is too large
Load Diff
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Underscore Test Suite</title>
|
||||
<link rel="stylesheet" href="../vendor/qunit/qunit/qunit.css">
|
||||
<link rel="stylesheet" href="../node_modules/qunitjs/qunit/qunit.css">
|
||||
<style>
|
||||
iframe {
|
||||
display: none;
|
||||
@@ -19,57 +19,165 @@
|
||||
</div>
|
||||
<img id="chart_image" src="data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==">
|
||||
</div>
|
||||
<script src="../vendor/qunit/qunit/qunit.js"></script>
|
||||
<script src="../vendor/jquery/jquery.js"></script>
|
||||
<script src="../vendor/platform.js/platform.js"></script>
|
||||
<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="../node_modules/qunitjs/qunit/qunit.js"></script>
|
||||
<script src="../node_modules/qunit-extras/qunit-extras.js"></script>
|
||||
<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>
|
||||
function init(lodash) {
|
||||
var arrayRef = [],
|
||||
push = arrayRef.push;
|
||||
QUnit.config.asyncRetries = 10;
|
||||
QUnit.config.hidepassed = true;
|
||||
|
||||
if (!lodash().map()) {
|
||||
return;
|
||||
// excuse tests we intentionally fail or those with problems
|
||||
QUnit.config.excused = {
|
||||
'Arrays': {
|
||||
'drop': [
|
||||
'alias for rest'
|
||||
],
|
||||
'first': [
|
||||
'can pass an index to first',
|
||||
'[1,2]',
|
||||
'0'
|
||||
],
|
||||
'flatten': [
|
||||
'can flatten nested arrays',
|
||||
'can shallowly flatten nested arrays',
|
||||
'works on an arguments object',
|
||||
'can shallowly flatten arrays containing only other arrays'
|
||||
],
|
||||
'initial': [
|
||||
'initial can take an index',
|
||||
'initial can take a large index',
|
||||
'initial works on arguments object'
|
||||
],
|
||||
'intersection': [
|
||||
'can perform an OO-style intersection',
|
||||
'returns an empty array when passed null as first argument',
|
||||
'returns an empty array when passed null as argument beyond the first'
|
||||
],
|
||||
'last': [
|
||||
'can pass an index to last',
|
||||
'0'
|
||||
],
|
||||
'lastIndexOf': [
|
||||
'[0,-1,-1]'
|
||||
],
|
||||
'rest': [
|
||||
'working rest(0)',
|
||||
'rest can take an index',
|
||||
'works on arguments object'
|
||||
],
|
||||
'take': [
|
||||
'alias for first'
|
||||
]
|
||||
},
|
||||
'Chaining': {
|
||||
'select/reject/sortBy': [
|
||||
'Died on test #1'
|
||||
],
|
||||
'select/reject/sortBy in functional style': [
|
||||
'Died on test #1'
|
||||
],
|
||||
'reverse/concat/unshift/pop/map': [
|
||||
'can chain together array functions.'
|
||||
]
|
||||
},
|
||||
'Collections': {
|
||||
'filter': [
|
||||
'OO-filter'
|
||||
],
|
||||
'map': [
|
||||
'OO-style doubled numbers'
|
||||
],
|
||||
'reduce': [
|
||||
'handles a null (without initial value) properly',
|
||||
'throws an error for empty arrays with no initial value'
|
||||
],
|
||||
'reduceRight': [
|
||||
'handles a null (without initial value) properly',
|
||||
'throws an error for empty arrays with no initial value'
|
||||
]
|
||||
},
|
||||
'Functions': {
|
||||
'bind': [
|
||||
'can bind without specifying a context',
|
||||
'Died on test #2'
|
||||
],
|
||||
'bindAll': [
|
||||
'throws an error for bindAll with no functions named'
|
||||
],
|
||||
'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': {
|
||||
'isEqual': [
|
||||
'Died on test #60',
|
||||
'Died on test #63'
|
||||
],
|
||||
'isFinite': [
|
||||
'Numeric strings are numbers',
|
||||
'Number instances can be finite'
|
||||
],
|
||||
'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'
|
||||
]
|
||||
},
|
||||
'Utility': {
|
||||
'now': [
|
||||
'Produces the correct time in milliseconds'
|
||||
],
|
||||
'_.templateSettings.variable': [
|
||||
'"x"'
|
||||
],
|
||||
'times': [
|
||||
'Died on test #1',
|
||||
'works as a wrapper'
|
||||
],
|
||||
'uniqueId': [
|
||||
'Died on test #1'
|
||||
]
|
||||
}
|
||||
lodash.mixin = function(object) {
|
||||
lodash.forEach(lodash.functions(object), function(methodName) {
|
||||
var func = lodash[methodName] = object[methodName];
|
||||
lodash.prototype[methodName] = function() {
|
||||
var args = [this.__wrapped__];
|
||||
push.apply(args, arguments);
|
||||
};
|
||||
|
||||
var result = func.apply(lodash, args);
|
||||
if (this.__chain__) {
|
||||
result = new lodash(result);
|
||||
result.__chain__ = true;
|
||||
}
|
||||
return result;
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
lodash.forEach(['pop', 'shift'], function(methodName) {
|
||||
var func = arrayRef[methodName];
|
||||
lodash.prototype[methodName] = function() {
|
||||
func.apply(this.__wrapped__, arguments);
|
||||
return this;
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
lodash.mixin(lodash);
|
||||
|
||||
// expose lodash
|
||||
window._ = lodash;
|
||||
// only excuse in Sauce Labs (buggy Safari and timers)
|
||||
if (!ui.isSauceLabs) {
|
||||
QUnit.config.excused.Utility.times.shift();
|
||||
delete QUnit.config.excused.Chaining['select/reject/sortBy'];
|
||||
delete QUnit.config.excused.Chaining['select/reject/sortBy in functional style'];
|
||||
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.Objects.isEqual;
|
||||
delete QUnit.config.excused.Utility.uniqueId;
|
||||
}
|
||||
|
||||
// load Lo-Dash again to overwrite the existing `_` value
|
||||
document.write('<script src="' + (ui.isModularize ? '../lodash.js' : ui.buildPath) + '"><\/script>');
|
||||
|
||||
// load test.js if not using require.js
|
||||
// load test scripts
|
||||
document.write(ui.urlParams.loader != 'none'
|
||||
? '<script data-dojo-config="async:1" src="' + ui.loaderPath + '"><\/script>'
|
||||
: ([
|
||||
'<script src="' + ui.buildPath + '"><\/script>',
|
||||
'<script src="../vendor/underscore/test/collections.js"><\/script>',
|
||||
'<script src="../vendor/underscore/test/arrays.js"><\/script>',
|
||||
'<script src="../vendor/underscore/test/functions.js"><\/script>',
|
||||
@@ -85,28 +193,23 @@
|
||||
curl.config({ 'apiName': 'require' });
|
||||
}
|
||||
if (!window.require) {
|
||||
init(_);
|
||||
return;
|
||||
}
|
||||
var reBasename = /[\w.-]+$/,
|
||||
basePath = ('//' + location.host + location.pathname).replace(/\btest\/$/, ''),
|
||||
basePath = ('//' + location.host + location.pathname.replace(reBasename, '')).replace(/\btest\/$/, ''),
|
||||
modulePath = ui.buildPath.replace(/\.js$/, ''),
|
||||
locationPath = modulePath.replace(reBasename, ''),
|
||||
moduleMain = modulePath.match(reBasename)[0];
|
||||
locationPath = modulePath.replace(reBasename, '').replace(/^\/|\/$/g, ''),
|
||||
moduleId = /\bunderscore\b/i.test(ui.buildPath) ? 'underscore' : 'lodash',
|
||||
moduleMain = modulePath.match(reBasename)[0],
|
||||
uid = +new Date;
|
||||
|
||||
QUnit.config.autostart = false;
|
||||
|
||||
// load Lo-Dash as a module
|
||||
require({
|
||||
'baseUrl': './',
|
||||
'urlArgs': 't=' + (+new Date),
|
||||
'packages': [
|
||||
{
|
||||
'name': 'lodash',
|
||||
'location': locationPath,
|
||||
'main': moduleMain
|
||||
},
|
||||
{
|
||||
function getConfig() {
|
||||
var result = {
|
||||
'baseUrl': './',
|
||||
'urlArgs': 't=' + uid++,
|
||||
'waitSeconds': 0,
|
||||
'paths': {},
|
||||
'packages': [{
|
||||
'name': 'test',
|
||||
'location': '../vendor/underscore/test',
|
||||
'config': {
|
||||
@@ -114,12 +217,28 @@
|
||||
'exports': 'QUnit',
|
||||
'loader': 'curl/loader/legacy'
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
['lodash'], function(lodash) {
|
||||
init(lodash);
|
||||
require([
|
||||
}]
|
||||
};
|
||||
|
||||
if (ui.isModularize) {
|
||||
result.packages.push({
|
||||
'name': moduleId,
|
||||
'location': locationPath,
|
||||
'main': moduleMain
|
||||
});
|
||||
} else {
|
||||
result.paths[moduleId] = modulePath;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
QUnit.config.autostart = false;
|
||||
|
||||
require(getConfig(), [moduleId], function(lodash) {
|
||||
if (ui.isModularize) {
|
||||
window._ = lodash;
|
||||
}
|
||||
require(getConfig(), [
|
||||
'test/collections',
|
||||
'test/arrays',
|
||||
'test/functions',
|
||||
|
||||
2
vendor/backbone/LICENSE
vendored
2
vendor/backbone/LICENSE
vendored
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 2010-2013 Jeremy Ashkenas, DocumentCloud
|
||||
Copyright (c) 2010-2014 Jeremy Ashkenas, DocumentCloud
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
|
||||
393
vendor/backbone/backbone.js
vendored
393
vendor/backbone/backbone.js
vendored
@@ -1,19 +1,35 @@
|
||||
// Backbone.js 1.0.0
|
||||
// Backbone.js 1.1.2
|
||||
|
||||
// (c) 2010-2013 Jeremy Ashkenas, DocumentCloud Inc.
|
||||
// (c) 2010-2014 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
||||
// Backbone may be freely distributed under the MIT license.
|
||||
// For all details and documentation:
|
||||
// http://backbonejs.org
|
||||
|
||||
(function(){
|
||||
(function(root, factory) {
|
||||
|
||||
// Set up Backbone appropriately for the environment. Start with AMD.
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define(['underscore', 'jquery', 'exports'], function(_, $, exports) {
|
||||
// Export global even in AMD case in case this script is loaded with
|
||||
// others that may still expect a global Backbone.
|
||||
root.Backbone = factory(root, exports, _, $);
|
||||
});
|
||||
|
||||
// Next for Node.js or CommonJS. jQuery may not be needed as a module.
|
||||
} else if (typeof exports !== 'undefined') {
|
||||
var _ = require('underscore');
|
||||
factory(root, exports, _);
|
||||
|
||||
// Finally, as a browser global.
|
||||
} else {
|
||||
root.Backbone = factory(root, {}, root._, (root.jQuery || root.Zepto || root.ender || root.$));
|
||||
}
|
||||
|
||||
}(this, function(root, Backbone, _, $) {
|
||||
|
||||
// Initial Setup
|
||||
// -------------
|
||||
|
||||
// Save a reference to the global object (`window` in the browser, `exports`
|
||||
// on the server).
|
||||
var root = this;
|
||||
|
||||
// Save the previous value of the `Backbone` variable, so that it can be
|
||||
// restored later on, if `noConflict` is used.
|
||||
var previousBackbone = root.Backbone;
|
||||
@@ -24,25 +40,12 @@
|
||||
var slice = array.slice;
|
||||
var splice = array.splice;
|
||||
|
||||
// The top-level namespace. All public Backbone classes and modules will
|
||||
// be attached to this. Exported for both the browser and the server.
|
||||
var Backbone;
|
||||
if (typeof exports !== 'undefined') {
|
||||
Backbone = exports;
|
||||
} else {
|
||||
Backbone = root.Backbone = {};
|
||||
}
|
||||
|
||||
// Current version of the library. Keep in sync with `package.json`.
|
||||
Backbone.VERSION = '1.0.0';
|
||||
|
||||
// Require Underscore, if we're on the server, and it's not already present.
|
||||
var _ = root._;
|
||||
if (!_ && (typeof require !== 'undefined')) _ = require('underscore');
|
||||
Backbone.VERSION = '1.1.2';
|
||||
|
||||
// For Backbone's purposes, jQuery, Zepto, Ender, or My Library (kidding) owns
|
||||
// the `$` variable.
|
||||
Backbone.$ = root.jQuery || root.Zepto || root.ender || root.$;
|
||||
Backbone.$ = $;
|
||||
|
||||
// Runs Backbone.js in *noConflict* mode, returning the `Backbone` variable
|
||||
// to its previous owner. Returns a reference to this Backbone object.
|
||||
@@ -52,7 +55,7 @@
|
||||
};
|
||||
|
||||
// Turn on `emulateHTTP` to support legacy HTTP servers. Setting this option
|
||||
// will fake `"PUT"` and `"DELETE"` requests via the `_method` parameter and
|
||||
// will fake `"PATCH"`, `"PUT"` and `"DELETE"` requests via the `_method` parameter and
|
||||
// set a `X-Http-Method-Override` header.
|
||||
Backbone.emulateHTTP = false;
|
||||
|
||||
@@ -108,10 +111,9 @@
|
||||
var retain, ev, events, names, i, l, j, k;
|
||||
if (!this._events || !eventsApi(this, 'off', name, [callback, context])) return this;
|
||||
if (!name && !callback && !context) {
|
||||
this._events = {};
|
||||
this._events = void 0;
|
||||
return this;
|
||||
}
|
||||
|
||||
names = name ? [name] : _.keys(this._events);
|
||||
for (i = 0, l = names.length; i < l; i++) {
|
||||
name = names[i];
|
||||
@@ -151,14 +153,15 @@
|
||||
// Tell this object to stop listening to either specific events ... or
|
||||
// to every object it's currently listening to.
|
||||
stopListening: function(obj, name, callback) {
|
||||
var listeners = this._listeners;
|
||||
if (!listeners) return this;
|
||||
var deleteListener = !name && !callback;
|
||||
if (typeof name === 'object') callback = this;
|
||||
if (obj) (listeners = {})[obj._listenerId] = obj;
|
||||
for (var id in listeners) {
|
||||
listeners[id].off(name, callback, this);
|
||||
if (deleteListener) delete this._listeners[id];
|
||||
var listeningTo = this._listeningTo;
|
||||
if (!listeningTo) return this;
|
||||
var remove = !name && !callback;
|
||||
if (!callback && typeof name === 'object') callback = this;
|
||||
if (obj) (listeningTo = {})[obj._listenId] = obj;
|
||||
for (var id in listeningTo) {
|
||||
obj = listeningTo[id];
|
||||
obj.off(name, callback, this);
|
||||
if (remove || _.isEmpty(obj._events)) delete this._listeningTo[id];
|
||||
}
|
||||
return this;
|
||||
}
|
||||
@@ -204,7 +207,7 @@
|
||||
case 1: while (++i < l) (ev = events[i]).callback.call(ev.ctx, a1); return;
|
||||
case 2: while (++i < l) (ev = events[i]).callback.call(ev.ctx, a1, a2); return;
|
||||
case 3: while (++i < l) (ev = events[i]).callback.call(ev.ctx, a1, a2, a3); return;
|
||||
default: while (++i < l) (ev = events[i]).callback.apply(ev.ctx, args);
|
||||
default: while (++i < l) (ev = events[i]).callback.apply(ev.ctx, args); return;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -215,10 +218,10 @@
|
||||
// listening to.
|
||||
_.each(listenMethods, function(implementation, method) {
|
||||
Events[method] = function(obj, name, callback) {
|
||||
var listeners = this._listeners || (this._listeners = {});
|
||||
var id = obj._listenerId || (obj._listenerId = _.uniqueId('l'));
|
||||
listeners[id] = obj;
|
||||
if (typeof name === 'object') callback = this;
|
||||
var listeningTo = this._listeningTo || (this._listeningTo = {});
|
||||
var id = obj._listenId || (obj._listenId = _.uniqueId('l'));
|
||||
listeningTo[id] = obj;
|
||||
if (!callback && typeof name === 'object') callback = this;
|
||||
obj[implementation](name, callback, this);
|
||||
return this;
|
||||
};
|
||||
@@ -243,24 +246,18 @@
|
||||
// Create a new model with the specified attributes. A client id (`cid`)
|
||||
// is automatically generated and assigned for you.
|
||||
var Model = Backbone.Model = function(attributes, options) {
|
||||
var defaults;
|
||||
var attrs = attributes || {};
|
||||
options || (options = {});
|
||||
this.cid = _.uniqueId('c');
|
||||
this.attributes = {};
|
||||
_.extend(this, _.pick(options, modelOptions));
|
||||
if (options.collection) this.collection = options.collection;
|
||||
if (options.parse) attrs = this.parse(attrs, options) || {};
|
||||
if (defaults = _.result(this, 'defaults')) {
|
||||
attrs = _.defaults({}, attrs, defaults);
|
||||
}
|
||||
attrs = _.defaults({}, attrs, _.result(this, 'defaults'));
|
||||
this.set(attrs, options);
|
||||
this.changed = {};
|
||||
this.initialize.apply(this, arguments);
|
||||
};
|
||||
|
||||
// A list of options to be attached directly to the model, if provided.
|
||||
var modelOptions = ['url', 'urlRoot', 'collection'];
|
||||
|
||||
// Attach all inheritable methods to the Model prototype.
|
||||
_.extend(Model.prototype, Events, {
|
||||
|
||||
@@ -355,7 +352,7 @@
|
||||
|
||||
// Trigger all relevant attribute changes.
|
||||
if (!silent) {
|
||||
if (changes.length) this._pending = true;
|
||||
if (changes.length) this._pending = options;
|
||||
for (var i = 0, l = changes.length; i < l; i++) {
|
||||
this.trigger('change:' + changes[i], this, current[changes[i]], options);
|
||||
}
|
||||
@@ -366,6 +363,7 @@
|
||||
if (changing) return this;
|
||||
if (!silent) {
|
||||
while (this._pending) {
|
||||
options = this._pending;
|
||||
this._pending = false;
|
||||
this.trigger('change', this, options);
|
||||
}
|
||||
@@ -456,13 +454,16 @@
|
||||
(attrs = {})[key] = val;
|
||||
}
|
||||
|
||||
// If we're not waiting and attributes exist, save acts as `set(attr).save(null, opts)`.
|
||||
if (attrs && (!options || !options.wait) && !this.set(attrs, options)) return false;
|
||||
|
||||
options = _.extend({validate: true}, options);
|
||||
|
||||
// Do not persist invalid models.
|
||||
if (!this._validate(attrs, options)) return false;
|
||||
// If we're not waiting and attributes exist, save acts as
|
||||
// `set(attr).save(null, opts)` with validation. Otherwise, check if
|
||||
// the model will be valid when the attributes, if any, are set.
|
||||
if (attrs && !options.wait) {
|
||||
if (!this.set(attrs, options)) return false;
|
||||
} else {
|
||||
if (!this._validate(attrs, options)) return false;
|
||||
}
|
||||
|
||||
// Set temporary attributes if `{wait: true}`.
|
||||
if (attrs && options.wait) {
|
||||
@@ -530,9 +531,12 @@
|
||||
// using Backbone's restful methods, override this to change the endpoint
|
||||
// that will be called.
|
||||
url: function() {
|
||||
var base = _.result(this, 'urlRoot') || _.result(this.collection, 'url') || urlError();
|
||||
var base =
|
||||
_.result(this, 'urlRoot') ||
|
||||
_.result(this.collection, 'url') ||
|
||||
urlError();
|
||||
if (this.isNew()) return base;
|
||||
return base + (base.charAt(base.length - 1) === '/' ? '' : '/') + encodeURIComponent(this.id);
|
||||
return base.replace(/([^\/])$/, '$1/') + encodeURIComponent(this.id);
|
||||
},
|
||||
|
||||
// **parse** converts a response into the hash of attributes to be `set` on
|
||||
@@ -548,7 +552,7 @@
|
||||
|
||||
// A model is new if it has never been saved to the server, and lacks an id.
|
||||
isNew: function() {
|
||||
return this.id == null;
|
||||
return !this.has(this.idAttribute);
|
||||
},
|
||||
|
||||
// Check if the model is currently in a valid state.
|
||||
@@ -563,7 +567,7 @@
|
||||
attrs = _.extend({}, this.attributes, attrs);
|
||||
var error = this.validationError = this.validate(attrs, options) || null;
|
||||
if (!error) return true;
|
||||
this.trigger('invalid', this, error, _.extend(options || {}, {validationError: error}));
|
||||
this.trigger('invalid', this, error, _.extend(options, {validationError: error}));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -596,7 +600,6 @@
|
||||
// its models in sort order, as they're added and removed.
|
||||
var Collection = Backbone.Collection = function(models, options) {
|
||||
options || (options = {});
|
||||
if (options.url) this.url = options.url;
|
||||
if (options.model) this.model = options.model;
|
||||
if (options.comparator !== void 0) this.comparator = options.comparator;
|
||||
this._reset();
|
||||
@@ -606,7 +609,7 @@
|
||||
|
||||
// Default options for `Collection#set`.
|
||||
var setOptions = {add: true, remove: true, merge: true};
|
||||
var addOptions = {add: true, merge: false, remove: false};
|
||||
var addOptions = {add: true, remove: false};
|
||||
|
||||
// Define the Collection's inheritable methods.
|
||||
_.extend(Collection.prototype, Events, {
|
||||
@@ -632,16 +635,17 @@
|
||||
|
||||
// Add a model, or list of models to the set.
|
||||
add: function(models, options) {
|
||||
return this.set(models, _.defaults(options || {}, addOptions));
|
||||
return this.set(models, _.extend({merge: false}, options, addOptions));
|
||||
},
|
||||
|
||||
// Remove a model, or a list of models from the set.
|
||||
remove: function(models, options) {
|
||||
models = _.isArray(models) ? models.slice() : [models];
|
||||
var singular = !_.isArray(models);
|
||||
models = singular ? [models] : _.clone(models);
|
||||
options || (options = {});
|
||||
var i, l, index, model;
|
||||
for (i = 0, l = models.length; i < l; i++) {
|
||||
model = this.get(models[i]);
|
||||
model = models[i] = this.get(models[i]);
|
||||
if (!model) continue;
|
||||
delete this._byId[model.id];
|
||||
delete this._byId[model.cid];
|
||||
@@ -652,9 +656,9 @@
|
||||
options.index = index;
|
||||
model.trigger('remove', model, this, options);
|
||||
}
|
||||
this._removeReference(model);
|
||||
this._removeReference(model, options);
|
||||
}
|
||||
return this;
|
||||
return singular ? models[0] : models;
|
||||
},
|
||||
|
||||
// Update a collection by `set`-ing a new list of models, adding new ones,
|
||||
@@ -662,43 +666,57 @@
|
||||
// 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);
|
||||
options = _.defaults({}, options, setOptions);
|
||||
if (options.parse) models = this.parse(models, options);
|
||||
if (!_.isArray(models)) models = models ? [models] : [];
|
||||
var i, l, model, attrs, existing, sort;
|
||||
var singular = !_.isArray(models);
|
||||
models = singular ? (models ? [models] : []) : _.clone(models);
|
||||
var i, l, id, model, attrs, existing, sort;
|
||||
var at = options.at;
|
||||
var targetModel = this.model;
|
||||
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;
|
||||
|
||||
// Turn bare objects into model references, and prevent invalid models
|
||||
// from being added.
|
||||
for (i = 0, l = models.length; i < l; i++) {
|
||||
if (!(model = this._prepareModel(models[i], options))) continue;
|
||||
attrs = models[i] || {};
|
||||
if (attrs instanceof Model) {
|
||||
id = model = attrs;
|
||||
} else {
|
||||
id = attrs[targetModel.prototype.idAttribute || 'id'];
|
||||
}
|
||||
|
||||
// If a duplicate is found, prevent it from being added and
|
||||
// optionally merge it into the existing model.
|
||||
if (existing = this.get(model)) {
|
||||
if (options.remove) modelMap[existing.cid] = true;
|
||||
if (options.merge) {
|
||||
existing.set(model.attributes, options);
|
||||
if (existing = this.get(id)) {
|
||||
if (remove) modelMap[existing.cid] = true;
|
||||
if (merge) {
|
||||
attrs = attrs === model ? model.attributes : attrs;
|
||||
if (options.parse) attrs = existing.parse(attrs, options);
|
||||
existing.set(attrs, options);
|
||||
if (sortable && !sort && existing.hasChanged(sortAttr)) sort = true;
|
||||
}
|
||||
models[i] = existing;
|
||||
|
||||
// This is a new model, push it to the `toAdd` list.
|
||||
} else if (options.add) {
|
||||
// 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);
|
||||
|
||||
// Listen to added models' events, and index models for lookup by
|
||||
// `id` and by `cid`.
|
||||
model.on('all', this._onModelEvent, this);
|
||||
this._byId[model.cid] = model;
|
||||
if (model.id != null) this._byId[model.id] = model;
|
||||
this._addReference(model, options);
|
||||
}
|
||||
|
||||
// Do not add multiple models with the same `id`.
|
||||
model = existing || model;
|
||||
if (order && (model.isNew() || !modelMap[model.id])) order.push(model);
|
||||
modelMap[model.id] = true;
|
||||
}
|
||||
|
||||
// Remove nonexistent models if appropriate.
|
||||
if (options.remove) {
|
||||
if (remove) {
|
||||
for (i = 0, l = this.length; i < l; ++i) {
|
||||
if (!modelMap[(model = this.models[i]).cid]) toRemove.push(model);
|
||||
}
|
||||
@@ -706,29 +724,35 @@
|
||||
}
|
||||
|
||||
// See if sorting is needed, update `length` and splice in new models.
|
||||
if (toAdd.length) {
|
||||
if (toAdd.length || (order && order.length)) {
|
||||
if (sortable) sort = true;
|
||||
this.length += toAdd.length;
|
||||
if (at != null) {
|
||||
splice.apply(this.models, [at, 0].concat(toAdd));
|
||||
for (i = 0, l = toAdd.length; i < l; i++) {
|
||||
this.models.splice(at + i, 0, toAdd[i]);
|
||||
}
|
||||
} else {
|
||||
push.apply(this.models, toAdd);
|
||||
if (order) this.models.length = 0;
|
||||
var orderedModels = order || toAdd;
|
||||
for (i = 0, l = orderedModels.length; i < l; i++) {
|
||||
this.models.push(orderedModels[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Silently sort the collection if appropriate.
|
||||
if (sort) this.sort({silent: true});
|
||||
|
||||
if (options.silent) return this;
|
||||
|
||||
// Trigger `add` events.
|
||||
for (i = 0, l = toAdd.length; i < l; i++) {
|
||||
(model = toAdd[i]).trigger('add', model, this, options);
|
||||
// Unless silenced, it's time to fire all appropriate add/sort events.
|
||||
if (!options.silent) {
|
||||
for (i = 0, l = toAdd.length; i < l; i++) {
|
||||
(model = toAdd[i]).trigger('add', model, this, options);
|
||||
}
|
||||
if (sort || (order && order.length)) this.trigger('sort', this, options);
|
||||
}
|
||||
|
||||
// Trigger `sort` if the collection was sorted.
|
||||
if (sort) this.trigger('sort', this, options);
|
||||
return this;
|
||||
// Return the added (or merged) model (or models).
|
||||
return singular ? models[0] : models;
|
||||
},
|
||||
|
||||
// When you have more items than you want to add or remove individually,
|
||||
@@ -738,20 +762,18 @@
|
||||
reset: function(models, options) {
|
||||
options || (options = {});
|
||||
for (var i = 0, l = this.models.length; i < l; i++) {
|
||||
this._removeReference(this.models[i]);
|
||||
this._removeReference(this.models[i], options);
|
||||
}
|
||||
options.previousModels = this.models;
|
||||
this._reset();
|
||||
this.add(models, _.extend({silent: true}, options));
|
||||
models = this.add(models, _.extend({silent: true}, options));
|
||||
if (!options.silent) this.trigger('reset', this, options);
|
||||
return this;
|
||||
return models;
|
||||
},
|
||||
|
||||
// Add a model to the end of the collection.
|
||||
push: function(model, options) {
|
||||
model = this._prepareModel(model, options);
|
||||
this.add(model, _.extend({at: this.length}, options));
|
||||
return model;
|
||||
return this.add(model, _.extend({at: this.length}, options));
|
||||
},
|
||||
|
||||
// Remove a model from the end of the collection.
|
||||
@@ -763,9 +785,7 @@
|
||||
|
||||
// Add a model to the beginning of the collection.
|
||||
unshift: function(model, options) {
|
||||
model = this._prepareModel(model, options);
|
||||
this.add(model, _.extend({at: 0}, options));
|
||||
return model;
|
||||
return this.add(model, _.extend({at: 0}, options));
|
||||
},
|
||||
|
||||
// Remove a model from the beginning of the collection.
|
||||
@@ -776,14 +796,14 @@
|
||||
},
|
||||
|
||||
// Slice out a sub-array of models from the collection.
|
||||
slice: function(begin, end) {
|
||||
return this.models.slice(begin, end);
|
||||
slice: function() {
|
||||
return slice.apply(this.models, arguments);
|
||||
},
|
||||
|
||||
// Get a model from the set by id.
|
||||
get: function(obj) {
|
||||
if (obj == null) return void 0;
|
||||
return this._byId[obj.id != null ? obj.id : obj.cid || obj];
|
||||
return this._byId[obj] || this._byId[obj.id] || this._byId[obj.cid];
|
||||
},
|
||||
|
||||
// Get the model at the given index.
|
||||
@@ -827,16 +847,6 @@
|
||||
return this;
|
||||
},
|
||||
|
||||
// Figure out the smallest index at which a model should be inserted so as
|
||||
// to maintain order.
|
||||
sortedIndex: function(model, value, context) {
|
||||
value || (value = this.comparator);
|
||||
var iterator = _.isFunction(value) ? value : function(model) {
|
||||
return model.get(value);
|
||||
};
|
||||
return _.sortedIndex(this.models, model, iterator, context);
|
||||
},
|
||||
|
||||
// Pluck an attribute from each model in the collection.
|
||||
pluck: function(attr) {
|
||||
return _.invoke(this.models, 'get', attr);
|
||||
@@ -869,7 +879,7 @@
|
||||
if (!options.wait) this.add(model, options);
|
||||
var collection = this;
|
||||
var success = options.success;
|
||||
options.success = function(resp) {
|
||||
options.success = function(model, resp) {
|
||||
if (options.wait) collection.add(model, options);
|
||||
if (success) success(model, resp, options);
|
||||
};
|
||||
@@ -899,22 +909,25 @@
|
||||
// Prepare a hash of attributes (or other model) to be added to this
|
||||
// collection.
|
||||
_prepareModel: function(attrs, options) {
|
||||
if (attrs instanceof Model) {
|
||||
if (!attrs.collection) attrs.collection = this;
|
||||
return attrs;
|
||||
}
|
||||
options || (options = {});
|
||||
if (attrs instanceof Model) return attrs;
|
||||
options = options ? _.clone(options) : {};
|
||||
options.collection = this;
|
||||
var model = new this.model(attrs, options);
|
||||
if (!model._validate(attrs, options)) {
|
||||
this.trigger('invalid', this, attrs, options);
|
||||
return false;
|
||||
}
|
||||
return model;
|
||||
if (!model.validationError) return model;
|
||||
this.trigger('invalid', this, model.validationError, options);
|
||||
return false;
|
||||
},
|
||||
|
||||
// Internal method to create a model's ties to a collection.
|
||||
_addReference: function(model, options) {
|
||||
this._byId[model.cid] = model;
|
||||
if (model.id != null) this._byId[model.id] = model;
|
||||
if (!model.collection) model.collection = this;
|
||||
model.on('all', this._onModelEvent, this);
|
||||
},
|
||||
|
||||
// Internal method to sever a model's ties to a collection.
|
||||
_removeReference: function(model) {
|
||||
_removeReference: function(model, options) {
|
||||
if (this === model.collection) delete model.collection;
|
||||
model.off('all', this._onModelEvent, this);
|
||||
},
|
||||
@@ -942,8 +955,8 @@
|
||||
'inject', 'reduceRight', 'foldr', 'find', 'detect', 'filter', 'select',
|
||||
'reject', 'every', 'all', 'some', 'any', 'include', 'contains', 'invoke',
|
||||
'max', 'min', 'toArray', 'size', 'first', 'head', 'take', 'initial', 'rest',
|
||||
'tail', 'drop', 'last', 'without', 'indexOf', 'shuffle', 'lastIndexOf',
|
||||
'isEmpty', 'chain'];
|
||||
'tail', 'drop', 'last', 'without', 'difference', 'indexOf', 'shuffle',
|
||||
'lastIndexOf', 'isEmpty', 'chain', 'sample'];
|
||||
|
||||
// Mix in each Underscore method as a proxy to `Collection#models`.
|
||||
_.each(methods, function(method) {
|
||||
@@ -955,7 +968,7 @@
|
||||
});
|
||||
|
||||
// Underscore methods that take a property name as an argument.
|
||||
var attributeMethods = ['groupBy', 'countBy', 'sortBy'];
|
||||
var attributeMethods = ['groupBy', 'countBy', 'sortBy', 'indexBy'];
|
||||
|
||||
// Use attributes instead of properties.
|
||||
_.each(attributeMethods, function(method) {
|
||||
@@ -982,7 +995,8 @@
|
||||
// if an existing element is not provided...
|
||||
var View = Backbone.View = function(options) {
|
||||
this.cid = _.uniqueId('view');
|
||||
this._configure(options || {});
|
||||
options || (options = {});
|
||||
_.extend(this, _.pick(options, viewOptions));
|
||||
this._ensureElement();
|
||||
this.initialize.apply(this, arguments);
|
||||
this.delegateEvents();
|
||||
@@ -1001,7 +1015,7 @@
|
||||
tagName: 'div',
|
||||
|
||||
// jQuery delegate for element lookup, scoped to DOM elements within the
|
||||
// current view. This should be prefered to global lookups where possible.
|
||||
// current view. This should be preferred to global lookups where possible.
|
||||
$: function(selector) {
|
||||
return this.$el.find(selector);
|
||||
},
|
||||
@@ -1041,7 +1055,7 @@
|
||||
//
|
||||
// {
|
||||
// 'mousedown .title': 'edit',
|
||||
// 'click .button': 'save'
|
||||
// 'click .button': 'save',
|
||||
// 'click .open': function(e) { ... }
|
||||
// }
|
||||
//
|
||||
@@ -1079,16 +1093,6 @@
|
||||
return this;
|
||||
},
|
||||
|
||||
// Performs the initial configuration of a View with a set of options.
|
||||
// Keys with special meaning *(e.g. model, collection, id, className)* are
|
||||
// attached directly to the view. See `viewOptions` for an exhaustive
|
||||
// list.
|
||||
_configure: function(options) {
|
||||
if (this.options) options = _.extend({}, _.result(this, 'options'), options);
|
||||
_.extend(this, _.pick(options, viewOptions));
|
||||
this.options = options;
|
||||
},
|
||||
|
||||
// Ensure that the View has a DOM element to render into.
|
||||
// If `this.el` is a string, pass it through `$()`, take the first
|
||||
// matching element, and re-assign it to `el`. Otherwise, create
|
||||
@@ -1174,8 +1178,7 @@
|
||||
// If we're sending a `PATCH` request, and we're in an old Internet Explorer
|
||||
// that still has ActiveX enabled by default, override jQuery to use that
|
||||
// for XHR instead. Remove this line when jQuery supports `PATCH` on IE8.
|
||||
if (params.type === 'PATCH' && window.ActiveXObject &&
|
||||
!(window.external && window.external.msActiveXFilteringEnabled)) {
|
||||
if (params.type === 'PATCH' && noXhrPatch) {
|
||||
params.xhr = function() {
|
||||
return new ActiveXObject("Microsoft.XMLHTTP");
|
||||
};
|
||||
@@ -1187,6 +1190,10 @@
|
||||
return xhr;
|
||||
};
|
||||
|
||||
var noXhrPatch =
|
||||
typeof window !== 'undefined' && !!window.ActiveXObject &&
|
||||
!(window.XMLHttpRequest && (new XMLHttpRequest).dispatchEvent);
|
||||
|
||||
// Map from CRUD to HTTP for our default `Backbone.sync` implementation.
|
||||
var methodMap = {
|
||||
'create': 'POST',
|
||||
@@ -1244,7 +1251,7 @@
|
||||
var router = this;
|
||||
Backbone.history.route(route, function(fragment) {
|
||||
var args = router._extractParameters(route, fragment);
|
||||
callback && callback.apply(router, args);
|
||||
router.execute(callback, args);
|
||||
router.trigger.apply(router, ['route:' + name].concat(args));
|
||||
router.trigger('route', name, args);
|
||||
Backbone.history.trigger('route', router, name, args);
|
||||
@@ -1252,6 +1259,12 @@
|
||||
return this;
|
||||
},
|
||||
|
||||
// Execute a route handler with the provided parameters. This is an
|
||||
// excellent place to do pre-route setup or post-route cleanup.
|
||||
execute: function(callback, args) {
|
||||
if (callback) callback.apply(this, args);
|
||||
},
|
||||
|
||||
// Simple proxy to `Backbone.history` to save a fragment into the history.
|
||||
navigate: function(fragment, options) {
|
||||
Backbone.history.navigate(fragment, options);
|
||||
@@ -1275,11 +1288,11 @@
|
||||
_routeToRegExp: function(route) {
|
||||
route = route.replace(escapeRegExp, '\\$&')
|
||||
.replace(optionalParam, '(?:$1)?')
|
||||
.replace(namedParam, function(match, optional){
|
||||
return optional ? match : '([^\/]+)';
|
||||
.replace(namedParam, function(match, optional) {
|
||||
return optional ? match : '([^/?]+)';
|
||||
})
|
||||
.replace(splatParam, '(.*?)');
|
||||
return new RegExp('^' + route + '$');
|
||||
.replace(splatParam, '([^?]*?)');
|
||||
return new RegExp('^' + route + '(?:\\?([\\s\\S]*))?$');
|
||||
},
|
||||
|
||||
// Given a route, and a URL fragment that it matches, return the array of
|
||||
@@ -1287,7 +1300,9 @@
|
||||
// treated as `null` to normalize cross-browser behavior.
|
||||
_extractParameters: function(route, fragment) {
|
||||
var params = route.exec(fragment).slice(1);
|
||||
return _.map(params, function(param) {
|
||||
return _.map(params, function(param, i) {
|
||||
// Don't decode the search params.
|
||||
if (i === params.length - 1) return param || null;
|
||||
return param ? decodeURIComponent(param) : null;
|
||||
});
|
||||
}
|
||||
@@ -1325,6 +1340,9 @@
|
||||
// Cached regex for removing a trailing slash.
|
||||
var trailingSlash = /\/$/;
|
||||
|
||||
// Cached regex for stripping urls of hash.
|
||||
var pathStripper = /#.*$/;
|
||||
|
||||
// Has the history handling already been started?
|
||||
History.started = false;
|
||||
|
||||
@@ -1335,6 +1353,11 @@
|
||||
// twenty times a second.
|
||||
interval: 50,
|
||||
|
||||
// Are we at the app root?
|
||||
atRoot: function() {
|
||||
return this.location.pathname.replace(/[^\/]$/, '$&/') === this.root;
|
||||
},
|
||||
|
||||
// Gets the true hash value. Cannot use location.hash directly due to bug
|
||||
// in Firefox where location.hash will always be decoded.
|
||||
getHash: function(window) {
|
||||
@@ -1347,9 +1370,9 @@
|
||||
getFragment: function(fragment, forcePushState) {
|
||||
if (fragment == null) {
|
||||
if (this._hasPushState || !this._wantsHashChange || forcePushState) {
|
||||
fragment = this.location.pathname;
|
||||
fragment = decodeURI(this.location.pathname + this.location.search);
|
||||
var root = this.root.replace(trailingSlash, '');
|
||||
if (!fragment.indexOf(root)) fragment = fragment.substr(root.length);
|
||||
if (!fragment.indexOf(root)) fragment = fragment.slice(root.length);
|
||||
} else {
|
||||
fragment = this.getHash();
|
||||
}
|
||||
@@ -1365,7 +1388,7 @@
|
||||
|
||||
// Figure out the initial configuration. Do we need an iframe?
|
||||
// Is pushState desired ... is it available?
|
||||
this.options = _.extend({}, {root: '/'}, this.options, options);
|
||||
this.options = _.extend({root: '/'}, this.options, options);
|
||||
this.root = this.options.root;
|
||||
this._wantsHashChange = this.options.hashChange !== false;
|
||||
this._wantsPushState = !!this.options.pushState;
|
||||
@@ -1378,7 +1401,8 @@
|
||||
this.root = ('/' + this.root + '/').replace(rootStripper, '/');
|
||||
|
||||
if (oldIE && this._wantsHashChange) {
|
||||
this.iframe = Backbone.$('<iframe src="javascript:0" tabindex="-1" />').hide().appendTo('body')[0].contentWindow;
|
||||
var frame = Backbone.$('<iframe src="javascript:0" tabindex="-1">');
|
||||
this.iframe = frame.hide().appendTo('body')[0].contentWindow;
|
||||
this.navigate(fragment);
|
||||
}
|
||||
|
||||
@@ -1396,21 +1420,26 @@
|
||||
// opened by a non-pushState browser.
|
||||
this.fragment = fragment;
|
||||
var loc = this.location;
|
||||
var atRoot = loc.pathname.replace(/[^\/]$/, '$&/') === this.root;
|
||||
|
||||
// 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._wantsHashChange && this._wantsPushState && !this._hasPushState && !atRoot) {
|
||||
this.fragment = this.getFragment(null, true);
|
||||
this.location.replace(this.root + this.location.search + '#' + this.fragment);
|
||||
// Return immediately as browser will do redirect to new url
|
||||
return true;
|
||||
// Transition from hashChange to pushState or vice versa if both are
|
||||
// requested.
|
||||
if (this._wantsHashChange && this._wantsPushState) {
|
||||
|
||||
// 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()) {
|
||||
this.fragment = this.getFragment(null, true);
|
||||
this.location.replace(this.root + '#' + this.fragment);
|
||||
// Return immediately as browser will do redirect to new url
|
||||
return true;
|
||||
|
||||
// Or if we've started out with a hash-based route, but we're currently
|
||||
// in a browser where it could be `pushState`-based instead...
|
||||
} else if (this._hasPushState && this.atRoot() && loc.hash) {
|
||||
this.fragment = this.getHash().replace(routeStripper, '');
|
||||
this.history.replaceState({}, document.title, this.root + this.fragment);
|
||||
}
|
||||
|
||||
// Or if we've started out with a hash-based route, but we're currently
|
||||
// in a browser where it could be `pushState`-based instead...
|
||||
} else if (this._wantsPushState && this._hasPushState && atRoot && loc.hash) {
|
||||
this.fragment = this.getHash().replace(routeStripper, '');
|
||||
this.history.replaceState({}, document.title, this.root + this.fragment + loc.search);
|
||||
}
|
||||
|
||||
if (!this.options.silent) return this.loadUrl();
|
||||
@@ -1420,7 +1449,7 @@
|
||||
// but possibly useful for unit testing Routers.
|
||||
stop: function() {
|
||||
Backbone.$(window).off('popstate', this.checkUrl).off('hashchange', this.checkUrl);
|
||||
clearInterval(this._checkUrlInterval);
|
||||
if (this._checkUrlInterval) clearInterval(this._checkUrlInterval);
|
||||
History.started = false;
|
||||
},
|
||||
|
||||
@@ -1439,21 +1468,20 @@
|
||||
}
|
||||
if (current === this.fragment) return false;
|
||||
if (this.iframe) this.navigate(current);
|
||||
this.loadUrl() || this.loadUrl(this.getHash());
|
||||
this.loadUrl();
|
||||
},
|
||||
|
||||
// Attempt to load the current URL fragment. If a route succeeds with a
|
||||
// match, returns `true`. If no defined routes matches the fragment,
|
||||
// returns `false`.
|
||||
loadUrl: function(fragmentOverride) {
|
||||
var fragment = this.fragment = this.getFragment(fragmentOverride);
|
||||
var matched = _.any(this.handlers, function(handler) {
|
||||
loadUrl: function(fragment) {
|
||||
fragment = this.fragment = this.getFragment(fragment);
|
||||
return _.any(this.handlers, function(handler) {
|
||||
if (handler.route.test(fragment)) {
|
||||
handler.callback(fragment);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
return matched;
|
||||
},
|
||||
|
||||
// Save a fragment into the hash history, or replace the URL state if the
|
||||
@@ -1465,11 +1493,18 @@
|
||||
// you wish to modify the current URL without adding an entry to the history.
|
||||
navigate: function(fragment, options) {
|
||||
if (!History.started) return false;
|
||||
if (!options || options === true) options = {trigger: options};
|
||||
fragment = this.getFragment(fragment || '');
|
||||
if (!options || options === true) options = {trigger: !!options};
|
||||
|
||||
var url = this.root + (fragment = this.getFragment(fragment || ''));
|
||||
|
||||
// Strip the hash for matching.
|
||||
fragment = fragment.replace(pathStripper, '');
|
||||
|
||||
if (this.fragment === fragment) return;
|
||||
this.fragment = fragment;
|
||||
var url = this.root + fragment;
|
||||
|
||||
// Don't include a trailing slash on the root.
|
||||
if (fragment === '' && url !== '/') url = url.slice(0, -1);
|
||||
|
||||
// If pushState is available, we use it to set the fragment as a real URL.
|
||||
if (this._hasPushState) {
|
||||
@@ -1492,7 +1527,7 @@
|
||||
} else {
|
||||
return this.location.assign(url);
|
||||
}
|
||||
if (options.trigger) this.loadUrl(fragment);
|
||||
if (options.trigger) return this.loadUrl(fragment);
|
||||
},
|
||||
|
||||
// Update the hash location, either replacing the current entry, or adding
|
||||
@@ -1560,7 +1595,7 @@
|
||||
};
|
||||
|
||||
// Wrap an optional error callback with a fallback error event.
|
||||
var wrapError = function (model, options) {
|
||||
var wrapError = function(model, options) {
|
||||
var error = options.error;
|
||||
options.error = function(resp) {
|
||||
if (error) error(model, resp, options);
|
||||
@@ -1568,4 +1603,6 @@
|
||||
};
|
||||
};
|
||||
|
||||
}).call(this);
|
||||
return Backbone;
|
||||
|
||||
}));
|
||||
|
||||
334
vendor/backbone/test/collection.js
vendored
334
vendor/backbone/test/collection.js
vendored
@@ -1,12 +1,10 @@
|
||||
$(document).ready(function() {
|
||||
(function() {
|
||||
|
||||
var a, b, c, d, e, col, otherCol;
|
||||
|
||||
module("Backbone.Collection", _.extend(new Environment, {
|
||||
module("Backbone.Collection", {
|
||||
|
||||
setup: function() {
|
||||
Environment.prototype.setup.apply(this, arguments);
|
||||
|
||||
a = new Backbone.Model({id: 3, label: 'a'});
|
||||
b = new Backbone.Model({id: 2, label: 'b'});
|
||||
c = new Backbone.Model({id: 1, label: 'c'});
|
||||
@@ -16,7 +14,7 @@ $(document).ready(function() {
|
||||
otherCol = new Backbone.Collection();
|
||||
}
|
||||
|
||||
}));
|
||||
});
|
||||
|
||||
test("new and sort", 9, function() {
|
||||
var counter = 0;
|
||||
@@ -87,7 +85,12 @@ $(document).ready(function() {
|
||||
equal(col2.get(model.clone()), col2.first());
|
||||
});
|
||||
|
||||
test("update index when id changes", 3, function() {
|
||||
test('get with "undefined" id', function() {
|
||||
var collection = new Backbone.Collection([{id: 1}, {id: 'undefined'}]);
|
||||
equal(collection.get(1).id, 1);
|
||||
}),
|
||||
|
||||
test("update index when id changes", 4, function() {
|
||||
var col = new Backbone.Collection();
|
||||
col.add([
|
||||
{id : 0, name : 'one'},
|
||||
@@ -95,9 +98,10 @@ $(document).ready(function() {
|
||||
]);
|
||||
var one = col.get(0);
|
||||
equal(one.get('name'), 'one');
|
||||
one.set({id : 101});
|
||||
col.on('change:name', function (model) { ok(this.get(model)); });
|
||||
one.set({name: 'dalmatians', id : 101});
|
||||
equal(col.get(0), null);
|
||||
equal(col.get(101).get('name'), 'one');
|
||||
equal(col.get(101).get('name'), 'dalmatians');
|
||||
});
|
||||
|
||||
test("at", 1, function() {
|
||||
@@ -108,7 +112,7 @@ $(document).ready(function() {
|
||||
equal(col.pluck('label').join(' '), 'a b c d');
|
||||
});
|
||||
|
||||
test("add", 10, function() {
|
||||
test("add", 14, function() {
|
||||
var added, opts, secondAdded;
|
||||
added = opts = secondAdded = null;
|
||||
e = new Backbone.Model({id: 10, label : 'e'});
|
||||
@@ -137,6 +141,18 @@ $(document).ready(function() {
|
||||
equal(atCol.length, 4);
|
||||
equal(atCol.at(1), e);
|
||||
equal(atCol.last(), h);
|
||||
|
||||
var coll = new Backbone.Collection(new Array(2));
|
||||
var addCount = 0;
|
||||
coll.on('add', function(){
|
||||
addCount += 1;
|
||||
});
|
||||
coll.add([undefined, f, g]);
|
||||
equal(coll.length, 5);
|
||||
equal(addCount, 3);
|
||||
coll.add(new Array(4));
|
||||
equal(coll.length, 9);
|
||||
equal(addCount, 7);
|
||||
});
|
||||
|
||||
test("add multiple models", 6, function() {
|
||||
@@ -226,13 +242,13 @@ $(document).ready(function() {
|
||||
});
|
||||
|
||||
test("add with parse and merge", function() {
|
||||
var Model = Backbone.Model.extend({
|
||||
parse: function (data) {
|
||||
return data.model;
|
||||
}
|
||||
});
|
||||
var collection = new Backbone.Collection();
|
||||
collection.model = Model;
|
||||
collection.parse = function(attrs) {
|
||||
return _.map(attrs, function(model) {
|
||||
if (model.model) return model.model;
|
||||
return model;
|
||||
});
|
||||
};
|
||||
collection.add({id: 1});
|
||||
collection.add({model: {id: 1, name: 'Alf'}}, {parse: true, merge: true});
|
||||
equal(collection.first().get('name'), 'Alf');
|
||||
@@ -288,6 +304,39 @@ $(document).ready(function() {
|
||||
equal(otherRemoved, null);
|
||||
});
|
||||
|
||||
test("add and remove return values", 13, function() {
|
||||
var Even = Backbone.Model.extend({
|
||||
validate: function(attrs) {
|
||||
if (attrs.id % 2 !== 0) return "odd";
|
||||
}
|
||||
});
|
||||
var col = new Backbone.Collection;
|
||||
col.model = Even;
|
||||
|
||||
var list = col.add([{id: 2}, {id: 4}], {validate: true});
|
||||
equal(list.length, 2);
|
||||
ok(list[0] instanceof Backbone.Model);
|
||||
equal(list[1], col.last());
|
||||
equal(list[1].get('id'), 4);
|
||||
|
||||
list = col.add([{id: 3}, {id: 6}], {validate: true});
|
||||
equal(col.length, 3);
|
||||
equal(list[0], false);
|
||||
equal(list[1].get('id'), 6);
|
||||
|
||||
var result = col.add({id: 6});
|
||||
equal(result.cid, list[1].cid);
|
||||
|
||||
result = col.remove({id: 6});
|
||||
equal(col.length, 2);
|
||||
equal(result.id, 6);
|
||||
|
||||
list = col.remove([{id: 2}, {id: 8}]);
|
||||
equal(col.length, 1);
|
||||
equal(list[0].get('id'), 2);
|
||||
equal(list[1], null);
|
||||
});
|
||||
|
||||
test("shift and pop", 2, function() {
|
||||
var col = new Backbone.Collection([{a: 'a'}, {b: 'b'}, {c: 'c'}]);
|
||||
equal(col.shift().get('a'), 'a');
|
||||
@@ -438,7 +487,7 @@ $(document).ready(function() {
|
||||
equal(model.collection, collection);
|
||||
});
|
||||
|
||||
test("create with validate:true enforces validation", 2, function() {
|
||||
test("create with validate:true enforces validation", 3, function() {
|
||||
var ValidatingModel = Backbone.Model.extend({
|
||||
validate: function(attrs) {
|
||||
return "fail";
|
||||
@@ -448,7 +497,8 @@ $(document).ready(function() {
|
||||
model: ValidatingModel
|
||||
});
|
||||
var col = new ValidatingCollection();
|
||||
col.on('invalid', function (collection, attrs, options) {
|
||||
col.on('invalid', function (collection, error, options) {
|
||||
equal(error, "fail");
|
||||
equal(options.validationError, 'fail');
|
||||
});
|
||||
equal(col.create({"foo":"bar"}, {validate:true}), false);
|
||||
@@ -502,7 +552,7 @@ $(document).ready(function() {
|
||||
equal(coll.findWhere({a: 4}), void 0);
|
||||
});
|
||||
|
||||
test("Underscore methods", 13, function() {
|
||||
test("Underscore methods", 16, function() {
|
||||
equal(col.map(function(model){ return model.get('label'); }).join(' '), 'a b c d');
|
||||
equal(col.any(function(model){ return model.id === 100; }), false);
|
||||
equal(col.any(function(model){ return model.id === 0; }), true);
|
||||
@@ -520,21 +570,13 @@ $(document).ready(function() {
|
||||
.map(function(o){ return o.id * 2; })
|
||||
.value(),
|
||||
[4, 0]);
|
||||
deepEqual(col.difference([c, d]), [a, b]);
|
||||
ok(col.include(col.sample()));
|
||||
var first = col.first();
|
||||
ok(col.indexBy('id')[first.id] === first);
|
||||
});
|
||||
|
||||
test("sortedIndex", function () {
|
||||
var model = new Backbone.Model({key: 2});
|
||||
var collection = new (Backbone.Collection.extend({
|
||||
comparator: 'key'
|
||||
}))([model, {key: 1}]);
|
||||
equal(collection.sortedIndex(model), 1);
|
||||
equal(collection.sortedIndex(model, 'key'), 1);
|
||||
equal(collection.sortedIndex(model, function (model) {
|
||||
return model.get('key');
|
||||
}), 1);
|
||||
});
|
||||
|
||||
test("reset", 12, function() {
|
||||
test("reset", 16, function() {
|
||||
var resetCount = 0;
|
||||
var models = col.models;
|
||||
col.on('reset', function() { resetCount += 1; });
|
||||
@@ -554,6 +596,15 @@ $(document).ready(function() {
|
||||
col.reset();
|
||||
equal(col.length, 0);
|
||||
equal(resetCount, 4);
|
||||
|
||||
var f = new Backbone.Model({id: 20, label : 'f'});
|
||||
col.reset([undefined, f]);
|
||||
equal(col.length, 2);
|
||||
equal(resetCount, 5);
|
||||
|
||||
col.reset(new Array(4));
|
||||
equal(col.length, 4);
|
||||
equal(resetCount, 6);
|
||||
});
|
||||
|
||||
test ("reset with different values", function(){
|
||||
@@ -963,17 +1014,33 @@ $(document).ready(function() {
|
||||
equal(col.first().get('key'), 'other');
|
||||
|
||||
col.set({id: 1, other: 'value'});
|
||||
equal(col.first().get('key'), 'value');
|
||||
equal(col.first().get('key'), 'other');
|
||||
equal(col.length, 1);
|
||||
});
|
||||
|
||||
test("`set` and model level `parse`", function() {
|
||||
test('merge without mutation', function () {
|
||||
var Model = Backbone.Model.extend({
|
||||
parse: function (res) { return res.model; }
|
||||
initialize: function (attrs, options) {
|
||||
if (attrs.child) {
|
||||
this.set('child', new Model(attrs.child, options), options);
|
||||
}
|
||||
}
|
||||
});
|
||||
var Collection = Backbone.Collection.extend({model: Model});
|
||||
var data = [{id: 1, child: {id: 2}}];
|
||||
var collection = new Collection(data);
|
||||
equal(collection.first().id, 1);
|
||||
collection.set(data);
|
||||
equal(collection.first().id, 1);
|
||||
collection.set([{id: 2, child: {id: 2}}].concat(data));
|
||||
deepEqual(collection.pluck('id'), [2, 1]);
|
||||
});
|
||||
|
||||
test("`set` and model level `parse`", function() {
|
||||
var Model = Backbone.Model.extend({});
|
||||
var Collection = Backbone.Collection.extend({
|
||||
model: Model,
|
||||
parse: function (res) { return res.models; }
|
||||
parse: function (res) { return _.pluck(res.models, 'model'); }
|
||||
});
|
||||
var model = new Model({id: 1});
|
||||
var collection = new Collection(model);
|
||||
@@ -996,6 +1063,25 @@ $(document).ready(function() {
|
||||
collection.set({}, {parse: true});
|
||||
});
|
||||
|
||||
test('`set` matches input order in the absence of a comparator', function () {
|
||||
var one = new Backbone.Model({id: 1});
|
||||
var two = new Backbone.Model({id: 2});
|
||||
var three = new Backbone.Model({id: 3});
|
||||
var collection = new Backbone.Collection([one, two, three]);
|
||||
collection.set([{id: 3}, {id: 2}, {id: 1}]);
|
||||
deepEqual(collection.models, [three, two, one]);
|
||||
collection.set([{id: 1}, {id: 2}]);
|
||||
deepEqual(collection.models, [one, two]);
|
||||
collection.set([two, three, one]);
|
||||
deepEqual(collection.models, [two, three, one]);
|
||||
collection.set([{id: 1}, {id: 2}], {remove: false});
|
||||
deepEqual(collection.models, [two, three, one]);
|
||||
collection.set([{id: 1}, {id: 2}, {id: 3}], {merge: false});
|
||||
deepEqual(collection.models, [one, two, three]);
|
||||
collection.set([three, two, one, {id: 4}], {add: false});
|
||||
deepEqual(collection.models, [one, two, three]);
|
||||
});
|
||||
|
||||
test("#1894 - Push should not trigger a sort", 0, function() {
|
||||
var Collection = Backbone.Collection.extend({
|
||||
comparator: 'id',
|
||||
@@ -1006,6 +1092,13 @@ $(document).ready(function() {
|
||||
new Collection().push({id: 1});
|
||||
});
|
||||
|
||||
test("#2428 - push duplicate models, return the correct one", 1, function() {
|
||||
var col = new Backbone.Collection;
|
||||
var model1 = col.push({id: 101});
|
||||
var model2 = col.push({id: 101})
|
||||
ok(model2.cid == model1.cid);
|
||||
});
|
||||
|
||||
test("`set` with non-normal id", function() {
|
||||
var Collection = Backbone.Collection.extend({
|
||||
model: Backbone.Model.extend({idAttribute: '_id'})
|
||||
@@ -1081,20 +1174,165 @@ $(document).ready(function() {
|
||||
collection.add(collection.models, {merge: true}); // don't sort
|
||||
});
|
||||
|
||||
test("Attach options to collection.", 3, function() {
|
||||
var url = '/somewhere';
|
||||
var model = new Backbone.Model;
|
||||
var comparator = function(){};
|
||||
test("Attach options to collection.", 2, function() {
|
||||
var model = new Backbone.Model;
|
||||
var comparator = function(){};
|
||||
|
||||
var collection = new Backbone.Collection([], {
|
||||
url: url,
|
||||
model: model,
|
||||
comparator: comparator
|
||||
});
|
||||
var collection = new Backbone.Collection([], {
|
||||
model: model,
|
||||
comparator: comparator
|
||||
});
|
||||
|
||||
strictEqual(collection.url, url);
|
||||
ok(collection.model === model);
|
||||
ok(collection.comparator === comparator);
|
||||
ok(collection.model === model);
|
||||
ok(collection.comparator === comparator);
|
||||
});
|
||||
|
||||
});
|
||||
test("`add` overrides `set` flags", function () {
|
||||
var collection = new Backbone.Collection();
|
||||
collection.once('add', function (model, collection, options) {
|
||||
collection.add({id: 2}, options);
|
||||
});
|
||||
collection.set({id: 1});
|
||||
equal(collection.length, 2);
|
||||
});
|
||||
|
||||
test("#2606 - Collection#create, success arguments", 1, function() {
|
||||
var collection = new Backbone.Collection;
|
||||
collection.url = 'test';
|
||||
collection.create({}, {
|
||||
success: function(model, resp, options) {
|
||||
strictEqual(resp, 'response');
|
||||
}
|
||||
});
|
||||
this.ajaxSettings.success('response');
|
||||
});
|
||||
|
||||
test("#2612 - nested `parse` works with `Collection#set`", function() {
|
||||
|
||||
var Job = Backbone.Model.extend({
|
||||
constructor: function() {
|
||||
this.items = new Items();
|
||||
Backbone.Model.apply(this, arguments);
|
||||
},
|
||||
parse: function(attrs) {
|
||||
this.items.set(attrs.items, {parse: true});
|
||||
return _.omit(attrs, 'items');
|
||||
}
|
||||
});
|
||||
|
||||
var Item = Backbone.Model.extend({
|
||||
constructor: function() {
|
||||
this.subItems = new Backbone.Collection();
|
||||
Backbone.Model.apply(this, arguments);
|
||||
},
|
||||
parse: function(attrs) {
|
||||
this.subItems.set(attrs.subItems, {parse: true});
|
||||
return _.omit(attrs, 'subItems');
|
||||
}
|
||||
});
|
||||
|
||||
var Items = Backbone.Collection.extend({
|
||||
model: Item
|
||||
});
|
||||
|
||||
var data = {
|
||||
name: 'JobName',
|
||||
id: 1,
|
||||
items: [{
|
||||
id: 1,
|
||||
name: 'Sub1',
|
||||
subItems: [
|
||||
{id: 1, subName: 'One'},
|
||||
{id: 2, subName: 'Two'}
|
||||
]
|
||||
}, {
|
||||
id: 2,
|
||||
name: 'Sub2',
|
||||
subItems: [
|
||||
{id: 3, subName: 'Three'},
|
||||
{id: 4, subName: 'Four'}
|
||||
]
|
||||
}]
|
||||
};
|
||||
|
||||
var newData = {
|
||||
name: 'NewJobName',
|
||||
id: 1,
|
||||
items: [{
|
||||
id: 1,
|
||||
name: 'NewSub1',
|
||||
subItems: [
|
||||
{id: 1,subName: 'NewOne'},
|
||||
{id: 2,subName: 'NewTwo'}
|
||||
]
|
||||
}, {
|
||||
id: 2,
|
||||
name: 'NewSub2',
|
||||
subItems: [
|
||||
{id: 3,subName: 'NewThree'},
|
||||
{id: 4,subName: 'NewFour'}
|
||||
]
|
||||
}]
|
||||
};
|
||||
|
||||
var job = new Job(data, {parse: true});
|
||||
equal(job.get('name'), 'JobName');
|
||||
equal(job.items.at(0).get('name'), 'Sub1');
|
||||
equal(job.items.length, 2);
|
||||
equal(job.items.get(1).subItems.get(1).get('subName'), 'One');
|
||||
equal(job.items.get(2).subItems.get(3).get('subName'), 'Three');
|
||||
job.set(job.parse(newData, {parse: true}));
|
||||
equal(job.get('name'), 'NewJobName');
|
||||
equal(job.items.at(0).get('name'), 'NewSub1');
|
||||
equal(job.items.length, 2);
|
||||
equal(job.items.get(1).subItems.get(1).get('subName'), 'NewOne');
|
||||
equal(job.items.get(2).subItems.get(3).get('subName'), 'NewThree');
|
||||
});
|
||||
|
||||
test('_addReference binds all collection events & adds to the lookup hashes', 9, function() {
|
||||
|
||||
var calls = {add: 0, remove: 0};
|
||||
|
||||
var Collection = Backbone.Collection.extend({
|
||||
|
||||
_addReference: function(model) {
|
||||
Backbone.Collection.prototype._addReference.apply(this, arguments);
|
||||
calls.add++;
|
||||
equal(model, this._byId[model.id]);
|
||||
equal(model, this._byId[model.cid]);
|
||||
equal(model._events.all.length, 1);
|
||||
},
|
||||
|
||||
_removeReference: function(model) {
|
||||
Backbone.Collection.prototype._removeReference.apply(this, arguments);
|
||||
calls.remove++;
|
||||
equal(this._byId[model.id], void 0);
|
||||
equal(this._byId[model.cid], void 0);
|
||||
equal(model.collection, void 0);
|
||||
equal(model._events.all, void 0);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
var collection = new Collection();
|
||||
var model = collection.add({id: 1});
|
||||
collection.remove(model);
|
||||
|
||||
equal(calls.add, 1);
|
||||
equal(calls.remove, 1);
|
||||
|
||||
});
|
||||
|
||||
test('Do not allow duplicate models to be `add`ed or `set`', function() {
|
||||
var c = new Backbone.Collection();
|
||||
|
||||
c.add([{id: 1}, {id: 1}]);
|
||||
equal(c.length, 1);
|
||||
equal(c.models.length, 1);
|
||||
|
||||
c.set([{id: 1}, {id: 1}]);
|
||||
equal(c.length, 1);
|
||||
equal(c.models.length, 1);
|
||||
});
|
||||
|
||||
})();
|
||||
|
||||
66
vendor/backbone/test/environment.js
vendored
66
vendor/backbone/test/environment.js
vendored
@@ -1,45 +1,43 @@
|
||||
(function() {
|
||||
|
||||
var Environment = this.Environment = function(){};
|
||||
var sync = Backbone.sync;
|
||||
var ajax = Backbone.ajax;
|
||||
var emulateHTTP = Backbone.emulateHTTP;
|
||||
var emulateJSON = Backbone.emulateJSON;
|
||||
var history = window.history;
|
||||
var pushState = history.pushState;
|
||||
var replaceState = history.replaceState;
|
||||
|
||||
_.extend(Environment.prototype, {
|
||||
QUnit.testStart(function() {
|
||||
var env = QUnit.config.current.testEnvironment;
|
||||
|
||||
ajax: Backbone.ajax,
|
||||
// We never want to actually call these during tests.
|
||||
history.pushState = history.replaceState = function(){};
|
||||
|
||||
sync: Backbone.sync,
|
||||
// Capture ajax settings for comparison.
|
||||
Backbone.ajax = function(settings) {
|
||||
env.ajaxSettings = settings;
|
||||
};
|
||||
|
||||
emulateHTTP: Backbone.emulateHTTP,
|
||||
|
||||
emulateJSON: Backbone.emulateJSON,
|
||||
|
||||
setup: function() {
|
||||
var env = this;
|
||||
|
||||
// Capture ajax settings for comparison.
|
||||
Backbone.ajax = function(settings) {
|
||||
env.ajaxSettings = settings;
|
||||
// Capture the arguments to Backbone.sync for comparison.
|
||||
Backbone.sync = function(method, model, options) {
|
||||
env.syncArgs = {
|
||||
method: method,
|
||||
model: model,
|
||||
options: options
|
||||
};
|
||||
|
||||
// Capture the arguments to Backbone.sync for comparison.
|
||||
Backbone.sync = function(method, model, options) {
|
||||
env.syncArgs = {
|
||||
method: method,
|
||||
model: model,
|
||||
options: options
|
||||
};
|
||||
env.sync.apply(this, arguments);
|
||||
};
|
||||
},
|
||||
|
||||
teardown: function() {
|
||||
this.syncArgs = null;
|
||||
this.ajaxSettings = null;
|
||||
Backbone.sync = this.sync;
|
||||
Backbone.ajax = this.ajax;
|
||||
Backbone.emulateHTTP = this.emulateHTTP;
|
||||
Backbone.emulateJSON = this.emulateJSON;
|
||||
}
|
||||
sync.apply(this, arguments);
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
QUnit.testDone(function() {
|
||||
Backbone.sync = sync;
|
||||
Backbone.ajax = ajax;
|
||||
Backbone.emulateHTTP = emulateHTTP;
|
||||
Backbone.emulateJSON = emulateJSON;
|
||||
history.pushState = pushState;
|
||||
history.replaceState = replaceState;
|
||||
});
|
||||
|
||||
})();
|
||||
|
||||
31
vendor/backbone/test/events.js
vendored
31
vendor/backbone/test/events.js
vendored
@@ -1,4 +1,4 @@
|
||||
$(document).ready(function() {
|
||||
(function() {
|
||||
|
||||
module("Backbone.Events");
|
||||
|
||||
@@ -152,6 +152,31 @@ $(document).ready(function() {
|
||||
e.trigger("foo");
|
||||
});
|
||||
|
||||
test("stopListening cleans up references", 4, function() {
|
||||
var a = _.extend({}, Backbone.Events);
|
||||
var b = _.extend({}, Backbone.Events);
|
||||
var fn = function() {};
|
||||
a.listenTo(b, 'all', fn).stopListening();
|
||||
equal(_.size(a._listeningTo), 0);
|
||||
a.listenTo(b, 'all', fn).stopListening(b);
|
||||
equal(_.size(a._listeningTo), 0);
|
||||
a.listenTo(b, 'all', fn).stopListening(null, 'all');
|
||||
equal(_.size(a._listeningTo), 0);
|
||||
a.listenTo(b, 'all', fn).stopListening(null, null, fn);
|
||||
equal(_.size(a._listeningTo), 0);
|
||||
});
|
||||
|
||||
test("listenTo and stopListening cleaning up references", 2, function() {
|
||||
var a = _.extend({}, Backbone.Events);
|
||||
var b = _.extend({}, Backbone.Events);
|
||||
a.listenTo(b, 'all', function(){ ok(true); });
|
||||
b.trigger('anything');
|
||||
a.listenTo(b, 'other', function(){ ok(false); });
|
||||
a.stopListening(b, 'other');
|
||||
a.stopListening(b, 'all');
|
||||
equal(_.keys(a._listeningTo).length, 0);
|
||||
});
|
||||
|
||||
test("listenTo with empty callback doesn't throw an error", 1, function(){
|
||||
var e = _.extend({}, Backbone.Events);
|
||||
e.listenTo(e, "foo", null);
|
||||
@@ -280,7 +305,7 @@ $(document).ready(function() {
|
||||
|
||||
test("if callback is truthy but not a function, `on` should throw an error just like jQuery", 1, function() {
|
||||
var view = _.extend({}, Backbone.Events).on('test', 'noop');
|
||||
throws(function() {
|
||||
raises(function() {
|
||||
view.trigger('test');
|
||||
});
|
||||
});
|
||||
@@ -449,4 +474,4 @@ $(document).ready(function() {
|
||||
equal(obj, obj.stopListening());
|
||||
});
|
||||
|
||||
});
|
||||
})();
|
||||
|
||||
52
vendor/backbone/test/model.js
vendored
52
vendor/backbone/test/model.js
vendored
@@ -1,4 +1,4 @@
|
||||
$(document).ready(function() {
|
||||
(function() {
|
||||
|
||||
var proxy = Backbone.Model.extend();
|
||||
var klass = Backbone.Collection.extend({
|
||||
@@ -6,10 +6,9 @@ $(document).ready(function() {
|
||||
});
|
||||
var doc, collection;
|
||||
|
||||
module("Backbone.Model", _.extend(new Environment, {
|
||||
module("Backbone.Model", {
|
||||
|
||||
setup: function() {
|
||||
Environment.prototype.setup.apply(this, arguments);
|
||||
doc = new proxy({
|
||||
id : '1-the-tempest',
|
||||
title : "The Tempest",
|
||||
@@ -20,7 +19,7 @@ $(document).ready(function() {
|
||||
collection.add(doc);
|
||||
}
|
||||
|
||||
}));
|
||||
});
|
||||
|
||||
test("initialize", 3, function() {
|
||||
var Model = Backbone.Model.extend({
|
||||
@@ -111,13 +110,6 @@ $(document).ready(function() {
|
||||
equal(model.url(), '/nested/1/collection/2');
|
||||
});
|
||||
|
||||
test('url and urlRoot are directly attached if passed in the options', 2, function () {
|
||||
var model = new Backbone.Model({a: 1}, {url: '/test'});
|
||||
var model2 = new Backbone.Model({a: 2}, {urlRoot: '/test2'});
|
||||
equal(model.url, '/test');
|
||||
equal(model2.urlRoot, '/test2');
|
||||
});
|
||||
|
||||
test("underscore methods", 5, function() {
|
||||
var model = new Backbone.Model({ 'foo': 'a', 'bar': 'b', 'baz': 'c' });
|
||||
var model2 = model.clone();
|
||||
@@ -270,6 +262,26 @@ $(document).ready(function() {
|
||||
model.set({result: void 0});
|
||||
});
|
||||
|
||||
test("nested set triggers with the correct options", function() {
|
||||
var model = new Backbone.Model();
|
||||
var o1 = {};
|
||||
var o2 = {};
|
||||
var o3 = {};
|
||||
model.on('change', function(__, options) {
|
||||
switch (model.get('a')) {
|
||||
case 1:
|
||||
equal(options, o1);
|
||||
return model.set('a', 2, o2);
|
||||
case 2:
|
||||
equal(options, o2);
|
||||
return model.set('a', 3, o3);
|
||||
case 3:
|
||||
equal(options, o3);
|
||||
}
|
||||
});
|
||||
model.set('a', 1, o1);
|
||||
});
|
||||
|
||||
test("multiple unsets", 1, function() {
|
||||
var i = 0;
|
||||
var counter = function(){ i++; };
|
||||
@@ -712,6 +724,22 @@ $(document).ready(function() {
|
||||
ok(this.syncArgs.model === model);
|
||||
});
|
||||
|
||||
test("save without `wait` doesn't set invalid attributes", function () {
|
||||
var model = new Backbone.Model();
|
||||
model.validate = function () { return 1; }
|
||||
model.save({a: 1});
|
||||
equal(model.get('a'), void 0);
|
||||
});
|
||||
|
||||
test("save doesn't validate twice", function () {
|
||||
var model = new Backbone.Model();
|
||||
var times = 0;
|
||||
model.sync = function () {};
|
||||
model.validate = function () { ++times; }
|
||||
model.save({});
|
||||
equal(times, 1);
|
||||
});
|
||||
|
||||
test("`hasChanged` for falsey keys", 2, function() {
|
||||
var model = new Backbone.Model();
|
||||
model.set({x: true}, {silent: true});
|
||||
@@ -1099,4 +1127,4 @@ $(document).ready(function() {
|
||||
model.set({a: true});
|
||||
});
|
||||
|
||||
});
|
||||
})();
|
||||
|
||||
4
vendor/backbone/test/noconflict.js
vendored
4
vendor/backbone/test/noconflict.js
vendored
@@ -1,4 +1,4 @@
|
||||
$(document).ready(function() {
|
||||
(function() {
|
||||
|
||||
module("Backbone.noConflict");
|
||||
|
||||
@@ -9,4 +9,4 @@ $(document).ready(function() {
|
||||
equal(window.Backbone, noconflictBackbone, 'Backbone is still pointing to the original Backbone');
|
||||
});
|
||||
|
||||
});
|
||||
})();
|
||||
|
||||
222
vendor/backbone/test/router.js
vendored
222
vendor/backbone/test/router.js
vendored
@@ -1,14 +1,14 @@
|
||||
$(document).ready(function() {
|
||||
(function() {
|
||||
|
||||
var router = null;
|
||||
var location = null;
|
||||
var lastRoute = null;
|
||||
var lastArgs = [];
|
||||
|
||||
function onRoute(router, route, args) {
|
||||
var onRoute = function(router, route, args) {
|
||||
lastRoute = route;
|
||||
lastArgs = args;
|
||||
}
|
||||
};
|
||||
|
||||
var Location = function(href) {
|
||||
this.replace(href);
|
||||
@@ -16,8 +16,11 @@ $(document).ready(function() {
|
||||
|
||||
_.extend(Location.prototype, {
|
||||
|
||||
parser: document.createElement('a'),
|
||||
|
||||
replace: function(href) {
|
||||
_.extend(this, _.pick($('<a></a>', {href: href})[0],
|
||||
this.parser.href = href;
|
||||
_.extend(this, _.pick(this.parser,
|
||||
'href',
|
||||
'hash',
|
||||
'host',
|
||||
@@ -64,7 +67,7 @@ $(document).ready(function() {
|
||||
this.value = value;
|
||||
}
|
||||
};
|
||||
_.bindAll(ExternalObject);
|
||||
_.bindAll(ExternalObject, 'routingFunction');
|
||||
|
||||
var Router = Backbone.Router.extend({
|
||||
|
||||
@@ -75,6 +78,8 @@ $(document).ready(function() {
|
||||
"counter": "counter",
|
||||
"search/:query": "search",
|
||||
"search/:query/p:page": "search",
|
||||
"charñ": "charUTF",
|
||||
"char%C3%B1": "charEscaped",
|
||||
"contacts": "contacts",
|
||||
"contacts/new": "newContact",
|
||||
"contacts/:id": "loadContact",
|
||||
@@ -85,7 +90,7 @@ $(document).ready(function() {
|
||||
":repo/compare/*from...*to": "github",
|
||||
"decode/:named/*splat": "decode",
|
||||
"*first/complex-*part/*rest": "complex",
|
||||
":entity?*args": "query",
|
||||
"query/:entity": "query",
|
||||
"function/:value": ExternalObject.routingFunction,
|
||||
"*anything": "anything"
|
||||
},
|
||||
@@ -103,11 +108,19 @@ $(document).ready(function() {
|
||||
this.count++;
|
||||
},
|
||||
|
||||
search : function(query, page) {
|
||||
search: function(query, page) {
|
||||
this.query = query;
|
||||
this.page = page;
|
||||
},
|
||||
|
||||
charUTF: function() {
|
||||
this.charType = 'UTF';
|
||||
},
|
||||
|
||||
charEscaped: function() {
|
||||
this.charType = 'escaped';
|
||||
},
|
||||
|
||||
contacts: function(){
|
||||
this.contact = 'index';
|
||||
},
|
||||
@@ -198,12 +211,21 @@ $(document).ready(function() {
|
||||
equal(router.page, '20');
|
||||
});
|
||||
|
||||
test("routes via navigate with params", 1, function() {
|
||||
Backbone.history.navigate('query/test?a=b', {trigger: true});
|
||||
equal(router.queryArgs, 'a=b');
|
||||
});
|
||||
|
||||
test("routes via navigate for backwards-compatibility", 2, function() {
|
||||
Backbone.history.navigate('search/manhattan/p20', true);
|
||||
equal(router.query, 'manhattan');
|
||||
equal(router.page, '20');
|
||||
});
|
||||
|
||||
test("reports matched route via nagivate", 1, function() {
|
||||
ok(Backbone.history.navigate('search/manhattan/p20', true));
|
||||
});
|
||||
|
||||
test("route precedence via navigate", 6, function(){
|
||||
// check both 0.9.x and backwards-compatibility options
|
||||
_.each([ { trigger: true }, true ], function( options ){
|
||||
@@ -271,7 +293,7 @@ $(document).ready(function() {
|
||||
});
|
||||
|
||||
test("routes (query)", 5, function() {
|
||||
location.replace('http://example.com#mandel?a=b&c=d');
|
||||
location.replace('http://example.com#query/mandel?a=b&c=d');
|
||||
Backbone.history.checkUrl();
|
||||
equal(router.entity, 'mandel');
|
||||
equal(router.queryArgs, 'a=b&c=d');
|
||||
@@ -349,6 +371,13 @@ $(document).ready(function() {
|
||||
equal(lastRoute, 'search');
|
||||
});
|
||||
|
||||
test("#2666 - Hashes with UTF8 in them.", 2, function() {
|
||||
Backbone.history.navigate('charñ', {trigger: true});
|
||||
equal(router.charType, 'UTF');
|
||||
Backbone.history.navigate('char%C3%B1', {trigger: true});
|
||||
equal(router.charType, 'escaped');
|
||||
});
|
||||
|
||||
test("#1185 - Use pathname when hashChange is not wanted.", 1, function() {
|
||||
Backbone.history.stop();
|
||||
location.replace('http://example.com/path/name#hash');
|
||||
@@ -514,7 +543,7 @@ $(document).ready(function() {
|
||||
Backbone.history.stop();
|
||||
location.replace('http://example.com/root/x/y?a=b');
|
||||
location.replace = function(url) {
|
||||
strictEqual(url, '/root/?a=b#x/y');
|
||||
strictEqual(url, '/root/#x/y?a=b');
|
||||
};
|
||||
Backbone.history = _.extend(new Backbone.History, {
|
||||
location: location,
|
||||
@@ -531,7 +560,7 @@ $(document).ready(function() {
|
||||
|
||||
test("#1695 - hashChange to pushState with search.", 1, function() {
|
||||
Backbone.history.stop();
|
||||
location.replace('http://example.com/root?a=b#x/y');
|
||||
location.replace('http://example.com/root#x/y?a=b');
|
||||
Backbone.history = _.extend(new Backbone.History, {
|
||||
location: location,
|
||||
history: {
|
||||
@@ -580,7 +609,7 @@ $(document).ready(function() {
|
||||
test("#2062 - Trigger 'route' event on router instance.", 2, function() {
|
||||
router.on('route', function(name, args) {
|
||||
strictEqual(name, 'routeEvent');
|
||||
deepEqual(args, ['x']);
|
||||
deepEqual(args, ['x', null]);
|
||||
});
|
||||
location.replace('http://example.com#route-event/x');
|
||||
Backbone.history.checkUrl();
|
||||
@@ -609,4 +638,173 @@ $(document).ready(function() {
|
||||
deepEqual({home: "root", index: "index.html", show: "show", search: "search"}, router.routes);
|
||||
});
|
||||
|
||||
});
|
||||
test("#2538 - hashChange to pushState only if both requested.", 0, function() {
|
||||
Backbone.history.stop();
|
||||
location.replace('http://example.com/root?a=b#x/y');
|
||||
Backbone.history = _.extend(new Backbone.History, {
|
||||
location: location,
|
||||
history: {
|
||||
pushState: function(){},
|
||||
replaceState: function(){ ok(false); }
|
||||
}
|
||||
});
|
||||
Backbone.history.start({
|
||||
root: 'root',
|
||||
pushState: true,
|
||||
hashChange: false
|
||||
});
|
||||
});
|
||||
|
||||
test('No hash fallback.', 0, function() {
|
||||
Backbone.history.stop();
|
||||
Backbone.history = _.extend(new Backbone.History, {
|
||||
location: location,
|
||||
history: {
|
||||
pushState: function(){},
|
||||
replaceState: function(){}
|
||||
}
|
||||
});
|
||||
|
||||
var Router = Backbone.Router.extend({
|
||||
routes: {
|
||||
hash: function() { ok(false); }
|
||||
}
|
||||
});
|
||||
var router = new Router;
|
||||
|
||||
location.replace('http://example.com/');
|
||||
Backbone.history.start({
|
||||
pushState: true,
|
||||
hashChange: false
|
||||
});
|
||||
location.replace('http://example.com/nomatch#hash');
|
||||
Backbone.history.checkUrl();
|
||||
});
|
||||
|
||||
test('#2656 - No trailing slash on root.', 1, function() {
|
||||
Backbone.history.stop();
|
||||
Backbone.history = _.extend(new Backbone.History, {
|
||||
location: location,
|
||||
history: {
|
||||
pushState: function(state, title, url){
|
||||
strictEqual(url, '/root');
|
||||
}
|
||||
}
|
||||
});
|
||||
location.replace('http://example.com/root/path');
|
||||
Backbone.history.start({pushState: true, hashChange: false, root: 'root'});
|
||||
Backbone.history.navigate('');
|
||||
});
|
||||
|
||||
test('#2656 - No trailing slash on root.', 1, function() {
|
||||
Backbone.history.stop();
|
||||
Backbone.history = _.extend(new Backbone.History, {
|
||||
location: location,
|
||||
history: {
|
||||
pushState: function(state, title, url) {
|
||||
strictEqual(url, '/');
|
||||
}
|
||||
}
|
||||
});
|
||||
location.replace('http://example.com/path');
|
||||
Backbone.history.start({pushState: true, hashChange: false});
|
||||
Backbone.history.navigate('');
|
||||
});
|
||||
|
||||
test('#2765 - Fragment matching sans query/hash.', 2, function() {
|
||||
Backbone.history.stop();
|
||||
Backbone.history = _.extend(new Backbone.History, {
|
||||
location: location,
|
||||
history: {
|
||||
pushState: function(state, title, url) {
|
||||
strictEqual(url, '/path?query#hash');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var Router = Backbone.Router.extend({
|
||||
routes: {
|
||||
path: function() { ok(true); }
|
||||
}
|
||||
});
|
||||
var router = new Router;
|
||||
|
||||
location.replace('http://example.com/');
|
||||
Backbone.history.start({pushState: true, hashChange: false});
|
||||
Backbone.history.navigate('path?query#hash', true);
|
||||
});
|
||||
|
||||
test('Do not decode the search params.', function() {
|
||||
var Router = Backbone.Router.extend({
|
||||
routes: {
|
||||
path: function(params){
|
||||
strictEqual(params, 'x=y%20z');
|
||||
}
|
||||
}
|
||||
});
|
||||
var router = new Router;
|
||||
Backbone.history.navigate('path?x=y%20z', true);
|
||||
});
|
||||
|
||||
test('Navigate to a hash url.', function() {
|
||||
Backbone.history.stop();
|
||||
Backbone.history = _.extend(new Backbone.History, {location: location});
|
||||
Backbone.history.start({pushState: true});
|
||||
var Router = Backbone.Router.extend({
|
||||
routes: {
|
||||
path: function(params) {
|
||||
strictEqual(params, 'x=y');
|
||||
}
|
||||
}
|
||||
});
|
||||
var router = new Router;
|
||||
location.replace('http://example.com/path?x=y#hash');
|
||||
Backbone.history.checkUrl();
|
||||
});
|
||||
|
||||
test('#navigate to a hash url.', function() {
|
||||
Backbone.history.stop();
|
||||
Backbone.history = _.extend(new Backbone.History, {location: location});
|
||||
Backbone.history.start({pushState: true});
|
||||
var Router = Backbone.Router.extend({
|
||||
routes: {
|
||||
path: function(params) {
|
||||
strictEqual(params, 'x=y');
|
||||
}
|
||||
}
|
||||
});
|
||||
var router = new Router;
|
||||
Backbone.history.navigate('path?x=y#hash', true);
|
||||
});
|
||||
|
||||
test('unicode pathname', 1, function() {
|
||||
location.replace('http://example.com/myyjä');
|
||||
Backbone.history.stop();
|
||||
Backbone.history = _.extend(new Backbone.History, {location: location});
|
||||
var Router = Backbone.Router.extend({
|
||||
routes: {
|
||||
myyjä: function() {
|
||||
ok(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
new Router;
|
||||
Backbone.history.start({pushState: true});
|
||||
});
|
||||
|
||||
test('newline in route', 1, function() {
|
||||
location.replace('http://example.com/stuff%0Anonsense?param=foo%0Abar');
|
||||
Backbone.history.stop();
|
||||
Backbone.history = _.extend(new Backbone.History, {location: location});
|
||||
var Router = Backbone.Router.extend({
|
||||
routes: {
|
||||
'stuff\nnonsense': function() {
|
||||
ok(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
new Router;
|
||||
Backbone.history.start({pushState: true});
|
||||
});
|
||||
|
||||
})();
|
||||
|
||||
10
vendor/backbone/test/sync.js
vendored
10
vendor/backbone/test/sync.js
vendored
@@ -1,4 +1,4 @@
|
||||
$(document).ready(function() {
|
||||
(function() {
|
||||
|
||||
var Library = Backbone.Collection.extend({
|
||||
url : function() { return '/library'; }
|
||||
@@ -11,20 +11,18 @@ $(document).ready(function() {
|
||||
length : 123
|
||||
};
|
||||
|
||||
module("Backbone.sync", _.extend(new Environment, {
|
||||
module("Backbone.sync", {
|
||||
|
||||
setup : function() {
|
||||
Environment.prototype.setup.apply(this, arguments);
|
||||
library = new Library;
|
||||
library.create(attrs, {wait: false});
|
||||
},
|
||||
|
||||
teardown: function() {
|
||||
Environment.prototype.teardown.apply(this, arguments);
|
||||
Backbone.emulateHTTP = false;
|
||||
}
|
||||
|
||||
}));
|
||||
});
|
||||
|
||||
test("read", 4, function() {
|
||||
library.fetch();
|
||||
@@ -209,4 +207,4 @@ $(document).ready(function() {
|
||||
strictEqual(this.ajaxSettings.beforeSend(xhr), false);
|
||||
});
|
||||
|
||||
});
|
||||
})();
|
||||
|
||||
80
vendor/backbone/test/view.js
vendored
80
vendor/backbone/test/view.js
vendored
@@ -1,4 +1,4 @@
|
||||
$(document).ready(function() {
|
||||
(function() {
|
||||
|
||||
var view;
|
||||
|
||||
@@ -14,13 +14,10 @@ $(document).ready(function() {
|
||||
|
||||
});
|
||||
|
||||
test("constructor", 6, function() {
|
||||
test("constructor", 3, function() {
|
||||
equal(view.el.id, 'test-view');
|
||||
equal(view.el.className, 'test-view');
|
||||
equal(view.el.other, void 0);
|
||||
equal(view.options.id, 'test-view');
|
||||
equal(view.options.className, 'test-view');
|
||||
equal(view.options.other, 'non-special-option');
|
||||
});
|
||||
|
||||
test("jQuery", 1, function() {
|
||||
@@ -42,23 +39,23 @@ $(document).ready(function() {
|
||||
test("delegateEvents", 6, function() {
|
||||
var counter1 = 0, counter2 = 0;
|
||||
|
||||
var view = new Backbone.View({el: '<p><a id="test"></a></p>'});
|
||||
var view = new Backbone.View({el: '#testElement'});
|
||||
view.increment = function(){ counter1++; };
|
||||
view.$el.on('click', function(){ counter2++; });
|
||||
|
||||
var events = {'click #test': 'increment'};
|
||||
var events = {'click h1': 'increment'};
|
||||
|
||||
view.delegateEvents(events);
|
||||
view.$('#test').trigger('click');
|
||||
view.$('h1').trigger('click');
|
||||
equal(counter1, 1);
|
||||
equal(counter2, 1);
|
||||
|
||||
view.$('#test').trigger('click');
|
||||
view.$('h1').trigger('click');
|
||||
equal(counter1, 2);
|
||||
equal(counter2, 2);
|
||||
|
||||
view.delegateEvents(events);
|
||||
view.$('#test').trigger('click');
|
||||
view.$('h1').trigger('click');
|
||||
equal(counter1, 3);
|
||||
equal(counter2, 3);
|
||||
});
|
||||
@@ -95,24 +92,24 @@ $(document).ready(function() {
|
||||
test("undelegateEvents", 6, function() {
|
||||
var counter1 = 0, counter2 = 0;
|
||||
|
||||
var view = new Backbone.View({el: '<p><a id="test"></a></p>'});
|
||||
var view = new Backbone.View({el: '#testElement'});
|
||||
view.increment = function(){ counter1++; };
|
||||
view.$el.on('click', function(){ counter2++; });
|
||||
|
||||
var events = {'click #test': 'increment'};
|
||||
var events = {'click h1': 'increment'};
|
||||
|
||||
view.delegateEvents(events);
|
||||
view.$('#test').trigger('click');
|
||||
view.$('h1').trigger('click');
|
||||
equal(counter1, 1);
|
||||
equal(counter2, 1);
|
||||
|
||||
view.undelegateEvents();
|
||||
view.$('#test').trigger('click');
|
||||
view.$('h1').trigger('click');
|
||||
equal(counter1, 1);
|
||||
equal(counter2, 2);
|
||||
|
||||
view.delegateEvents(events);
|
||||
view.$('#test').trigger('click');
|
||||
view.$('h1').trigger('click');
|
||||
equal(counter1, 2);
|
||||
equal(counter2, 3);
|
||||
});
|
||||
@@ -156,30 +153,6 @@ $(document).ready(function() {
|
||||
strictEqual(new View().el.id, 'id');
|
||||
});
|
||||
|
||||
test("with options function", 3, function() {
|
||||
var View1 = Backbone.View.extend({
|
||||
options: function() {
|
||||
return {
|
||||
title: 'title1',
|
||||
acceptText: 'confirm'
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
var View2 = View1.extend({
|
||||
options: function() {
|
||||
return _.extend(View1.prototype.options.call(this), {
|
||||
title: 'title2',
|
||||
fixed: true
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
strictEqual(new View2().options.title, 'title2');
|
||||
strictEqual(new View2().options.acceptText, 'confirm');
|
||||
strictEqual(new View2().options.fixed, true);
|
||||
});
|
||||
|
||||
test("with attributes", 2, function() {
|
||||
var View = Backbone.View.extend({
|
||||
attributes: {
|
||||
@@ -245,7 +218,7 @@ $(document).ready(function() {
|
||||
$('body').trigger('fake$event').trigger('fake$event');
|
||||
equal(count, 2);
|
||||
|
||||
$('body').unbind('.namespaced');
|
||||
$('body').off('.namespaced');
|
||||
$('body').trigger('fake$event');
|
||||
equal(count, 2);
|
||||
});
|
||||
@@ -319,7 +292,7 @@ $(document).ready(function() {
|
||||
view.collection.trigger('x');
|
||||
});
|
||||
|
||||
test("Provide function for el.", 1, function() {
|
||||
test("Provide function for el.", 2, function() {
|
||||
var View = Backbone.View.extend({
|
||||
el: function() {
|
||||
return "<p><a></a></p>";
|
||||
@@ -327,31 +300,28 @@ $(document).ready(function() {
|
||||
});
|
||||
|
||||
var view = new View;
|
||||
ok(view.$el.is('p:has(a)'));
|
||||
ok(view.$el.is('p'));
|
||||
ok(view.$el.has('a'));
|
||||
});
|
||||
|
||||
test("events passed in options", 2, function() {
|
||||
test("events passed in options", 1, function() {
|
||||
var counter = 0;
|
||||
|
||||
var View = Backbone.View.extend({
|
||||
el: '<p><a id="test"></a></p>',
|
||||
el: '#testElement',
|
||||
increment: function() {
|
||||
counter++;
|
||||
}
|
||||
});
|
||||
|
||||
var view = new View({events:{'click #test':'increment'}});
|
||||
var view2 = new View({events:function(){
|
||||
return {'click #test':'increment'};
|
||||
}});
|
||||
var view = new View({
|
||||
events: {
|
||||
'click h1': 'increment'
|
||||
}
|
||||
});
|
||||
|
||||
view.$('#test').trigger('click');
|
||||
view2.$('#test').trigger('click');
|
||||
view.$('h1').trigger('click').trigger('click');
|
||||
equal(counter, 2);
|
||||
|
||||
view.$('#test').trigger('click');
|
||||
view2.$('#test').trigger('click');
|
||||
equal(counter, 4);
|
||||
});
|
||||
|
||||
});
|
||||
})();
|
||||
|
||||
4
vendor/benchmark.js/LICENSE.txt
vendored
4
vendor/benchmark.js/LICENSE.txt
vendored
@@ -1,4 +1,4 @@
|
||||
Copyright 2010-2013 Mathias Bynens <http://mathiasbynens.be/>
|
||||
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/>
|
||||
|
||||
@@ -19,4 +19,4 @@ 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.
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
531
vendor/benchmark.js/benchmark.js
vendored
531
vendor/benchmark.js/benchmark.js
vendored
File diff suppressed because it is too large
Load Diff
24
vendor/curl/LICENSE.txt
vendored
24
vendor/curl/LICENSE.txt
vendored
@@ -1,24 +0,0 @@
|
||||
Open Source Initiative OSI - The MIT License
|
||||
|
||||
http://www.opensource.org/licenses/mit-license.php
|
||||
|
||||
Copyright (c) 2010-2013 Brian Cavalier and John Hann
|
||||
|
||||
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.
|
||||
48
vendor/curl/dist/curl-kitchen-sink/curl.js
vendored
48
vendor/curl/dist/curl-kitchen-sink/curl.js
vendored
@@ -1,48 +0,0 @@
|
||||
(function(){/*
|
||||
MIT License (c) copyright 2010-2013 B Cavalier & J Hann MIT (c) copyright 2010-2013 B Cavalier & J Hann */
|
||||
(function(d){function l(){}function k(b,e){return 0==U.call(b).indexOf("[object "+e)}function n(b){return b&&"/"==b.charAt(b.length-1)?b.substr(0,b.length-1):b}function h(b,e){var m,g,x,P;m=1;g=b;"."==g.charAt(0)&&(x=!0,g=g.replace(V,function(b,e,g,x){g&&m++;return x||""}));if(x){x=e.split("/");P=x.length-m;if(0>P)return b;x.splice(P,m);return x.concat(g||[]).join("/")}return g}function p(b){var e=b.indexOf("!");return{h:b.substr(e+1),e:0<=e&&b.substr(0,e)}}function v(){}function r(b,e){v.prototype=
|
||||
b||Q;var m=new v;v.prototype=Q;for(var g in e)m[g]=e[g];return m}function z(){function b(b,e,m){g.push([b,e,m])}function e(b,e){for(var m,x=0;m=g[x++];)(m=m[b])&&m(e)}var m,g,x;m=this;g=[];x=function(m,f){b=m?function(b){b&&b(f)}:function(b,e){e&&e(f)};x=l;e(m?0:1,f);e=l;g=G};this.j=function(e,g,x){b(e,g,x);return m};this.g=function(b){m.I=b;x(!0,b)};this.d=function(b){m.Aa=b;x(!1,b)};this.G=function(b){e(2,b)}}function y(b){return b instanceof z||b instanceof t}function q(b,e,m,g){y(b)?b.j(e,m,g):
|
||||
e(b)}function w(b,e,m){var g;return function(){0<=--b&&e&&(g=e.apply(G,arguments));0==b&&m&&m(g);return g}}function c(){var b,e;b=[].slice.call(arguments);k(b[0],"Object")&&(e=b.shift(),e=a(e));return new t(b[0],b[1],b[2],e)}function a(b,e,m){var g,x,a;if(b&&(u.V(b),f=u.b(b),"preloads"in b&&(g=new t(b.preloads,G,m,J,!0),u.C(function(){J=g})),a=(a=b.main)&&String(a).split(W)))return x=new z,x.j(e,m),b=a[1]?function(){new t([a[1]],x.g,x.d)}:x.d,new t([a[0]],x.g,b),x}function t(b,e,m,g,x){var s;s=u.k(f,
|
||||
G,[].concat(b),x);this.then=this.j=b=function(b,e){q(s,function(e){b&&b.apply(G,e)},function(b){if(e)e(b);else throw b;});return this};this.next=function(b,e,g){return new t(b,e,g,s)};this.config=a;(e||m)&&b(e,m);u.C(function(){q(x||J,function(){q(g,function(){u.A(s)},m)})})}function A(b){var e,m;e=b.id;e==G&&(K!==G?K={M:"Multiple anonymous defines encountered"}:(e=u.ia())||(K=b));if(e!=G){m=E[e];e in E||(m=u.m(e,f),m=u.J(m.b,e),E[e]=m);if(!y(m))throw Error("duplicate define: "+e);m.na=!1;u.K(m,b)}}
|
||||
function C(){var b=u.fa(arguments);A(b)}var f,B,F,H=d.document,D=H&&(H.head||H.getElementsByTagName("head")[0]),R=D&&D.getElementsByTagName("base")[0]||null,L={},M={},I={},s="addEventListener"in d?{}:{loaded:1,complete:1},Q={},U=Q.toString,G,E={},N={},J=!1,K,T=/^\/|^[^:]+:\/\//,V=/(\.)(\.?)(?:$|\/([^\.\/]+.*)?)/g,X=/\/\*[\s\S]*?\*\/|\/\/.*?[\n\r]/g,Y=/require\s*\(\s*(["'])(.*?[^\\])\1\s*\)|[^\\]?(["'])/g,W=/\s*,\s*/,S,u;u={t:function(b,e,m){var g;b=h(b,e);if("."==b.charAt(0))return b;g=p(b);b=(e=
|
||||
g.e)||g.h;b in m.c&&(b=m.c[b].q||b);e&&(0>e.indexOf("/")&&!(e in m.c)&&(b=n(m.T)+"/"+e),b=b+"!"+g.h);return b},k:function(b,e,m,g){function x(e,g){var m,a;m=u.t(e,f.id,b);if(!g)return m;a=p(m);if(!a.e)return m;m=E[a.e];a.h="normalize"in m?m.normalize(a.h,x,f.b)||"":x(a.h);return a.e+"!"+a.h}function a(e,m,s){var c;c=m&&function(b){m.apply(G,b)};if(k(e,"String")){if(c)throw Error("require(id, callback) not allowed");s=x(e,!0);e=E[s];if(!(s in E))throw Error("Module not resolved: "+s);return(s=y(e)&&
|
||||
e.a)||e}q(u.A(u.k(b,f.id,e,g)),c,s)}var f;f=new z;f.id=e||"";f.ja=g;f.L=m;f.b=b;f.s=a;a.toUrl=function(e){return u.m(x(e,!0),b).url};f.t=x;return f},J:function(b,e,m){var g,x,a;g=u.k(b,e,G,m);x=g.g;a=w(1,function(b){g.w=b;try{return u.aa(g)}catch(e){g.d(e)}});g.g=function(b){q(m||J,function(){x(E[g.id]=N[g.url]=a(b))})};g.N=function(b){q(m||J,function(){g.a&&(a(b),g.G(M))})};return g},Z:function(b,e,m,g){return u.k(b,m,G,g)},ha:function(b){return b.s},P:function(b){return b.a||(b.a={})},ga:function(b){var e=
|
||||
b.B;e||(e=b.B={id:b.id,uri:u.Q(b),exports:u.P(b),config:function(){return b.b}},e.a=e.exports);return e},Q:function(b){return b.url||(b.url=u.u(b.s.toUrl(b.id),b.b))},V:function(b){var e,m,g,a,f;e="curl";m="define";g=a=d;if(b&&(f=b.overwriteApi||b.xa,e=b.apiName||b.pa||e,g=b.apiContext||b.oa||g,m=b.defineName||b.ta||m,a=b.defineContext||b.sa||a,B&&k(B,"Function")&&(d.curl=B),B=null,F&&k(F,"Function")&&(d.define=F),F=null,!f)){if(g[e]&&g[e]!=c)throw Error(e+" already exists");if(a[m]&&a[m]!=C)throw Error(m+
|
||||
" already exists");}g[e]=c;a[m]=C},b:function(b){function e(b,e){var m,g,f,c,d;for(d in b){f=b[d];k(f,"String")&&(f={path:b[d]});f.name=f.name||d;c=a;g=p(n(f.name));m=g.h;if(g=g.e)c=s[g],c||(c=s[g]=r(a),c.c=r(a.c),c.f=[]),delete b[d];g=f;var l=e,q=void 0;g.path=n(g.path||g.location||"");l&&(q=g.main||"./main","."==q.charAt(0)||(q="./"+q),g.q=h(q,g.name+"/"));g.b=g.config;g.b&&(g.b=r(a,g.b));g.W=m.split("/").length;m?(c.c[m]=g,c.f.push(m)):c.n=u.U(f.path,a)}}function m(b){var e=b.c;b.S=RegExp("^("+
|
||||
b.f.sort(function(b,g){return e[g].W-e[b].W}).join("|").replace(/\/|\./g,"\\$&")+")(?=\\/|$)");delete b.f}var g,a,s,c;"baseUrl"in b&&(b.n=b.baseUrl);"main"in b&&(b.q=b.main);"preloads"in b&&(b.ya=b.preloads);"pluginPath"in b&&(b.T=b.pluginPath);if("dontAddFileExt"in b||b.l)b.l=RegExp(b.dontAddFileExt||b.l);g=f;a=r(g,b);a.c=r(g.c);s=b.plugins||{};a.plugins=r(g.plugins);a.F=r(g.F,b.F);a.D=r(g.D,b.D);a.f=[];e(b.packages,!0);e(b.paths,!1);for(c in s)b=u.t(c+"!","",a),a.plugins[b.substr(0,b.length-1)]=
|
||||
s[c];s=a.plugins;for(c in s)if(s[c]=r(a,s[c]),b=s[c].f)s[c].f=b.concat(a.f),m(s[c]);for(c in g.c)a.c.hasOwnProperty(c)||a.f.push(c);m(a);return a},m:function(b,e){var a,g,c,s;a=e.c;c=T.test(b)?b:b.replace(e.S,function(b){g=a[b]||{};s=g.b;return g.path||""});return{b:s||f,url:u.U(c,e)}},U:function(b,e){var a=e.n;return a&&!T.test(b)?n(a)+"/"+b:b},u:function(b,e){return b+((e||f).l.test(b)?"":".js")},p:function(b,e,a){var g=H.createElement("script");g.onload=g.onreadystatechange=function(a){a=a||d.event;
|
||||
if("load"==a.type||s[g.readyState])delete I[b.id],g.onload=g.onreadystatechange=g.onerror="",e()};g.onerror=function(){a(Error("Syntax or http error: "+b.url))};g.type=b.r||"text/javascript";g.charset="utf-8";g.async=!b.R;g.src=b.url;I[b.id]=g;D.insertBefore(g,R);return g},O:function(b){var e=[],a;("string"==typeof b?b:b.toSource?b.toSource():b.toString()).replace(X,"").replace(Y,function(b,f,c,s){s?a=a==s?G:a:a||e.push(c);return""});return e},fa:function(b){var e,a,g,f,c,s;c=b.length;g=b[c-1];f=
|
||||
k(g,"Function")?g.length:-1;2==c?k(b[0],"Array")?a=b[0]:e=b[0]:3==c&&(e=b[0],a=b[1]);!a&&0<f&&(s=!0,a=["require","exports","module"].slice(0,f).concat(u.O(g)));return{id:e,w:a||[],H:0<=f?g:function(){return g},v:s}},aa:function(b){var e;e=b.H.apply(b.v?b.a:G,b.w);e===G&&b.a&&(e=b.B?b.a=b.B.a:b.a);return e},K:function(b,e){b.H=e.H;b.v=e.v;b.L=e.w;u.A(b)},A:function(b){function e(b,e,a){s[e]=b;a&&k(b,e)}function a(e,g){var f,c,s,m;f=w(1,function(b){c(b);p(b,g)});c=w(1,function(b){k(b,g)});s=u.ca(e,
|
||||
b);(m=y(s)&&s.a)&&c(m);q(s,f,b.d,b.a&&function(b){s.a&&(b==L?c(s.a):b==M&&f(s.a))})}function g(){b.g(s)}var f,c,s,d,h,k,p;s=[];c=b.L;d=c.length;0==c.length&&g();k=w(d,e,function(){b.N&&b.N(s)});p=w(d,e,g);for(f=0;f<d;f++)h=c[f],h in S?(p(S[h](b),f,!0),b.a&&b.G(L)):h?a(h,f):p(G,f,!0);return b},da:function(b){u.Q(b);u.p(b,function(){var e=K;K=G;!1!==b.na&&(!e||e.M?b.d(Error(e&&e.M||"define() missing or duplicated: "+b.url)):u.K(b,e))},b.d);return b},ca:function(b,e){var a,g,s,c,d,h,k,l,n,r,t,B;a=e.t;
|
||||
g=e.ja;s=e.b||f;d=a(b);d in E?h=d:(c=p(d),l=c.h,h=c.e||l,n=u.m(h,s));if(!(d in E))if(B=u.m(l,s).b,c.e)k=h;else if(k=B.moduleLoader||B.wa||B.loader||B.va)l=h,h=k,n=u.m(k,s);h in E?r=E[h]:n.url in N?r=E[h]=N[n.url]:(r=u.J(B,h,g),r.url=u.u(n.url,n.b),E[h]=N[n.url]=r,u.da(r));h==k&&(c.e&&s.plugins[c.e]&&(B=s.plugins[c.e]),t=new z,q(r,function(b){var e,c,s;s=b.dynamic;l="normalize"in b?b.normalize(l,a,r.b)||"":a(l);c=k+"!"+l;e=E[c];if(!(c in E)){e=u.Z(B,c,l,g);s||(E[c]=e);var f=function(b){s||(E[c]=b);
|
||||
e.g(b)};f.resolve=f;f.reject=f.error=e.d;b.load(l,e.s,f,B)}t!=e&&q(e,t.g,t.d,t.G)},t.d));return t||r},ia:function(){var b;if(!k(d.opera,"Opera"))for(var e in I)if("interactive"==I[e].readyState){b=e;break}return b},ea:function(b){var e=0,a,c;for(a=H&&(H.scripts||H.getElementsByTagName("script"));a&&(c=a[e++]);)if(b(c))return c},ba:function(b){var e;(e=u.ea(function(e){if(e=e.getAttribute("data-curl-run"))b.q=e;return e}))&&e.setAttribute("data-curl-run","");return b},C:function(b){setTimeout(b,0)}};
|
||||
S={require:u.ha,exports:u.P,module:u.ga};c.version="0.8.1";c.config=a;C.amd={plugins:!0,jQuery:!0,curl:"0.8.1"};f={n:"",T:"curl/plugin",l:/\?|\.js\b/,F:{},D:{},plugins:{},c:{},S:/$^/};f=u.ba(f);B=d.curl;F=d.define;B&&k(B,"Object")||f.q?(d.curl=G,a(B||f)):u.V();E.curl=c;E["curl/_privileged"]={core:u,cache:E,config:function(){return f},_define:A,_curl:c,Promise:z}})(this.window||"undefined"!=typeof global&&global||this);
|
||||
(function(d,l){function k(){if(!l.body)return!1;C||(C=l.createTextNode(""));try{return l.body.removeChild(l.body.appendChild(C)),C=A,!0}catch(a){return!1}}function n(){var f;f=v[l[p]]&&k();if(!y&&f){y=!0;for(clearTimeout(t);c=a.pop();)c();z&&(l[p]="complete");for(var h;h=r.shift();)h()}return f}function h(){n();y||(t=setTimeout(h,q))}var p="readyState",v={loaded:1,interactive:1,complete:1},r=[],z=l&&"string"!=typeof l[p],y=!1,q=10,w,c,a=[],t,A,C;w="addEventListener"in d?function(a,c){a.addEventListener(c,
|
||||
n,!1);return function(){a.removeEventListener(c,n,!1)}}:function(a,c){a.attachEvent("on"+c,n);return function(){a.detachEvent(c,n)}};l&&!n()&&(a=[w(d,"load"),w(l,"readystatechange"),w(d,"DOMContentLoaded")],t=setTimeout(h,q));define("curl/domReady",function(){function a(c){y?c():r.push(c)}a.then=a;a.amd=!0;return a})})(this,this.document);var O;
|
||||
(function(d,l){define("curl/shim/dojo18",["curl/_privileged"],function(k){function n(a){a.has||(a.has=c);a.on||(a.on=p);a.idle||(a.idle=h);a.async=!0}function h(){for(var a in r)if(r[a]instanceof z)return!1;return!0}function p(){}var v,r,z,y;v=k._curl;r=k.cache;z=k.Promise;y=k.core.k;var q,w,c;q=k.b().ua||{};w=l&&l.createElement("div");c=function(a){return"function"==typeof q[a]?q[a]=q[a](d,l,w):q[a]};c.add=function(a,h,d,k){if(void 0===q[a]||k)q[a]=h;if(d)return c(a)};q["dojo-loader"]=!1;r["dojo/_base/loader"]=
|
||||
0;"undefined"==typeof O&&(n(v),O=v);k.core.k=function(){var a=y.apply(this,arguments);n(a.s);return a};return!0})})("object"==typeof global?global:this.window||this.global,"object"==typeof document&&document);
|
||||
(function(d,l,k){define("curl/plugin/js",["curl/_privileged"],function(d){function h(c,a,h){function l(){f||(p<new Date?h():setTimeout(l,10))}var p,f,r;p=(new Date).valueOf()+(c.ma||3E5);h&&c.a&&setTimeout(l,10);r=d.core.p(c,function(){f=!0;c.a&&(c.I=k(c.a));!c.a||c.I?a(r):h()},function(a){f=!0;h(a)})}function p(c,a){h(c,function(){var h=r.shift();q=0<r.length;h&&p.apply(null,h);a.g(c.I||!0)},function(c){a.d(c)})}var v={},r=[],z=l&&!0==l.createElement("script").async,y,q,w=/\?|\.js\b/;y=d.Promise;
|
||||
return{dynamic:!0,normalize:function(c,a){var h=c.indexOf("!");return 0<=h?a(c.substr(0,h))+c.substr(h):a(c)},load:function(c,a,d,k){function l(a){(d.error||function(a){throw a;})(a)}var f,n,F,H,D;f=0<c.indexOf("!order");n=c.indexOf("!exports=");F=0<n?c.substr(n+9):k.a;H="prefetch"in k?k.prefetch:!0;c=f||0<n?c.substr(0,c.indexOf("!")):c;n=(n=k.dontAddFileExt||k.l)?RegExp(n):w;D=a.toUrl(c);n.test(D)||(D=D.lastIndexOf(".")<=D.lastIndexOf("/")?D+".js":D);D in v?v[D]instanceof y?v[D].j(d,l):d(v[D]):(c=
|
||||
{name:c,url:D,R:f,a:F,ma:k.timeout},v[D]=a=new y,a.j(function(a){v[D]=a;d(a)},l),f&&!z&&q?(r.push([c,a]),H&&(c.r="text/cache",h(c,function(a){a&&a.parentNode.removeChild(a)},function(){}),c.r="")):(q=q||f,p(c,a)))},cramPlugin:"../cram/js"}})})(this,this.document,function(d){try{return eval(d)}catch(l){}});
|
||||
define("curl/plugin/_fetchText",[],function(){var d,l;l=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"];d=function(){if("undefined"!==typeof XMLHttpRequest)d=function(){return new XMLHttpRequest};else for(var k=d=function(){throw Error("getXhr(): XMLHttpRequest not available");};0<l.length&&d===k;)(function(k){try{new ActiveXObject(k),d=function(){return new ActiveXObject(k)}}catch(h){}})(l.shift());return d()};return function(k,l,h){var p=d();p.open("GET",k,!0);p.onreadystatechange=function(){4===
|
||||
p.readyState&&(400>p.status?l(p.responseText):h(Error("fetchText() failed. status: "+p.statusText)))};p.send(null)}});define("curl/plugin/text",["./_fetchText"],function(d){function l(d){throw d;}return{normalize:function(d,l){return d?l(d.split("!")[0]):d},load:function(k,n,h){d(n.toUrl(k),h,h.error||l)},cramPlugin:"../cram/text"}});
|
||||
define("curl/plugin/async",function(){return{load:function(d,l,k){function n(h){"function"==typeof k.error&&k.error(h)}l([d],function(h){"function"==typeof h.j?h.j(function(d){0==arguments.length&&(d=h);k(d)},n):k(h)},k.error||function(h){throw h;})},analyze:function(d,l,k){k(d)}}});
|
||||
(function(d){function l(){var a;a=f[A]("link");a.rel="stylesheet";a.type="text/css";return a}function k(a,c){a.onload=function(){I.load=I.load||!0;c()}}function n(a,c){a.onerror=function(){I.error=I.error||!0;c()}}function h(a,c,f){D.push({url:a,X:c,$:function(){f(Error(M))}});(a=v())&&p(a)}function p(a){var c,f;c=D.shift();f=a.styleSheet;c?(a.onload=function(){c.X(c.la);p(a)},a.onerror=function(){c.$();p(a)},c.la=f.imports[f.addImport(c.url)]):(a.onload=a.onerror=t,H.push(a))}function v(){var a;
|
||||
a=H.shift();!a&&F.length<R&&(a=f.createElement("style"),F.push(a),B.appendChild(a));return a}function r(a){var c,h,d;if(!a.href||f.readyState&&"complete"!=f.readyState)return!1;c=!1;try{if(h=a.sheet)d=h.cssRules,c=null===d,!c&&d&&(h.insertRule("-curl-css-test {}",0),h.deleteRule(0),c=!0)}catch(k){c="[object Opera]"!=Object.prototype.toString.call(window.opera)&&/security|denied/i.test(k.message)}return c}function z(a,c,f){I.load||(r(a)?f(a.sheet):a.onload==t||!a.onload||C(function(){z(a,c,f)},c))}
|
||||
function y(a,f,h){function d(){a.onload!=t&&a.onload&&(a.onload=a.onerror=t,c(function(){h(a.sheet)}))}k(a,d);z(a,f,d)}function q(a,c){n(a,function(){a.onload!=t&&a.onload&&(a.onload=a.onerror=t,c(Error(M)))})}function w(a,c,f,h){var d;d=l();y(d,h,c);q(d,f);d.href=a;B.appendChild(d)}function c(a){function c(){f.readyState&&"complete"!=f.readyState?C(c,10):a()}c()}function a(a){return a.lastIndexOf(".")<=a.lastIndexOf("/")?a+".css":a}function t(){}var A="createElement",C=d.setTimeout,f=d.document,
|
||||
B;d=f&&f.createStyleSheet&&!(10<=f.documentMode);var F=[],H=[],D=[],R=12,L,M="HTTP or network error.",I={};f&&(B=f.head||f.getElementsByTagName("head")[0],L=d?h:w);define("curl/plugin/css",{normalize:function(a,c){var f,h;if(!a)return a;f=a.split(",");h=[];for(var d=0,k=f.length;d<k;d++)h.push(c(f[d]));return h.join(",")},load:function(c,f,h,d){function k(a){1<n.length&&p.push(a);0==--w&&h(1==n.length?a:p)}function r(a){(h.d||function(a){throw a;})(a)}var p,n,q,w,F;p=[];n=(c||"").split(",");q=d.cssWatchPeriod||
|
||||
50;d=d.cssNoWait;w=n.length;for(F=0;F<n.length;F++){c=n[F];var t;c=a(f.toUrl(c));d?(t=l(),t.href=c,B.appendChild(t),k(t.sheet||t.styleSheet)):L(c,k,r,q)}},cramPlugin:"../cram/css"})})(this);
|
||||
(function(d){var l=d.document,k=/^\/\//,n;l&&(n=l.head||(l.head=l.getElementsByTagName("head")[0]));define("curl/plugin/link",{load:function(d,p,v,r){d=p.toUrl(d);d=d.lastIndexOf(".")<=d.lastIndexOf("/")?d+".css":d;r=d=(r="fixSchemalessUrls"in r?r.fixSchemalessUrls:l.location.protocol)?d.replace(k,r+"//"):d;d=l.createElement("link");d.rel="stylesheet";d.type="text/css";d.href=r;n.appendChild(d);v(d.sheet||d.styleSheet)}})})(this);
|
||||
define("curl/plugin/domReady",["../domReady"],function(d){return{load:function(l,k,n){d(n)}}});(function(d){define("curl/shim/_fetchText",function(){function l(d,h,k){n.za(d,function(d,l){d?k(d):h(l.toString())})}function k(d,k,l){var n;d=p.parse(d,!1,!0);n="";h.get(d,function(d){d.i("data",function(c){n+=c}).i("end",function(){k(n)}).i("error",l)}).i("error",l)}var n,h,p;n=d("fs");h=d("http");p=d("url");var v;v=/^https?:/;return function(d,h,n){v.test(d)?k(d,h,n):l(d,h,n)}})})(O);define.amd.Ca=!0;
|
||||
(function(d,l){define("curl/shim/ssjs",["curl/_privileged","./_fetchText"],function(k,n){function h(a,c,d){try{l(a.url),c()}catch(f){d(f)}}function p(a,c,f){var h;try{h=a.url.replace(/\.js$/,""),d(h),c()}catch(k){f(k)}}function v(a,c,f){var h;a=d("url").parse(a.url,!1,!0);h="";A.get(a,function(a){a.i("data",function(a){h+=a}).i("end",function(){z(h);c()}).i("error",f)}).i("error",f)}function r(a){throw Error("ssjs: unable to load module in current environment: "+a.url);}function z(a){eval(a)}function y(c){return c&&
|
||||
c.replace(a,function(a,c){return c})}var q,w,c,a,t,A,C,f;if("object"!=typeof window||!window.ra&&!window.navigator){q=k.qa;w=k.b();c=/^\w+:\/\//;a=/(^\w+:)?.*$/;"undefined"==typeof XMLHttpRequest&&(q["curl/plugin/_fetchText"]=n);t=(w.o&&":"!=w.o[w.o.length-1]?w.o+":":w.o)||y(w.n)||"http:";if(l)C=f=h;else if(d){C=p;try{A=d("http"),f=v}catch(B){f=r}}else C=f=r;"object"===typeof process&&process.ka&&(k.Y.C=process.ka);k.Y.p=function(a,d,h){/^\/\//.test(a.url)&&(a.url=t+a.url);return c.test(a.url)?f(a,
|
||||
d,h):C(a,d,h)}}})})(O,void 0);
|
||||
(function(d,l,k){define("curl/loader/cjsm11",["../plugin/_fetchText","curl/_privileged"],function(d,h){function p(d,c){p="text"in d?function(a,c){a.text=c}:function(a,c){a.appendChild(l.createTextNode(c))};p(d,c)}function v(d,c,a){a=a?"/*\n////@ sourceURL="+a.replace(/\s/g,"%20")+".js\n*/":"";return"define('"+c+"',['require','exports','module'],function(require,exports,module){"+d+"\n});\n"+a+"\n"}var r,z,y,q;z=(r=l&&(l.head||l.getElementsByTagName("head")[0]))&&r.getElementsByTagName("base")[0]||null;
|
||||
y=h.core.O;q=h.core.u;v.load=function(h,c,a,t){var A,C,f;A=a.error||function(a){throw a;};C=q(c.Ea(h),t);f=!1!==t.injectSourceUrl&&C;d(C,function(d){var n;n=y(d);c(n,function(){d=v(d,h,f);if(t.injectScript){var n=d,q=l.createElement("script");p(q,n);q.charset="utf-8";r.insertBefore(q,z)}else k(d);a(c(h))},A)},A)};v.cramPlugin="../cram/cjsm11";return v})})(this,this.document,function(d){eval(d)});
|
||||
define("curl/plugin/locale",function(){function d(d,h){var k;if(d&&(k=d.locale,"function"==typeof k&&(k=k(d,h)),"string"==typeof k))return k;if("undefined"==typeof window)return!1;k=window.clientInformation||window.navigator;return(k&&(k.language||k.userLanguage)||"").toLowerCase()}function l(d,h){return d.replace(k,(h?"/"+h:"")+"$&")}var k;k=/(\.js)?$/;d.toModuleId=l;d.load=function(k,h,p,v){function r(){var c=Error("Unable to find correct locale for "+k);if(p.error)p.error(c);else throw c;}var z,
|
||||
y;z=d(v,k);y=v.localeToModuleId||l;v=z?y(k,z):k;try{p(h(v))}catch(q){y=z?y(k,!1):k;if(y==v)return r();try{p(h(y))}catch(w){if(!0!==z)return r();h(["i18n!"+k],p,r)}}};return d});
|
||||
define("curl/plugin/i18n",["./locale"],function(d){function l(d,l,h,p,v){d([l],function(d){p(d,h)},v)}return{load:function(k,n,h,p){function v(a,c){w[c]=a;r()}function r(){var d;if(++c==a.length)if(0==w.length)z(Error('No i18n bundles found: "'+k+'", locale "'+q+'"'));else{d=w[0]||{};for(A=1;A<w.length;A++){var f=w[A],l={},n=void 0;for(n in d)l[n]=d[n];if(f)for(n in f)l[n]=f[n];d=l}h(d)}}var z,y,q,w,c,a,t,A;z=h.error;k||z(Error("blank i18n bundle id."));y=p.localeToModuleId||d.Da;q=d(p,k);a=[k];w=
|
||||
[];c=0;if(q&&!1!==p.locale)for(a=a.concat(q.split("-")),t=[],A=1;A<a.length;A++)t[A-1]=a[A],p=y(k,t.join("-")),l(n,p,A,v,r);l(n,k,0,v,r)},cramPlugin:"../cram/i18n"}});
|
||||
(function(d,l,k){define("curl/loader/legacy",["curl/_privileged"],function(n){var h,p,v;h=l&&!0==l.createElement("script").async;p=n.core.p;v=/\?|\.js\b/;return{load:function(l,n,y,q){function w(){B.r="";p(B,c,a)}function c(){var c;if(!(0<--F)){if(A)try{c=A.call(d,l)}catch(f){a(Error("Factory for legacy "+l+" failed: "+f.message))}else try{c=k(t)}catch(h){a(Error("Failed to find exports "+t+" for legacy "+l))}y(c)}}function a(a){(y.error||function(a){throw a;})(a)}var t,A,C,f,B,F;t=q.exports||q.a;
|
||||
A=q.factory||q.factory;if(!t&&!A)throw Error("`exports` or `factory` required for legacy: "+l);C=[].concat(q.requires||q.Ba||[]);q=(q=q.dontAddFileExt||q.l)?RegExp(q):v;f=n.toUrl(l);q.test(f)||(f=f.lastIndexOf(".")<=f.lastIndexOf("/")?f+".js":f);B={url:f,R:!0,r:h||!C.length?"":"text/cache"};C.length?(F=2,n(C,h?c:w,a)):F=1;p(B,c,a)},cramPlugin:"../cram/legacy"}})})(this,this.document,function(d){return(0,eval)(d)});
|
||||
}).call(this);
|
||||
20
vendor/docdown/LICENSE.txt
vendored
20
vendor/docdown/LICENSE.txt
vendored
@@ -1,20 +0,0 @@
|
||||
Copyright 2011-2013 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.
|
||||
38
vendor/docdown/docdown.php
vendored
38
vendor/docdown/docdown.php
vendored
@@ -1,38 +0,0 @@
|
||||
<?php
|
||||
/*!
|
||||
* Docdown v1.0.0-pre
|
||||
* Copyright 2011-2013 John-David Dalton <http://allyoucanleet.com/>
|
||||
* Available under MIT license <http://mths.be/mit>
|
||||
*/
|
||||
require(dirname(__FILE__) . '/src/DocDown/MarkdownGenerator.php');
|
||||
|
||||
/**
|
||||
* Generates Markdown from JSDoc entries in a given file.
|
||||
*
|
||||
* @param {Array} [$options=array()] The options array.
|
||||
* @returns {string} The generated Markdown.
|
||||
* @example
|
||||
*
|
||||
* // specify a file path
|
||||
* $markdown = docdown(array(
|
||||
* // path to js file
|
||||
* 'path' => $filepath,
|
||||
* // url used to reference line numbers in code
|
||||
* 'url' => 'https://github.com/username/project/blob/master/my.js'
|
||||
* ));
|
||||
*
|
||||
* // or pass raw js
|
||||
* $markdown = docdown(array(
|
||||
* // raw JavaScript source
|
||||
* 'source' => $rawJS,
|
||||
* // documentation title
|
||||
* 'title' => 'My API Documentation',
|
||||
* // url used to reference line numbers in code
|
||||
* 'url' => 'https://github.com/username/project/blob/master/my.js'
|
||||
* ));
|
||||
*/
|
||||
function docdown( $options = array() ) {
|
||||
$gen = new MarkdownGenerator($options);
|
||||
return $gen->generate();
|
||||
}
|
||||
?>
|
||||
226
vendor/docdown/src/DocDown/Alias.php
vendored
226
vendor/docdown/src/DocDown/Alias.php
vendored
@@ -1,226 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* A class to represent a JSDoc entry alias.
|
||||
*/
|
||||
class Alias {
|
||||
|
||||
/**
|
||||
* The alias owner.
|
||||
*
|
||||
* @memberOf Alias
|
||||
* @type Object
|
||||
*/
|
||||
public $owner;
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* The Alias constructor.
|
||||
*
|
||||
* @constructor
|
||||
* @param {string} $name The alias name.
|
||||
* @param {Object} $owner The alias owner.
|
||||
*/
|
||||
public function __construct( $name, $owner ) {
|
||||
$this->owner = $owner;
|
||||
$this->_name = $name;
|
||||
$this->_call = $owner->getCall();
|
||||
$this->_category = $owner->getCategory();
|
||||
$this->_desc = $owner->getDesc();
|
||||
$this->_example = $owner->getExample();
|
||||
$this->_isCtor = $owner->isCtor();
|
||||
$this->_isLicense = $owner->isLicense();
|
||||
$this->_isPlugin = $owner->isPlugin();
|
||||
$this->_isPrivate = $owner->isPrivate();
|
||||
$this->_isStatic = $owner->isStatic();
|
||||
$this->_lineNumber = $owner->getLineNumber();
|
||||
$this->_members = $owner->getMembers();
|
||||
$this->_params = $owner->getParams();
|
||||
$this->_returns = $owner->getReturns();
|
||||
$this->_type = $owner->getType();
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Extracts the entry's `alias` objects.
|
||||
*
|
||||
* @memberOf Alias
|
||||
* @param {number} $index The index of the array value to return.
|
||||
* @returns {Array|string} The entry's `alias` objects.
|
||||
*/
|
||||
public function getAliases( $index = null ) {
|
||||
$result = array();
|
||||
return $index !== null
|
||||
? @$result[$index]
|
||||
: $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts the function call from the owner entry.
|
||||
*
|
||||
* @memberOf Alias
|
||||
* @returns {string} The function call.
|
||||
*/
|
||||
public function getCall() {
|
||||
return $this->_call;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts the owner entry's `category` data.
|
||||
*
|
||||
* @memberOf Alias
|
||||
* @returns {string} The owner entry's `category` data.
|
||||
*/
|
||||
public function getCategory() {
|
||||
return $this->_category;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts the owner entry's description.
|
||||
*
|
||||
* @memberOf Alias
|
||||
* @returns {string} The owner entry's description.
|
||||
*/
|
||||
public function getDesc() {
|
||||
return $this->_desc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts the owner entry's `example` data.
|
||||
*
|
||||
* @memberOf Alias
|
||||
* @returns {string} The owner entry's `example` data.
|
||||
*/
|
||||
public function getExample() {
|
||||
return $this->_example;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the entry is an alias.
|
||||
*
|
||||
* @memberOf Alias
|
||||
* @returns {boolean} Returns `true`.
|
||||
*/
|
||||
public function isAlias() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the owner entry is a constructor.
|
||||
*
|
||||
* @memberOf Alias
|
||||
* @returns {boolean} Returns `true` if a constructor, else `false`.
|
||||
*/
|
||||
public function isCtor() {
|
||||
return $this->_isCtor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the owner entry is a license.
|
||||
*
|
||||
* @memberOf Alias
|
||||
* @returns {boolean} Returns `true` if a license, else `false`.
|
||||
*/
|
||||
public function isLicense() {
|
||||
return $this->_isLicense;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the owner entry *is* assigned to a prototype.
|
||||
*
|
||||
* @memberOf Alias
|
||||
* @returns {boolean} Returns `true` if assigned to a prototype, else `false`.
|
||||
*/
|
||||
public function isPlugin() {
|
||||
return $this->_isPlugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the owner entry is private.
|
||||
*
|
||||
* @memberOf Alias
|
||||
* @returns {boolean} Returns `true` if private, else `false`.
|
||||
*/
|
||||
public function isPrivate() {
|
||||
return $this->_isPrivate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the owner entry is *not* assigned to a prototype.
|
||||
*
|
||||
* @memberOf Alias
|
||||
* @returns {boolean} Returns `true` if not assigned to a prototype, else `false`.
|
||||
*/
|
||||
public function isStatic() {
|
||||
return $this->_isStatic;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves the owner entry's line number.
|
||||
*
|
||||
* @memberOf Alias
|
||||
* @returns {number} The owner entry's line number.
|
||||
*/
|
||||
public function getLineNumber() {
|
||||
return $this->_lineNumber;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts the owner entry's `member` data.
|
||||
*
|
||||
* @memberOf Alias
|
||||
* @param {number} $index The index of the array value to return.
|
||||
* @returns {Array|string} The owner entry's `member` data.
|
||||
*/
|
||||
public function getMembers( $index = null ) {
|
||||
return $index !== null
|
||||
? @$this->_members[$index]
|
||||
: $this->_members;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts the owner entry's `name` data.
|
||||
*
|
||||
* @memberOf Alias
|
||||
* @returns {string} The owner entry's `name` data.
|
||||
*/
|
||||
public function getName() {
|
||||
return $this->_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts the owner entry's `param` data.
|
||||
*
|
||||
* @memberOf Alias
|
||||
* @param {number} $index The index of the array value to return.
|
||||
* @returns {Array} The owner entry's `param` data.
|
||||
*/
|
||||
public function getParams( $index = null ) {
|
||||
return $index !== null
|
||||
? @$this->_params[$index]
|
||||
: $this->_params;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts the owner entry's `returns` data.
|
||||
*
|
||||
* @memberOf Alias
|
||||
* @returns {string} The owner entry's `returns` data.
|
||||
*/
|
||||
public function getReturns() {
|
||||
return $this->_returns;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts the owner entry's `type` data.
|
||||
*
|
||||
* @memberOf Alias
|
||||
* @returns {string} The owner entry's `type` data.
|
||||
*/
|
||||
public function getType() {
|
||||
return $this->_type;
|
||||
}
|
||||
}
|
||||
?>
|
||||
451
vendor/docdown/src/DocDown/Entry.php
vendored
451
vendor/docdown/src/DocDown/Entry.php
vendored
@@ -1,451 +0,0 @@
|
||||
<?php
|
||||
|
||||
require(dirname(__FILE__) . "/Alias.php");
|
||||
|
||||
/**
|
||||
* A class to simplify parsing a single JSDoc entry.
|
||||
*/
|
||||
class Entry {
|
||||
|
||||
/**
|
||||
* The documentation entry.
|
||||
*
|
||||
* @memberOf Entry
|
||||
* @type string
|
||||
*/
|
||||
public $entry = '';
|
||||
|
||||
/**
|
||||
* The language highlighter used for code examples.
|
||||
*
|
||||
* @memberOf Entry
|
||||
* @type string
|
||||
*/
|
||||
public $lang = '';
|
||||
|
||||
/**
|
||||
* The source code.
|
||||
*
|
||||
* @memberOf Entry
|
||||
* @type string
|
||||
*/
|
||||
public $source = '';
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* The Entry constructor.
|
||||
*
|
||||
* @constructor
|
||||
* @param {string} $entry The documentation entry to analyse.
|
||||
* @param {string} $source The source code.
|
||||
* @param {string} [$lang ='js'] The language highlighter used for code examples.
|
||||
*/
|
||||
public function __construct( $entry, $source, $lang = 'js' ) {
|
||||
$this->entry = $entry;
|
||||
$this->lang = $lang;
|
||||
$this->source = str_replace(PHP_EOL, "\n", $source);
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Extracts the documentation entries from source code.
|
||||
*
|
||||
* @static
|
||||
* @memberOf Entry
|
||||
* @param {string} $source The source code.
|
||||
* @returns {Array} The array of entries.
|
||||
*/
|
||||
public static function getEntries( $source ) {
|
||||
preg_match_all('#/\*\*(?![-!])[\s\S]*?\*/\s*.+#', $source, $result);
|
||||
return array_pop($result);
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Checks if the entry is a function reference.
|
||||
*
|
||||
* @private
|
||||
* @memberOf Entry
|
||||
* @returns {boolean} Returns `true` if the entry is a function reference, else `false`.
|
||||
*/
|
||||
private function isFunction() {
|
||||
if (!isset($this->_isFunction)) {
|
||||
$this->_isFunction = !!(
|
||||
$this->isCtor() ||
|
||||
count($this->getParams()) ||
|
||||
count($this->getReturns()) ||
|
||||
preg_match('/\*[\t ]*@function\b/', $this->entry)
|
||||
);
|
||||
}
|
||||
return $this->_isFunction;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Extracts the entry's `alias` objects.
|
||||
*
|
||||
* @memberOf Entry
|
||||
* @param {number} $index The index of the array value to return.
|
||||
* @returns {Array|string} The entry's `alias` objects.
|
||||
*/
|
||||
public function getAliases( $index = null ) {
|
||||
if (!isset($this->_aliases)) {
|
||||
preg_match('#\*[\t ]*@alias\s+(.+)#', $this->entry, $result);
|
||||
|
||||
if (count($result)) {
|
||||
$result = trim(preg_replace('/(?:^|\n)[\t ]*\*[\t ]?/', ' ', $result[1]));
|
||||
$result = preg_split('/,\s*/', $result);
|
||||
natsort($result);
|
||||
|
||||
foreach ($result as $resultIndex => $value) {
|
||||
$result[$resultIndex] = new Alias($value, $this);
|
||||
}
|
||||
}
|
||||
$this->_aliases = $result;
|
||||
}
|
||||
return $index !== null
|
||||
? @$this->_aliases[$index]
|
||||
: $this->_aliases;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts the function call from the entry.
|
||||
*
|
||||
* @memberOf Entry
|
||||
* @returns {string} The function call.
|
||||
*/
|
||||
public function getCall() {
|
||||
if (isset($this->_call)) {
|
||||
return $this->_call;
|
||||
}
|
||||
|
||||
preg_match('#\*/\s*(?:function ([^(]*)|(.*?)(?=[:=,]|return\b))#', $this->entry, $result);
|
||||
if ($result = array_pop($result)) {
|
||||
$result = array_pop(explode('var ', trim(trim(array_pop(explode('.', $result))), "'")));
|
||||
}
|
||||
// resolve name
|
||||
// avoid $this->getName() because it calls $this->getCall()
|
||||
preg_match('#\*[\t ]*@name\s+(.+)#', $this->entry, $name);
|
||||
if (count($name)) {
|
||||
$name = trim($name[1]);
|
||||
} else {
|
||||
$name = $result;
|
||||
}
|
||||
// compile function call syntax
|
||||
if ($this->isFunction()) {
|
||||
// compose parts
|
||||
$result = array($result);
|
||||
$params = $this->getParams();
|
||||
|
||||
foreach ($params as $param) {
|
||||
// skip params that are properties of other params (e.g. `options.leading`)
|
||||
if (!preg_match('/\w+\.[\w.]+\s*=/', $param[1])) {
|
||||
$result[] = $param[1];
|
||||
}
|
||||
}
|
||||
// format
|
||||
$result = $name .'('. implode(array_slice($result, 1), ', ') .')';
|
||||
}
|
||||
|
||||
$this->_call = $result ? $result : $name;
|
||||
return $this->_call;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts the entry's `category` data.
|
||||
*
|
||||
* @memberOf Entry
|
||||
* @returns {string} The entry's `category` data.
|
||||
*/
|
||||
public function getCategory() {
|
||||
if (isset($this->_category)) {
|
||||
return $this->_category;
|
||||
}
|
||||
|
||||
preg_match('#\*[\t ]*@category\s+(.+)#', $this->entry, $result);
|
||||
if (count($result)) {
|
||||
$result = trim(preg_replace('/(?:^|\n)[\t ]*\*[\t ]?/', ' ', $result[1]));
|
||||
} else {
|
||||
$result = $this->getType() == 'Function' ? 'Methods' : 'Properties';
|
||||
}
|
||||
$this->_category = $result;
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts the entry's description.
|
||||
*
|
||||
* @memberOf Entry
|
||||
* @returns {string} The entry's description.
|
||||
*/
|
||||
public function getDesc() {
|
||||
if (isset($this->_desc)) {
|
||||
return $this->_desc;
|
||||
}
|
||||
|
||||
preg_match('#/\*\*(?:\s*\*)?([\s\S]*?)(?=\*\s\@[a-z]|\*/)#', $this->entry, $result);
|
||||
if (count($result)) {
|
||||
$type = $this->getType();
|
||||
$result = preg_replace('/:\n[\t ]*\*[\t ]*/', ":<br>\n", $result[1]);
|
||||
$result = preg_replace('/(?:^|\n)[\t ]*\*\n[\t ]*\*[\t ]*/', "\n\n", $result);
|
||||
$result = preg_replace('/(?:^|\n)[\t ]*\*[\t ]?/', ' ', $result);
|
||||
$result = trim($result);
|
||||
$result = ($type == 'Function' ? '' : '(' . str_replace('|', ', ', trim($type, '{}')) . '): ') . $result;
|
||||
}
|
||||
$this->_desc = $result;
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts the entry's `example` data.
|
||||
*
|
||||
* @memberOf Entry
|
||||
* @returns {string} The entry's `example` data.
|
||||
*/
|
||||
public function getExample() {
|
||||
if (isset($this->_example)) {
|
||||
return $this->_example;
|
||||
}
|
||||
|
||||
preg_match('#\*[\t ]*@example\s+([\s\S]*?)(?=\*\s\@[a-z]|\*/)#', $this->entry, $result);
|
||||
if (count($result)) {
|
||||
$result = trim(preg_replace('/(?:^|\n)[\t ]*\*[\t ]?/', "\n", $result[1]));
|
||||
$result = '```' . $this->lang . "\n" . $result . "\n```";
|
||||
}
|
||||
$this->_example = $result;
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the entry is an alias.
|
||||
*
|
||||
* @memberOf Entry
|
||||
* @returns {boolean} Returns `false`.
|
||||
*/
|
||||
public function isAlias() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the entry is a constructor.
|
||||
*
|
||||
* @memberOf Entry
|
||||
* @returns {boolean} Returns `true` if a constructor, else `false`.
|
||||
*/
|
||||
public function isCtor() {
|
||||
if (!isset($this->_isCtor)) {
|
||||
$this->_isCtor = !!preg_match('/\*[\t ]*@constructor\b/', $this->entry);
|
||||
}
|
||||
return $this->_isCtor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the entry is a license.
|
||||
*
|
||||
* @memberOf Entry
|
||||
* @returns {boolean} Returns `true` if a license, else `false`.
|
||||
*/
|
||||
public function isLicense() {
|
||||
if (!isset($this->_isLicense)) {
|
||||
$this->_isLicense = !!preg_match('/\*[\t ]*@license\b/', $this->entry);
|
||||
}
|
||||
return $this->_isLicense;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the entry *is* assigned to a prototype.
|
||||
*
|
||||
* @memberOf Entry
|
||||
* @returns {boolean} Returns `true` if assigned to a prototype, else `false`.
|
||||
*/
|
||||
public function isPlugin() {
|
||||
if (!isset($this->_isPlugin)) {
|
||||
$this->_isPlugin = !$this->isCtor() && !$this->isPrivate() && !$this->isStatic();
|
||||
}
|
||||
return $this->_isPlugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the entry is private.
|
||||
*
|
||||
* @memberOf Entry
|
||||
* @returns {boolean} Returns `true` if private, else `false`.
|
||||
*/
|
||||
public function isPrivate() {
|
||||
if (!isset($this->_isPrivate)) {
|
||||
$this->_isPrivate = $this->isLicense() || !!preg_match('/\*[\t ]*@private\b/', $this->entry) || !preg_match('/\*[\t ]*@[a-z]+\b/', $this->entry);
|
||||
}
|
||||
return $this->_isPrivate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the entry is *not* assigned to a prototype.
|
||||
*
|
||||
* @memberOf Entry
|
||||
* @returns {boolean} Returns `true` if not assigned to a prototype, else `false`.
|
||||
*/
|
||||
public function isStatic() {
|
||||
if (isset($this->_isStatic)) {
|
||||
return $this->_isStatic;
|
||||
}
|
||||
|
||||
$public = !$this->isPrivate();
|
||||
$result = $public && !!preg_match('/\*[\t ]*@static\b/', $this->entry);
|
||||
|
||||
// set in cases where it isn't explicitly stated
|
||||
if ($public && !$result) {
|
||||
if ($parent = array_pop(preg_split('/[#.]/', $this->getMembers(0)))) {
|
||||
foreach (Entry::getEntries($this->source) as $entry) {
|
||||
$entry = new Entry($entry, $this->source);
|
||||
if ($entry->getName() == $parent) {
|
||||
$result = !$entry->isCtor();
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$result = true;
|
||||
}
|
||||
}
|
||||
$this->_isStatic = $result;
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves the entry's line number.
|
||||
*
|
||||
* @memberOf Entry
|
||||
* @returns {number} The entry's line number.
|
||||
*/
|
||||
public function getLineNumber() {
|
||||
if (!isset($this->_lineNumber)) {
|
||||
preg_match_all('/\n/', substr($this->source, 0, strrpos($this->source, $this->entry) + strlen($this->entry)), $lines);
|
||||
$this->_lineNumber = count(array_pop($lines)) + 1;
|
||||
}
|
||||
return $this->_lineNumber;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts the entry's `member` data.
|
||||
*
|
||||
* @memberOf Entry
|
||||
* @param {number} $index The index of the array value to return.
|
||||
* @returns {Array|string} The entry's `member` data.
|
||||
*/
|
||||
public function getMembers( $index = null ) {
|
||||
if (!isset($this->_members)) {
|
||||
preg_match('#\*[\t ]*@member(?:Of)?\s+(.+)#', $this->entry, $result);
|
||||
if (count($result)) {
|
||||
$result = trim(preg_replace('/(?:^|\n)[\t ]*\*[\t ]?/', ' ', $result[1]));
|
||||
$result = preg_split('/,\s*/', $result);
|
||||
natsort($result);
|
||||
}
|
||||
$this->_members = $result;
|
||||
}
|
||||
return $index !== null
|
||||
? @$this->_members[$index]
|
||||
: $this->_members;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts the entry's `name` data.
|
||||
*
|
||||
* @memberOf Entry
|
||||
* @returns {string} The entry's `name` data.
|
||||
*/
|
||||
public function getName() {
|
||||
if (isset($this->_name)) {
|
||||
return $this->_name;
|
||||
}
|
||||
|
||||
preg_match('#\*[\t ]*@name\s+(.+)#', $this->entry, $result);
|
||||
if (count($result)) {
|
||||
$result = trim(preg_replace('/(?:^|\n)[\t ]*\*[\t ]?/', ' ', $result[1]));
|
||||
} else {
|
||||
$result = array_shift(explode('(', $this->getCall()));
|
||||
}
|
||||
$this->_name = $result;
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts the entry's `param` data.
|
||||
*
|
||||
* @memberOf Entry
|
||||
* @param {number} $index The index of the array value to return.
|
||||
* @returns {Array} The entry's `param` data.
|
||||
*/
|
||||
public function getParams( $index = null ) {
|
||||
if (!isset($this->_params)) {
|
||||
preg_match_all('#\*[\t ]*@param\s+\{\(?([^})]+)\)?\}\s+(\[.+\]|[$\w|]+(?:\[.+\])?)\s+([\s\S]*?)(?=\*\s\@[a-z]|\*/)#i', $this->entry, $matchTuples);
|
||||
$matchTuples = array_filter(array_slice($matchTuples, 1));
|
||||
$result = array();
|
||||
|
||||
if (count($matchTuples)) {
|
||||
foreach ($matchTuples as $tupleKey => $tuple) {
|
||||
foreach ($tuple as $key => $value) {
|
||||
if (!isset($result[$key])) {
|
||||
$result[$key] = array();
|
||||
}
|
||||
$result[$key][] = $tupleKey
|
||||
? trim(preg_replace('/(?:^|\n)[\t ]*\*[\t ]*/', ' ', $value))
|
||||
: trim($value);
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->_params = $result;
|
||||
}
|
||||
return $index !== null
|
||||
? @$this->_params[$index]
|
||||
: $this->_params;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts the entry's `returns` data.
|
||||
*
|
||||
* @memberOf Entry
|
||||
* @returns {string} The entry's `returns` data.
|
||||
*/
|
||||
public function getReturns() {
|
||||
if (isset($this->_returns)) {
|
||||
return $this->_returns;
|
||||
}
|
||||
|
||||
preg_match('#\*[\t ]*@returns\s+\{([^}]+)\}\s+([\s\S]*?)(?=\*\s\@[a-z]|\*/)#', $this->entry, $result);
|
||||
if (count($result)) {
|
||||
$result = array_map('trim', array_slice($result, 1));
|
||||
$result[0] = str_replace('|', ', ', $result[0]);
|
||||
$result[1] = preg_replace('/(?:^|\n)[\t ]*\*[\t ]?/', ' ', $result[1]);
|
||||
}
|
||||
$this->_returns = $result;
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts the entry's `type` data.
|
||||
*
|
||||
* @memberOf Entry
|
||||
* @returns {string} The entry's `type` data.
|
||||
*/
|
||||
public function getType() {
|
||||
if (isset($this->_type)) {
|
||||
return $this->_type;
|
||||
}
|
||||
|
||||
preg_match('#\*[\t ]*@type\s(?:\{\(?)?([^)}\n]+)#', $this->entry, $result);
|
||||
if (count($result)) {
|
||||
$result = trim($result[1]);
|
||||
if (preg_match('/^(?:array|function|object|regexp)$/', $result)) {
|
||||
$result = ucfirst($result);
|
||||
}
|
||||
} else {
|
||||
$result = $this->isFunction() ? 'Function' : 'unknown';
|
||||
}
|
||||
$this->_type = $result;
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
?>
|
||||
567
vendor/docdown/src/DocDown/MarkdownGenerator.php
vendored
567
vendor/docdown/src/DocDown/MarkdownGenerator.php
vendored
@@ -1,567 +0,0 @@
|
||||
<?php
|
||||
|
||||
require(dirname(__FILE__) . "/Entry.php");
|
||||
|
||||
/**
|
||||
* Generates Markdown from JSDoc entries.
|
||||
*/
|
||||
class MarkdownGenerator {
|
||||
|
||||
/**
|
||||
* The HTML for the close tag.
|
||||
*
|
||||
* @static
|
||||
* @memberOf MarkdownGenerator
|
||||
* @type string
|
||||
*/
|
||||
public $closeTag = "\n<!-- /div -->\n";
|
||||
|
||||
/**
|
||||
* An array of JSDoc entries.
|
||||
*
|
||||
* @memberOf MarkdownGenerator
|
||||
* @type Array
|
||||
*/
|
||||
public $entries = array();
|
||||
|
||||
/**
|
||||
* The HTML for the open tag.
|
||||
*
|
||||
* @static
|
||||
* @memberOf MarkdownGenerator
|
||||
* @type string
|
||||
*/
|
||||
public $openTag = "\n<!-- div -->\n";
|
||||
|
||||
/**
|
||||
* An options array used to configure the generator.
|
||||
*
|
||||
* @memberOf MarkdownGenerator
|
||||
* @type Array
|
||||
*/
|
||||
public $options = array();
|
||||
|
||||
/**
|
||||
* The file's source code.
|
||||
*
|
||||
* @memberOf MarkdownGenerator
|
||||
* @type string
|
||||
*/
|
||||
public $source = '';
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* The MarkdownGenerator constructor.
|
||||
*
|
||||
* @constructor
|
||||
* @param {string} $source The source code to parse.
|
||||
* @param {Array} $options The options array.
|
||||
*/
|
||||
public function __construct( $source, $options = array() ) {
|
||||
// juggle arguments
|
||||
if (is_array($source)) {
|
||||
$options = $source;
|
||||
} else {
|
||||
$options['source'] = $source;
|
||||
}
|
||||
if (isset($options['source']) && realpath($options['source'])) {
|
||||
$options['path'] = $options['source'];
|
||||
}
|
||||
if (isset($options['path'])) {
|
||||
preg_match('/(?<=\.)[a-z]+$/', $options['path'], $ext);
|
||||
$options['source'] = file_get_contents($options['path']);
|
||||
$ext = array_pop($ext);
|
||||
|
||||
if (!isset($options['lang']) && $ext) {
|
||||
$options['lang'] = $ext;
|
||||
}
|
||||
if (!isset($options['title'])) {
|
||||
$options['title'] = ucfirst(basename($options['path'])) . ' API documentation';
|
||||
}
|
||||
}
|
||||
if (!isset($options['lang'])) {
|
||||
$options['lang'] = 'js';
|
||||
}
|
||||
if (!isset($options['toc'])) {
|
||||
$options['toc'] = 'properties';
|
||||
}
|
||||
|
||||
$this->options = $options;
|
||||
$this->source = str_replace(PHP_EOL, "\n", $options['source']);
|
||||
$this->entries = Entry::getEntries($this->source);
|
||||
|
||||
foreach ($this->entries as $index => $value) {
|
||||
$this->entries[$index] = new Entry($value, $this->source, $options['lang']);
|
||||
}
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Performs common string formatting operations.
|
||||
*
|
||||
* @private
|
||||
* @static
|
||||
* @memberOf MarkdownGenerator
|
||||
* @param {string} $string The string to format.
|
||||
* @returns {string} The formatted string.
|
||||
*/
|
||||
private static function format( $string ) {
|
||||
$counter = 0;
|
||||
|
||||
// tokenize inline code snippets
|
||||
preg_match_all('/`[^`]+`/', $string, $tokenized);
|
||||
$tokenized = $tokenized[0];
|
||||
foreach ($tokenized as $snippet) {
|
||||
$string = str_replace($snippet, '__token' . ($counter++) .'__', $string);
|
||||
}
|
||||
|
||||
// italicize parentheses
|
||||
$string = preg_replace('/(^|\s)(\([^)]+\))/', '$1*$2*', $string);
|
||||
|
||||
// mark numbers as inline code
|
||||
$string = preg_replace('/[\t ](-?\d+(?:.\d+)?)(?!\.[^\n])/', ' `$1`', $string);
|
||||
|
||||
// detokenize inline code snippets
|
||||
$counter = 0;
|
||||
foreach ($tokenized as $snippet) {
|
||||
$string = str_replace('__token' . ($counter++) . '__', $snippet, $string);
|
||||
}
|
||||
|
||||
return trim($string);
|
||||
}
|
||||
|
||||
/**
|
||||
* Modify a string by replacing named tokens with matching assoc. array values.
|
||||
*
|
||||
* @private
|
||||
* @static
|
||||
* @memberOf MarkdownGenerator
|
||||
* @param {string} $string The string to modify.
|
||||
* @param {Array|Object} $object The template object.
|
||||
* @returns {string} The modified string.
|
||||
*/
|
||||
private static function interpolate( $string, $object ) {
|
||||
preg_match_all('/#\{([^}]+)\}/', $string, $tokens);
|
||||
$tokens = array_unique(array_pop($tokens));
|
||||
|
||||
foreach ($tokens as $token) {
|
||||
$pattern = '/#\{' . preg_replace('/([.*+?^${}()|[\]\\\])/', '\\\$1', $token) . '\}/';
|
||||
$replacement = '';
|
||||
|
||||
if (is_object($object)) {
|
||||
preg_match('/\(([^)]+?)\)$/', $token, $args);
|
||||
$args = preg_split('/,\s*/', array_pop($args));
|
||||
$method = 'get' . ucfirst(preg_replace('/\([^)]+?\)$/', '', $token));
|
||||
|
||||
if (method_exists($object, $method)) {
|
||||
$replacement = (string) call_user_func_array(array($object, $method), $args);
|
||||
} else if (isset($object->{$token})) {
|
||||
$replacement = (string) $object->{$token};
|
||||
}
|
||||
} else if (isset($object[$token])) {
|
||||
$replacement = (string) $object[$token];
|
||||
}
|
||||
$string = preg_replace($pattern, trim($replacement), $string);
|
||||
}
|
||||
return MarkdownGenerator::format($string);
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Adds the given `$entries` to the `$result` array.
|
||||
*
|
||||
* @private
|
||||
* @memberOf MarkdownGenerator
|
||||
* @param {Array} $result The result array to modify.
|
||||
* @param {Array} $entries The entries to add to the `$result`.
|
||||
*/
|
||||
private function addEntries( &$result, $entries ) {
|
||||
foreach ($entries as $entry) {
|
||||
// skip aliases
|
||||
if ($entry->isAlias()) {
|
||||
continue;
|
||||
}
|
||||
// name and description
|
||||
array_push(
|
||||
$result,
|
||||
$this->openTag,
|
||||
MarkdownGenerator::interpolate("### <a id=\"#{hash}\"></a>`#{member}#{separator}#{call}`\n<a href=\"##{hash}\">#</a> [Ⓢ](#{href} \"View in source\") [Ⓣ][1]\n\n#{desc}", $entry)
|
||||
);
|
||||
|
||||
// @alias
|
||||
if (count($aliases = $entry->getAliases())) {
|
||||
array_push($result, '', '#### Aliases');
|
||||
foreach ($aliases as $index => $alias) {
|
||||
$aliases[$index] = MarkdownGenerator::interpolate('#{member}#{separator}#{name}', $alias);
|
||||
}
|
||||
$result[] = '*' . implode(', ', $aliases) . '*';
|
||||
}
|
||||
// @param
|
||||
if (count($params = $entry->getParams())) {
|
||||
array_push($result, '', '#### Arguments');
|
||||
foreach ($params as $index => $param) {
|
||||
$result[] = MarkdownGenerator::interpolate('#{num}. `#{name}` (#{type}): #{desc}', array(
|
||||
'desc' => $param[2],
|
||||
'name' => $param[1],
|
||||
'num' => $index + 1,
|
||||
'type' => preg_replace('/(?<!\\\)(\*)/', '\\\$1', $param[0])
|
||||
));
|
||||
}
|
||||
}
|
||||
// @returns
|
||||
if (count($returns = $entry->getReturns())) {
|
||||
array_push(
|
||||
$result, '',
|
||||
'#### Returns',
|
||||
MarkdownGenerator::interpolate('(#{type}): #{desc}', array(
|
||||
'desc' => $returns[1],
|
||||
'type' => preg_replace('/(?<!\\\)(\*)/', '\\\$1', $returns[0])
|
||||
))
|
||||
);
|
||||
}
|
||||
// @example
|
||||
if ($example = $entry->getExample()) {
|
||||
array_push($result, '', '#### Example', $example);
|
||||
}
|
||||
array_push($result, "\n* * *", $this->closeTag);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves the entry's hash used to navigate the documentation.
|
||||
*
|
||||
* @private
|
||||
* @memberOf MarkdownGenerator
|
||||
* @param {number|Object} $entry The entry object.
|
||||
* @param {string} $member The name of the member.
|
||||
* @returns {string} The url hash.
|
||||
*/
|
||||
private function getHash( $entry, $member = '' ) {
|
||||
$entry = is_numeric($entry) ? $this->entries[$entry] : $entry;
|
||||
$member = !$member ? $entry->getMembers(0) : $member;
|
||||
|
||||
$result = ($member ? $member . ($entry->isPlugin() ? 'prototype' : '') : '') . $entry->getCall();
|
||||
$result = preg_replace('/\(\[|\[\]/', '', $result);
|
||||
$result = preg_replace('/[\t =|\'"{}.()\]]/', '', $result);
|
||||
$result = preg_replace('/[[#,]/', '-', $result);
|
||||
return strtolower($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves the entry's url for the specific line number.
|
||||
*
|
||||
* @private
|
||||
* @memberOf MarkdownGenerator
|
||||
* @param {number|Object} $entry The entry object.
|
||||
* @returns {string} The url.
|
||||
*/
|
||||
private function getLineUrl( $entry ) {
|
||||
$entry = is_numeric($entry) ? $this->entries($entry) : $entry;
|
||||
return $this->options['url'] . '#L' . $entry->getLineNumber();
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts the character used to separate the entry's name from its member.
|
||||
*
|
||||
* @private
|
||||
* @memberOf MarkdownGenerator
|
||||
* @param {number|Object} $entry The entry object.
|
||||
* @returns {string} The separator.
|
||||
*/
|
||||
private function getSeparator( $entry ) {
|
||||
$entry = is_numeric($entry) ? $this->entries($entry) : $entry;
|
||||
return $entry->isPlugin() ? '.prototype.' : '.';
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Generates Markdown from JSDoc entries.
|
||||
*
|
||||
* @memberOf MarkdownGenerator
|
||||
* @returns {string} The rendered Markdown.
|
||||
*/
|
||||
public function generate() {
|
||||
$api = array();
|
||||
$byCategory = $this->options['toc'] == 'categories';
|
||||
$categories = array();
|
||||
$closeTag = $this->closeTag;
|
||||
$compiling = false;
|
||||
$openTag = $this->openTag;
|
||||
$result = array('# ' . $this->options['title']);
|
||||
$toc = 'toc';
|
||||
|
||||
// initialize $api array
|
||||
foreach ($this->entries as $entry) {
|
||||
// skip invalid or private entries
|
||||
$name = $entry->getName();
|
||||
if (!$name || $entry->isPrivate()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$members = $entry->getMembers();
|
||||
$members = count($members) ? $members : array('');
|
||||
|
||||
foreach ($members as $member) {
|
||||
// create api category arrays
|
||||
if ($member && !isset($api[$member])) {
|
||||
// create temporary entry to be replaced later
|
||||
$api[$member] = new stdClass;
|
||||
$api[$member]->static = array();
|
||||
$api[$member]->plugin = array();
|
||||
}
|
||||
|
||||
// append entry to api member
|
||||
if (!$member || $entry->isCtor() || ($entry->getType() == 'Object' &&
|
||||
!preg_match('/[=:]\s*(?:null|undefined)\s*[,;]?$/', $entry->entry))) {
|
||||
|
||||
// assign the real entry, replacing the temporary entry if it exist
|
||||
$member = ($member ? $member . ($entry->isPlugin() ? '#' : '.') : '') . $name;
|
||||
$entry->static = @$api[$member] ? $api[$member]->static : array();
|
||||
$entry->plugin = @$api[$member] ? $api[$member]->plugin : array();
|
||||
|
||||
$api[$member] = $entry;
|
||||
foreach ($entry->getAliases() as $alias) {
|
||||
$api[$member]->static[] = $alias;
|
||||
}
|
||||
}
|
||||
else if ($entry->isStatic()) {
|
||||
$api[$member]->static[] = $entry;
|
||||
foreach ($entry->getAliases() as $alias) {
|
||||
$api[$member]->static[] = $alias;
|
||||
}
|
||||
}
|
||||
else if (!$entry->isCtor()) {
|
||||
$api[$member]->plugin[] = $entry;
|
||||
foreach ($entry->getAliases() as $alias) {
|
||||
$api[$member]->plugin[] = $alias;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// add properties to each entry
|
||||
foreach ($api as $entry) {
|
||||
$entry->hash = $this->getHash($entry);
|
||||
$entry->href = $this->getLineUrl($entry);
|
||||
|
||||
$member = $entry->getMembers(0);
|
||||
$member = ($member ? $member . $this->getSeparator($entry) : '') . $entry->getName();
|
||||
$entry->member = preg_replace('/' . $entry->getName() . '$/', '', $member);
|
||||
|
||||
// add properties to static and plugin sub-entries
|
||||
foreach (array('static', 'plugin') as $kind) {
|
||||
foreach ($entry->{$kind} as $subentry) {
|
||||
$subentry->hash = $this->getHash($subentry);
|
||||
$subentry->href = $this->getLineUrl($subentry);
|
||||
$subentry->member = $member;
|
||||
$subentry->separator = $this->getSeparator($subentry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
// custom sort for root level entries
|
||||
// TODO: see how well it handles deeper namespace traversal
|
||||
function sortCompare($a, $b) {
|
||||
$score = array( 'a' => 0, 'b' => 0);
|
||||
foreach (array( 'a' => $a, 'b' => $b) as $key => $value) {
|
||||
// capitalized properties are last
|
||||
if (preg_match('/[#.][A-Z]/', $value)) {
|
||||
$score[$key] = 0;
|
||||
}
|
||||
// lowercase prototype properties are next to last
|
||||
else if (preg_match('/#[a-z]/', $value)) {
|
||||
$score[$key] = 1;
|
||||
}
|
||||
// lowercase static properties next to first
|
||||
else if (preg_match('/\.[a-z]/', $value)) {
|
||||
$score[$key] = 2;
|
||||
}
|
||||
// root properties are first
|
||||
else if (preg_match('/^[^#.]+$/', $value)) {
|
||||
$score[$key] = 3;
|
||||
}
|
||||
}
|
||||
$score = $score['b'] - $score['a'];
|
||||
return $score ? $score : strcasecmp($a, $b);
|
||||
}
|
||||
|
||||
uksort($api, 'sortCompare');
|
||||
|
||||
// sort static and plugin sub-entries
|
||||
foreach ($api as $entry) {
|
||||
foreach (array('static', 'plugin') as $kind) {
|
||||
$sortBy = array( 'a' => array(), 'b' => array(), 'c' => array() );
|
||||
foreach ($entry->{$kind} as $subentry) {
|
||||
$name = $subentry->getName();
|
||||
// functions w/o ALL-CAPs names are last
|
||||
$sortBy['a'][] = $subentry->getType() == 'Function' && !preg_match('/^[A-Z_]+$/', $name);
|
||||
// ALL-CAPs properties first
|
||||
$sortBy['b'][] = preg_match('/^[A-Z_]+$/', $name);
|
||||
// lowercase alphanumeric sort
|
||||
$sortBy['c'][] = strtolower($name);
|
||||
}
|
||||
array_multisort($sortBy['a'], SORT_ASC, $sortBy['b'], SORT_DESC, $sortBy['c'], SORT_ASC, $entry->{$kind});
|
||||
}
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
// add categories
|
||||
foreach ($api as $entry) {
|
||||
$categories[$entry->getCategory()][] = $entry;
|
||||
foreach (array('static', 'plugin') as $kind) {
|
||||
foreach ($entry->{$kind} as $subentry) {
|
||||
$categories[$subentry->getCategory()][] = $subentry;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// sort categories
|
||||
ksort($categories);
|
||||
|
||||
foreach(array('Methods', 'Properties') as $category) {
|
||||
if (isset($categories[$category])) {
|
||||
$entries = $categories[$category];
|
||||
unset($categories[$category]);
|
||||
$categories[$category] = $entries;
|
||||
}
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
// compile TOC
|
||||
$result[] = $openTag;
|
||||
|
||||
// compile TOC by categories
|
||||
if ($byCategory) {
|
||||
foreach ($categories as $category => $entries) {
|
||||
if ($compiling) {
|
||||
$result[] = $closeTag;
|
||||
} else {
|
||||
$compiling = true;
|
||||
}
|
||||
// assign TOC hash
|
||||
if (count($result) == 2) {
|
||||
$toc = $category;
|
||||
}
|
||||
// add category
|
||||
array_push(
|
||||
$result,
|
||||
$openTag, '## ' . (count($result) == 2 ? '<a id="' . $toc . '"></a>' : '') . '`' . $category . '`'
|
||||
);
|
||||
// add entries
|
||||
foreach ($entries as $entry) {
|
||||
$result[] = MarkdownGenerator::interpolate('* [`#{member}#{separator}#{name}`](##{hash})', $entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
// compile TOC by namespace
|
||||
else {
|
||||
foreach ($api as $entry) {
|
||||
if ($compiling) {
|
||||
$result[] = $closeTag;
|
||||
} else {
|
||||
$compiling = true;
|
||||
}
|
||||
$member = $entry->member . $entry->getName();
|
||||
|
||||
// assign TOC hash
|
||||
if (count($result) == 2) {
|
||||
$toc = $member;
|
||||
}
|
||||
// add root entry
|
||||
array_push(
|
||||
$result,
|
||||
$openTag, '## ' . (count($result) == 2 ? '<a id="' . $toc . '"></a>' : '') . '`' . $member . '`',
|
||||
MarkdownGenerator::interpolate('* [`' . $member . '`](##{hash})', $entry)
|
||||
);
|
||||
|
||||
// add static and plugin sub-entries
|
||||
foreach (array('static', 'plugin') as $kind) {
|
||||
if ($kind == 'plugin' && count($entry->plugin)) {
|
||||
array_push(
|
||||
$result,
|
||||
$closeTag,
|
||||
$openTag,
|
||||
'## `' . $member . ($entry->isCtor() ? '.prototype`' : '`')
|
||||
);
|
||||
}
|
||||
foreach ($entry->{$kind} as $subentry) {
|
||||
$subentry->member = $member;
|
||||
$result[] = MarkdownGenerator::interpolate('* [`#{member}#{separator}#{name}`](##{hash})', $subentry);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
array_push($result, $closeTag, $closeTag);
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
// compile content
|
||||
$compiling = false;
|
||||
$result[] = $openTag;
|
||||
|
||||
if ($byCategory) {
|
||||
foreach ($categories as $category => $entries) {
|
||||
if ($compiling) {
|
||||
$result[] = $closeTag;
|
||||
} else {
|
||||
$compiling = true;
|
||||
}
|
||||
if ($category != 'Methods' && $category != 'Properties') {
|
||||
$category = '“' . $category . '” Methods';
|
||||
}
|
||||
array_push($result, $openTag, '## `' . $category . '`');
|
||||
$this->addEntries($result, $entries);
|
||||
}
|
||||
}
|
||||
else {
|
||||
foreach ($api as $entry) {
|
||||
// skip aliases
|
||||
if ($entry->isAlias()) {
|
||||
continue;
|
||||
}
|
||||
if ($compiling) {
|
||||
$result[] = $closeTag;
|
||||
} else {
|
||||
$compiling = true;
|
||||
}
|
||||
// add root entry name
|
||||
$member = $entry->member . $entry->getName();
|
||||
array_push($result, $openTag, '## `' . $member . '`');
|
||||
|
||||
foreach (array($entry, 'static', 'plugin') as $kind) {
|
||||
$subentries = is_string($kind) ? $entry->{$kind} : array($kind);
|
||||
|
||||
// add sub-entry name
|
||||
if ($kind != 'static' && $entry->getType() != 'Object' &&
|
||||
count($subentries) && $subentries[0] != $kind) {
|
||||
if ($kind == 'plugin') {
|
||||
$result[] = $closeTag;
|
||||
}
|
||||
array_push(
|
||||
$result,
|
||||
$openTag,
|
||||
'## `' . $member . ($kind == 'plugin' ? '.prototype`' : '`')
|
||||
);
|
||||
}
|
||||
$this->addEntries($result, $subentries);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// close tags add TOC link reference
|
||||
array_push($result, $closeTag, $closeTag, '', ' [1]: #' . $toc . ' "Jump back to the TOC."');
|
||||
|
||||
// cleanup whitespace
|
||||
return trim(preg_replace('/[\t ]+\n/', "\n", join($result, "\n")));
|
||||
}
|
||||
}
|
||||
?>
|
||||
195
vendor/dojo/LICENSE
vendored
195
vendor/dojo/LICENSE
vendored
@@ -1,195 +0,0 @@
|
||||
Dojo is available under *either* the terms of the modified BSD license *or* the
|
||||
Academic Free License version 2.1. As a recipient of Dojo, you may choose which
|
||||
license to receive this code under (except as noted in per-module LICENSE
|
||||
files). Some modules may not be the copyright of the Dojo Foundation. These
|
||||
modules contain explicit declarations of copyright in both the LICENSE files in
|
||||
the directories in which they reside and in the code itself. No external
|
||||
contributions are allowed under licenses which are fundamentally incompatible
|
||||
with the AFL or BSD licenses that Dojo is distributed under.
|
||||
|
||||
The text of the AFL and BSD licenses is reproduced below.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
The "New" BSD License:
|
||||
**********************
|
||||
|
||||
Copyright (c) 2005-2013, The Dojo Foundation
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the Dojo Foundation nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
The Academic Free License, v. 2.1:
|
||||
**********************************
|
||||
|
||||
This Academic Free License (the "License") applies to any original work of
|
||||
authorship (the "Original Work") whose owner (the "Licensor") has placed the
|
||||
following notice immediately following the copyright notice for the Original
|
||||
Work:
|
||||
|
||||
Licensed under the Academic Free License version 2.1
|
||||
|
||||
1) Grant of Copyright License. Licensor hereby grants You a world-wide,
|
||||
royalty-free, non-exclusive, perpetual, sublicenseable license to do the
|
||||
following:
|
||||
|
||||
a) to reproduce the Original Work in copies;
|
||||
|
||||
b) to prepare derivative works ("Derivative Works") based upon the Original
|
||||
Work;
|
||||
|
||||
c) to distribute copies of the Original Work and Derivative Works to the
|
||||
public;
|
||||
|
||||
d) to perform the Original Work publicly; and
|
||||
|
||||
e) to display the Original Work publicly.
|
||||
|
||||
2) Grant of Patent License. Licensor hereby grants You a world-wide,
|
||||
royalty-free, non-exclusive, perpetual, sublicenseable license, under patent
|
||||
claims owned or controlled by the Licensor that are embodied in the Original
|
||||
Work as furnished by the Licensor, to make, use, sell and offer for sale the
|
||||
Original Work and Derivative Works.
|
||||
|
||||
3) Grant of Source Code License. The term "Source Code" means the preferred
|
||||
form of the Original Work for making modifications to it and all available
|
||||
documentation describing how to modify the Original Work. Licensor hereby
|
||||
agrees to provide a machine-readable copy of the Source Code of the Original
|
||||
Work along with each copy of the Original Work that Licensor distributes.
|
||||
Licensor reserves the right to satisfy this obligation by placing a
|
||||
machine-readable copy of the Source Code in an information repository
|
||||
reasonably calculated to permit inexpensive and convenient access by You for as
|
||||
long as Licensor continues to distribute the Original Work, and by publishing
|
||||
the address of that information repository in a notice immediately following
|
||||
the copyright notice that applies to the Original Work.
|
||||
|
||||
4) Exclusions From License Grant. Neither the names of Licensor, nor the names
|
||||
of any contributors to the Original Work, nor any of their trademarks or
|
||||
service marks, may be used to endorse or promote products derived from this
|
||||
Original Work without express prior written permission of the Licensor. Nothing
|
||||
in this License shall be deemed to grant any rights to trademarks, copyrights,
|
||||
patents, trade secrets or any other intellectual property of Licensor except as
|
||||
expressly stated herein. No patent license is granted to make, use, sell or
|
||||
offer to sell embodiments of any patent claims other than the licensed claims
|
||||
defined in Section 2. No right is granted to the trademarks of Licensor even if
|
||||
such marks are included in the Original Work. Nothing in this License shall be
|
||||
interpreted to prohibit Licensor from licensing under different terms from this
|
||||
License any Original Work that Licensor otherwise would have a right to
|
||||
license.
|
||||
|
||||
5) This section intentionally omitted.
|
||||
|
||||
6) Attribution Rights. You must retain, in the Source Code of any Derivative
|
||||
Works that You create, all copyright, patent or trademark notices from the
|
||||
Source Code of the Original Work, as well as any notices of licensing and any
|
||||
descriptive text identified therein as an "Attribution Notice." You must cause
|
||||
the Source Code for any Derivative Works that You create to carry a prominent
|
||||
Attribution Notice reasonably calculated to inform recipients that You have
|
||||
modified the Original Work.
|
||||
|
||||
7) Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that
|
||||
the copyright in and to the Original Work and the patent rights granted herein
|
||||
by Licensor are owned by the Licensor or are sublicensed to You under the terms
|
||||
of this License with the permission of the contributor(s) of those copyrights
|
||||
and patent rights. Except as expressly stated in the immediately proceeding
|
||||
sentence, the Original Work is provided under this License on an "AS IS" BASIS
|
||||
and WITHOUT WARRANTY, either express or implied, including, without limitation,
|
||||
the warranties of NON-INFRINGEMENT, MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU.
|
||||
This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No
|
||||
license to Original Work is granted hereunder except under this disclaimer.
|
||||
|
||||
8) Limitation of Liability. Under no circumstances and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise, shall the
|
||||
Licensor be liable to any person for any direct, indirect, special, incidental,
|
||||
or consequential damages of any character arising as a result of this License
|
||||
or the use of the Original Work including, without limitation, damages for loss
|
||||
of goodwill, work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses. This limitation of liability shall not
|
||||
apply to liability for death or personal injury resulting from Licensor's
|
||||
negligence to the extent applicable law prohibits such limitation. Some
|
||||
jurisdictions do not allow the exclusion or limitation of incidental or
|
||||
consequential damages, so this exclusion and limitation may not apply to You.
|
||||
|
||||
9) Acceptance and Termination. If You distribute copies of the Original Work or
|
||||
a Derivative Work, You must make a reasonable effort under the circumstances to
|
||||
obtain the express assent of recipients to the terms of this License. Nothing
|
||||
else but this License (or another written agreement between Licensor and You)
|
||||
grants You permission to create Derivative Works based upon the Original Work
|
||||
or to exercise any of the rights granted in Section 1 herein, and any attempt
|
||||
to do so except under the terms of this License (or another written agreement
|
||||
between Licensor and You) is expressly prohibited by U.S. copyright law, the
|
||||
equivalent laws of other countries, and by international treaty. Therefore, by
|
||||
exercising any of the rights granted to You in Section 1 herein, You indicate
|
||||
Your acceptance of this License and all of its terms and conditions.
|
||||
|
||||
10) Termination for Patent Action. This License shall terminate automatically
|
||||
and You may no longer exercise any of the rights granted to You by this License
|
||||
as of the date You commence an action, including a cross-claim or counterclaim,
|
||||
against Licensor or any licensee alleging that the Original Work infringes a
|
||||
patent. This termination provision shall not apply for an action alleging
|
||||
patent infringement by combinations of the Original Work with other software or
|
||||
hardware.
|
||||
|
||||
11) Jurisdiction, Venue and Governing Law. Any action or suit relating to this
|
||||
License may be brought only in the courts of a jurisdiction wherein the
|
||||
Licensor resides or in which Licensor conducts its primary business, and under
|
||||
the laws of that jurisdiction excluding its conflict-of-law provisions. The
|
||||
application of the United Nations Convention on Contracts for the International
|
||||
Sale of Goods is expressly excluded. Any use of the Original Work outside the
|
||||
scope of this License or after its termination shall be subject to the
|
||||
requirements and penalties of the U.S. Copyright Act, 17 U.S.C. § 101 et
|
||||
seq., the equivalent laws of other countries, and international treaty. This
|
||||
section shall survive the termination of this License.
|
||||
|
||||
12) Attorneys Fees. In any action to enforce the terms of this License or
|
||||
seeking damages relating thereto, the prevailing party shall be entitled to
|
||||
recover its costs and expenses, including, without limitation, reasonable
|
||||
attorneys' fees and costs incurred in connection with such action, including
|
||||
any appeal of such action. This section shall survive the termination of this
|
||||
License.
|
||||
|
||||
13) Miscellaneous. This License represents the complete agreement concerning
|
||||
the subject matter hereof. If any provision of this License is held to be
|
||||
unenforceable, such provision shall be reformed only to the extent necessary to
|
||||
make it enforceable.
|
||||
|
||||
14) Definition of "You" in This License. "You" throughout this License, whether
|
||||
in upper or lower case, means an individual or a legal entity exercising rights
|
||||
under, and complying with all of the terms of, this License. For legal
|
||||
entities, "You" includes any entity that controls, is controlled by, or is
|
||||
under common control with you. For purposes of this definition, "control" means
|
||||
(i) the power, direct or indirect, to cause the direction or management of such
|
||||
entity, whether by contract or otherwise, or (ii) ownership of fifty percent
|
||||
(50%) or more of the outstanding shares, or (iii) beneficial ownership of such
|
||||
entity.
|
||||
|
||||
15) Right to Use. You may use the Original Work in all ways not otherwise
|
||||
restricted or conditioned by this License or by law, and Licensor promises not
|
||||
to interfere with or be responsible for such uses by You.
|
||||
|
||||
This license is Copyright (C) 2003-2004 Lawrence E. Rosen. All rights reserved.
|
||||
Permission is hereby granted to copy and distribute this license without
|
||||
modification. This license may not be modified without the express written
|
||||
permission of its copyright owner.
|
||||
1997
vendor/dojo/dojo.js
vendored
1997
vendor/dojo/dojo.js
vendored
File diff suppressed because it is too large
Load Diff
21
vendor/jquery/MIT-LICENSE.txt
vendored
21
vendor/jquery/MIT-LICENSE.txt
vendored
@@ -1,21 +0,0 @@
|
||||
Copyright 2012 jQuery Foundation and other contributors
|
||||
http://jquery.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.
|
||||
9440
vendor/jquery/jquery.js
vendored
9440
vendor/jquery/jquery.js
vendored
File diff suppressed because it is too large
Load Diff
27
vendor/json-js/json2.js
vendored
27
vendor/json-js/json2.js
vendored
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
json2.js
|
||||
2013-05-26
|
||||
2014-02-04
|
||||
|
||||
Public Domain.
|
||||
|
||||
@@ -192,19 +192,11 @@ if (typeof JSON !== 'object') {
|
||||
};
|
||||
}
|
||||
|
||||
var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
|
||||
escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
|
||||
var cx,
|
||||
escapable,
|
||||
gap,
|
||||
indent,
|
||||
meta = { // table of character substitutions
|
||||
'\b': '\\b',
|
||||
'\t': '\\t',
|
||||
'\n': '\\n',
|
||||
'\f': '\\f',
|
||||
'\r': '\\r',
|
||||
'"' : '\\"',
|
||||
'\\': '\\\\'
|
||||
},
|
||||
meta,
|
||||
rep;
|
||||
|
||||
|
||||
@@ -356,6 +348,16 @@ if (typeof JSON !== 'object') {
|
||||
// If the JSON object does not yet have a stringify method, give it one.
|
||||
|
||||
if (typeof JSON.stringify !== 'function') {
|
||||
escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
|
||||
meta = { // table of character substitutions
|
||||
'\b': '\\b',
|
||||
'\t': '\\t',
|
||||
'\n': '\\n',
|
||||
'\f': '\\f',
|
||||
'\r': '\\r',
|
||||
'"' : '\\"',
|
||||
'\\': '\\\\'
|
||||
};
|
||||
JSON.stringify = function (value, replacer, space) {
|
||||
|
||||
// The stringify method takes a value and an optional replacer, and an optional
|
||||
@@ -403,6 +405,7 @@ if (typeof JSON !== 'object') {
|
||||
// If the JSON object does not yet have a parse method, give it one.
|
||||
|
||||
if (typeof JSON.parse !== 'function') {
|
||||
cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
|
||||
JSON.parse = function (text, reviver) {
|
||||
|
||||
// The parse method takes a text and an optional reviver function, and returns
|
||||
|
||||
20
vendor/platform.js/LICENSE.txt
vendored
20
vendor/platform.js/LICENSE.txt
vendored
@@ -1,20 +0,0 @@
|
||||
Copyright 2011-2013 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.
|
||||
1007
vendor/platform.js/platform.js
vendored
1007
vendor/platform.js/platform.js
vendored
File diff suppressed because it is too large
Load Diff
20
vendor/qunit-clib/LICENSE.txt
vendored
20
vendor/qunit-clib/LICENSE.txt
vendored
@@ -1,20 +0,0 @@
|
||||
Copyright 2011-2013 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.
|
||||
337
vendor/qunit-clib/qunit-clib.js
vendored
337
vendor/qunit-clib/qunit-clib.js
vendored
@@ -1,337 +0,0 @@
|
||||
/*!
|
||||
* QUnit CLI Boilerplate v1.3.0
|
||||
* Copyright 2011-2012 John-David Dalton <http://allyoucanleet.com/>
|
||||
* Based on a gist by Jörn Zaefferer <https://gist.github.com/722381>
|
||||
* Available under MIT license <http://mths.be/mit>
|
||||
*/
|
||||
;(function(root) {
|
||||
'use strict';
|
||||
|
||||
/** Detect free variable `exports` */
|
||||
var freeExports = typeof exports == 'object' && exports;
|
||||
|
||||
/** Detect free variable `global`, from Node.js or Browserified code, and use it as `root` */
|
||||
var freeGlobal = typeof global == 'object' && global;
|
||||
if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {
|
||||
root = freeGlobal;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Installs the CLI boilerplate additions on the given `context` object.
|
||||
*
|
||||
* @memberOf exports
|
||||
* @param {Object} context The context object.
|
||||
*/
|
||||
function runInContext(context) {
|
||||
// exit early if no `context` is provided or if `QUnit` does not exist
|
||||
if (!context || !context.QUnit) {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Schedules timer-based callbacks.
|
||||
*
|
||||
* @private
|
||||
* @param {Function|string} fn The function to call.
|
||||
* @param {number} delay The number of milliseconds to delay the `fn` call.
|
||||
* @param [arg1, arg2, ...] Arguments to invoke `fn` with.
|
||||
* @param {boolean} repeated A flag to specify whether `fn` is called repeatedly.
|
||||
* @returns {number} The the ID of the timeout.
|
||||
*/
|
||||
function schedule(fn, delay, args, repeated) {
|
||||
// Rhino 1.7RC4 will error assigning `task` below
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=775566
|
||||
var task = ids[++counter] = new JavaAdapter(java.util.TimerTask, {
|
||||
'run': function() {
|
||||
fn.apply(context, args);
|
||||
}
|
||||
});
|
||||
// support non-functions
|
||||
if (typeof fn != 'function') {
|
||||
fn = (function(code) {
|
||||
code = String(code);
|
||||
return function() { eval(code); };
|
||||
}(fn));
|
||||
}
|
||||
// used by setInterval
|
||||
if (repeated) {
|
||||
timer.schedule(task, delay, delay);
|
||||
}
|
||||
// used by setTimeout
|
||||
else {
|
||||
timer.schedule(task, delay);
|
||||
}
|
||||
return counter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the delay set by `setInterval` or `setTimeout`.
|
||||
*
|
||||
* @memberOf context
|
||||
* @param {number} id The ID of the timeout to be cleared.
|
||||
*/
|
||||
function clearTimer(id) {
|
||||
if (ids[id]) {
|
||||
ids[id].cancel();
|
||||
timer.purge();
|
||||
delete ids[id];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes a code snippet or function repeatedly, with a delay between each call.
|
||||
*
|
||||
* @memberOf context
|
||||
* @param {Function|string} fn The function to call or string to evaluate.
|
||||
* @param {number} delay The number of milliseconds to delay each `fn` call.
|
||||
* @param [arg1, arg2, ...] Arguments to invoke `fn` with.
|
||||
* @returns {number} The the ID of the timeout.
|
||||
*/
|
||||
function setInterval(fn, delay) {
|
||||
return schedule(fn, delay, slice.call(arguments, 2), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes a code snippet or a function after specified delay.
|
||||
*
|
||||
* @memberOf context
|
||||
* @param {Function|string} fn The function to call or string to evaluate.
|
||||
* @param {number} delay The number of milliseconds to delay the `fn` call.
|
||||
* @param [arg1, arg2, ...] Arguments to invoke `fn` with.
|
||||
* @returns {number} The the ID of the timeout.
|
||||
*/
|
||||
function setTimeout(fn, delay) {
|
||||
return schedule(fn, delay, slice.call(arguments, 2));
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
/** Used to report the test module for failing tests */
|
||||
var moduleName,
|
||||
modulePrinted;
|
||||
|
||||
/** Add `console.log()` support for Narwhal, Rhino, and RingoJS */
|
||||
var console = context.console || (context.console = { 'log': context.print });
|
||||
|
||||
/** Used as a horizontal rule in console output */
|
||||
var hr = '----------------------------------------';
|
||||
|
||||
/** Used by `logInline` to clear previously logged messages */
|
||||
var prevLine = '';
|
||||
|
||||
/** Shorten `context.QUnit.QUnit` to `context.QUnit` */
|
||||
var QUnit = context.QUnit = context.QUnit.QUnit || context.QUnit;
|
||||
|
||||
/**
|
||||
* Logs an inline message to standard output.
|
||||
*
|
||||
* @private
|
||||
* @param {string} text The text to log.
|
||||
*/
|
||||
var logInline = (function() {
|
||||
// exit early if not Node.js
|
||||
if (!(typeof process == 'object' && process &&
|
||||
process.on && process.stdout && process.platform != 'win32')) {
|
||||
return function() {};
|
||||
}
|
||||
// cleanup any inline logs when exited via `ctrl+c`
|
||||
process.on('SIGINT', function() {
|
||||
logInline('');
|
||||
process.exit();
|
||||
});
|
||||
return function(text) {
|
||||
var blankLine = Array(prevLine.length + 1).join(' ');
|
||||
if (text.length > hr.length) {
|
||||
text = text.slice(0, hr.length - 3) + '...';
|
||||
}
|
||||
prevLine = text;
|
||||
process.stdout.write(text + blankLine.slice(text.length) + '\r');
|
||||
}
|
||||
}());
|
||||
|
||||
/**
|
||||
* A logging callback triggered when all testing is completed.
|
||||
*
|
||||
* @memberOf QUnit
|
||||
* @param {Object} details An object with properties `failed`, `passed`, `runtime`, and `total`.
|
||||
*/
|
||||
QUnit.done(function() {
|
||||
var ran;
|
||||
return function(details) {
|
||||
// stop `asyncTest()` from erroneously calling `done()` twice in
|
||||
// environments w/o timeouts
|
||||
if (ran) {
|
||||
return;
|
||||
}
|
||||
ran = true;
|
||||
|
||||
logInline('');
|
||||
console.log(hr);
|
||||
console.log(' PASS: ' + details.passed + ' FAIL: ' + details.failed + ' TOTAL: ' + details.total);
|
||||
console.log(' Finished in ' + details.runtime + ' milliseconds.');
|
||||
console.log(hr);
|
||||
|
||||
// exit out of Narhwal, Rhino, or RingoJS
|
||||
try {
|
||||
quit();
|
||||
} catch(e) { }
|
||||
|
||||
// exit out of Node.js or PhantomJS
|
||||
try {
|
||||
var process = context.process || context.phantom;
|
||||
if (details.failed) {
|
||||
console.error('Error: ' + details.failed + ' of ' + details.total + ' tests failed.');
|
||||
process.exit(1);
|
||||
} else {
|
||||
process.exit(0);
|
||||
}
|
||||
} catch(e) { }
|
||||
};
|
||||
}());
|
||||
|
||||
/**
|
||||
* A logging callback triggered after every assertion.
|
||||
*
|
||||
* @memberOf QUnit
|
||||
* @param {Object} details An object with properties `actual`, `expected`, `message`, and `result`.
|
||||
*/
|
||||
QUnit.log(function(details) {
|
||||
var expected = details.expected,
|
||||
result = details.result,
|
||||
type = typeof expected != 'undefined' ? 'EQ' : 'OK';
|
||||
|
||||
var assertion = [
|
||||
result ? 'PASS' : 'FAIL',
|
||||
type,
|
||||
details.message || 'ok'
|
||||
];
|
||||
|
||||
if (!result && type == 'EQ') {
|
||||
assertion.push('Expected: ' + expected + ', Actual: ' + details.actual);
|
||||
}
|
||||
QUnit.config.testStats.assertions.push(assertion.join(' | '));
|
||||
});
|
||||
|
||||
/**
|
||||
* A logging callback triggered at the start of every test module.
|
||||
*
|
||||
* @memberOf QUnit
|
||||
* @param {Object} details An object with property `name`.
|
||||
*/
|
||||
QUnit.moduleStart(function(details) {
|
||||
var newModuleName = details.name;
|
||||
if (moduleName != newModuleName) {
|
||||
moduleName = newModuleName;
|
||||
modulePrinted = false;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Converts an object into a string representation.
|
||||
*
|
||||
* @memberOf QUnit
|
||||
* @type Function
|
||||
* @param {Object} object The object to stringify.
|
||||
* @returns {string} The result string.
|
||||
*/
|
||||
QUnit.jsDump.parsers.object = (function() {
|
||||
var func = QUnit.jsDump.parsers.object;
|
||||
return function(object) {
|
||||
// fork to support Rhino's error objects
|
||||
if (typeof object.rhinoException == 'object') {
|
||||
return object.name +
|
||||
' { message: "' + object.message +
|
||||
'", fileName: "' + object.fileName +
|
||||
'", lineNumber: ' + object.lineNumber + ' }';
|
||||
}
|
||||
return func(object);
|
||||
};
|
||||
}());
|
||||
|
||||
/**
|
||||
* A logging callback triggered after a test is completed.
|
||||
*
|
||||
* @memberOf QUnit
|
||||
* @param {Object} details An object with properties `failed`, `name`, `passed`, and `total`.
|
||||
*/
|
||||
QUnit.testDone(function(details) {
|
||||
var assertions = QUnit.config.testStats.assertions,
|
||||
testName = details.name;
|
||||
|
||||
if (details.failed > 0) {
|
||||
logInline('');
|
||||
if (!modulePrinted) {
|
||||
modulePrinted = true;
|
||||
console.log(hr);
|
||||
console.log(moduleName);
|
||||
console.log(hr);
|
||||
}
|
||||
console.log(' FAIL - '+ testName);
|
||||
assertions.forEach(function(value) {
|
||||
console.log(' ' + value);
|
||||
});
|
||||
} else {
|
||||
logInline('Testing ' + moduleName + '...');
|
||||
}
|
||||
assertions.length = 0;
|
||||
});
|
||||
|
||||
/**
|
||||
* An object used to hold information about the current running test.
|
||||
*
|
||||
* @memberOf QUnit.config
|
||||
* @type Object
|
||||
*/
|
||||
QUnit.config.testStats = {
|
||||
|
||||
/**
|
||||
* An array of test summaries.
|
||||
*
|
||||
* @memberOf QUnit.config.testStats
|
||||
* @type Array
|
||||
*/
|
||||
'assertions': []
|
||||
};
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
// Timeout fallbacks based on the work of Andrea Giammarchi and Weston C.
|
||||
// https://github.com/WebReflection/wru/blob/master/src/rhinoTimers.js
|
||||
// http://stackoverflow.com/questions/2261705/how-to-run-a-javascript-function-asynchronously-without-using-settimeout
|
||||
try {
|
||||
var counter = 0,
|
||||
ids = {},
|
||||
slice = Array.prototype.slice,
|
||||
timer = new java.util.Timer;
|
||||
|
||||
context.clearInterval =
|
||||
context.clearTimeout = clearTimer;
|
||||
context.setInterval = setInterval;
|
||||
context.setTimeout = setTimeout;
|
||||
} catch(e) { }
|
||||
|
||||
// expose shortcuts
|
||||
// exclude `module` because some environments have it as a built-in object
|
||||
('asyncTest deepEqual equal equals expect notDeepEqual notEqual notStrictEqual ' +
|
||||
'ok raises same start stop strictEqual test throws').replace(/\S+/g, function(methodName) {
|
||||
context[methodName] = QUnit[methodName];
|
||||
});
|
||||
|
||||
// must call `QUnit.start()` in the test file if not loaded in a browser
|
||||
if (!context.document || context.phantom) {
|
||||
QUnit.config.autostart = false;
|
||||
QUnit.init();
|
||||
}
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
// expose QUnit CLIB
|
||||
if (freeExports && !freeExports.nodeType) {
|
||||
freeExports.runInContext = runInContext;
|
||||
} else {
|
||||
runInContext(root);
|
||||
}
|
||||
}(this));
|
||||
21
vendor/qunit/MIT-LICENSE.txt
vendored
21
vendor/qunit/MIT-LICENSE.txt
vendored
@@ -1,21 +0,0 @@
|
||||
Copyright 2013 jQuery Foundation and other contributors
|
||||
http://jquery.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.
|
||||
244
vendor/qunit/qunit/qunit.css
vendored
244
vendor/qunit/qunit/qunit.css
vendored
@@ -1,244 +0,0 @@
|
||||
/**
|
||||
* QUnit v1.11.0 - A JavaScript Unit Testing Framework
|
||||
*
|
||||
* http://qunitjs.com
|
||||
*
|
||||
* Copyright 2012 jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*/
|
||||
|
||||
/** Font Family and Sizes */
|
||||
|
||||
#qunit-tests, #qunit-header, #qunit-banner, #qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult {
|
||||
font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial, sans-serif;
|
||||
}
|
||||
|
||||
#qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult, #qunit-tests li { font-size: small; }
|
||||
#qunit-tests { font-size: smaller; }
|
||||
|
||||
|
||||
/** Resets */
|
||||
|
||||
#qunit-tests, #qunit-header, #qunit-banner, #qunit-userAgent, #qunit-testresult, #qunit-modulefilter {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
|
||||
/** Header */
|
||||
|
||||
#qunit-header {
|
||||
padding: 0.5em 0 0.5em 1em;
|
||||
|
||||
color: #8699a4;
|
||||
background-color: #0d3349;
|
||||
|
||||
font-size: 1.5em;
|
||||
line-height: 1em;
|
||||
font-weight: normal;
|
||||
|
||||
border-radius: 5px 5px 0 0;
|
||||
-moz-border-radius: 5px 5px 0 0;
|
||||
-webkit-border-top-right-radius: 5px;
|
||||
-webkit-border-top-left-radius: 5px;
|
||||
}
|
||||
|
||||
#qunit-header a {
|
||||
text-decoration: none;
|
||||
color: #c2ccd1;
|
||||
}
|
||||
|
||||
#qunit-header a:hover,
|
||||
#qunit-header a:focus {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
#qunit-testrunner-toolbar label {
|
||||
display: inline-block;
|
||||
padding: 0 .5em 0 .1em;
|
||||
}
|
||||
|
||||
#qunit-banner {
|
||||
height: 5px;
|
||||
}
|
||||
|
||||
#qunit-testrunner-toolbar {
|
||||
padding: 0.5em 0 0.5em 2em;
|
||||
color: #5E740B;
|
||||
background-color: #eee;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#qunit-userAgent {
|
||||
padding: 0.5em 0 0.5em 2.5em;
|
||||
background-color: #2b81af;
|
||||
color: #fff;
|
||||
text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px;
|
||||
}
|
||||
|
||||
#qunit-modulefilter-container {
|
||||
float: right;
|
||||
}
|
||||
|
||||
/** Tests: Pass/Fail */
|
||||
|
||||
#qunit-tests {
|
||||
list-style-position: inside;
|
||||
}
|
||||
|
||||
#qunit-tests li {
|
||||
padding: 0.4em 0.5em 0.4em 2.5em;
|
||||
border-bottom: 1px solid #fff;
|
||||
list-style-position: inside;
|
||||
}
|
||||
|
||||
#qunit-tests.hidepass li.pass, #qunit-tests.hidepass li.running {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#qunit-tests li strong {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#qunit-tests li a {
|
||||
padding: 0.5em;
|
||||
color: #c2ccd1;
|
||||
text-decoration: none;
|
||||
}
|
||||
#qunit-tests li a:hover,
|
||||
#qunit-tests li a:focus {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
#qunit-tests li .runtime {
|
||||
float: right;
|
||||
font-size: smaller;
|
||||
}
|
||||
|
||||
.qunit-assert-list {
|
||||
margin-top: 0.5em;
|
||||
padding: 0.5em;
|
||||
|
||||
background-color: #fff;
|
||||
|
||||
border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
-webkit-border-radius: 5px;
|
||||
}
|
||||
|
||||
.qunit-collapsed {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#qunit-tests table {
|
||||
border-collapse: collapse;
|
||||
margin-top: .2em;
|
||||
}
|
||||
|
||||
#qunit-tests th {
|
||||
text-align: right;
|
||||
vertical-align: top;
|
||||
padding: 0 .5em 0 0;
|
||||
}
|
||||
|
||||
#qunit-tests td {
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
#qunit-tests pre {
|
||||
margin: 0;
|
||||
white-space: pre-wrap;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
#qunit-tests del {
|
||||
background-color: #e0f2be;
|
||||
color: #374e0c;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#qunit-tests ins {
|
||||
background-color: #ffcaca;
|
||||
color: #500;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
/*** Test Counts */
|
||||
|
||||
#qunit-tests b.counts { color: black; }
|
||||
#qunit-tests b.passed { color: #5E740B; }
|
||||
#qunit-tests b.failed { color: #710909; }
|
||||
|
||||
#qunit-tests li li {
|
||||
padding: 5px;
|
||||
background-color: #fff;
|
||||
border-bottom: none;
|
||||
list-style-position: inside;
|
||||
}
|
||||
|
||||
/*** Passing Styles */
|
||||
|
||||
#qunit-tests li li.pass {
|
||||
color: #3c510c;
|
||||
background-color: #fff;
|
||||
border-left: 10px solid #C6E746;
|
||||
}
|
||||
|
||||
#qunit-tests .pass { color: #528CE0; background-color: #D2E0E6; }
|
||||
#qunit-tests .pass .test-name { color: #366097; }
|
||||
|
||||
#qunit-tests .pass .test-actual,
|
||||
#qunit-tests .pass .test-expected { color: #999999; }
|
||||
|
||||
#qunit-banner.qunit-pass { background-color: #C6E746; }
|
||||
|
||||
/*** Failing Styles */
|
||||
|
||||
#qunit-tests li li.fail {
|
||||
color: #710909;
|
||||
background-color: #fff;
|
||||
border-left: 10px solid #EE5757;
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
#qunit-tests > li:last-child {
|
||||
border-radius: 0 0 5px 5px;
|
||||
-moz-border-radius: 0 0 5px 5px;
|
||||
-webkit-border-bottom-right-radius: 5px;
|
||||
-webkit-border-bottom-left-radius: 5px;
|
||||
}
|
||||
|
||||
#qunit-tests .fail { color: #000000; background-color: #EE5757; }
|
||||
#qunit-tests .fail .test-name,
|
||||
#qunit-tests .fail .module-name { color: #000000; }
|
||||
|
||||
#qunit-tests .fail .test-actual { color: #EE5757; }
|
||||
#qunit-tests .fail .test-expected { color: green; }
|
||||
|
||||
#qunit-banner.qunit-fail { background-color: #EE5757; }
|
||||
|
||||
|
||||
/** Result */
|
||||
|
||||
#qunit-testresult {
|
||||
padding: 0.5em 0.5em 0.5em 2.5em;
|
||||
|
||||
color: #2b81af;
|
||||
background-color: #D2E0E6;
|
||||
|
||||
border-bottom: 1px solid white;
|
||||
}
|
||||
#qunit-testresult .module-name {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/** Fixture */
|
||||
|
||||
#qunit-fixture {
|
||||
position: absolute;
|
||||
top: -10000px;
|
||||
left: -10000px;
|
||||
width: 1000px;
|
||||
height: 1000px;
|
||||
}
|
||||
2152
vendor/qunit/qunit/qunit.js
vendored
2152
vendor/qunit/qunit/qunit.js
vendored
File diff suppressed because it is too large
Load Diff
58
vendor/requirejs/LICENSE
vendored
58
vendor/requirejs/LICENSE
vendored
@@ -1,58 +0,0 @@
|
||||
RequireJS is released under two licenses: new BSD, and MIT. You may pick the
|
||||
license that best suits your development needs. The text of both licenses are
|
||||
provided below.
|
||||
|
||||
|
||||
The "New" BSD License:
|
||||
----------------------
|
||||
|
||||
Copyright (c) 2010-2011, The Dojo Foundation
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the Dojo Foundation nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
|
||||
MIT License
|
||||
-----------
|
||||
|
||||
Copyright (c) 2010-2011, The Dojo Foundation
|
||||
|
||||
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.
|
||||
2053
vendor/requirejs/require.js
vendored
2053
vendor/requirejs/require.js
vendored
File diff suppressed because it is too large
Load Diff
2
vendor/underscore/LICENSE
vendored
2
vendor/underscore/LICENSE
vendored
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative
|
||||
Copyright (c) 2009-2014 Jeremy Ashkenas, DocumentCloud and Investigative
|
||||
Reporters & Editors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
|
||||
313
vendor/underscore/test/arrays.js
vendored
313
vendor/underscore/test/arrays.js
vendored
@@ -1,174 +1,233 @@
|
||||
$(document).ready(function() {
|
||||
(function() {
|
||||
|
||||
module("Arrays");
|
||||
module('Arrays');
|
||||
|
||||
test("first", function() {
|
||||
equal(_.first([1,2,3]), 1, 'can pull out the first element of an array');
|
||||
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()"');
|
||||
equal(_.first([1,2,3], 0).join(', '), "", 'can pass an index to first');
|
||||
equal(_.first([1,2,3], 2).join(', '), '1, 2', 'can pass an index to first');
|
||||
equal(_.first([1,2,3], 5).join(', '), '1, 2, 3', 'can pass an index to first');
|
||||
var result = (function(){ return _.first(arguments); })(4, 3, 2, 1);
|
||||
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');
|
||||
var result = (function(){ return _.first(arguments); }(4, 3, 2, 1));
|
||||
equal(result, 4, 'works on an arguments object.');
|
||||
result = _.map([[1,2,3],[1,2,3]], _.first);
|
||||
equal(result.join(','), '1,1', 'works well with _.map');
|
||||
result = (function() { return _.take([1,2,3], 2); })();
|
||||
equal(result.join(','), '1,2', 'aliased as take');
|
||||
result = _.map([[1, 2, 3], [1, 2, 3]], _.first);
|
||||
deepEqual(result, [1, 1], 'works well with _.map');
|
||||
result = (function() { return _.first([1, 2, 3], 2); }());
|
||||
deepEqual(result, [1, 2]);
|
||||
|
||||
equal(_.first(null), undefined, 'handles nulls');
|
||||
strictEqual(_.first([1, 2, 3], -1).length, 0);
|
||||
});
|
||||
|
||||
test("rest", function() {
|
||||
test('head', function() {
|
||||
strictEqual(_.first, _.head, 'alias for first');
|
||||
});
|
||||
|
||||
test('take', function() {
|
||||
strictEqual(_.first, _.take, 'alias for first');
|
||||
});
|
||||
|
||||
test('rest', function() {
|
||||
var numbers = [1, 2, 3, 4];
|
||||
equal(_.rest(numbers).join(", "), "2, 3, 4", 'working rest()');
|
||||
equal(_.rest(numbers, 0).join(", "), "1, 2, 3, 4", 'working rest(0)');
|
||||
equal(_.rest(numbers, 2).join(', '), '3, 4', 'rest can take an index');
|
||||
var result = (function(){ return _(arguments).tail(); })(1, 2, 3, 4);
|
||||
equal(result.join(', '), '2, 3, 4', 'aliased as tail and works on arguments object');
|
||||
result = _.map([[1,2,3],[1,2,3]], _.rest);
|
||||
equal(_.flatten(result).join(','), '2,3,2,3', 'works well with _.map');
|
||||
result = (function(){ return _(arguments).drop(); })(1, 2, 3, 4);
|
||||
equal(result.join(', '), '2, 3, 4', 'aliased as drop and works on arguments object');
|
||||
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');
|
||||
var result = (function(){ return _(arguments).rest(); }(1, 2, 3, 4));
|
||||
deepEqual(result, [2, 3, 4], 'works on 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');
|
||||
});
|
||||
|
||||
test("initial", function() {
|
||||
equal(_.initial([1,2,3,4,5]).join(", "), "1, 2, 3, 4", 'working initial()');
|
||||
equal(_.initial([1,2,3,4],2).join(", "), "1, 2", 'initial can take an index');
|
||||
var result = (function(){ return _(arguments).initial(); })(1, 2, 3, 4);
|
||||
equal(result.join(", "), "1, 2, 3", 'initial works on arguments object');
|
||||
result = _.map([[1,2,3],[1,2,3]], _.initial);
|
||||
equal(_.flatten(result).join(','), '1,2,1,2', 'initial works with _.map');
|
||||
test('tail', function() {
|
||||
strictEqual(_.rest, _.tail, 'alias for rest');
|
||||
});
|
||||
|
||||
test("last", function() {
|
||||
equal(_.last([1,2,3]), 3, 'can pull out the last element of an array');
|
||||
equal(_.last([1,2,3], 0).join(', '), "", 'can pass an index to last');
|
||||
equal(_.last([1,2,3], 2).join(', '), '2, 3', 'can pass an index to last');
|
||||
equal(_.last([1,2,3], 5).join(', '), '1, 2, 3', 'can pass an index to last');
|
||||
var result = (function(){ return _(arguments).last(); })(1, 2, 3, 4);
|
||||
test('drop', function() {
|
||||
strictEqual(_.rest, _.drop, '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');
|
||||
var result = (function(){ return _(arguments).initial(); }(1, 2, 3, 4));
|
||||
deepEqual(result, [1, 2, 3], 'initial works on arguments object');
|
||||
result = _.map([[1, 2, 3], [1, 2, 3]], _.initial);
|
||||
deepEqual(_.flatten(result), [1, 2, 1, 2], 'initial works 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');
|
||||
var result = (function(){ return _(arguments).last(); }(1, 2, 3, 4));
|
||||
equal(result, 4, 'works on an arguments object');
|
||||
result = _.map([[1,2,3],[1,2,3]], _.last);
|
||||
equal(result.join(','), '3,3', 'works well with _.map');
|
||||
result = _.map([[1, 2, 3], [1, 2, 3]], _.last);
|
||||
deepEqual(result, [3, 3], 'works well with _.map');
|
||||
|
||||
equal(_.last(null), undefined, 'handles nulls');
|
||||
strictEqual(_.last([1, 2, 3], -1).length, 0);
|
||||
});
|
||||
|
||||
test("compact", function() {
|
||||
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);
|
||||
var result = (function(){ return _.compact(arguments).length; }(0, 1, false, 2, false, 3));
|
||||
equal(result, 3, 'works on an arguments object');
|
||||
});
|
||||
|
||||
test("flatten", function() {
|
||||
test('flatten', function() {
|
||||
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');
|
||||
var result = (function(){ return _.flatten(arguments); })(1, [2], [3, [[[4]]]]);
|
||||
deepEqual(result, [1,2,3,4], 'works on an arguments object');
|
||||
deepEqual(_.flatten(list), [1, 2, 3, 4], 'can flatten nested arrays');
|
||||
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');
|
||||
list = [[1], [2], [3], [[4]]];
|
||||
deepEqual(_.flatten(list, true), [1, 2, 3, [4]], 'can shallowly flatten arrays containing only other arrays');
|
||||
});
|
||||
|
||||
test("without", function() {
|
||||
test('without', function() {
|
||||
var list = [1, 2, 1, 0, 3, 1, 4];
|
||||
equal(_.without(list, 0, 1).join(', '), '2, 3, 4', 'can remove all instances of an object');
|
||||
var result = (function(){ return _.without(arguments, 0, 1); })(1, 2, 1, 0, 3, 1, 4);
|
||||
equal(result.join(', '), '2, 3, 4', 'works on an arguments object');
|
||||
deepEqual(_.without(list, 0, 1), [2, 3, 4], 'can remove all instances of an object');
|
||||
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');
|
||||
|
||||
list = [{one : 1}, {two : 2}];
|
||||
ok(_.without(list, {one : 1}).length == 2, 'uses real object identity for comparisons.');
|
||||
ok(_.without(list, list[0]).length == 1, 'ditto.');
|
||||
equal(_.without(list, {one : 1}).length, 2, 'uses real object identity for comparisons.');
|
||||
equal(_.without(list, list[0]).length, 1, 'ditto.');
|
||||
});
|
||||
|
||||
test("uniq", function() {
|
||||
test('uniq', function() {
|
||||
var list = [1, 2, 1, 3, 1, 4];
|
||||
equal(_.uniq(list).join(', '), '1, 2, 3, 4', 'can find the unique values of an unsorted array');
|
||||
deepEqual(_.uniq(list), [1, 2, 3, 4], 'can find the unique values of an unsorted array');
|
||||
|
||||
list = [1, 1, 1, 2, 2, 3];
|
||||
equal(_.uniq(list, true).join(', '), '1, 2, 3', 'can find the unique values of a sorted array faster');
|
||||
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'}];
|
||||
list = [{name: 'moe'}, {name: 'curly'}, {name: 'larry'}, {name: 'curly'}];
|
||||
var iterator = function(value) { return value.name; };
|
||||
equal(_.map(_.uniq(list, false, iterator), iterator).join(', '), 'moe, curly, larry', 'can find the unique values of an array using a custom iterator');
|
||||
deepEqual(_.map(_.uniq(list, false, iterator), iterator), ['moe', 'curly', 'larry'], 'can find the unique values of an array using a custom iterator');
|
||||
|
||||
equal(_.map(_.uniq(list, iterator), iterator).join(', '), 'moe, curly, larry', 'can find the unique values of an array using a custom iterator without specifying whether array is sorted');
|
||||
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; };
|
||||
iterator = function(value) { return value + 1; };
|
||||
list = [1, 2, 2, 3, 4, 4];
|
||||
equal(_.uniq(list, true, iterator).join(', '), '1, 2, 3, 4', 'iterator works with sorted array');
|
||||
deepEqual(_.uniq(list, true, iterator), [1, 2, 3, 4], 'iterator works with sorted array');
|
||||
|
||||
var result = (function(){ return _.uniq(arguments); })(1, 2, 1, 3, 1, 4);
|
||||
equal(result.join(', '), '1, 2, 3, 4', 'works on an arguments object');
|
||||
var result = (function(){ return _.uniq(arguments); }(1, 2, 1, 3, 1, 4));
|
||||
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');
|
||||
|
||||
deepEqual(_.uniq(null), []);
|
||||
|
||||
var context = {};
|
||||
list = [3];
|
||||
_.uniq(list, function(value, index, array) {
|
||||
strictEqual(this, context);
|
||||
strictEqual(value, 3);
|
||||
strictEqual(index, 0);
|
||||
strictEqual(array, list);
|
||||
}, 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("intersection", function() {
|
||||
test('unique', function() {
|
||||
strictEqual(_.uniq, _.unique, 'alias for uniq');
|
||||
});
|
||||
|
||||
test('intersection', function() {
|
||||
var stooges = ['moe', 'curly', 'larry'], leaders = ['moe', 'groucho'];
|
||||
equal(_.intersection(stooges, leaders).join(''), 'moe', 'can take the set intersection of two arrays');
|
||||
equal(_(stooges).intersection(leaders).join(''), 'moe', 'can perform an OO-style intersection');
|
||||
var result = (function(){ return _.intersection(arguments, leaders); })('moe', 'curly', 'larry');
|
||||
equal(result.join(''), 'moe', 'works on an arguments object');
|
||||
deepEqual(_.intersection(stooges, leaders), ['moe'], 'can take the set intersection of two arrays');
|
||||
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');
|
||||
var theSixStooges = ['moe', 'moe', 'curly', 'curly', 'larry', 'larry'];
|
||||
equal(_.intersection(theSixStooges, leaders).join(''), 'moe', 'returns a duplicate-free array');
|
||||
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');
|
||||
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');
|
||||
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');
|
||||
});
|
||||
|
||||
test("union", function() {
|
||||
test('union', function() {
|
||||
var result = _.union([1, 2, 3], [2, 30, 1], [1, 40]);
|
||||
equal(result.join(' '), '1 2 3 30 40', 'takes the union of a list of arrays');
|
||||
deepEqual(result, [1, 2, 3, 30, 40], 'takes the union of a list of arrays');
|
||||
|
||||
result = _.union([1, 2, 3], [2, 30, 1], [1, 40, [1]]);
|
||||
equal(result.join(' '), '1 2 3 30 40 1', 'takes the union of a list of nested arrays');
|
||||
deepEqual(result, [1, 2, 3, 30, 40, [1]], 'takes the union of a list of nested arrays');
|
||||
|
||||
var args = null;
|
||||
(function(){ args = arguments; })(1, 2, 3);
|
||||
(function(){ args = arguments; }(1, 2, 3));
|
||||
result = _.union(args, [2, 30, 1], [1, 40]);
|
||||
equal(result.join(' '), '1 2 3 30 40', 'takes the union of a list of arrays');
|
||||
deepEqual(result, [1, 2, 3, 30, 40], 'takes the union of a list of arrays');
|
||||
|
||||
result = _.union([1, 2, 3], 4);
|
||||
deepEqual(result, [1, 2, 3], 'restrict the union to arrays only');
|
||||
});
|
||||
|
||||
test("difference", function() {
|
||||
test('difference', function() {
|
||||
var result = _.difference([1, 2, 3], [2, 30, 40]);
|
||||
equal(result.join(' '), '1 3', 'takes the difference of two arrays');
|
||||
deepEqual(result, [1, 3], 'takes the difference of two arrays');
|
||||
|
||||
result = _.difference([1, 2, 3, 4], [2, 30, 40], [1, 11, 111]);
|
||||
equal(result.join(' '), '3 4', 'takes the difference of three arrays');
|
||||
deepEqual(result, [3, 4], 'takes the difference of three arrays');
|
||||
|
||||
result = _.difference([1, 2, 3], 1);
|
||||
deepEqual(result, [1, 2, 3], 'restrict the difference to arrays only');
|
||||
});
|
||||
|
||||
test('zip', function() {
|
||||
var names = ['moe', 'larry', 'curly'], ages = [30, 40, 50], leaders = [true];
|
||||
var stooges = _.zip(names, ages, leaders);
|
||||
equal(String(stooges), 'moe,30,true,larry,40,,curly,50,', 'zipped together arrays of different lengths');
|
||||
deepEqual(_.zip(names, ages, leaders), [
|
||||
['moe', 30, true],
|
||||
['larry', 40, undefined],
|
||||
['curly', 50, undefined]
|
||||
], 'zipped together arrays of different lengths');
|
||||
|
||||
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');
|
||||
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');
|
||||
|
||||
// In the case of difference lengths of the tuples undefineds
|
||||
// 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');
|
||||
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');
|
||||
|
||||
var empty = _.zip([]);
|
||||
deepEqual(empty, [], 'unzipped empty');
|
||||
|
||||
deepEqual(_.zip(null), [], 'handles null');
|
||||
deepEqual(_.zip(), [], '_.zip() returns []');
|
||||
});
|
||||
|
||||
test('object', function() {
|
||||
var result = _.object(['moe', 'larry', 'curly'], [30, 40, 50]);
|
||||
var shouldBe = {moe: 30, larry: 40, curly: 50};
|
||||
ok(_.isEqual(result, shouldBe), 'two arrays zipped together into an object');
|
||||
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};
|
||||
ok(_.isEqual(result, shouldBe), 'an array of pairs zipped together into an object');
|
||||
deepEqual(result, shouldBe, 'an array of pairs zipped together into an object');
|
||||
|
||||
var stooges = {moe: 30, larry: 40, curly: 50};
|
||||
ok(_.isEqual(_.object(_.pairs(stooges)), stooges), 'an object converted to pairs and back to an object');
|
||||
deepEqual(_.object(_.pairs(stooges)), stooges, 'an object converted to pairs and back to an object');
|
||||
|
||||
ok(_.isEqual(_.object(null), {}), 'handles nulls');
|
||||
deepEqual(_.object(null), {}, 'handles nulls');
|
||||
});
|
||||
|
||||
test("indexOf", function() {
|
||||
test('indexOf', function() {
|
||||
var numbers = [1, 2, 3];
|
||||
numbers.indexOf = null;
|
||||
equal(_.indexOf(numbers, 2), 1, 'can compute indexOf, even without the native function');
|
||||
var result = (function(){ return _.indexOf(arguments, 2); })(1, 2, 3);
|
||||
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');
|
||||
equal(_.indexOf(null, 2), -1, 'handles nulls properly');
|
||||
|
||||
@@ -182,40 +241,90 @@ $(document).ready(function() {
|
||||
equal(index, 3, '40 is in the list');
|
||||
|
||||
numbers = [1, 40, 40, 40, 40, 40, 40, 40, 50, 60, 70]; num = 40;
|
||||
index = _.indexOf(numbers, num, true);
|
||||
equal(index, 1, '40 is in the list');
|
||||
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() {
|
||||
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');
|
||||
|
||||
index = _.indexOf([,,,], undefined);
|
||||
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);
|
||||
_.each([-6, -8, -Infinity], function(fromIndex) {
|
||||
strictEqual(_.indexOf(array, 1, fromIndex), 0);
|
||||
});
|
||||
strictEqual(_.indexOf([1, 2, 3], 1, true), 0);
|
||||
});
|
||||
|
||||
test("lastIndexOf", function() {
|
||||
test('lastIndexOf', function() {
|
||||
var numbers = [1, 0, 1];
|
||||
var falsey = [void 0, '', 0, false, NaN, null, undefined];
|
||||
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');
|
||||
var result = (function(){ return _.lastIndexOf(arguments, 1); })(1, 0, 1, 0, 0, 1, 0, 0, 0);
|
||||
var result = (function(){ return _.lastIndexOf(arguments, 1); }(1, 0, 1, 0, 0, 1, 0, 0, 0));
|
||||
equal(result, 5, 'works on an arguments object');
|
||||
equal(_.lastIndexOf(null, 2), -1, 'handles nulls properly');
|
||||
|
||||
numbers = [1, 2, 3, 1, 2, 3, 1, 2, 3];
|
||||
var index = _.lastIndexOf(numbers, 2, 2);
|
||||
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');
|
||||
|
||||
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);
|
||||
});
|
||||
|
||||
var expected = _.map(falsey, function(value) {
|
||||
return typeof value == 'number' ? -1 : 5;
|
||||
});
|
||||
|
||||
var actual = _.map(falsey, function(fromIndex) {
|
||||
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`');
|
||||
|
||||
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');
|
||||
|
||||
deepEqual(_.map([-6, -8, -Infinity], function(fromIndex) {
|
||||
return _.lastIndexOf(array, 1, fromIndex);
|
||||
}), [0, -1, -1]);
|
||||
});
|
||||
|
||||
test("range", function() {
|
||||
equal(_.range(0).join(''), '', 'range with 0 as a first argument generates an empty array');
|
||||
equal(_.range(4).join(' '), '0 1 2 3', 'range with a single positive argument generates an array of elements 0,1,2,...,n-1');
|
||||
equal(_.range(5, 8).join(' '), '5 6 7', 'range with two arguments a & b, a<b generates an array of elements a,a+1,a+2,...,b-2,b-1');
|
||||
equal(_.range(8, 5).join(''), '', 'range with two arguments a & b, b<a generates an empty array');
|
||||
equal(_.range(3, 10, 3).join(' '), '3 6 9', 'range with three arguments a & b & c, c < b-a, a < b generates an array of elements a,a+c,a+2c,...,b - (multiplier of a) < c');
|
||||
equal(_.range(3, 10, 15).join(''), '3', 'range with three arguments a & b & c, c > b-a, a < b generates an array with a single element, equal to a');
|
||||
equal(_.range(12, 7, -2).join(' '), '12 10 8', 'range with three arguments a & b & c, a > b, c < 0 generates an array of elements a,a-c,a-2c and ends with the number not less than b');
|
||||
equal(_.range(0, -10, -1).join(' '), '0 -1 -2 -3 -4 -5 -6 -7 -8 -9', 'final example in the Python docs');
|
||||
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 & b, a<b generates an array of elements a,a+1,a+2,...,b-2,b-1');
|
||||
deepEqual(_.range(8, 5), [], 'range with two arguments a & b, b<a generates an empty array');
|
||||
deepEqual(_.range(3, 10, 3), [3, 6, 9], 'range with three arguments a & b & c, c < b-a, a < b generates an array of elements a,a+c,a+2c,...,b - (multiplier of a) < c');
|
||||
deepEqual(_.range(3, 10, 15), [3], 'range with three arguments a & b & c, c > b-a, a < b generates an array with a single element, equal to a');
|
||||
deepEqual(_.range(12, 7, -2), [12, 10, 8], 'range with three arguments a & b & c, a > b, c < 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');
|
||||
});
|
||||
|
||||
});
|
||||
}());
|
||||
|
||||
39
vendor/underscore/test/chaining.js
vendored
39
vendor/underscore/test/chaining.js
vendored
@@ -1,13 +1,13 @@
|
||||
$(document).ready(function() {
|
||||
(function() {
|
||||
|
||||
module("Chaining");
|
||||
module('Chaining');
|
||||
|
||||
test("map/flatten/reduce", function() {
|
||||
test('map/flatten/reduce', function() {
|
||||
var lyrics = [
|
||||
"I'm a lumberjack and I'm okay",
|
||||
"I sleep all night and I work all day",
|
||||
"He's a lumberjack and he's okay",
|
||||
"He sleeps all night and he works all day"
|
||||
'I\'m a lumberjack and I\'m okay',
|
||||
'I sleep all night and I work all day',
|
||||
'He\'s a lumberjack and he\'s okay',
|
||||
'He sleeps all night and he works all day'
|
||||
];
|
||||
var counts = _(lyrics).chain()
|
||||
.map(function(line) { return line.split(''); })
|
||||
@@ -17,11 +17,12 @@ $(document).ready(function() {
|
||||
hash[l]++;
|
||||
return hash;
|
||||
}, {}).value();
|
||||
ok(counts.a == 16 && counts.e == 10, 'counted all the letters in the song');
|
||||
equal(counts.a, 16, 'counted all the letters in the song');
|
||||
equal(counts.e, 10, 'counted all the letters in the song');
|
||||
});
|
||||
|
||||
test("select/reject/sortBy", function() {
|
||||
var numbers = [1,2,3,4,5,6,7,8,9,10];
|
||||
test('select/reject/sortBy', function() {
|
||||
var numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
||||
numbers = _(numbers).chain().select(function(n) {
|
||||
return n % 2 === 0;
|
||||
}).reject(function(n) {
|
||||
@@ -29,11 +30,11 @@ $(document).ready(function() {
|
||||
}).sortBy(function(n) {
|
||||
return -n;
|
||||
}).value();
|
||||
equal(numbers.join(', '), "10, 6, 2", "filtered and reversed the numbers");
|
||||
deepEqual(numbers, [10, 6, 2], 'filtered and reversed the numbers');
|
||||
});
|
||||
|
||||
test("select/reject/sortBy in functional style", function() {
|
||||
var numbers = [1,2,3,4,5,6,7,8,9,10];
|
||||
test('select/reject/sortBy in functional style', function() {
|
||||
var numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
||||
numbers = _.chain(numbers).select(function(n) {
|
||||
return n % 2 === 0;
|
||||
}).reject(function(n) {
|
||||
@@ -41,11 +42,11 @@ $(document).ready(function() {
|
||||
}).sortBy(function(n) {
|
||||
return -n;
|
||||
}).value();
|
||||
equal(numbers.join(', '), "10, 6, 2", "filtered and reversed the numbers");
|
||||
deepEqual(numbers, [10, 6, 2], 'filtered and reversed the numbers');
|
||||
});
|
||||
|
||||
test("reverse/concat/unshift/pop/map", function() {
|
||||
var numbers = [1,2,3,4,5];
|
||||
test('reverse/concat/unshift/pop/map', function() {
|
||||
var numbers = [1, 2, 3, 4, 5];
|
||||
numbers = _(numbers).chain()
|
||||
.reverse()
|
||||
.concat([5, 5, 5])
|
||||
@@ -53,13 +54,13 @@ $(document).ready(function() {
|
||||
.pop()
|
||||
.map(function(n){ return n * 2; })
|
||||
.value();
|
||||
equal(numbers.join(', '), "34, 10, 8, 6, 4, 2, 10, 10", 'can chain together array functions.');
|
||||
deepEqual(numbers, [34, 10, 8, 6, 4, 2, 10, 10], 'can chain together array functions.');
|
||||
});
|
||||
|
||||
test("chaining works in small stages", function() {
|
||||
test('chaining works in small stages', function() {
|
||||
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]);
|
||||
});
|
||||
|
||||
});
|
||||
}());
|
||||
|
||||
480
vendor/underscore/test/collections.js
vendored
480
vendor/underscore/test/collections.js
vendored
@@ -1,25 +1,25 @@
|
||||
$(document).ready(function() {
|
||||
(function() {
|
||||
|
||||
module("Collections");
|
||||
module('Collections');
|
||||
|
||||
test("each", function() {
|
||||
test('each', function() {
|
||||
_.each([1, 2, 3], function(num, i) {
|
||||
equal(num, i + 1, 'each iterators provide value and iteration count');
|
||||
});
|
||||
|
||||
var answers = [];
|
||||
_.each([1, 2, 3], function(num){ answers.push(num * this.multiplier);}, {multiplier : 5});
|
||||
equal(answers.join(', '), '5, 10, 15', 'context object property accessed');
|
||||
deepEqual(answers, [5, 10, 15], 'context object property accessed');
|
||||
|
||||
answers = [];
|
||||
_.forEach([1, 2, 3], function(num){ answers.push(num); });
|
||||
equal(answers.join(', '), '1, 2, 3', 'aliased as "forEach"');
|
||||
_.each([1, 2, 3], function(num){ answers.push(num); });
|
||||
deepEqual(answers, [1, 2, 3], 'aliased as "forEach"');
|
||||
|
||||
answers = [];
|
||||
var obj = {one : 1, two : 2, three : 3};
|
||||
obj.constructor.prototype.four = 4;
|
||||
_.each(obj, function(value, key){ answers.push(key); });
|
||||
equal(answers.join(", "), 'one, two, three', 'iterating over objects works, and ignores the object prototype.');
|
||||
deepEqual(answers, ['one', 'two', 'three'], 'iterating over objects works, and ignores the object prototype.');
|
||||
delete obj.constructor.prototype.four;
|
||||
|
||||
var answer = null;
|
||||
@@ -29,34 +29,65 @@ $(document).ready(function() {
|
||||
answers = 0;
|
||||
_.each(null, function(){ ++answers; });
|
||||
equal(answers, 0, 'handles a null properly');
|
||||
|
||||
_.each(false, function(){});
|
||||
|
||||
var a = [1, 2, 3];
|
||||
strictEqual(_.each(a, function(){}), a);
|
||||
strictEqual(_.each(null, function(){}), null);
|
||||
|
||||
var b = [1, 2, 3];
|
||||
b.length = 100;
|
||||
answers = 0;
|
||||
_.each(b, function(){ ++answers; });
|
||||
equal(answers, 100, 'enumerates [0, length)');
|
||||
});
|
||||
|
||||
test('forEach', function() {
|
||||
strictEqual(_.each, _.forEach, 'alias for each');
|
||||
});
|
||||
|
||||
test('lookupIterator with contexts', function() {
|
||||
_.each([true, false, 'yes', '', 0, 1, {}], function(context) {
|
||||
_.each([1], function() {
|
||||
equal(this, context);
|
||||
}, context);
|
||||
});
|
||||
});
|
||||
|
||||
test('map', function() {
|
||||
var doubled = _.map([1, 2, 3], function(num){ return num * 2; });
|
||||
equal(doubled.join(', '), '2, 4, 6', 'doubled numbers');
|
||||
|
||||
doubled = _.collect([1, 2, 3], function(num){ return num * 2; });
|
||||
equal(doubled.join(', '), '2, 4, 6', 'aliased as "collect"');
|
||||
deepEqual(doubled, [2, 4, 6], 'doubled numbers');
|
||||
|
||||
var tripled = _.map([1, 2, 3], function(num){ return num * this.multiplier; }, {multiplier : 3});
|
||||
equal(tripled.join(', '), '3, 6, 9', 'tripled numbers with context');
|
||||
deepEqual(tripled, [3, 6, 9], 'tripled numbers with context');
|
||||
|
||||
var doubled = _([1, 2, 3]).map(function(num){ return num * 2; });
|
||||
equal(doubled.join(', '), '2, 4, 6', 'OO-style doubled numbers');
|
||||
doubled = _([1, 2, 3]).map(function(num){ return num * 2; });
|
||||
deepEqual(doubled, [2, 4, 6], 'OO-style doubled numbers');
|
||||
|
||||
if (document.querySelectorAll) {
|
||||
var ids = _.map(document.querySelectorAll('#map-test *'), function(n){ return n.id; });
|
||||
deepEqual(ids, ['id1', 'id2'], 'Can use collection methods on NodeLists.');
|
||||
}
|
||||
|
||||
var ids = _.map($('#map-test').children(), function(n){ return n.id; });
|
||||
deepEqual(ids, ['id1', 'id2'], 'Can use collection methods on jQuery Array-likes.');
|
||||
ids = _.map({length: 2, 0: {id: '1'}, 1: {id: '2'}}, function(n){
|
||||
return n.id;
|
||||
});
|
||||
deepEqual(ids, ['1', '2'], 'Can use collection methods on Array-likes.');
|
||||
|
||||
var ids = _.map(document.images, function(n){ return n.id; });
|
||||
ok(ids[0] == 'chart_image', 'can use collection methods on HTMLCollections');
|
||||
deepEqual(_.map(null, _.noop), [], 'handles a null properly');
|
||||
|
||||
var ifnull = _.map(null, function(){});
|
||||
ok(_.isArray(ifnull) && ifnull.length === 0, 'handles a null properly');
|
||||
deepEqual(_.map([1], function() {
|
||||
return this.length;
|
||||
}, [5]), [1], 'called with context');
|
||||
|
||||
// Passing a property name like _.pluck.
|
||||
var people = [{name : 'moe', age : 30}, {name : 'curly', age : 50}];
|
||||
deepEqual(_.map(people, 'name'), ['moe', 'curly'], 'predicate string map to object properties');
|
||||
});
|
||||
|
||||
test('collect', function() {
|
||||
strictEqual(_.map, _.collect, 'alias for map');
|
||||
});
|
||||
|
||||
test('reduce', function() {
|
||||
@@ -73,50 +104,41 @@ $(document).ready(function() {
|
||||
sum = _([1, 2, 3]).reduce(function(sum, num){ return sum + num; }, 0);
|
||||
equal(sum, 6, 'OO-style reduce');
|
||||
|
||||
var sum = _.reduce([1, 2, 3], function(sum, num){ return sum + num; });
|
||||
sum = _.reduce([1, 2, 3], function(sum, num){ return sum + num; });
|
||||
equal(sum, 6, 'default initial value');
|
||||
|
||||
var prod = _.reduce([1, 2, 3, 4], function(prod, num){ return prod * num; });
|
||||
equal(prod, 24, 'can reduce via multiplication');
|
||||
|
||||
var ifnull;
|
||||
try {
|
||||
_.reduce(null, function(){});
|
||||
} catch (ex) {
|
||||
ifnull = ex;
|
||||
}
|
||||
ok(ifnull instanceof TypeError, 'handles a null (without initial value) properly');
|
||||
ok(_.reduce(null, _.noop, 138) === 138, 'handles a null (with initial value) properly');
|
||||
equal(_.reduce([], _.noop, undefined), undefined, 'undefined can be passed as a special case');
|
||||
equal(_.reduce([_], _.noop), _, 'collection of length one with no initial value returns the first item');
|
||||
|
||||
ok(_.reduce(null, function(){}, 138) === 138, 'handles a null (with initial value) properly');
|
||||
equal(_.reduce([], function(){}, undefined), undefined, 'undefined can be passed as a special case');
|
||||
raises(function() { _.reduce([], function(){}); }, TypeError, 'throws an error for empty arrays with no initial value');
|
||||
raises(function() { _.reduce([], _.noop); }, TypeError, 'throws an error for empty arrays with no initial value');
|
||||
raises(function() {_.reduce(null, _.noop);}, TypeError, 'handles a null (without initial value) properly');
|
||||
});
|
||||
|
||||
test('foldl', function() {
|
||||
strictEqual(_.reduce, _.foldl, 'alias for reduce');
|
||||
});
|
||||
|
||||
test('reduceRight', function() {
|
||||
var list = _.reduceRight(["foo", "bar", "baz"], function(memo, str){ return memo + str; }, '');
|
||||
var list = _.reduceRight(['foo', 'bar', 'baz'], function(memo, str){ return memo + str; }, '');
|
||||
equal(list, 'bazbarfoo', 'can perform right folds');
|
||||
|
||||
var list = _.foldr(["foo", "bar", "baz"], function(memo, str){ return memo + str; }, '');
|
||||
equal(list, 'bazbarfoo', 'aliased as "foldr"');
|
||||
|
||||
var list = _.foldr(["foo", "bar", "baz"], function(memo, str){ return memo + str; });
|
||||
list = _.reduceRight(['foo', 'bar', 'baz'], function(memo, str){ return memo + str; });
|
||||
equal(list, 'bazbarfoo', 'default initial value');
|
||||
|
||||
var ifnull;
|
||||
try {
|
||||
_.reduceRight(null, function(){});
|
||||
} catch (ex) {
|
||||
ifnull = ex;
|
||||
}
|
||||
ok(ifnull instanceof TypeError, 'handles a null (without initial value) properly');
|
||||
|
||||
var sum = _.reduceRight({a: 1, b: 2, c: 3}, function(sum, num){ return sum + num; });
|
||||
equal(sum, 6, 'default initial value on object');
|
||||
|
||||
ok(_.reduceRight(null, function(){}, 138) === 138, 'handles a null (with initial value) properly');
|
||||
ok(_.reduceRight(null, _.noop, 138) === 138, 'handles a null (with initial value) properly');
|
||||
equal(_.reduceRight([_], _.noop), _, 'collection of length one with no initial value returns the first item');
|
||||
|
||||
equal(_.reduceRight([], function(){}, undefined), undefined, 'undefined can be passed as a special case');
|
||||
raises(function() { _.reduceRight([], function(){}); }, TypeError, 'throws an error for empty arrays with no initial value');
|
||||
equal(_.reduceRight([], _.noop, undefined), undefined, 'undefined can be passed as a special case');
|
||||
|
||||
raises(function() { _.reduceRight([], _.noop); }, TypeError, 'throws an error for empty arrays with no initial value');
|
||||
raises(function() {_.reduceRight(null, _.noop);}, TypeError, 'handles a null (without initial value) properly');
|
||||
|
||||
// Assert that the correct arguments are being passed.
|
||||
|
||||
@@ -125,12 +147,12 @@ $(document).ready(function() {
|
||||
object = {a: 1, b: 2},
|
||||
lastKey = _.keys(object).pop();
|
||||
|
||||
var expected = lastKey == 'a'
|
||||
var expected = lastKey === 'a'
|
||||
? [memo, 1, 'a', object]
|
||||
: [memo, 2, 'b', object];
|
||||
|
||||
_.reduceRight(object, function() {
|
||||
args || (args = _.toArray(arguments));
|
||||
if (!args) args = _.toArray(arguments);
|
||||
}, memo);
|
||||
|
||||
deepEqual(args, expected);
|
||||
@@ -141,96 +163,169 @@ $(document).ready(function() {
|
||||
lastKey = _.keys(object).pop();
|
||||
args = null;
|
||||
|
||||
expected = lastKey == '2'
|
||||
expected = lastKey === '2'
|
||||
? [memo, 'a', '2', object]
|
||||
: [memo, 'b', '1', object];
|
||||
|
||||
_.reduceRight(object, function() {
|
||||
args || (args = _.toArray(arguments));
|
||||
if (!args) args = _.toArray(arguments);
|
||||
}, memo);
|
||||
|
||||
deepEqual(args, expected);
|
||||
});
|
||||
|
||||
test('foldr', function() {
|
||||
strictEqual(_.reduceRight, _.foldr, 'alias for reduceRight');
|
||||
});
|
||||
|
||||
test('find', function() {
|
||||
var array = [1, 2, 3, 4];
|
||||
strictEqual(_.find(array, function(n) { return n > 2; }), 3, 'should return first found `value`');
|
||||
strictEqual(_.find(array, function() { return false; }), void 0, 'should return `undefined` if `value` is not found');
|
||||
});
|
||||
|
||||
test('detect', function() {
|
||||
var result = _.detect([1, 2, 3], function(num){ return num * 2 == 4; });
|
||||
// Matching an object like _.findWhere.
|
||||
var list = [{a: 1, b: 2}, {a: 2, b: 2}, {a: 1, b: 3}, {a: 1, b: 4}, {a: 2, b: 4}];
|
||||
deepEqual(_.find(list, {a: 1}), {a: 1, b: 2}, 'can be used as findWhere');
|
||||
deepEqual(_.find(list, {b: 4}), {a: 1, b: 4});
|
||||
ok(!_.find(list, {c: 1}), 'undefined when not found');
|
||||
ok(!_.find([], {c: 1}), 'undefined when searching empty list');
|
||||
|
||||
var result = _.find([1, 2, 3], function(num){ return num * 2 === 4; });
|
||||
equal(result, 2, 'found the first "2" and broke the loop');
|
||||
});
|
||||
|
||||
test('select', function() {
|
||||
var evens = _.select([1, 2, 3, 4, 5, 6], function(num){ return num % 2 == 0; });
|
||||
equal(evens.join(', '), '2, 4, 6', 'selected each even number');
|
||||
test('detect', function() {
|
||||
strictEqual(_.detect, _.find, 'alias for detect');
|
||||
});
|
||||
|
||||
evens = _.filter([1, 2, 3, 4, 5, 6], function(num){ return num % 2 == 0; });
|
||||
equal(evens.join(', '), '2, 4, 6', 'aliased as "filter"');
|
||||
test('filter', function() {
|
||||
var evenArray = [1, 2, 3, 4, 5, 6];
|
||||
var evenObject = {one: 1, two: 2, three: 3};
|
||||
var isEven = function(num){ return num % 2 === 0; };
|
||||
|
||||
deepEqual(_.filter(evenArray, isEven), [2, 4, 6]);
|
||||
deepEqual(_.filter(evenObject, isEven), [2], 'can filter objects');
|
||||
deepEqual(_.filter([{}, evenObject, []], 'two'), [evenObject], 'predicate string map to object properties');
|
||||
|
||||
_.filter([1], function() {
|
||||
equal(this, evenObject, 'given context');
|
||||
}, evenObject);
|
||||
|
||||
// Can be used like _.where.
|
||||
var list = [{a: 1, b: 2}, {a: 2, b: 2}, {a: 1, b: 3}, {a: 1, b: 4}];
|
||||
deepEqual(_.filter(list, {a: 1}), [{a: 1, b: 2}, {a: 1, b: 3}, {a: 1, b: 4}]);
|
||||
deepEqual(_.filter(list, {b: 2}), [{a: 1, b: 2}, {a: 2, b: 2}]);
|
||||
deepEqual(_.filter(list, {}), list, 'Empty object accepts all items');
|
||||
deepEqual(_(list).filter({}), list, 'OO-filter');
|
||||
});
|
||||
|
||||
test('select', function() {
|
||||
strictEqual(_.filter, _.select, 'alias for filter');
|
||||
});
|
||||
|
||||
test('reject', function() {
|
||||
var odds = _.reject([1, 2, 3, 4, 5, 6], function(num){ return num % 2 == 0; });
|
||||
equal(odds.join(', '), '1, 3, 5', 'rejected each even number');
|
||||
var odds = _.reject([1, 2, 3, 4, 5, 6], function(num){ return num % 2 === 0; });
|
||||
deepEqual(odds, [1, 3, 5], 'rejected each even number');
|
||||
|
||||
var context = "obj";
|
||||
var context = 'obj';
|
||||
|
||||
var evens = _.reject([1, 2, 3, 4, 5, 6], function(num){
|
||||
equal(context, "obj");
|
||||
return num % 2 != 0;
|
||||
equal(context, 'obj');
|
||||
return num % 2 !== 0;
|
||||
}, context);
|
||||
equal(evens.join(', '), '2, 4, 6', 'rejected each odd number');
|
||||
deepEqual(evens, [2, 4, 6], 'rejected each odd number');
|
||||
|
||||
deepEqual(_.reject([odds, {one: 1, two: 2, three: 3}], 'two'), [odds], 'predicate string map to object properties');
|
||||
|
||||
// Can be used like _.where.
|
||||
var list = [{a: 1, b: 2}, {a: 2, b: 2}, {a: 1, b: 3}, {a: 1, b: 4}];
|
||||
deepEqual(_.reject(list, {a: 1}), [{a: 2, b: 2}]);
|
||||
deepEqual(_.reject(list, {b: 2}), [{a: 1, b: 3}, {a: 1, b: 4}]);
|
||||
deepEqual(_.reject(list, {}), [], 'Returns empty list given empty object');
|
||||
deepEqual(_.reject(list, []), [], 'Returns empty list given empty array');
|
||||
});
|
||||
|
||||
test('every', function() {
|
||||
ok(_.every([], _.identity), 'the empty set');
|
||||
ok(_.every([true, true, true], _.identity), 'every true values');
|
||||
ok(!_.every([true, false, true], _.identity), 'one false value');
|
||||
ok(_.every([0, 10, 28], function(num){ return num % 2 === 0; }), 'even numbers');
|
||||
ok(!_.every([0, 11, 28], function(num){ return num % 2 === 0; }), 'an odd number');
|
||||
ok(_.every([1], _.identity) === true, 'cast to boolean - true');
|
||||
ok(_.every([0], _.identity) === false, 'cast to boolean - false');
|
||||
ok(!_.every([undefined, undefined, undefined], _.identity), 'works with arrays of undefined');
|
||||
|
||||
var list = [{a: 1, b: 2}, {a: 2, b: 2}, {a: 1, b: 3}, {a: 1, b: 4}];
|
||||
ok(!_.every(list, {a: 1, b: 2}), 'Can be called with object');
|
||||
ok(_.every(list, 'a'), 'String mapped to object property');
|
||||
|
||||
list = [{a: 1, b: 2}, {a: 2, b: 2, c: true}];
|
||||
ok(_.every(list, {b: 2}), 'Can be called with object');
|
||||
ok(!_.every(list, 'c'), 'String mapped to object property');
|
||||
|
||||
ok(_.every({a: 1, b: 2, c: 3, d: 4}, _.isNumber), 'takes objects');
|
||||
ok(!_.every({a: 1, b: 2, c: 3, d: 4}, _.isObject), 'takes objects');
|
||||
ok(_.every(['a', 'b', 'c', 'd'], _.hasOwnProperty, {a: 1, b: 2, c: 3, d: 4}), 'context works');
|
||||
ok(!_.every(['a', 'b', 'c', 'd', 'f'], _.hasOwnProperty, {a: 1, b: 2, c: 3, d: 4}), 'context works');
|
||||
});
|
||||
|
||||
test('all', function() {
|
||||
ok(_.all([], _.identity), 'the empty set');
|
||||
ok(_.all([true, true, true], _.identity), 'all true values');
|
||||
ok(!_.all([true, false, true], _.identity), 'one false value');
|
||||
ok(_.all([0, 10, 28], function(num){ return num % 2 == 0; }), 'even numbers');
|
||||
ok(!_.all([0, 11, 28], function(num){ return num % 2 == 0; }), 'an odd number');
|
||||
ok(_.all([1], _.identity) === true, 'cast to boolean - true');
|
||||
ok(_.all([0], _.identity) === false, 'cast to boolean - false');
|
||||
ok(_.every([true, true, true], _.identity), 'aliased as "every"');
|
||||
ok(!_.all([undefined, undefined, undefined], _.identity), 'works with arrays of undefined');
|
||||
strictEqual(_.all, _.every, 'alias for all');
|
||||
});
|
||||
|
||||
test('some', function() {
|
||||
ok(!_.some([]), 'the empty set');
|
||||
ok(!_.some([false, false, false]), 'all false values');
|
||||
ok(_.some([false, false, true]), 'one true value');
|
||||
ok(_.some([null, 0, 'yes', false]), 'a string');
|
||||
ok(!_.some([null, 0, '', false]), 'falsy values');
|
||||
ok(!_.some([1, 11, 29], function(num){ return num % 2 === 0; }), 'all odd numbers');
|
||||
ok(_.some([1, 10, 29], function(num){ return num % 2 === 0; }), 'an even number');
|
||||
ok(_.some([1], _.identity) === true, 'cast to boolean - true');
|
||||
ok(_.some([0], _.identity) === false, 'cast to boolean - false');
|
||||
ok(_.some([false, false, true]));
|
||||
|
||||
var list = [{a: 1, b: 2}, {a: 2, b: 2}, {a: 1, b: 3}, {a: 1, b: 4}];
|
||||
ok(!_.some(list, {a: 5, b: 2}), 'Can be called with object');
|
||||
ok(_.some(list, 'a'), 'String mapped to object property');
|
||||
|
||||
list = [{a: 1, b: 2}, {a: 2, b: 2, c: true}];
|
||||
ok(_.some(list, {b: 2}), 'Can be called with object');
|
||||
ok(!_.some(list, 'd'), 'String mapped to object property');
|
||||
|
||||
ok(_.some({a: '1', b: '2', c: '3', d: '4', e: 6}, _.isNumber), 'takes objects');
|
||||
ok(!_.some({a: 1, b: 2, c: 3, d: 4}, _.isObject), 'takes objects');
|
||||
ok(_.some(['a', 'b', 'c', 'd'], _.hasOwnProperty, {a: 1, b: 2, c: 3, d: 4}), 'context works');
|
||||
ok(!_.some(['x', 'y', 'z'], _.hasOwnProperty, {a: 1, b: 2, c: 3, d: 4}), 'context works');
|
||||
});
|
||||
|
||||
test('any', function() {
|
||||
var nativeSome = Array.prototype.some;
|
||||
Array.prototype.some = null;
|
||||
ok(!_.any([]), 'the empty set');
|
||||
ok(!_.any([false, false, false]), 'all false values');
|
||||
ok(_.any([false, false, true]), 'one true value');
|
||||
ok(_.any([null, 0, 'yes', false]), 'a string');
|
||||
ok(!_.any([null, 0, '', false]), 'falsy values');
|
||||
ok(!_.any([1, 11, 29], function(num){ return num % 2 == 0; }), 'all odd numbers');
|
||||
ok(_.any([1, 10, 29], function(num){ return num % 2 == 0; }), 'an even number');
|
||||
ok(_.any([1], _.identity) === true, 'cast to boolean - true');
|
||||
ok(_.any([0], _.identity) === false, 'cast to boolean - false');
|
||||
ok(_.some([false, false, true]), 'aliased as "some"');
|
||||
Array.prototype.some = nativeSome;
|
||||
strictEqual(_.any, _.some, 'alias for any');
|
||||
});
|
||||
|
||||
test('contains', function() {
|
||||
ok(_.contains([1, 2, 3], 2), 'two is in the array');
|
||||
ok(!_.contains([1, 3, 9], 2), 'two is not in the array');
|
||||
ok(_.contains({moe: 1, larry: 3, curly: 9}, 3) === true, '_.contains on objects checks their values');
|
||||
ok(_([1, 2, 3]).contains(2), 'OO-style contains');
|
||||
});
|
||||
|
||||
test('include', function() {
|
||||
ok(_.include([1,2,3], 2), 'two is in the array');
|
||||
ok(!_.include([1,3,9], 2), 'two is not in the array');
|
||||
ok(_.contains({moe:1, larry:3, curly:9}, 3) === true, '_.include on objects checks their values');
|
||||
ok(_([1,2,3]).include(2), 'OO-style include');
|
||||
strictEqual(_.contains, _.include, 'alias for contains');
|
||||
});
|
||||
|
||||
test('invoke', function() {
|
||||
var list = [[5, 1, 7], [3, 2, 1]];
|
||||
var result = _.invoke(list, 'sort');
|
||||
equal(result[0].join(', '), '1, 5, 7', 'first array sorted');
|
||||
equal(result[1].join(', '), '1, 2, 3', 'second array sorted');
|
||||
deepEqual(result[0], [1, 5, 7], 'first array sorted');
|
||||
deepEqual(result[1], [1, 2, 3], 'second array sorted');
|
||||
});
|
||||
|
||||
test('invoke w/ function reference', function() {
|
||||
var list = [[5, 1, 7], [3, 2, 1]];
|
||||
var result = _.invoke(list, Array.prototype.sort);
|
||||
equal(result[0].join(', '), '1, 5, 7', 'first array sorted');
|
||||
equal(result[1].join(', '), '1, 2, 3', 'second array sorted');
|
||||
deepEqual(result[0], [1, 5, 7], 'first array sorted');
|
||||
deepEqual(result[1], [1, 2, 3], 'second array sorted');
|
||||
});
|
||||
|
||||
// Relevant when using ClojureScript
|
||||
@@ -239,18 +334,20 @@ $(document).ready(function() {
|
||||
return 42;
|
||||
};
|
||||
var list = [[5, 1, 7], [3, 2, 1]];
|
||||
var s = "foo";
|
||||
equal(s.call(), 42, "call function exists");
|
||||
var s = 'foo';
|
||||
equal(s.call(), 42, 'call function exists');
|
||||
var result = _.invoke(list, 'sort');
|
||||
equal(result[0].join(', '), '1, 5, 7', 'first array sorted');
|
||||
equal(result[1].join(', '), '1, 2, 3', 'second array sorted');
|
||||
deepEqual(result[0], [1, 5, 7], 'first array sorted');
|
||||
deepEqual(result[1], [1, 2, 3], 'second array sorted');
|
||||
delete String.prototype.call;
|
||||
equal(s.call, undefined, "call function removed");
|
||||
equal(s.call, undefined, 'call function removed');
|
||||
});
|
||||
|
||||
test('pluck', function() {
|
||||
var people = [{name : 'moe', age : 30}, {name : 'curly', age : 50}];
|
||||
equal(_.pluck(people, 'name').join(', '), 'moe, curly', 'pulls names out of objects');
|
||||
var people = [{name: 'moe', age: 30}, {name: 'curly', age: 50}];
|
||||
deepEqual(_.pluck(people, 'name'), ['moe', 'curly'], 'pulls names out of objects');
|
||||
//compat: most flexible handling of edge cases
|
||||
deepEqual(_.pluck([{'[object Object]': 1}], {}), [1]);
|
||||
});
|
||||
|
||||
test('where', function() {
|
||||
@@ -261,11 +358,12 @@ $(document).ready(function() {
|
||||
result = _.where(list, {b: 2});
|
||||
equal(result.length, 2);
|
||||
equal(result[0].a, 1);
|
||||
result = _.where(list, {});
|
||||
equal(result.length, list.length);
|
||||
|
||||
result = _.where(list, {a: 1}, true);
|
||||
equal(result.b, 2, "Only get the first object matched.")
|
||||
result = _.where(list, {a: 1}, false);
|
||||
equal(result.length, 3);
|
||||
function test() {}
|
||||
test.map = _.map;
|
||||
deepEqual(_.where([_, {a: 1, b: 2}, _], test), [_, _], 'checks properties given function');
|
||||
});
|
||||
|
||||
test('findWhere', function() {
|
||||
@@ -275,14 +373,29 @@ $(document).ready(function() {
|
||||
result = _.findWhere(list, {b: 4});
|
||||
deepEqual(result, {a: 1, b: 4});
|
||||
|
||||
result = _.findWhere(list, {c:1})
|
||||
ok(_.isUndefined(result), "undefined when not found");
|
||||
result = _.findWhere(list, {c: 1});
|
||||
ok(_.isUndefined(result), 'undefined when not found');
|
||||
|
||||
result = _.findWhere([], {c:1});
|
||||
ok(_.isUndefined(result), "undefined when searching empty list");
|
||||
result = _.findWhere([], {c: 1});
|
||||
ok(_.isUndefined(result), 'undefined when searching empty list');
|
||||
|
||||
function test() {}
|
||||
test.map = _.map;
|
||||
equal(_.findWhere([_, {a: 1, b: 2}, _], test), _, 'checks properties given function');
|
||||
|
||||
function TestClass() {
|
||||
this.y = 5;
|
||||
this.x = 'foo';
|
||||
}
|
||||
var expect = {c: 1, x: 'foo', y: 5};
|
||||
deepEqual(_.findWhere([{y: 5, b: 6}, expect], new TestClass()), expect, 'uses class instance properties');
|
||||
});
|
||||
|
||||
test('max', function() {
|
||||
equal(-Infinity, _.max(null), 'can handle null/undefined');
|
||||
equal(-Infinity, _.max(undefined), 'can handle null/undefined');
|
||||
equal(-Infinity, _.max(null, _.identity), 'can handle null/undefined');
|
||||
|
||||
equal(3, _.max([1, 2, 3]), 'can perform a regular Math.max');
|
||||
|
||||
var neg = _.max([1, 2, 3], function(num){ return -num; });
|
||||
@@ -292,10 +405,28 @@ $(document).ready(function() {
|
||||
equal(-Infinity, _.max([]), 'Maximum value of an empty array');
|
||||
equal(_.max({'a': 'a'}), -Infinity, 'Maximum value of a non-numeric collection');
|
||||
|
||||
equal(299999, _.max(_.range(1,300000)), "Maximum value of a too-big array");
|
||||
equal(299999, _.max(_.range(1, 300000)), 'Maximum value of a too-big array');
|
||||
|
||||
equal(3, _.max([1, 2, 3, 'test']), 'Finds correct max in array starting with num and containing a NaN');
|
||||
equal(3, _.max(['test', 1, 2, 3]), 'Finds correct max in array starting with NaN');
|
||||
|
||||
var a = {x: -Infinity};
|
||||
var b = {x: -Infinity};
|
||||
var iterator = function(o){ return o.x; };
|
||||
equal(_.max([a, b], iterator), a, 'Respects iterator return value of -Infinity');
|
||||
|
||||
deepEqual(_.max([{'a': 1}, {'a': 0, 'b': 3}, {'a': 4}, {'a': 2}], 'a'), {'a': 4}, 'String keys use property iterator');
|
||||
|
||||
deepEqual(_.max([0, 2], function(a){ return a * this.x; }, {x: 1}), 2, 'Iterator context');
|
||||
deepEqual(_.max([[1], [2, 3], [-1, 4], [5]], 0), [5], 'Lookup falsy iterator');
|
||||
deepEqual(_.max([{0: 1}, {0: 2}, {0: -1}, {a: 1}], 0), {0: 2}, 'Lookup falsy iterator');
|
||||
});
|
||||
|
||||
test('min', function() {
|
||||
equal(Infinity, _.min(null), 'can handle null/undefined');
|
||||
equal(Infinity, _.min(undefined), 'can handle null/undefined');
|
||||
equal(Infinity, _.min(null, _.identity), 'can handle null/undefined');
|
||||
|
||||
equal(1, _.min([1, 2, 3]), 'can perform a regular Math.min');
|
||||
|
||||
var neg = _.min([1, 2, 3], function(num){ return -num; });
|
||||
@@ -309,20 +440,34 @@ $(document).ready(function() {
|
||||
var then = new Date(0);
|
||||
equal(_.min([now, then]), then);
|
||||
|
||||
equal(1, _.min(_.range(1,300000)), "Minimum value of a too-big array");
|
||||
equal(1, _.min(_.range(1, 300000)), 'Minimum value of a too-big array');
|
||||
|
||||
equal(1, _.min([1, 2, 3, 'test']), 'Finds correct min in array starting with num and containing a NaN');
|
||||
equal(1, _.min(['test', 1, 2, 3]), 'Finds correct min in array starting with NaN');
|
||||
|
||||
var a = {x: Infinity};
|
||||
var b = {x: Infinity};
|
||||
var iterator = function(o){ return o.x; };
|
||||
equal(_.min([a, b], iterator), a, 'Respects iterator return value of Infinity');
|
||||
|
||||
deepEqual(_.min([{'a': 1}, {'a': 0, 'b': 3}, {'a': 4}, {'a': 2}], 'a'), {'a': 0, 'b': 3}, 'String keys use property iterator');
|
||||
|
||||
deepEqual(_.min([0, 2], function(a){ return a * this.x; }, {x: -1}), 2, 'Iterator context');
|
||||
deepEqual(_.min([[1], [2, 3], [-1, 4], [5]], 0), [-1, 4], 'Lookup falsy iterator');
|
||||
deepEqual(_.min([{0: 1}, {0: 2}, {0: -1}, {a: 1}], 0), {0: -1}, 'Lookup falsy iterator');
|
||||
});
|
||||
|
||||
test('sortBy', function() {
|
||||
var people = [{name : 'curly', age : 50}, {name : 'moe', age : 30}];
|
||||
people = _.sortBy(people, function(person){ return person.age; });
|
||||
equal(_.pluck(people, 'name').join(', '), 'moe, curly', 'stooges sorted by age');
|
||||
deepEqual(_.pluck(people, 'name'), ['moe', 'curly'], 'stooges sorted by age');
|
||||
|
||||
var list = [undefined, 4, 1, undefined, 3, 2];
|
||||
equal(_.sortBy(list, _.identity).join(','), '1,2,3,4,,', 'sortBy with undefined values');
|
||||
deepEqual(_.sortBy(list, _.identity), [1, 2, 3, 4, undefined, undefined], 'sortBy with undefined values');
|
||||
|
||||
var list = ["one", "two", "three", "four", "five"];
|
||||
list = ['one', 'two', 'three', 'four', 'five'];
|
||||
var sorted = _.sortBy(list, 'length');
|
||||
equal(sorted.join(' '), 'one two four five three', 'sorted by length');
|
||||
deepEqual(sorted, ['one', 'two', 'four', 'five', 'three'], 'sorted by length');
|
||||
|
||||
function Pair(x, y) {
|
||||
this.x = x;
|
||||
@@ -346,18 +491,23 @@ $(document).ready(function() {
|
||||
});
|
||||
|
||||
deepEqual(actual, collection, 'sortBy should be stable');
|
||||
|
||||
deepEqual(_.sortBy(collection, 'x'), collection, 'sortBy accepts property string');
|
||||
|
||||
list = ['q', 'w', 'e', 'r', 't', 'y'];
|
||||
deepEqual(_.sortBy(list), ['e', 'q', 'r', 't', 'w', 'y'], 'uses _.identity if iterator is not specified');
|
||||
});
|
||||
|
||||
test('groupBy', function() {
|
||||
var parity = _.groupBy([1, 2, 3, 4, 5, 6], function(num){ return num % 2; });
|
||||
ok('0' in parity && '1' in parity, 'created a group for each value');
|
||||
equal(parity[0].join(', '), '2, 4, 6', 'put each even number in the right group');
|
||||
deepEqual(parity[0], [2, 4, 6], 'put each even number in the right group');
|
||||
|
||||
var list = ["one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten"];
|
||||
var list = ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten'];
|
||||
var grouped = _.groupBy(list, 'length');
|
||||
equal(grouped['3'].join(' '), 'one two six ten');
|
||||
equal(grouped['4'].join(' '), 'four five nine');
|
||||
equal(grouped['5'].join(' '), 'three seven eight');
|
||||
deepEqual(grouped['3'], ['one', 'two', 'six', 'ten']);
|
||||
deepEqual(grouped['4'], ['four', 'five', 'nine']);
|
||||
deepEqual(grouped['5'], ['three', 'seven', 'eight']);
|
||||
|
||||
var context = {};
|
||||
_.groupBy([{}], function(){ ok(this === context); }, context);
|
||||
@@ -371,44 +521,44 @@ $(document).ready(function() {
|
||||
var array = [{}];
|
||||
_.groupBy(array, function(value, index, obj){ ok(obj === array); });
|
||||
|
||||
var array = [1, 2, 1, 2, 3];
|
||||
var grouped = _.groupBy(array);
|
||||
array = [1, 2, 1, 2, 3];
|
||||
grouped = _.groupBy(array);
|
||||
equal(grouped['1'].length, 2);
|
||||
equal(grouped['3'].length, 1);
|
||||
|
||||
var matrix = [
|
||||
[1,2],
|
||||
[1,3],
|
||||
[2,3]
|
||||
[1, 2],
|
||||
[1, 3],
|
||||
[2, 3]
|
||||
];
|
||||
deepEqual(_.groupBy(matrix, 0), {1: [[1,2], [1,3]], 2: [[2,3]]})
|
||||
deepEqual(_.groupBy(matrix, 1), {2: [[1,2]], 3: [[1,3], [2,3]]})
|
||||
deepEqual(_.groupBy(matrix, 0), {1: [[1, 2], [1, 3]], 2: [[2, 3]]});
|
||||
deepEqual(_.groupBy(matrix, 1), {2: [[1, 2]], 3: [[1, 3], [2, 3]]});
|
||||
});
|
||||
|
||||
test('indexBy', function() {
|
||||
var parity = _.indexBy([1, 2, 3, 4, 5], function(num){ return num % 2 == 0; });
|
||||
var parity = _.indexBy([1, 2, 3, 4, 5], function(num){ return num % 2 === 0; });
|
||||
equal(parity['true'], 4);
|
||||
equal(parity['false'], 5);
|
||||
|
||||
var list = ["one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten"];
|
||||
var list = ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten'];
|
||||
var grouped = _.indexBy(list, 'length');
|
||||
equal(grouped['3'], 'ten');
|
||||
equal(grouped['4'], 'nine');
|
||||
equal(grouped['5'], 'eight');
|
||||
|
||||
var array = [1, 2, 1, 2, 3];
|
||||
var grouped = _.indexBy(array);
|
||||
grouped = _.indexBy(array);
|
||||
equal(grouped['1'], 1);
|
||||
equal(grouped['2'], 2);
|
||||
equal(grouped['3'], 3);
|
||||
});
|
||||
|
||||
test('countBy', function() {
|
||||
var parity = _.countBy([1, 2, 3, 4, 5], function(num){ return num % 2 == 0; });
|
||||
var parity = _.countBy([1, 2, 3, 4, 5], function(num){ return num % 2 === 0; });
|
||||
equal(parity['true'], 2);
|
||||
equal(parity['false'], 3);
|
||||
|
||||
var list = ["one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten"];
|
||||
var list = ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten'];
|
||||
var grouped = _.countBy(list, 'length');
|
||||
equal(grouped['3'], 4);
|
||||
equal(grouped['4'], 3);
|
||||
@@ -426,8 +576,8 @@ $(document).ready(function() {
|
||||
var array = [{}];
|
||||
_.countBy(array, function(value, index, obj){ ok(obj === array); });
|
||||
|
||||
var array = [1, 2, 1, 2, 3];
|
||||
var grouped = _.countBy(array);
|
||||
array = [1, 2, 1, 2, 3];
|
||||
grouped = _.countBy(array);
|
||||
equal(grouped['1'], 2);
|
||||
equal(grouped['3'], 1);
|
||||
});
|
||||
@@ -452,33 +602,40 @@ $(document).ready(function() {
|
||||
|
||||
test('shuffle', function() {
|
||||
var numbers = _.range(10);
|
||||
var shuffled = _.shuffle(numbers).sort();
|
||||
var shuffled = _.shuffle(numbers);
|
||||
notStrictEqual(numbers, shuffled, 'original object is unmodified');
|
||||
equal(shuffled.join(','), numbers.join(','), 'contains the same members before and after shuffle');
|
||||
ok(_.every(_.range(10), function() { //appears consistent?
|
||||
return _.every(numbers, _.partial(_.contains, numbers));
|
||||
}), 'contains the same members before and after shuffle');
|
||||
|
||||
shuffled = _.shuffle({a: 1, b: 2, c: 3, d: 4});
|
||||
equal(shuffled.length, 4);
|
||||
deepEqual(shuffled.sort(), [1, 2, 3, 4], 'works on objects');
|
||||
});
|
||||
|
||||
test('sample', function() {
|
||||
var numbers = _.range(10);
|
||||
var all_sampled = _.sample(numbers, 10).sort();
|
||||
equal(all_sampled.join(','), numbers.join(','), 'contains the same members before and after sample');
|
||||
all_sampled = _.sample(numbers, 20).sort();
|
||||
equal(all_sampled.join(','), numbers.join(','), 'also works when sampling more objects than are present');
|
||||
var allSampled = _.sample(numbers, 10).sort();
|
||||
deepEqual(allSampled, numbers, 'contains the same members before and after sample');
|
||||
allSampled = _.sample(numbers, 20).sort();
|
||||
deepEqual(allSampled, numbers, 'also works when sampling more objects than are present');
|
||||
ok(_.contains(numbers, _.sample(numbers)), 'sampling a single element returns something from the array');
|
||||
strictEqual(_.sample([]), undefined, 'sampling empty array with no number returns undefined');
|
||||
notStrictEqual(_.sample([], 5), [], 'sampling empty array with a number returns an empty array');
|
||||
notStrictEqual(_.sample([1, 2, 3], 0), [], 'sampling an array with 0 picks returns an empty array');
|
||||
deepEqual(_.sample([1, 2], -1), [], 'sampling a negative number of picks returns an empty array');
|
||||
ok(_.contains([1, 2, 3], _.sample({a: 1, b: 2, c: 3})), 'sample one value from an object');
|
||||
});
|
||||
|
||||
test('toArray', function() {
|
||||
ok(!_.isArray(arguments), 'arguments object is not an array');
|
||||
ok(_.isArray(_.toArray(arguments)), 'arguments object converted into array');
|
||||
var a = [1,2,3];
|
||||
var a = [1, 2, 3];
|
||||
ok(_.toArray(a) !== a, 'array is cloned');
|
||||
equal(_.toArray(a).join(', '), '1, 2, 3', 'cloned array contains same elements');
|
||||
deepEqual(_.toArray(a), [1, 2, 3], 'cloned array contains same elements');
|
||||
|
||||
var numbers = _.toArray({one : 1, two : 2, three : 3});
|
||||
equal(numbers.join(', '), '1, 2, 3', 'object flattened into array');
|
||||
deepEqual(numbers, [1, 2, 3], 'object flattened into array');
|
||||
|
||||
// test in IE < 9
|
||||
try {
|
||||
@@ -491,7 +648,7 @@ $(document).ready(function() {
|
||||
test('size', function() {
|
||||
equal(_.size({one : 1, two : 2, three : 3}), 3, 'can compute the size of an object');
|
||||
equal(_.size([1, 2, 3]), 3, 'can compute the size of an array');
|
||||
equal(_.size($('<div>').add('<span>').add('<span>')), 3, 'can compute the size of jQuery objects');
|
||||
equal(_.size({length: 3, 0: 0, 1: 0, 2: 0}), 3, 'can compute the size of Array-likes');
|
||||
|
||||
var func = function() {
|
||||
return _.size(arguments);
|
||||
@@ -505,4 +662,35 @@ $(document).ready(function() {
|
||||
equal(_.size(null), 0, 'handles nulls');
|
||||
});
|
||||
|
||||
});
|
||||
test('partition', function() {
|
||||
var list = [0, 1, 2, 3, 4, 5];
|
||||
deepEqual(_.partition(list, function(x) { return x < 4; }), [[0, 1, 2, 3], [4, 5]], 'handles bool return values');
|
||||
deepEqual(_.partition(list, function(x) { return x & 1; }), [[1, 3, 5], [0, 2, 4]], 'handles 0 and 1 return values');
|
||||
deepEqual(_.partition(list, function(x) { return x - 3; }), [[0, 1, 2, 4, 5], [3]], 'handles other numeric return values');
|
||||
deepEqual(_.partition(list, function(x) { return x > 1 ? null : true; }), [[0, 1], [2, 3, 4, 5]], 'handles null return values');
|
||||
deepEqual(_.partition(list, function(x) { if (x < 2) return true; }), [[0, 1], [2, 3, 4, 5]], 'handles undefined return values');
|
||||
deepEqual(_.partition({a: 1, b: 2, c: 3}, function(x) { return x > 1; }), [[2, 3], [1]], 'handles objects');
|
||||
|
||||
deepEqual(_.partition(list, function(x, index) { return index % 2; }), [[1, 3, 5], [0, 2, 4]], 'can reference the array index');
|
||||
deepEqual(_.partition(list, function(x, index, arr) { return x === arr.length - 1; }), [[5], [0, 1, 2, 3, 4]], 'can reference the collection');
|
||||
|
||||
// Default iterator
|
||||
deepEqual(_.partition([1, false, true, '']), [[1, true], [false, '']], 'Default iterator');
|
||||
deepEqual(_.partition([{x: 1}, {x: 0}, {x: 1}], 'x'), [[{x: 1}, {x: 1}], [{x: 0}]], 'Takes a string');
|
||||
|
||||
// Context
|
||||
var predicate = function(x){ return x === this.x; };
|
||||
deepEqual(_.partition([1, 2, 3], predicate, {x: 2}), [[2], [1, 3]], 'partition takes a context argument');
|
||||
|
||||
deepEqual(_.partition([{a: 1}, {b: 2}, {a: 1, b: 2}], {a: 1}), [[{a: 1}, {a: 1, b: 2}], [{b: 2}]], 'predicate can be object');
|
||||
|
||||
var object = {a: 1};
|
||||
_.partition(object, function(val, key, obj) {
|
||||
equal(val, 1);
|
||||
equal(key, 'a');
|
||||
equal(obj, object);
|
||||
equal(this, predicate);
|
||||
}, predicate);
|
||||
});
|
||||
|
||||
}());
|
||||
|
||||
342
vendor/underscore/test/functions.js
vendored
342
vendor/underscore/test/functions.js
vendored
@@ -1,10 +1,10 @@
|
||||
$(document).ready(function() {
|
||||
(function() {
|
||||
|
||||
module("Functions");
|
||||
module('Functions');
|
||||
|
||||
test("bind", function() {
|
||||
test('bind', function() {
|
||||
var context = {name : 'moe'};
|
||||
var func = function(arg) { return "name: " + (this.name || arg); };
|
||||
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');
|
||||
|
||||
@@ -33,22 +33,35 @@ $(document).ready(function() {
|
||||
// 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 Boundf = _.bind(F, {hello: "moe curly"});
|
||||
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");
|
||||
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');
|
||||
|
||||
raises(function() { _.bind('notafunction'); }, TypeError, 'throws an error when binding to a non-function');
|
||||
});
|
||||
|
||||
test("partial", function() {
|
||||
test('partial', function() {
|
||||
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');
|
||||
|
||||
obj.func = _.partial(func, _, 'b', _, 'd');
|
||||
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');
|
||||
|
||||
func = _.partial(function() { return typeof arguments[2]; }, _, 'b', _, 'd');
|
||||
equal(func('a'), 'undefined', 'unfilled placeholders are undefined');
|
||||
});
|
||||
|
||||
test("bindAll", function() {
|
||||
test('bindAll', function() {
|
||||
var curly = {name : 'curly'}, moe = {
|
||||
name : 'moe',
|
||||
getName : function() { return 'name: ' + this.name; },
|
||||
@@ -64,17 +77,23 @@ $(document).ready(function() {
|
||||
moe = {
|
||||
name : 'moe',
|
||||
getName : function() { return 'name: ' + this.name; },
|
||||
sayHi : function() { return 'hi: ' + this.name; }
|
||||
sayHi : function() { return 'hi: ' + this.name; },
|
||||
sayLast : function() { return this.sayHi(_.last(arguments)); }
|
||||
};
|
||||
|
||||
raises(function() { _.bindAll(moe); }, Error, 'throws an error for bindAll with no functions named');
|
||||
raises(function() { _.bindAll(moe, 'sayBye'); }, TypeError, 'throws an error for bindAll if the given key is undefined');
|
||||
raises(function() { _.bindAll(moe, 'name'); }, TypeError, 'throws an error for bindAll if the given key is not a function');
|
||||
|
||||
_.bindAll(moe, 'sayHi');
|
||||
_.bindAll(moe, 'sayHi', 'sayLast');
|
||||
curly.sayHi = moe.sayHi;
|
||||
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');
|
||||
});
|
||||
|
||||
test("memoize", function() {
|
||||
test('memoize', function() {
|
||||
var fib = function(n) {
|
||||
return n < 2 ? n : fib(n - 1) + fib(n - 2);
|
||||
};
|
||||
@@ -88,75 +107,108 @@ $(document).ready(function() {
|
||||
var fastO = _.memoize(o);
|
||||
equal(o('toString'), 'toString', 'checks hasOwnProperty');
|
||||
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'});
|
||||
upper.cache = {foo: 'BAR', bar: 'FOO'};
|
||||
equal(upper('foo'), 'BAR');
|
||||
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');
|
||||
return key;
|
||||
}, function(key) {
|
||||
return key.toUpperCase();
|
||||
});
|
||||
hashed('yep');
|
||||
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) {
|
||||
return {key: key, value: value};
|
||||
}, function(value, key) {
|
||||
return key;
|
||||
});
|
||||
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');
|
||||
});
|
||||
|
||||
asyncTest("delay", 2, function() {
|
||||
asyncTest('delay', 2, function() {
|
||||
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);
|
||||
});
|
||||
|
||||
asyncTest("defer", 1, function() {
|
||||
asyncTest('defer', 1, function() {
|
||||
var deferred = false;
|
||||
_.defer(function(bool){ deferred = bool; }, true);
|
||||
_.delay(function(){ ok(deferred, "deferred the function"); start(); }, 50);
|
||||
_.delay(function(){ ok(deferred, 'deferred the function'); start(); }, 50);
|
||||
});
|
||||
|
||||
asyncTest("throttle", 2, function() {
|
||||
asyncTest('throttle', 2, function() {
|
||||
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);
|
||||
equal(counter, 1, 'incr was called immediately');
|
||||
_.delay(function(){ equal(counter, 2, 'incr was throttled'); start(); }, 64);
|
||||
});
|
||||
|
||||
asyncTest("throttle arguments", 2, function() {
|
||||
asyncTest('throttle arguments', 2, function() {
|
||||
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);
|
||||
equal(value, 1, 'updated to latest value');
|
||||
_.delay(function(){ equal(value, 3, 'updated to latest value'); start(); }, 96);
|
||||
});
|
||||
|
||||
asyncTest("throttle once", 2, function() {
|
||||
asyncTest('throttle once', 2, function() {
|
||||
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();
|
||||
equal(result, 1, 'throttled functions return their value');
|
||||
equal(counter, 1, 'incr was called once'); start();
|
||||
}, 64);
|
||||
});
|
||||
|
||||
asyncTest("throttle twice", 1, function() {
|
||||
asyncTest('throttle twice', 1, function() {
|
||||
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(){ equal(counter, 2, 'incr was called twice'); start(); }, 64);
|
||||
});
|
||||
|
||||
asyncTest("more throttling", 3, function() {
|
||||
asyncTest('more throttling', 3, function() {
|
||||
var counter = 0;
|
||||
var incr = function(){ counter++; };
|
||||
var throttledIncr = _.throttle(incr, 30);
|
||||
throttledIncr(); throttledIncr();
|
||||
ok(counter == 1);
|
||||
equal(counter, 1);
|
||||
_.delay(function(){
|
||||
ok(counter == 2);
|
||||
equal(counter, 2);
|
||||
throttledIncr();
|
||||
ok(counter == 3);
|
||||
equal(counter, 3);
|
||||
start();
|
||||
}, 85);
|
||||
});
|
||||
|
||||
asyncTest("throttle repeatedly with results", 6, function() {
|
||||
asyncTest('throttle repeatedly with results', 6, function() {
|
||||
var counter = 0;
|
||||
var incr = function(){ return ++counter; };
|
||||
var throttledIncr = _.throttle(incr, 100);
|
||||
@@ -168,24 +220,24 @@ $(document).ready(function() {
|
||||
_.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");
|
||||
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();
|
||||
}, 300);
|
||||
});
|
||||
|
||||
asyncTest("throttle triggers trailing call when invoked repeatedly", 2, function() {
|
||||
asyncTest('throttle triggers trailing call when invoked repeatedly', 2, function() {
|
||||
var counter = 0;
|
||||
var limit = 48;
|
||||
var incr = function(){ counter++; };
|
||||
var throttledIncr = _.throttle(incr, 32);
|
||||
|
||||
var stamp = new Date;
|
||||
while ((new Date - stamp) < limit) {
|
||||
while (new Date - stamp < limit) {
|
||||
throttledIncr();
|
||||
}
|
||||
var lastCount = counter;
|
||||
@@ -197,21 +249,21 @@ $(document).ready(function() {
|
||||
}, 96);
|
||||
});
|
||||
|
||||
asyncTest("throttle does not trigger leading call when leading is set to false", 2, function() {
|
||||
asyncTest('throttle does not trigger leading call when leading is set to false', 2, function() {
|
||||
var counter = 0;
|
||||
var incr = function(){ counter++; };
|
||||
var throttledIncr = _.throttle(incr, 60, {leading: false});
|
||||
|
||||
throttledIncr(); throttledIncr();
|
||||
ok(counter === 0);
|
||||
equal(counter, 0);
|
||||
|
||||
_.delay(function() {
|
||||
ok(counter == 1);
|
||||
equal(counter, 1);
|
||||
start();
|
||||
}, 96);
|
||||
});
|
||||
|
||||
asyncTest("more throttle does not trigger leading call when leading is set to false", 3, function() {
|
||||
asyncTest('more throttle does not trigger leading call when leading is set to false', 3, function() {
|
||||
var counter = 0;
|
||||
var incr = function(){ counter++; };
|
||||
var throttledIncr = _.throttle(incr, 100, {leading: false});
|
||||
@@ -220,19 +272,19 @@ $(document).ready(function() {
|
||||
_.delay(throttledIncr, 50);
|
||||
_.delay(throttledIncr, 60);
|
||||
_.delay(throttledIncr, 200);
|
||||
ok(counter === 0);
|
||||
equal(counter, 0);
|
||||
|
||||
_.delay(function() {
|
||||
ok(counter == 1);
|
||||
equal(counter, 1);
|
||||
}, 250);
|
||||
|
||||
_.delay(function() {
|
||||
ok(counter == 2);
|
||||
equal(counter, 2);
|
||||
start();
|
||||
}, 350);
|
||||
});
|
||||
|
||||
asyncTest("one more throttle with leading: false test", 2, function() {
|
||||
asyncTest('one more throttle with leading: false test', 2, function() {
|
||||
var counter = 0;
|
||||
var incr = function(){ counter++; };
|
||||
var throttledIncr = _.throttle(incr, 100, {leading: false});
|
||||
@@ -247,37 +299,80 @@ $(document).ready(function() {
|
||||
}, 200);
|
||||
});
|
||||
|
||||
asyncTest("throttle does not trigger trailing call when trailing is set to false", 4, function() {
|
||||
asyncTest('throttle does not trigger trailing call when trailing is set to false', 4, function() {
|
||||
var counter = 0;
|
||||
var incr = function(){ counter++; };
|
||||
var throttledIncr = _.throttle(incr, 60, {trailing: false});
|
||||
|
||||
throttledIncr(); throttledIncr(); throttledIncr();
|
||||
ok(counter === 1);
|
||||
equal(counter, 1);
|
||||
|
||||
_.delay(function() {
|
||||
ok(counter == 1);
|
||||
equal(counter, 1);
|
||||
|
||||
throttledIncr(); throttledIncr();
|
||||
ok(counter == 2);
|
||||
equal(counter, 2);
|
||||
|
||||
_.delay(function() {
|
||||
ok(counter == 2);
|
||||
equal(counter, 2);
|
||||
start();
|
||||
}, 96);
|
||||
}, 96);
|
||||
});
|
||||
|
||||
asyncTest("debounce", 1, function() {
|
||||
asyncTest('throttle continues to function after system time is set backwards', 2, function() {
|
||||
var counter = 0;
|
||||
var incr = function(){ counter++; };
|
||||
var throttledIncr = _.throttle(incr, 100);
|
||||
var origNowFunc = _.now;
|
||||
|
||||
throttledIncr();
|
||||
equal(counter, 1);
|
||||
_.now = function () {
|
||||
return new Date(2013, 0, 1, 1, 1, 1);
|
||||
};
|
||||
|
||||
_.delay(function() {
|
||||
throttledIncr();
|
||||
equal(counter, 2);
|
||||
start();
|
||||
_.now = origNowFunc;
|
||||
}, 200);
|
||||
});
|
||||
|
||||
asyncTest('throttle re-entrant', 2, function() {
|
||||
var sequence = [
|
||||
['b1', 'b2'],
|
||||
['c1', 'c2']
|
||||
];
|
||||
var value = '';
|
||||
var throttledAppend;
|
||||
var append = function(arg){
|
||||
value += this + arg;
|
||||
var args = sequence.pop();
|
||||
if (args) {
|
||||
throttledAppend.call(args[0], args[1]);
|
||||
}
|
||||
};
|
||||
throttledAppend = _.throttle(append, 32);
|
||||
throttledAppend.call('a1', 'a2');
|
||||
equal(value, 'a1a2');
|
||||
_.delay(function(){
|
||||
equal(value, 'a1a2c1c2b1b2', 'append was throttled successfully');
|
||||
start();
|
||||
}, 100);
|
||||
});
|
||||
|
||||
asyncTest('debounce', 1, function() {
|
||||
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(){ equal(counter, 1, 'incr was debounced'); start(); }, 96);
|
||||
});
|
||||
|
||||
asyncTest("debounce asap", 4, function() {
|
||||
asyncTest('debounce asap', 4, function() {
|
||||
var a, b;
|
||||
var counter = 0;
|
||||
var incr = function(){ return ++counter; };
|
||||
@@ -290,29 +385,75 @@ $(document).ready(function() {
|
||||
_.delay(debouncedIncr, 16);
|
||||
_.delay(debouncedIncr, 32);
|
||||
_.delay(debouncedIncr, 48);
|
||||
_.delay(function(){ equal(counter, 1, "incr was debounced"); start(); }, 128);
|
||||
_.delay(function(){ equal(counter, 1, 'incr was debounced'); start(); }, 128);
|
||||
});
|
||||
|
||||
asyncTest("debounce asap recursively", 2, function() {
|
||||
asyncTest('debounce asap recursively', 2, function() {
|
||||
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);
|
||||
equal(counter, 1, 'incr was called immediately');
|
||||
_.delay(function(){ equal(counter, 1, 'incr was debounced'); start(); }, 96);
|
||||
});
|
||||
|
||||
test("once", function() {
|
||||
asyncTest('debounce after system time is set backwards', 2, function() {
|
||||
var counter = 0;
|
||||
var origNowFunc = _.now;
|
||||
var debouncedIncr = _.debounce(function(){
|
||||
counter++;
|
||||
}, 100, true);
|
||||
|
||||
debouncedIncr();
|
||||
equal(counter, 1, 'incr was called immediately');
|
||||
|
||||
_.now = function () {
|
||||
return new Date(2013, 0, 1, 1, 1, 1);
|
||||
};
|
||||
|
||||
_.delay(function() {
|
||||
debouncedIncr();
|
||||
equal(counter, 2, 'incr was debounced successfully');
|
||||
start();
|
||||
_.now = origNowFunc;
|
||||
}, 200);
|
||||
});
|
||||
|
||||
asyncTest('debounce re-entrant', 2, function() {
|
||||
var sequence = [
|
||||
['b1', 'b2']
|
||||
];
|
||||
var value = '';
|
||||
var debouncedAppend;
|
||||
var append = function(arg){
|
||||
value += this + arg;
|
||||
var args = sequence.pop();
|
||||
if (args) {
|
||||
debouncedAppend.call(args[0], args[1]);
|
||||
}
|
||||
};
|
||||
debouncedAppend = _.debounce(append, 32);
|
||||
debouncedAppend.call('a1', 'a2');
|
||||
equal(value, '');
|
||||
_.delay(function(){
|
||||
equal(value, 'a1a2b1b2', 'append was debounced successfully');
|
||||
start();
|
||||
}, 100);
|
||||
});
|
||||
|
||||
test('once', function() {
|
||||
var num = 0;
|
||||
var increment = _.once(function(){ num++; });
|
||||
var increment = _.once(function(){ return ++num; });
|
||||
increment();
|
||||
increment();
|
||||
equal(num, 1);
|
||||
|
||||
equal(increment(), 1, 'stores a memo to the last value');
|
||||
});
|
||||
|
||||
test("Recursive onced function.", 1, function() {
|
||||
test('Recursive onced function.', 1, function() {
|
||||
var f = _.once(function(){
|
||||
ok(true);
|
||||
f();
|
||||
@@ -320,33 +461,55 @@ $(document).ready(function() {
|
||||
f();
|
||||
});
|
||||
|
||||
test("wrap", function() {
|
||||
var greet = function(name){ return "hi: " + name; };
|
||||
test('wrap', function() {
|
||||
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');
|
||||
|
||||
var inner = function(){ return "Hello "; };
|
||||
var obj = {name : "Moe"};
|
||||
var inner = function(){ return 'Hello '; };
|
||||
var obj = {name : 'Moe'};
|
||||
obj.hi = _.wrap(inner, function(fn){ return fn() + this.name; });
|
||||
equal(obj.hi(), "Hello Moe");
|
||||
equal(obj.hi(), 'Hello Moe');
|
||||
|
||||
var noop = function(){};
|
||||
var wrapped = _.wrap(noop, function(fn){ return Array.prototype.slice.call(arguments, 0); });
|
||||
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']);
|
||||
});
|
||||
|
||||
test("compose", function() {
|
||||
var greet = function(name){ return "hi: " + name; };
|
||||
test('negate', function() {
|
||||
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');
|
||||
});
|
||||
|
||||
test('compose', function() {
|
||||
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');
|
||||
|
||||
composed = _.compose(greet, exclaim);
|
||||
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');
|
||||
return z * y;
|
||||
}
|
||||
function g(x) {
|
||||
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');
|
||||
return x * 2;
|
||||
}
|
||||
composed = _.compose(f, g, h);
|
||||
equal(composed(1, 2, 3), 12);
|
||||
});
|
||||
|
||||
test("after", function() {
|
||||
test('after', function() {
|
||||
var testAfter = function(afterAmount, timesCalled) {
|
||||
var afterCalled = 0;
|
||||
var after = _.after(afterAmount, function() {
|
||||
@@ -356,10 +519,35 @@ $(document).ready(function() {
|
||||
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");
|
||||
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');
|
||||
});
|
||||
|
||||
});
|
||||
test('before', function() {
|
||||
var testBefore = function(beforeAmount, timesCalled) {
|
||||
var beforeCalled = 0;
|
||||
var before = _.before(beforeAmount, function() { beforeCalled++; });
|
||||
while (timesCalled--) before();
|
||||
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');
|
||||
|
||||
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');
|
||||
});
|
||||
|
||||
test('iteratee', function() {
|
||||
var identity = _.iteratee();
|
||||
equal(identity, _.identity, '_.iteratee is exposed as an external function.');
|
||||
});
|
||||
|
||||
}());
|
||||
|
||||
619
vendor/underscore/test/objects.js
vendored
619
vendor/underscore/test/objects.js
vendored
@@ -1,98 +1,151 @@
|
||||
$(document).ready(function() {
|
||||
(function() {
|
||||
|
||||
module("Objects");
|
||||
module('Objects');
|
||||
/* global iObject, iElement, iArguments, iFunction, iArray, iString, iNumber, iBoolean, iDate, iRegExp, iNaN, iNull, iUndefined, ActiveXObject */
|
||||
|
||||
test("keys", function() {
|
||||
equal(_.keys({one : 1, two : 2}).join(', '), 'one, two', 'can extract the keys from an object');
|
||||
test('keys', function() {
|
||||
deepEqual(_.keys({one : 1, two : 2}), ['one', 'two'], 'can extract the keys from an object');
|
||||
// the test above is not safe because it relies on for-in enumeration order
|
||||
var a = []; a[1] = 0;
|
||||
equal(_.keys(a).join(', '), '1', 'is not fooled by sparse arrays; see issue #95');
|
||||
raises(function() { _.keys(null); }, TypeError, 'throws an error for `null` values');
|
||||
raises(function() { _.keys(void 0); }, TypeError, 'throws an error for `undefined` values');
|
||||
raises(function() { _.keys(1); }, TypeError, 'throws an error for number primitives');
|
||||
raises(function() { _.keys('a'); }, TypeError, 'throws an error for string primitives');
|
||||
raises(function() { _.keys(true); }, TypeError, 'throws an error for boolean primitives');
|
||||
deepEqual(_.keys(a), ['1'], 'is not fooled by sparse arrays; see issue #95');
|
||||
deepEqual(_.keys(null), []);
|
||||
deepEqual(_.keys(void 0), []);
|
||||
deepEqual(_.keys(1), []);
|
||||
deepEqual(_.keys('a'), []);
|
||||
deepEqual(_.keys(true), []);
|
||||
});
|
||||
|
||||
test("values", function() {
|
||||
equal(_.values({one: 1, two: 2}).join(', '), '1, 2', 'can extract the values from an object');
|
||||
equal(_.values({one: 1, two: 2, length: 3}).join(', '), '1, 2, 3', '... even when one of them is "length"');
|
||||
test('values', function() {
|
||||
deepEqual(_.values({one: 1, two: 2}), [1, 2], 'can extract the values from an object');
|
||||
deepEqual(_.values({one: 1, two: 2, length: 3}), [1, 2, 3], '... even when one of them is "length"');
|
||||
});
|
||||
|
||||
test("pairs", function() {
|
||||
test('pairs', function() {
|
||||
deepEqual(_.pairs({one: 1, two: 2}), [['one', 1], ['two', 2]], 'can convert an object into pairs');
|
||||
deepEqual(_.pairs({one: 1, two: 2, length: 3}), [['one', 1], ['two', 2], ['length', 3]], '... even when one of them is "length"');
|
||||
});
|
||||
|
||||
test("invert", function() {
|
||||
test('invert', function() {
|
||||
var obj = {first: 'Moe', second: 'Larry', third: 'Curly'};
|
||||
equal(_.keys(_.invert(obj)).join(' '), 'Moe Larry Curly', 'can invert an object');
|
||||
ok(_.isEqual(_.invert(_.invert(obj)), obj), 'two inverts gets you back where you started');
|
||||
deepEqual(_.keys(_.invert(obj)), ['Moe', 'Larry', 'Curly'], 'can invert an object');
|
||||
deepEqual(_.invert(_.invert(obj)), obj, 'two inverts gets you back where you started');
|
||||
|
||||
var obj = {length: 3};
|
||||
ok(_.invert(obj)['3'] == 'length', 'can invert an object with "length"')
|
||||
obj = {length: 3};
|
||||
equal(_.invert(obj)['3'], 'length', 'can invert an object with "length"');
|
||||
});
|
||||
|
||||
test("functions", function() {
|
||||
var obj = {a : 'dash', b : _.map, c : (/yo/), d : _.reduce};
|
||||
ok(_.isEqual(['b', 'd'], _.functions(obj)), 'can grab the function names of any passed-in object');
|
||||
test('functions', function() {
|
||||
var obj = {a : 'dash', b : _.map, c : /yo/, d : _.reduce};
|
||||
deepEqual(['b', 'd'], _.functions(obj), 'can grab the function names of any passed-in object');
|
||||
|
||||
var Animal = function(){};
|
||||
Animal.prototype.run = function(){};
|
||||
equal(_.functions(new Animal).join(''), 'run', 'also looks up functions on the prototype');
|
||||
deepEqual(_.functions(new Animal), ['run'], 'also looks up functions on the prototype');
|
||||
});
|
||||
|
||||
test("extend", function() {
|
||||
test('methods', function() {
|
||||
strictEqual(_.functions, _.methods, 'alias for functions');
|
||||
});
|
||||
|
||||
test('extend', function() {
|
||||
var result;
|
||||
equal(_.extend({}, {a:'b'}).a, 'b', 'can extend an object with the attributes of another');
|
||||
equal(_.extend({a:'x'}, {a:'b'}).a, 'b', 'properties in source override destination');
|
||||
equal(_.extend({x:'x'}, {a:'b'}).x, 'x', "properties not in source don't get overriden");
|
||||
result = _.extend({x:'x'}, {a:'a'}, {b:'b'});
|
||||
ok(_.isEqual(result, {x:'x', a:'a', b:'b'}), 'can extend from multiple source objects');
|
||||
result = _.extend({x:'x'}, {a:'a', x:2}, {a:'b'});
|
||||
ok(_.isEqual(result, {x:2, a:'b'}), 'extending from multiple source objects last property trumps');
|
||||
equal(_.extend({}, {a: 'b'}).a, 'b', 'can extend an object with the attributes of another');
|
||||
equal(_.extend({a: 'x'}, {a: 'b'}).a, 'b', 'properties in source override destination');
|
||||
equal(_.extend({x: 'x'}, {a: 'b'}).x, 'x', "properties not in source don't get overriden");
|
||||
result = _.extend({x: 'x'}, {a: 'a'}, {b: 'b'});
|
||||
deepEqual(result, {x: 'x', a: 'a', b: 'b'}, 'can extend from multiple source objects');
|
||||
result = _.extend({x: 'x'}, {a: 'a', x: 2}, {a: 'b'});
|
||||
deepEqual(result, {x: 2, a: 'b'}, 'extending from multiple source objects last property trumps');
|
||||
result = _.extend({}, {a: void 0, b: null});
|
||||
equal(_.keys(result).join(''), 'ab', 'extend copies undefined values');
|
||||
deepEqual(_.keys(result), ['a', 'b'], 'extend copies undefined values');
|
||||
|
||||
var F = function() {};
|
||||
F.prototype = {a: 'b'};
|
||||
var subObj = new F();
|
||||
subObj.c = 'd';
|
||||
deepEqual(_.extend({}, subObj), {c: 'd'}, 'extend ignores any properties but own from source');
|
||||
|
||||
try {
|
||||
result = {};
|
||||
_.extend(result, null, undefined, {a:1});
|
||||
_.extend(result, null, undefined, {a: 1});
|
||||
} catch(ex) {}
|
||||
|
||||
equal(result.a, 1, 'should not error on `null` or `undefined` sources');
|
||||
|
||||
strictEqual(_.extend(null, {a: 1}), null, 'extending null results in null');
|
||||
strictEqual(_.extend(undefined, {a: 1}), undefined, 'extending undefined results in undefined');
|
||||
});
|
||||
|
||||
test("pick", function() {
|
||||
test('pick', function() {
|
||||
var result;
|
||||
result = _.pick({a:1, b:2, c:3}, 'a', 'c');
|
||||
ok(_.isEqual(result, {a:1, c:3}), 'can restrict properties to those named');
|
||||
result = _.pick({a:1, b:2, c:3}, ['b', 'c']);
|
||||
ok(_.isEqual(result, {b:2, c:3}), 'can restrict properties to those named in an array');
|
||||
result = _.pick({a:1, b:2, c:3}, ['a'], 'b');
|
||||
ok(_.isEqual(result, {a:1, b:2}), 'can restrict properties to those named in mixed args');
|
||||
result = _.pick({a: 1, b: 2, c: 3}, 'a', 'c');
|
||||
deepEqual(result, {a: 1, c: 3}, 'can restrict properties to those named');
|
||||
result = _.pick({a: 1, b: 2, c: 3}, ['b', 'c']);
|
||||
deepEqual(result, {b: 2, c: 3}, 'can restrict properties to those named in an array');
|
||||
result = _.pick({a: 1, b: 2, c: 3}, ['a'], 'b');
|
||||
deepEqual(result, {a: 1, b: 2}, 'can restrict properties to those named in mixed args');
|
||||
result = _.pick(['a', 'b'], 1);
|
||||
deepEqual(result, {1: 'b'}, 'can pick numeric properties');
|
||||
|
||||
deepEqual(_.pick(null, 'a', 'b'), {}, 'non objects return empty object');
|
||||
deepEqual(_.pick(undefined, 'toString'), {}, 'null/undefined return empty object');
|
||||
deepEqual(_.pick(5, 'toString', 'b'), {toString: Number.prototype.toString}, 'can iterate primitives');
|
||||
|
||||
var data = {a: 1, b: 2, c: 3};
|
||||
var callback = function(value, key, object) {
|
||||
strictEqual(key, {1: 'a', 2: 'b', 3: 'c'}[value]);
|
||||
strictEqual(object, data);
|
||||
return value !== this.value;
|
||||
};
|
||||
result = _.pick(data, callback, {value: 2});
|
||||
deepEqual(result, {a: 1, c: 3}, 'can accept a predicate and context');
|
||||
|
||||
var Obj = function(){};
|
||||
Obj.prototype = {a: 1, b: 2, c: 3};
|
||||
ok(_.isEqual(_.pick(new Obj, 'a', 'c'), {a:1, c: 3}), 'include prototype props');
|
||||
var instance = new Obj();
|
||||
deepEqual(_.pick(instance, 'a', 'c'), {a: 1, c: 3}, 'include prototype props');
|
||||
|
||||
deepEqual(_.pick(data, function(val, key) {
|
||||
return this[key] === 3 && this === instance;
|
||||
}, instance), {c: 3}, 'function is given context');
|
||||
});
|
||||
|
||||
test("omit", function() {
|
||||
test('omit', function() {
|
||||
var result;
|
||||
result = _.omit({a:1, b:2, c:3}, 'b');
|
||||
ok(_.isEqual(result, {a:1, c:3}), 'can omit a single named property');
|
||||
result = _.omit({a:1, b:2, c:3}, 'a', 'c');
|
||||
ok(_.isEqual(result, {b:2}), 'can omit several named properties');
|
||||
result = _.omit({a:1, b:2, c:3}, ['b', 'c']);
|
||||
ok(_.isEqual(result, {a:1}), 'can omit properties named in an array');
|
||||
result = _.omit({a: 1, b: 2, c: 3}, 'b');
|
||||
deepEqual(result, {a: 1, c: 3}, 'can omit a single named property');
|
||||
result = _.omit({a: 1, b: 2, c: 3}, 'a', 'c');
|
||||
deepEqual(result, {b: 2}, 'can omit several named properties');
|
||||
result = _.omit({a: 1, b: 2, c: 3}, ['b', 'c']);
|
||||
deepEqual(result, {a: 1}, 'can omit properties named in an array');
|
||||
result = _.omit(['a', 'b'], 0);
|
||||
deepEqual(result, {1: 'b'}, 'can omit numeric properties');
|
||||
|
||||
deepEqual(_.omit(null, 'a', 'b'), {}, 'non objects return empty object');
|
||||
deepEqual(_.omit(undefined, 'toString'), {}, 'null/undefined return empty object');
|
||||
deepEqual(_.omit(5, 'toString', 'b'), {}, 'returns empty object for primitives');
|
||||
|
||||
var data = {a: 1, b: 2, c: 3};
|
||||
var callback = function(value, key, object) {
|
||||
strictEqual(key, {1: 'a', 2: 'b', 3: 'c'}[value]);
|
||||
strictEqual(object, data);
|
||||
return value !== this.value;
|
||||
};
|
||||
result = _.omit(data, callback, {value: 2});
|
||||
deepEqual(result, {b: 2}, 'can accept a predicate');
|
||||
|
||||
var Obj = function(){};
|
||||
Obj.prototype = {a: 1, b: 2, c: 3};
|
||||
ok(_.isEqual(_.omit(new Obj, 'b'), {a:1, c: 3}), 'include prototype props');
|
||||
var instance = new Obj();
|
||||
deepEqual(_.omit(instance, 'b'), {a: 1, c: 3}, 'include prototype props');
|
||||
|
||||
deepEqual(_.omit(data, function(val, key) {
|
||||
return this[key] === 3 && this === instance;
|
||||
}, instance), {a: 1, b: 2}, 'function is given context');
|
||||
});
|
||||
|
||||
test("defaults", function() {
|
||||
var result;
|
||||
var options = {zero: 0, one: 1, empty: "", nan: NaN, nothing: null};
|
||||
test('defaults', function() {
|
||||
var options = {zero: 0, one: 1, empty: '', nan: NaN, nothing: null};
|
||||
|
||||
_.defaults(options, {zero: 1, one: 10, twenty: 20, nothing: 'str'});
|
||||
equal(options.zero, 0, 'value exists');
|
||||
@@ -100,26 +153,29 @@ $(document).ready(function() {
|
||||
equal(options.twenty, 20, 'default applied');
|
||||
equal(options.nothing, null, "null isn't overridden");
|
||||
|
||||
_.defaults(options, {empty: "full"}, {nan: "nan"}, {word: "word"}, {word: "dog"});
|
||||
equal(options.empty, "", 'value exists');
|
||||
_.defaults(options, {empty: 'full'}, {nan: 'nan'}, {word: 'word'}, {word: 'dog'});
|
||||
equal(options.empty, '', 'value exists');
|
||||
ok(_.isNaN(options.nan), "NaN isn't overridden");
|
||||
equal(options.word, "word", 'new value is added, first one wins');
|
||||
equal(options.word, 'word', 'new value is added, first one wins');
|
||||
|
||||
try {
|
||||
options = {};
|
||||
_.defaults(options, null, undefined, {a:1});
|
||||
_.defaults(options, null, undefined, {a: 1});
|
||||
} catch(ex) {}
|
||||
|
||||
equal(options.a, 1, 'should not error on `null` or `undefined` sources');
|
||||
|
||||
strictEqual(_.defaults(null, {a: 1}), null, 'result is null if destination is null');
|
||||
strictEqual(_.defaults(undefined, {a: 1}), undefined, 'result is undefined if destination is undefined');
|
||||
});
|
||||
|
||||
test("clone", function() {
|
||||
test('clone', function() {
|
||||
var moe = {name : 'moe', lucky : [13, 27, 34]};
|
||||
var clone = _.clone(moe);
|
||||
equal(clone.name, 'moe', 'the clone as the attributes of the original');
|
||||
|
||||
clone.name = 'curly';
|
||||
ok(clone.name == 'curly' && moe.name == 'moe', 'clones can change shallow attributes without affecting the original');
|
||||
ok(clone.name === 'curly' && moe.name === 'moe', 'clones can change shallow attributes without affecting the original');
|
||||
|
||||
clone.lucky.push(101);
|
||||
equal(_.last(moe.lucky), 101, 'changes to deep attributes are shared with the original');
|
||||
@@ -129,7 +185,7 @@ $(document).ready(function() {
|
||||
equal(_.clone(null), null, 'non objects should not be changed by clone');
|
||||
});
|
||||
|
||||
test("isEqual", function() {
|
||||
test('isEqual', function() {
|
||||
function First() {
|
||||
this.value = 1;
|
||||
}
|
||||
@@ -140,133 +196,139 @@ $(document).ready(function() {
|
||||
Second.prototype.value = 2;
|
||||
|
||||
// Basic equality and identity comparisons.
|
||||
ok(_.isEqual(null, null), "`null` is equal to `null`");
|
||||
ok(_.isEqual(), "`undefined` is equal to `undefined`");
|
||||
ok(_.isEqual(null, null), '`null` is equal to `null`');
|
||||
ok(_.isEqual(), '`undefined` is equal to `undefined`');
|
||||
|
||||
ok(!_.isEqual(0, -0), "`0` is not equal to `-0`");
|
||||
ok(!_.isEqual(-0, 0), "Commutative equality is implemented for `0` and `-0`");
|
||||
ok(!_.isEqual(null, undefined), "`null` is not equal to `undefined`");
|
||||
ok(!_.isEqual(undefined, null), "Commutative equality is implemented for `null` and `undefined`");
|
||||
ok(!_.isEqual(0, -0), '`0` is not equal to `-0`');
|
||||
ok(!_.isEqual(-0, 0), 'Commutative equality is implemented for `0` and `-0`');
|
||||
ok(!_.isEqual(null, undefined), '`null` is not equal to `undefined`');
|
||||
ok(!_.isEqual(undefined, null), 'Commutative equality is implemented for `null` and `undefined`');
|
||||
|
||||
// String object and primitive comparisons.
|
||||
ok(_.isEqual("Curly", "Curly"), "Identical string primitives are equal");
|
||||
ok(_.isEqual(new String("Curly"), new String("Curly")), "String objects with identical primitive values are equal");
|
||||
ok(_.isEqual(new String("Curly"), "Curly"), "String primitives and their corresponding object wrappers are equal");
|
||||
ok(_.isEqual("Curly", new String("Curly")), "Commutative equality is implemented for string objects and primitives");
|
||||
ok(_.isEqual('Curly', 'Curly'), 'Identical string primitives are equal');
|
||||
ok(_.isEqual(new String('Curly'), new String('Curly')), 'String objects with identical primitive values are equal');
|
||||
ok(_.isEqual(new String('Curly'), 'Curly'), 'String primitives and their corresponding object wrappers are equal');
|
||||
ok(_.isEqual('Curly', new String('Curly')), 'Commutative equality is implemented for string objects and primitives');
|
||||
|
||||
ok(!_.isEqual("Curly", "Larry"), "String primitives with different values are not equal");
|
||||
ok(!_.isEqual(new String("Curly"), new String("Larry")), "String objects with different primitive values are not equal");
|
||||
ok(!_.isEqual(new String("Curly"), {toString: function(){ return "Curly"; }}), "String objects and objects with a custom `toString` method are not equal");
|
||||
ok(!_.isEqual('Curly', 'Larry'), 'String primitives with different values are not equal');
|
||||
ok(!_.isEqual(new String('Curly'), new String('Larry')), 'String objects with different primitive values are not equal');
|
||||
ok(!_.isEqual(new String('Curly'), {toString: function(){ return 'Curly'; }}), 'String objects and objects with a custom `toString` method are not equal');
|
||||
|
||||
// Number object and primitive comparisons.
|
||||
ok(_.isEqual(75, 75), "Identical number primitives are equal");
|
||||
ok(_.isEqual(new Number(75), new Number(75)), "Number objects with identical primitive values are equal");
|
||||
ok(_.isEqual(75, new Number(75)), "Number primitives and their corresponding object wrappers are equal");
|
||||
ok(_.isEqual(new Number(75), 75), "Commutative equality is implemented for number objects and primitives");
|
||||
ok(!_.isEqual(new Number(0), -0), "`new Number(0)` and `-0` are not equal");
|
||||
ok(!_.isEqual(0, new Number(-0)), "Commutative equality is implemented for `new Number(0)` and `-0`");
|
||||
ok(_.isEqual(75, 75), 'Identical number primitives are equal');
|
||||
ok(_.isEqual(new Number(75), new Number(75)), 'Number objects with identical primitive values are equal');
|
||||
ok(_.isEqual(75, new Number(75)), 'Number primitives and their corresponding object wrappers are equal');
|
||||
ok(_.isEqual(new Number(75), 75), 'Commutative equality is implemented for number objects and primitives');
|
||||
ok(!_.isEqual(new Number(0), -0), '`new Number(0)` and `-0` are not equal');
|
||||
ok(!_.isEqual(0, new Number(-0)), 'Commutative equality is implemented for `new Number(0)` and `-0`');
|
||||
|
||||
ok(!_.isEqual(new Number(75), new Number(63)), "Number objects with different primitive values are not equal");
|
||||
ok(!_.isEqual(new Number(63), {valueOf: function(){ return 63; }}), "Number objects and objects with a `valueOf` method are not equal");
|
||||
ok(!_.isEqual(new Number(75), new Number(63)), 'Number objects with different primitive values are not equal');
|
||||
ok(!_.isEqual(new Number(63), {valueOf: function(){ return 63; }}), 'Number objects and objects with a `valueOf` method are not equal');
|
||||
|
||||
// Comparisons involving `NaN`.
|
||||
ok(_.isEqual(NaN, NaN), "`NaN` is equal to `NaN`");
|
||||
ok(!_.isEqual(61, NaN), "A number primitive is not equal to `NaN`");
|
||||
ok(!_.isEqual(new Number(79), NaN), "A number object is not equal to `NaN`");
|
||||
ok(!_.isEqual(Infinity, NaN), "`Infinity` is not equal to `NaN`");
|
||||
ok(_.isEqual(NaN, NaN), '`NaN` is equal to `NaN`');
|
||||
ok(_.isEqual(new Object(NaN), NaN), 'Object(`NaN`) is equal to `NaN`');
|
||||
ok(!_.isEqual(61, NaN), 'A number primitive is not equal to `NaN`');
|
||||
ok(!_.isEqual(new Number(79), NaN), 'A number object is not equal to `NaN`');
|
||||
ok(!_.isEqual(Infinity, NaN), '`Infinity` is not equal to `NaN`');
|
||||
|
||||
// Boolean object and primitive comparisons.
|
||||
ok(_.isEqual(true, true), "Identical boolean primitives are equal");
|
||||
ok(_.isEqual(new Boolean, new Boolean), "Boolean objects with identical primitive values are equal");
|
||||
ok(_.isEqual(true, new Boolean(true)), "Boolean primitives and their corresponding object wrappers are equal");
|
||||
ok(_.isEqual(new Boolean(true), true), "Commutative equality is implemented for booleans");
|
||||
ok(!_.isEqual(new Boolean(true), new Boolean), "Boolean objects with different primitive values are not equal");
|
||||
ok(_.isEqual(true, true), 'Identical boolean primitives are equal');
|
||||
ok(_.isEqual(new Boolean, new Boolean), 'Boolean objects with identical primitive values are equal');
|
||||
ok(_.isEqual(true, new Boolean(true)), 'Boolean primitives and their corresponding object wrappers are equal');
|
||||
ok(_.isEqual(new Boolean(true), true), 'Commutative equality is implemented for booleans');
|
||||
ok(!_.isEqual(new Boolean(true), new Boolean), 'Boolean objects with different primitive values are not equal');
|
||||
|
||||
// Common type coercions.
|
||||
ok(!_.isEqual(true, new Boolean(false)), "Boolean objects are not equal to the boolean primitive `true`");
|
||||
ok(!_.isEqual("75", 75), "String and number primitives with like values are not equal");
|
||||
ok(!_.isEqual(new Number(63), new String(63)), "String and number objects with like values are not equal");
|
||||
ok(!_.isEqual(75, "75"), "Commutative equality is implemented for like string and number values");
|
||||
ok(!_.isEqual(0, ""), "Number and string primitives with like values are not equal");
|
||||
ok(!_.isEqual(1, true), "Number and boolean primitives with like values are not equal");
|
||||
ok(!_.isEqual(new Boolean(false), new Number(0)), "Boolean and number objects with like values are not equal");
|
||||
ok(!_.isEqual(false, new String("")), "Boolean primitives and string objects with like values are not equal");
|
||||
ok(!_.isEqual(12564504e5, new Date(2009, 9, 25)), "Dates and their corresponding numeric primitive values are not equal");
|
||||
ok(!_.isEqual(new Boolean(false), true), '`new Boolean(false)` is not equal to `true`');
|
||||
ok(!_.isEqual('75', 75), 'String and number primitives with like values are not equal');
|
||||
ok(!_.isEqual(new Number(63), new String(63)), 'String and number objects with like values are not equal');
|
||||
ok(!_.isEqual(75, '75'), 'Commutative equality is implemented for like string and number values');
|
||||
ok(!_.isEqual(0, ''), 'Number and string primitives with like values are not equal');
|
||||
ok(!_.isEqual(1, true), 'Number and boolean primitives with like values are not equal');
|
||||
ok(!_.isEqual(new Boolean(false), new Number(0)), 'Boolean and number objects with like values are not equal');
|
||||
ok(!_.isEqual(false, new String('')), 'Boolean primitives and string objects with like values are not equal');
|
||||
ok(!_.isEqual(12564504e5, new Date(2009, 9, 25)), 'Dates and their corresponding numeric primitive values are not equal');
|
||||
|
||||
// Dates.
|
||||
ok(_.isEqual(new Date(2009, 9, 25), new Date(2009, 9, 25)), "Date objects referencing identical times are equal");
|
||||
ok(!_.isEqual(new Date(2009, 9, 25), new Date(2009, 11, 13)), "Date objects referencing different times are not equal");
|
||||
ok(_.isEqual(new Date(2009, 9, 25), new Date(2009, 9, 25)), 'Date objects referencing identical times are equal');
|
||||
ok(!_.isEqual(new Date(2009, 9, 25), new Date(2009, 11, 13)), 'Date objects referencing different times are not equal');
|
||||
ok(!_.isEqual(new Date(2009, 11, 13), {
|
||||
getTime: function(){
|
||||
return 12606876e5;
|
||||
}
|
||||
}), "Date objects and objects with a `getTime` method are not equal");
|
||||
ok(!_.isEqual(new Date("Curly"), new Date("Curly")), "Invalid dates are not equal");
|
||||
}), 'Date objects and objects with a `getTime` method are not equal');
|
||||
ok(!_.isEqual(new Date('Curly'), new Date('Curly')), 'Invalid dates are not equal');
|
||||
|
||||
// Functions.
|
||||
ok(!_.isEqual(First, Second), "Different functions with identical bodies and source code representations are not equal");
|
||||
ok(!_.isEqual(First, Second), 'Different functions with identical bodies and source code representations are not equal');
|
||||
|
||||
// RegExps.
|
||||
ok(_.isEqual(/(?:)/gim, /(?:)/gim), "RegExps with equivalent patterns and flags are equal");
|
||||
ok(!_.isEqual(/(?:)/g, /(?:)/gi), "RegExps with equivalent patterns and different flags are not equal");
|
||||
ok(!_.isEqual(/Moe/gim, /Curly/gim), "RegExps with different patterns and equivalent flags are not equal");
|
||||
ok(!_.isEqual(/(?:)/gi, /(?:)/g), "Commutative equality is implemented for RegExps");
|
||||
ok(!_.isEqual(/Curly/g, {source: "Larry", global: true, ignoreCase: false, multiline: false}), "RegExps and RegExp-like objects are not equal");
|
||||
ok(_.isEqual(/(?:)/gim, /(?:)/gim), 'RegExps with equivalent patterns and flags are equal');
|
||||
ok(_.isEqual(/(?:)/gi, /(?:)/ig), 'Flag order is not significant');
|
||||
ok(!_.isEqual(/(?:)/g, /(?:)/gi), 'RegExps with equivalent patterns and different flags are not equal');
|
||||
ok(!_.isEqual(/Moe/gim, /Curly/gim), 'RegExps with different patterns and equivalent flags are not equal');
|
||||
ok(!_.isEqual(/(?:)/gi, /(?:)/g), 'Commutative equality is implemented for RegExps');
|
||||
ok(!_.isEqual(/Curly/g, {source: 'Larry', global: true, ignoreCase: false, multiline: false}), 'RegExps and RegExp-like objects are not equal');
|
||||
|
||||
// Empty arrays, array-like objects, and object literals.
|
||||
ok(_.isEqual({}, {}), "Empty object literals are equal");
|
||||
ok(_.isEqual([], []), "Empty array literals are equal");
|
||||
ok(_.isEqual([{}], [{}]), "Empty nested arrays and objects are equal");
|
||||
ok(!_.isEqual({length: 0}, []), "Array-like objects and arrays are not equal.");
|
||||
ok(!_.isEqual([], {length: 0}), "Commutative equality is implemented for array-like objects");
|
||||
ok(_.isEqual({}, {}), 'Empty object literals are equal');
|
||||
ok(_.isEqual([], []), 'Empty array literals are equal');
|
||||
ok(_.isEqual([{}], [{}]), 'Empty nested arrays and objects are equal');
|
||||
ok(!_.isEqual({length: 0}, []), 'Array-like objects and arrays are not equal.');
|
||||
ok(!_.isEqual([], {length: 0}), 'Commutative equality is implemented for array-like objects');
|
||||
|
||||
ok(!_.isEqual({}, []), "Object literals and array literals are not equal");
|
||||
ok(!_.isEqual([], {}), "Commutative equality is implemented for objects and arrays");
|
||||
ok(!_.isEqual({}, []), 'Object literals and array literals are not equal');
|
||||
ok(!_.isEqual([], {}), 'Commutative equality is implemented for objects and arrays');
|
||||
|
||||
// Arrays with primitive and object values.
|
||||
ok(_.isEqual([1, "Larry", true], [1, "Larry", true]), "Arrays containing identical primitives are equal");
|
||||
ok(_.isEqual([(/Moe/g), new Date(2009, 9, 25)], [(/Moe/g), new Date(2009, 9, 25)]), "Arrays containing equivalent elements are equal");
|
||||
ok(_.isEqual([1, 'Larry', true], [1, 'Larry', true]), 'Arrays containing identical primitives are equal');
|
||||
ok(_.isEqual([/Moe/g, new Date(2009, 9, 25)], [/Moe/g, new Date(2009, 9, 25)]), 'Arrays containing equivalent elements are equal');
|
||||
|
||||
// Multi-dimensional arrays.
|
||||
var a = [new Number(47), false, "Larry", /Moe/, new Date(2009, 11, 13), ['running', 'biking', new String('programming')], {a: 47}];
|
||||
var b = [new Number(47), false, "Larry", /Moe/, new Date(2009, 11, 13), ['running', 'biking', new String('programming')], {a: 47}];
|
||||
ok(_.isEqual(a, b), "Arrays containing nested arrays and objects are recursively compared");
|
||||
var a = [new Number(47), false, 'Larry', /Moe/, new Date(2009, 11, 13), ['running', 'biking', new String('programming')], {a: 47}];
|
||||
var b = [new Number(47), false, 'Larry', /Moe/, new Date(2009, 11, 13), ['running', 'biking', new String('programming')], {a: 47}];
|
||||
ok(_.isEqual(a, b), 'Arrays containing nested arrays and objects are recursively compared');
|
||||
|
||||
// Overwrite the methods defined in ES 5.1 section 15.4.4.
|
||||
a.forEach = a.map = a.filter = a.every = a.indexOf = a.lastIndexOf = a.some = a.reduce = a.reduceRight = null;
|
||||
b.join = b.pop = b.reverse = b.shift = b.slice = b.splice = b.concat = b.sort = b.unshift = null;
|
||||
|
||||
// Array elements and properties.
|
||||
ok(_.isEqual(a, b), "Arrays containing equivalent elements and different non-numeric properties are equal");
|
||||
a.push("White Rocks");
|
||||
ok(!_.isEqual(a, b), "Arrays of different lengths are not equal");
|
||||
a.push("East Boulder");
|
||||
b.push("Gunbarrel Ranch", "Teller Farm");
|
||||
ok(!_.isEqual(a, b), "Arrays of identical lengths containing different elements are not equal");
|
||||
ok(_.isEqual(a, b), 'Arrays containing equivalent elements and different non-numeric properties are equal');
|
||||
a.push('White Rocks');
|
||||
ok(!_.isEqual(a, b), 'Arrays of different lengths are not equal');
|
||||
a.push('East Boulder');
|
||||
b.push('Gunbarrel Ranch', 'Teller Farm');
|
||||
ok(!_.isEqual(a, b), 'Arrays of identical lengths containing different elements are not equal');
|
||||
|
||||
// Sparse arrays.
|
||||
ok(_.isEqual(Array(3), Array(3)), "Sparse arrays of identical lengths are equal");
|
||||
ok(!_.isEqual(Array(3), Array(6)), "Sparse arrays of different lengths are not equal when both are empty");
|
||||
ok(_.isEqual(Array(3), Array(3)), 'Sparse arrays of identical lengths are equal');
|
||||
ok(!_.isEqual(Array(3), Array(6)), 'Sparse arrays of different lengths are not equal when both are empty');
|
||||
|
||||
var sparse = [];
|
||||
sparse[1] = 5;
|
||||
ok(_.isEqual(sparse, [undefined, 5]), 'Handles sparse arrays as dense');
|
||||
|
||||
// Simple objects.
|
||||
ok(_.isEqual({a: "Curly", b: 1, c: true}, {a: "Curly", b: 1, c: true}), "Objects containing identical primitives are equal");
|
||||
ok(_.isEqual({a: /Curly/g, b: new Date(2009, 11, 13)}, {a: /Curly/g, b: new Date(2009, 11, 13)}), "Objects containing equivalent members are equal");
|
||||
ok(!_.isEqual({a: 63, b: 75}, {a: 61, b: 55}), "Objects of identical sizes with different values are not equal");
|
||||
ok(!_.isEqual({a: 63, b: 75}, {a: 61, c: 55}), "Objects of identical sizes with different property names are not equal");
|
||||
ok(!_.isEqual({a: 1, b: 2}, {a: 1}), "Objects of different sizes are not equal");
|
||||
ok(!_.isEqual({a: 1}, {a: 1, b: 2}), "Commutative equality is implemented for objects");
|
||||
ok(!_.isEqual({x: 1, y: undefined}, {x: 1, z: 2}), "Objects with identical keys and different values are not equivalent");
|
||||
ok(_.isEqual({a: 'Curly', b: 1, c: true}, {a: 'Curly', b: 1, c: true}), 'Objects containing identical primitives are equal');
|
||||
ok(_.isEqual({a: /Curly/g, b: new Date(2009, 11, 13)}, {a: /Curly/g, b: new Date(2009, 11, 13)}), 'Objects containing equivalent members are equal');
|
||||
ok(!_.isEqual({a: 63, b: 75}, {a: 61, b: 55}), 'Objects of identical sizes with different values are not equal');
|
||||
ok(!_.isEqual({a: 63, b: 75}, {a: 61, c: 55}), 'Objects of identical sizes with different property names are not equal');
|
||||
ok(!_.isEqual({a: 1, b: 2}, {a: 1}), 'Objects of different sizes are not equal');
|
||||
ok(!_.isEqual({a: 1}, {a: 1, b: 2}), 'Commutative equality is implemented for objects');
|
||||
ok(!_.isEqual({x: 1, y: undefined}, {x: 1, z: 2}), 'Objects with identical keys and different values are not equivalent');
|
||||
|
||||
// `A` contains nested objects and arrays.
|
||||
a = {
|
||||
name: new String("Moe Howard"),
|
||||
name: new String('Moe Howard'),
|
||||
age: new Number(77),
|
||||
stooge: true,
|
||||
hobbies: ["acting"],
|
||||
hobbies: ['acting'],
|
||||
film: {
|
||||
name: "Sing a Song of Six Pants",
|
||||
name: 'Sing a Song of Six Pants',
|
||||
release: new Date(1947, 9, 30),
|
||||
stars: [new String("Larry Fine"), "Shemp Howard"],
|
||||
stars: [new String('Larry Fine'), 'Shemp Howard'],
|
||||
minutes: new Number(16),
|
||||
seconds: 54
|
||||
}
|
||||
@@ -274,81 +336,81 @@ $(document).ready(function() {
|
||||
|
||||
// `B` contains equivalent nested objects and arrays.
|
||||
b = {
|
||||
name: new String("Moe Howard"),
|
||||
name: new String('Moe Howard'),
|
||||
age: new Number(77),
|
||||
stooge: true,
|
||||
hobbies: ["acting"],
|
||||
hobbies: ['acting'],
|
||||
film: {
|
||||
name: "Sing a Song of Six Pants",
|
||||
name: 'Sing a Song of Six Pants',
|
||||
release: new Date(1947, 9, 30),
|
||||
stars: [new String("Larry Fine"), "Shemp Howard"],
|
||||
stars: [new String('Larry Fine'), 'Shemp Howard'],
|
||||
minutes: new Number(16),
|
||||
seconds: 54
|
||||
}
|
||||
};
|
||||
ok(_.isEqual(a, b), "Objects with nested equivalent members are recursively compared");
|
||||
ok(_.isEqual(a, b), 'Objects with nested equivalent members are recursively compared');
|
||||
|
||||
// Instances.
|
||||
ok(_.isEqual(new First, new First), "Object instances are equal");
|
||||
ok(!_.isEqual(new First, new Second), "Objects with different constructors and identical own properties are not equal");
|
||||
ok(!_.isEqual({value: 1}, new First), "Object instances and objects sharing equivalent properties are not equal");
|
||||
ok(!_.isEqual({value: 2}, new Second), "The prototype chain of objects should not be examined");
|
||||
ok(_.isEqual(new First, new First), 'Object instances are equal');
|
||||
ok(!_.isEqual(new First, new Second), 'Objects with different constructors and identical own properties are not equal');
|
||||
ok(!_.isEqual({value: 1}, new First), 'Object instances and objects sharing equivalent properties are not equal');
|
||||
ok(!_.isEqual({value: 2}, new Second), 'The prototype chain of objects should not be examined');
|
||||
|
||||
// Circular Arrays.
|
||||
(a = []).push(a);
|
||||
(b = []).push(b);
|
||||
ok(_.isEqual(a, b), "Arrays containing circular references are equal");
|
||||
a.push(new String("Larry"));
|
||||
b.push(new String("Larry"));
|
||||
ok(_.isEqual(a, b), "Arrays containing circular references and equivalent properties are equal");
|
||||
a.push("Shemp");
|
||||
b.push("Curly");
|
||||
ok(!_.isEqual(a, b), "Arrays containing circular references and different properties are not equal");
|
||||
ok(_.isEqual(a, b), 'Arrays containing circular references are equal');
|
||||
a.push(new String('Larry'));
|
||||
b.push(new String('Larry'));
|
||||
ok(_.isEqual(a, b), 'Arrays containing circular references and equivalent properties are equal');
|
||||
a.push('Shemp');
|
||||
b.push('Curly');
|
||||
ok(!_.isEqual(a, b), 'Arrays containing circular references and different properties are not equal');
|
||||
|
||||
// More circular arrays #767.
|
||||
a = ["everything is checked but", "this", "is not"];
|
||||
a = ['everything is checked but', 'this', 'is not'];
|
||||
a[1] = a;
|
||||
b = ["everything is checked but", ["this", "array"], "is not"];
|
||||
ok(!_.isEqual(a, b), "Comparison of circular references with non-circular references are not equal");
|
||||
b = ['everything is checked but', ['this', 'array'], 'is not'];
|
||||
ok(!_.isEqual(a, b), 'Comparison of circular references with non-circular references are not equal');
|
||||
|
||||
// Circular Objects.
|
||||
a = {abc: null};
|
||||
b = {abc: null};
|
||||
a.abc = a;
|
||||
b.abc = b;
|
||||
ok(_.isEqual(a, b), "Objects containing circular references are equal");
|
||||
ok(_.isEqual(a, b), 'Objects containing circular references are equal');
|
||||
a.def = 75;
|
||||
b.def = 75;
|
||||
ok(_.isEqual(a, b), "Objects containing circular references and equivalent properties are equal");
|
||||
ok(_.isEqual(a, b), 'Objects containing circular references and equivalent properties are equal');
|
||||
a.def = new Number(75);
|
||||
b.def = new Number(63);
|
||||
ok(!_.isEqual(a, b), "Objects containing circular references and different properties are not equal");
|
||||
ok(!_.isEqual(a, b), 'Objects containing circular references and different properties are not equal');
|
||||
|
||||
// More circular objects #767.
|
||||
a = {everything: "is checked", but: "this", is: "not"};
|
||||
a = {everything: 'is checked', but: 'this', is: 'not'};
|
||||
a.but = a;
|
||||
b = {everything: "is checked", but: {that:"object"}, is: "not"};
|
||||
ok(!_.isEqual(a, b), "Comparison of circular references with non-circular object references are not equal");
|
||||
b = {everything: 'is checked', but: {that: 'object'}, is: 'not'};
|
||||
ok(!_.isEqual(a, b), 'Comparison of circular references with non-circular object references are not equal');
|
||||
|
||||
// Cyclic Structures.
|
||||
a = [{abc: null}];
|
||||
b = [{abc: null}];
|
||||
(a[0].abc = a).push(a);
|
||||
(b[0].abc = b).push(b);
|
||||
ok(_.isEqual(a, b), "Cyclic structures are equal");
|
||||
a[0].def = "Larry";
|
||||
b[0].def = "Larry";
|
||||
ok(_.isEqual(a, b), "Cyclic structures containing equivalent properties are equal");
|
||||
a[0].def = new String("Larry");
|
||||
b[0].def = new String("Curly");
|
||||
ok(!_.isEqual(a, b), "Cyclic structures containing different properties are not equal");
|
||||
ok(_.isEqual(a, b), 'Cyclic structures are equal');
|
||||
a[0].def = 'Larry';
|
||||
b[0].def = 'Larry';
|
||||
ok(_.isEqual(a, b), 'Cyclic structures containing equivalent properties are equal');
|
||||
a[0].def = new String('Larry');
|
||||
b[0].def = new String('Curly');
|
||||
ok(!_.isEqual(a, b), 'Cyclic structures containing different properties are not equal');
|
||||
|
||||
// Complex Circular References.
|
||||
a = {foo: {b: {foo: {c: {foo: null}}}}};
|
||||
b = {foo: {b: {foo: {c: {foo: null}}}}};
|
||||
a.foo.b.foo.c.foo = a;
|
||||
b.foo.b.foo.c.foo = b;
|
||||
ok(_.isEqual(a, b), "Cyclic structures with nested and identically-named properties are equal");
|
||||
ok(_.isEqual(a, b), 'Cyclic structures with nested and identically-named properties are equal');
|
||||
|
||||
// Chaining.
|
||||
ok(!_.isEqual(_({x: 1, y: undefined}).chain(), _({x: 1, z: 2}).chain()), 'Chained objects containing different values are not equal');
|
||||
@@ -359,9 +421,22 @@ $(document).ready(function() {
|
||||
|
||||
// Objects from another frame.
|
||||
ok(_.isEqual({}, iObject));
|
||||
|
||||
// Objects without a `constructor` property
|
||||
if (Object.create) {
|
||||
a = Object.create(null, {x: {value: 1, enumerable: true}});
|
||||
b = {x: 1};
|
||||
ok(_.isEqual(a, b), 'Handles objects without a constructor (e.g. from Object.create');
|
||||
}
|
||||
|
||||
function Foo() { this.a = 1; }
|
||||
Foo.prototype.constructor = null;
|
||||
|
||||
var other = {a: 1};
|
||||
strictEqual(_.isEqual(new Foo, other), false, 'Objects from different constructors are not equal');
|
||||
});
|
||||
|
||||
test("isEmpty", function() {
|
||||
test('isEmpty', function() {
|
||||
ok(!_([1]).isEmpty(), '[1] is not empty');
|
||||
ok(_.isEmpty([]), '[] is empty');
|
||||
ok(!_.isEmpty({one : 1}), '{one : 1} is not empty');
|
||||
@@ -375,51 +450,56 @@ $(document).ready(function() {
|
||||
var obj = {one : 1};
|
||||
delete obj.one;
|
||||
ok(_.isEmpty(obj), 'deleting all the keys from an object empties it');
|
||||
|
||||
var args = function(){ return arguments; };
|
||||
ok(_.isEmpty(args()), 'empty arguments object is empty');
|
||||
ok(!_.isEmpty(args('')), 'non-empty arguments object is not empty');
|
||||
});
|
||||
|
||||
// Setup remote variables for iFrame tests.
|
||||
var iframe = document.createElement('iframe');
|
||||
jQuery(iframe).appendTo(document.body);
|
||||
var iDoc = iframe.contentDocument || iframe.contentWindow.document;
|
||||
iframe.frameBorder = iframe.height = iframe.width = 0;
|
||||
document.body.appendChild(iframe);
|
||||
var iDoc = (iDoc = iframe.contentDocument || iframe.contentWindow).document || iDoc;
|
||||
iDoc.write(
|
||||
"<script>\
|
||||
parent.iElement = document.createElement('div');\
|
||||
parent.iArguments = (function(){ return arguments; })(1, 2, 3);\
|
||||
parent.iArray = [1, 2, 3];\
|
||||
parent.iString = new String('hello');\
|
||||
parent.iNumber = new Number(100);\
|
||||
parent.iFunction = (function(){});\
|
||||
parent.iDate = new Date();\
|
||||
parent.iRegExp = /hi/;\
|
||||
parent.iNaN = NaN;\
|
||||
parent.iNull = null;\
|
||||
parent.iBoolean = new Boolean(false);\
|
||||
parent.iUndefined = undefined;\
|
||||
parent.iObject = {};\
|
||||
</script>"
|
||||
'<script>' +
|
||||
' parent.iElement = document.createElement("div");' +
|
||||
' parent.iArguments = (function(){ return arguments; })(1, 2, 3);' +
|
||||
' parent.iArray = [1, 2, 3];' +
|
||||
' parent.iString = new String("hello");' +
|
||||
' parent.iNumber = new Number(100);' +
|
||||
' parent.iFunction = (function(){});' +
|
||||
' parent.iDate = new Date();' +
|
||||
' parent.iRegExp = /hi/;' +
|
||||
' parent.iNaN = NaN;' +
|
||||
' parent.iNull = null;' +
|
||||
' parent.iBoolean = new Boolean(false);' +
|
||||
' parent.iUndefined = undefined;' +
|
||||
' parent.iObject = {};' +
|
||||
'</script>'
|
||||
);
|
||||
iDoc.close();
|
||||
|
||||
test("isElement", function() {
|
||||
test('isElement', function() {
|
||||
ok(!_.isElement('div'), 'strings are not dom elements');
|
||||
ok(_.isElement($('html')[0]), 'the html tag is a DOM element');
|
||||
ok(_.isElement(document.body), 'the body tag is a DOM element');
|
||||
ok(_.isElement(iElement), 'even from another frame');
|
||||
});
|
||||
|
||||
test("isArguments", function() {
|
||||
var args = (function(){ return arguments; })(1, 2, 3);
|
||||
test('isArguments', function() {
|
||||
var args = (function(){ return arguments; }(1, 2, 3));
|
||||
ok(!_.isArguments('string'), 'a string is not an arguments object');
|
||||
ok(!_.isArguments(_.isArguments), 'a function is not an arguments object');
|
||||
ok(_.isArguments(args), 'but the arguments object is an arguments object');
|
||||
ok(!_.isArguments(_.toArray(args)), 'but not when it\'s converted into an array');
|
||||
ok(!_.isArguments([1,2,3]), 'and not vanilla arrays.');
|
||||
ok(!_.isArguments([1, 2, 3]), 'and not vanilla arrays.');
|
||||
ok(_.isArguments(iArguments), 'even from another frame');
|
||||
});
|
||||
|
||||
test("isObject", function() {
|
||||
test('isObject', function() {
|
||||
ok(_.isObject(arguments), 'the arguments object is object');
|
||||
ok(_.isObject([1, 2, 3]), 'and arrays');
|
||||
ok(_.isObject($('html')[0]), 'and DOM element');
|
||||
ok(_.isObject(document.body), 'and DOM element');
|
||||
ok(_.isObject(iElement), 'even from another frame');
|
||||
ok(_.isObject(function () {}), 'and functions');
|
||||
ok(_.isObject(iFunction), 'even from another frame');
|
||||
@@ -431,23 +511,23 @@ $(document).ready(function() {
|
||||
ok(_.isObject(new String('string')), 'but new String()');
|
||||
});
|
||||
|
||||
test("isArray", function() {
|
||||
test('isArray', function() {
|
||||
ok(!_.isArray(undefined), 'undefined vars are not arrays');
|
||||
ok(!_.isArray(arguments), 'the arguments object is not an array');
|
||||
ok(_.isArray([1, 2, 3]), 'but arrays are');
|
||||
ok(_.isArray(iArray), 'even from another frame');
|
||||
});
|
||||
|
||||
test("isString", function() {
|
||||
var obj = new String("I am a string object");
|
||||
test('isString', function() {
|
||||
var obj = new String('I am a string object');
|
||||
ok(!_.isString(document.body), 'the document body is not a string');
|
||||
ok(_.isString([1, 2, 3].join(', ')), 'but strings are');
|
||||
ok(_.isString(iString), 'even from another frame');
|
||||
ok(_.isString("I am a string literal"), 'string literals are');
|
||||
ok(_.isString('I am a string literal'), 'string literals are');
|
||||
ok(_.isString(obj), 'so are String objects');
|
||||
});
|
||||
|
||||
test("isNumber", function() {
|
||||
test('isNumber', function() {
|
||||
ok(!_.isNumber('string'), 'a string is not a number');
|
||||
ok(!_.isNumber(arguments), 'the arguments object is not a number');
|
||||
ok(!_.isNumber(undefined), 'undefined is not a number');
|
||||
@@ -458,11 +538,11 @@ $(document).ready(function() {
|
||||
ok(!_.isNumber('1'), 'numeric strings are not numbers');
|
||||
});
|
||||
|
||||
test("isBoolean", function() {
|
||||
test('isBoolean', function() {
|
||||
ok(!_.isBoolean(2), 'a number is not a boolean');
|
||||
ok(!_.isBoolean("string"), 'a string is not a boolean');
|
||||
ok(!_.isBoolean("false"), 'the string "false" is not a boolean');
|
||||
ok(!_.isBoolean("true"), 'the string "true" is not a boolean');
|
||||
ok(!_.isBoolean('string'), 'a string is not a boolean');
|
||||
ok(!_.isBoolean('false'), 'the string "false" is not a boolean');
|
||||
ok(!_.isBoolean('true'), 'the string "true" is not a boolean');
|
||||
ok(!_.isBoolean(arguments), 'the arguments object is not a boolean');
|
||||
ok(!_.isBoolean(undefined), 'undefined is not a boolean');
|
||||
ok(!_.isBoolean(NaN), 'NaN is not a boolean');
|
||||
@@ -472,7 +552,7 @@ $(document).ready(function() {
|
||||
ok(_.isBoolean(iBoolean), 'even from another frame');
|
||||
});
|
||||
|
||||
test("isFunction", function() {
|
||||
test('isFunction', function() {
|
||||
ok(!_.isFunction(undefined), 'undefined vars are not functions');
|
||||
ok(!_.isFunction([1, 2, 3]), 'arrays are not functions');
|
||||
ok(!_.isFunction('moe'), 'strings are not functions');
|
||||
@@ -481,36 +561,36 @@ $(document).ready(function() {
|
||||
ok(_.isFunction(function(){}), 'even anonymous ones');
|
||||
});
|
||||
|
||||
test("isDate", function() {
|
||||
test('isDate', function() {
|
||||
ok(!_.isDate(100), 'numbers are not dates');
|
||||
ok(!_.isDate({}), 'objects are not dates');
|
||||
ok(_.isDate(new Date()), 'but dates are');
|
||||
ok(_.isDate(iDate), 'even from another frame');
|
||||
});
|
||||
|
||||
test("isRegExp", function() {
|
||||
test('isRegExp', function() {
|
||||
ok(!_.isRegExp(_.identity), 'functions are not RegExps');
|
||||
ok(_.isRegExp(/identity/), 'but RegExps are');
|
||||
ok(_.isRegExp(iRegExp), 'even from another frame');
|
||||
});
|
||||
|
||||
test("isFinite", function() {
|
||||
ok(!_.isFinite(undefined), 'undefined is not Finite');
|
||||
ok(!_.isFinite(null), 'null is not Finite');
|
||||
ok(!_.isFinite(NaN), 'NaN is not Finite');
|
||||
ok(!_.isFinite(Infinity), 'Infinity is not Finite');
|
||||
ok(!_.isFinite(-Infinity), '-Infinity is not Finite');
|
||||
test('isFinite', function() {
|
||||
ok(!_.isFinite(undefined), 'undefined is not finite');
|
||||
ok(!_.isFinite(null), 'null is not finite');
|
||||
ok(!_.isFinite(NaN), 'NaN is not finite');
|
||||
ok(!_.isFinite(Infinity), 'Infinity is not finite');
|
||||
ok(!_.isFinite(-Infinity), '-Infinity is not finite');
|
||||
ok(_.isFinite('12'), 'Numeric strings are numbers');
|
||||
ok(!_.isFinite('1a'), 'Non numeric strings are not numbers');
|
||||
ok(!_.isFinite(''), 'Empty strings are not numbers');
|
||||
var obj = new Number(5);
|
||||
ok(_.isFinite(obj), 'Number instances can be finite');
|
||||
ok(_.isFinite(0), '0 is Finite');
|
||||
ok(_.isFinite(123), 'Ints are Finite');
|
||||
ok(_.isFinite(-12.44), 'Floats are Finite');
|
||||
ok(_.isFinite(0), '0 is finite');
|
||||
ok(_.isFinite(123), 'Ints are finite');
|
||||
ok(_.isFinite(-12.44), 'Floats are finite');
|
||||
});
|
||||
|
||||
test("isNaN", function() {
|
||||
test('isNaN', function() {
|
||||
ok(!_.isNaN(undefined), 'undefined is not NaN');
|
||||
ok(!_.isNaN(null), 'null is not NaN');
|
||||
ok(!_.isNaN(0), '0 is not NaN');
|
||||
@@ -519,14 +599,14 @@ $(document).ready(function() {
|
||||
ok(_.isNaN(new Number(NaN)), 'wrapped NaN is still NaN');
|
||||
});
|
||||
|
||||
test("isNull", function() {
|
||||
test('isNull', function() {
|
||||
ok(!_.isNull(undefined), 'undefined is not null');
|
||||
ok(!_.isNull(NaN), 'NaN is not null');
|
||||
ok(_.isNull(null), 'but null is');
|
||||
ok(_.isNull(iNull), 'even from another frame');
|
||||
});
|
||||
|
||||
test("isUndefined", function() {
|
||||
test('isUndefined', function() {
|
||||
ok(!_.isUndefined(1), 'numbers are defined');
|
||||
ok(!_.isUndefined(null), 'null is defined');
|
||||
ok(!_.isUndefined(false), 'false is defined');
|
||||
@@ -537,8 +617,8 @@ $(document).ready(function() {
|
||||
});
|
||||
|
||||
if (window.ActiveXObject) {
|
||||
test("IE host objects", function() {
|
||||
var xml = new ActiveXObject("Msxml2.DOMDocument.3.0");
|
||||
test('IE host objects', function() {
|
||||
var xml = new ActiveXObject('Msxml2.DOMDocument.3.0');
|
||||
ok(!_.isNumber(xml));
|
||||
ok(!_.isBoolean(xml));
|
||||
ok(!_.isNaN(xml));
|
||||
@@ -548,30 +628,91 @@ $(document).ready(function() {
|
||||
});
|
||||
}
|
||||
|
||||
test("tap", function() {
|
||||
test('tap', function() {
|
||||
var intercepted = null;
|
||||
var interceptor = function(obj) { intercepted = obj; };
|
||||
var returned = _.tap(1, interceptor);
|
||||
equal(intercepted, 1, "passes tapped object to interceptor");
|
||||
equal(returned, 1, "returns tapped object");
|
||||
equal(intercepted, 1, 'passes tapped object to interceptor');
|
||||
equal(returned, 1, 'returns tapped object');
|
||||
|
||||
returned = _([1,2,3]).chain().
|
||||
returned = _([1, 2, 3]).chain().
|
||||
map(function(n){ return n * 2; }).
|
||||
max().
|
||||
tap(interceptor).
|
||||
value();
|
||||
ok(returned == 6 && intercepted == 6, 'can use tapped objects in a chain');
|
||||
equal(returned, 6, 'can use tapped objects in a chain');
|
||||
equal(intercepted, returned, 'can use tapped objects in a chain');
|
||||
});
|
||||
|
||||
test("has", function () {
|
||||
var obj = {foo: "bar", func: function () {} };
|
||||
ok (_.has(obj, "foo"), "has() checks that the object has a property.");
|
||||
ok (_.has(obj, "baz") == false, "has() returns false if the object doesn't have the property.");
|
||||
ok (_.has(obj, "func"), "has() works for functions too.");
|
||||
obj.hasOwnProperty = null;
|
||||
ok (_.has(obj, "foo"), "has() works even when the hasOwnProperty method is deleted.");
|
||||
var child = {};
|
||||
child.prototype = obj;
|
||||
ok (_.has(child, "foo") == false, "has() does not check the prototype chain for a property.")
|
||||
test('has', function () {
|
||||
var obj = {foo: 'bar', func: function(){}};
|
||||
ok(_.has(obj, 'foo'), 'has() checks that the object has a property.');
|
||||
ok(!_.has(obj, 'baz'), "has() returns false if the object doesn't have the property.");
|
||||
ok(_.has(obj, 'func'), 'has() works for functions too.');
|
||||
obj.hasOwnProperty = null;
|
||||
ok(_.has(obj, 'foo'), 'has() works even when the hasOwnProperty method is deleted.');
|
||||
var child = {};
|
||||
child.prototype = obj;
|
||||
ok(!_.has(child, 'foo'), 'has() does not check the prototype chain for a property.');
|
||||
strictEqual(_.has(null, 'foo'), false, 'has() returns false for null');
|
||||
strictEqual(_.has(undefined, 'foo'), false, 'has() returns false for undefined');
|
||||
});
|
||||
});
|
||||
|
||||
test('matches', function() {
|
||||
var moe = {name: 'Moe Howard', hair: true};
|
||||
var curly = {name: 'Curly Howard', hair: false};
|
||||
var stooges = [moe, curly];
|
||||
|
||||
equal(_.matches({hair: true})(moe), true, 'Returns a boolean');
|
||||
equal(_.matches({hair: true})(curly), false, 'Returns a boolean');
|
||||
|
||||
equal(_.matches({__x__: undefined})(5), false, 'can match undefined props on primitives');
|
||||
equal(_.matches({__x__: undefined})({__x__: undefined}), true, 'can match undefined props');
|
||||
|
||||
equal(_.matches({})(null), true, 'Empty spec called with null object returns true');
|
||||
equal(_.matches({a: 1})(null), false, 'Non-empty spec called with null object returns false');
|
||||
|
||||
ok(_.find(stooges, _.matches({hair: false})) === curly, 'returns a predicate that can be used by finding functions.');
|
||||
ok(_.find(stooges, _.matches(moe)) === moe, 'can be used to locate an object exists in a collection.');
|
||||
deepEqual(_.where([null, undefined], {a: 1}), [], 'Do not throw on null values.');
|
||||
|
||||
deepEqual(_.where([null, undefined], null), [null, undefined], 'null matches null');
|
||||
deepEqual(_.where([null, undefined], {}), [null, undefined], 'null matches {}');
|
||||
deepEqual(_.where([{b: 1}], {a: undefined}), [], 'handles undefined values (1683)');
|
||||
|
||||
_.each([true, 5, NaN, null, undefined], function(item) {
|
||||
deepEqual(_.where([{a: 1}], item), [{a: 1}], 'treats primitives as empty');
|
||||
});
|
||||
|
||||
function Prototest() {}
|
||||
Prototest.prototype.x = 1;
|
||||
var specObj = new Prototest;
|
||||
var protospec = _.matches(specObj);
|
||||
equal(protospec({x: 2}), true, 'spec is restricted to own properties');
|
||||
|
||||
specObj.y = 5;
|
||||
protospec = _.matches(specObj);
|
||||
equal(protospec({x: 1, y: 5}), true);
|
||||
equal(protospec({x: 1, y: 4}), false);
|
||||
|
||||
ok(_.matches({x: 1, y: 5})(specObj), 'inherited and own properties are checked on the test object');
|
||||
|
||||
Prototest.x = 5;
|
||||
ok(_.matches(Prototest)({x: 5, y: 1}), 'spec can be a function');
|
||||
|
||||
// #1729
|
||||
var o = {'b': 1};
|
||||
var m = _.matches(o);
|
||||
|
||||
equal(m({'b': 1}), true);
|
||||
o.b = 2;
|
||||
o.a = 1;
|
||||
equal(m({'b': 1}), true, 'changing spec object doesnt change matches result');
|
||||
|
||||
|
||||
//null edge cases
|
||||
var oCon = _.matches({'constructor': Object});
|
||||
deepEqual(_.map([null, undefined, 5, {}], oCon), [false, false, false, true], 'doesnt fasley match constructor on undefined/null');
|
||||
});
|
||||
|
||||
}());
|
||||
|
||||
205
vendor/underscore/test/utility.js
vendored
205
vendor/underscore/test/utility.js
vendored
@@ -1,8 +1,8 @@
|
||||
$(document).ready(function() {
|
||||
(function() {
|
||||
|
||||
var templateSettings;
|
||||
|
||||
module("Utility", {
|
||||
module('Utility', {
|
||||
|
||||
setup: function() {
|
||||
templateSettings = _.clone(_.templateSettings);
|
||||
@@ -14,54 +14,73 @@ $(document).ready(function() {
|
||||
|
||||
});
|
||||
|
||||
test("#750 - Return _ instance.", 2, function() {
|
||||
test('#750 - Return _ instance.', 2, function() {
|
||||
var instance = _([]);
|
||||
ok(_(instance) === instance);
|
||||
ok(new _(instance) === instance);
|
||||
});
|
||||
|
||||
test("identity", function() {
|
||||
test('identity', function() {
|
||||
var moe = {name : 'moe'};
|
||||
equal(_.identity(moe), moe, 'moe is the same as his identity');
|
||||
});
|
||||
|
||||
test("random", function() {
|
||||
test('constant', function() {
|
||||
var moe = {name : 'moe'};
|
||||
equal(_.constant(moe)(), moe, 'should create a function that returns moe');
|
||||
});
|
||||
|
||||
test('noop', function() {
|
||||
strictEqual(_.noop('curly', 'larry', 'moe'), undefined, 'should always return undefined');
|
||||
});
|
||||
|
||||
test('property', function() {
|
||||
var moe = {name : 'moe'};
|
||||
equal(_.property('name')(moe), 'moe', 'should return the property with the given name');
|
||||
});
|
||||
|
||||
test('random', function() {
|
||||
var array = _.range(1000);
|
||||
var min = Math.pow(2, 31);
|
||||
var max = Math.pow(2, 62);
|
||||
|
||||
ok(_.every(array, function() {
|
||||
return _.random(min, max) >= min;
|
||||
}), "should produce a random number greater than or equal to the minimum number");
|
||||
}), 'should produce a random number greater than or equal to the minimum number');
|
||||
|
||||
ok(_.some(array, function() {
|
||||
return _.random(Number.MAX_VALUE) > 0;
|
||||
}), "should produce a random number when passed `Number.MAX_VALUE`");
|
||||
}), 'should produce a random number when passed `Number.MAX_VALUE`');
|
||||
});
|
||||
|
||||
test("uniqueId", function() {
|
||||
test('now', function() {
|
||||
var diff = _.now() - new Date().getTime();
|
||||
ok(diff <= 0 && diff > -5, 'Produces the correct time in milliseconds');//within 5ms
|
||||
});
|
||||
|
||||
test('uniqueId', function() {
|
||||
var ids = [], i = 0;
|
||||
while(i++ < 100) ids.push(_.uniqueId());
|
||||
while (i++ < 100) ids.push(_.uniqueId());
|
||||
equal(_.uniq(ids).length, ids.length, 'can generate a globally-unique stream of ids');
|
||||
});
|
||||
|
||||
test("times", function() {
|
||||
test('times', function() {
|
||||
var vals = [];
|
||||
_.times(3, function (i) { vals.push(i); });
|
||||
ok(_.isEqual(vals, [0,1,2]), "is 0 indexed");
|
||||
deepEqual(vals, [0, 1, 2], 'is 0 indexed');
|
||||
//
|
||||
vals = [];
|
||||
_(3).times(function(i) { vals.push(i); });
|
||||
ok(_.isEqual(vals, [0,1,2]), "works as a wrapper");
|
||||
deepEqual(vals, [0, 1, 2], 'works as a wrapper');
|
||||
// collects return values
|
||||
ok(_.isEqual([0, 1, 2], _.times(3, function(i) { return i; })), "collects return values");
|
||||
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), []);
|
||||
});
|
||||
|
||||
test("mixin", function() {
|
||||
test('mixin', function() {
|
||||
_.mixin({
|
||||
myReverse: function(string) {
|
||||
return string.split('').reverse().join('');
|
||||
@@ -71,126 +90,159 @@ $(document).ready(function() {
|
||||
equal(_('champ').myReverse(), 'pmahc', 'mixed in a function to the OOP wrapper');
|
||||
});
|
||||
|
||||
test("_.escape", function() {
|
||||
equal(_.escape("Curly & Moe"), "Curly & Moe");
|
||||
equal(_.escape('<a href="http://moe.com">Curly & Moe\'s</a>'), '<a href="http://moe.com">Curly & Moe's</a>');
|
||||
equal(_.escape("Curly & Moe"), "Curly &amp; Moe");
|
||||
test('_.escape', function() {
|
||||
equal(_.escape(null), '');
|
||||
});
|
||||
|
||||
test("_.unescape", function() {
|
||||
var string = "Curly & Moe";
|
||||
equal(_.unescape("Curly & Moe"), string);
|
||||
equal(_.unescape('<a href="http://moe.com">Curly & Moe's</a>'), '<a href="http://moe.com">Curly & Moe\'s</a>');
|
||||
equal(_.unescape("Curly &amp; Moe"), "Curly & Moe");
|
||||
test('_.unescape', function() {
|
||||
var string = 'Curly & Moe';
|
||||
equal(_.unescape(null), '');
|
||||
equal(_.unescape(_.escape(string)), string);
|
||||
equal(_.unescape(string), string, 'don\'t unescape unnecessarily');
|
||||
});
|
||||
|
||||
test("template", function() {
|
||||
// Don't care what they escape them to just that they're escaped and can be unescaped
|
||||
test('_.escape & unescape', function() {
|
||||
// test & (&) 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');
|
||||
|
||||
str = 'a ' + escapeChar + escapeChar + escapeChar + 'some more string' + escapeChar;
|
||||
escaped = _.escape(str);
|
||||
|
||||
equal(escaped.indexOf(escapeChar), -1, 'can escape multiple occurances of ' + escapeChar);
|
||||
equal(_.unescape(escaped), str, '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) {
|
||||
return allEscaped.indexOf(escapeChar) !== -1;
|
||||
}), 'handles multiple characters');
|
||||
ok(allEscaped.indexOf(joiner) >= 0, 'can escape multiple escape characters at the same time');
|
||||
|
||||
// test & -> &
|
||||
var str = 'some string & another string & yet another';
|
||||
var escaped = _.escape(str);
|
||||
|
||||
ok(escaped.indexOf('&') !== -1, 'handles & aka &');
|
||||
equal(_.unescape(str), str, 'can unescape &');
|
||||
});
|
||||
|
||||
test('template', function() {
|
||||
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 sansSemicolonTemplate = _.template("A <% this %> B");
|
||||
equal(sansSemicolonTemplate(), "A B");
|
||||
var sansSemicolonTemplate = _.template('A <% this %> B');
|
||||
equal(sansSemicolonTemplate(), 'A B');
|
||||
|
||||
var backslashTemplate = _.template("<%= thing %> is \\ridanculous");
|
||||
equal(backslashTemplate({thing: 'This'}), "This is \\ridanculous");
|
||||
var backslashTemplate = _.template('<%= thing %> is \\ridanculous');
|
||||
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.');
|
||||
|
||||
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');
|
||||
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');
|
||||
|
||||
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');
|
||||
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');
|
||||
|
||||
var namespaceCollisionTemplate = _.template("<%= pageCount %> <%= thumbnails[pageCount] %> <% _.each(thumbnails, function(p) { %><div class=\"thumbnail\" rel=\"<%= p %>\"></div><% }); %>");
|
||||
var namespaceCollisionTemplate = _.template('<%= pageCount %> <%= thumbnails[pageCount] %> <% _.each(thumbnails, function(p) { %><div class="thumbnail" rel="<%= p %>"></div><% }); %>');
|
||||
result = namespaceCollisionTemplate({
|
||||
pageCount: 3,
|
||||
thumbnails: {
|
||||
1: "p1-thumbnail.gif",
|
||||
2: "p2-thumbnail.gif",
|
||||
3: "p3-thumbnail.gif"
|
||||
1: 'p1-thumbnail.gif',
|
||||
2: 'p2-thumbnail.gif',
|
||||
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>");
|
||||
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>");
|
||||
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>");
|
||||
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");
|
||||
|
||||
var quoteInStatementAndBody = _.template("<%\
|
||||
if(foo == 'bar'){ \
|
||||
%>Statement quotes and 'quotes'.<% } %>");
|
||||
equal(quoteInStatementAndBody({foo: "bar"}), "Statement quotes and 'quotes'.");
|
||||
var quoteInStatementAndBody = _.template('<% ' +
|
||||
" if(foo == 'bar'){ " +
|
||||
"%>Statement quotes and 'quotes'.<% } %>");
|
||||
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.');
|
||||
|
||||
var template = _.template("<i><%- value %></i>");
|
||||
var result = template({value: "<script>"});
|
||||
var template = _.template('<i><%- value %></i>');
|
||||
result = template({value: '<script>'});
|
||||
equal(result, '<i><script></i>');
|
||||
|
||||
var stooge = {
|
||||
name: "Moe",
|
||||
name: 'Moe',
|
||||
template: _.template("I'm <%= this.name %>")
|
||||
};
|
||||
equal(stooge.template(), "I'm Moe");
|
||||
|
||||
if (!$.browser.msie) {
|
||||
var fromHTML = _.template($('#template').html());
|
||||
equal(fromHTML({data : 12345}).replace(/\s/g, ''), '<li>24690</li>');
|
||||
}
|
||||
template = _.template('\n ' +
|
||||
' <%\n ' +
|
||||
' // a comment\n ' +
|
||||
' if (data) { data += 12345; }; %>\n ' +
|
||||
' <li><%= data %></li>\n '
|
||||
);
|
||||
equal(template({data : 12345}).replace(/\s/g, ''), '<li>24690</li>');
|
||||
|
||||
_.templateSettings = {
|
||||
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');
|
||||
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');
|
||||
|
||||
var customQuote = _.template("It's its, not it's");
|
||||
equal(customQuote({}), "It's its, not it's");
|
||||
|
||||
var quoteInStatementAndBody = _.template("{{ if(foo == 'bar'){ }}Statement quotes and 'quotes'.{{ } }}");
|
||||
equal(quoteInStatementAndBody({foo: "bar"}), "Statement quotes and 'quotes'.");
|
||||
quoteInStatementAndBody = _.template("{{ if(foo == 'bar'){ }}Statement quotes and 'quotes'.{{ } }}");
|
||||
equal(quoteInStatementAndBody({foo: 'bar'}), "Statement quotes and 'quotes'.");
|
||||
|
||||
_.templateSettings = {
|
||||
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');
|
||||
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');
|
||||
|
||||
var customWithSpecialCharsQuote = _.template("It's its, not it's");
|
||||
equal(customWithSpecialCharsQuote({}), "It's its, not it's");
|
||||
|
||||
var quoteInStatementAndBody = _.template("<? if(foo == 'bar'){ ?>Statement quotes and 'quotes'.<? } ?>");
|
||||
equal(quoteInStatementAndBody({foo: "bar"}), "Statement quotes and 'quotes'.");
|
||||
quoteInStatementAndBody = _.template("<? if(foo == 'bar'){ ?>Statement quotes and 'quotes'.<? } ?>");
|
||||
equal(quoteInStatementAndBody({foo: 'bar'}), "Statement quotes and 'quotes'.");
|
||||
|
||||
_.templateSettings = {
|
||||
interpolate : /\{\{(.+?)\}\}/g
|
||||
};
|
||||
|
||||
var mustache = _.template("Hello {{planet}}!");
|
||||
equal(mustache({planet : "World"}), "Hello World!", "can mimic mustache.js");
|
||||
var mustache = _.template('Hello {{planet}}!');
|
||||
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");
|
||||
var templateWithNull = _.template('a null undefined {{planet}}');
|
||||
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() {
|
||||
@@ -219,7 +271,8 @@ $(document).ready(function() {
|
||||
test('_.templateSettings.variable', function() {
|
||||
var s = '<%=data.x%>';
|
||||
var data = {x: 'x'};
|
||||
strictEqual(_.template(s, data, {variable: 'data'}), 'x');
|
||||
var tmp = _.template(s, {variable: 'data'});
|
||||
strictEqual(tmp(data), 'x');
|
||||
_.templateSettings.variable = 'data';
|
||||
strictEqual(_.template(s)(data), 'x');
|
||||
});
|
||||
@@ -240,22 +293,22 @@ $(document).ready(function() {
|
||||
strictEqual(templateEscaped({x: undefined}), '');
|
||||
|
||||
var templateWithProperty = _.template('<%=x.foo%>');
|
||||
strictEqual(templateWithProperty({x: {} }), '');
|
||||
strictEqual(templateWithProperty({x: {} }), '');
|
||||
strictEqual(templateWithProperty({x: {}}), '');
|
||||
strictEqual(templateWithProperty({x: {}}), '');
|
||||
|
||||
var templateWithPropertyEscaped = _.template('<%-x.foo%>');
|
||||
strictEqual(templateWithPropertyEscaped({x: {} }), '');
|
||||
strictEqual(templateWithPropertyEscaped({x: {} }), '');
|
||||
strictEqual(templateWithPropertyEscaped({x: {}}), '');
|
||||
strictEqual(templateWithPropertyEscaped({x: {}}), '');
|
||||
});
|
||||
|
||||
test('interpolate evaluates code only once.', 2, function() {
|
||||
var count = 0;
|
||||
var template = _.template('<%= f() %>');
|
||||
template({f: function(){ ok(!(count++)); }});
|
||||
template({f: function(){ ok(!count++); }});
|
||||
|
||||
var countEscaped = 0;
|
||||
var templateEscaped = _.template('<%- f() %>');
|
||||
templateEscaped({f: function(){ ok(!(countEscaped++)); }});
|
||||
templateEscaped({f: function(){ ok(!countEscaped++); }});
|
||||
});
|
||||
|
||||
test('#746 - _.template settings are not modified.', 1, function() {
|
||||
@@ -269,4 +322,4 @@ $(document).ready(function() {
|
||||
strictEqual(template(), '<<\nx\n>>');
|
||||
});
|
||||
|
||||
});
|
||||
}());
|
||||
|
||||
6
vendor/underscore/underscore-min.js
vendored
6
vendor/underscore/underscore-min.js
vendored
File diff suppressed because one or more lines are too long
1023
vendor/underscore/underscore.js
vendored
1023
vendor/underscore/underscore.js
vendored
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user