Compare commits
393 Commits
1.0.0-rc.3
...
1.2.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dd5fda0690 | ||
|
|
2276df07bd | ||
|
|
758ff03520 | ||
|
|
c3ac172960 | ||
|
|
562b4eb531 | ||
|
|
b1f8e845df | ||
|
|
bda869ea54 | ||
|
|
19cfbf082a | ||
|
|
07078bdd1f | ||
|
|
03657a98e1 | ||
|
|
b3f64abfae | ||
|
|
5d73c8f002 | ||
|
|
ba0882762d | ||
|
|
bb8855b628 | ||
|
|
883d5917f5 | ||
|
|
0275e99fe2 | ||
|
|
5d109077e5 | ||
|
|
540851ab6a | ||
|
|
6b920fa5e6 | ||
|
|
d1498bb9fb | ||
|
|
54eeef173a | ||
|
|
723ddf8cda | ||
|
|
9f12552907 | ||
|
|
a8b6fa413e | ||
|
|
76aae8ce42 | ||
|
|
ad0c287053 | ||
|
|
4a11a3559d | ||
|
|
1faa5a80e4 | ||
|
|
f1d3df1ec0 | ||
|
|
e7c94d3351 | ||
|
|
954f76dcf5 | ||
|
|
43037c0ff9 | ||
|
|
93df901b71 | ||
|
|
e97e645eda | ||
|
|
4a03ba3874 | ||
|
|
7f637e4acc | ||
|
|
8f3eeefafd | ||
|
|
5dc550a0ce | ||
|
|
6fe322da27 | ||
|
|
3cfe7c9a56 | ||
|
|
be7d5917cb | ||
|
|
ca28aa6ebd | ||
|
|
e76360c1b5 | ||
|
|
265ca8ba67 | ||
|
|
b0d942d0ec | ||
|
|
6c25905ae4 | ||
|
|
80a39393fe | ||
|
|
d4aed71abf | ||
|
|
ebb72bb992 | ||
|
|
8ffcd30b4d | ||
|
|
06804c37e2 | ||
|
|
1acca0278c | ||
|
|
639c8d4171 | ||
|
|
d77c9d3fca | ||
|
|
2c7cc2c191 | ||
|
|
d7c74b8004 | ||
|
|
aaa8003418 | ||
|
|
86890b13c6 | ||
|
|
39158b0eb6 | ||
|
|
87f1d55bc2 | ||
|
|
14343b5410 | ||
|
|
ffdac30b3c | ||
|
|
244c8dc391 | ||
|
|
e593344461 | ||
|
|
74c46f6e93 | ||
|
|
bbfd8aa249 | ||
|
|
2705a488ad | ||
|
|
850c253e08 | ||
|
|
80e0e3fcd7 | ||
|
|
2cc2d696f1 | ||
|
|
8a83a6b5be | ||
|
|
002d5338a0 | ||
|
|
743aa472f0 | ||
|
|
ba85d5d351 | ||
|
|
4e2ef908dc | ||
|
|
f5dd05ba8e | ||
|
|
17eda2a4cc | ||
|
|
d219c6e019 | ||
|
|
2dc539747b | ||
|
|
e941de50e8 | ||
|
|
63052257a2 | ||
|
|
ac5d2a714e | ||
|
|
59f78c16b1 | ||
|
|
3f7f8133df | ||
|
|
fef5e1ce2c | ||
|
|
0b97b3864f | ||
|
|
3d1330c85d | ||
|
|
041c0cc322 | ||
|
|
e72712640c | ||
|
|
6830195127 | ||
|
|
f9b5d6644d | ||
|
|
40f9eeda36 | ||
|
|
0fa0b0b1ea | ||
|
|
ff0b23f200 | ||
|
|
5456d4081b | ||
|
|
8948fae780 | ||
|
|
ee4542a699 | ||
|
|
31e4e631f9 | ||
|
|
cbf20b3271 | ||
|
|
a65fd50723 | ||
|
|
63a6aac2d8 | ||
|
|
afde4804c9 | ||
|
|
bc8ec9cd3e | ||
|
|
b63ab18e29 | ||
|
|
e7325f58c3 | ||
|
|
7b35bb8c96 | ||
|
|
e84671ce5d | ||
|
|
b01d50fe05 | ||
|
|
3f163051b1 | ||
|
|
4f1d03e1d4 | ||
|
|
fc39e4a225 | ||
|
|
bf88ad7fc8 | ||
|
|
11ba02067e | ||
|
|
952afa05ce | ||
|
|
3131cc3160 | ||
|
|
792f768479 | ||
|
|
ff312a15dd | ||
|
|
36207c9a98 | ||
|
|
b92105e888 | ||
|
|
35bd7c55d0 | ||
|
|
9f19c302d8 | ||
|
|
87b1ac776f | ||
|
|
41e401b05e | ||
|
|
d88da3589d | ||
|
|
9638c393bb | ||
|
|
9961ddc2a8 | ||
|
|
2d40dfd8d4 | ||
|
|
99c9bdf71d | ||
|
|
4fcd25ec88 | ||
|
|
440218da67 | ||
|
|
fefdb9fc8d | ||
|
|
21a0eff593 | ||
|
|
8825a094ae | ||
|
|
aa49ce5c56 | ||
|
|
1522d3385d | ||
|
|
510c41440a | ||
|
|
aa0c34ba1c | ||
|
|
af87e6ef62 | ||
|
|
30291ce6e6 | ||
|
|
890c2eb564 | ||
|
|
67a269b89c | ||
|
|
4b9ee81a78 | ||
|
|
4343f4d229 | ||
|
|
2162baa6c0 | ||
|
|
7e7f792710 | ||
|
|
1bbd9e24b0 | ||
|
|
6435aaa64f | ||
|
|
999aae0a33 | ||
|
|
ba795639b4 | ||
|
|
4c4b205721 | ||
|
|
b3c550b7c0 | ||
|
|
eb8953e784 | ||
|
|
b88b292d5d | ||
|
|
5f42c3b319 | ||
|
|
5b27ae0371 | ||
|
|
f26b1da1b5 | ||
|
|
7a853e2dcb | ||
|
|
9b22748bd0 | ||
|
|
c1e9dd3373 | ||
|
|
8cbbc47043 | ||
|
|
81b3567133 | ||
|
|
fc6568f390 | ||
|
|
8e30fe2946 | ||
|
|
6c811a3261 | ||
|
|
afbe5aa540 | ||
|
|
324afd2d6c | ||
|
|
58d94ef61e | ||
|
|
39974b0982 | ||
|
|
323d7306e2 | ||
|
|
251e228ce4 | ||
|
|
a99f3f217a | ||
|
|
e2acbee113 | ||
|
|
37b69eddf2 | ||
|
|
f0322e6f2c | ||
|
|
756587d080 | ||
|
|
1ad2c92324 | ||
|
|
e5433adf78 | ||
|
|
ed765f75d8 | ||
|
|
4136f1b377 | ||
|
|
860339b90e | ||
|
|
03254a0c0f | ||
|
|
a76081c979 | ||
|
|
71a207079f | ||
|
|
f6e724c4c5 | ||
|
|
4251b36b25 | ||
|
|
b8f39cbfdf | ||
|
|
088c621862 | ||
|
|
2459a53350 | ||
|
|
7093e9c0d4 | ||
|
|
4bc49978d1 | ||
|
|
96bac9c149 | ||
|
|
8dcc15f4d3 | ||
|
|
8183740c04 | ||
|
|
25e4231d7b | ||
|
|
3ed9e0e905 | ||
|
|
45bec0c440 | ||
|
|
5133e39d45 | ||
|
|
cb3b4e446e | ||
|
|
9829a2f3b4 | ||
|
|
7eadf11145 | ||
|
|
2a2bc44f43 | ||
|
|
9ccfa5cec9 | ||
|
|
02687f3c78 | ||
|
|
7ea7a6cbb1 | ||
|
|
a15a28fe5b | ||
|
|
265dedfae1 | ||
|
|
5ddbb8bc56 | ||
|
|
4101b8e937 | ||
|
|
56b6d50479 | ||
|
|
506f585d78 | ||
|
|
577dfb7220 | ||
|
|
7e4286adde | ||
|
|
1090228628 | ||
|
|
aeea861b73 | ||
|
|
997c43bbdd | ||
|
|
958d4dbd2e | ||
|
|
f2b350eb62 | ||
|
|
a3464780a1 | ||
|
|
fe1eb92196 | ||
|
|
0b2d26ec92 | ||
|
|
8024a25f2b | ||
|
|
d287ecbb34 | ||
|
|
d9c95e7730 | ||
|
|
c3b1af31ce | ||
|
|
465576b5cb | ||
|
|
9ecbcd0075 | ||
|
|
c1f62d72ae | ||
|
|
1b27834c41 | ||
|
|
77804907b6 | ||
|
|
9dfa2609be | ||
|
|
8ffb3ab3c4 | ||
|
|
65e1da34fa | ||
|
|
282110807c | ||
|
|
25e5f43d1c | ||
|
|
ce0441694d | ||
|
|
db29699927 | ||
|
|
9a4e2d7617 | ||
|
|
fbf64585b7 | ||
|
|
6d1c6dfd16 | ||
|
|
e78df4d981 | ||
|
|
a757b4d5dc | ||
|
|
d28036ee91 | ||
|
|
d2ba0d4e7a | ||
|
|
5787436177 | ||
|
|
f5ab24b8d2 | ||
|
|
05c0f32a24 | ||
|
|
7b918f77a9 | ||
|
|
d87929d61c | ||
|
|
a926829c33 | ||
|
|
d58e366c40 | ||
|
|
0fb4f7e1c4 | ||
|
|
6ee606e3e2 | ||
|
|
22d4a7690f | ||
|
|
f3a2f5018a | ||
|
|
d2a7589f7c | ||
|
|
f87b4e04f1 | ||
|
|
b5aa4c1f0c | ||
|
|
0c1eb6d288 | ||
|
|
8a03c5f998 | ||
|
|
60aa50ae45 | ||
|
|
aae6bbbb66 | ||
|
|
5ca903c428 | ||
|
|
e86b07f760 | ||
|
|
d7fea5dc78 | ||
|
|
c1eff5aebb | ||
|
|
f2dc490d6f | ||
|
|
b296e1b340 | ||
|
|
8adb060edb | ||
|
|
c3b984fea7 | ||
|
|
afbb2c338b | ||
|
|
6632241ab5 | ||
|
|
be50df81db | ||
|
|
9763b6e2cf | ||
|
|
812b848daf | ||
|
|
4907a7389f | ||
|
|
17dff36b65 | ||
|
|
904921d8c4 | ||
|
|
ac4c075d32 | ||
|
|
ddde64ece9 | ||
|
|
91c097e88d | ||
|
|
894658a3f5 | ||
|
|
a4454ea5f9 | ||
|
|
8ea8fa3a8a | ||
|
|
7480603295 | ||
|
|
079b749d5d | ||
|
|
4815600e85 | ||
|
|
1c63e2d295 | ||
|
|
cf13eca58c | ||
|
|
3cf4607870 | ||
|
|
23c3ba6ad7 | ||
|
|
17fc3c2317 | ||
|
|
af234cbe54 | ||
|
|
c8517c0ec9 | ||
|
|
20b226454b | ||
|
|
98eccf223a | ||
|
|
0fc2ab4d41 | ||
|
|
641b6efe7f | ||
|
|
4c83435b4b | ||
|
|
9f7319cff4 | ||
|
|
dd9baa1502 | ||
|
|
41b4d0daa1 | ||
|
|
e41b181163 | ||
|
|
288ac115d0 | ||
|
|
6774d46a6f | ||
|
|
607abf89f7 | ||
|
|
27f1e5e2f2 | ||
|
|
a457675ce1 | ||
|
|
82049096e6 | ||
|
|
6c965e0223 | ||
|
|
8b4d952929 | ||
|
|
873cc63f94 | ||
|
|
39fc839ff2 | ||
|
|
4edef4c959 | ||
|
|
1d9ced8037 | ||
|
|
4cb77d1429 | ||
|
|
b52d9d1bdd | ||
|
|
5fe7ca5e70 | ||
|
|
62fb440de2 | ||
|
|
96fbd7c7ba | ||
|
|
c9bec8e636 | ||
|
|
769e03e7f2 | ||
|
|
ab83f2d5e2 | ||
|
|
b60d0cdb17 | ||
|
|
677503dbf1 | ||
|
|
25efa29470 | ||
|
|
21a90f8f8f | ||
|
|
64e8d6ae99 | ||
|
|
16a204335e | ||
|
|
0a53f762fe | ||
|
|
6ba4778c1b | ||
|
|
0404c2266c | ||
|
|
e5e914282f | ||
|
|
9867d4bdc3 | ||
|
|
e4cb7112cf | ||
|
|
2d202e90b7 | ||
|
|
016391e442 | ||
|
|
1eff48a429 | ||
|
|
ce33af6bb5 | ||
|
|
fb9d4303f1 | ||
|
|
4e631c9e8f | ||
|
|
766d67d80d | ||
|
|
e2c2a37221 | ||
|
|
2b23020695 | ||
|
|
8d43c6b1a8 | ||
|
|
7362dd1a7c | ||
|
|
316caf7e8c | ||
|
|
87dc6631ee | ||
|
|
62246d7d43 | ||
|
|
a14be3a42c | ||
|
|
7fdf00d5e9 | ||
|
|
99e02f30fb | ||
|
|
716a5b9b5a | ||
|
|
87f880ca52 | ||
|
|
8ec7b84a78 | ||
|
|
05cf5bc8db | ||
|
|
ac25e21a0c | ||
|
|
cc1e0daaa4 | ||
|
|
f4120a9c8c | ||
|
|
e3b80a5e09 | ||
|
|
ef7cb26b01 | ||
|
|
408a5c168f | ||
|
|
0ad6ac95b2 | ||
|
|
bda4747e9c | ||
|
|
bd8f882c94 | ||
|
|
32b5b5b1c4 | ||
|
|
c1e543c9fe | ||
|
|
3908fa5c57 | ||
|
|
1b347fc185 | ||
|
|
282a5e0b01 | ||
|
|
e9d23cc1ea | ||
|
|
34173fd60f | ||
|
|
d0d3c8ef57 | ||
|
|
11912008dd | ||
|
|
c122007e17 | ||
|
|
69dfa1a175 | ||
|
|
bfea443e55 | ||
|
|
680798c28f | ||
|
|
9f0cc45c45 | ||
|
|
0ac97f467f | ||
|
|
647746ea72 | ||
|
|
7bea30b2e6 | ||
|
|
12bc852c89 | ||
|
|
0d42e84045 | ||
|
|
897b85b607 | ||
|
|
5c55cf0efb | ||
|
|
eccd6463f6 | ||
|
|
4a0897c734 | ||
|
|
c86a16df7f | ||
|
|
2ae0e9d902 | ||
|
|
bba18cd56b | ||
|
|
2f20781e16 | ||
|
|
3bee212876 | ||
|
|
6c8893a550 |
4
.gitattributes
vendored
@@ -1 +1,5 @@
|
||||
* text=auto
|
||||
*.js text eol=lf
|
||||
*.jst text eol=lf
|
||||
*.sh text eol=lf
|
||||
*.tpl text eol=lf
|
||||
|
||||
6
.gitignore
vendored
@@ -1,5 +1,5 @@
|
||||
.DS_Store
|
||||
*.custom.*
|
||||
node_modules/
|
||||
vendor/closure-compiler/
|
||||
vendor/uglifyjs/
|
||||
node_modules
|
||||
vendor/closure-compiler
|
||||
vendor/uglifyjs
|
||||
|
||||
14
.jamignore
@@ -1,12 +1,14 @@
|
||||
.*
|
||||
*.custom.*
|
||||
*.d.ts
|
||||
*.md
|
||||
*.txt
|
||||
build.js
|
||||
index.js
|
||||
build/
|
||||
doc/
|
||||
node_modules/
|
||||
perf/
|
||||
test/
|
||||
vendor/
|
||||
bower.json
|
||||
build
|
||||
doc
|
||||
node_modules
|
||||
perf
|
||||
test
|
||||
vendor
|
||||
|
||||
34
.npmignore
@@ -1,25 +1,23 @@
|
||||
.*
|
||||
*.custom.*
|
||||
*.d.ts
|
||||
doc/*.php
|
||||
node_modules/
|
||||
perf/*.html
|
||||
perf/*-ui.js
|
||||
perf/*.sh
|
||||
test/*.html
|
||||
test/*-ui.js
|
||||
test/*.sh
|
||||
*.md
|
||||
bower.json
|
||||
doc
|
||||
node_modules
|
||||
perf
|
||||
test
|
||||
vendor/*.gz
|
||||
vendor/backbone/
|
||||
vendor/benchmark.js/*.jar
|
||||
vendor/backbone
|
||||
vendor/benchmark.js
|
||||
vendor/closure-compiler
|
||||
vendor/docdown
|
||||
vendor/firebug-lite/
|
||||
vendor/json3/
|
||||
vendor/jquery/
|
||||
vendor/qunit/qunit/*.css
|
||||
vendor/qunit/qunit/*-1.8.0.js
|
||||
vendor/requirejs/
|
||||
vendor/underscore/*-min.js
|
||||
vendor/firebug-lite
|
||||
vendor/jquery
|
||||
vendor/json3
|
||||
vendor/platform.js
|
||||
vendor/qunit
|
||||
vendor/qunit-clib
|
||||
vendor/requirejs
|
||||
vendor/uglifyjs
|
||||
vendor/underscore/test/
|
||||
vendor/underscore
|
||||
|
||||
19
.travis.yml
@@ -1,7 +1,20 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- 0.6
|
||||
- 0.8
|
||||
- 0.9
|
||||
env:
|
||||
- TEST_COMMAND="phantomjs ./test/test.js ../dist/lodash.compat.js"
|
||||
- TEST_COMMAND="phantomjs ./test/test.js ../dist/lodash.compat.min.js"
|
||||
- TEST_COMMAND="node ./test/test.js ../dist/lodash.js"
|
||||
- TEST_COMMAND="node ./test/test.js ../dist/lodash.min.js"
|
||||
- TEST_COMMAND="node ./test/test-build.js --time-limit 49m30s"
|
||||
git:
|
||||
depth: 1
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
before_script:
|
||||
- "curl -H 'Accept: application/vnd.github.v3.raw' https://api.github.com/repos/bestiejs/lodash/git/blobs/a2787b470c577cee2404d186c562dd9835f779f5 | tar xvz -C vendor"
|
||||
- "curl -H 'Accept: application/vnd.github.v3.raw' https://api.github.com/repos/bestiejs/lodash/git/blobs/7ecae09d413eb48dd5785fe877f24e60ac3bbcef | tar xvz -C vendor"
|
||||
- "tar -xzvf vendor/closure-compiler.tar.gz -C vendor"
|
||||
- "tar -xzvf vendor/uglifyjs.tar.gz -C vendor"
|
||||
script:
|
||||
$TEST_COMMAND
|
||||
|
||||
@@ -7,12 +7,12 @@ Please make sure to [search the issue tracker](https://github.com/bestiejs/lodas
|
||||
|
||||
Include updated unit tests in the `test` directory as part of your pull request.
|
||||
You can run the tests from the command line via `npm test`, or open `test/index.html` in a web browser.
|
||||
The `test/run-test.sh` script attempts to run the tests in [Rhino](http://www.mozilla.org/rhino/), [RingoJS](http://ringojs.org/), [Narwhal](https://github.com/280north/narwhal), and [Node](http://nodejs.org/), before running them in your default 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.
|
||||
|
||||
## Contributor License Agreement
|
||||
|
||||
Lo-Dash is preparing to join [Dojo Foundation](http://dojofoundation.org/).
|
||||
Lo-Dash 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/).
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Copyright 2012 John-David Dalton <http://allyoucanleet.com/>
|
||||
Based on Underscore.js 1.4.3, copyright 2009-2012 Jeremy Ashkenas,
|
||||
DocumentCloud Inc. <http://documentcloud.github.com/underscore>
|
||||
Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/>
|
||||
Based on Underscore.js 1.4.3, copyright 2009-2013 Jeremy Ashkenas,
|
||||
DocumentCloud Inc. <http://underscorejs.org/>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
|
||||
184
README.md
@@ -1,23 +1,28 @@
|
||||
# Lo-Dash <sup>v1.0.0-rc.3</sup>
|
||||
[](http://travis-ci.org/bestiejs/lodash)
|
||||
# Lo-Dash <sup>v1.2.0</sup>
|
||||
|
||||
An alternative to Underscore.js, delivering [consistency](https://github.com/bestiejs/lodash#resolved-underscorejs-issues), [customization](https://github.com/bestiejs/lodash#custom-builds), [performance](http://lodash.com/benchmarks), and [extra features](https://github.com/bestiejs/lodash#features).
|
||||
A low-level utility library delivering consistency, [customization](https://github.com/bestiejs/lodash#custom-builds), [performance](http://lodash.com/benchmarks), and [extra features](https://github.com/bestiejs/lodash#features).
|
||||
|
||||
## Download
|
||||
|
||||
* Lo-Dash builds:<br>
|
||||
[Development](https://raw.github.com/bestiejs/lodash/v1.0.0-rc.3/lodash.js) and
|
||||
[Production](https://raw.github.com/bestiejs/lodash/v1.0.0-rc.3/lodash.min.js)
|
||||
* Lo-Dash builds (for modern environments):<br>
|
||||
[Development](https://raw.github.com/bestiejs/lodash/v1.2.0/dist/lodash.js) and
|
||||
[Production](https://raw.github.com/bestiejs/lodash/v1.2.0/dist/lodash.min.js)
|
||||
|
||||
* Lo-Dash compatibility builds (for legacy and modern environments):<br>
|
||||
[Development](https://raw.github.com/bestiejs/lodash/v1.2.0/dist/lodash.compat.js) and
|
||||
[Production](https://raw.github.com/bestiejs/lodash/v1.2.0/dist/lodash.compat.min.js)
|
||||
|
||||
* Underscore compatibility builds:<br>
|
||||
[Development](https://raw.github.com/bestiejs/lodash/v1.0.0-rc.3/lodash.underscore.js) and
|
||||
[Production](https://raw.github.com/bestiejs/lodash/v1.0.0-rc.3/lodash.underscore.min.js)
|
||||
[Development](https://raw.github.com/bestiejs/lodash/v1.2.0/dist/lodash.underscore.js) and
|
||||
[Production](https://raw.github.com/bestiejs/lodash/v1.2.0/dist/lodash.underscore.min.js)
|
||||
|
||||
* CDN copies of ≤ v1.0.0-rc.3’s builds are available on [cdnjs](http://cdnjs.com/) thanks to [CloudFlare](http://www.cloudflare.com/):<br>
|
||||
[Lo-Dash dev](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.0.0-rc.3/lodash.js),
|
||||
[Lo-Dash prod](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.0.0-rc.3/lodash.min.js),
|
||||
[Underscore compat-dev](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.0.0-rc.3/lodash.underscore.js), and
|
||||
[Underscore compat-prod](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.0.0-rc.3/lodash.underscore.min.js)
|
||||
* CDN copies of ≤ v1.2.0’s builds are available on [cdnjs](http://cdnjs.com/) thanks to [CloudFlare](http://www.cloudflare.com/):<br>
|
||||
[Lo-Dash dev](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.2.0/lodash.js),
|
||||
[Lo-Dash prod](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.2.0/lodash.min.js),<br>
|
||||
[Lo-Dash compat-dev](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.2.0/lodash.compat.js),
|
||||
[Lo-Dash compat-prod](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.2.0/lodash.compat.min.js),<br>
|
||||
[Underscore compat-dev](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.2.0/lodash.underscore.js), and
|
||||
[Underscore compat-prod](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.2.0/lodash.underscore.min.js)
|
||||
|
||||
* For optimal file size, [create a custom build](https://github.com/bestiejs/lodash#custom-builds) with only the features you need
|
||||
|
||||
@@ -27,38 +32,54 @@ We’ve got [API docs](http://lodash.com/docs), [benchmarks](http://lodash.com/b
|
||||
|
||||
For a list of upcoming features, check out our [roadmap](https://github.com/bestiejs/lodash/wiki/Roadmap).
|
||||
|
||||
## Screencasts
|
||||
## Resources
|
||||
|
||||
For more information check out these screencasts over Lo-Dash:
|
||||
For more information check out these articles, screencasts, and other videos over Lo-Dash:
|
||||
|
||||
* [Introducing Lo-Dash](https://vimeo.com/44154599)
|
||||
* [Lo-Dash optimizations and custom builds](https://vimeo.com/44154601)
|
||||
* [Lo-Dash’s origin and why it’s a better utility belt](https://vimeo.com/44154600)
|
||||
* [Unit testing in Lo-Dash](https://vimeo.com/45865290)
|
||||
* [Lo-Dash’s approach to native method use](https://vimeo.com/48576012)
|
||||
* [CascadiaJS: Lo-Dash for a better utility belt](http://www.youtube.com/watch?v=dpPy4f_SeEk)
|
||||
* Posts
|
||||
- [Say “Hello” to Lo-Dash](http://kitcambridge.be/blog/say-hello-to-lo-dash/)
|
||||
|
||||
* Videos
|
||||
- [Introducing Lo-Dash](https://vimeo.com/44154599)
|
||||
- [Lo-Dash optimizations and custom builds](https://vimeo.com/44154601)
|
||||
- [Lo-Dash’s origin and why it’s a better utility belt](https://vimeo.com/44154600)
|
||||
- [Unit testing in Lo-Dash](https://vimeo.com/45865290)
|
||||
- [Lo-Dash’s approach to native method use](https://vimeo.com/48576012)
|
||||
- [CascadiaJS: Lo-Dash for a better utility belt](http://www.youtube.com/watch?v=dpPy4f_SeEk)
|
||||
|
||||
## Features
|
||||
|
||||
* AMD loader support ([RequireJS](http://requirejs.org/), [curl.js](https://github.com/cujojs/curl), 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”* defined](http://michaux.ca/articles/lazy-function-definition-pattern) methods
|
||||
* [_.cloneDeep](http://lodash.com/docs#cloneDeep) for *“deep”* cloning arrays and objects
|
||||
* [_.cloneDeep](http://lodash.com/docs#cloneDeep) for deep cloning arrays and objects
|
||||
* [_.contains](http://lodash.com/docs#contains) accepts a `fromIndex` argument
|
||||
* [_.debounce](http://lodash.com/docs#debounce) and [_.throttle](http://lodash.com/docs#throttle) accept an `options` argument for more control
|
||||
* [_.createCallback](http://lodash.com/docs#createCallback) to customize how callback arguments are handled and support callback shorthands in mixins
|
||||
* [_.findIndex](http://lodash.com/docs#findIndex) and [_.findKey](http://lodash.com/docs#findKey) for finding indexes and keys of collections
|
||||
* [_.forEach](http://lodash.com/docs#forEach) is chainable and supports exiting iteration early
|
||||
* [_.forIn](http://lodash.com/docs#forIn) for iterating over an object’s own and inherited properties
|
||||
* [_.forOwn](http://lodash.com/docs#forOwn) for iterating over an object’s own properties
|
||||
* [_.isPlainObject](http://lodash.com/docs#isPlainObject) checks if values are created by the `Object` constructor
|
||||
* [_.merge](http://lodash.com/docs#merge) for a *“deep”* [_.extend](http://lodash.com/docs#extend)
|
||||
* [_.partial](http://lodash.com/docs#partial) for partial application without `this` binding
|
||||
* [_.pick](http://lodash.com/docs#pick) and [_.omit](http://lodash.com/docs#omit) accepts `callback` and `thisArg` arguments
|
||||
* [_.template](http://lodash.com/docs#template) supports [ES6 template delimiters](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-7.8.6) and utilizes [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) for easier debugging
|
||||
* [_.merge](http://lodash.com/docs#merge) for a deep [_.extend](http://lodash.com/docs#extend)
|
||||
* [_.parseInt](http://lodash.com/docs#parseInt) for consistent cross-environment behavior
|
||||
* [_.partial](http://lodash.com/docs#partial) and [_.partialRight](http://lodash.com/docs#partialRight) for partial application without `this` binding
|
||||
* [_.runInContext](http://lodash.com/docs#runInContext) for easier mocking and extended environment support
|
||||
* [_.support](http://lodash.com/docs#support) to flag environment features
|
||||
* [_.template](http://lodash.com/docs#template) supports [*“imports”* options](http://lodash.com/docs#templateSettings_imports), [ES6 template delimiters](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-7.8.6), and [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
|
||||
* [_.unzip](http://lodash.com/docs#unzip) as the inverse of [_.zip](http://lodash.com/docs#zip)
|
||||
* [_.where](http://lodash.com/docs#where) supports deep object comparisons
|
||||
* [_.clone](http://lodash.com/docs#clone), [_.omit](http://lodash.com/docs#omit), [_.pick](http://lodash.com/docs#pick),
|
||||
[and more…](http://lodash.com/docs "_.assign, _.cloneDeep, _.first, _.initial, _.isEqual, _.last, _.merge, _.rest") accept `callback` and `thisArg` arguments
|
||||
* [_.contains](http://lodash.com/docs#contains), [_.size](http://lodash.com/docs#size), [_.toArray](http://lodash.com/docs#toArray),
|
||||
[and more…](http://lodash.com/docs "_.countBy, _.every, _.filter, _.find, _.forEach, _.groupBy, _.invoke, _.map, _.max, _.min, _.pluck, _.reduce, _.reduceRight, _.reject, _.shuffle, _.some, _.sortBy, _.where") accept strings
|
||||
[and more…](http://lodash.com/docs "_.at, _.countBy, _.every, _.filter, _.find, _.forEach, _.groupBy, _.invoke, _.map, _.max, _.min, _.pluck, _.reduce, _.reduceRight, _.reject, _.shuffle, _.some, _.sortBy, _.where") accept strings
|
||||
* [_.filter](http://lodash.com/docs#filter), [_.find](http://lodash.com/docs#find), [_.map](http://lodash.com/docs#map),
|
||||
[and more…](http://lodash.com/docs "_.countBy, _.every, _.first, _.groupBy, _.initial, _.last, _.max, _.min, _.reject, _.rest, _.some, _.sortBy, _.sortedIndex, _.uniq") support *“_.pluck”* and *“_.where”* `callback` shorthands
|
||||
|
||||
## Support
|
||||
|
||||
Lo-Dash has been tested in at least Chrome 5~23, Firefox 1~17, IE 6-10, Opera 9.25-12, Safari 3-6, Node.js 0.4.8-0.8.16, Narwhal 0.3.2, RingoJS 0.8, and Rhino 1.7RC5.
|
||||
Lo-Dash has been tested in at least Chrome 5~26, Firefox 2~19, IE 6-10, Opera 9.25~12, Safari 3-6, Node.js 0.4.8-0.10.4, Narwhal 0.3.2, PhantomJS 1.9.0, RingoJS 0.9, and Rhino 1.7RC5.
|
||||
|
||||
## Custom builds
|
||||
|
||||
@@ -70,18 +91,17 @@ To top it off, we handle all method dependency and alias mapping for you.
|
||||
lodash backbone
|
||||
```
|
||||
|
||||
* CSP builds, supporting default [Content Security Policy](http://dvcs.w3.org/hg/content-security-policy/raw-file/tip/csp-specification.dev.html) restrictions, may be created using the `csp` modifier argument.
|
||||
The `csp` modifier is an alais of the `mobile` modifier. Chrome extensions will require [sandboxing](http://developer.chrome.com/trunk/extensions/sandboxingEval.html) or the use of either the `csp`, `mobile`, or `underscore` build.
|
||||
```bash
|
||||
lodash csp
|
||||
```
|
||||
|
||||
* Legacy builds, tailored for older browsers without [ES5 support](http://es5.github.com/), may be created using the `legacy` modifier argument.
|
||||
* Legacy builds, tailored for older environments without [ES5 support](http://es5.github.com/), may be created using the `legacy` modifier argument.
|
||||
```bash
|
||||
lodash legacy
|
||||
```
|
||||
|
||||
* Mobile builds, with IE < 9 bug fixes and method compilation removed, may be created using the `mobile` modifier argument.
|
||||
* Modern builds, tailored for newer environments with ES5 support, may be created using the `modern` modifier argument.
|
||||
```bash
|
||||
lodash modern
|
||||
```
|
||||
|
||||
* Mobile builds, without method compilation and most bug fixes for old browsers, may be created using the `mobile` modifier argument.
|
||||
```bash
|
||||
lodash mobile
|
||||
```
|
||||
@@ -142,7 +162,7 @@ lodash template="./*.jst"
|
||||
|
||||
* Use the `settings` argument to pass the template settings used when precompiling templates.
|
||||
```bash
|
||||
lodash settings="{interpolate:/\\{\\{([\\s\\S]+?)\\}\\}/g}"
|
||||
lodash settings="{interpolate:/\{\{([\s\S]+?)\}\}/g}"
|
||||
```
|
||||
|
||||
* Use the `moduleId` argument to specify the AMD module ID of Lo-Dash, which defaults to “lodash”, used by precompiled templates.
|
||||
@@ -150,18 +170,19 @@ lodash settings="{interpolate:/\\{\\{([\\s\\S]+?)\\}\\}/g}"
|
||||
lodash moduleId="underscore"
|
||||
```
|
||||
|
||||
All arguments, except `legacy` with `csp` or `mobile`, may be combined.<br>
|
||||
All arguments, except `legacy` with `mobile`, `modern`, or `underscore`, may be combined.<br>
|
||||
Unless specified by `-o` or `--output`, all files created are saved to the current working directory.
|
||||
|
||||
The following options are also supported:
|
||||
|
||||
* `-c`, `--stdout` Write output to standard output
|
||||
* `-d`, `--debug` Write only the debug output
|
||||
* `-h`, `--help` Display help information
|
||||
* `-m`, `--minify` Write only the minified output
|
||||
* `-o`, `--output` Write output to a given path/filename
|
||||
* `-s`, `--silent` Skip status updates normally logged to the console
|
||||
* `-V`, `--version` Output current version of Lo-Dash
|
||||
* `-c`, `--stdout` ......... Write output to standard output
|
||||
* `-d`, `--debug` ........... Write only the non-minified development output
|
||||
* `-h`, `--help` ............. Display help information
|
||||
* `-m`, `--minify` ......... Write only the minified production output
|
||||
* `-o`, `--output` ......... Write output to a given path/filename
|
||||
* `-p`, `--source-map` .. Generate a source map for the minified output, using an optional source map URL
|
||||
* `-s`, `--silent` ......... Skip status updates normally logged to the console
|
||||
* `-V`, `--version` ....... Output current version of Lo-Dash
|
||||
|
||||
The `lodash` command-line utility is available when Lo-Dash is installed as a global package (i.e. `npm install -g lodash`).
|
||||
|
||||
@@ -188,18 +209,18 @@ To avoid potential issues, update `npm` before installing Lo-Dash:
|
||||
npm install npm -g
|
||||
```
|
||||
|
||||
In [Node.js](http://nodejs.org/) and [RingoJS v0.8.0+](http://ringojs.org/):
|
||||
In [Node.js](http://nodejs.org/) and [RingoJS ≥ v0.8.0](http://ringojs.org/):
|
||||
|
||||
```js
|
||||
var _ = require('lodash');
|
||||
|
||||
// or as a drop-in replacement for Underscore
|
||||
var _ = require('lodash/lodash.underscore');
|
||||
var _ = require('lodash/dist/lodash.underscore');
|
||||
```
|
||||
|
||||
**Note:** If Lo-Dash is installed globally, run [`npm link lodash`](http://blog.nodejs.org/2011/03/23/npm-1-0-global-vs-local-installation/) in your project’s root directory before requiring it.
|
||||
|
||||
In [RingoJS v0.7.0-](http://ringojs.org/):
|
||||
In [RingoJS ≤ v0.7.0](http://ringojs.org/):
|
||||
|
||||
```js
|
||||
var _ = require('lodash')._;
|
||||
@@ -224,67 +245,28 @@ require({
|
||||
});
|
||||
```
|
||||
|
||||
## Resolved Underscore.js issues
|
||||
|
||||
* Allow iteration of objects with a `length` property [[#799](https://github.com/documentcloud/underscore/pull/799), [test](https://github.com/bestiejs/lodash/blob/v1.0.0-rc.3/test/test.js#L605-L611)]
|
||||
* Fix cross-browser object iteration bugs [[#60](https://github.com/documentcloud/underscore/issues/60), [#376](https://github.com/documentcloud/underscore/issues/376), [test](https://github.com/bestiejs/lodash/blob/v1.0.0-rc.3/test/test.js#L618-L642)]
|
||||
* Methods should work on pages with incorrectly shimmed native methods [[#7](https://github.com/documentcloud/underscore/issues/7), [#742](https://github.com/documentcloud/underscore/issues/742), [test](https://github.com/bestiejs/lodash/blob/v1.0.0-rc.3/test/test.js#L140-L146)]
|
||||
* `_.isEmpty` should support jQuery/MooTools DOM query collections [[#690](https://github.com/documentcloud/underscore/pull/690), [test](https://github.com/bestiejs/lodash/blob/v1.0.0-rc.3/test/test.js#L807-L812)]
|
||||
* `_.isObject` should avoid V8 bug [#2291](http://code.google.com/p/v8/issues/detail?id=2291) [[#605](https://github.com/documentcloud/underscore/issues/605), [test](https://github.com/bestiejs/lodash/blob/v1.0.0-rc.3/test/test.js#L888-L900)]
|
||||
* `_.keys` should work with `arguments` objects cross-browser [[#396](https://github.com/documentcloud/underscore/issues/396), [test](https://github.com/bestiejs/lodash/blob/v1.0.0-rc.3/test/test.js#L982-L984)]
|
||||
* `_.range` should coerce arguments to numbers [[#634](https://github.com/documentcloud/underscore/issues/634), [#683](https://github.com/documentcloud/underscore/issues/683), [test](https://github.com/bestiejs/lodash/blob/v1.0.0-rc.3/test/test.js#L1383-L1386)]
|
||||
|
||||
## Release Notes
|
||||
|
||||
### <sup>v1.0.0-rc.3</sup>
|
||||
### <sup>v1.2.0</sup>
|
||||
|
||||
#### Compatibility Warnings
|
||||
|
||||
* Made `_#join`, `_#pop`, and `_#shift` wrapper methods return unwrapped values
|
||||
* Made *“Functions”* methods wrapper counterparts return wrapped values
|
||||
* Removed `_.chain` and `_#chain` methods
|
||||
|
||||
#### Changes
|
||||
|
||||
* Added [_.cloneDeep](http://lodash.com/docs#cloneDeep) alias of `_.clone(…, true)`
|
||||
* Added `_.once` to the `backbone` build method dependencies
|
||||
* Ensured `backbone` builds implement Underscore’s chaining behavior
|
||||
* Ensured the `settings=…` build option doesn’t clobber the default `moduleId`
|
||||
* Ensured Lo-Dash’s `npm` package installation avoids erroring when no other modules have been globally installed
|
||||
* Made compiled templates loaded via AMD use the Lo-Dash module for their `_` references
|
||||
* Removed the *“Collections”* method `_.forEach` dependency from *“Arrays”* method `_.intersection`
|
||||
* Optimized `_.isArray` and `_.isFunction` fallbacks as well as<br>
|
||||
`_.intersection`, `_.isDate`, `_.isRegExp`, `_.reduce`, `_.reduceRight`, `_.union`, and `_.uniq`
|
||||
|
||||
### <sup>v1.0.0-rc.2</sup>
|
||||
|
||||
* Specified more method chaining behaviors
|
||||
* Updated `underscore` build compatibility to v1.4.3
|
||||
|
||||
### <sup>v1.0.0-rc.1</sup>
|
||||
|
||||
#### Compatibility Warnings
|
||||
|
||||
* Made `_(…)` intuitively chain without needing to call `_#chain`
|
||||
* Made `_.isEqual` equate `arguments` objects to similar `Object` objects
|
||||
* Made `_.clone` copy the enumerable properties of `arguments` objects and objects<br>
|
||||
created by constructors other than `Object` are cloned to plain `Object` objects
|
||||
|
||||
#### Changes
|
||||
|
||||
* Ensure Lo-Dash runs in the JS engine embedded in Adobe products
|
||||
* Ensured `_.reduce` and `_.reduceRight` pass the correct number of `callback` arguments
|
||||
* Ensured `_.throttle` nulls the `timeoutId`
|
||||
* Made deep `_.clone` more closely follow the structured clone algorithm and copy array properties assigned by `RegExp#exec`
|
||||
* Optimized compiled templates in Firefox
|
||||
* Optimized `_.forEach`, `_.forOwn`, `_.isNumber`, and `_.isString`
|
||||
* Simplified `iteratorTemplate`
|
||||
* Added Bower package support
|
||||
* Added `_.unzip`
|
||||
* Added an `options` argument to `_.debounce` and `_.throttle`
|
||||
* Allowed non-`underscore` builds to include `_.findWhere` and `_.chain`
|
||||
* Ensured *“Arrays”* and *“Objects”* category methods work with `arguments` objects and arrays respectively
|
||||
* Ensured build utility runs on Windows
|
||||
* Ensured `underscore` build versions of *“isType”* methods align with Underscore
|
||||
* Ensured methods avoid issues with the `__proto__` property
|
||||
* Ensured `_.merge` applies a `callback` to nested properties
|
||||
* Ensured `_.merge` passes the correct `callback` arguments when comparing objects
|
||||
* Made Lo-Dash work with Browserify
|
||||
* Removed method compilation from the `modern`
|
||||
|
||||
The full changelog is available [here](https://github.com/bestiejs/lodash/wiki/Changelog).
|
||||
|
||||
## BestieJS
|
||||
|
||||
Lo-Dash is part of the BestieJS *“Best in Class”* module collection. This means we promote solid browser/environment support, ES5 precedents, unit testing, and plenty of documentation.
|
||||
Lo-Dash is part of the BestieJS *“Best in Class”* module collection. This means we promote solid browser/environment support, ES5+ precedents, unit testing, and plenty of documentation.
|
||||
|
||||
## Author
|
||||
|
||||
|
||||
20
bower.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "lodash",
|
||||
"version": "1.2.0",
|
||||
"main": "./lodash.js",
|
||||
"ignore": [
|
||||
".*",
|
||||
"*.custom.*",
|
||||
"*.d.ts",
|
||||
"*.md",
|
||||
"*.txt",
|
||||
"build.js",
|
||||
"index.js",
|
||||
"build",
|
||||
"doc",
|
||||
"node_modules",
|
||||
"perf",
|
||||
"test",
|
||||
"vendor"
|
||||
]
|
||||
}
|
||||
539
build/minify.js
@@ -2,35 +2,69 @@
|
||||
;(function() {
|
||||
'use strict';
|
||||
|
||||
/** The Node filesystem, path, `zlib`, and child process modules */
|
||||
var fs = require('fs'),
|
||||
gzip = require('zlib').gzip,
|
||||
path = require('path'),
|
||||
spawn = require('child_process').spawn;
|
||||
/** Load Node.js modules */
|
||||
var https = require('https'),
|
||||
spawn = require('child_process').spawn,
|
||||
zlib = require('zlib');
|
||||
|
||||
/** Load other modules */
|
||||
var _ = require('../lodash.js'),
|
||||
preprocess = require('./pre-compile.js'),
|
||||
postprocess = require('./post-compile.js'),
|
||||
tar = require('../vendor/tar/tar.js'),
|
||||
util = require('./util.js');
|
||||
|
||||
/** Module shortcuts */
|
||||
var fs = util.fs,
|
||||
path = util.path;
|
||||
|
||||
/** The Git object ID of `closure-compiler.tar.gz` */
|
||||
var closureId = 'fe7665b9fb2378ffaf9e3985268e20e5c72e35fd';
|
||||
|
||||
/** The Git object ID of `uglifyjs.tar.gz` */
|
||||
var uglifyId = '3658629b8c7ae2e686f69eadd788ed792a23f4c6';
|
||||
|
||||
/** The path of the directory that is the base of the repository */
|
||||
var basePath = fs.realpathSync(path.join(__dirname, '..'));
|
||||
|
||||
/** The path of the directory where the Closure Compiler is located */
|
||||
var closurePath = path.join(basePath, 'vendor', 'closure-compiler', 'compiler.jar');
|
||||
/** The path of the `vendor` directory */
|
||||
var vendorPath = path.join(basePath, 'vendor');
|
||||
|
||||
/** Load other modules */
|
||||
var preprocess = require('./pre-compile.js'),
|
||||
postprocess = require('./post-compile.js'),
|
||||
uglifyJS = require('../vendor/uglifyjs/uglify-js.js');
|
||||
/** The path to the Closure Compiler `.jar` */
|
||||
var closurePath = path.join(vendorPath, 'closure-compiler', 'compiler.jar');
|
||||
|
||||
/** The path to the UglifyJS module */
|
||||
var uglifyPath = path.join(vendorPath, 'uglifyjs', 'tools', 'node.js');
|
||||
|
||||
/** The Closure Compiler command-line options */
|
||||
var closureOptions = ['--warning_level=QUIET'];
|
||||
|
||||
/** The media type for raw blob data */
|
||||
var mediaType = 'application/vnd.github.v3.raw';
|
||||
|
||||
/** Used to detect the Node.js executable in command-line arguments */
|
||||
var reNode = RegExp('(?:^|' + path.sepEscaped + ')node(?:\\.exe)?$');
|
||||
|
||||
/** Used to reference parts of the blob href */
|
||||
var location = (function() {
|
||||
var host = 'api.github.com',
|
||||
origin = 'https://api.github.com',
|
||||
pathname = '/repos/bestiejs/lodash/git/blobs';
|
||||
|
||||
return {
|
||||
'host': host,
|
||||
'href': origin + pathname,
|
||||
'origin': origin,
|
||||
'pathname': pathname
|
||||
};
|
||||
}());
|
||||
|
||||
/** The Closure Compiler optimization modes */
|
||||
var optimizationModes = {
|
||||
'simple': 'SIMPLE_OPTIMIZATIONS',
|
||||
'advanced': 'ADVANCED_OPTIMIZATIONS'
|
||||
};
|
||||
|
||||
/** Reassign `existsSync` for older versions of Node */
|
||||
fs.existsSync || (fs.existsSync = path.existsSync);
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
@@ -50,6 +84,12 @@
|
||||
* onComplete - The function called once minification has finished.
|
||||
*/
|
||||
function minify(source, options) {
|
||||
// used to specify the source map URL
|
||||
var sourceMapURL;
|
||||
|
||||
// used to specify the default minifer modes
|
||||
var modes = ['simple', 'advanced', 'hybrid'];
|
||||
|
||||
source || (source = '');
|
||||
options || (options = {});
|
||||
|
||||
@@ -58,28 +98,106 @@
|
||||
// convert commands to an options object
|
||||
options = source;
|
||||
|
||||
// used to report invalid command-line arguments
|
||||
var invalidArgs = _.reject(options.slice(reNode.test(options[0]) ? 2 : 0), function(value, index, options) {
|
||||
if (/^(?:-o|--output)$/.test(options[index - 1]) ||
|
||||
/^modes=.*$/.test(value)) {
|
||||
return true;
|
||||
}
|
||||
var result = [
|
||||
'-o', '--output',
|
||||
'-p', '--source-map',
|
||||
'-s', '--silent',
|
||||
'-t', '--template'
|
||||
].indexOf(value) > -1;
|
||||
|
||||
if (!result && /^(?:-p|--source-map)$/.test(options[index - 1])) {
|
||||
result = true;
|
||||
sourceMapURL = value;
|
||||
}
|
||||
return result;
|
||||
});
|
||||
|
||||
// report invalid arguments
|
||||
if (invalidArgs.length) {
|
||||
console.log(
|
||||
'\n' +
|
||||
'Invalid argument' + (invalidArgs.length > 1 ? 's' : '') +
|
||||
' passed: ' + invalidArgs.join(', ')
|
||||
);
|
||||
return;
|
||||
}
|
||||
var filePath = options[options.length - 1],
|
||||
isSilent = options.indexOf('-s') > -1 || options.indexOf('--silent') > -1,
|
||||
isTemplate = options.indexOf('-t') > -1 || options.indexOf('--template') > -1,
|
||||
isMapped = _.contains(options, '-p') || _.contains(options, '--source-map'),
|
||||
isSilent = _.contains(options, '-s') || _.contains(options, '--silent'),
|
||||
isTemplate = _.contains(options, '-t') || _.contains(options, '--template'),
|
||||
outputPath = path.join(path.dirname(filePath), path.basename(filePath, '.js') + '.min.js');
|
||||
|
||||
modes = options.reduce(function(result, value) {
|
||||
var match = value.match(/modes=(.*)$/);
|
||||
return match ? match[1].split(/, */) : result;
|
||||
}, modes);
|
||||
|
||||
outputPath = options.reduce(function(result, value, index) {
|
||||
if (/-o|--output/.test(value)) {
|
||||
result = options[index + 1];
|
||||
result = path.join(fs.realpathSync(path.dirname(result)), path.basename(result));
|
||||
var dirname = path.dirname(result);
|
||||
fs.mkdirpSync(dirname);
|
||||
result = path.join(fs.realpathSync(dirname), path.basename(result));
|
||||
}
|
||||
return result;
|
||||
}, outputPath);
|
||||
|
||||
options = {
|
||||
'filePath': filePath,
|
||||
'isMapped': isMapped,
|
||||
'isSilent': isSilent,
|
||||
'isTemplate': isTemplate,
|
||||
'outputPath': outputPath
|
||||
'modes': modes,
|
||||
'outputPath': outputPath,
|
||||
'sourceMapURL': sourceMapURL
|
||||
};
|
||||
|
||||
source = fs.readFileSync(filePath, 'utf8');
|
||||
}
|
||||
new Minify(source, options);
|
||||
|
||||
modes = options.modes || modes;
|
||||
if (options.isMapped) {
|
||||
modes = modes.filter(function(mode) {
|
||||
return mode != 'hybrid';
|
||||
});
|
||||
}
|
||||
if (options.isTemplate) {
|
||||
modes = modes.filter(function(mode) {
|
||||
return mode != 'advanced';
|
||||
});
|
||||
}
|
||||
options.modes = modes;
|
||||
|
||||
// fetch the Closure Compiler
|
||||
getDependency({
|
||||
'id': 'closure-compiler',
|
||||
'hashId': closureId,
|
||||
'path': vendorPath,
|
||||
'title': 'the Closure Compiler',
|
||||
'onComplete': function(exception) {
|
||||
var error = exception;
|
||||
|
||||
// fetch UglifyJS
|
||||
getDependency({
|
||||
'id': 'uglifyjs',
|
||||
'hashId': uglifyId,
|
||||
'title': 'UglifyJS',
|
||||
'path': vendorPath,
|
||||
'onComplete': function(exception) {
|
||||
error || (error = exception);
|
||||
if (!error) {
|
||||
new Minify(source, options);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -104,19 +222,114 @@
|
||||
this.hybrid = { 'simple': {}, 'advanced': {} };
|
||||
this.uglified = {};
|
||||
|
||||
this.filePath = options.filePath;
|
||||
this.isMapped = !!options.isMapped;
|
||||
this.isSilent = !!options.isSilent;
|
||||
this.isTemplate = !!options.isTemplate;
|
||||
this.outputPath = options.outputPath;
|
||||
this.sourceMapURL = options.sourceMapURL;
|
||||
|
||||
source = preprocess(source, options);
|
||||
this.source = source;
|
||||
var modes = this.modes = options.modes;
|
||||
source = this.source = preprocess(source, options);
|
||||
|
||||
this.onComplete = options.onComplete || function(source) {
|
||||
fs.writeFileSync(this.outputPath, source, 'utf8');
|
||||
this.onComplete = options.onComplete || function(data) {
|
||||
var outputPath = this.outputPath,
|
||||
sourceMap = data.sourceMap;
|
||||
|
||||
fs.writeFileSync(outputPath, data.source, 'utf8');
|
||||
if (sourceMap) {
|
||||
fs.writeFileSync(getMapPath(outputPath), sourceMap, 'utf8');
|
||||
}
|
||||
};
|
||||
|
||||
// begin the minification process
|
||||
closureCompile.call(this, source, 'simple', onClosureSimpleCompile.bind(this));
|
||||
if (_.contains(modes, 'simple')) {
|
||||
closureCompile.call(this, source, 'simple', onClosureSimpleCompile.bind(this));
|
||||
} else if (_.contains(modes, 'advanced')) {
|
||||
onClosureSimpleGzip.call(this);
|
||||
} else {
|
||||
onClosureAdvancedGzip.call(this);
|
||||
}
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Fetches a required `.tar.gz` dependency with the given Git object ID from
|
||||
* the Lo-Dash repo on GitHub. The object ID may be obtained by running
|
||||
* `git hash-object path/to/dependency.tar.gz`.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} options The options object.
|
||||
* id - The Git object ID of the `.tar.gz` file.
|
||||
* onComplete - The function called once the extraction has finished.
|
||||
* path - The path of the extraction directory.
|
||||
* title - The dependency's title used in status updates logged to the console.
|
||||
*/
|
||||
function getDependency(options) {
|
||||
options || (options = {});
|
||||
|
||||
var ran,
|
||||
destPath = options.path,
|
||||
hashId = options.hashId,
|
||||
id = options.id,
|
||||
onComplete = options.onComplete,
|
||||
title = options.title;
|
||||
|
||||
// exit early if dependency exists
|
||||
if (fs.existsSync(path.join(destPath, id))) {
|
||||
onComplete();
|
||||
return;
|
||||
}
|
||||
var callback = function(exception) {
|
||||
if (ran) {
|
||||
return;
|
||||
}
|
||||
if (exception) {
|
||||
console.error([
|
||||
'There was a problem installing ' + title + '.',
|
||||
'Try running the command as root, via `sudo`, or manually install by running:',
|
||||
'',
|
||||
"curl -H 'Accept: " + mediaType + "' " + location.href + '/' + hashId + " | tar xvz -C '" + destPath + "'",
|
||||
''
|
||||
].join('\n'));
|
||||
}
|
||||
ran = true;
|
||||
process.removeListener('uncaughtException', callback);
|
||||
onComplete(exception);
|
||||
};
|
||||
|
||||
console.log('Downloading ' + title + '...');
|
||||
process.on('uncaughtException', callback);
|
||||
|
||||
https.get({
|
||||
'host': location.host,
|
||||
'path': location.pathname + '/' + hashId,
|
||||
'headers': {
|
||||
// By default, all GitHub blob API endpoints return a JSON document
|
||||
// containing Base64-encoded blob data. Overriding the `Accept` header
|
||||
// with the GitHub raw media type returns the blob data directly.
|
||||
// See http://developer.github.com/v3/media/.
|
||||
'Accept': mediaType
|
||||
}
|
||||
}, function(response) {
|
||||
var decompressor = zlib.createUnzip(),
|
||||
parser = new tar.Extract({ 'path': destPath });
|
||||
|
||||
parser.on('end', callback);
|
||||
response.pipe(decompressor).pipe(parser);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves the source map path from the given output path.
|
||||
*
|
||||
* @private
|
||||
* @param {String} outputPath The output path.
|
||||
* @returns {String} Returns the source map path.
|
||||
*/
|
||||
function getMapPath(outputPath) {
|
||||
return path.join(path.dirname(outputPath), path.basename(outputPath, '.js') + '.map');
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
@@ -131,36 +344,82 @@
|
||||
* @param {Function} callback The function called once the process has completed.
|
||||
*/
|
||||
function closureCompile(source, mode, callback) {
|
||||
// use simple optimizations when minifying template files
|
||||
var options = closureOptions.slice();
|
||||
options.push('--compilation_level=' + optimizationModes[this.isTemplate ? 'simple' : mode]);
|
||||
var filePath = this.filePath,
|
||||
isAdvanced = mode == 'advanced',
|
||||
isMapped = this.isMapped,
|
||||
options = closureOptions.slice(),
|
||||
outputPath = this.outputPath,
|
||||
mapPath = getMapPath(outputPath),
|
||||
sourceMapURL = this.sourceMapURL || path.basename(mapPath);
|
||||
|
||||
// the standard error stream, standard output stream, and the Closure Compiler process
|
||||
var error = '',
|
||||
output = '',
|
||||
compiler = spawn('java', ['-jar', closurePath].concat(options));
|
||||
|
||||
if (!this.isSilent) {
|
||||
console.log('Compressing ' + path.basename(this.outputPath, '.js') + ' using the Closure Compiler (' + mode + ')...');
|
||||
// remove copyright header to make other modifications easier
|
||||
var license = (/^(?:\s*\/\/.*\s*|\s*\/\*[^*]*\*+(?:[^\/][^*]*\*+)*\/\s*)*/.exec(source) || [''])[0];
|
||||
if (license) {
|
||||
source = source.replace(license, '');
|
||||
}
|
||||
compiler.stdout.on('data', function(data) {
|
||||
// append the data to the output stream
|
||||
output += data;
|
||||
|
||||
var hasIIFE = /^;?\(function[^{]+{/.test(source),
|
||||
isStrict = hasIIFE && /^;?\(function[^{]+{\s*["']use strict["']/.test(source);
|
||||
|
||||
// to avoid stripping the IIFE, convert it to a function call
|
||||
if (hasIIFE && isAdvanced) {
|
||||
source = source
|
||||
.replace(/\(function/, '__iife__$&')
|
||||
.replace(/\(this\)\)([\s;]*(\n\/\/.+)?)$/, ', this)$1');
|
||||
}
|
||||
|
||||
options.push('--compilation_level=' + optimizationModes[mode]);
|
||||
if (isMapped) {
|
||||
options.push('--create_source_map=' + mapPath, '--source_map_format=V3');
|
||||
}
|
||||
|
||||
var compiler = spawn('java', ['-jar', closurePath].concat(options));
|
||||
if (!this.isSilent) {
|
||||
console.log('Compressing ' + path.basename(outputPath, '.js') + ' using the Closure Compiler (' + mode + ')...');
|
||||
}
|
||||
|
||||
var error = '';
|
||||
compiler.stderr.on('data', function(data) {
|
||||
error += data;
|
||||
});
|
||||
|
||||
compiler.stderr.on('data', function(data) {
|
||||
// append the error message to the error stream
|
||||
error += data;
|
||||
var output = '';
|
||||
compiler.stdout.on('data', function(data) {
|
||||
output += data;
|
||||
});
|
||||
|
||||
compiler.on('exit', function(status) {
|
||||
// `status` contains the process exit code
|
||||
var exception = null;
|
||||
if (status) {
|
||||
exception = new Error(error);
|
||||
var exception = new Error(error);
|
||||
exception.status = status;
|
||||
}
|
||||
callback(exception, output);
|
||||
// restore IIFE and move exposed vars inside the IIFE
|
||||
if (hasIIFE && isAdvanced) {
|
||||
output = output
|
||||
.replace(/__iife__\(/, '(')
|
||||
.replace(/,\s*this\)([\s;]*(\n\/\/.+)?)$/, '(this))$1')
|
||||
.replace(/^((?:var (?:\w+=(?:!0|!1|null)[,;])+)?)([\s\S]*?function[^{]+{)/, '$2$1');
|
||||
}
|
||||
// inject "use strict" directive
|
||||
if (isStrict) {
|
||||
output = output.replace(/^[\s\S]*?function[^{]+{/, '$&"use strict";');
|
||||
}
|
||||
// restore copyright header
|
||||
if (license) {
|
||||
output = license + output;
|
||||
}
|
||||
if (isMapped) {
|
||||
var mapOutput = fs.readFileSync(mapPath, 'utf8');
|
||||
fs.unlinkSync(mapPath);
|
||||
output = output.replace(/[\s;]*$/, '\n/*\n//@ sourceMappingURL=' + sourceMapURL) + '\n*/';
|
||||
|
||||
mapOutput = JSON.parse(mapOutput);
|
||||
mapOutput.file = path.basename(outputPath);
|
||||
mapOutput.sources = [path.basename(filePath)];
|
||||
mapOutput = JSON.stringify(mapOutput, null, 2);
|
||||
}
|
||||
callback(exception, output, mapOutput);
|
||||
});
|
||||
|
||||
// proxy the standard input to the Closure Compiler
|
||||
@@ -178,31 +437,47 @@
|
||||
* @param {Function} callback The function called once the process has completed.
|
||||
*/
|
||||
function uglify(source, label, callback) {
|
||||
var exception,
|
||||
result,
|
||||
ugly = uglifyJS.uglify;
|
||||
|
||||
if (!this.isSilent) {
|
||||
console.log('Compressing ' + path.basename(this.outputPath, '.js') + ' using ' + label + '...');
|
||||
}
|
||||
try {
|
||||
result = ugly.gen_code(
|
||||
// enable unsafe transformations
|
||||
ugly.ast_squeeze_more(
|
||||
ugly.ast_squeeze(
|
||||
// munge variable and function names, excluding the special `define`
|
||||
// function exposed by AMD loaders
|
||||
ugly.ast_mangle(uglifyJS.parser.parse(source), {
|
||||
'except': ['define']
|
||||
}
|
||||
))), {
|
||||
'ascii_only': true
|
||||
var uglifyJS = require(uglifyPath);
|
||||
|
||||
// 1. parse
|
||||
var toplevel = uglifyJS.parse(source);
|
||||
|
||||
// 2. compress
|
||||
// enable unsafe comparisons
|
||||
toplevel.figure_out_scope();
|
||||
toplevel = toplevel.transform(uglifyJS.Compressor({
|
||||
'comparisons': false,
|
||||
'unsafe': true,
|
||||
'unsafe_comps': true,
|
||||
'warnings': false
|
||||
}));
|
||||
|
||||
// 3. mangle
|
||||
// excluding the `define` function exposed by AMD loaders
|
||||
toplevel.figure_out_scope();
|
||||
toplevel.compute_char_frequency();
|
||||
toplevel.mangle_names({
|
||||
'except': ['define']
|
||||
});
|
||||
} catch(e) {
|
||||
exception = e;
|
||||
|
||||
// 4. output
|
||||
// restrict lines to 500 characters for consistency with the Closure Compiler
|
||||
var stream = uglifyJS.OutputStream({
|
||||
'ascii_only': true,
|
||||
'comments': /@cc_on|@license|@preserve/i,
|
||||
'max_line_len': 500,
|
||||
});
|
||||
|
||||
toplevel.print(stream);
|
||||
}
|
||||
// lines are restricted to 500 characters for consistency with the Closure Compiler
|
||||
callback(exception, result && ugly.split_lines(result, 500));
|
||||
catch(e) {
|
||||
var exception = e;
|
||||
}
|
||||
callback(exception, stream && String(stream));
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
@@ -213,14 +488,18 @@
|
||||
* @private
|
||||
* @param {Object|Undefined} exception The error object.
|
||||
* @param {String} result The resulting minified source.
|
||||
* @param {String} map The source map output.
|
||||
*/
|
||||
function onClosureSimpleCompile(exception, result) {
|
||||
function onClosureSimpleCompile(exception, result, map) {
|
||||
if (exception) {
|
||||
throw exception;
|
||||
}
|
||||
result = postprocess(result);
|
||||
this.compiled.simple.source = result;
|
||||
gzip(result, onClosureSimpleGzip.bind(this));
|
||||
|
||||
var simple = this.compiled.simple;
|
||||
simple.source = result;
|
||||
simple.sourceMap = map;
|
||||
zlib.gzip(result, onClosureSimpleGzip.bind(this));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -234,13 +513,18 @@
|
||||
if (exception) {
|
||||
throw exception;
|
||||
}
|
||||
if (!this.isSilent) {
|
||||
console.log('Done. Size: %d bytes.', result.length);
|
||||
if (result != null) {
|
||||
if (!this.isSilent) {
|
||||
console.log('Done. Size: %d bytes.', result.length);
|
||||
}
|
||||
this.compiled.simple.gzip = result;
|
||||
}
|
||||
// compile the source using advanced optimizations
|
||||
if (_.contains(this.modes, 'advanced')) {
|
||||
closureCompile.call(this, this.source, 'advanced', onClosureAdvancedCompile.bind(this));
|
||||
} else {
|
||||
onClosureAdvancedGzip.call(this);
|
||||
}
|
||||
this.compiled.simple.gzip = result;
|
||||
|
||||
// next, compile the source using advanced optimizations
|
||||
closureCompile.call(this, this.source, 'advanced', onClosureAdvancedCompile.bind(this));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -249,14 +533,18 @@
|
||||
* @private
|
||||
* @param {Object|Undefined} exception The error object.
|
||||
* @param {String} result The resulting minified source.
|
||||
* @param {String} map The source map output.
|
||||
*/
|
||||
function onClosureAdvancedCompile(exception, result) {
|
||||
function onClosureAdvancedCompile(exception, result, map) {
|
||||
if (exception) {
|
||||
throw exception;
|
||||
}
|
||||
result = postprocess(result);
|
||||
this.compiled.advanced.source = result;
|
||||
gzip(result, onClosureAdvancedGzip.bind(this));
|
||||
|
||||
var advanced = this.compiled.advanced;
|
||||
advanced.source = result;
|
||||
advanced.sourceMap = map;
|
||||
zlib.gzip(result, onClosureAdvancedGzip.bind(this));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -270,13 +558,18 @@
|
||||
if (exception) {
|
||||
throw exception;
|
||||
}
|
||||
if (!this.isSilent) {
|
||||
console.log('Done. Size: %d bytes.', result.length);
|
||||
if (result != null) {
|
||||
if (!this.isSilent) {
|
||||
console.log('Done. Size: %d bytes.', result.length);
|
||||
}
|
||||
this.compiled.advanced.gzip = result;
|
||||
}
|
||||
// minify the source using UglifyJS
|
||||
if (!this.isMapped) {
|
||||
uglify.call(this, this.source, 'UglifyJS', onUglify.bind(this));
|
||||
} else {
|
||||
onComplete.call(this);
|
||||
}
|
||||
this.compiled.advanced.gzip = result;
|
||||
|
||||
// next, minify the source using only UglifyJS
|
||||
uglify.call(this, this.source, 'UglifyJS', onUglify.bind(this));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -292,7 +585,7 @@
|
||||
}
|
||||
result = postprocess(result);
|
||||
this.uglified.source = result;
|
||||
gzip(result, onUglifyGzip.bind(this));
|
||||
zlib.gzip(result, onUglifyGzip.bind(this));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -306,13 +599,23 @@
|
||||
if (exception) {
|
||||
throw exception;
|
||||
}
|
||||
if (!this.isSilent) {
|
||||
console.log('Done. Size: %d bytes.', result.length);
|
||||
if (result != null) {
|
||||
if (!this.isSilent) {
|
||||
console.log('Done. Size: %d bytes.', result.length);
|
||||
}
|
||||
this.uglified.gzip = result;
|
||||
}
|
||||
// minify the already Closure Compiler simple optimized source using UglifyJS
|
||||
var modes = this.modes;
|
||||
if (_.contains(modes, 'hybrid')) {
|
||||
if (_.contains(modes, 'simple')) {
|
||||
uglify.call(this, this.compiled.simple.source, 'hybrid (simple)', onSimpleHybrid.bind(this));
|
||||
} else if (_.contains(modes, 'advanced')) {
|
||||
onSimpleHybridGzip.call(this);
|
||||
}
|
||||
} else {
|
||||
onComplete.call(this);
|
||||
}
|
||||
this.uglified.gzip = result;
|
||||
|
||||
// next, minify the already Closure Compiler simple optimized source using UglifyJS
|
||||
uglify.call(this, this.compiled.simple.source, 'hybrid (simple)', onSimpleHybrid.bind(this));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -328,7 +631,7 @@
|
||||
}
|
||||
result = postprocess(result);
|
||||
this.hybrid.simple.source = result;
|
||||
gzip(result, onSimpleHybridGzip.bind(this));
|
||||
zlib.gzip(result, onSimpleHybridGzip.bind(this));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -342,13 +645,18 @@
|
||||
if (exception) {
|
||||
throw exception;
|
||||
}
|
||||
if (!this.isSilent) {
|
||||
console.log('Done. Size: %d bytes.', result.length);
|
||||
if (result != null) {
|
||||
if (!this.isSilent) {
|
||||
console.log('Done. Size: %d bytes.', result.length);
|
||||
}
|
||||
this.hybrid.simple.gzip = result;
|
||||
}
|
||||
// minify the already Closure Compiler advance optimized source using UglifyJS
|
||||
if (_.contains(this.modes, 'advanced')) {
|
||||
uglify.call(this, this.compiled.advanced.source, 'hybrid (advanced)', onAdvancedHybrid.bind(this));
|
||||
} else {
|
||||
onComplete.call(this);
|
||||
}
|
||||
this.hybrid.simple.gzip = result;
|
||||
|
||||
// next, minify the already Closure Compiler advance optimized source using UglifyJS
|
||||
uglify.call(this, this.compiled.advanced.source, 'hybrid (advanced)', onAdvancedHybrid.bind(this));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -364,7 +672,7 @@
|
||||
}
|
||||
result = postprocess(result);
|
||||
this.hybrid.advanced.source = result;
|
||||
gzip(result, onAdvancedHybridGzip.bind(this));
|
||||
zlib.gzip(result, onAdvancedHybridGzip.bind(this));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -378,11 +686,12 @@
|
||||
if (exception) {
|
||||
throw exception;
|
||||
}
|
||||
if (!this.isSilent) {
|
||||
console.log('Done. Size: %d bytes.', result.length);
|
||||
if (result != null) {
|
||||
if (!this.isSilent) {
|
||||
console.log('Done. Size: %d bytes.', result.length);
|
||||
}
|
||||
this.hybrid.advanced.gzip = result;
|
||||
}
|
||||
this.hybrid.advanced.gzip = result;
|
||||
|
||||
// finish by choosing the smallest compressed file
|
||||
onComplete.call(this);
|
||||
}
|
||||
@@ -399,20 +708,32 @@
|
||||
hybridSimple = this.hybrid.simple,
|
||||
hybridAdvanced = this.hybrid.advanced;
|
||||
|
||||
var objects = [
|
||||
compiledSimple,
|
||||
compiledAdvanced,
|
||||
uglified,
|
||||
hybridSimple,
|
||||
hybridAdvanced
|
||||
];
|
||||
|
||||
var gzips = objects
|
||||
.map(function(data) { return data.gzip; })
|
||||
.filter(Boolean);
|
||||
|
||||
// select the smallest gzipped file and use its minified counterpart as the
|
||||
// official minified release (ties go to the Closure Compiler)
|
||||
var min = Math.min(
|
||||
compiledSimple.gzip.length,
|
||||
compiledAdvanced.gzip.length,
|
||||
uglified.gzip.length,
|
||||
hybridSimple.gzip.length,
|
||||
hybridAdvanced.gzip.length
|
||||
);
|
||||
var min = gzips.reduce(function(min, gzip) {
|
||||
var length = gzip.length;
|
||||
return min > length ? length : min;
|
||||
}, Infinity);
|
||||
|
||||
// pass the minified source to the "onComplete" callback
|
||||
[compiledSimple, compiledAdvanced, uglified, hybridSimple, hybridAdvanced].some(function(data) {
|
||||
if (data.gzip.length == min) {
|
||||
this.onComplete(data.source);
|
||||
objects.some(function(data) {
|
||||
var gzip = data.gzip;
|
||||
if (gzip && gzip.length == min) {
|
||||
data.outputPath = this.outputPath;
|
||||
this.onComplete(data);
|
||||
return true;
|
||||
}
|
||||
}, this);
|
||||
}
|
||||
|
||||
@@ -2,19 +2,17 @@
|
||||
;(function() {
|
||||
'use strict';
|
||||
|
||||
/** The Node filesystem module */
|
||||
/** The Node.js filesystem module */
|
||||
var fs = require('fs');
|
||||
|
||||
/** The minimal license/copyright template */
|
||||
var licenseTemplate = {
|
||||
'lodash':
|
||||
'/*!\n' +
|
||||
' Lo-Dash <%= VERSION %> lodash.com/license\n' +
|
||||
' Underscore.js 1.4.3 underscorejs.org/LICENSE\n' +
|
||||
'*/',
|
||||
'underscore':
|
||||
'/*! Underscore.js <%= VERSION %> underscorejs.org/LICENSE */'
|
||||
};
|
||||
var licenseTemplate = [
|
||||
'/**',
|
||||
' * @license',
|
||||
' * Lo-Dash <%= VERSION %> lodash.com/license',
|
||||
' * Underscore.js 1.4.4 underscorejs.org/LICENSE',
|
||||
' */'
|
||||
].join('\n');
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
@@ -26,36 +24,33 @@
|
||||
* @returns {String} Returns the processed source.
|
||||
*/
|
||||
function postprocess(source) {
|
||||
// move vars exposed by the Closure Compiler into the IIFE
|
||||
source = source.replace(/^((?:(['"])use strict\2;)?(?:var (?:[a-z]+=(?:!0|!1|null)[,;])+)?)([\s\S]*?function[^)]+\){)/, '$3$1');
|
||||
// remove copyright header
|
||||
source = source.replace(/^\/\**[\s\S]+?\*\/\n/, '');
|
||||
|
||||
// correct overly aggressive Closure Compiler advanced optimizations
|
||||
source = source.replace(/prototype\s*=\s*{\s*valueOf\s*:\s*1\s*}/, 'prototype={valueOf:1,y:1}');
|
||||
|
||||
// unescape properties (e.g. foo["bar"] => foo.bar)
|
||||
source = source.replace(/(\w)\["([^."]+)"\]/g, function(match, left, right) {
|
||||
return /\W/.test(right) ? match : (left + '.' + right);
|
||||
});
|
||||
// correct overly aggressive Closure Compiler advanced optimization
|
||||
source = source.replace(/(document[^&]+&&)\s*(?:\w+|!\d)/, '$1!({toString:0}+"")');
|
||||
|
||||
// flip `typeof` expressions to help optimize Safari and
|
||||
// correct the AMD module definition for AMD build optimizers
|
||||
// (e.g. from `"number" == typeof x` to `typeof x == "number")
|
||||
source = source.replace(/(return)?("[^"]+")\s*([!=]=)\s*(typeof(?:\s*\([^)]+\)|\s+[\w.]+))/g, function(match, ret, type, equality, expression) {
|
||||
return (ret ? ret + ' ' : '') + expression + equality + type;
|
||||
source = source.replace(/(\w)?("[^"]+")\s*([!=]=)\s*(typeof(?:\s*\([^)]+\)|\s+[.\w]+(?!\[)))/g, function(match, other, type, equality, expression) {
|
||||
return (other ? other + ' ' : '') + expression + equality + type;
|
||||
});
|
||||
|
||||
// add trailing semicolon
|
||||
if (source) {
|
||||
source = source.replace(/[\s;]*$/, ';');
|
||||
source = source.replace(/[\s;]*?(\s*\/\/.*\s*|\s*\/\*[^*]*\*+(?:[^\/][^*]*\*+)*\/\s*)*$/, ';$1');
|
||||
}
|
||||
// exit early if version snippet isn't found
|
||||
var snippet = /VERSION\s*[=:]\s*([\'"])(.*?)\1/.exec(source);
|
||||
if (!snippet) {
|
||||
return source;
|
||||
}
|
||||
// add copyright/license header
|
||||
return licenseTemplate[/call\(this\);?$/.test(source) ? 'underscore' : 'lodash']
|
||||
.replace('<%= VERSION %>', snippet[2]) + '\n;' + source;
|
||||
// add new copyright header
|
||||
var version = snippet[2];
|
||||
source = licenseTemplate.replace('<%= VERSION %>', version) + '\n;' + source;
|
||||
|
||||
return source;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
@@ -1,148 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
;(function() {
|
||||
'use strict';
|
||||
|
||||
/** Load Node modules */
|
||||
var exec = require('child_process').exec,
|
||||
fs = require('fs'),
|
||||
https = require('https'),
|
||||
path = require('path'),
|
||||
tar = require('../vendor/tar/tar.js'),
|
||||
zlib = require('zlib');
|
||||
|
||||
/** The path of the directory that is the base of the repository */
|
||||
var basePath = fs.realpathSync(path.join(__dirname, '..'));
|
||||
|
||||
/** The path of the `vendor` directory */
|
||||
var vendorPath = path.join(basePath, 'vendor');
|
||||
|
||||
/** The Git object ID of `closure-compiler.tar.gz` */
|
||||
var closureId = 'a2787b470c577cee2404d186c562dd9835f779f5';
|
||||
|
||||
/** The Git object ID of `uglifyjs.tar.gz` */
|
||||
var uglifyId = '7ecae09d413eb48dd5785fe877f24e60ac3bbcef';
|
||||
|
||||
/** The media type for raw blob data */
|
||||
var mediaType = 'application/vnd.github.v3.raw';
|
||||
|
||||
/** Reassign `existsSync` for older versions of Node */
|
||||
fs.existsSync || (fs.existsSync = path.existsSync);
|
||||
|
||||
/** Used to reference parts of the blob href */
|
||||
var location = (function() {
|
||||
var host = 'api.github.com',
|
||||
origin = 'https://api.github.com',
|
||||
pathname = '/repos/bestiejs/lodash/git/blobs';
|
||||
|
||||
return {
|
||||
'host': host,
|
||||
'href': host + origin + pathname,
|
||||
'origin': origin,
|
||||
'pathname': pathname
|
||||
};
|
||||
}());
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Fetches a required `.tar.gz` dependency with the given Git object ID from
|
||||
* the Lo-Dash repo on GitHub. The object ID may be obtained by running
|
||||
* `git hash-object path/to/dependency.tar.gz`.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} options The options object.
|
||||
* id - The Git object ID of the `.tar.gz` file.
|
||||
* onComplete - The function, invoked with one argument (exception),
|
||||
* called once the extraction has finished.
|
||||
* path - The path of the extraction directory.
|
||||
* title - The dependency's title used in status updates logged to the console.
|
||||
*/
|
||||
function getDependency(options) {
|
||||
options || (options = {});
|
||||
|
||||
var id = options.id,
|
||||
onComplete = options.onComplete,
|
||||
path = options.path,
|
||||
title = options.title;
|
||||
|
||||
function callback(exception) {
|
||||
if (exception) {
|
||||
console.error([
|
||||
'There was a problem installing ' + title + '. To manually install, run:',
|
||||
'',
|
||||
"curl -H 'Accept: " + mediaType + "' " + location.href + '/' + id + " | tar xvz -C '" + path + "'"
|
||||
].join('\n'));
|
||||
}
|
||||
onComplete(exception);
|
||||
}
|
||||
|
||||
console.log('Downloading ' + title + '...');
|
||||
|
||||
https.get({
|
||||
'host': location.host,
|
||||
'path': location.pathname + '/' + id,
|
||||
'headers': {
|
||||
// By default, all GitHub blob API endpoints return a JSON document
|
||||
// containing Base64-encoded blob data. Overriding the `Accept` header
|
||||
// with the GitHub raw media type returns the blob data directly.
|
||||
// See http://developer.github.com/v3/media/.
|
||||
'Accept': mediaType
|
||||
}
|
||||
}, function(response) {
|
||||
var decompressor = zlib.createUnzip(),
|
||||
parser = new tar.Extract({ 'path': path });
|
||||
|
||||
decompressor.on('error', callback)
|
||||
parser.on('end', callback).on('error', callback);
|
||||
response.pipe(decompressor).pipe(parser);
|
||||
})
|
||||
.on('error', callback);
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
exec('npm -g root', function(exception, stdout) {
|
||||
if (!exception) {
|
||||
try {
|
||||
var root = stdout.trim(),
|
||||
isGlobal = fs.existsSync(root) && path.resolve(basePath, '..') == fs.realpathSync(root);
|
||||
} catch(e) {
|
||||
exception = e;
|
||||
}
|
||||
}
|
||||
if (exception) {
|
||||
console.error([
|
||||
'Oops! There was a problem detecting the install mode. If you’re installing the',
|
||||
'Lo-Dash command-line executable (via `npm install -g lodash`), you’ll need to',
|
||||
'manually install UglifyJS and the Closure Compiler by running:',
|
||||
'',
|
||||
"curl -H 'Accept: " + mediaType + "' " + location.href + '/' + closureId + " | tar xvz -C '" + vendorPath + "'",
|
||||
"curl -H 'Accept: " + mediaType + "' " + location.href + '/' + uglifyId + " | tar xvz -C '" + vendorPath + "'",
|
||||
'',
|
||||
'Please submit an issue on the GitHub issue tracker: ' + process.env.npm_package_bugs_url
|
||||
].join('\n'));
|
||||
|
||||
console.error(exception);
|
||||
}
|
||||
if (!isGlobal) {
|
||||
return;
|
||||
}
|
||||
// download the Closure Compiler
|
||||
getDependency({
|
||||
'title': 'the Closure Compiler',
|
||||
'id': closureId,
|
||||
'path': vendorPath,
|
||||
'onComplete': function() {
|
||||
// download UglifyJS
|
||||
getDependency({
|
||||
'title': 'UglifyJS',
|
||||
'id': uglifyId,
|
||||
'path': vendorPath,
|
||||
'onComplete': function() {
|
||||
process.exit();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}());
|
||||
@@ -2,51 +2,49 @@
|
||||
;(function() {
|
||||
'use strict';
|
||||
|
||||
/** The Node filesystem module */
|
||||
/** The Node.js filesystem module */
|
||||
var fs = require('fs');
|
||||
|
||||
/** Used to minify variables embedded in compiled strings */
|
||||
var compiledVars = [
|
||||
'args',
|
||||
'argsIndex',
|
||||
'argsLength',
|
||||
'callback',
|
||||
'collection',
|
||||
'createCallback',
|
||||
'ctor',
|
||||
'guard',
|
||||
'hasOwnProperty',
|
||||
'index',
|
||||
'isArguments',
|
||||
'isArray',
|
||||
'isString',
|
||||
'iteratee',
|
||||
'iterable',
|
||||
'length',
|
||||
'nativeKeys',
|
||||
'keys',
|
||||
'lodash',
|
||||
'object',
|
||||
'objectTypes',
|
||||
'ownIndex',
|
||||
'ownProps',
|
||||
'propertyIsEnumerable',
|
||||
'result',
|
||||
'skipProto',
|
||||
'source',
|
||||
'thisArg'
|
||||
];
|
||||
|
||||
/** Used to minify `compileIterator` option properties */
|
||||
/** Used to minify `iteratorTemplate` data properties */
|
||||
var iteratorOptions = [
|
||||
'args',
|
||||
'arrayLoop',
|
||||
'arrays',
|
||||
'bottom',
|
||||
'firstArg',
|
||||
'hasDontEnumBug',
|
||||
'isKeysFast',
|
||||
'objectLoop',
|
||||
'nonEnumArgs',
|
||||
'noCharByIndex',
|
||||
'shadowed',
|
||||
'init',
|
||||
'loop',
|
||||
'shadowedProps',
|
||||
'top',
|
||||
'useHas',
|
||||
'useStrict'
|
||||
'useKeys'
|
||||
];
|
||||
|
||||
/** Used to minify variables and string values to a single character */
|
||||
@@ -57,17 +55,32 @@
|
||||
|
||||
/** Used to protect the specified properties from getting minified */
|
||||
var propWhitelist = [
|
||||
'Array',
|
||||
'Boolean',
|
||||
'Date',
|
||||
'Function',
|
||||
'Math',
|
||||
'Number',
|
||||
'Object',
|
||||
'RegExp',
|
||||
'String',
|
||||
'TypeError',
|
||||
'VERSION',
|
||||
'_',
|
||||
'__wrapped__',
|
||||
'after',
|
||||
'all',
|
||||
'amd',
|
||||
'any',
|
||||
'argsClass',
|
||||
'argsObject',
|
||||
'assign',
|
||||
'at',
|
||||
'attachEvent',
|
||||
'bind',
|
||||
'bindAll',
|
||||
'bindKey',
|
||||
'clearTimeout',
|
||||
'clone',
|
||||
'cloneDeep',
|
||||
'collect',
|
||||
@@ -75,6 +88,7 @@
|
||||
'compose',
|
||||
'contains',
|
||||
'countBy',
|
||||
'createCallback',
|
||||
'criteria',
|
||||
'debounce',
|
||||
'defaults',
|
||||
@@ -84,14 +98,19 @@
|
||||
'difference',
|
||||
'drop',
|
||||
'each',
|
||||
'enumPrototypes',
|
||||
'environment',
|
||||
'escape',
|
||||
'evaluate',
|
||||
'every',
|
||||
'exports',
|
||||
'extend',
|
||||
'fastBind',
|
||||
'fastKeys',
|
||||
'filter',
|
||||
'find',
|
||||
'findIndex',
|
||||
'findKey',
|
||||
'first',
|
||||
'flatten',
|
||||
'foldl',
|
||||
@@ -105,6 +124,7 @@
|
||||
'has',
|
||||
'head',
|
||||
'identity',
|
||||
'imports',
|
||||
'include',
|
||||
'index',
|
||||
'indexOf',
|
||||
@@ -136,6 +156,7 @@
|
||||
'keys',
|
||||
'last',
|
||||
'lastIndexOf',
|
||||
'leading',
|
||||
'map',
|
||||
'max',
|
||||
'memoize',
|
||||
@@ -144,12 +165,17 @@
|
||||
'min',
|
||||
'mixin',
|
||||
'noConflict',
|
||||
'nodeClass',
|
||||
'nonEnumArgs',
|
||||
'nonEnumShadows',
|
||||
'object',
|
||||
'omit',
|
||||
'once',
|
||||
'opera',
|
||||
'ownLast',
|
||||
'pairs',
|
||||
'parseInt',
|
||||
'partial',
|
||||
'partialRight',
|
||||
'pick',
|
||||
'pluck',
|
||||
'random',
|
||||
@@ -159,13 +185,18 @@
|
||||
'reject',
|
||||
'rest',
|
||||
'result',
|
||||
'runInContext',
|
||||
'select',
|
||||
'setImmediate',
|
||||
'setTimeout',
|
||||
'shuffle',
|
||||
'size',
|
||||
'some',
|
||||
'sortBy',
|
||||
'sortedIndex',
|
||||
'source',
|
||||
'spliceObjects',
|
||||
'support',
|
||||
'tail',
|
||||
'take',
|
||||
'tap',
|
||||
@@ -174,27 +205,28 @@
|
||||
'throttle',
|
||||
'times',
|
||||
'toArray',
|
||||
'trailing',
|
||||
'unescape',
|
||||
'unindexedChars',
|
||||
'union',
|
||||
'uniq',
|
||||
'unique',
|
||||
'uniqueId',
|
||||
'unzip',
|
||||
'value',
|
||||
'values',
|
||||
'variable',
|
||||
'VERSION',
|
||||
'where',
|
||||
'window',
|
||||
'without',
|
||||
'wrap',
|
||||
'zip',
|
||||
'zipObject',
|
||||
|
||||
// properties used by the `backbone` and `underscore` builds
|
||||
'__chain__',
|
||||
'chain',
|
||||
|
||||
// properties used by underscore.js
|
||||
'_chain',
|
||||
'_wrapped'
|
||||
'findWhere'
|
||||
];
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
@@ -216,20 +248,20 @@
|
||||
if (options.isTemplate) {
|
||||
return source;
|
||||
}
|
||||
// remove copyright/license header to add later in post-compile.js
|
||||
source = source.replace(/\/\*![\s\S]+?\*\//, '');
|
||||
|
||||
// add brackets to whitelisted properties so the Closure Compiler won't mung them
|
||||
// http://code.google.com/closure/compiler/docs/api-tutorial3.html#export
|
||||
source = source.replace(RegExp('\\.(' + propWhitelist.join('|') + ')\\b', 'g'), function(match, prop) {
|
||||
return "['" + prop.replace(/['\n\r\t]/g, '\\$&') + "']";
|
||||
});
|
||||
|
||||
// remove brackets from `_.escape()` in `_.template`
|
||||
source = source.replace(/__e *= *_\['escape']/g, '__e=_.escape');
|
||||
// remove brackets from `lodash.createCallback` in `eachIteratorOptions`
|
||||
source = source.replace('lodash[\'createCallback\'](callback, thisArg)"', 'lodash.createCallback(callback, thisArg)"');
|
||||
|
||||
// remove brackets from `_.escape()` in underscore.js `_.template`
|
||||
source = source.replace(/_\['escape'\]\(__t'/g, '_.escape(__t');
|
||||
// remove brackets from `lodash.createCallback` in `_.assign`
|
||||
source = source.replace("' var callback = lodash['createCallback']", "'var callback=lodash.createCallback");
|
||||
|
||||
// remove brackets from `_.escape` in `_.template`
|
||||
source = source.replace(/__e *= *_\['escape']/g, '__e=_.escape');
|
||||
|
||||
// remove brackets from `collection.indexOf` in `_.contains`
|
||||
source = source.replace("collection['indexOf'](target)", 'collection.indexOf(target)');
|
||||
@@ -238,27 +270,21 @@
|
||||
source = source.replace("result[length]['value']", 'result[length].value');
|
||||
|
||||
// remove whitespace from string literals
|
||||
source = source.replace(/^([ "'\w]+:)? *"(?:(?=(\\?))\2.)*?"|'(?:(?=(\\?))\3.)*?'/gm, function(string, captured) {
|
||||
// remove object literal property name
|
||||
if (/:$/.test(captured)) {
|
||||
string = string.slice(captured.length);
|
||||
source = source.replace(/^((?:[ "'\w]+:)? *)"[^"\\\n]*(?:\\.[^"\\\n]*)*"|'[^'\\\n]*(?:\\.[^'\\\n]*)*'/gm, function(string, left) {
|
||||
// clip after an object literal property name or leading spaces
|
||||
if (left) {
|
||||
string = string.slice(left.length);
|
||||
}
|
||||
// avoids removing the '\n' of the `stringEscapes` object
|
||||
string = string.replace(/\[object |delete |else |function | in |return\s+[\w"']|throw |typeof |use strict|var |@ |(["'])\\n\1|\\\\n|\\n|\s+/g, function(match) {
|
||||
string = string.replace(/\[object |delete |else (?!{)|function | in |return\s+[\w"']|throw |typeof |use strict|var |@ |(["'])\\n\1|\\\\n|\\n|\s+/g, function(match) {
|
||||
return match == false || match == '\\n' ? '' : match;
|
||||
});
|
||||
// prepend object literal property name
|
||||
return (captured || '') + string;
|
||||
// unclip
|
||||
return (left || '') + string;
|
||||
});
|
||||
|
||||
// add newline to `+"__p+='"` in underscore.js `_.template`
|
||||
source = source.replace(/\+"__p\+='"/g, '+"\\n__p+=\'"');
|
||||
|
||||
// add newline to `body + '}'` in `createFunction`
|
||||
source = source.replace(/body *\+ *'}'/, 'body+"\\n}"');
|
||||
|
||||
// remove whitespace from `_.template` related regexes
|
||||
source = source.replace(/(?:reEmptyString\w+|reInsertVariable) *=.+/g, function(match) {
|
||||
source = source.replace(/reEmptyString\w+ *=.+/g, function(match) {
|
||||
return match.replace(/ |\\n/g, '');
|
||||
});
|
||||
|
||||
@@ -267,9 +293,6 @@
|
||||
.replace('"__p += \'"', '"__p+=\'"')
|
||||
.replace('"\';\n"', '"\';"')
|
||||
|
||||
// remove `useSourceURL` variable
|
||||
source = source.replace(/(?:\n +\/\*[^*]*\*+(?:[^\/][^*]*\*+)*\/)?\n *try *\{(?:\s*\/\/.*)*\n *var useSourceURL[\s\S]+?catch[^}]+}\n/, '');
|
||||
|
||||
// remove debug sourceURL use in `_.template`
|
||||
source = source.replace(/(?:\s*\/\/.*\n)* *var sourceURL[^;]+;|\+ *sourceURL/g, '');
|
||||
|
||||
@@ -286,18 +309,21 @@
|
||||
|
||||
// minify properties
|
||||
properties.forEach(function(property, index) {
|
||||
var reBracketProp = RegExp("\\['(" + property + ")'\\]", 'g'),
|
||||
var minName = minNames[index],
|
||||
reBracketProp = RegExp("\\['(" + property + ")'\\]", 'g'),
|
||||
reDotProp = RegExp('\\.' + property + '\\b', 'g'),
|
||||
rePropColon = RegExp("([^?\\s])\\s*([\"'])?\\b" + property + "\\2 *:", 'g');
|
||||
|
||||
modified = modified
|
||||
.replace(reBracketProp, "['" + minNames[index] + "']")
|
||||
.replace(reDotProp, "['" + minNames[index] + "']")
|
||||
.replace(rePropColon, "$1'" + minNames[index] + "':");
|
||||
.replace(reBracketProp, "['" + minName + "']")
|
||||
.replace(reDotProp, "['" + minName + "']")
|
||||
.replace(rePropColon, "$1'" + minName + "':");
|
||||
});
|
||||
|
||||
// replace with modified snippet
|
||||
source = source.replace(snippet, modified);
|
||||
source = source.replace(snippet, function() {
|
||||
return modified;
|
||||
});
|
||||
});
|
||||
}());
|
||||
|
||||
@@ -307,7 +333,7 @@
|
||||
// match the `iteratorTemplate`
|
||||
'( +)var iteratorTemplate\\b[\\s\\S]+?\\n\\1}',
|
||||
// match methods created by `createIterator` calls
|
||||
'createIterator\\((?:{|[a-zA-Z]+)[\\s\\S]+?\\);\\n',
|
||||
'createIterator\\((?:{|[a-zA-Z]+)[\\s\\S]*?\\);\\n',
|
||||
// match variables storing `createIterator` options
|
||||
'( +)var [a-zA-Z]+IteratorOptions\\b[\\s\\S]+?\\n\\2}',
|
||||
// match the the `createIterator` function
|
||||
@@ -330,42 +356,38 @@
|
||||
return "['" + prop.replace(/['\n\r\t]/g, '\\$&') + "']";
|
||||
});
|
||||
|
||||
if (isCreateIterator) {
|
||||
// replace with modified snippet early and clip snippet to the `factory`
|
||||
// call so other arguments aren't minified
|
||||
source = source.replace(snippet, modified);
|
||||
snippet = modified = modified.replace(/factory\([\s\S]+$/, '');
|
||||
}
|
||||
|
||||
// minify snippet variables / arguments
|
||||
compiledVars.forEach(function(variable, index) {
|
||||
// ensure properties in compiled strings aren't minified
|
||||
modified = modified.replace(RegExp('([^.]\\b)' + variable + '\\b(?!\' *[\\]:])', 'g'), '$1' + minNames[index]);
|
||||
|
||||
// correct `typeof` values
|
||||
if (/^(?:boolean|function|object|number|string|undefined)$/.test(variable)) {
|
||||
modified = modified.replace(RegExp("(typeof [^']+')" + minNames[index] + "'", 'g'), '$1' + variable + "'");
|
||||
}
|
||||
});
|
||||
|
||||
// minify `createIterator` option property names
|
||||
iteratorOptions.forEach(function(property, index) {
|
||||
if (isIteratorTemplate) {
|
||||
// minify property names as interpolated template variables
|
||||
modified = modified.replace(RegExp('\\b' + property + '\\b', 'g'), minNames[index]);
|
||||
var minName = minNames[index];
|
||||
|
||||
// minify variables in `iteratorTemplate` or property names in everything else
|
||||
modified = isIteratorTemplate
|
||||
? modified.replace(RegExp('\\b' + property + '\\b', 'g'), minName)
|
||||
: modified.replace(RegExp("'" + property + "'", 'g'), "'" + minName + "'");
|
||||
});
|
||||
|
||||
// minify snippet variables / arguments
|
||||
compiledVars.forEach(function(varName, index) {
|
||||
var minName = minNames[index];
|
||||
|
||||
// minify variable names present in strings
|
||||
if (isCreateIterator) {
|
||||
modified = modified.replace(RegExp('(([\'"])[^\\n\\2]*?)\\b' + varName + '\\b(?=[^\\n\\2]*\\2[ ,+]+$)', 'gm'), '$1' + minName);
|
||||
}
|
||||
// ensure properties in compiled strings aren't minified
|
||||
else {
|
||||
// minify property name strings
|
||||
modified = modified.replace(RegExp("'" + property + "'", 'g'), "'" + minNames[index] + "'");
|
||||
// minify property names in accessors
|
||||
if (isCreateIterator) {
|
||||
modified = modified.replace(RegExp('\\.' + property + '\\b' , 'g'), '.' + minNames[index]);
|
||||
}
|
||||
modified = modified.replace(RegExp('([^.])\\b' + varName + '\\b(?!\' *[\\]:])', 'g'), '$1' + minName);
|
||||
}
|
||||
// correct `typeof` values
|
||||
if (/^(?:boolean|function|object|number|string|undefined)$/.test(varName)) {
|
||||
modified = modified.replace(RegExp("(typeof [^']+')" + minName + "'", 'g'), '$1' + varName + "'");
|
||||
}
|
||||
});
|
||||
|
||||
// replace with modified snippet
|
||||
source = source.replace(snippet, modified);
|
||||
source = source.replace(snippet, function() {
|
||||
return modified;
|
||||
});
|
||||
});
|
||||
|
||||
return source;
|
||||
|
||||
98
build/util.js
Executable file
@@ -0,0 +1,98 @@
|
||||
#!/usr/bin/env node
|
||||
;(function() {
|
||||
'use strict';
|
||||
|
||||
/** Load Node.js modules */
|
||||
var fs = require('fs'),
|
||||
path = require('path');
|
||||
|
||||
/** Load other modules */
|
||||
var _ = require('../lodash.js');
|
||||
|
||||
/** Used to indicate if running in Windows */
|
||||
var isWindows = process.platform == 'win32';
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* The path separator.
|
||||
*
|
||||
* @memberOf util.path
|
||||
* @type String
|
||||
*/
|
||||
var sep = path.sep || (isWindows ? '\\' : '/');
|
||||
|
||||
/**
|
||||
* The escaped path separator used for inclusion in RegExp strings.
|
||||
*
|
||||
* @memberOf util.path
|
||||
* @type String
|
||||
*/
|
||||
var sepEscaped = sep.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
||||
|
||||
/** Used to determine if a path is prefixed with a drive letter, dot, or slash */
|
||||
var rePrefixed = RegExp('^(?:' + (isWindows ? '[a-zA-Z]:|' : '') + '\\.?)' + sepEscaped);
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Makes the given `dirname` directory, without throwing errors for existing
|
||||
* directories and making parent directories as needed.
|
||||
*
|
||||
* @memberOf util.fs
|
||||
* @param {String} dirname The path of the directory.
|
||||
* @param {Number|String} [mode='0777'] The permission mode.
|
||||
*/
|
||||
function mkdirpSync(dirname, mode) {
|
||||
// ensure relative paths are prefixed with `./`
|
||||
if (!rePrefixed.test(dirname)) {
|
||||
dirname = '.' + sep + dirname;
|
||||
}
|
||||
dirname.split(sep).reduce(function(currPath, segment) {
|
||||
currPath += sep + segment;
|
||||
try {
|
||||
currPath = fs.realpathSync(currPath);
|
||||
} catch(e) {
|
||||
fs.mkdirSync(currPath, mode);
|
||||
}
|
||||
return currPath;
|
||||
});
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* The utility object.
|
||||
*
|
||||
* @type Object
|
||||
*/
|
||||
var util = {
|
||||
|
||||
/**
|
||||
* The file system object.
|
||||
*
|
||||
* @memberOf util
|
||||
* @type Object
|
||||
*/
|
||||
'fs': _.defaults(_.cloneDeep(fs), {
|
||||
'existsSync': fs.existsSync || path.existsSync,
|
||||
'mkdirpSync': mkdirpSync
|
||||
}),
|
||||
|
||||
/**
|
||||
* The path object.
|
||||
*
|
||||
* @memberOf util
|
||||
* @type Object
|
||||
*/
|
||||
'path': _.defaults(_.cloneDeep(path), {
|
||||
'sep': sep,
|
||||
'sepEscaped': sepEscaped
|
||||
})
|
||||
};
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
// expose
|
||||
module.exports = util;
|
||||
}());
|
||||
5516
dist/lodash.compat.js
vendored
Normal file
46
dist/lodash.compat.min.js
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
/**
|
||||
* @license
|
||||
* Lo-Dash 1.2.0 (Custom Build) lodash.com/license
|
||||
* Build: `lodash -o ./dist/lodash.compat.js`
|
||||
* Underscore.js 1.4.4 underscorejs.org/LICENSE
|
||||
*/
|
||||
;(function(n){function t(r){function a(n){return n&&typeof n=="object"&&!Z(n)&&Qt.call(n,"__wrapped__")?n:new U(n)}function F(n){var t=n.length,e=t>=l;if(e)for(var r={},u=-1;++u<t;){var a=f+n[u];(r[a]||(r[a]=[])).push(n[u])}return function(t){if(e){var u=f+t;return r[u]&&-1<_t(r[u],t)}return-1<_t(n,t)}}function R(n){return n.charCodeAt(0)}function T(n,t){var e=n.b,r=t.b;if(n=n.a,t=t.a,n!==t){if(n>t||typeof n=="undefined")return 1;if(n<t||typeof t=="undefined")return-1}return e<r?-1:1}function D(n,t,e,r){function u(){var r=arguments,l=o?this:t;
|
||||
return a||(n=t[i]),e.length&&(r=r.length?(r=le.call(r),f?r.concat(e):e.concat(r)):e),this instanceof u?(V.prototype=n.prototype,l=new V,V.prototype=null,r=n.apply(l,r),et(r)?r:l):n.apply(l,r)}var a=tt(n),o=!e,i=t;if(o){var f=r;e=t}else if(!a){if(!r)throw new Dt;t=n}return u}function z(){for(var n,t={g:C,b:"k(m)",c:"",e:"m",f:"",h:"",i:!0,j:!!de},e=0;n=arguments[e];e++)for(var r in n)t[r]=n[r];if(n=t.a,t.d=/^[^,]+/.exec(n)[0],e=$t,r="var i,m="+t.d+",u="+t.e+";if(!m)return u;"+t.h+";",t.b?(r+="var n=m.length;i=-1;if("+t.b+"){",ve.unindexedChars&&(r+="if(l(m)){m=m.split('')}"),r+="while(++i<n){"+t.f+"}}else{"):ve.nonEnumArgs&&(r+="var n=m.length;i=-1;if(n&&j(m)){while(++i<n){i+='';"+t.f+"}}else{"),ve.enumPrototypes&&(r+="var v=typeof m=='function';"),t.i&&t.j)r+="var s=-1,t=r[typeof m]?o(m):[],n=t.length;while(++s<n){i=t[s];",ve.enumPrototypes&&(r+="if(!(v&&i=='prototype')){"),r+=t.f,ve.enumPrototypes&&(r+="}"),r+="}";
|
||||
else if(r+="for(i in m){",(ve.enumPrototypes||t.i)&&(r+="if(",ve.enumPrototypes&&(r+="!(v&&i=='prototype')"),ve.enumPrototypes&&t.i&&(r+="&&"),t.i&&(r+="h.call(m,i)"),r+="){"),r+=t.f+";",(ve.enumPrototypes||t.i)&&(r+="}"),r+="}",ve.nonEnumShadows){r+="var f=m.constructor;";for(var u=0;7>u;u++)r+="i='"+t.g[u]+"';if(","constructor"==t.g[u]&&(r+="!(f&&f.prototype===m)&&"),r+="h.call(m,i)){"+t.f+"}"}return(t.b||ve.nonEnumArgs)&&(r+="}"),r+=t.c+";return u",e("h,j,k,l,o,p,r","return function("+n+"){"+r+"}")(Qt,Q,Z,ut,de,a,$)
|
||||
}function L(n){return"\\"+q[n]}function K(n){return _e[n]}function M(n){return typeof n.toString!="function"&&typeof(n+"")=="string"}function U(n){this.__wrapped__=n}function V(){}function G(n){var t=!1;if(!n||Zt.call(n)!=A||!ve.argsClass&&Q(n))return t;var e=n.constructor;return(tt(e)?e instanceof e:ve.nodeClass||!M(n))?ve.ownLast?(ke(n,function(n,e,r){return t=Qt.call(r,e),!1}),!0===t):(ke(n,function(n,e){t=e}),!1===t||Qt.call(n,t)):t}function H(n,t,e){t||(t=0),typeof e=="undefined"&&(e=n?n.length:0);
|
||||
var r=-1;e=e-t||0;for(var u=It(0>e?0:e);++r<e;)u[r]=n[t+r];return u}function J(n){return we[n]}function Q(n){return Zt.call(n)==j}function W(n,t,r,u,o,i){var f=n;if(typeof t=="function"&&(u=r,r=t,t=!1),typeof r=="function"){if(r=typeof u=="undefined"?r:a.createCallback(r,u,1),f=r(f),typeof f!="undefined")return f;f=n}if(u=et(f)){var l=Zt.call(f);if(!N[l]||!ve.nodeClass&&M(f))return f;var c=Z(f)}if(!u||!t)return u?c?H(f):Ce({},f):f;switch(u=se[l],l){case x:case O:return new u(+f);case S:case P:return new u(f);
|
||||
case I:return u(f.source,h.exec(f))}for(o||(o=[]),i||(i=[]),l=o.length;l--;)if(o[l]==n)return i[l];return f=c?u(f.length):{},c&&(Qt.call(n,"index")&&(f.index=n.index),Qt.call(n,"input")&&(f.input=n.input)),o.push(n),i.push(f),(c?pt:xe)(n,function(n,u){f[u]=W(n,t,r,e,o,i)}),f}function X(n){var t=[];return ke(n,function(n,e){tt(n)&&t.push(e)}),t.sort()}function Y(n){for(var t=-1,e=de(n),r=e.length,u={};++t<r;){var a=e[t];u[n[a]]=a}return u}function Z(n){return ve.argsObject&&n instanceof It||(te?te(n):Zt.call(n)==k)
|
||||
}function nt(n,t,e,r,u,o){var f=e===i;if(typeof e=="function"&&!f){e=a.createCallback(e,r,2);var l=e(n,t);if(typeof l!="undefined")return!!l}if(n===t)return 0!==n||1/n==1/t;var c=typeof n,p=typeof t;if(n===n&&(!n||"function"!=c&&"object"!=c)&&(!t||"function"!=p&&"object"!=p))return!1;if(null==n||null==t)return n===t;if(p=Zt.call(n),c=Zt.call(t),p==j&&(p=A),c==j&&(c=A),p!=c)return!1;switch(p){case x:case O:return+n==+t;case S:return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case I:case P:return n==Tt(t)}if(c=p==k,!c){if(Qt.call(n,"__wrapped__")||Qt.call(t,"__wrapped__"))return nt(n.__wrapped__||n,t.__wrapped__||t,e,r,u,o);
|
||||
if(p!=A||!ve.nodeClass&&(M(n)||M(t)))return!1;var p=!ve.argsObject&&Q(n)?Ft:n.constructor,s=!ve.argsObject&&Q(t)?Ft:t.constructor;if(p!=s&&(!tt(p)||!(p instanceof p&&tt(s)&&s instanceof s)))return!1}for(u||(u=[]),o||(o=[]),p=u.length;p--;)if(u[p]==n)return o[p]==t;var v=0,l=!0;if(u.push(n),o.push(t),c){if(p=n.length,v=t.length,l=v==n.length,!l&&!f)return l;for(;v--;)if(c=p,s=t[v],f)for(;c--&&!(l=nt(n[c],s,e,r,u,o)););else if(!(l=nt(n[v],s,e,r,u,o)))break;return l}return ke(t,function(t,a,i){return Qt.call(i,a)?(v++,l=Qt.call(n,a)&&nt(n[a],t,e,r,u,o)):void 0
|
||||
}),l&&!f&&ke(n,function(n,t,e){return Qt.call(e,t)?l=-1<--v:void 0}),l}function tt(n){return typeof n=="function"}function et(n){return n?$[typeof n]:!1}function rt(n){return typeof n=="number"||Zt.call(n)==S}function ut(n){return typeof n=="string"||Zt.call(n)==P}function at(n,t,e){var r=arguments,u=0,o=2;if(!et(n))return n;if(e===i)var f=r[3],l=r[4],c=r[5];else l=[],c=[],typeof e!="number"&&(o=r.length),3<o&&"function"==typeof r[o-2]?f=a.createCallback(r[--o-1],r[o--],2):2<o&&"function"==typeof r[o-1]&&(f=r[--o]);
|
||||
for(;++u<o;)(Z(r[u])?pt:xe)(r[u],function(t,e){var r,u,a=t,o=n[e];if(t&&((u=Z(t))||Oe(t))){for(a=l.length;a--;)if(r=l[a]==t){o=c[a];break}if(!r){var p;f&&(a=f(o,t),p=typeof a!="undefined")&&(o=a),p||(o=u?Z(o)?o:[]:Oe(o)?o:{}),l.push(t),c.push(o),p||(o=at(o,t,i,f,l,c))}}else f&&(a=f(o,t),typeof a=="undefined"&&(a=t)),typeof a!="undefined"&&(o=a);n[e]=o});return n}function ot(n){for(var t=-1,e=de(n),r=e.length,u=It(r);++t<r;)u[t]=n[e[t]];return u}function it(n,t,e){var r=-1,u=n?n.length:0,a=!1;return e=(0>e?ae(0,u+e):e)||0,typeof u=="number"?a=-1<(ut(n)?n.indexOf(t,e):_t(n,t,e)):be(n,function(n){return++r<e?void 0:!(a=n===t)
|
||||
}),a}function ft(n,t,e){var r=!0;if(t=a.createCallback(t,e),Z(n)){e=-1;for(var u=n.length;++e<u&&(r=!!t(n[e],e,n)););}else be(n,function(n,e,u){return r=!!t(n,e,u)});return r}function lt(n,t,e){var r=[];if(t=a.createCallback(t,e),Z(n)){e=-1;for(var u=n.length;++e<u;){var o=n[e];t(o,e,n)&&r.push(o)}}else be(n,function(n,e,u){t(n,e,u)&&r.push(n)});return r}function ct(n,t,e){if(t=a.createCallback(t,e),!Z(n)){var r;return be(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 pt(n,t,e){if(t&&typeof e=="undefined"&&Z(n)){e=-1;for(var r=n.length;++e<r&&!1!==t(n[e],e,n););}else be(n,t,e);return n}function st(n,t,e){var r=-1,u=n?n.length:0,o=It(typeof u=="number"?u:0);if(t=a.createCallback(t,e),Z(n))for(;++r<u;)o[r]=t(n[r],r,n);else be(n,function(n,e,u){o[++r]=t(n,e,u)});return o}function vt(n,t,e){var r=-1/0,u=r;if(!t&&Z(n)){e=-1;for(var o=n.length;++e<o;){var i=n[e];i>u&&(u=i)}}else t=!t&&ut(n)?R:a.createCallback(t,e),be(n,function(n,e,a){e=t(n,e,a),e>r&&(r=e,u=n)
|
||||
});return u}function gt(n,t,e,r){var u=3>arguments.length;if(t=a.createCallback(t,r,4),Z(n)){var o=-1,i=n.length;for(u&&(e=n[++o]);++o<i;)e=t(e,n[o],o,n)}else be(n,function(n,r,a){e=u?(u=!1,n):t(e,n,r,a)});return e}function ht(n,t,e,r){var u=n,o=n?n.length:0,i=3>arguments.length;if(typeof o!="number")var f=de(n),o=f.length;else ve.unindexedChars&&ut(n)&&(u=n.split(""));return t=a.createCallback(t,r,4),pt(n,function(n,r,a){r=f?f[--o]:--o,e=i?(i=!1,u[r]):t(e,u[r],r,a)}),e}function yt(n,t,e){var r;if(t=a.createCallback(t,e),Z(n)){e=-1;
|
||||
for(var u=n.length;++e<u&&!(r=t(n[e],e,n)););}else be(n,function(n,e,u){return!(r=t(n,e,u))});return!!r}function mt(n){for(var t=-1,e=n?n.length:0,r=Gt.apply(zt,le.call(arguments,1)),r=F(r),u=[];++t<e;){var a=n[t];r(a)||u.push(a)}return u}function dt(n,t,e){if(n){var r=0,u=n.length;if(typeof t!="number"&&null!=t){var o=-1;for(t=a.createCallback(t,e);++o<u&&t(n[o],o,n);)r++}else if(r=t,null==r||e)return n[0];return H(n,0,oe(ae(0,r),u))}}function bt(n,t,e,r){var u=-1,o=n?n.length:0,i=[];for(typeof t!="boolean"&&null!=t&&(r=e,e=t,t=!1),null!=e&&(e=a.createCallback(e,r));++u<o;)r=n[u],e&&(r=e(r,u,n)),Z(r)?Wt.apply(i,t?r:bt(r)):i.push(r);
|
||||
return i}function _t(n,t,e){var r=-1,u=n?n.length:0;if(typeof e=="number")r=(0>e?ae(0,u+e):e||0)-1;else if(e)return r=Ct(n,t),n[r]===t?r:-1;for(;++r<u;)if(n[r]===t)return r;return-1}function wt(n,t,e){if(typeof t!="number"&&null!=t){var r=0,u=-1,o=n?n.length:0;for(t=a.createCallback(t,e);++u<o&&t(n[u],u,n);)r++}else r=null==t||e?1:ae(0,t);return H(n,r)}function Ct(n,t,e,r){var u=0,o=n?n.length:u;for(e=e?a.createCallback(e,r,1):Et,t=e(t);u<o;)r=u+o>>>1,e(n[r])<t?u=r+1:o=r;return u}function jt(n,t,e,r){var u=-1,o=n?n.length:0,i=[],c=i;
|
||||
typeof t!="boolean"&&null!=t&&(r=e,e=t,t=!1);var p=!t&&o>=l;if(p)var s={};for(null!=e&&(c=[],e=a.createCallback(e,r));++u<o;){r=n[u];var v=e?e(r,u,n):r;if(p)var g=f+v,g=s[g]?!(c=s[g]):c=s[g]=[];(t?!u||c[c.length-1]!==v:g||0>_t(c,v))&&((e||p)&&c.push(v),i.push(r))}return i}function kt(n,t){for(var e=-1,r=n?n.length:0,u={};++e<r;){var a=n[e];t?u[a]=t[e]:u[a[0]]=a[1]}return u}function xt(n,t){return ve.fastBind||ne&&2<arguments.length?ne.call.apply(ne,arguments):D(n,t,le.call(arguments,2))}function Ot(n){var t=le.call(arguments,1);
|
||||
return Yt(function(){n.apply(e,t)},1)}function Et(n){return n}function St(n){pt(X(n),function(t){var e=a[t]=n[t];a.prototype[t]=function(){var n=this.__wrapped__,t=[n];return Wt.apply(t,arguments),t=e.apply(a,t),n&&typeof n=="object"&&n==t?this:new U(t)}})}function At(){return this.__wrapped__}r=r?B.defaults(n.Object(),r,B.pick(n,w)):n;var It=r.Array,Pt=r.Boolean,Nt=r.Date,$t=r.Function,qt=r.Math,Bt=r.Number,Ft=r.Object,Rt=r.RegExp,Tt=r.String,Dt=r.TypeError,zt=It(),Lt=Ft(),Kt=r._,Mt=Rt("^"+Tt(Lt.valueOf).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),Ut=qt.ceil,Vt=r.clearTimeout,Gt=zt.concat,Ht=qt.floor,Jt=Mt.test(Jt=Ft.getPrototypeOf)&&Jt,Qt=Lt.hasOwnProperty,Wt=zt.push,Xt=r.setImmediate,Yt=r.setTimeout,Zt=Lt.toString,ne=Mt.test(ne=Zt.bind)&&ne,te=Mt.test(te=It.isArray)&&te,ee=r.isFinite,re=r.isNaN,ue=Mt.test(ue=Ft.keys)&&ue,ae=qt.max,oe=qt.min,ie=r.parseInt,fe=qt.random,le=zt.slice,ce=Mt.test(r.attachEvent),pe=ne&&!/\n|true/.test(ne+ce),se={};
|
||||
se[k]=It,se[x]=Pt,se[O]=Nt,se[A]=Ft,se[S]=Bt,se[I]=Rt,se[P]=Tt;var ve=a.support={};(function(){var n=function(){this.x=1},t={0:1,length:1},e=[];n.prototype={valueOf:1,y:1};for(var r in new n)e.push(r);for(r in arguments);ve.argsObject=arguments.constructor==Ft&&!(arguments instanceof It),ve.argsClass=Q(arguments),ve.enumPrototypes=n.propertyIsEnumerable("prototype"),ve.fastBind=ne&&!pe,ve.ownLast="x"!=e[0],ve.nonEnumArgs=0!=r,ve.nonEnumShadows=!/valueOf/.test(e),ve.spliceObjects=(zt.splice.call(t,0,1),!t[0]),ve.unindexedChars="xx"!="x"[0]+Ft("x")[0];
|
||||
try{ve.nodeClass=!(Zt.call(document)==A&&!({toString:0}+""))}catch(u){ve.nodeClass=!0}})(1),a.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:y,variable:"",imports:{_:a}};var ge={a:"q,w,g",h:"var a=arguments,b=0,c=typeof g=='number'?2:a.length;while(++b<c){m=a[b];if(m&&r[typeof m]){",f:"if(typeof u[i]=='undefined')u[i]=m[i]",c:"}}"},he={a:"e,d,x",h:"d=d&&typeof x=='undefined'?d:p.createCallback(d,x)",b:"typeof n=='number'",f:"if(d(m[i],i,e)===false)return u"},ye={h:"if(!r[typeof m])return u;"+he.h,b:!1};
|
||||
U.prototype=a.prototype,ve.argsClass||(Q=function(n){return n?Qt.call(n,"callee"):!1});var me=z({a:"q",e:"[]",h:"if(!(r[typeof q]))return u",f:"u.push(i)",b:!1}),de=ue?function(n){return et(n)?ve.enumPrototypes&&typeof n=="function"||ve.nonEnumArgs&&n.length&&Q(n)?me(n):ue(n):[]}:me,be=z(he),_e={"&":"&","<":"<",">":">",'"':""","'":"'"},we=Y(_e),Ce=z(ge,{h:ge.h.replace(";",";if(c>3&&typeof a[c-2]=='function'){var d=p.createCallback(a[--c-1],a[c--],2);}else if(c>2&&typeof a[c-1]=='function'){d=a[--c];}"),f:"u[i]=d?d(u[i],m[i]):m[i]"}),je=z(ge),ke=z(he,ye,{i:!1}),xe=z(he,ye);
|
||||
tt(/x/)&&(tt=function(n){return n instanceof $t||Zt.call(n)==E});var Oe=Jt?function(n){if(!n||Zt.call(n)!=A||!ve.argsClass&&Q(n))return!1;var t=n.valueOf,e=typeof t=="function"&&(e=Jt(t))&&Jt(e);return e?n==e||Jt(n)==e:G(n)}:G;pe&&u&&typeof Xt=="function"&&(Ot=xt(Xt,r));var Ee=8==ie("08")?ie:function(n,t){return ie(ut(n)?n.replace(m,""):n,t||0)};return a.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},a.assign=Ce,a.at=function(n){var t=-1,e=Gt.apply(zt,le.call(arguments,1)),r=e.length,u=It(r);
|
||||
for(ve.unindexedChars&&ut(n)&&(n=n.split(""));++t<r;)u[t]=n[e[t]];return u},a.bind=xt,a.bindAll=function(n){for(var t=1<arguments.length?Gt.apply(zt,le.call(arguments,1)):X(n),e=-1,r=t.length;++e<r;){var u=t[e];n[u]=xt(n[u],n)}return n},a.bindKey=function(n,t){return D(n,t,le.call(arguments,2),i)},a.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},a.compose=function(){var n=arguments;return function(){for(var t=arguments,e=n.length;e--;)t=[n[e].apply(this,t)];
|
||||
return t[0]}},a.countBy=function(n,t,e){var r={};return t=a.createCallback(t,e),pt(n,function(n,e,u){e=Tt(t(n,e,u)),Qt.call(r,e)?r[e]++:r[e]=1}),r},a.createCallback=function(n,t,e){if(null==n)return Et;var r=typeof n;if("function"!=r){if("object"!=r)return function(t){return t[n]};var u=de(n);return function(t){for(var e=u.length,r=!1;e--&&(r=nt(t[u[e]],n[u[e]],i)););return r}}return typeof t!="undefined"?1===e?function(e){return n.call(t,e)}:2===e?function(e,r){return n.call(t,e,r)}:4===e?function(e,r,u,a){return n.call(t,e,r,u,a)
|
||||
}:function(e,r,u){return n.call(t,e,r,u)}:n},a.debounce=function(n,t,e){function r(){i=null,f&&(a=n.apply(o,u))}var u,a,o,i,f=!0;if(!0===e)var l=!0,f=!1;else e&&$[typeof e]&&(l=e.leading,f="trailing"in e?e.trailing:f);return function(){var e=l&&!i;return u=arguments,o=this,Vt(i),i=Yt(r,t),e&&(a=n.apply(o,u)),a}},a.defaults=je,a.defer=Ot,a.delay=function(n,t){var r=le.call(arguments,2);return Yt(function(){n.apply(e,r)},t)},a.difference=mt,a.filter=lt,a.flatten=bt,a.forEach=pt,a.forIn=ke,a.forOwn=xe,a.functions=X,a.groupBy=function(n,t,e){var r={};
|
||||
return t=a.createCallback(t,e),pt(n,function(n,e,u){e=Tt(t(n,e,u)),(Qt.call(r,e)?r[e]:r[e]=[]).push(n)}),r},a.initial=function(n,t,e){if(!n)return[];var r=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=a.createCallback(t,e);o--&&t(n[o],o,n);)r++}else r=null==t||e?1:t||r;return H(n,0,oe(ae(0,u-r),u))},a.intersection=function(n){var t=arguments,e=t.length,r={0:{}},u=-1,a=n?n.length:0,o=a>=l,i=[],c=i;n:for(;++u<a;){var p=n[u];if(o)var s=f+p,s=r[0][s]?!(c=r[0][s]):c=r[0][s]=[];if(s||0>_t(c,p)){o&&c.push(p);
|
||||
for(var v=e;--v;)if(!(r[v]||(r[v]=F(t[v])))(p))continue n;i.push(p)}}return i},a.invert=Y,a.invoke=function(n,t){var e=le.call(arguments,2),r=-1,u=typeof t=="function",a=n?n.length:0,o=It(typeof a=="number"?a:0);return pt(n,function(n){o[++r]=(u?t:n[t]).apply(n,e)}),o},a.keys=de,a.map=st,a.max=vt,a.memoize=function(n,t){var e={};return function(){var r=f+(t?t.apply(this,arguments):arguments[0]);return Qt.call(e,r)?e[r]:e[r]=n.apply(this,arguments)}},a.merge=at,a.min=function(n,t,e){var r=1/0,u=r;
|
||||
if(!t&&Z(n)){e=-1;for(var o=n.length;++e<o;){var i=n[e];i<u&&(u=i)}}else t=!t&&ut(n)?R:a.createCallback(t,e),be(n,function(n,e,a){e=t(n,e,a),e<r&&(r=e,u=n)});return u},a.omit=function(n,t,e){var r=typeof t=="function",u={};if(r)t=a.createCallback(t,e);else var o=Gt.apply(zt,le.call(arguments,1));return ke(n,function(n,e,a){(r?!t(n,e,a):0>_t(o,e))&&(u[e]=n)}),u},a.once=function(n){var t,e;return function(){return t?e:(t=!0,e=n.apply(this,arguments),n=null,e)}},a.pairs=function(n){for(var t=-1,e=de(n),r=e.length,u=It(r);++t<r;){var a=e[t];
|
||||
u[t]=[a,n[a]]}return u},a.partial=function(n){return D(n,le.call(arguments,1))},a.partialRight=function(n){return D(n,le.call(arguments,1),null,i)},a.pick=function(n,t,e){var r={};if(typeof t!="function")for(var u=-1,o=Gt.apply(zt,le.call(arguments,1)),i=et(n)?o.length:0;++u<i;){var f=o[u];f in n&&(r[f]=n[f])}else t=a.createCallback(t,e),ke(n,function(n,e,u){t(n,e,u)&&(r[e]=n)});return r},a.pluck=st,a.range=function(n,t,e){n=+n||0,e=+e||1,null==t&&(t=n,n=0);var r=-1;t=ae(0,Ut((t-n)/e));for(var u=It(t);++r<t;)u[r]=n,n+=e;
|
||||
return u},a.reject=function(n,t,e){return t=a.createCallback(t,e),lt(n,function(n,e,r){return!t(n,e,r)})},a.rest=wt,a.shuffle=function(n){var t=-1,e=n?n.length:0,r=It(typeof e=="number"?e:0);return pt(n,function(n){var e=Ht(fe()*(++t+1));r[t]=r[e],r[e]=n}),r},a.sortBy=function(n,t,e){var r=-1,u=n?n.length:0,o=It(typeof u=="number"?u:0);for(t=a.createCallback(t,e),pt(n,function(n,e,u){o[++r]={a:t(n,e,u),b:r,c:n}}),u=o.length,o.sort(T);u--;)o[u]=o[u].c;return o},a.tap=function(n,t){return t(n),n},a.throttle=function(n,t,e){function r(){f=new Nt,i=null,c&&(a=n.apply(o,u))
|
||||
}var u,a,o,i,f=0,l=!0,c=!0;return!1===e?l=!1:e&&$[typeof e]&&(l="leading"in e?e.leading:l,c="trailing"in e?e.trailing:c),function(){var e=new Nt;!i&&!l&&(f=e);var c=t-(e-f);return u=arguments,o=this,0<c?i||(i=Yt(r,c)):(Vt(i),i=null,f=e,a=n.apply(o,u)),a}},a.times=function(n,t,e){n=-1<(n=+n)?n:0;var r=-1,u=It(n);for(t=a.createCallback(t,e,1);++r<n;)u[r]=t(r);return u},a.toArray=function(n){return n&&typeof n.length=="number"?ve.unindexedChars&&ut(n)?n.split(""):H(n):ot(n)},a.union=function(n){return Z(n)||(arguments[0]=n?le.call(n):zt),jt(Gt.apply(zt,arguments))
|
||||
},a.uniq=jt,a.unzip=function(n){for(var t=-1,e=n?n.length:0,r=e?vt(st(n,"length")):0,u=It(r);++t<e;)for(var a=-1,o=n[t];++a<r;)(u[a]||(u[a]=It(e)))[t]=o[a];return u},a.values=ot,a.where=lt,a.without=function(n){return mt(n,le.call(arguments,1))},a.wrap=function(n,t){return function(){var e=[n];return Wt.apply(e,arguments),t.apply(this,e)}},a.zip=function(n){for(var t=-1,e=n?vt(st(arguments,"length")):0,r=It(e);++t<e;)r[t]=st(arguments,t);return r},a.zipObject=kt,a.collect=st,a.drop=wt,a.each=pt,a.extend=Ce,a.methods=X,a.object=kt,a.select=lt,a.tail=wt,a.unique=jt,St(a),a.clone=W,a.cloneDeep=function(n,t,e){return W(n,!0,t,e)
|
||||
},a.contains=it,a.escape=function(n){return null==n?"":Tt(n).replace(b,K)},a.every=ft,a.find=ct,a.findIndex=function(n,t,e){var r=-1,u=n?n.length:0;for(t=a.createCallback(t,e);++r<u;)if(t(n[r],r,n))return r;return-1},a.findKey=function(n,t,e){var r;return t=a.createCallback(t,e),xe(n,function(n,e,u){return t(n,e,u)?(r=e,!1):void 0}),r},a.has=function(n,t){return n?Qt.call(n,t):!1},a.identity=Et,a.indexOf=_t,a.isArguments=Q,a.isArray=Z,a.isBoolean=function(n){return!0===n||!1===n||Zt.call(n)==x},a.isDate=function(n){return n instanceof Nt||Zt.call(n)==O
|
||||
},a.isElement=function(n){return n?1===n.nodeType:!1},a.isEmpty=function(n){var t=!0;if(!n)return t;var e=Zt.call(n),r=n.length;return e==k||e==P||(ve.argsClass?e==j:Q(n))||e==A&&typeof r=="number"&&tt(n.splice)?!r:(xe(n,function(){return t=!1}),t)},a.isEqual=nt,a.isFinite=function(n){return ee(n)&&!re(parseFloat(n))},a.isFunction=tt,a.isNaN=function(n){return rt(n)&&n!=+n},a.isNull=function(n){return null===n},a.isNumber=rt,a.isObject=et,a.isPlainObject=Oe,a.isRegExp=function(n){return n instanceof Rt||Zt.call(n)==I
|
||||
},a.isString=ut,a.isUndefined=function(n){return typeof n=="undefined"},a.lastIndexOf=function(n,t,e){var r=n?n.length:0;for(typeof e=="number"&&(r=(0>e?ae(0,r+e):oe(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},a.mixin=St,a.noConflict=function(){return r._=Kt,this},a.parseInt=Ee,a.random=function(n,t){return null==n&&null==t&&(t=1),n=+n||0,null==t&&(t=n,n=0),n+Ht(fe()*((+t||0)-n+1))},a.reduce=gt,a.reduceRight=ht,a.result=function(n,t){var r=n?n[t]:e;return tt(r)?n[t]():r},a.runInContext=t,a.size=function(n){var t=n?n.length:0;
|
||||
return typeof t=="number"?t:de(n).length},a.some=yt,a.sortedIndex=Ct,a.template=function(n,t,r){var u=a.templateSettings;n||(n=""),r=je({},r,u);var o,i=je({},r.imports,u.imports),u=de(i),i=ot(i),f=0,l=r.interpolate||d,v="__p+='",l=Rt((r.escape||d).source+"|"+l.source+"|"+(l===y?g:d).source+"|"+(r.evaluate||d).source+"|$","g");n.replace(l,function(t,e,r,u,a,i){return r||(r=u),v+=n.slice(f,i).replace(_,L),e&&(v+="'+__e("+e+")+'"),a&&(o=!0,v+="';"+a+";__p+='"),r&&(v+="'+((__t=("+r+"))==null?'':__t)+'"),f=i+t.length,t
|
||||
}),v+="';\n",l=r=r.variable,l||(r="obj",v="with("+r+"){"+v+"}"),v=(o?v.replace(c,""):v).replace(p,"$1").replace(s,"$1;"),v="function("+r+"){"+(l?"":r+"||("+r+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+v+"return __p}";try{var h=$t(u,"return "+v).apply(e,i)}catch(m){throw m.source=v,m}return t?h(t):(h.source=v,h)},a.unescape=function(n){return null==n?"":Tt(n).replace(v,J)},a.uniqueId=function(n){var t=++o;return Tt(null==n?"":n)+t
|
||||
},a.all=ft,a.any=yt,a.detect=ct,a.foldl=gt,a.foldr=ht,a.include=it,a.inject=gt,xe(a,function(n,t){a.prototype[t]||(a.prototype[t]=function(){var t=[this.__wrapped__];return Wt.apply(t,arguments),n.apply(a,t)})}),a.first=dt,a.last=function(n,t,e){if(n){var r=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=a.createCallback(t,e);o--&&t(n[o],o,n);)r++}else if(r=t,null==r||e)return n[u-1];return H(n,ae(0,u-r))}},a.take=dt,a.head=dt,xe(a,function(n,t){a.prototype[t]||(a.prototype[t]=function(t,e){var r=n(this.__wrapped__,t,e);
|
||||
return null==t||e&&typeof t!="function"?r:new U(r)})}),a.VERSION="1.2.0",a.prototype.toString=function(){return Tt(this.__wrapped__)},a.prototype.value=At,a.prototype.valueOf=At,be(["join","pop","shift"],function(n){var t=zt[n];a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),be(["push","reverse","sort","unshift"],function(n){var t=zt[n];a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),be(["concat","slice","splice"],function(n){var t=zt[n];a.prototype[n]=function(){return new U(t.apply(this.__wrapped__,arguments))
|
||||
}}),ve.spliceObjects||be(["pop","shift","splice"],function(n){var t=zt[n],e="splice"==n;a.prototype[n]=function(){var n=this.__wrapped__,r=t.apply(n,arguments);return 0===n.length&&delete n[0],e?new U(r):r}}),a}var e,r=typeof exports=="object"&&exports,u=typeof module=="object"&&module&&module.exports==r&&module,a=typeof global=="object"&&global;(a.global===a||a.window===a)&&(n=a);var o=0,i={},f=+new Date+"",l=200,c=/\b__p\+='';/g,p=/\b(__p\+=)''\+/g,s=/(__e\(.*?\)|\b__t\))\+'';/g,v=/&(?:amp|lt|gt|quot|#39);/g,g=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,h=/\w*$/,y=/<%=([\s\S]+?)%>/g,m=/^0+(?=.$)/,d=/($^)/,b=/[&<>"']/g,_=/['\n\r\t\u2028\u2029\\]/g,w="Array Boolean Date Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),C="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),j="[object Arguments]",k="[object Array]",x="[object Boolean]",O="[object Date]",E="[object Function]",S="[object Number]",A="[object Object]",I="[object RegExp]",P="[object String]",N={};
|
||||
N[E]=!1,N[j]=N[k]=N[x]=N[O]=N[S]=N[A]=N[I]=N[P]=!0;var $={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},q={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"},B=t();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=B,define(function(){return B})):r&&!r.nodeType?u?(u.exports=B)._=B:r._=B:n._=B})(this);
|
||||
5238
dist/lodash.js
vendored
Normal file
44
dist/lodash.min.js
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
/**
|
||||
* @license
|
||||
* Lo-Dash 1.2.0 (Custom Build) lodash.com/license
|
||||
* Build: `lodash modern -o ./dist/lodash.js`
|
||||
* Underscore.js 1.4.4 underscorejs.org/LICENSE
|
||||
*/
|
||||
;(function(n){function t(o){function f(n){if(!n||ue.call(n)!=S)return a;var t=n.valueOf,e=typeof t=="function"&&(e=Zt(t))&&Zt(e);return e?n==e||Zt(n)==e:X(n)}function q(n,t,e){if(!n||!F[typeof n])return n;t=t&&typeof e=="undefined"?t:M.createCallback(t,e);for(var r=-1,u=F[typeof n]?me(n):[],o=u.length;++r<o&&(e=u[r],!(t(n[e],e,n)===a)););return n}function D(n,t,e){var r;if(!n||!F[typeof n])return n;t=t&&typeof e=="undefined"?t:M.createCallback(t,e);for(r in n)if(t(n[r],r,n)===a)break;return n}function z(n,t,e){var r,u=n,a=u;
|
||||
if(!u)return a;for(var o=arguments,i=0,f=typeof e=="number"?2:o.length;++i<f;)if((u=o[i])&&F[typeof u]){var c=u.length;if(r=-1,rt(u))for(;++r<c;)"undefined"==typeof a[r]&&(a[r]=u[r]);else for(var l=-1,p=F[typeof u]?me(u):[],c=p.length;++l<c;)r=p[l],"undefined"==typeof a[r]&&(a[r]=u[r])}return a}function P(n,t,e){var r,u=n,a=u;if(!u)return a;var o=arguments,i=0,f=typeof e=="number"?2:o.length;if(3<f&&"function"==typeof o[f-2])var c=M.createCallback(o[--f-1],o[f--],2);else 2<f&&"function"==typeof o[f-1]&&(c=o[--f]);
|
||||
for(;++i<f;)if((u=o[i])&&F[typeof u]){var l=u.length;if(r=-1,rt(u))for(;++r<l;)a[r]=c?c(a[r],u[r]):u[r];else for(var p=-1,s=F[typeof u]?me(u):[],l=s.length;++p<l;)r=s[p],a[r]=c?c(a[r],u[r]):u[r]}return a}function K(n){var t,e=[];if(!n||!F[typeof n])return e;for(t in n)ne.call(n,t)&&e.push(t);return e}function M(n){return n&&typeof n=="object"&&!rt(n)&&ne.call(n,"__wrapped__")?n:new Q(n)}function U(n){var t=n.length,e=t>=s;if(e)for(var r={},u=-1;++u<t;){var a=p+n[u];(r[a]||(r[a]=[])).push(n[u])}return function(t){if(e){var u=p+t;
|
||||
return r[u]&&-1<xt(r[u],t)}return-1<xt(n,t)}}function V(n){return n.charCodeAt(0)}function G(n,t){var e=n.b,r=t.b;if(n=n.a,t=t.a,n!==t){if(n>t||typeof n=="undefined")return 1;if(n<t||typeof t=="undefined")return-1}return e<r?-1:1}function H(n,t,e,r){function a(){var r=arguments,l=i?this:t;return o||(n=t[f]),e.length&&(r=r.length?(r=ge.call(r),c?r.concat(e):e.concat(r)):e),this instanceof a?(W.prototype=n.prototype,l=new W,W.prototype=u,r=n.apply(l,r),ot(r)?r:l):n.apply(l,r)}var o=at(n),i=!e,f=t;if(i){var c=r;
|
||||
e=t}else if(!o){if(!r)throw new Vt;t=n}return a}function J(n){return"\\"+R[n]}function L(n){return be[n]}function Q(n){this.__wrapped__=n}function W(){}function X(n){var t=a;if(!n||ue.call(n)!=S)return t;var e=n.constructor;return(at(e)?e instanceof e:he.nodeClass||!isNode(n))?(D(n,function(n,e){t=e}),t===a||ne.call(n,t)):t}function Y(n,t,e){t||(t=0),typeof e=="undefined"&&(e=n?n.length:0);var r=-1;e=e-t||0;for(var u=Rt(0>e?0:e);++r<e;)u[r]=n[t+r];return u}function Z(n){return de[n]}function nt(n,t,r,u,o,i){var f=n;
|
||||
if(typeof t=="function"&&(u=r,r=t,t=a),typeof r=="function"){if(r=typeof u=="undefined"?r:M.createCallback(r,u,1),f=r(f),typeof f!="undefined")return f;f=n}if(u=ot(f)){var c=ue.call(f);if(!B[c])return f;var l=rt(f)}if(!u||!t)return u?l?Y(f):P({},f):f;switch(u=ye[c],c){case N:case E:return new u(+f);case I:case $:return new u(f);case A:return u(f.source,b.exec(f))}for(o||(o=[]),i||(i=[]),c=o.length;c--;)if(o[c]==n)return i[c];return f=l?u(f.length):{},l&&(ne.call(n,"index")&&(f.index=n.index),ne.call(n,"input")&&(f.input=n.input)),o.push(n),i.push(f),(l?yt:q)(n,function(n,u){f[u]=nt(n,t,r,e,o,i)
|
||||
}),f}function tt(n){var t=[];return D(n,function(n,e){at(n)&&t.push(e)}),t.sort()}function et(n){for(var t=-1,e=me(n),r=e.length,u={};++t<r;){var a=e[t];u[n[a]]=a}return u}function rt(n){return n instanceof Rt||oe(n)}function ut(n,t,e,o,i,f){var c=e===l;if(typeof e=="function"&&!c){e=M.createCallback(e,o,2);var p=e(n,t);if(typeof p!="undefined")return!!p}if(n===t)return 0!==n||1/n==1/t;var s=typeof n,v=typeof t;if(n===n&&(!n||"function"!=s&&"object"!=s)&&(!t||"function"!=v&&"object"!=v))return a;
|
||||
if(n==u||t==u)return n===t;if(v=ue.call(n),s=ue.call(t),v==x&&(v=S),s==x&&(s=S),v!=s)return a;switch(v){case N:case E:return+n==+t;case I:return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case A:case $:return n==Ut(t)}if(s=v==O,!s){if(ne.call(n,"__wrapped__")||ne.call(t,"__wrapped__"))return ut(n.__wrapped__||n,t.__wrapped__||t,e,o,i,f);if(v!=S)return a;var v=n.constructor,g=t.constructor;if(v!=g&&(!at(v)||!(v instanceof v&&at(g)&&g instanceof g)))return a}for(i||(i=[]),f||(f=[]),v=i.length;v--;)if(i[v]==n)return f[v]==t;
|
||||
var y=0,p=r;if(i.push(n),f.push(t),s){if(v=n.length,y=t.length,p=y==n.length,!p&&!c)return p;for(;y--;)if(s=v,g=t[y],c)for(;s--&&!(p=ut(n[s],g,e,o,i,f)););else if(!(p=ut(n[y],g,e,o,i,f)))break;return p}return D(t,function(t,r,u){return ne.call(u,r)?(y++,p=ne.call(n,r)&&ut(n[r],t,e,o,i,f)):void 0}),p&&!c&&D(n,function(n,t,e){return ne.call(e,t)?p=-1<--y:void 0}),p}function at(n){return typeof n=="function"}function ot(n){return n?F[typeof n]:a}function it(n){return typeof n=="number"||ue.call(n)==I}function ft(n){return typeof n=="string"||ue.call(n)==$
|
||||
}function ct(n,t,e){var r=arguments,u=0,a=2;if(!ot(n))return n;if(e===l)var o=r[3],i=r[4],c=r[5];else i=[],c=[],typeof e!="number"&&(a=r.length),3<a&&"function"==typeof r[a-2]?o=M.createCallback(r[--a-1],r[a--],2):2<a&&"function"==typeof r[a-1]&&(o=r[--a]);for(;++u<a;)(rt(r[u])?yt:q)(r[u],function(t,e){var r,u,a=t,p=n[e];if(t&&((u=rt(t))||f(t))){for(a=i.length;a--;)if(r=i[a]==t){p=c[a];break}if(!r){var s;o&&(a=o(p,t),s=typeof a!="undefined")&&(p=a),s||(p=u?rt(p)?p:[]:f(p)?p:{}),i.push(t),c.push(p),s||(p=ct(p,t,l,o,i,c))
|
||||
}}else o&&(a=o(p,t),typeof a=="undefined"&&(a=t)),typeof a!="undefined"&&(p=a);n[e]=p});return n}function lt(n){for(var t=-1,e=me(n),r=e.length,u=Rt(r);++t<r;)u[t]=n[e[t]];return u}function pt(n,t,e){var r=-1,u=n?n.length:0,o=a;return e=(0>e?le(0,u+e):e)||0,typeof u=="number"?o=-1<(ft(n)?n.indexOf(t,e):xt(n,t,e)):q(n,function(n){return++r<e?void 0:!(o=n===t)}),o}function st(n,t,e){var u=r;t=M.createCallback(t,e),e=-1;var a=n?n.length:0;if(typeof a=="number")for(;++e<a&&(u=!!t(n[e],e,n)););else q(n,function(n,e,r){return u=!!t(n,e,r)
|
||||
});return u}function vt(n,t,e){var r=[];t=M.createCallback(t,e),e=-1;var u=n?n.length:0;if(typeof u=="number")for(;++e<u;){var a=n[e];t(a,e,n)&&r.push(a)}else q(n,function(n,e,u){t(n,e,u)&&r.push(n)});return r}function gt(n,t,e){t=M.createCallback(t,e),e=-1;var r=n?n.length:0;if(typeof r!="number"){var u;return q(n,function(n,e,r){return t(n,e,r)?(u=n,a):void 0}),u}for(;++e<r;){var o=n[e];if(t(o,e,n))return o}}function yt(n,t,e){var r=-1,u=n?n.length:0;if(t=t&&typeof e=="undefined"?t:M.createCallback(t,e),typeof u=="number")for(;++r<u&&t(n[r],r,n)!==a;);else q(n,t);
|
||||
return n}function ht(n,t,e){var r=-1,u=n?n.length:0;if(t=M.createCallback(t,e),typeof u=="number")for(var a=Rt(u);++r<u;)a[r]=t(n[r],r,n);else a=[],q(n,function(n,e,u){a[++r]=t(n,e,u)});return a}function mt(n,t,e){var r=-1/0,u=r;if(!t&&rt(n)){e=-1;for(var a=n.length;++e<a;){var o=n[e];o>u&&(u=o)}}else t=!t&&ft(n)?V:M.createCallback(t,e),yt(n,function(n,e,a){e=t(n,e,a),e>r&&(r=e,u=n)});return u}function bt(n,t){var e=-1,r=n?n.length:0;if(typeof r=="number")for(var u=Rt(r);++e<r;)u[e]=n[e][t];return u||ht(n,t)
|
||||
}function dt(n,t,e,r){if(!n)return e;var u=3>arguments.length;t=M.createCallback(t,r,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(e=n[++o]);++o<i;)e=t(e,n[o],o,n);else q(n,function(n,r,o){e=u?(u=a,n):t(e,n,r,o)});return e}function _t(n,t,e,r){var u=n?n.length:0,o=3>arguments.length;if(typeof u!="number")var i=me(n),u=i.length;return t=M.createCallback(t,r,4),yt(n,function(r,f,c){f=i?i[--u]:--u,e=o?(o=a,n[f]):t(e,n[f],f,c)}),e}function kt(n,t,e){var r;t=M.createCallback(t,e),e=-1;var u=n?n.length:0;
|
||||
if(typeof u=="number")for(;++e<u&&!(r=t(n[e],e,n)););else q(n,function(n,e,u){return!(r=t(n,e,u))});return!!r}function wt(n){for(var t=-1,e=n?n.length:0,r=Xt.apply(Gt,ge.call(arguments,1)),r=U(r),u=[];++t<e;){var a=n[t];r(a)||u.push(a)}return u}function Ct(n,t,e){if(n){var r=0,a=n.length;if(typeof t!="number"&&t!=u){var o=-1;for(t=M.createCallback(t,e);++o<a&&t(n[o],o,n);)r++}else if(r=t,r==u||e)return n[0];return Y(n,0,pe(le(0,r),a))}}function jt(n,t,e,r){var o=-1,i=n?n.length:0,f=[];for(typeof t!="boolean"&&t!=u&&(r=e,e=t,t=a),e!=u&&(e=M.createCallback(e,r));++o<i;)r=n[o],e&&(r=e(r,o,n)),rt(r)?te.apply(f,t?r:jt(r)):f.push(r);
|
||||
return f}function xt(n,t,e){var r=-1,u=n?n.length:0;if(typeof e=="number")r=(0>e?le(0,u+e):e||0)-1;else if(e)return r=Nt(n,t),n[r]===t?r:-1;for(;++r<u;)if(n[r]===t)return r;return-1}function Ot(n,t,e){if(typeof t!="number"&&t!=u){var r=0,a=-1,o=n?n.length:0;for(t=M.createCallback(t,e);++a<o&&t(n[a],a,n);)r++}else r=t==u||e?1:le(0,t);return Y(n,r)}function Nt(n,t,e,r){var u=0,a=n?n.length:u;for(e=e?M.createCallback(e,r,1):$t,t=e(t);u<a;)r=u+a>>>1,e(n[r])<t?u=r+1:a=r;return u}function Et(n,t,e,r){var o=-1,i=n?n.length:0,f=[],c=f;
|
||||
typeof t!="boolean"&&t!=u&&(r=e,e=t,t=a);var l=!t&&i>=s;if(l)var v={};for(e!=u&&(c=[],e=M.createCallback(e,r));++o<i;){r=n[o];var g=e?e(r,o,n):r;if(l)var y=p+g,y=v[y]?!(c=v[y]):c=v[y]=[];(t?!o||c[c.length-1]!==g:y||0>xt(c,g))&&((e||l)&&c.push(g),f.push(r))}return f}function It(n,t){for(var e=-1,r=n?n.length:0,u={};++e<r;){var a=n[e];t?u[a]=t[e]:u[a[0]]=a[1]}return u}function St(n,t){return he.fastBind||ae&&2<arguments.length?ae.call.apply(ae,arguments):H(n,t,ge.call(arguments,2))}function At(n){var t=ge.call(arguments,1);
|
||||
return re(function(){n.apply(e,t)},1)}function $t(n){return n}function Bt(n){yt(tt(n),function(t){var e=M[t]=n[t];M.prototype[t]=function(){var n=this.__wrapped__,t=[n];return te.apply(t,arguments),t=e.apply(M,t),n&&typeof n=="object"&&n==t?this:new Q(t)}})}function Ft(){return this.__wrapped__}o=o?T.defaults(n.Object(),o,T.pick(n,j)):n;var Rt=o.Array,Tt=o.Boolean,qt=o.Date,Dt=o.Function,zt=o.Math,Pt=o.Number,Kt=o.Object,Mt=o.RegExp,Ut=o.String,Vt=o.TypeError,Gt=Rt(),Ht=Kt(),Jt=o._,Lt=Mt("^"+Ut(Ht.valueOf).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),Qt=zt.ceil,Wt=o.clearTimeout,Xt=Gt.concat,Yt=zt.floor,Zt=Lt.test(Zt=Kt.getPrototypeOf)&&Zt,ne=Ht.hasOwnProperty,te=Gt.push,ee=o.setImmediate,re=o.setTimeout,ue=Ht.toString,ae=Lt.test(ae=ue.bind)&&ae,oe=Lt.test(oe=Rt.isArray)&&oe,ie=o.isFinite,fe=o.isNaN,ce=Lt.test(ce=Kt.keys)&&ce,le=zt.max,pe=zt.min,se=o.parseInt,ve=zt.random,ge=Gt.slice,zt=Lt.test(o.attachEvent),zt=ae&&!/\n|true/.test(ae+zt),ye={};
|
||||
ye[O]=Rt,ye[N]=Tt,ye[E]=qt,ye[S]=Kt,ye[I]=Pt,ye[A]=Mt,ye[$]=Ut;var he=M.support={};he.fastBind=ae&&!zt,M.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:d,variable:"",imports:{_:M}},Q.prototype=M.prototype;var me=ce?function(n){return ot(n)?ce(n):[]}:K,be={"&":"&","<":"<",">":">",'"':""","'":"'"},de=et(be);return zt&&i&&typeof ee=="function"&&(At=St(ee,o)),Tt=8==se("08")?se:function(n,t){return se(ft(n)?n.replace(_,""):n,t||0)},M.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0
|
||||
}},M.assign=P,M.at=function(n){for(var t=-1,e=Xt.apply(Gt,ge.call(arguments,1)),r=e.length,u=Rt(r);++t<r;)u[t]=n[e[t]];return u},M.bind=St,M.bindAll=function(n){for(var t=1<arguments.length?Xt.apply(Gt,ge.call(arguments,1)):tt(n),e=-1,r=t.length;++e<r;){var u=t[e];n[u]=St(n[u],n)}return n},M.bindKey=function(n,t){return H(n,t,ge.call(arguments,2),l)},M.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},M.compose=function(){var n=arguments;return function(){for(var t=arguments,e=n.length;e--;)t=[n[e].apply(this,t)];
|
||||
return t[0]}},M.countBy=function(n,t,e){var r={};return t=M.createCallback(t,e),yt(n,function(n,e,u){e=Ut(t(n,e,u)),ne.call(r,e)?r[e]++:r[e]=1}),r},M.createCallback=function(n,t,e){if(n==u)return $t;var r=typeof n;if("function"!=r){if("object"!=r)return function(t){return t[n]};var o=me(n);return function(t){for(var e=o.length,r=a;e--&&(r=ut(t[o[e]],n[o[e]],l)););return r}}return typeof t!="undefined"?1===e?function(e){return n.call(t,e)}:2===e?function(e,r){return n.call(t,e,r)}:4===e?function(e,r,u,a){return n.call(t,e,r,u,a)
|
||||
}:function(e,r,u){return n.call(t,e,r,u)}:n},M.debounce=function(n,t,e){function o(){l=u,p&&(f=n.apply(c,i))}var i,f,c,l,p=r;if(e===r)var s=r,p=a;else e&&F[typeof e]&&(s=e.leading,p="trailing"in e?e.trailing:p);return function(){var e=s&&!l;return i=arguments,c=this,Wt(l),l=re(o,t),e&&(f=n.apply(c,i)),f}},M.defaults=z,M.defer=At,M.delay=function(n,t){var r=ge.call(arguments,2);return re(function(){n.apply(e,r)},t)},M.difference=wt,M.filter=vt,M.flatten=jt,M.forEach=yt,M.forIn=D,M.forOwn=q,M.functions=tt,M.groupBy=function(n,t,e){var r={};
|
||||
return t=M.createCallback(t,e),yt(n,function(n,e,u){e=Ut(t(n,e,u)),(ne.call(r,e)?r[e]:r[e]=[]).push(n)}),r},M.initial=function(n,t,e){if(!n)return[];var r=0,a=n.length;if(typeof t!="number"&&t!=u){var o=a;for(t=M.createCallback(t,e);o--&&t(n[o],o,n);)r++}else r=t==u||e?1:t||r;return Y(n,0,pe(le(0,a-r),a))},M.intersection=function(n){var t=arguments,e=t.length,r={0:{}},u=-1,a=n?n.length:0,o=a>=s,i=[],f=i;n:for(;++u<a;){var c=n[u];if(o)var l=p+c,l=r[0][l]?!(f=r[0][l]):f=r[0][l]=[];if(l||0>xt(f,c)){o&&f.push(c);
|
||||
for(var v=e;--v;)if(!(r[v]||(r[v]=U(t[v])))(c))continue n;i.push(c)}}return i},M.invert=et,M.invoke=function(n,t){var e=ge.call(arguments,2),r=-1,u=typeof t=="function",a=n?n.length:0,o=Rt(typeof a=="number"?a:0);return yt(n,function(n){o[++r]=(u?t:n[t]).apply(n,e)}),o},M.keys=me,M.map=ht,M.max=mt,M.memoize=function(n,t){var e={};return function(){var r=p+(t?t.apply(this,arguments):arguments[0]);return ne.call(e,r)?e[r]:e[r]=n.apply(this,arguments)}},M.merge=ct,M.min=function(n,t,e){var r=1/0,u=r;
|
||||
if(!t&&rt(n)){e=-1;for(var a=n.length;++e<a;){var o=n[e];o<u&&(u=o)}}else t=!t&&ft(n)?V:M.createCallback(t,e),yt(n,function(n,e,a){e=t(n,e,a),e<r&&(r=e,u=n)});return u},M.omit=function(n,t,e){var r=typeof t=="function",u={};if(r)t=M.createCallback(t,e);else var a=Xt.apply(Gt,ge.call(arguments,1));return D(n,function(n,e,o){(r?!t(n,e,o):0>xt(a,e))&&(u[e]=n)}),u},M.once=function(n){var t,e;return function(){return t?e:(t=r,e=n.apply(this,arguments),n=u,e)}},M.pairs=function(n){for(var t=-1,e=me(n),r=e.length,u=Rt(r);++t<r;){var a=e[t];
|
||||
u[t]=[a,n[a]]}return u},M.partial=function(n){return H(n,ge.call(arguments,1))},M.partialRight=function(n){return H(n,ge.call(arguments,1),u,l)},M.pick=function(n,t,e){var r={};if(typeof t!="function")for(var u=-1,a=Xt.apply(Gt,ge.call(arguments,1)),o=ot(n)?a.length:0;++u<o;){var i=a[u];i in n&&(r[i]=n[i])}else t=M.createCallback(t,e),D(n,function(n,e,u){t(n,e,u)&&(r[e]=n)});return r},M.pluck=bt,M.range=function(n,t,e){n=+n||0,e=+e||1,t==u&&(t=n,n=0);var r=-1;t=le(0,Qt((t-n)/e));for(var a=Rt(t);++r<t;)a[r]=n,n+=e;
|
||||
return a},M.reject=function(n,t,e){return t=M.createCallback(t,e),vt(n,function(n,e,r){return!t(n,e,r)})},M.rest=Ot,M.shuffle=function(n){var t=-1,e=n?n.length:0,r=Rt(typeof e=="number"?e:0);return yt(n,function(n){var e=Yt(ve()*(++t+1));r[t]=r[e],r[e]=n}),r},M.sortBy=function(n,t,e){var r=-1,u=n?n.length:0,a=Rt(typeof u=="number"?u:0);for(t=M.createCallback(t,e),yt(n,function(n,e,u){a[++r]={a:t(n,e,u),b:r,c:n}}),u=a.length,a.sort(G);u--;)a[u]=a[u].c;return a},M.tap=function(n,t){return t(n),n},M.throttle=function(n,t,e){function o(){p=new qt,l=u,v&&(f=n.apply(c,i))
|
||||
}var i,f,c,l,p=0,s=r,v=r;return e===a?s=a:e&&F[typeof e]&&(s="leading"in e?e.leading:s,v="trailing"in e?e.trailing:v),function(){var e=new qt;!l&&!s&&(p=e);var r=t-(e-p);return i=arguments,c=this,0<r?l||(l=re(o,r)):(Wt(l),l=u,p=e,f=n.apply(c,i)),f}},M.times=function(n,t,e){n=-1<(n=+n)?n:0;var r=-1,u=Rt(n);for(t=M.createCallback(t,e,1);++r<n;)u[r]=t(r);return u},M.toArray=function(n){return n&&typeof n.length=="number"?Y(n):lt(n)},M.union=function(n){return rt(n)||(arguments[0]=n?ge.call(n):Gt),Et(Xt.apply(Gt,arguments))
|
||||
},M.uniq=Et,M.unzip=function(n){for(var t=-1,e=n?n.length:0,r=e?mt(bt(n,"length")):0,u=Rt(r);++t<e;)for(var a=-1,o=n[t];++a<r;)(u[a]||(u[a]=Rt(e)))[t]=o[a];return u},M.values=lt,M.where=vt,M.without=function(n){return wt(n,ge.call(arguments,1))},M.wrap=function(n,t){return function(){var e=[n];return te.apply(e,arguments),t.apply(this,e)}},M.zip=function(n){for(var t=-1,e=n?mt(bt(arguments,"length")):0,r=Rt(e);++t<e;)r[t]=bt(arguments,t);return r},M.zipObject=It,M.collect=ht,M.drop=Ot,M.each=yt,M.extend=P,M.methods=tt,M.object=It,M.select=vt,M.tail=Ot,M.unique=Et,Bt(M),M.clone=nt,M.cloneDeep=function(n,t,e){return nt(n,r,t,e)
|
||||
},M.contains=pt,M.escape=function(n){return n==u?"":Ut(n).replace(w,L)},M.every=st,M.find=gt,M.findIndex=function(n,t,e){var r=-1,u=n?n.length:0;for(t=M.createCallback(t,e);++r<u;)if(t(n[r],r,n))return r;return-1},M.findKey=function(n,t,e){var r;return t=M.createCallback(t,e),q(n,function(n,e,u){return t(n,e,u)?(r=e,a):void 0}),r},M.has=function(n,t){return n?ne.call(n,t):a},M.identity=$t,M.indexOf=xt,M.isArguments=function(n){return ue.call(n)==x},M.isArray=rt,M.isBoolean=function(n){return n===r||n===a||ue.call(n)==N
|
||||
},M.isDate=function(n){return n instanceof qt||ue.call(n)==E},M.isElement=function(n){return n?1===n.nodeType:a},M.isEmpty=function(n){var t=r;if(!n)return t;var e=ue.call(n),u=n.length;return e==O||e==$||e==x||e==S&&typeof u=="number"&&at(n.splice)?!u:(q(n,function(){return t=a}),t)},M.isEqual=ut,M.isFinite=function(n){return ie(n)&&!fe(parseFloat(n))},M.isFunction=at,M.isNaN=function(n){return it(n)&&n!=+n},M.isNull=function(n){return n===u},M.isNumber=it,M.isObject=ot,M.isPlainObject=f,M.isRegExp=function(n){return n instanceof Mt||ue.call(n)==A
|
||||
},M.isString=ft,M.isUndefined=function(n){return typeof n=="undefined"},M.lastIndexOf=function(n,t,e){var r=n?n.length:0;for(typeof e=="number"&&(r=(0>e?le(0,r+e):pe(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},M.mixin=Bt,M.noConflict=function(){return o._=Jt,this},M.parseInt=Tt,M.random=function(n,t){return n==u&&t==u&&(t=1),n=+n||0,t==u&&(t=n,n=0),n+Yt(ve()*((+t||0)-n+1))},M.reduce=dt,M.reduceRight=_t,M.result=function(n,t){var r=n?n[t]:e;return at(r)?n[t]():r},M.runInContext=t,M.size=function(n){var t=n?n.length:0;
|
||||
return typeof t=="number"?t:me(n).length},M.some=kt,M.sortedIndex=Nt,M.template=function(n,t,u){var a=M.templateSettings;n||(n=""),u=z({},u,a);var o,i=z({},u.imports,a.imports),a=me(i),i=lt(i),f=0,c=u.interpolate||k,l="__p+='",c=Mt((u.escape||k).source+"|"+c.source+"|"+(c===d?m:k).source+"|"+(u.evaluate||k).source+"|$","g");n.replace(c,function(t,e,u,a,i,c){return u||(u=a),l+=n.slice(f,c).replace(C,J),e&&(l+="'+__e("+e+")+'"),i&&(o=r,l+="';"+i+";__p+='"),u&&(l+="'+((__t=("+u+"))==null?'':__t)+'"),f=c+t.length,t
|
||||
}),l+="';\n",c=u=u.variable,c||(u="obj",l="with("+u+"){"+l+"}"),l=(o?l.replace(v,""):l).replace(g,"$1").replace(y,"$1;"),l="function("+u+"){"+(c?"":u+"||("+u+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}";try{var p=Dt(a,"return "+l).apply(e,i)}catch(s){throw s.source=l,s}return t?p(t):(p.source=l,p)},M.unescape=function(n){return n==u?"":Ut(n).replace(h,Z)},M.uniqueId=function(n){var t=++c;return Ut(n==u?"":n)+t
|
||||
},M.all=st,M.any=kt,M.detect=gt,M.foldl=dt,M.foldr=_t,M.include=pt,M.inject=dt,q(M,function(n,t){M.prototype[t]||(M.prototype[t]=function(){var t=[this.__wrapped__];return te.apply(t,arguments),n.apply(M,t)})}),M.first=Ct,M.last=function(n,t,e){if(n){var r=0,a=n.length;if(typeof t!="number"&&t!=u){var o=a;for(t=M.createCallback(t,e);o--&&t(n[o],o,n);)r++}else if(r=t,r==u||e)return n[a-1];return Y(n,le(0,a-r))}},M.take=Ct,M.head=Ct,q(M,function(n,t){M.prototype[t]||(M.prototype[t]=function(t,e){var r=n(this.__wrapped__,t,e);
|
||||
return t==u||e&&typeof t!="function"?r:new Q(r)})}),M.VERSION="1.2.0",M.prototype.toString=function(){return Ut(this.__wrapped__)},M.prototype.value=Ft,M.prototype.valueOf=Ft,yt(["join","pop","shift"],function(n){var t=Gt[n];M.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),yt(["push","reverse","sort","unshift"],function(n){var t=Gt[n];M.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),yt(["concat","slice","splice"],function(n){var t=Gt[n];M.prototype[n]=function(){return new Q(t.apply(this.__wrapped__,arguments))
|
||||
}}),M}var e,r=!0,u=null,a=!1,o=typeof exports=="object"&&exports,i=typeof module=="object"&&module&&module.exports==o&&module,f=typeof global=="object"&&global;(f.global===f||f.window===f)&&(n=f);var c=0,l={},p=+new Date+"",s=200,v=/\b__p\+='';/g,g=/\b(__p\+=)''\+/g,y=/(__e\(.*?\)|\b__t\))\+'';/g,h=/&(?:amp|lt|gt|quot|#39);/g,m=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,b=/\w*$/,d=/<%=([\s\S]+?)%>/g,_=/^0+(?=.$)/,k=/($^)/,w=/[&<>"']/g,C=/['\n\r\t\u2028\u2029\\]/g,j="Array Boolean Date Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),x="[object Arguments]",O="[object Array]",N="[object Boolean]",E="[object Date]",I="[object Number]",S="[object Object]",A="[object RegExp]",$="[object String]",B={"[object Function]":a};
|
||||
B[x]=B[O]=B[N]=B[E]=B[I]=B[S]=B[A]=B[$]=r;var F={"boolean":a,"function":r,object:r,number:a,string:a,undefined:a},R={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"},T=t();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=T,define(function(){return T})):o&&!o.nodeType?i?(i.exports=T)._=T:o._=T:n._=T})(this);
|
||||
2574
lodash.underscore.js → dist/lodash.underscore.js
vendored
34
dist/lodash.underscore.min.js
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* @license
|
||||
* Lo-Dash 1.2.0 (Custom Build) lodash.com/license
|
||||
* Build: `lodash underscore exports="amd,commonjs,global,node" -o ./dist/lodash.underscore.js`
|
||||
* Underscore.js 1.4.4 underscorejs.org/LICENSE
|
||||
*/
|
||||
;(function(n){function r(n){return n instanceof r?n:new i(n)}function t(n,r){var t=n.b,e=r.b;if(n=n.a,r=r.a,n!==r){if(n>r||typeof n=="undefined")return 1;if(n<r||typeof r=="undefined")return-1}return t<e?-1:1}function e(n,r,t,e){function u(){var e=arguments,c=i?this:r;return o||(n=r[f]),t.length&&(e=e.length?(e=Br.call(e),l?e.concat(t):t.concat(e)):t),this instanceof u?(a.prototype=n.prototype,c=new a,a.prototype=null,e=n.apply(c,e),m(e)?e:c):n.apply(c,e)}var o=y(n),i=!t,f=r;if(i){var l=e;t=r}else if(!o){if(!e)throw new TypeError;
|
||||
r=n}return u}function u(n){return"\\"+lr[n]}function o(n){return Rr[n]}function i(n){this.__wrapped__=n}function a(){}function f(n){return Dr[n]}function l(n){return dr.call(n)==nr}function c(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 p(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)null==n[u]&&(n[u]=e[u])}return n}function s(n){var r=[];return Mr(n,function(n,t){y(n)&&r.push(t)
|
||||
}),r.sort()}function v(n){for(var r=-1,t=Fr(n),e=t.length,u={};++r<e;){var o=t[r];u[n[o]]=o}return u}function g(n){if(!n)return!0;if($r(n)||b(n))return!n.length;for(var r in n)if(mr.call(n,r))return!1;return!0}function h(n,t,e,u){if(n===t)return 0!==n||1/n==1/t;var o=typeof n,i=typeof t;if(n===n&&(!n||"function"!=o&&"object"!=o)&&(!t||"function"!=i&&"object"!=i))return!1;if(null==n||null==t)return n===t;if(i=dr.call(n),o=dr.call(t),i!=o)return!1;switch(i){case tr:case er:return+n==+t;case ur:return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;
|
||||
case ir:case ar:return n==t+""}if(o=i==rr,!o){if(n instanceof r||t instanceof r)return h(n.__wrapped__||n,t.__wrapped__||t,e,u);if(i!=or)return!1;var i=n.constructor,a=t.constructor;if(i!=a&&(!y(i)||!(i instanceof i&&y(a)&&a instanceof a)))return!1}for(e||(e=[]),u||(u=[]),i=e.length;i--;)if(e[i]==n)return u[i]==t;var f=!0,l=0;if(e.push(n),u.push(t),o){if(l=t.length,f=l==n.length)for(;l--&&(f=h(n[l],t[l],e,u)););return f}return Mr(t,function(r,t,o){return mr.call(o,t)?(l++,!(f=mr.call(n,t)&&h(n[t],r,e,u))&&K):void 0
|
||||
}),f&&Mr(n,function(n,r,t){return mr.call(t,r)?!(f=-1<--l)&&K:void 0}),f}function y(n){return typeof n=="function"}function m(n){return n?fr[typeof n]:!1}function _(n){return typeof n=="number"||dr.call(n)==ur}function b(n){return typeof n=="string"||dr.call(n)==ar}function d(n){for(var r=-1,t=Fr(n),e=t.length,u=Array(e);++r<e;)u[r]=n[t[r]];return u}function j(n,r){var t=!1;return typeof(n?n.length:0)=="number"?t=-1<T(n,r):Tr(n,function(n){return(t=n===r)&&K}),t}function w(n,r,t){var e=!0;r=P(r,t),t=-1;
|
||||
var u=n?n.length:0;if(typeof u=="number")for(;++t<u&&(e=!!r(n[t],t,n)););else Tr(n,function(n,t,u){return!(e=!!r(n,t,u))&&K});return e}function A(n,r,t){var e=[];r=P(r,t),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 Tr(n,function(n,t,u){r(n,t,u)&&e.push(n)});return e}function x(n,r,t){r=P(r,t),t=-1;var e=n?n.length:0;if(typeof e!="number"){var u;return Tr(n,function(n,t,e){return r(n,t,e)?(u=n,K):void 0}),u}for(;++t<e;){var o=n[t];if(r(o,t,n))return o
|
||||
}}function O(n,r,t){var e=-1,u=n?n.length:0;if(r=r&&typeof t=="undefined"?r:P(r,t),typeof u=="number")for(;++e<u&&r(n[e],e,n)!==K;);else Tr(n,r)}function E(n,r,t){var e=-1,u=n?n.length:0;if(r=P(r,t),typeof u=="number")for(var o=Array(u);++e<u;)o[e]=r(n[e],e,n);else o=[],Tr(n,function(n,t,u){o[++e]=r(n,t,u)});return o}function S(n,r,t){var e=-1/0,u=e,o=-1,i=n?n.length:0;if(r||typeof i!="number")r=P(r,t),O(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 N(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||E(n,r)}function B(n,r,t,e){if(!n)return t;var u=3>arguments.length;r=P(r,e,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(t=n[++o]);++o<i;)t=r(t,n[o],o,n);else Tr(n,function(n,e,o){t=u?(u=!1,n):r(t,n,e,o)});return t}function k(n,r,t,e){var u=n?n.length:0,o=3>arguments.length;if(typeof u!="number")var i=Fr(n),u=i.length;return r=P(r,e,4),O(n,function(e,a,f){a=i?i[--u]:--u,t=o?(o=!1,n[a]):r(t,n[a],a,f)}),t}function q(n,r,t){var e;
|
||||
r=P(r,t),t=-1;var u=n?n.length:0;if(typeof u=="number")for(;++t<u&&!(e=r(n[t],t,n)););else Tr(n,function(n,t,u){return(e=r(n,t,u))&&K});return!!e}function F(n,r,t){return t&&g(r)?null:(t?x:A)(n,r)}function R(n){for(var r=-1,t=n.length,e=hr.apply(cr,Br.call(arguments,1)),u=[];++r<t;){var o=n[r];0>T(e,o)&&u.push(o)}return u}function D(n,r,t){if(n){var e=0,u=n.length;if(typeof r!="number"&&null!=r){var o=-1;for(r=P(r,t);++o<u&&r(n[o],o,n);)e++}else if(e=r,null==e||t)return n[0];return Br.call(n,0,Sr(Er(0,e),u))
|
||||
}}function M(n,r){for(var t=-1,e=n?n.length:0,u=[];++t<e;){var o=n[t];$r(o)?_r.apply(u,r?o:M(o)):u.push(o)}return u}function T(n,r,t){var e=-1,u=n?n.length:0;if(typeof t=="number")e=(0>t?Er(0,u+t):t||0)-1;else if(t)return e=I(n,r),n[e]===r?e:-1;for(;++e<u;)if(n[e]===r)return e;return-1}function $(n,r,t){if(typeof r!="number"&&null!=r){var e=0,u=-1,o=n?n.length:0;for(r=P(r,t);++u<o&&r(n[u],u,n);)e++}else e=null==r||t?1:Er(0,r);return Br.call(n,e)}function I(n,r,t,e){var u=0,o=n?n.length:u;for(t=t?P(t,e,1):U,r=t(r);u<o;)e=u+o>>>1,t(n[e])<r?u=e+1:o=e;
|
||||
return u}function z(n,r,t,e){var u=-1,o=n?n.length:0,i=[],a=i;for(typeof r!="boolean"&&null!=r&&(e=t,t=r,r=!1),null!=t&&(a=[],t=P(t,e));++u<o;){e=n[u];var f=t?t(e,u,n):e;(r?!u||a[a.length-1]!==f:0>T(a,f))&&(t&&a.push(f),i.push(e))}return i}function C(n,r){return qr.fastBind||jr&&2<arguments.length?jr.call.apply(jr,arguments):e(n,r,Br.call(arguments,2))}function P(n,r,t){if(null==n)return U;var e=typeof n;if("function"!=e){if("object"!=e)return function(r){return r[n]};var u=Fr(n);return function(r){for(var t=u.length,e=!1;t--&&(e=r[u[t]]===n[u[t]]););return e
|
||||
}}return typeof r!="undefined"?1===t?function(t){return n.call(r,t)}:2===t?function(t,e){return n.call(r,t,e)}:4===t?function(t,e,u,o){return n.call(r,t,e,u,o)}:function(t,e,u){return n.call(r,t,e,u)}:n}function U(n){return n}function V(n){O(s(n),function(t){var e=r[t]=n[t];r.prototype[t]=function(){var n=[this.__wrapped__];return _r.apply(n,arguments),n=e.apply(r,n),this.__chain__&&(n=new i(n),n.__chain__=!0),n}})}var W=typeof exports=="object"&&exports,G=typeof module=="object"&&module&&module.exports==W&&module,H=typeof global=="object"&&global;
|
||||
(H.global===H||H.window===H)&&(n=H);var J=0,K={},L=+new Date+"",Q=/&(?:amp|lt|gt|quot|#39);/g,X=/($^)/,Y=/[&<>"']/g,Z=/['\n\r\t\u2028\u2029\\]/g,nr="[object Arguments]",rr="[object Array]",tr="[object Boolean]",er="[object Date]",ur="[object Number]",or="[object Object]",ir="[object RegExp]",ar="[object String]",fr={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},lr={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"},cr=[],H={},pr=n._,sr=RegExp("^"+(H.valueOf+"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),vr=Math.ceil,gr=n.clearTimeout,hr=cr.concat,yr=Math.floor,mr=H.hasOwnProperty,_r=cr.push,br=n.setTimeout,dr=H.toString,jr=sr.test(jr=dr.bind)&&jr,wr=sr.test(wr=Array.isArray)&&wr,Ar=n.isFinite,xr=n.isNaN,Or=sr.test(Or=Object.keys)&&Or,Er=Math.max,Sr=Math.min,Nr=Math.random,Br=cr.slice,H=sr.test(n.attachEvent),kr=jr&&!/\n|true/.test(jr+H),qr={};
|
||||
(function(){var n={0:1,length:1};qr.argsObject=arguments.constructor==Object&&!(arguments instanceof Array),qr.fastBind=jr&&!kr,qr.spliceObjects=(cr.splice.call(n,0,1),!n[0])})(1),r.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},i.prototype=r.prototype,l(arguments)||(l=function(n){return n?mr.call(n,"callee"):!1});var H=function(n){var r,t=[];if(!n||!fr[typeof n])return t;for(r in n)mr.call(n,r)&&t.push(r);return t},Fr=Or?function(n){return m(n)?Or(n):[]
|
||||
}:H,Rr={"&":"&","<":"<",">":">",'"':""","'":"'"},Dr=v(Rr),Mr=function(n,r){var t;if(!n||!fr[typeof n])return n;for(t in n)if(r(n[t],t,n)===K)break;return n},Tr=function(n,r){var t;if(!n||!fr[typeof n])return n;for(t in n)if(mr.call(n,t)&&r(n[t],t,n)===K)break;return n},$r=wr||function(n){return dr.call(n)==rr};y(/x/)&&(y=function(n){return"[object Function]"==dr.call(n)}),r.after=function(n,r){return 1>n?r():function(){return 1>--n?r.apply(this,arguments):void 0}},r.bind=C,r.bindAll=function(n){for(var r=1<arguments.length?hr.apply(cr,Br.call(arguments,1)):s(n),t=-1,e=r.length;++t<e;){var u=r[t];
|
||||
n[u]=C(n[u],n)}return n},r.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},r.compose=function(){var n=arguments;return function(){for(var r=arguments,t=n.length;t--;)r=[n[t].apply(this,r)];return r[0]}},r.countBy=function(n,r,t){var e={};return r=P(r,t),O(n,function(n,t,u){t=r(n,t,u)+"",mr.call(e,t)?e[t]++:e[t]=1}),e},r.debounce=function(n,r,t){function e(){a=null,t||(o=n.apply(i,u))}var u,o,i,a;return function(){var f=t&&!a;return u=arguments,i=this,gr(a),a=br(e,r),f&&(o=n.apply(i,u)),o
|
||||
}},r.defaults=p,r.defer=function(n){var r=Br.call(arguments,1);return br(function(){n.apply(void 0,r)},1)},r.delay=function(n,r){var t=Br.call(arguments,2);return br(function(){n.apply(void 0,t)},r)},r.difference=R,r.filter=A,r.flatten=M,r.forEach=O,r.functions=s,r.groupBy=function(n,r,t){var e={};return r=P(r,t),O(n,function(n,t,u){t=r(n,t,u)+"",(mr.call(e,t)?e[t]:e[t]=[]).push(n)}),e},r.initial=function(n,r,t){if(!n)return[];var e=0,u=n.length;if(typeof r!="number"&&null!=r){var o=u;for(r=P(r,t);o--&&r(n[o],o,n);)e++
|
||||
}else e=null==r||t?1:r||e;return Br.call(n,0,Sr(Er(0,u-e),u))},r.intersection=function(n){var r=arguments,t=r.length,e=-1,u=n?n.length:0,o=[];n:for(;++e<u;){var i=n[e];if(0>T(o,i)){for(var a=t;--a;)if(0>T(r[a],i))continue n;o.push(i)}}return o},r.invert=v,r.invoke=function(n,r){var t=Br.call(arguments,2),e=-1,u=typeof r=="function",o=n?n.length:0,i=Array(typeof o=="number"?o:0);return O(n,function(n){i[++e]=(u?r:n[r]).apply(n,t)}),i},r.keys=Fr,r.map=E,r.max=S,r.memoize=function(n,r){var t={};return function(){var e=L+(r?r.apply(this,arguments):arguments[0]);
|
||||
return mr.call(t,e)?t[e]:t[e]=n.apply(this,arguments)}},r.min=function(n,r,t){var e=1/0,u=e,o=-1,i=n?n.length:0;if(r||typeof i!="number")r=P(r,t),O(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},r.omit=function(n){var r=hr.apply(cr,Br.call(arguments,1)),t={};return Mr(n,function(n,e){0>T(r,e)&&(t[e]=n)}),t},r.once=function(n){var r,t;return function(){return r?t:(r=!0,t=n.apply(this,arguments),n=null,t)}},r.pairs=function(n){for(var r=-1,t=Fr(n),e=t.length,u=Array(e);++r<e;){var o=t[r];
|
||||
u[r]=[o,n[o]]}return u},r.partial=function(n){return e(n,Br.call(arguments,1))},r.pick=function(n){for(var r=-1,t=hr.apply(cr,Br.call(arguments,1)),e=t.length,u={};++r<e;){var o=t[r];o in n&&(u[o]=n[o])}return u},r.pluck=N,r.range=function(n,r,t){n=+n||0,t=+t||1,null==r&&(r=n,n=0);var e=-1;r=Er(0,vr((r-n)/t));for(var u=Array(r);++e<r;)u[e]=n,n+=t;return u},r.reject=function(n,r,t){return r=P(r,t),A(n,function(n,t,e){return!r(n,t,e)})},r.rest=$,r.shuffle=function(n){var r=-1,t=n?n.length:0,e=Array(typeof t=="number"?t:0);
|
||||
return O(n,function(n){var t=yr(Nr()*(++r+1));e[r]=e[t],e[t]=n}),e},r.sortBy=function(n,r,e){var u=-1,o=n?n.length:0,i=Array(typeof o=="number"?o:0);for(r=P(r,e),O(n,function(n,t,e){i[++u]={a:r(n,t,e),b:u,c:n}}),o=i.length,i.sort(t);o--;)i[o]=i[o].c;return i},r.tap=function(n,r){return r(n),n},r.throttle=function(n,r){function t(){a=new Date,i=null,u=n.apply(o,e)}var e,u,o,i,a=0;return function(){var f=new Date,l=r-(f-a);return e=arguments,o=this,0<l?i||(i=br(t,l)):(gr(i),i=null,a=f,u=n.apply(o,e)),u
|
||||
}},r.times=function(n,r,t){for(var e=-1,u=Array(-1<n?n:0);++e<n;)u[e]=r.call(t,e);return u},r.toArray=function(n){return $r(n)?Br.call(n):n&&typeof n.length=="number"?E(n):d(n)},r.union=function(n){return $r(n)||(arguments[0]=n?Br.call(n):cr),z(hr.apply(cr,arguments))},r.uniq=z,r.values=d,r.where=F,r.without=function(n){return R(n,Br.call(arguments,1))},r.wrap=function(n,r){return function(){var t=[n];return _r.apply(t,arguments),r.apply(this,t)}},r.zip=function(n){for(var r=-1,t=n?S(N(arguments,"length")):0,e=Array(t);++r<t;)e[r]=N(arguments,r);
|
||||
return e},r.collect=E,r.drop=$,r.each=O,r.extend=c,r.methods=s,r.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]:u[o[0]]=o[1]}return u},r.select=A,r.tail=$,r.unique=z,r.clone=function(n){return m(n)?$r(n)?Br.call(n):c({},n):n},r.contains=j,r.escape=function(n){return null==n?"":(n+"").replace(Y,o)},r.every=w,r.find=x,r.findWhere=function(n,r){return F(n,r,!0)},r.has=function(n,r){return n?mr.call(n,r):!1},r.identity=U,r.indexOf=T,r.isArguments=l,r.isArray=$r,r.isBoolean=function(n){return!0===n||!1===n||dr.call(n)==tr
|
||||
},r.isDate=function(n){return dr.call(n)==er},r.isElement=function(n){return n?1===n.nodeType:!1},r.isEmpty=g,r.isEqual=h,r.isFinite=function(n){return Ar(n)&&!xr(parseFloat(n))},r.isFunction=y,r.isNaN=function(n){return _(n)&&n!=+n},r.isNull=function(n){return null===n},r.isNumber=_,r.isObject=m,r.isRegExp=function(n){return dr.call(n)==ir},r.isString=b,r.isUndefined=function(n){return typeof n=="undefined"},r.lastIndexOf=function(n,r,t){var e=n?n.length:0;for(typeof t=="number"&&(e=(0>t?Er(0,e+t):Sr(t,e-1))+1);e--;)if(n[e]===r)return e;
|
||||
return-1},r.mixin=V,r.noConflict=function(){return n._=pr,this},r.random=function(n,r){return null==n&&null==r&&(r=1),n=+n||0,null==r&&(r=n,n=0),n+yr(Nr()*((+r||0)-n+1))},r.reduce=B,r.reduceRight=k,r.result=function(n,r){var t=n?n[r]:null;return y(t)?n[r]():t},r.size=function(n){var r=n?n.length:0;return typeof r=="number"?r:Fr(n).length},r.some=q,r.sortedIndex=I,r.template=function(n,t,e){n||(n=""),e=p({},e,r.templateSettings);var o=0,i="__p+='",a=e.variable;n.replace(RegExp((e.escape||X).source+"|"+(e.interpolate||X).source+"|"+(e.evaluate||X).source+"|$","g"),function(r,t,e,a,f){return i+=n.slice(o,f).replace(Z,u),t&&(i+="'+_['escape']("+t+")+'"),a&&(i+="';"+a+";__p+='"),e&&(i+="'+((__t=("+e+"))==null?'':__t)+'"),o=f+r.length,r
|
||||
}),i+="';\n",a||(a="obj",i="with("+a+"||{}){"+i+"}"),i="function("+a+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+i+"return __p}";try{var f=Function("_","return "+i)(r)}catch(l){throw l.source=i,l}return t?f(t):(f.source=i,f)},r.unescape=function(n){return null==n?"":(n+"").replace(Q,f)},r.uniqueId=function(n){var r=++J+"";return n?n+r:r},r.all=w,r.any=q,r.detect=x,r.foldl=B,r.foldr=k,r.include=j,r.inject=B,r.first=D,r.last=function(n,r,t){if(n){var e=0,u=n.length;
|
||||
if(typeof r!="number"&&null!=r){var o=u;for(r=P(r,t);o--&&r(n[o],o,n);)e++}else if(e=r,null==e||t)return n[u-1];return Br.call(n,Er(0,u-e))}},r.take=D,r.head=D,r.chain=function(n){return n=new i(n),n.__chain__=!0,n},r.VERSION="1.2.0",V(r),r.prototype.chain=function(){return this.__chain__=!0,this},r.prototype.value=function(){return this.__wrapped__},O("pop push reverse shift sort splice unshift".split(" "),function(n){var t=cr[n];r.prototype[n]=function(){var n=this.__wrapped__;return t.apply(n,arguments),!qr.spliceObjects&&0===n.length&&delete n[0],this
|
||||
}}),O(["concat","join","slice"],function(n){var t=cr[n];r.prototype[n]=function(){var n=t.apply(this.__wrapped__,arguments);return this.__chain__&&(n=new i(n),n.__chain__=!0),n}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=r,define(function(){return r})):W&&!W.nodeType?G?(G.exports=r)._=r:W._=r:n._=r})(this);
|
||||
1653
doc/README.md
@@ -21,9 +21,9 @@
|
||||
// generate Markdown
|
||||
$markdown = docdown(array(
|
||||
'path' => '../' . $file,
|
||||
'title' => 'Lo-Dash <sup>v1.0.0-rc.3</sup>',
|
||||
'title' => 'Lo-Dash <sup>v1.2.0</sup>',
|
||||
'toc' => 'categories',
|
||||
'url' => 'https://github.com/bestiejs/lodash/blob/master/lodash.js'
|
||||
'url' => 'https://github.com/lodash/lodash/blob/1.2.0/lodash.js'
|
||||
));
|
||||
|
||||
// save to a .md file
|
||||
@@ -33,4 +33,4 @@
|
||||
header('Content-Type: text/plain;charset=utf-8');
|
||||
echo $markdown . PHP_EOL;
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
42
lodash.min.js
vendored
@@ -1,42 +0,0 @@
|
||||
/*!
|
||||
Lo-Dash 1.0.0-rc.3 lodash.com/license
|
||||
Underscore.js 1.4.3 underscorejs.org/LICENSE
|
||||
*/
|
||||
;(function(e,t){function n(e){if(e&&typeof e=="object"&&e.__wrapped__)return e;if(!(this instanceof n))return new n(e);this.__wrapped__=e}function r(e,t,n){t||(t=0);var r=e.length,i=r-t>=(n||tt);if(i)for(var s={},n=t-1;++n<r;){var o=e[n]+"";(Et.call(s,o)?s[o]:s[o]=[]).push(e[n])}return function(n){if(i){var r=n+"";return Et.call(s,r)&&-1<R(s[r],n)}return-1<R(e,n,t)}}function i(e){return e.charCodeAt(0)}function s(e,t){var n=e.b,r=t.b,e=e.a,t=t.a;if(e!==t){if(e>t||typeof e=="undefined")return 1;if(
|
||||
e<t||typeof t=="undefined")return-1}return n<r?-1:1}function o(e,t,n){function r(){var u=arguments,a=s?this:t;return i||(e=t[o]),n.length&&(u=u.length?n.concat(p(u)):n),this instanceof r?(h.prototype=e.prototype,a=new h,h.prototype=null,u=e.apply(a,u),x(u)?u:a):e.apply(a,u)}var i=S(e),s=!n,o=t;return s&&(n=t),i||(t=e),r}function u(e,t,n){return e?typeof e!="function"?function(t){return t[e]}:typeof t!="undefined"?n?function(n,r,i,s){return e.call(t,n,r,i,s)}:function(n,r,i){return e.call(t,n,r,i)
|
||||
}:e:V}function a(){for(var e={b:"",c:"",e:Xt,f:Wt,g:"",h:Jt,i:Gt,j:mt,k:"",l:!0},t,n=0;t=arguments[n];n++)for(var r in t)e[r]=t[r];t=e.a,e.d=/^[^,]+/.exec(t)[0],n=Function,r="var i,l="+e.d+",t="+e.d+";if(!"+e.d+")return t;"+e.k+";",e.b?(r+="var m=l.length;i=-1;if(typeof m=='number'){",e.i&&(r+="if(k(l)){l=l.split('')}"),r+="while(++i<m){"+e.b+"}}else {"):e.h&&(r+="var m=l.length;i=-1;if(m&&j(l)){while(++i<m){i+='';"+e.g+"}}else {"),e.e||(r+="var u=typeof l=='function'&&s.call(l,'prototype');");if(
|
||||
e.f&&e.l)r+="var q=-1,r=p[typeof l]?n(l):[],m=r.length;while(++q<m){i=r[q];",e.e||(r+="if(!(u&&i=='prototype')){"),r+=e.g+"",e.e||(r+="}");else{r+="for(i in l){";if(!e.e||e.l)r+="if(",e.e||(r+="!(u&&i=='prototype')"),!e.e&&e.l&&(r+="&&"),e.l&&(r+="h.call(l,i)"),r+="){";r+=e.g+";";if(!e.e||e.l)r+="}"}r+="}";if(e.e){r+="var f=l.constructor;";for(var i=0;7>i;i++)r+="i='"+e.j[i]+"';if(","constructor"==e.j[i]&&(r+="!(f&&f.prototype===l)&&"),r+="h.call(l,i)){"+e.g+"}"}if(e.b||e.h)r+="}";return r+=e.c+";return t"
|
||||
,n("e,h,j,k,p,n,s","return function("+t+"){"+r+"}")(u,Et,v,N,nn,At,xt)}function f(e){return"\\"+rn[e]}function l(e){return hn[e]}function c(e){return typeof e.toString!="function"&&typeof (e+"")=="string"}function h(){}function p(e,t,n){t||(t=0),typeof n=="undefined"&&(n=e?e.length:0);for(var r=-1,n=n-t||0,i=Array(0>n?0:n);++r<n;)i[r]=e[t+r];return i}function d(e){return pn[e]}function v(e){return Tt.call(e)==Dt}function m(e){var t=!1;if(!e||typeof e!="object"||v(e))return t;var n=e.constructor;return!
|
||||
S(n)&&(!Yt||!c(e))||n instanceof n?Vt?(ln(e,function(e,n,r){return t=!Et.call(r,n),!1}),!1===t):(ln(e,function(e,n){t=n}),!1===t||Et.call(e,t)):t}function g(e){var t=[];return cn(e,function(e,n){t.push(n)}),t}function y(e,t,n,r,i){if(null==e)return e;n&&(t=!1);if(n=x(e)){var s=Tt.call(e);if(!en[s]||Yt&&c(e))return e;var o=vn(e)}if(!n||!t)return n?o?p(e):fn({},e):e;n=tn[s];switch(s){case Ht:case Bt:return new n(+e);case jt:case qt:return new n(e);case It:return n(e.source,at.exec(e))}r||(r=[]),i||
|
||||
(i=[]);for(s=r.length;s--;)if(r[s]==e)return i[s];var u=o?n(e.length):{};return r.push(e),i.push(u),(o?_:cn)(e,function(e,n){u[n]=y(e,t,null,r,i)}),o&&(Et.call(e,"index")&&(u.index=e.index),Et.call(e,"input")&&(u.input=e.input)),u}function b(e){var t=[];return ln(e,function(e,n){S(e)&&t.push(n)}),t.sort()}function w(e){var t={};return cn(e,function(e,n){t[e]=n}),t}function E(e,t,n,r){if(e===t)return 0!==e||1/e==1/t;if(null==e||null==t)return e===t;var i=Tt.call(e),s=Tt.call(t);i==Dt&&(i=Ft),s==Dt&&
|
||||
(s=Ft);if(i!=s)return!1;switch(i){case Ht:case Bt:return+e==+t;case jt:return e!=+e?t!=+t:0==e?1/e==1/t:e==+t;case It:case qt:return e==t+""}s=i==Pt;if(!s){if(e.__wrapped__||t.__wrapped__)return E(e.__wrapped__||e,t.__wrapped__||t);if(i!=Ft||Yt&&(c(e)||c(t)))return!1;var i=!Kt&&v(e)?Object:e.constructor,o=!Kt&&v(t)?Object:t.constructor;if(i!=o&&(!S(i)||!(i instanceof i&&S(o)&&o instanceof o)))return!1}n||(n=[]),r||(r=[]);for(i=n.length;i--;)if(n[i]==e)return r[i]==t;var u=!0,a=0;n.push(e),r.push(
|
||||
t);if(s){a=e.length;if(u=a==t.length)for(;a--&&(u=E(e[a],t[a],n,r)););return u}return ln(e,function(e,i,s){if(Et.call(s,i))return a++,u=Et.call(t,i)&&E(e,t[i],n,r)}),u&&ln(t,function(e,t,n){if(Et.call(n,t))return u=-1<--a}),u}function S(e){return typeof e=="function"}function x(e){return e?nn[typeof e]:!1}function T(e){return typeof e=="number"||Tt.call(e)==jt}function N(e){return typeof e=="string"||Tt.call(e)==qt}function C(e,t,n){var r=arguments,i=0,s=2,o=r[3],u=r[4];n!==et&&(o=[],u=[],typeof
|
||||
n!="number"&&(s=r.length));for(;++i<s;)cn(r[i],function(t,n){var r,i,s;if(t&&((i=vn(t))||mn(t))){for(var a=o.length;a--;)if(r=o[a]==t)break;r?e[n]=u[a]:(o.push(t),u.push(s=(s=e[n],i)?vn(s)?s:[]:mn(s)?s:{}),e[n]=C(s,t,et,o,u))}else t!=null&&(e[n]=t)});return e}function k(e){var t=[];return cn(e,function(e){t.push(e)}),t}function L(e,t,n){var r=-1,i=e?e.length:0,s=!1,n=(0>n?Ot(0,i+n):n)||0;return typeof i=="number"?s=-1<(N(e)?e.indexOf(t,n):R(e,t,n)):an(e,function(e){if(++r>=n)return!(s=e===t)}),s}
|
||||
function A(e,t,n){var r=!0,t=u(t,n);if(vn(e))for(var n=-1,i=e.length;++n<i&&(r=!!t(e[n],n,e)););else an(e,function(e,n,i){return r=!!t(e,n,i)});return r}function O(e,t,n){var r=[],t=u(t,n);if(vn(e))for(var n=-1,i=e.length;++n<i;){var s=e[n];t(s,n,e)&&r.push(s)}else an(e,function(e,n,i){t(e,n,i)&&r.push(e)});return r}function M(e,t,n){var r,t=u(t,n);return _(e,function(e,n,i){if(t(e,n,i))return r=e,!1}),r}function _(e,t,n){if(t&&typeof n=="undefined"&&vn(e))for(var n=-1,r=e.length;++n<r&&!1!==t(e[
|
||||
n],n,e););else an(e,t,n);return e}function D(e,t,n){var r=-1,i=e?e.length:0,s=Array(typeof i=="number"?i:0),t=u(t,n);if(vn(e))for(;++r<i;)s[r]=t(e[r],r,e);else an(e,function(e,n,i){s[++r]=t(e,n,i)});return s}function P(e,t,n){var r=-Infinity,s=-1,o=e?e.length:0,a=r;if(t||!vn(e))t=!t&&N(e)?i:u(t,n),an(e,function(e,n,i){n=t(e,n,i),n>r&&(r=n,a=e)});else for(;++s<o;)e[s]>a&&(a=e[s]);return a}function H(e,t){return D(e,t+"")}function B(e,t,n,r){var i=3>arguments.length,t=u(t,r,et);if(vn(e)){var s=-1,o=
|
||||
e.length;for(i&&(n=e[++s]);++s<o;)n=t(n,e[s],s,e)}else an(e,function(e,r,s){n=i?(i=!1,e):t(n,e,r,s)});return n}function j(e,t,n,r){var i=e,s=e?e.length:0,o=3>arguments.length;if(typeof s!="number")var a=gn(e),s=a.length;else Gt&&N(e)&&(i=e.split(""));return t=u(t,r,et),_(e,function(e,r,u){r=a?a[--s]:--s,n=o?(o=!1,i[r]):t(n,i[r],r,u)}),n}function F(e,t,n){var r,t=u(t,n);if(vn(e))for(var n=-1,i=e.length;++n<i&&!(r=t(e[n],n,e)););else an(e,function(e,n,i){return!(r=t(e,n,i))});return!!r}function I(e
|
||||
,t,n){if(e){var r=e.length;return null==t||n?e[0]:p(e,0,Mt(Ot(0,t),r))}}function q(e,t){for(var n=-1,r=e?e.length:0,i=[];++n<r;){var s=e[n];vn(s)?St.apply(i,t?s:q(s)):i.push(s)}return i}function R(e,t,n){var r=-1,i=e?e.length:0;if(typeof n=="number")r=(0>n?Ot(0,i+n):n||0)-1;else if(n)return r=z(e,t),e[r]===t?r:-1;for(;++r<i;)if(e[r]===t)return r;return-1}function U(e,t,n){return p(e,null==t||n?1:Ot(0,t))}function z(e,t,n,r){for(var i=0,s=e?e.length:i,n=n?u(n,r):V,t=n(t);i<s;)r=i+s>>>1,n(e[r])<t?i=
|
||||
r+1:s=r;return i}function W(e,t,n,r){var i=-1,s=e?e.length:0,o=[],a=o;typeof t=="function"&&(r=n,n=t,t=!1);var f=!t&&75<=s;if(f)var l={};n&&(a=[],n=u(n,r));for(;++i<s;){var r=e[i],c=n?n(r,i,e):r;if(f)var h=c+"",h=Et.call(l,h)?!(a=l[h]):a=l[h]=[];if(t?!i||a[a.length-1]!==c:h||0>R(a,c))(n||f)&&a.push(c),o.push(r)}return o}function X(e,t){return zt||Nt&&2<arguments.length?Nt.call.apply(Nt,arguments):o(e,t,p(arguments,2))}function V(e){return e}function $(e){_(b(e),function(t){var r=n[t]=e[t];n.prototype
|
||||
[t]=function(){var e=[this.__wrapped__];return St.apply(e,arguments),e=r.apply(n,e),new n(e)}})}function J(){return this.__wrapped__}var K=typeof exports=="object"&&exports,Q=typeof global=="object"&&global;Q.global===Q&&(e=Q);var G=[],Y=new function(){},Z=0,et=Y,tt=30,nt=e._,rt=/[-?+=!~*%&^<>|{(\/]|\[\D|\b(?:delete|in|instanceof|new|typeof|void)\b/,it=/&(?:amp|lt|gt|quot|#x27);/g,st=/\b__p\+='';/g,ot=/\b(__p\+=)''\+/g,ut=/(__e\(.*?\)|\b__t\))\+'';/g,at=/\w*$/,ft=/(?:__e|__t=)\(\s*(?![\d\s"']|this\.)/g
|
||||
,lt=RegExp("^"+(Y.valueOf+"").replace(/[.*+?^=!:${}()|[\]\/\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),ct=/\$\{((?:(?=\\?)\\?[\s\S])*?)}/g,ht=/<%=([\s\S]+?)%>/g,pt=/($^)/,dt=/[&<>"']/g,vt=/['\n\r\t\u2028\u2029\\]/g,mt="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),gt=Math.ceil,yt=G.concat,bt=Math.floor,wt=lt.test(wt=Object.getPrototypeOf)&&wt,Et=Y.hasOwnProperty,St=G.push,xt=Y.propertyIsEnumerable,Tt=Y.toString,Nt=lt.test(Nt=
|
||||
p.bind)&&Nt,Ct=lt.test(Ct=Array.isArray)&&Ct,kt=e.isFinite,Lt=e.isNaN,At=lt.test(At=Object.keys)&&At,Ot=Math.max,Mt=Math.min,_t=Math.random,Dt="[object Arguments]",Pt="[object Array]",Ht="[object Boolean]",Bt="[object Date]",jt="[object Number]",Ft="[object Object]",It="[object RegExp]",qt="[object String]",Rt=!!e.attachEvent,Ut=Nt&&!/\n|true/.test(Nt+Rt),zt=Nt&&!Ut,Wt=At&&(Rt||Ut),Xt,Vt,$t=($t={0:1,length:1},G.splice.call($t,0,1),$t[0]),Jt=!0;(function(){function e(){this.x=1}var t=[];e.prototype=
|
||||
{valueOf:1,y:1};for(var n in new e)t.push(n);for(n in arguments)Jt=!n;Xt=!/valueOf/.test(t),Vt="x"!=t[0]})(1);var Kt=arguments.constructor==Object,Qt=!v(arguments),Gt="xx"!="x"[0]+Object("x")[0];try{var Yt=("[object Object]",Tt.call(document)==Ft)}catch(Zt){}var en={"[object Function]":!1};en[Dt]=en[Pt]=en[Ht]=en[Bt]=en[jt]=en[Ft]=en[It]=en[qt]=!0;var tn={};tn[Pt]=Array,tn[Ht]=Boolean,tn[Bt]=Date,tn[Ft]=Object,tn[jt]=Number,tn[It]=RegExp,tn[qt]=String;var nn={"boolean":!1,"function":!0,object:!0,
|
||||
number:!1,string:!1,"undefined":!1},rn={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"};n.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:ht,variable:""};var sn={a:"o,v,g",k:"for(var a=1,b=typeof g=='number'?2:arguments.length;a<b;a++){if((l=arguments[a])){",g:"t[i]=l[i]",c:"}}"},on={a:"d,c,w",k:"c=c&&typeof w=='undefined'?c:e(c,w)",b:"if(c(l[i],i,d)===false)return t",g:"if(c(l[i],i,d)===false)return t"},un={b:null},an=a(on),fn=a(sn
|
||||
);Qt&&(v=function(e){return e?Et.call(e,"callee"):!1});var ln=a(on,un,{l:!1}),cn=a(on,un),hn={"&":"&","<":"<",">":">",'"':""","'":"'"},pn=w(hn),dn=a(sn,{g:"if(t[i]==null)"+sn.g}),vn=Ct||function(e){return Kt&&e instanceof Array||Tt.call(e)==Pt};S(/x/)&&(S=function(e){return e instanceof Function||"[object Function]"==Tt.call(e)});var mn=wt?function(e){if(!e||typeof e!="object")return!1;var t=e.valueOf,n=typeof t=="function"&&(n=wt(t))&&wt(n);return n?e==n||wt(e)==n&&!v(e):m(e)
|
||||
}:m,gn=At?function(e){return typeof e=="function"&&xt.call(e,"prototype")?g(e):x(e)?At(e):[]}:g;n.after=function(e,t){return 1>e?t():function(){if(1>--e)return t.apply(this,arguments)}},n.assign=fn,n.bind=X,n.bindAll=function(e){for(var t=arguments,n=1<t.length?0:(t=b(e),-1),r=t.length;++n<r;){var i=t[n];e[i]=X(e[i],e)}return e},n.bindKey=function(e,t){return o(e,t,p(arguments,2))},n.compact=function(e){for(var t=-1,n=e?e.length:0,r=[];++t<n;){var i=e[t];i&&r.push(i)}return r},n.compose=function(
|
||||
){var e=arguments;return function(){for(var t=arguments,n=e.length;n--;)t=[e[n].apply(this,t)];return t[0]}},n.countBy=function(e,t,n){var r={},t=u(t,n);return _(e,function(e,n,i){n=t(e,n,i),Et.call(r,n)?r[n]++:r[n]=1}),r},n.debounce=function(e,t,n){function r(){u=null,n||(s=e.apply(o,i))}var i,s,o,u;return function(){var a=n&&!u;return i=arguments,o=this,clearTimeout(u),u=setTimeout(r,t),a&&(s=e.apply(o,i)),s}},n.defaults=dn,n.defer=function(e){var n=p(arguments,1);return setTimeout(function(){e
|
||||
.apply(t,n)},1)},n.delay=function(e,n){var r=p(arguments,2);return setTimeout(function(){e.apply(t,r)},n)},n.difference=function(e){for(var t=-1,n=e?e.length:0,i=yt.apply(G,arguments),i=r(i,n),s=[];++t<n;){var o=e[t];i(o)||s.push(o)}return s},n.filter=O,n.flatten=q,n.forEach=_,n.forIn=ln,n.forOwn=cn,n.functions=b,n.groupBy=function(e,t,n){var r={},t=u(t,n);return _(e,function(e,n,i){n=t(e,n,i),(Et.call(r,n)?r[n]:r[n]=[]).push(e)}),r},n.initial=function(e,t,n){if(!e)return[];var r=e.length;return p
|
||||
(e,0,Mt(Ot(0,r-(null==t||n?1:t||0)),r))},n.intersection=function(e){var t=arguments,n=t.length,i={0:{}},s=-1,o=e?e.length:0,u=100<=o,a=[],f=a;e:for(;++s<o;){var l=e[s];if(u)var c=l+"",c=Et.call(i[0],c)?!(f=i[0][c]):f=i[0][c]=[];if(c||0>R(f,l)){u&&f.push(l);for(var h=n;--h;)if(!(i[h]||(i[h]=r(t[h],0,100)))(l))continue e;a.push(l)}}return a},n.invert=w,n.invoke=function(e,t){var n=p(arguments,2),r=typeof t=="function",i=[];return _(e,function(e){i.push((r?t:e[t]).apply(e,n))}),i},n.keys=gn,n.map=D,
|
||||
n.max=P,n.memoize=function(e,t){var n={};return function(){var r=t?t.apply(this,arguments):arguments[0];return Et.call(n,r)?n[r]:n[r]=e.apply(this,arguments)}},n.merge=C,n.min=function(e,t,n){var r=Infinity,s=-1,o=e?e.length:0,a=r;if(t||!vn(e))t=!t&&N(e)?i:u(t,n),an(e,function(e,n,i){n=t(e,n,i),n<r&&(r=n,a=e)});else for(;++s<o;)e[s]<a&&(a=e[s]);return a},n.object=function(e,t){for(var n=-1,r=e?e.length:0,i={};++n<r;){var s=e[n];t?i[s]=t[n]:i[s[0]]=s[1]}return i},n.omit=function(e,t,n){var r=typeof
|
||||
t=="function",i={};if(r)t=u(t,n);else var s=yt.apply(G,arguments);return ln(e,function(e,n,o){if(r?!t(e,n,o):0>R(s,n,1))i[n]=e}),i},n.once=function(e){var t,n=!1;return function(){return n?t:(n=!0,t=e.apply(this,arguments),e=null,t)}},n.pairs=function(e){var t=[];return cn(e,function(e,n){t.push([n,e])}),t},n.partial=function(e){return o(e,p(arguments,1))},n.pick=function(e,t,n){var r={};if(typeof t!="function")for(var i=0,s=yt.apply(G,arguments),o=s.length;++i<o;){var a=s[i];a in e&&(r[a]=e[a])}
|
||||
else t=u(t,n),ln(e,function(e,n,i){t(e,n,i)&&(r[n]=e)});return r},n.pluck=H,n.range=function(e,t,n){e=+e||0,n=+n||1,null==t&&(t=e,e=0);for(var r=-1,t=Ot(0,gt((t-e)/n)),i=Array(t);++r<t;)i[r]=e,e+=n;return i},n.reject=function(e,t,n){return t=u(t,n),O(e,function(e,n,r){return!t(e,n,r)})},n.rest=U,n.shuffle=function(e){var t=-1,n=Array(e?e.length:0);return _(e,function(e){var r=bt(_t()*(++t+1));n[t]=n[r],n[r]=e}),n},n.sortBy=function(e,t,n){var r=[],t=u(t,n);_(e,function(e,n,i){r.push({a:t(e,n,i),b
|
||||
:n,c:e})}),e=r.length;for(r.sort(s);e--;)r[e]=r[e].c;return r},n.tap=function(e,t){return t(e),e},n.throttle=function(e,t){function n(){u=new Date,o=null,i=e.apply(s,r)}var r,i,s,o,u=0;return function(){var a=new Date,f=t-(a-u);return r=arguments,s=this,0>=f?(clearTimeout(o),o=null,u=a,i=e.apply(s,r)):o||(o=setTimeout(n,f)),i}},n.times=function(e,t,n){for(var e=+e||0,r=-1,i=Array(e);++r<e;)i[r]=t.call(n,r);return i},n.toArray=function(e){return typeof (e?e.length:0)=="number"?Gt&&N(e)?e.split("")
|
||||
:p(e):k(e)},n.union=function(){return W(yt.apply(G,arguments))},n.uniq=W,n.values=k,n.where=function(e,t){var n=gn(t);return O(e,function(e){for(var r=n.length;r--;){var i=e[n[r]]===t[n[r]];if(!i)break}return!!i})},n.without=function(e){for(var t=-1,n=e?e.length:0,i=r(arguments,1,20),s=[];++t<n;){var o=e[t];i(o)||s.push(o)}return s},n.wrap=function(e,t){return function(){var n=[e];return St.apply(n,arguments),t.apply(this,n)}},n.zip=function(e){for(var t=-1,n=e?P(H(arguments,"length")):0,r=Array(
|
||||
n);++t<n;)r[t]=H(arguments,t);return r},n.collect=D,n.drop=U,n.each=_,n.extend=fn,n.methods=b,n.select=O,n.tail=U,n.unique=W,$(n),n.clone=y,n.cloneDeep=function(e){return y(e,!0)},n.contains=L,n.escape=function(e){return null==e?"":(e+"").replace(dt,l)},n.every=A,n.find=M,n.has=function(e,t){return e?Et.call(e,t):!1},n.identity=V,n.indexOf=R,n.isArguments=v,n.isArray=vn,n.isBoolean=function(e){return!0===e||!1===e||Tt.call(e)==Ht},n.isDate=function(e){return e instanceof Date||Tt.call(e)==Bt},n.isElement=
|
||||
function(e){return e?1===e.nodeType:!1},n.isEmpty=function(e){var t=!0;if(!e)return t;var n=Tt.call(e),r=e.length;return n==Pt||n==qt||n==Dt||Qt&&v(e)||n==Ft&&typeof r=="number"&&S(e.splice)?!r:(cn(e,function(){return t=!1}),t)},n.isEqual=E,n.isFinite=function(e){return kt(e)&&!Lt(parseFloat(e))},n.isFunction=S,n.isNaN=function(e){return T(e)&&e!=+e},n.isNull=function(e){return null===e},n.isNumber=T,n.isObject=x,n.isPlainObject=mn,n.isRegExp=function(e){return e instanceof RegExp||Tt.call(e)==It
|
||||
},n.isString=N,n.isUndefined=function(e){return typeof e=="undefined"},n.lastIndexOf=function(e,t,n){var r=e?e.length:0;for(typeof n=="number"&&(r=(0>n?Ot(0,r+n):Mt(n,r-1))+1);r--;)if(e[r]===t)return r;return-1},n.mixin=$,n.noConflict=function(){return e._=nt,this},n.random=function(e,t){return null==e&&null==t&&(t=1),e=+e||0,null==t&&(t=e,e=0),e+bt(_t()*((+t||0)-e+1))},n.reduce=B,n.reduceRight=j,n.result=function(e,t){var n=e?e[t]:null;return S(n)?e[t]():n},n.size=function(e){var t=e?e.length:0;
|
||||
return typeof t=="number"?t:gn(e).length},n.some=F,n.sortedIndex=z,n.template=function(e,t,r){e||(e=""),r||(r={});var i,s,o=n.templateSettings,u=0,a=r.interpolate||o.interpolate||pt,l="__p+='",c=r.variable||o.variable,h=c;e.replace(RegExp((r.escape||o.escape||pt).source+"|"+a.source+"|"+(a===ht?ct:pt).source+"|"+(r.evaluate||o.evaluate||pt).source+"|$","g"),function(t,n,r,s,o,a){return r||(r=s),l+=e.slice(u,a).replace(vt,f),n&&(l+="'+__e("+n+")+'"),o&&(l+="';"+o+";__p+='"),r&&(l+="'+((__t=("+r+"))==null?'':__t)+'"
|
||||
),i||(i=o||rt.test(n||r)),u=a+t.length,t}),l+="';\n",h||(c="obj",i?l="with("+c+"){"+l+"}":(r=RegExp("(\\(\\s*)"+c+"\\."+c+"\\b","g"),l=l.replace(ft,"$&"+c+".").replace(r,"$1__d"))),l=(i?l.replace(st,""):l).replace(ot,"$1").replace(ut,"$1;"),l="function("+c+"){"+(h?"":c+"||("+c+"={});")+"var __t,__p='',__e=_.escape"+(i?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":(h?"":",__d="+c+"."+c+"||"+c)+";")+l+"return __p}";try{s=Function("_","return "+l)(n)}catch(p){throw p.source=
|
||||
l,p}return t?s(t):(s.source=l,s)},n.unescape=function(e){return null==e?"":(e+"").replace(it,d)},n.uniqueId=function(e){return(null==e?"":e+"")+ ++Z},n.all=A,n.any=F,n.detect=M,n.foldl=B,n.foldr=j,n.include=L,n.inject=B,cn(n,function(e,t){n.prototype[t]||(n.prototype[t]=function(){var t=[this.__wrapped__];return St.apply(t,arguments),e.apply(n,t)})}),n.first=I,n.last=function(e,t,n){if(e){var r=e.length;return null==t||n?e[r-1]:p(e,Ot(0,r-t))}},n.take=I,n.head=I,cn(n,function(e,t){n.prototype[t]||
|
||||
(n.prototype[t]=function(t,r){var i=e(this.__wrapped__,t,r);return null==t||r?i:new n(i)})}),n.VERSION="1.0.0-rc.3",n.prototype.toString=function(){return this.__wrapped__+""},n.prototype.value=J,n.prototype.valueOf=J,an(["join","pop","shift"],function(e){var t=G[e];n.prototype[e]=function(){return t.apply(this.__wrapped__,arguments)}}),an(["push","reverse","sort","unshift"],function(e){var t=G[e];n.prototype[e]=function(){return t.apply(this.__wrapped__,arguments),this}}),an(["concat","slice","splice"
|
||||
],function(e){var t=G[e];n.prototype[e]=function(){var e=t.apply(this.__wrapped__,arguments);return new n(e)}}),$t&&an(["pop","shift","splice"],function(e){var t=G[e],r="splice"==e;n.prototype[e]=function(){var e=this.__wrapped__,i=t.apply(e,arguments);return 0===e.length&&delete e[0],r?new n(i):i}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(e._=n,define(function(){return n})):K?typeof module=="object"&&module&&module.exports==K?(module.exports=n)._=n:K._=n:e._=n})(this);
|
||||
33
lodash.underscore.min.js
vendored
@@ -1,33 +0,0 @@
|
||||
/*!
|
||||
Lo-Dash 1.0.0-rc.3 (Custom Build) lodash.com/license
|
||||
Build: `lodash underscore -m -o ./lodash.underscore.min.js`
|
||||
Underscore.js 1.4.3 underscorejs.org/LICENSE
|
||||
*/
|
||||
;(function(e,t){function n(e){if(e&&typeof e=="object"&&e.__wrapped__)return e;if(!(this instanceof n))return new n(e);this.__wrapped__=e}function r(e,t){var n=e.b,r=t.b,e=e.a,t=t.a;if(e!==t){if(e>t||typeof e=="undefined")return 1;if(e<t||typeof t=="undefined")return-1}return n<r?-1:1}function i(e,t,n){function r(){var i=arguments,s=t;return n.length&&(i=i.length?n.concat(f(i)):n),this instanceof r?(a.prototype=e.prototype,s=new a,a.prototype=null,i=e.apply(s,i),y(i)?i:s):e.apply(s,i)}return r}function s
|
||||
(e,t,n){return e?typeof e!="function"?function(t){return t[e]}:typeof t!="undefined"?n?function(n,r,i,s){return e.call(t,n,r,i,s)}:function(n,r,i){return e.call(t,n,r,i)}:e:q}function o(e){return"\\"+Tt[e]}function u(e){return Lt[e]}function a(){}function f(e,t,n){t||(t=0),typeof n=="undefined"&&(n=e?e.length:0);for(var r=-1,n=n-t||0,i=Array(0>n?0:n);++r<n;)i[r]=e[t+r];return i}function l(e){return At[e]}function c(e){if(!e)return e;for(var t=1,n=arguments.length;t<n;t++){var r=arguments[t];if(r)
|
||||
for(var i in r)e[i]=r[i]}return e}function h(e){var t=[];return kt(e,function(e,n){t.push(n)}),t}function p(e){if(!e)return e;for(var t=1,n=arguments.length;t<n;t++){var r=arguments[t];if(r)for(var i in r)null==e[i]&&(e[i]=r[i])}return e}function d(e){var t=[];return Ct(e,function(e,n){g(e)&&t.push(n)}),t.sort()}function v(e){var t={};return kt(e,function(e,n){t[e]=n}),t}function m(e,t,n,r){if(e===t)return 0!==e||1/e==1/t;if(null==e||null==t)return e===t;var i=it.call(e),s=it.call(t);if(i!=s)return!1
|
||||
;switch(i){case dt:case vt:return+e==+t;case mt:return e!=+e?t!=+t:0==e?1/e==1/t:e==+t;case yt:case bt:return e==t+""}s=i==pt;if(!s){if(e.__wrapped__||t.__wrapped__)return m(e.__wrapped__||e,t.__wrapped__||t);if(i!=gt)return!1;var i=e.constructor,o=t.constructor;if(i!=o&&(!g(i)||!(i instanceof i&&g(o)&&o instanceof o)))return!1}n||(n=[]),r||(r=[]);for(i=n.length;i--;)if(n[i]==e)return r[i]==t;var u=!0,a=0;n.push(e),r.push(t);if(s){a=e.length;if(u=a==t.length)for(;a--&&(u=m(e[a],t[a],n,r)););return u
|
||||
}return Ct(e,function(e,i,s){if(nt.call(s,i))return a++,!(u=nt.call(t,i)&&m(e,t[i],n,r))&&V}),u&&Ct(t,function(e,t,n){if(nt.call(n,t))return!(u=-1<--a)&&V}),u}function g(e){return typeof e=="function"}function y(e){return e?xt[typeof e]:!1}function b(e){return typeof e=="number"||it.call(e)==mt}function w(e){return typeof e=="string"||it.call(e)==bt}function E(e){var t=[];return kt(e,function(e){t.push(e)}),t}function S(e,t){var n=!1;return typeof (e?e.length:0)=="number"?n=-1<H(e,t):Nt(e,function(
|
||||
e){return(n=e===t)&&V}),n}function x(e,t,n){var r=!0,t=s(t,n);if(Ot(e))for(var n=-1,i=e.length;++n<i&&(r=!!t(e[n],n,e)););else Nt(e,function(e,n,i){return!(r=!!t(e,n,i))&&V});return r}function T(e,t,n){var r=[],t=s(t,n);if(Ot(e))for(var n=-1,i=e.length;++n<i;){var o=e[n];t(o,n,e)&&r.push(o)}else Nt(e,function(e,n,i){t(e,n,i)&&r.push(e)});return r}function N(e,t,n){var r,t=s(t,n);return C(e,function(e,n,i){if(t(e,n,i))return r=e,V}),r}function C(e,t,n){if(t&&typeof n=="undefined"&&Ot(e))for(var n=-1
|
||||
,r=e.length;++n<r&&t(e[n],n,e)!==V;);else Nt(e,t,n)}function k(e,t,n){var r=-1,i=e?e.length:0,o=Array(typeof i=="number"?i:0),t=s(t,n);if(Ot(e))for(;++r<i;)o[r]=t(e[r],r,e);else Nt(e,function(e,n,i){o[++r]=t(e,n,i)});return o}function L(e,t,n){var r=-Infinity,i=-1,o=e?e.length:0,u=r;if(t||!Ot(e))t=s(t,n),Nt(e,function(e,n,i){n=t(e,n,i),n>r&&(r=n,u=e)});else for(;++i<o;)e[i]>u&&(u=e[i]);return u}function A(e,t){return k(e,t+"")}function O(e,t,n,r){var i=3>arguments.length,t=s(t,r,V);if(Ot(e)){var o=-1
|
||||
,u=e.length;for(i&&(n=e[++o]);++o<u;)n=t(n,e[o],o,e)}else Nt(e,function(e,r,s){n=i?(i=!1,e):t(n,e,r,s)});return n}function M(e,t,n,r){var i=e?e.length:0,o=3>arguments.length;if(typeof i!="number")var u=Mt(e),i=u.length;return t=s(t,r,V),C(e,function(r,s,a){s=u?u[--i]:--i,n=o?(o=!1,e[s]):t(n,e[s],s,a)}),n}function _(e,t,n){var r,t=s(t,n);if(Ot(e))for(var n=-1,i=e.length;++n<i&&!(r=t(e[n],n,e)););else Nt(e,function(e,n,i){return(r=t(e,n,i))&&V});return!!r}function D(e,t,n){if(e){var r=e.length;return null==
|
||||
t||n?e[0]:f(e,0,ct(lt(0,t),r))}}function P(e,t){for(var n=-1,r=e?e.length:0,i=[];++n<r;){var s=e[n];Ot(s)?rt.apply(i,t?s:P(s)):i.push(s)}return i}function H(e,t,n){var r=-1,i=e?e.length:0;if(typeof n=="number")r=(0>n?lt(0,i+n):n||0)-1;else if(n)return r=j(e,t),e[r]===t?r:-1;for(;++r<i;)if(e[r]===t)return r;return-1}function B(e,t,n){return f(e,null==t||n?1:lt(0,t))}function j(e,t,n,r){for(var i=0,o=e?e.length:i,n=n?s(n,r):q,t=n(t);i<o;)r=i+o>>>1,n(e[r])<t?i=r+1:o=r;return i}function F(e,t,n,r){var i=-1
|
||||
,o=e?e.length:0,u=[],a=u;typeof t=="function"&&(r=n,n=t,t=!1),n&&(a=[],n=s(n,r));for(;++i<o;){var r=e[i],f=n?n(r,i,e):r;if(t?!i||a[a.length-1]!==f:0>H(a,f))n&&a.push(f),u.push(r)}return u}function I(e,t){return wt||st&&2<arguments.length?st.call.apply(st,arguments):i(e,t,f(arguments,2))}function q(e){return e}function R(e){C(d(e),function(t){var r=n[t]=e[t];n.prototype[t]=function(){var e=[this.__wrapped__];return rt.apply(e,arguments),e=r.apply(n,e),this.__chain__&&(e=new n(e),e.__chain__=!0),e}
|
||||
})}var U=typeof exports=="object"&&exports,z=typeof global=="object"&&global;z.global===z&&(e=z);var W=[],z=new function(){},X=0,V=z,$=e._,J=/&(?:amp|lt|gt|quot|#x27);/g,K=RegExp("^"+(z.valueOf+"").replace(/[.*+?^=!:${}()|[\]\/\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),Q=/($^)/,G=/[&<>"']/g,Y=/['\n\r\t\u2028\u2029\\]/g,Z=Math.ceil,et=W.concat,tt=Math.floor,nt=z.hasOwnProperty,rt=W.push,it=z.toString,st=K.test(st=f.bind)&&st,ot=K.test(ot=Array.isArray)&&ot,ut=e.isFinite,at=e.isNaN,ft=
|
||||
K.test(ft=Object.keys)&&ft,lt=Math.max,ct=Math.min,ht=Math.random,pt="[object Array]",dt="[object Boolean]",vt="[object Date]",mt="[object Number]",gt="[object Object]",yt="[object RegExp]",bt="[object String]",z=!!e.attachEvent,z=st&&!/\n|true/.test(st+z),wt=st&&!z,Et=(Et={0:1,length:1},W.splice.call(Et,0,1),Et[0]),St=arguments.constructor==Object,xt={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,"undefined":!1},Tt={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029"
|
||||
:"u2029"};n.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""};var Nt=function(e,t,n){if(!e)return e;var t=t&&typeof n=="undefined"?t:s(t,n),r=e.length,n=-1;if(typeof r=="number"){for(;++n<r;)if(t(e[n],n,e)===V)return e}else for(n in e)if(nt.call(e,n)&&t(e[n],n,e)===V)return e};n.isArguments=function(e){return"[object Arguments]"==it.call(e)},n.isArguments(arguments)||(n.isArguments=function(e){return e?nt.call(e,"callee"):!1});var Ct=
|
||||
function(e,t){var n;if(!e)return e;t||(t=q);for(n in e)if(t(e[n],n,e)===V)break;return e},kt=function(e,t){var n;if(!e)return e;t||(t=q);for(n in e)if(nt.call(e,n)&&t(e[n],n,e)===V)break;return e},Lt={"&":"&","<":"<",">":">",'"':""","'":"'"},At=v(Lt),Ot=ot||function(e){return St&&e instanceof Array||it.call(e)==pt};g(/x/)&&(g=function(e){return e instanceof Function||"[object Function]"==it.call(e)});var Mt=ft?function(e){return y(e)?ft(e):[]}:h;n.after=function(e,t){return 1>
|
||||
e?t():function(){if(1>--e)return t.apply(this,arguments)}},n.bind=I,n.bindAll=function(e){for(var t=arguments,n=1<t.length?0:(t=d(e),-1),r=t.length;++n<r;){var i=t[n];e[i]=I(e[i],e)}return e},n.compact=function(e){for(var t=-1,n=e?e.length:0,r=[];++t<n;){var i=e[t];i&&r.push(i)}return r},n.compose=function(){var e=arguments;return function(){for(var t=arguments,n=e.length;n--;)t=[e[n].apply(this,t)];return t[0]}},n.countBy=function(e,t,n){var r={},t=s(t,n);return C(e,function(e,n,i){n=t(e,n,i),nt
|
||||
.call(r,n)?r[n]++:r[n]=1}),r},n.debounce=function(e,t,n){function r(){u=null,n||(s=e.apply(o,i))}var i,s,o,u;return function(){var a=n&&!u;return i=arguments,o=this,clearTimeout(u),u=setTimeout(r,t),a&&(s=e.apply(o,i)),s}},n.defaults=p,n.defer=function(e){var n=f(arguments,1);return setTimeout(function(){e.apply(t,n)},1)},n.delay=function(e,n){var r=f(arguments,2);return setTimeout(function(){e.apply(t,r)},n)},n.difference=function(e){for(var t=-1,n=e.length,r=et.apply(W,arguments),i=[];++t<n;){var s=
|
||||
e[t];0>H(r,s,n)&&i.push(s)}return i},n.filter=T,n.flatten=P,n.forEach=C,n.functions=d,n.groupBy=function(e,t,n){var r={},t=s(t,n);return C(e,function(e,n,i){n=t(e,n,i),(nt.call(r,n)?r[n]:r[n]=[]).push(e)}),r},n.initial=function(e,t,n){if(!e)return[];var r=e.length;return f(e,0,ct(lt(0,r-(null==t||n?1:t||0)),r))},n.intersection=function(e){var t=arguments,n=t.length,r=-1,i=e?e.length:0,s=[];e:for(;++r<i;){var o=e[r];if(0>H(s,o)){for(var u=n;--u;)if(0>H(t[u],o))continue e;s.push(o)}}return s},n.invert=
|
||||
v,n.invoke=function(e,t){var n=f(arguments,2),r=typeof t=="function",i=[];return C(e,function(e){i.push((r?t:e[t]).apply(e,n))}),i},n.keys=Mt,n.map=k,n.max=L,n.memoize=function(e,t){var n={};return function(){var r=t?t.apply(this,arguments):arguments[0];return nt.call(n,r)?n[r]:n[r]=e.apply(this,arguments)}},n.min=function(e,t,n){var r=Infinity,i=-1,o=e?e.length:0,u=r;if(t||!Ot(e))t=s(t,n),Nt(e,function(e,n,i){n=t(e,n,i),n<r&&(r=n,u=e)});else for(;++i<o;)e[i]<u&&(u=e[i]);return u},n.object=function(
|
||||
e,t){for(var n=-1,r=e?e.length:0,i={};++n<r;){var s=e[n];t?i[s]=t[n]:i[s[0]]=s[1]}return i},n.omit=function(e){var t=et.apply(W,arguments),n={};return Ct(e,function(e,r){0>H(t,r,1)&&(n[r]=e)}),n},n.once=function(e){var t,n=!1;return function(){return n?t:(n=!0,t=e.apply(this,arguments),e=null,t)}},n.pairs=function(e){var t=[];return kt(e,function(e,n){t.push([n,e])}),t},n.pick=function(e){for(var t=0,n=et.apply(W,arguments),r=n.length,i={};++t<r;){var s=n[t];s in e&&(i[s]=e[s])}return i},n.pluck=
|
||||
A,n.range=function(e,t,n){e=+e||0,n=+n||1,null==t&&(t=e,e=0);for(var r=-1,t=lt(0,Z((t-e)/n)),i=Array(t);++r<t;)i[r]=e,e+=n;return i},n.reject=function(e,t,n){return t=s(t,n),T(e,function(e,n,r){return!t(e,n,r)})},n.rest=B,n.shuffle=function(e){var t=-1,n=Array(e?e.length:0);return C(e,function(e){var r=tt(ht()*(++t+1));n[t]=n[r],n[r]=e}),n},n.sortBy=function(e,t,n){var i=[],t=s(t,n);C(e,function(e,n,r){i.push({a:t(e,n,r),b:n,c:e})}),e=i.length;for(i.sort(r);e--;)i[e]=i[e].c;return i},n.tap=function(
|
||||
e,t){return t(e),e},n.throttle=function(e,t){function n(){u=new Date,o=null,i=e.apply(s,r)}var r,i,s,o,u=0;return function(){var a=new Date,f=t-(a-u);return r=arguments,s=this,0>=f?(clearTimeout(o),o=null,u=a,i=e.apply(s,r)):o||(o=setTimeout(n,f)),i}},n.times=function(e,t,n){for(var e=+e||0,r=-1,i=Array(e);++r<e;)i[r]=t.call(n,r);return i},n.toArray=function(e){return typeof (e?e.length:0)=="number"?f(e):E(e)},n.union=function(){return F(et.apply(W,arguments))},n.uniq=F,n.values=E,n.where=function(
|
||||
e,t){var n=Mt(t);return T(e,function(e){for(var r=n.length;r--;){var i=e[n[r]]===t[n[r]];if(!i)break}return!!i})},n.without=function(e){for(var t=-1,n=e.length,r=[];++t<n;){var i=e[t];0>H(arguments,i,1)&&r.push(i)}return r},n.wrap=function(e,t){return function(){var n=[e];return rt.apply(n,arguments),t.apply(this,n)}},n.zip=function(e){for(var t=-1,n=e?L(A(arguments,"length")):0,r=Array(n);++t<n;)r[t]=A(arguments,t);return r},n.collect=k,n.drop=B,n.each=C,n.extend=c,n.methods=d,n.select=T,n.tail=
|
||||
B,n.unique=F,n.clone=function(e){return e&&xt[typeof e]?Ot(e)?f(e):c({},e):e},n.contains=S,n.escape=function(e){return null==e?"":(e+"").replace(G,u)},n.every=x,n.find=N,n.has=function(e,t){return e?nt.call(e,t):!1},n.identity=q,n.indexOf=H,n.isArray=Ot,n.isBoolean=function(e){return!0===e||!1===e||it.call(e)==dt},n.isDate=function(e){return e instanceof Date||it.call(e)==vt},n.isElement=function(e){return e?1===e.nodeType:!1},n.isEmpty=function(e){if(!e)return!0;if(Ot(e)||w(e))return!e.length;for(
|
||||
var t in e)if(nt.call(e,t))return!1;return!0},n.isEqual=m,n.isFinite=function(e){return ut(e)&&!at(parseFloat(e))},n.isFunction=g,n.isNaN=function(e){return b(e)&&e!=+e},n.isNull=function(e){return null===e},n.isNumber=b,n.isObject=y,n.isRegExp=function(e){return e instanceof RegExp||it.call(e)==yt},n.isString=w,n.isUndefined=function(e){return typeof e=="undefined"},n.lastIndexOf=function(e,t,n){var r=e?e.length:0;for(typeof n=="number"&&(r=(0>n?lt(0,r+n):ct(n,r-1))+1);r--;)if(e[r]===t)return r;
|
||||
return-1},n.mixin=R,n.noConflict=function(){return e._=$,this},n.random=function(e,t){return null==e&&null==t&&(t=1),e=+e||0,null==t&&(t=e,e=0),e+tt(ht()*((+t||0)-e+1))},n.reduce=O,n.reduceRight=M,n.result=function(e,t){var n=e?e[t]:null;return g(n)?e[t]():n},n.size=function(e){var t=e?e.length:0;return typeof t=="number"?t:Mt(e).length},n.some=_,n.sortedIndex=j,n.template=function(e,t,r){e||(e="");var r=p({},r,n.templateSettings),i=0,s="__p+='",u=r.variable;e.replace(RegExp((r.escape||Q).source+"|"+
|
||||
(r.interpolate||Q).source+"|"+(r.evaluate||Q).source+"|$","g"),function(t,n,r,u,a){s+=e.slice(i,a).replace(Y,o),s+=n?"'+_['escape']("+n+")+'":u?"';"+u+";__p+='":r?"'+((__t=("+r+"))==null?'':__t)+'":"",i=a+t.length}),s+="';\n",u||(u="obj",s="with("+u+"||{}){"+s+"}"),s="function("+u+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+s+"return __p}";try{var a=Function("_","return "+s)(n)}catch(f){throw f.source=s,f}return t?a(t):(a.source=s,a)},n.unescape=function(
|
||||
e){return null==e?"":(e+"").replace(J,l)},n.uniqueId=function(e){var t=++X+"";return e?e+t:t},n.all=x,n.any=_,n.detect=N,n.foldl=O,n.foldr=M,n.include=S,n.inject=O,n.first=D,n.last=function(e,t,n){if(e){var r=e.length;return null==t||n?e[r-1]:f(e,lt(0,r-t))}},n.take=D,n.head=D,n.chain=function(e){return e=new n(e),e.__chain__=!0,e},n.VERSION="1.0.0-rc.3",R(n),n.prototype.chain=function(){return this.__chain__=!0,this},n.prototype.value=function(){return this.__wrapped__},Nt("pop push reverse shift sort splice unshift"
|
||||
.split(" "),function(e){var t=W[e];n.prototype[e]=function(){var e=this.__wrapped__;return t.apply(e,arguments),Et&&e.length===0&&delete e[0],this}}),Nt(["concat","join","slice"],function(e){var t=W[e];n.prototype[e]=function(){var e=t.apply(this.__wrapped__,arguments);return this.__chain__&&(e=new n(e),e.__chain__=!0),e}}),U?typeof module=="object"&&module&&module.exports==U?(module.exports=n)._=n:U._=n:e._=n})(this);
|
||||
22
package.json
@@ -1,9 +1,10 @@
|
||||
{
|
||||
"name": "lodash",
|
||||
"version": "1.0.0-rc.3",
|
||||
"description": "An alternative to Underscore.js, delivering consistency, customization, performance, and extra features.",
|
||||
"version": "1.2.0",
|
||||
"description": "A low-level utility library delivering consistency, customization, performance, and extra features.",
|
||||
"homepage": "http://lodash.com",
|
||||
"main": "./lodash",
|
||||
"license": "MIT",
|
||||
"main": "./dist/lodash.js",
|
||||
"keywords": [
|
||||
"browser",
|
||||
"client",
|
||||
@@ -13,12 +14,6 @@
|
||||
"speed",
|
||||
"util"
|
||||
],
|
||||
"licenses": [
|
||||
{
|
||||
"type": "MIT",
|
||||
"url": "http://lodash.com/license"
|
||||
}
|
||||
],
|
||||
"author": {
|
||||
"name": "John-David Dalton",
|
||||
"email": "john.david.dalton@gmail.com",
|
||||
@@ -34,20 +29,11 @@
|
||||
"bin": {
|
||||
"lodash": "./build.js"
|
||||
},
|
||||
"directories": {
|
||||
"doc": "./doc",
|
||||
"test": "./test"
|
||||
},
|
||||
"engines": [
|
||||
"node",
|
||||
"rhino"
|
||||
],
|
||||
"jam": {
|
||||
"main": "./lodash.js"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "node build",
|
||||
"test": "node test/test && node test/test-build",
|
||||
"install": "node build/post-install"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
<body>
|
||||
<div id="perf-toolbar"></div>
|
||||
<script src="../vendor/platform.js/platform.js"></script>
|
||||
<script src="../lodash.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>
|
||||
|
||||
@@ -34,19 +34,21 @@
|
||||
// expose Lo-Dash build file path
|
||||
ui.buildPath = (function() {
|
||||
switch (build) {
|
||||
case 'lodash-dev': return 'lodash.js';
|
||||
case 'lodash-underscore': return 'lodash.underscore.min.js';
|
||||
case 'lodash-dev': return 'dist/lodash.compat.js';
|
||||
case 'lodash-modern': return 'dist/lodash.min.js';
|
||||
case 'lodash-underscore': return 'dist/lodash.underscore.min.js';
|
||||
case 'lodash-custom': return 'lodash.custom.min.js';
|
||||
}
|
||||
return 'lodash.min.js';
|
||||
return 'dist/lodash.compat.min.js';
|
||||
}());
|
||||
|
||||
// expose other library file path
|
||||
ui.otherPath = (function() {
|
||||
switch (other) {
|
||||
case 'lodash-dev': return 'lodash.js';
|
||||
case 'lodash-prod': return 'lodash.min.js';
|
||||
case 'lodash-underscore': return 'lodash.underscore.min.js';
|
||||
case 'lodash-dev': return 'dist/lodash.compat.js';
|
||||
case 'lodash-prod': return 'dist/lodash.compat.min.js';
|
||||
case 'lodash-modern': return 'dist/lodash.min.js';
|
||||
case 'lodash-underscore': return 'dist/lodash.underscore.min.js';
|
||||
case 'lodash-custom': return 'lodash.custom.min.js';
|
||||
case 'underscore-dev': return 'vendor/underscore/underscore.js';
|
||||
}
|
||||
@@ -76,6 +78,7 @@
|
||||
'<select id="perf-build">' +
|
||||
'<option value="lodash-dev">Lo-Dash</option>' +
|
||||
'<option value="lodash-prod">Lo-Dash (minified)</option>' +
|
||||
'<option value="lodash-modern">Lo-Dash (modern)</option>' +
|
||||
'<option value="lodash-underscore">Lo-Dash (underscore)</option>' +
|
||||
'<option value="lodash-custom">Lo-Dash (custom)</option>' +
|
||||
'</select>';
|
||||
@@ -89,6 +92,7 @@
|
||||
'<option value="underscore-prod">Underscore (minified)</option>' +
|
||||
'<option value="lodash-dev">Lo-Dash</option>' +
|
||||
'<option value="lodash-prod">Lo-Dash (minified)</option>' +
|
||||
'<option value="lodash-modern">Lo-Dash (modern)</option>' +
|
||||
'<option value="lodash-underscore">Lo-Dash (underscore)</option>' +
|
||||
'<option value="lodash-custom">Lo-Dash (custom)</option>' +
|
||||
'</select>';
|
||||
@@ -102,20 +106,22 @@
|
||||
|
||||
buildList.selectedIndex = (function() {
|
||||
switch (build) {
|
||||
case 'lodash-dev': return 0;
|
||||
case 'lodash-underscore': return 2;
|
||||
case 'lodash-custom': return 3;
|
||||
case 'lodash-dev': return 0;
|
||||
case 'lodash-modern': return 2;
|
||||
case 'lodash-underscore': return 3;
|
||||
case 'lodash-custom': return 4;
|
||||
}
|
||||
return 1;
|
||||
}());
|
||||
|
||||
otherList.selectedIndex = (function() {
|
||||
switch (other) {
|
||||
case 'underscore-dev': return 0;
|
||||
case 'lodash-dev': return 2;
|
||||
case 'lodash-prod': return 3;
|
||||
case 'lodash-underscore': return 4;
|
||||
case 'lodash-custom': return 5;
|
||||
case 'underscore-dev': return 0;
|
||||
case 'lodash-dev': return 2;
|
||||
case 'lodash-prod': return 3;
|
||||
case 'lodash-modern': return 4;
|
||||
case 'lodash-underscore': return 5;
|
||||
case 'lodash-custom': return 6;
|
||||
}
|
||||
return 1;
|
||||
}());
|
||||
|
||||
508
perf/perf.js
@@ -1,55 +1,91 @@
|
||||
(function(window) {
|
||||
|
||||
/** Use a single load function */
|
||||
/** Use a single "load" function */
|
||||
var load = typeof require == 'function' ? require : window.load;
|
||||
|
||||
/** Load Benchmark.js */
|
||||
var Benchmark =
|
||||
window.Benchmark || (
|
||||
Benchmark = load('../vendor/benchmark.js/benchmark.js') || window.Benchmark,
|
||||
Benchmark.Benchmark || Benchmark
|
||||
);
|
||||
/** The file path of the Lo-Dash file to test */
|
||||
var filePath = (function() {
|
||||
var min = 0;
|
||||
var result = window.phantom
|
||||
? phantom.args
|
||||
: (window.system
|
||||
? (min = 1, system.args)
|
||||
: (window.process ? (min = 2, process.argv) : (window.arguments || []))
|
||||
);
|
||||
|
||||
var last = result[result.length - 1];
|
||||
result = (result.length > min && !/perf(?:\.js)?$/.test(last))
|
||||
? last
|
||||
: '../lodash.js';
|
||||
|
||||
try {
|
||||
result = require('fs').realpathSync(result);
|
||||
} catch(e) { }
|
||||
|
||||
return result;
|
||||
}());
|
||||
|
||||
/** Load Lo-Dash */
|
||||
var lodash =
|
||||
window.lodash || (
|
||||
lodash = load('../lodash.js') || window._,
|
||||
lodash = lodash._ || lodash,
|
||||
lodash.noConflict()
|
||||
);
|
||||
var lodash = window.lodash || (window.lodash = (
|
||||
lodash = load(filePath) || window._,
|
||||
lodash = lodash._ || lodash,
|
||||
lodash.noConflict()
|
||||
));
|
||||
|
||||
/** Load Benchmark.js */
|
||||
var Benchmark = window.Benchmark || (window.Benchmark = (
|
||||
Benchmark = load('../vendor/benchmark.js/benchmark.js') || window.Benchmark,
|
||||
Benchmark = Benchmark.Benchmark || Benchmark,
|
||||
Benchmark.runInContext(lodash.extend({}, window, { '_': lodash }))
|
||||
));
|
||||
|
||||
/** Load Underscore */
|
||||
var _ =
|
||||
window._ || (
|
||||
_ = load('../vendor/underscore/underscore.js') || window._,
|
||||
_._ || _
|
||||
);
|
||||
var _ = window._ || (window._ = (
|
||||
_ = load('../vendor/underscore/underscore.js') || window._,
|
||||
_._ || _
|
||||
));
|
||||
|
||||
/** Used to access the Firebug Lite panel (set by `run`) */
|
||||
var fbPanel;
|
||||
|
||||
/** Used to match path separators */
|
||||
var rePathSeparator = /[\/\\]/;
|
||||
|
||||
/** Used to detect primitive types */
|
||||
var rePrimitive = /^(?:boolean|number|string|undefined)$/;
|
||||
|
||||
/** Used to match RegExp special characters */
|
||||
var reSpecialChars = /[.*+?^=!:${}()|[\]\/\\]/g;
|
||||
|
||||
/** Used to score performance */
|
||||
var score = { 'a': 0, 'b': 0 };
|
||||
|
||||
/** Used to queue benchmark suites */
|
||||
var suites = [];
|
||||
|
||||
/** Used to resolve a value's internal [[Class]] */
|
||||
var toString = Object.prototype.toString;
|
||||
|
||||
/** The `ui` object */
|
||||
var ui = window.ui || {};
|
||||
var ui = window.ui || ({
|
||||
'buildPath': basename(filePath, '.js'),
|
||||
'otherPath': 'underscore'
|
||||
});
|
||||
|
||||
/** The Lo-Dash build basename */
|
||||
var buildName = basename(ui.buildPath || 'lodash', '.js');
|
||||
var buildName = basename(ui.buildPath, '.js');
|
||||
|
||||
/** The other library basename */
|
||||
var otherName = basename(ui.otherPath || 'underscore', '.js');
|
||||
var otherName = basename(ui.otherPath, '.js');
|
||||
|
||||
/** Add `console.log()` support for Narwhal and RingoJS */
|
||||
window.console || (window.console = { 'log': window.print });
|
||||
/** Detect if in a browser environment */
|
||||
var isBrowser = isHostType(window, 'document') && isHostType(window, 'navigator');
|
||||
|
||||
/** Expose functions to the global object */
|
||||
window._ = _;
|
||||
window.Benchmark = Benchmark;
|
||||
window.lodash = lodash;
|
||||
/** Detect Java environment */
|
||||
var isJava = !isBrowser && /Java/.test(toString.call(window.java));
|
||||
|
||||
/** Add `console.log()` support for Narwhal, Rhino, and RingoJS */
|
||||
var console = window.console || (window.console = { 'log': window.print });
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
@@ -63,10 +99,10 @@
|
||||
* @returns {String} Returns the basename.
|
||||
*/
|
||||
function basename(filePath, extension) {
|
||||
var result = (filePath || '').split(/[\\/]/).pop();
|
||||
return arguments.length < 2
|
||||
var result = (filePath || '').split(rePathSeparator).pop();
|
||||
return (arguments.length < 2)
|
||||
? result
|
||||
: result.replace(RegExp(extension.replace(/[.*+?^=!:${}()|[\]\/\\]/g, '\\$&') + '$'), '');
|
||||
: result.replace(RegExp(extension.replace(reSpecialChars, '\\$&') + '$'), '');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -78,7 +114,26 @@
|
||||
* @returns {Number} Returns the adjusted Hz.
|
||||
*/
|
||||
function getHz(bench) {
|
||||
return 1 / (bench.stats.mean + bench.stats.moe);
|
||||
var result = 1 / (bench.stats.mean + bench.stats.moe);
|
||||
return isFinite(result) ? result : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Host objects can return type values that are different from their actual
|
||||
* data type. The objects we are concerned with usually return non-primitive
|
||||
* types of "object", "function", or "unknown".
|
||||
*
|
||||
* @private
|
||||
* @param {Mixed} object The owner of the property.
|
||||
* @param {String} property The property to check.
|
||||
* @returns {Boolean} Returns `true` if the property value is a non-primitive, else `false`.
|
||||
*/
|
||||
function isHostType(object, property) {
|
||||
if (object == null) {
|
||||
return false;
|
||||
}
|
||||
var type = typeof object[property];
|
||||
return !rePrimitive.test(type) && (type != 'object' || !!object[property]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -106,7 +161,7 @@
|
||||
fbPanel.getElementById('fbPanel1');
|
||||
|
||||
log('\nSit back and relax, this may take a while.');
|
||||
suites[0].run();
|
||||
suites[0].run({ 'async': !isJava });
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
@@ -127,29 +182,37 @@
|
||||
aHz = getHz(this[0]),
|
||||
bHz = getHz(this[1]);
|
||||
|
||||
if (fastest.length > 1) {
|
||||
log('It\'s too close to call.');
|
||||
aHz = bHz = slowestHz;
|
||||
for (var index = 0, length = this.length; index < length; index++) {
|
||||
var bench = this[index];
|
||||
if (bench.error) {
|
||||
var errored = true;
|
||||
log(bench.error);
|
||||
}
|
||||
}
|
||||
else {
|
||||
var percent = ((fastestHz / slowestHz) - 1) * 100;
|
||||
if (!errored) {
|
||||
if (fastest.length > 1) {
|
||||
log('It\'s too close to call.');
|
||||
aHz = bHz = slowestHz;
|
||||
}
|
||||
else {
|
||||
var percent = ((fastestHz / slowestHz) - 1) * 100;
|
||||
|
||||
log(
|
||||
fastest[0].name + ' is ' +
|
||||
formatNumber(percent < 1 ? percent.toFixed(2) : Math.round(percent)) +
|
||||
'% faster.'
|
||||
);
|
||||
log(
|
||||
fastest[0].name + ' is ' +
|
||||
formatNumber(percent < 1 ? percent.toFixed(2) : Math.round(percent)) +
|
||||
'% faster.'
|
||||
);
|
||||
}
|
||||
// add score adjusted for margin of error
|
||||
score.a += aHz;
|
||||
score.b += bHz;
|
||||
}
|
||||
// add score adjusted for margin of error
|
||||
score.a += aHz;
|
||||
score.b += bHz;
|
||||
|
||||
// remove current suite from queue
|
||||
suites.shift();
|
||||
|
||||
if (suites.length) {
|
||||
// run next suite
|
||||
suites[0].run();
|
||||
suites[0].run({ 'async': !isJava });
|
||||
}
|
||||
else {
|
||||
var fastestTotalHz = Math.max(score.a, score.b),
|
||||
@@ -173,8 +236,7 @@
|
||||
lodash.extend(Benchmark.options, {
|
||||
'async': true,
|
||||
'setup': '\
|
||||
var window = Function("return this || global")(),\
|
||||
_ = window._,\
|
||||
var _ = window._,\
|
||||
lodash = window.lodash,\
|
||||
belt = this.name == "Lo-Dash" ? lodash : _;\
|
||||
\
|
||||
@@ -187,7 +249,7 @@
|
||||
numbers = Array(limit),\
|
||||
fourNumbers = [5, 25, 10, 30],\
|
||||
nestedNumbers = [1, [2], [3, [[4]]]],\
|
||||
twoNumbers = [12, 21];\
|
||||
twoNumbers = [12, 23];\
|
||||
\
|
||||
for (index = 0; index < limit; index++) {\
|
||||
numbers[index] = index;\
|
||||
@@ -196,20 +258,18 @@
|
||||
}\
|
||||
\
|
||||
if (typeof bind != "undefined") {\
|
||||
var contextObject = { "name": "moe" },\
|
||||
var thisArg = { "name": "moe" },\
|
||||
ctor = function() {};\
|
||||
\
|
||||
var func = function(greeting, punctuation) {\
|
||||
return greeting + ", " + this.name + (punctuation || ".");\
|
||||
};\
|
||||
\
|
||||
var lodashBoundNormal = lodash.bind(func, contextObject),\
|
||||
lodashBoundCtor = lodash.bind(ctor, contextObject),\
|
||||
lodashBoundPartial = lodash.bind(func, contextObject, "hi");\
|
||||
var _boundNormal = _.bind(func, thisArg),\
|
||||
_boundPartial = _.bind(func, thisArg, "hi");\
|
||||
\
|
||||
var _boundNormal = _.bind(func, contextObject),\
|
||||
_boundCtor = _.bind(ctor, contextObject),\
|
||||
_boundPartial = _.bind(func, contextObject, "hi");\
|
||||
var lodashBoundNormal = lodash.bind(func, thisArg),\
|
||||
lodashBoundPartial = lodash.bind(func, thisArg, "hi");\
|
||||
}\
|
||||
\
|
||||
if (typeof bindAll != "undefined") {\
|
||||
@@ -224,6 +284,10 @@
|
||||
}, {});\
|
||||
}\
|
||||
}\
|
||||
if (typeof chaining != "undefined") {\
|
||||
var _chaining = _.chain ? _(numbers).chain() : _(numbers),\
|
||||
lodashChaining = lodash(numbers);\
|
||||
}\
|
||||
if (typeof compact != "undefined") {\
|
||||
var uncompacted = numbers.slice();\
|
||||
uncompacted[2] = false;\
|
||||
@@ -294,7 +358,13 @@
|
||||
var object2 = {},\
|
||||
objects2 = Array(limit),\
|
||||
numbers2 = Array(limit),\
|
||||
nestedNumbers2 = [1, [2], [3, [[4]]]];\
|
||||
nestedNumbers2 = [1, [2], [3, [[4]]]],\
|
||||
nestedNumbers3 = [1, [2], [5, [[6]]]],\
|
||||
simpleObject = { "a": 1 },\
|
||||
simpleObject2 = { "a": 2 },\
|
||||
simpleObjects = [simpleObject],\
|
||||
simpleObjects2 = [simpleObject2],\
|
||||
twoNumbers2 = [18, 27];\
|
||||
\
|
||||
for (index = 0; index < limit; index++) {\
|
||||
object2["key" + index] = index;\
|
||||
@@ -316,12 +386,14 @@
|
||||
fiftyValues2 = Array(50),\
|
||||
seventyFiveValues = Array(75),\
|
||||
seventyFiveValues2 = Array(75),\
|
||||
hundredValues = Array(100),\
|
||||
hundredValues2 = Array(100),\
|
||||
oneHundredValues = Array(100),\
|
||||
oneHundredValues2 = Array(100),\
|
||||
twoHundredValues = Array(200),\
|
||||
twoHundredValues2 = Array(200),\
|
||||
lowerChars = "abcdefghijklmnopqrstuvwxyz".split(""),\
|
||||
upperChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");\
|
||||
\
|
||||
for (index = 0; index < 100; index++) {\
|
||||
for (index = 0; index < 200; index++) {\
|
||||
if (index < 15) {\
|
||||
twentyValues[index] = lowerChars[index];\
|
||||
twentyValues2[index] = upperChars[index];\
|
||||
@@ -341,13 +413,15 @@
|
||||
fortyValues[index] =\
|
||||
fiftyValues[index] =\
|
||||
seventyFiveValues[index] =\
|
||||
hundredValues[index] = lowerChars[index];\
|
||||
oneHundredValues[index] =\
|
||||
twoHundredValues[index] = lowerChars[index];\
|
||||
\
|
||||
thirtyValues2[index] =\
|
||||
fortyValues2[index] =\
|
||||
fiftyValues2[index] =\
|
||||
seventyFiveValues2[index] =\
|
||||
hundredValues2[index] = upperChars[index];\
|
||||
oneHundredValues2[index] =\
|
||||
twoHundredValues2[index] = upperChars[index];\
|
||||
}\
|
||||
else {\
|
||||
if (index < 30) {\
|
||||
@@ -366,8 +440,12 @@
|
||||
seventyFiveValues[index] =\
|
||||
seventyFiveValues2[index] = index;\
|
||||
}\
|
||||
hundredValues[index] =\
|
||||
hundredValues2[index] = index;\
|
||||
if (index < 100) {\
|
||||
oneHundredValues[index] =\
|
||||
oneHundredValues2[index] = index;\
|
||||
}\
|
||||
twoHundredValues[index] =\
|
||||
twoHundredValues2[index] = index;\
|
||||
}\
|
||||
}\
|
||||
}\
|
||||
@@ -383,33 +461,14 @@
|
||||
"list": ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"]\
|
||||
};\
|
||||
\
|
||||
var tplBase =\
|
||||
var tpl =\
|
||||
"<div>" +\
|
||||
"<h1 class=\'header1\'><%= header1 %></h1>" +\
|
||||
"<h2 class=\'header2\'><%= header2 %></h2>" +\
|
||||
"<h3 class=\'header3\'><%= header3 %></h3>" +\
|
||||
"<h4 class=\'header4\'><%= header4 %></h4>" +\
|
||||
"<h5 class=\'header5\'><%= header5 %></h5>" +\
|
||||
"<h6 class=\'header6\'><%= header6 %></h6>";\
|
||||
\
|
||||
var tpl =\
|
||||
tplBase +\
|
||||
"<ul class=\'list\'>" +\
|
||||
"<li class=\'item\'><%= list[0] %></li>" +\
|
||||
"<li class=\'item\'><%= list[1] %></li>" +\
|
||||
"<li class=\'item\'><%= list[2] %></li>" +\
|
||||
"<li class=\'item\'><%= list[3] %></li>" +\
|
||||
"<li class=\'item\'><%= list[4] %></li>" +\
|
||||
"<li class=\'item\'><%= list[5] %></li>" +\
|
||||
"<li class=\'item\'><%= list[6] %></li>" +\
|
||||
"<li class=\'item\'><%= list[7] %></li>" +\
|
||||
"<li class=\'item\'><%= list[8] %></li>" +\
|
||||
"<li class=\'item\'><%= list[9] %></li>" +\
|
||||
"</ul>" +\
|
||||
"</div>";\
|
||||
\
|
||||
var tplWithEvaluate =\
|
||||
tplBase +\
|
||||
"<h6 class=\'header6\'><%= header6 %></h6>" +\
|
||||
"<ul class=\'list\'>" +\
|
||||
"<% for (var index = 0, length = list.length; index < length; index++) { %>" +\
|
||||
"<li class=\'item\'><%= list[index] %></li>" +\
|
||||
@@ -417,33 +476,14 @@
|
||||
"</ul>" +\
|
||||
"</div>";\
|
||||
\
|
||||
var tplBaseVerbose =\
|
||||
var tplVerbose =\
|
||||
"<div>" +\
|
||||
"<h1 class=\'header1\'><%= data.header1 %></h1>" +\
|
||||
"<h2 class=\'header2\'><%= data.header2 %></h2>" +\
|
||||
"<h3 class=\'header3\'><%= data.header3 %></h3>" +\
|
||||
"<h4 class=\'header4\'><%= data.header4 %></h4>" +\
|
||||
"<h5 class=\'header5\'><%= data.header5 %></h5>" +\
|
||||
"<h6 class=\'header6\'><%= data.header6 %></h6>";\
|
||||
\
|
||||
var tplVerbose =\
|
||||
tplBaseVerbose +\
|
||||
"<ul class=\'list\'>" +\
|
||||
"<li class=\'item\'><%= data.list[0] %></li>" +\
|
||||
"<li class=\'item\'><%= data.list[1] %></li>" +\
|
||||
"<li class=\'item\'><%= data.list[2] %></li>" +\
|
||||
"<li class=\'item\'><%= data.list[3] %></li>" +\
|
||||
"<li class=\'item\'><%= data.list[4] %></li>" +\
|
||||
"<li class=\'item\'><%= data.list[5] %></li>" +\
|
||||
"<li class=\'item\'><%= data.list[6] %></li>" +\
|
||||
"<li class=\'item\'><%= data.list[7] %></li>" +\
|
||||
"<li class=\'item\'><%= data.list[8] %></li>" +\
|
||||
"<li class=\'item\'><%= data.list[9] %></li>" +\
|
||||
"</ul>" +\
|
||||
"</div>";\
|
||||
\
|
||||
var tplVerboseWithEvaluate =\
|
||||
tplBaseVerbose +\
|
||||
"<h6 class=\'header6\'><%= data.header6 %></h6>" +\
|
||||
"<ul class=\'list\'>" +\
|
||||
"<% for (var index = 0, length = data.list.length; index < length; index++) { %>" +\
|
||||
"<li class=\'item\'><%= data.list[index] %></li>" +\
|
||||
@@ -453,20 +493,72 @@
|
||||
\
|
||||
var settingsObject = { "variable": "data" };\
|
||||
\
|
||||
var lodashTpl = lodash.template(tpl),\
|
||||
lodashTplWithEvaluate = lodash.template(tplWithEvaluate),\
|
||||
lodashTplVerbose = lodash.template(tplVerbose, null, settingsObject),\
|
||||
lodashTplVerboseWithEvaluate = lodash.template(tplVerboseWithEvaluate, null, settingsObject);\
|
||||
\
|
||||
var _tpl = _.template(tpl),\
|
||||
_tplWithEvaluate = _.template(tplWithEvaluate),\
|
||||
_tplVerbose = _.template(tplVerbose, null, settingsObject),\
|
||||
_tplVerboseWithEvaluate = _.template(tplVerboseWithEvaluate, null, settingsObject);\
|
||||
_tplVerbose = _.template(tplVerbose, null, settingsObject);\
|
||||
\
|
||||
var lodashTpl = lodash.template(tpl),\
|
||||
lodashTplVerbose = lodash.template(tplVerbose, null, settingsObject);\
|
||||
}\
|
||||
if (typeof where != "undefined") {\
|
||||
var _findWhere = _.findWhere || _.find,\
|
||||
lodashFindWhere = lodash.findWhere || lodash.find,\
|
||||
whereObject = { "num": 9 };\
|
||||
}\
|
||||
if (typeof zip != "undefined") {\
|
||||
var unzipped = [["a", "b", "c"], [1, 2, 3], [true, false, true]],\
|
||||
zipped = [["a", 1, true], ["b", 2, false], ["c", 3, true]];\
|
||||
}'
|
||||
});
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
suites.push(
|
||||
Benchmark.Suite('`_(...)` with a number')
|
||||
.add(buildName, '\
|
||||
lodash(2)'
|
||||
)
|
||||
.add(otherName, '\
|
||||
_(2)'
|
||||
)
|
||||
);
|
||||
|
||||
suites.push(
|
||||
Benchmark.Suite('`_(...)` with an array')
|
||||
.add(buildName, '\
|
||||
lodash(numbers)'
|
||||
)
|
||||
.add(otherName, '\
|
||||
_(numbers)'
|
||||
)
|
||||
);
|
||||
|
||||
suites.push(
|
||||
Benchmark.Suite('`_(...)` with an object')
|
||||
.add(buildName, '\
|
||||
lodash(object)'
|
||||
)
|
||||
.add(otherName, '\
|
||||
_(object)'
|
||||
)
|
||||
);
|
||||
|
||||
// avoid Underscore induced `OutOfMemoryError` in Rhino, Narwhal, and Ringo
|
||||
if (!isJava) {
|
||||
suites.push(
|
||||
Benchmark.Suite('`_(...).tap(...)`')
|
||||
.add(buildName, {
|
||||
'fn': 'lodashChaining.tap(lodash.identity)',
|
||||
'teardown': 'function chaining(){}'
|
||||
})
|
||||
.add(otherName, {
|
||||
'fn': '_chaining.tap(_.identity)',
|
||||
'teardown': 'function chaining(){}'
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
suites.push(
|
||||
Benchmark.Suite('`_.bind` (uses native `Function#bind` if available and inferred fast)')
|
||||
.add(buildName, {
|
||||
@@ -527,18 +619,6 @@
|
||||
})
|
||||
);
|
||||
|
||||
suites.push(
|
||||
Benchmark.Suite('bound and called in a `new` expression, i.e. `new bound` (edge case)')
|
||||
.add(buildName, {
|
||||
'fn': 'new lodashBoundCtor()',
|
||||
'teardown': 'function bind(){}'
|
||||
})
|
||||
.add(otherName, {
|
||||
'fn': 'new _boundCtor()',
|
||||
'teardown': 'function bind(){}'
|
||||
})
|
||||
);
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
suites.push(
|
||||
@@ -674,13 +754,13 @@
|
||||
);
|
||||
|
||||
suites.push(
|
||||
Benchmark.Suite('`_.difference` iterating 30 elements')
|
||||
Benchmark.Suite('`_.difference` iterating 200 elements')
|
||||
.add(buildName, {
|
||||
'fn': 'lodash.difference(thirtyValues, thirtyValues2)',
|
||||
'fn': 'lodash.difference(twoHundredValues, twoHundredValues2)',
|
||||
'teardown': 'function multiArrays(){}'
|
||||
})
|
||||
.add(otherName, {
|
||||
'fn': '_.difference(thirtyValues, thirtyValues2)',
|
||||
'fn': '_.difference(twoHundredValues, twoHundredValues2)',
|
||||
'teardown': 'function multiArrays(){}'
|
||||
})
|
||||
);
|
||||
@@ -863,6 +943,21 @@
|
||||
)
|
||||
);
|
||||
|
||||
// avoid Underscore induced `OutOfMemoryError` in Rhino, Narwhal, and Ringo
|
||||
if (!isJava) {
|
||||
suites.push(
|
||||
Benchmark.Suite('`_.find` with `properties`')
|
||||
.add(buildName, {
|
||||
'fn': 'lodashFindWhere(objects, whereObject)',
|
||||
'teardown': 'function where(){}'
|
||||
})
|
||||
.add(otherName, {
|
||||
'fn': '_findWhere(objects, whereObject)',
|
||||
'teardown': 'function where(){}'
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
suites.push(
|
||||
@@ -968,13 +1063,13 @@
|
||||
);
|
||||
|
||||
suites.push(
|
||||
Benchmark.Suite('`_.intersection` iterating 100 elements')
|
||||
Benchmark.Suite('`_.intersection` iterating 200 elements')
|
||||
.add(buildName, {
|
||||
'fn': 'lodash.intersection(hundredValues, hundredValues2)',
|
||||
'fn': 'lodash.intersection(twoHundredValues, twoHundredValues2)',
|
||||
'teardown': 'function multiArrays(){}'
|
||||
})
|
||||
.add(otherName, {
|
||||
'fn': '_.intersection(hundredValues, hundredValues2)',
|
||||
'fn': '_.intersection(twoHundredValues, twoHundredValues2)',
|
||||
'teardown': 'function multiArrays(){}'
|
||||
})
|
||||
);
|
||||
@@ -1040,11 +1135,15 @@
|
||||
suites.push(
|
||||
Benchmark.Suite('`_.isEqual` comparing arrays')
|
||||
.add(buildName, {
|
||||
'fn': 'lodash.isEqual(numbers, numbers2)',
|
||||
'fn': '\
|
||||
lodash.isEqual(numbers, numbers2);\
|
||||
lodash.isEqual(twoNumbers, twoNumbers2);',
|
||||
'teardown': 'function isEqual(){}'
|
||||
})
|
||||
.add(otherName, {
|
||||
'fn': '_.isEqual(numbers, numbers2)',
|
||||
'fn': '\
|
||||
_.isEqual(numbers, numbers2);\
|
||||
_.isEqual(twoNumbers, twoNumbers2);',
|
||||
'teardown': 'function isEqual(){}'
|
||||
})
|
||||
);
|
||||
@@ -1052,11 +1151,15 @@
|
||||
suites.push(
|
||||
Benchmark.Suite('`_.isEqual` comparing nested arrays')
|
||||
.add(buildName, {
|
||||
'fn': 'lodash.isEqual(nestedNumbers, nestedNumbers2)',
|
||||
'fn': '\
|
||||
lodash.isEqual(nestedNumbers, nestedNumbers2);\
|
||||
lodash.isEqual(nestedNumbers2, nestedNumbers3);',
|
||||
'teardown': 'function isEqual(){}'
|
||||
})
|
||||
.add(otherName, {
|
||||
'fn': '_.isEqual(nestedNumbers, nestedNumbers2)',
|
||||
'fn': '\
|
||||
_.isEqual(nestedNumbers, nestedNumbers2);\
|
||||
_.isEqual(nestedNumbers2, nestedNumbers3);',
|
||||
'teardown': 'function isEqual(){}'
|
||||
})
|
||||
);
|
||||
@@ -1064,11 +1167,15 @@
|
||||
suites.push(
|
||||
Benchmark.Suite('`_.isEqual` comparing arrays of objects')
|
||||
.add(buildName, {
|
||||
'fn': 'lodash.isEqual(objects, objects2)',
|
||||
'fn': '\
|
||||
lodash.isEqual(objects, objects2);\
|
||||
lodash.isEqual(simpleObjects, simpleObjects2);',
|
||||
'teardown': 'function isEqual(){}'
|
||||
})
|
||||
.add(otherName, {
|
||||
'fn': '_.isEqual(objects, objects2)',
|
||||
'fn': '\
|
||||
_.isEqual(objects, objects2);\
|
||||
_.isEqual(simpleObjects, simpleObjects2);',
|
||||
'teardown': 'function isEqual(){}'
|
||||
})
|
||||
);
|
||||
@@ -1076,11 +1183,15 @@
|
||||
suites.push(
|
||||
Benchmark.Suite('`_.isEqual` comparing objects')
|
||||
.add(buildName, {
|
||||
'fn': 'lodash.isEqual(object, object2)',
|
||||
'fn': '\
|
||||
lodash.isEqual(object, object2);\
|
||||
lodash.isEqual(simpleObject, simpleObject2);',
|
||||
'teardown': 'function isEqual(){}'
|
||||
})
|
||||
.add(otherName, {
|
||||
'fn': '_.isEqual(object, object2)',
|
||||
'fn': '\
|
||||
_.isEqual(object, object2);\
|
||||
_.isEqual(simpleObject, simpleObject2);',
|
||||
'teardown': 'function isEqual(){}'
|
||||
})
|
||||
);
|
||||
@@ -1226,7 +1337,7 @@
|
||||
'teardown': 'function omit(){}'
|
||||
})
|
||||
.add(otherName, {
|
||||
'fn': 'result = _.omit(wordToNumber, words)',
|
||||
'fn': '_.omit(wordToNumber, words)',
|
||||
'teardown': 'function omit(){}'
|
||||
})
|
||||
);
|
||||
@@ -1289,13 +1400,13 @@
|
||||
Benchmark.Suite('`_.reduce` iterating an object')
|
||||
.add(buildName, '\
|
||||
lodash.reduce(object, function(result, value, key) {\
|
||||
result.push([key, value]);\
|
||||
result.push(key, value);\
|
||||
return result;\
|
||||
}, []);'
|
||||
)
|
||||
.add(otherName, '\
|
||||
_.reduce(object, function(result, value, key) {\
|
||||
result.push([key, value]);\
|
||||
result.push(key, value);\
|
||||
return result;\
|
||||
}, []);'
|
||||
)
|
||||
@@ -1323,13 +1434,13 @@
|
||||
Benchmark.Suite('`_.reduceRight` iterating an object')
|
||||
.add(buildName, '\
|
||||
lodash.reduceRight(object, function(result, value, key) {\
|
||||
result.push([key, value]);\
|
||||
result.push(key, value);\
|
||||
return result;\
|
||||
}, []);'
|
||||
)
|
||||
.add(otherName, '\
|
||||
_.reduceRight(object, function(result, value, key) {\
|
||||
result.push([key, value]);\
|
||||
result.push(key, value);\
|
||||
return result;\
|
||||
}, []);'
|
||||
)
|
||||
@@ -1419,6 +1530,20 @@
|
||||
)
|
||||
);
|
||||
|
||||
suites.push(
|
||||
Benchmark.Suite('`_.some` with `thisArg` iterating an array (slow path)')
|
||||
.add(buildName, '\
|
||||
lodash.some(objects, function(value, index) {\
|
||||
return this["key" + index] == 19;\
|
||||
}, object)'
|
||||
)
|
||||
.add(otherName, '\
|
||||
_.some(objects, function(value, index) {\
|
||||
return this["key" + index] == 19;\
|
||||
}, object)'
|
||||
)
|
||||
);
|
||||
|
||||
suites.push(
|
||||
Benchmark.Suite('`_.some` iterating an object')
|
||||
.add(buildName, '\
|
||||
@@ -1500,7 +1625,7 @@
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
suites.push(
|
||||
Benchmark.Suite('`_.template` without "evaluate" delimiters (slow path)')
|
||||
Benchmark.Suite('`_.template` (slow path)')
|
||||
.add(buildName, {
|
||||
'fn': 'lodash.template(tpl, tplData)',
|
||||
'teardown': 'function template(){}'
|
||||
@@ -1512,19 +1637,7 @@
|
||||
);
|
||||
|
||||
suites.push(
|
||||
Benchmark.Suite('`_.template` with "evaluate" delimiters (slow path)')
|
||||
.add(buildName, {
|
||||
'fn': 'lodash.template(tplWithEvaluate, tplData)',
|
||||
'teardown': 'function template(){}'
|
||||
})
|
||||
.add(otherName, {
|
||||
'fn': '_.template(tplWithEvaluate, tplData)',
|
||||
'teardown': 'function template(){}'
|
||||
})
|
||||
);
|
||||
|
||||
suites.push(
|
||||
Benchmark.Suite('compiled template without "evaluate" delimiters')
|
||||
Benchmark.Suite('compiled template')
|
||||
.add(buildName, {
|
||||
'fn': 'lodashTpl(tplData)',
|
||||
'teardown': 'function template(){}'
|
||||
@@ -1536,19 +1649,7 @@
|
||||
);
|
||||
|
||||
suites.push(
|
||||
Benchmark.Suite('compiled template with "evaluate" delimiters')
|
||||
.add(buildName, {
|
||||
'fn': 'lodashTplWithEvaluate(tplData)',
|
||||
'teardown': 'function template(){}'
|
||||
})
|
||||
.add(otherName, {
|
||||
'fn': '_tplWithEvaluate(tplData)',
|
||||
'teardown': 'function template(){}'
|
||||
})
|
||||
);
|
||||
|
||||
suites.push(
|
||||
Benchmark.Suite('compiled template without a with-statement or "evaluate" delimiters')
|
||||
Benchmark.Suite('compiled template without a with-statement')
|
||||
.add(buildName, {
|
||||
'fn': 'lodashTplVerbose(tplData)',
|
||||
'teardown': 'function template(){}'
|
||||
@@ -1559,18 +1660,6 @@
|
||||
})
|
||||
);
|
||||
|
||||
suites.push(
|
||||
Benchmark.Suite('compiled template without a with-statement using "evaluate" delimiters')
|
||||
.add(buildName, {
|
||||
'fn': 'lodashTplVerboseWithEvaluate(tplData)',
|
||||
'teardown': 'function template(){}'
|
||||
})
|
||||
.add(otherName, {
|
||||
'fn': '_tplVerboseWithEvaluate(tplData)',
|
||||
'teardown': 'function template(){}'
|
||||
})
|
||||
);
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
suites.push(
|
||||
@@ -1670,19 +1759,33 @@
|
||||
);
|
||||
|
||||
suites.push(
|
||||
Benchmark.Suite('`_.uniq` iterating an array of 75 elements')
|
||||
Benchmark.Suite('`_.uniq` iterating an array of 200 elements')
|
||||
.add(buildName, {
|
||||
'fn': 'lodash.uniq(fiftyValues.concat(twentyFiveValues2));',
|
||||
'fn': 'lodash.uniq(oneHundredValues.concat(oneHundredValues2));',
|
||||
'teardown': 'function multiArrays(){}'
|
||||
})
|
||||
.add(otherName, {
|
||||
'fn': '_.uniq(fiftyValues.concat(twentyFiveValues2));',
|
||||
'fn': '_.uniq(oneHundredValues.concat(oneHundredValues2));',
|
||||
'teardown': 'function multiArrays(){}'
|
||||
})
|
||||
);
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
suites.push(
|
||||
Benchmark.Suite('`_.unzip`')
|
||||
.add(buildName, {
|
||||
'fn': 'lodash.unzip(zipped);',
|
||||
'teardown': 'function zip(){}'
|
||||
})
|
||||
.add(otherName, {
|
||||
'fn': '_.unzip(zipped);',
|
||||
'teardown': 'function zip(){}'
|
||||
})
|
||||
);
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
suites.push(
|
||||
Benchmark.Suite('`_.values`')
|
||||
.add(buildName, '\
|
||||
@@ -1697,12 +1800,14 @@
|
||||
|
||||
suites.push(
|
||||
Benchmark.Suite('`_.where`')
|
||||
.add(buildName, '\
|
||||
lodash.where(objects, { "num": 9 });'
|
||||
)
|
||||
.add(otherName, '\
|
||||
_.where(objects, { "num": 9 });'
|
||||
)
|
||||
.add(buildName, {
|
||||
'fn': 'lodash.where(objects, whereObject);',
|
||||
'teardown': 'function where(){}'
|
||||
})
|
||||
.add(otherName, {
|
||||
'fn': '_.where(objects, whereObject);',
|
||||
'teardown': 'function where(){}'
|
||||
})
|
||||
);
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
@@ -1717,15 +1822,17 @@
|
||||
)
|
||||
);
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
suites.push(
|
||||
Benchmark.Suite('`_.without` iterating an array of 20 elements')
|
||||
Benchmark.Suite('`_.zip`')
|
||||
.add(buildName, {
|
||||
'fn': 'lodash.without.apply(lodash, [twentyValues].concat(twentyValues2));',
|
||||
'teardown': 'function multiArrays(){}'
|
||||
'fn': 'lodash.zip.apply(lodash, unzipped);',
|
||||
'teardown': 'function zip(){}'
|
||||
})
|
||||
.add(otherName, {
|
||||
'fn': '_.without.apply(_, [twentyValues].concat(twentyValues2));',
|
||||
'teardown': 'function multiArrays(){}'
|
||||
'fn': '_.zip.apply(_, unzipped);',
|
||||
'teardown': 'function zip(){}'
|
||||
})
|
||||
);
|
||||
|
||||
@@ -1734,9 +1841,8 @@
|
||||
if (Benchmark.platform + '') {
|
||||
log(Benchmark.platform);
|
||||
}
|
||||
|
||||
// in the browser, expose `run` to be called later
|
||||
if (window.document) {
|
||||
if (window.document && !window.phantom) {
|
||||
window.run = run;
|
||||
} else {
|
||||
run();
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
cd "$(dirname "$0")"
|
||||
for cmd in node narwhal ringo rhino; do
|
||||
echo ""
|
||||
echo "Running performance suite in $cmd..."
|
||||
$cmd perf.js
|
||||
|
||||
echo "Running performance suite in node..."
|
||||
node perf.js ../dist/lodash.js && node perf.js ../dist/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
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "Running performance suite in a browser..."
|
||||
open index.html
|
||||
open index.html
|
||||
|
||||
@@ -21,13 +21,7 @@
|
||||
<script src="../vendor/json3/lib/json3.js"></script>
|
||||
<script src="../vendor/jquery/jquery.js"></script>
|
||||
<script src="../vendor/platform.js/platform.js"></script>
|
||||
<script>
|
||||
// avoid syntax errors for `QUnit.throws` in older Firefoxes
|
||||
document.write(platform.name == 'Firefox' && /^1\b/.test(platform.version)
|
||||
? '<script src="../vendor/qunit/qunit/qunit-1.8.0.js"><\/script>'
|
||||
: '<script src="../vendor/qunit/qunit/qunit.js"><\/script>'
|
||||
);
|
||||
</script>
|
||||
<script src="../vendor/qunit/qunit/qunit.js"></script>
|
||||
<script src="test-ui.js"></script>
|
||||
<script src="../lodash.js"></script>
|
||||
<script>
|
||||
@@ -36,7 +30,8 @@
|
||||
</script>
|
||||
<script>
|
||||
_.mixin({
|
||||
'debounce': lodash.debounce
|
||||
'debounce': lodash.debounce,
|
||||
'defer': lodash.defer
|
||||
});
|
||||
if (!_.chain) {
|
||||
_.mixin({
|
||||
|
||||
@@ -4,18 +4,18 @@
|
||||
<meta charset="utf-8">
|
||||
<title>Lo-Dash Test Suite</title>
|
||||
<link rel="stylesheet" href="../vendor/qunit/qunit/qunit.css">
|
||||
<style>
|
||||
#exports {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="qunit"></div>
|
||||
<script src="../vendor/qunit/qunit/qunit.js"></script>
|
||||
<script src="../vendor/platform.js/platform.js"></script>
|
||||
<script>
|
||||
// avoid syntax errors for `QUnit.throws` in older Firefoxes
|
||||
document.write(platform.name == 'Firefox' && /^1\b/.test(platform.version)
|
||||
? '<script src="../vendor/qunit/qunit/qunit-1.8.0.js"><\/script>'
|
||||
: '<script src="../vendor/qunit/qunit/qunit.js"><\/script>'
|
||||
);
|
||||
</script>
|
||||
<script src="test-ui.js"></script>
|
||||
<div id="qunit"></div>
|
||||
<div id="exports"></div>
|
||||
<script>
|
||||
// set a bad shim
|
||||
Object._keys = Object.keys;
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
cd "$(dirname "$0")"
|
||||
for cmd in rhino ringo narwhal node; do
|
||||
echo ""
|
||||
|
||||
for cmd in rhino "rhino -require" narwhal ringo phantomjs; do
|
||||
echo "Testing in $cmd..."
|
||||
$cmd test.js
|
||||
$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
|
||||
|
||||
echo ""
|
||||
echo "Testing build..."
|
||||
node test-build.js
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
<ul>
|
||||
<% _.forEach(people, function(name) { %><li><%= name %></li><% }); %>
|
||||
<% _.forEach(people, function(name) { %><li><%- name %></li><% }); %>
|
||||
</ul>
|
||||
1125
test/test-build.js
@@ -18,8 +18,10 @@
|
||||
// expose Lo-Dash build file path
|
||||
ui.buildPath = (function() {
|
||||
switch (build) {
|
||||
case 'lodash-prod': return 'lodash.min.js';
|
||||
case 'lodash-underscore': return 'lodash.underscore.min.js';
|
||||
case 'lodash-prod': return 'dist/lodash.compat.min.js';
|
||||
case 'lodash-underscore': return 'dist/lodash.underscore.min.js';
|
||||
case 'lodash-modern': return 'dist/lodash.min.js';
|
||||
case 'lodash-modern-debug': return 'dist/lodash.js';
|
||||
case 'lodash-custom': return 'lodash.custom.min.js';
|
||||
case 'lodash-custom-debug': return 'lodash.custom.js';
|
||||
}
|
||||
@@ -58,8 +60,10 @@
|
||||
switch (build) {
|
||||
case 'lodash-prod': return 1;
|
||||
case 'lodash-underscore': return 2;
|
||||
case 'lodash-custom': return 3;
|
||||
case 'lodash-custom-debug': return 4;
|
||||
case 'lodash-modern': return 3;
|
||||
case 'lodash-modern-debug': return 4;
|
||||
case 'lodash-custom': return 5;
|
||||
case 'lodash-custom-debug': return 6;
|
||||
}
|
||||
return 0;
|
||||
}());
|
||||
@@ -86,6 +90,8 @@
|
||||
'<option value="lodash-dev">Developement</option>' +
|
||||
'<option value="lodash-prod">Production</option>' +
|
||||
'<option value="lodash-underscore">Underscore</option>' +
|
||||
'<option value="lodash-modern">Modern</option>' +
|
||||
'<option value="lodash-modern-debug">Modern (debug)</option>' +
|
||||
'<option value="lodash-custom">Custom</option>' +
|
||||
'<option value="lodash-custom-debug">Custom (debug)</option>' +
|
||||
'</select>';
|
||||
|
||||
1768
test/test.js
@@ -21,13 +21,7 @@
|
||||
</div>
|
||||
<script src="../vendor/jquery/jquery.js"></script>
|
||||
<script src="../vendor/platform.js/platform.js"></script>
|
||||
<script>
|
||||
// avoid syntax errors for `QUnit.throws` in older Firefoxes
|
||||
document.write(platform.name == 'Firefox' && /^1\b/.test(platform.version)
|
||||
? '<script src="../vendor/qunit/qunit/qunit-1.8.0.js"><\/script>'
|
||||
: '<script src="../vendor/qunit/qunit/qunit.js"><\/script>'
|
||||
);
|
||||
</script>
|
||||
<script src="../vendor/qunit/qunit/qunit.js"></script>
|
||||
<script src="test-ui.js"></script>
|
||||
<script>
|
||||
document.write('<script src="../' + ui.buildPath + '"><\/script>');
|
||||
@@ -62,6 +56,10 @@
|
||||
|
||||
_.mixin(_);
|
||||
|
||||
_.mixin({
|
||||
'findWhere': _.find
|
||||
});
|
||||
|
||||
_.chain = function(value) {
|
||||
value = new _(value);
|
||||
value.__chain__ = true;
|
||||
|
||||
4
vendor/backbone/LICENSE
vendored
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 2010-2012 Jeremy Ashkenas, DocumentCloud
|
||||
Copyright (c) 2010-2013 Jeremy Ashkenas, DocumentCloud
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
@@ -19,4 +19,4 @@ 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.
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
1350
vendor/backbone/backbone.js
vendored
299
vendor/backbone/test/collection.js
vendored
@@ -62,22 +62,29 @@ $(document).ready(function() {
|
||||
strictEqual(collection.last().get('a'), 4);
|
||||
});
|
||||
|
||||
test("get", 3, function() {
|
||||
test("get", 6, function() {
|
||||
equal(col.get(0), d);
|
||||
equal(col.get(d.clone()), d);
|
||||
equal(col.get(2), b);
|
||||
equal(col.get({id: 1}), c);
|
||||
equal(col.get(c.clone()), c);
|
||||
equal(col.get(col.first().cid), col.first());
|
||||
});
|
||||
|
||||
test("get with non-default ids", 2, function() {
|
||||
test("get with non-default ids", 5, function() {
|
||||
var col = new Backbone.Collection();
|
||||
var MongoModel = Backbone.Model.extend({
|
||||
idAttribute: '_id'
|
||||
});
|
||||
var MongoModel = Backbone.Model.extend({idAttribute: '_id'});
|
||||
var model = new MongoModel({_id: 100});
|
||||
col.push(model);
|
||||
col.add(model);
|
||||
equal(col.get(100), model);
|
||||
model.set({_id: 101});
|
||||
equal(col.get(101), model);
|
||||
equal(col.get(model.cid), model);
|
||||
equal(col.get(model), model);
|
||||
equal(col.get(101), void 0);
|
||||
|
||||
var col2 = new Backbone.Collection();
|
||||
col2.model = MongoModel;
|
||||
col2.add(model.attributes);
|
||||
equal(col2.get(model.clone()), col2.first());
|
||||
});
|
||||
|
||||
test("update index when id changes", 3, function() {
|
||||
@@ -218,6 +225,19 @@ $(document).ready(function() {
|
||||
equal(col.at(0).get('value'), 2);
|
||||
});
|
||||
|
||||
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.add({id: 1});
|
||||
collection.add({model: {id: 1, name: 'Alf'}}, {parse: true, merge: true});
|
||||
equal(collection.first().get('name'), 'Alf');
|
||||
});
|
||||
|
||||
test("add model to collection with sort()-style comparator", 3, function() {
|
||||
var col = new Backbone.Collection;
|
||||
col.comparator = function(a, b) {
|
||||
@@ -354,7 +374,7 @@ $(document).ready(function() {
|
||||
|
||||
test("model destroy removes from all collections", 3, function() {
|
||||
var e = new Backbone.Model({id: 5, title: 'Othello'});
|
||||
e.sync = function(method, model, options) { options.success({}); };
|
||||
e.sync = function(method, model, options) { options.success(); };
|
||||
var colE = new Backbone.Collection([e]);
|
||||
var colF = new Backbone.Collection([e]);
|
||||
e.destroy();
|
||||
@@ -386,6 +406,15 @@ $(document).ready(function() {
|
||||
equal(this.syncArgs.options.parse, false);
|
||||
});
|
||||
|
||||
test("fetch with an error response triggers an error event", 1, function () {
|
||||
var collection = new Backbone.Collection();
|
||||
collection.on('error', function () {
|
||||
ok(true);
|
||||
});
|
||||
collection.sync = function (method, model, options) { options.error(); };
|
||||
collection.fetch();
|
||||
});
|
||||
|
||||
test("ensure fetch only parses once", 1, function() {
|
||||
var collection = new Backbone.Collection;
|
||||
var counter = 0;
|
||||
@@ -395,7 +424,7 @@ $(document).ready(function() {
|
||||
};
|
||||
collection.url = '/test';
|
||||
collection.fetch();
|
||||
this.syncArgs.options.success([]);
|
||||
this.syncArgs.options.success();
|
||||
equal(counter, 1);
|
||||
});
|
||||
|
||||
@@ -409,7 +438,7 @@ $(document).ready(function() {
|
||||
equal(model.collection, collection);
|
||||
});
|
||||
|
||||
test("create enforces validation", 1, function() {
|
||||
test("create with validate:true enforces validation", 2, function() {
|
||||
var ValidatingModel = Backbone.Model.extend({
|
||||
validate: function(attrs) {
|
||||
return "fail";
|
||||
@@ -419,10 +448,13 @@ $(document).ready(function() {
|
||||
model: ValidatingModel
|
||||
});
|
||||
var col = new ValidatingCollection();
|
||||
equal(col.create({"foo":"bar"}), false);
|
||||
col.on('invalid', function (collection, attrs, options) {
|
||||
equal(options.validationError, 'fail');
|
||||
});
|
||||
equal(col.create({"foo":"bar"}, {validate:true}), false);
|
||||
});
|
||||
|
||||
test("a failing create runs the error callback", 1, function() {
|
||||
test("a failing create returns model with errors", function() {
|
||||
var ValidatingModel = Backbone.Model.extend({
|
||||
validate: function(attrs) {
|
||||
return "fail";
|
||||
@@ -431,11 +463,10 @@ $(document).ready(function() {
|
||||
var ValidatingCollection = Backbone.Collection.extend({
|
||||
model: ValidatingModel
|
||||
});
|
||||
var flag = false;
|
||||
var callback = function(model, error) { flag = true; };
|
||||
var col = new ValidatingCollection();
|
||||
col.create({"foo":"bar"}, { error: callback });
|
||||
equal(flag, true);
|
||||
var m = col.create({"foo":"bar"});
|
||||
equal(m.validationError, 'fail');
|
||||
equal(col.length, 1);
|
||||
});
|
||||
|
||||
test("initialize", 1, function() {
|
||||
@@ -452,9 +483,10 @@ $(document).ready(function() {
|
||||
equal(JSON.stringify(col), '[{"id":3,"label":"a"},{"id":2,"label":"b"},{"id":1,"label":"c"},{"id":0,"label":"d"}]');
|
||||
});
|
||||
|
||||
test("where", 6, function() {
|
||||
test("where and findWhere", 8, function() {
|
||||
var model = new Backbone.Model({a: 1});
|
||||
var coll = new Backbone.Collection([
|
||||
{a: 1},
|
||||
model,
|
||||
{a: 1},
|
||||
{a: 1, b: 2},
|
||||
{a: 2, b: 2},
|
||||
@@ -466,6 +498,8 @@ $(document).ready(function() {
|
||||
equal(coll.where({b: 1}).length, 0);
|
||||
equal(coll.where({b: 2}).length, 2);
|
||||
equal(coll.where({a: 1, b: 2}).length, 1);
|
||||
equal(coll.findWhere({a: 1}), model);
|
||||
equal(coll.findWhere({a: 4}), void 0);
|
||||
});
|
||||
|
||||
test("Underscore methods", 13, function() {
|
||||
@@ -475,10 +509,10 @@ $(document).ready(function() {
|
||||
equal(col.indexOf(b), 1);
|
||||
equal(col.size(), 4);
|
||||
equal(col.rest().length, 3);
|
||||
ok(!_.include(col.rest()), a);
|
||||
ok(!_.include(col.rest()), d);
|
||||
ok(!_.include(col.rest(), a));
|
||||
ok(_.include(col.rest(), d));
|
||||
ok(!col.isEmpty());
|
||||
ok(!_.include(col.without(d)), d);
|
||||
ok(!_.include(col.without(d), d));
|
||||
equal(col.max(function(model){ return model.id; }).id, 3);
|
||||
equal(col.min(function(model){ return model.id; }).id, 0);
|
||||
deepEqual(col.chain()
|
||||
@@ -488,7 +522,19 @@ $(document).ready(function() {
|
||||
[4, 0]);
|
||||
});
|
||||
|
||||
test("reset", 10, function() {
|
||||
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() {
|
||||
var resetCount = 0;
|
||||
var models = col.models;
|
||||
col.on('reset', function() { resetCount += 1; });
|
||||
@@ -505,6 +551,22 @@ $(document).ready(function() {
|
||||
equal(col.length, 4);
|
||||
ok(col.last() !== d);
|
||||
ok(_.isEqual(col.last().attributes, d.attributes));
|
||||
col.reset();
|
||||
equal(col.length, 0);
|
||||
equal(resetCount, 4);
|
||||
});
|
||||
|
||||
test ("reset with different values", function(){
|
||||
var col = new Backbone.Collection({id: 1});
|
||||
col.reset({id: 1, a: 1});
|
||||
equal(col.get(1).get('a'), 1);
|
||||
});
|
||||
|
||||
test("same references in reset", function() {
|
||||
var model = new Backbone.Model({id: 1});
|
||||
var collection = new Backbone.Collection({id: 1});
|
||||
collection.reset(model);
|
||||
equal(collection.get(1), model);
|
||||
});
|
||||
|
||||
test("reset passes caller options", 3, function() {
|
||||
@@ -559,7 +621,7 @@ $(document).ready(function() {
|
||||
equal(col.length, 0);
|
||||
});
|
||||
|
||||
test("#861, adding models to a collection which do not pass validation", function() {
|
||||
test("#861, adding models to a collection which do not pass validation, with validate:true", function() {
|
||||
var Model = Backbone.Model.extend({
|
||||
validate: function(attrs) {
|
||||
if (attrs.id == 3) return "id can't be 3";
|
||||
@@ -573,18 +635,18 @@ $(document).ready(function() {
|
||||
var collection = new Collection;
|
||||
collection.on("error", function() { ok(true); });
|
||||
|
||||
collection.add([{id: 1}, {id: 2}, {id: 3}, {id: 4}, {id: 5}, {id: 6}]);
|
||||
collection.add([{id: 1}, {id: 2}, {id: 3}, {id: 4}, {id: 5}, {id: 6}], {validate:true});
|
||||
deepEqual(collection.pluck('id'), [1, 2, 4, 5, 6]);
|
||||
});
|
||||
|
||||
test("Invalid models are discarded.", 5, function() {
|
||||
test("Invalid models are discarded with validate:true.", 5, function() {
|
||||
var collection = new Backbone.Collection;
|
||||
collection.on('test', function() { ok(true); });
|
||||
collection.model = Backbone.Model.extend({
|
||||
validate: function(attrs){ if (!attrs.valid) return 'invalid'; }
|
||||
});
|
||||
var model = new collection.model({id: 1, valid: true});
|
||||
collection.add([model, {id: 2}]);
|
||||
collection.add([model, {id: 2}], {validate:true});
|
||||
model.trigger('test');
|
||||
ok(collection.get(model.cid));
|
||||
ok(collection.get(1));
|
||||
@@ -648,19 +710,34 @@ $(document).ready(function() {
|
||||
}
|
||||
};
|
||||
col.sync = m.sync = function( method, collection, options ){
|
||||
options.success();
|
||||
options.success(collection, [], options);
|
||||
};
|
||||
col.fetch(opts);
|
||||
col.create(m, opts);
|
||||
});
|
||||
|
||||
test("#1412 - Trigger 'sync' event.", 2, function() {
|
||||
test("#1412 - Trigger 'request' and 'sync' events.", 4, function() {
|
||||
var collection = new Backbone.Collection;
|
||||
collection.url = '/test';
|
||||
collection.on('sync', function() { ok(true); });
|
||||
Backbone.ajax = function(settings){ settings.success(); };
|
||||
|
||||
collection.on('request', function(obj, xhr, options) {
|
||||
ok(obj === collection, "collection has correct 'request' event after fetching");
|
||||
});
|
||||
collection.on('sync', function(obj, response, options) {
|
||||
ok(obj === collection, "collection has correct 'sync' event after fetching");
|
||||
});
|
||||
collection.fetch();
|
||||
collection.off();
|
||||
|
||||
collection.on('request', function(obj, xhr, options) {
|
||||
ok(obj === collection.get(1), "collection has correct 'request' event after one of its models save");
|
||||
});
|
||||
collection.on('sync', function(obj, response, options) {
|
||||
ok(obj === collection.get(1), "collection has correct 'sync' event after one of its models save");
|
||||
});
|
||||
collection.create({id: 1});
|
||||
collection.off();
|
||||
});
|
||||
|
||||
test("#1447 - create with wait adds model.", 1, function() {
|
||||
@@ -796,7 +873,7 @@ $(document).ready(function() {
|
||||
collection.reset([]);
|
||||
});
|
||||
|
||||
test("update", function() {
|
||||
test("set", function() {
|
||||
var m1 = new Backbone.Model();
|
||||
var m2 = new Backbone.Model({id: 2});
|
||||
var m3 = new Backbone.Model();
|
||||
@@ -814,24 +891,24 @@ $(document).ready(function() {
|
||||
});
|
||||
|
||||
// remove: false doesn't remove any models
|
||||
c.update([], {remove: false});
|
||||
c.set([], {remove: false});
|
||||
strictEqual(c.length, 2);
|
||||
|
||||
// add: false doesn't add any models
|
||||
c.update([m1, m2, m3], {add: false});
|
||||
c.set([m1, m2, m3], {add: false});
|
||||
strictEqual(c.length, 2);
|
||||
|
||||
// merge: false doesn't change any models
|
||||
c.update([m1, {id: 2, a: 1}], {merge: false});
|
||||
c.set([m1, {id: 2, a: 1}], {merge: false});
|
||||
strictEqual(m2.get('a'), void 0);
|
||||
|
||||
// add: false, remove: false only merges existing models
|
||||
c.update([m1, {id: 2, a: 0}, m3, {id: 4}], {add: false, remove: false});
|
||||
c.set([m1, {id: 2, a: 0}, m3, {id: 4}], {add: false, remove: false});
|
||||
strictEqual(c.length, 2);
|
||||
strictEqual(m2.get('a'), 0);
|
||||
|
||||
// default options add/remove/merge as appropriate
|
||||
c.update([{id: 2, a: 1}, m3]);
|
||||
c.set([{id: 2, a: 1}, m3]);
|
||||
strictEqual(c.length, 2);
|
||||
strictEqual(m2.get('a'), 1);
|
||||
|
||||
@@ -839,23 +916,23 @@ $(document).ready(function() {
|
||||
c.off('remove').on('remove', function(model) {
|
||||
ok(model === m2 || model === m3);
|
||||
});
|
||||
c.update([]);
|
||||
c.set([]);
|
||||
strictEqual(c.length, 0);
|
||||
});
|
||||
|
||||
test("update with only cids", 3, function() {
|
||||
test("set with only cids", 3, function() {
|
||||
var m1 = new Backbone.Model;
|
||||
var m2 = new Backbone.Model;
|
||||
var c = new Backbone.Collection;
|
||||
c.update([m1, m2]);
|
||||
c.set([m1, m2]);
|
||||
equal(c.length, 2);
|
||||
c.update([m1]);
|
||||
c.set([m1]);
|
||||
equal(c.length, 1);
|
||||
c.update([m1, m1, m1, m2, m2], {remove: false});
|
||||
c.set([m1, m1, m1, m2, m2], {remove: false});
|
||||
equal(c.length, 2);
|
||||
});
|
||||
|
||||
test("update with only idAttribute", 3, function() {
|
||||
test("set with only idAttribute", 3, function() {
|
||||
var m1 = { _id: 1 };
|
||||
var m2 = { _id: 2 };
|
||||
var col = Backbone.Collection.extend({
|
||||
@@ -864,14 +941,61 @@ $(document).ready(function() {
|
||||
})
|
||||
});
|
||||
var c = new col;
|
||||
c.update([m1, m2]);
|
||||
c.set([m1, m2]);
|
||||
equal(c.length, 2);
|
||||
c.update([m1]);
|
||||
c.set([m1]);
|
||||
equal(c.length, 1);
|
||||
c.update([m1, m1, m1, m2, m2], {remove: false});
|
||||
c.set([m1, m1, m1, m2, m2], {remove: false});
|
||||
equal(c.length, 2);
|
||||
});
|
||||
|
||||
test("set + merge with default values defined", function() {
|
||||
var Model = Backbone.Model.extend({
|
||||
defaults: {
|
||||
key: 'value'
|
||||
}
|
||||
});
|
||||
var m = new Model({id: 1});
|
||||
var col = new Backbone.Collection([m], {model: Model});
|
||||
equal(col.first().get('key'), 'value');
|
||||
|
||||
col.set({id: 1, key: 'other'});
|
||||
equal(col.first().get('key'), 'other');
|
||||
|
||||
col.set({id: 1, other: 'value'});
|
||||
equal(col.first().get('key'), 'value');
|
||||
equal(col.length, 1);
|
||||
});
|
||||
|
||||
test("`set` and model level `parse`", function() {
|
||||
var Model = Backbone.Model.extend({
|
||||
parse: function (res) { return res.model; }
|
||||
});
|
||||
var Collection = Backbone.Collection.extend({
|
||||
model: Model,
|
||||
parse: function (res) { return res.models; }
|
||||
});
|
||||
var model = new Model({id: 1});
|
||||
var collection = new Collection(model);
|
||||
collection.set({models: [
|
||||
{model: {id: 1}},
|
||||
{model: {id: 2}}
|
||||
]}, {parse: true});
|
||||
equal(collection.first(), model);
|
||||
});
|
||||
|
||||
test("`set` data is only parsed once", function() {
|
||||
var collection = new Backbone.Collection();
|
||||
collection.model = Backbone.Model.extend({
|
||||
parse: function (data) {
|
||||
equal(data.parsed, void 0);
|
||||
data.parsed = true;
|
||||
return data;
|
||||
}
|
||||
});
|
||||
collection.set({}, {parse: true});
|
||||
});
|
||||
|
||||
test("#1894 - Push should not trigger a sort", 0, function() {
|
||||
var Collection = Backbone.Collection.extend({
|
||||
comparator: 'id',
|
||||
@@ -882,14 +1006,14 @@ $(document).ready(function() {
|
||||
new Collection().push({id: 1});
|
||||
});
|
||||
|
||||
// test("`update` with non-normal id", function() {
|
||||
// var Collection = Backbone.Collection.extend({
|
||||
// model: Backbone.Model.extend({idAttribute: '_id'})
|
||||
// });
|
||||
// var collection = new Collection({_id: 1});
|
||||
// collection.update([{_id: 1, a: 1}], {add: false});
|
||||
// equal(collection.first().get('a'), 1);
|
||||
// });
|
||||
test("`set` with non-normal id", function() {
|
||||
var Collection = Backbone.Collection.extend({
|
||||
model: Backbone.Model.extend({idAttribute: '_id'})
|
||||
});
|
||||
var collection = new Collection({_id: 1});
|
||||
collection.set([{_id: 1, a: 1}], {add: false});
|
||||
equal(collection.first().get('a'), 1);
|
||||
});
|
||||
|
||||
test("#1894 - `sort` can optionally be turned off", 0, function() {
|
||||
var Collection = Backbone.Collection.extend({
|
||||
@@ -899,15 +1023,78 @@ $(document).ready(function() {
|
||||
new Collection().add({id: 1}, {sort: false});
|
||||
});
|
||||
|
||||
test("#1915 - `parse` data in the right order in `update`", function() {
|
||||
test("#1915 - `parse` data in the right order in `set`", function() {
|
||||
var collection = new (Backbone.Collection.extend({
|
||||
parse: function (data) {
|
||||
strictEqual(data.status, 'ok');
|
||||
return data.data;
|
||||
}
|
||||
}));
|
||||
var res = {status: 'ok', data:[{id: 1}]}
|
||||
collection.update(res, {parse: true});
|
||||
var res = {status: 'ok', data:[{id: 1}]};
|
||||
collection.set(res, {parse: true});
|
||||
});
|
||||
|
||||
asyncTest("#1939 - `parse` is passed `options`", 1, function () {
|
||||
var collection = new (Backbone.Collection.extend({
|
||||
url: '/',
|
||||
parse: function (data, options) {
|
||||
strictEqual(options.xhr.someHeader, 'headerValue');
|
||||
return data;
|
||||
}
|
||||
}));
|
||||
var ajax = Backbone.ajax;
|
||||
Backbone.ajax = function (params) {
|
||||
_.defer(params.success);
|
||||
return {someHeader: 'headerValue'};
|
||||
};
|
||||
collection.fetch({
|
||||
success: function () { start(); }
|
||||
});
|
||||
Backbone.ajax = ajax;
|
||||
});
|
||||
|
||||
test("`add` only `sort`s when necessary", 2, function () {
|
||||
var collection = new (Backbone.Collection.extend({
|
||||
comparator: 'a'
|
||||
}))([{id: 1}, {id: 2}, {id: 3}]);
|
||||
collection.on('sort', function () { ok(true); });
|
||||
collection.add({id: 4}); // do sort, new model
|
||||
collection.add({id: 1, a: 1}, {merge: true}); // do sort, comparator change
|
||||
collection.add({id: 1, b: 1}, {merge: true}); // don't sort, no comparator change
|
||||
collection.add({id: 1, a: 1}, {merge: true}); // don't sort, no comparator change
|
||||
collection.add(collection.models); // don't sort, nothing new
|
||||
collection.add(collection.models, {merge: true}); // don't sort
|
||||
});
|
||||
|
||||
test("`add` only `sort`s when necessary with comparator function", 3, function () {
|
||||
var collection = new (Backbone.Collection.extend({
|
||||
comparator: function(a, b) {
|
||||
return a.get('a') > b.get('a') ? 1 : (a.get('a') < b.get('a') ? -1 : 0);
|
||||
}
|
||||
}))([{id: 1}, {id: 2}, {id: 3}]);
|
||||
collection.on('sort', function () { ok(true); });
|
||||
collection.add({id: 4}); // do sort, new model
|
||||
collection.add({id: 1, a: 1}, {merge: true}); // do sort, model change
|
||||
collection.add({id: 1, b: 1}, {merge: true}); // do sort, model change
|
||||
collection.add({id: 1, a: 1}, {merge: true}); // don't sort, no model change
|
||||
collection.add(collection.models); // don't sort, nothing new
|
||||
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(){};
|
||||
|
||||
var collection = new Backbone.Collection([], {
|
||||
url: url,
|
||||
model: model,
|
||||
comparator: comparator
|
||||
});
|
||||
|
||||
strictEqual(collection.url, url);
|
||||
ok(collection.model === model);
|
||||
ok(collection.comparator === comparator);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
113
vendor/backbone/test/events.js
vendored
@@ -76,6 +76,58 @@ $(document).ready(function() {
|
||||
b.trigger('anything');
|
||||
});
|
||||
|
||||
test("listenTo and stopListening with event maps", 4, function() {
|
||||
var a = _.extend({}, Backbone.Events);
|
||||
var b = _.extend({}, Backbone.Events);
|
||||
var cb = function(){ ok(true); };
|
||||
a.listenTo(b, {event: cb});
|
||||
b.trigger('event');
|
||||
a.listenTo(b, {event2: cb});
|
||||
b.on('event2', cb);
|
||||
a.stopListening(b, {event2: cb});
|
||||
b.trigger('event event2');
|
||||
a.stopListening();
|
||||
b.trigger('event event2');
|
||||
});
|
||||
|
||||
test("stopListening with omitted args", 2, function () {
|
||||
var a = _.extend({}, Backbone.Events);
|
||||
var b = _.extend({}, Backbone.Events);
|
||||
var cb = function () { ok(true); };
|
||||
a.listenTo(b, 'event', cb);
|
||||
b.on('event', cb);
|
||||
a.listenTo(b, 'event2', cb);
|
||||
a.stopListening(null, {event: cb});
|
||||
b.trigger('event event2');
|
||||
b.off();
|
||||
a.listenTo(b, 'event event2', cb);
|
||||
a.stopListening(null, 'event');
|
||||
a.stopListening();
|
||||
b.trigger('event2');
|
||||
});
|
||||
|
||||
test("listenToOnce and stopListening", 1, function() {
|
||||
var a = _.extend({}, Backbone.Events);
|
||||
var b = _.extend({}, Backbone.Events);
|
||||
a.listenToOnce(b, 'all', function() { ok(true); });
|
||||
b.trigger('anything');
|
||||
b.trigger('anything');
|
||||
a.listenToOnce(b, 'all', function() { ok(false); });
|
||||
a.stopListening();
|
||||
b.trigger('anything');
|
||||
});
|
||||
|
||||
test("listenTo, listenToOnce and stopListening", 1, function() {
|
||||
var a = _.extend({}, Backbone.Events);
|
||||
var b = _.extend({}, Backbone.Events);
|
||||
a.listenToOnce(b, 'all', function() { ok(true); });
|
||||
b.trigger('anything');
|
||||
b.trigger('anything');
|
||||
a.listenTo(b, 'all', function() { ok(false); });
|
||||
a.stopListening();
|
||||
b.trigger('anything');
|
||||
});
|
||||
|
||||
test("listenTo and stopListening with event maps", 1, function() {
|
||||
var a = _.extend({}, Backbone.Events);
|
||||
var b = _.extend({}, Backbone.Events);
|
||||
@@ -86,6 +138,27 @@ $(document).ready(function() {
|
||||
b.trigger('change');
|
||||
});
|
||||
|
||||
test("listenTo yourself", 1, function(){
|
||||
var e = _.extend({}, Backbone.Events);
|
||||
e.listenTo(e, "foo", function(){ ok(true); });
|
||||
e.trigger("foo");
|
||||
});
|
||||
|
||||
test("listenTo yourself cleans yourself up with stopListening", 1, function(){
|
||||
var e = _.extend({}, Backbone.Events);
|
||||
e.listenTo(e, "foo", function(){ ok(true); });
|
||||
e.trigger("foo");
|
||||
e.stopListening();
|
||||
e.trigger("foo");
|
||||
});
|
||||
|
||||
test("listenTo with empty callback doesn't throw an error", 1, function(){
|
||||
var e = _.extend({}, Backbone.Events);
|
||||
e.listenTo(e, "foo", null);
|
||||
e.trigger("foo");
|
||||
ok(true);
|
||||
});
|
||||
|
||||
test("trigger all for each event", 3, function() {
|
||||
var a, b, obj = { counter: 0 };
|
||||
_.extend(obj, Backbone.Events);
|
||||
@@ -205,6 +278,13 @@ $(document).ready(function() {
|
||||
_.extend({}, Backbone.Events).on('test').trigger('test');
|
||||
});
|
||||
|
||||
test("if callback is truthy but not a function, `on` should throw an error just like jQuery", 1, function() {
|
||||
var view = _.extend({}, Backbone.Events).on('test', 'noop');
|
||||
throws(function() {
|
||||
view.trigger('test');
|
||||
});
|
||||
});
|
||||
|
||||
test("remove all events for a specific context", 4, function() {
|
||||
var obj = _.extend({}, Backbone.Events);
|
||||
obj.on('x y all', function() { ok(true); });
|
||||
@@ -223,18 +303,6 @@ $(document).ready(function() {
|
||||
obj.trigger('x y');
|
||||
});
|
||||
|
||||
test("off is chainable", 3, function() {
|
||||
var obj = _.extend({}, Backbone.Events);
|
||||
// With no events
|
||||
ok(obj.off() === obj);
|
||||
// When removing all events
|
||||
obj.on('event', function(){}, obj);
|
||||
ok(obj.off() === obj);
|
||||
// When removing some events
|
||||
obj.on('event', function(){}, obj);
|
||||
ok(obj.off('event') === obj);
|
||||
});
|
||||
|
||||
test("#1310 - off does not skip consecutive events", 0, function() {
|
||||
var obj = _.extend({}, Backbone.Events);
|
||||
obj.on('event', function() { ok(false); }, obj);
|
||||
@@ -360,4 +428,25 @@ $(document).ready(function() {
|
||||
Backbone.trigger('all');
|
||||
});
|
||||
|
||||
test("once without a callback is a noop", 0, function() {
|
||||
_.extend({}, Backbone.Events).once('event').trigger('event');
|
||||
});
|
||||
|
||||
test("event functions are chainable", function() {
|
||||
var obj = _.extend({}, Backbone.Events);
|
||||
var obj2 = _.extend({}, Backbone.Events);
|
||||
var fn = function() {};
|
||||
equal(obj, obj.trigger('noeventssetyet'));
|
||||
equal(obj, obj.off('noeventssetyet'));
|
||||
equal(obj, obj.stopListening('noeventssetyet'));
|
||||
equal(obj, obj.on('a', fn));
|
||||
equal(obj, obj.once('c', fn));
|
||||
equal(obj, obj.trigger('a'));
|
||||
equal(obj, obj.listenTo(obj2, 'a', fn));
|
||||
equal(obj, obj.listenToOnce(obj2, 'b', fn));
|
||||
equal(obj, obj.off('a c'));
|
||||
equal(obj, obj.stopListening(obj2, 'a'));
|
||||
equal(obj, obj.stopListening());
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
338
vendor/backbone/test/model.js
vendored
@@ -46,9 +46,9 @@ $(document).ready(function() {
|
||||
|
||||
test("initialize with parsed attributes", 1, function() {
|
||||
var Model = Backbone.Model.extend({
|
||||
parse: function(obj) {
|
||||
obj.value += 1;
|
||||
return obj;
|
||||
parse: function(attrs) {
|
||||
attrs.value += 1;
|
||||
return attrs;
|
||||
}
|
||||
});
|
||||
var model = new Model({value: 1}, {parse: true});
|
||||
@@ -69,8 +69,8 @@ $(document).ready(function() {
|
||||
|
||||
test("parse can return null", 1, function() {
|
||||
var Model = Backbone.Model.extend({
|
||||
parse: function(obj) {
|
||||
obj.value += 1;
|
||||
parse: function(attrs) {
|
||||
attrs.value += 1;
|
||||
return null;
|
||||
}
|
||||
});
|
||||
@@ -111,6 +111,23 @@ $(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();
|
||||
deepEqual(model.keys(), ['foo', 'bar', 'baz']);
|
||||
deepEqual(model.values(), ['a', 'b', 'c']);
|
||||
deepEqual(model.invert(), { 'a': 'foo', 'b': 'bar', 'c': 'baz' });
|
||||
deepEqual(model.pick('foo', 'baz'), {'foo': 'a', 'baz': 'c'});
|
||||
deepEqual(model.omit('foo', 'bar'), {'baz': 'c'});
|
||||
});
|
||||
|
||||
test("clone", 10, function() {
|
||||
var a = new Backbone.Model({ 'foo': 1, 'bar': 2, 'baz': 3});
|
||||
var b = a.clone();
|
||||
@@ -202,9 +219,9 @@ $(document).ready(function() {
|
||||
ok(changeCount == 1, "Change count should NOT have incremented.");
|
||||
|
||||
a.validate = function(attrs) {
|
||||
equal(attrs.foo, void 0, "don't ignore values when unsetting");
|
||||
equal(attrs.foo, void 0, "validate:true passed while unsetting");
|
||||
};
|
||||
a.unset('foo');
|
||||
a.unset('foo', {validate: true});
|
||||
equal(a.get('foo'), void 0, "Foo should have changed");
|
||||
delete a.validate;
|
||||
ok(changeCount == 2, "Change count should have incremented for unset.");
|
||||
@@ -213,6 +230,24 @@ $(document).ready(function() {
|
||||
equal(a.id, undefined, "Unsetting the id should remove the id property.");
|
||||
});
|
||||
|
||||
test("#2030 - set with failed validate, followed by another set triggers change", function () {
|
||||
var attr = 0, main = 0, error = 0;
|
||||
var Model = Backbone.Model.extend({
|
||||
validate: function (attr) {
|
||||
if (attr.x > 1) {
|
||||
error++;
|
||||
return "this is an error";
|
||||
}
|
||||
}
|
||||
});
|
||||
var model = new Model({x:0});
|
||||
model.on('change:x', function () { attr++; });
|
||||
model.on('change', function () { main++; });
|
||||
model.set({x:2}, {validate:true});
|
||||
model.set({x:1}, {validate:true});
|
||||
deepEqual([attr, main, error], [1, 1, 1]);
|
||||
});
|
||||
|
||||
test("set triggers changes in the correct order", function() {
|
||||
var value = null;
|
||||
var model = new Backbone.Model;
|
||||
@@ -223,15 +258,16 @@ $(document).ready(function() {
|
||||
equal(value, 'last');
|
||||
});
|
||||
|
||||
test("set falsy values in the correct order", 1, function() {
|
||||
test("set falsy values in the correct order", 2, function() {
|
||||
var model = new Backbone.Model({result: 'result'});
|
||||
model.on('change', function() {
|
||||
equal(model.changed.result, false);
|
||||
equal(model.changed.result, void 0);
|
||||
equal(model.previous('result'), false);
|
||||
});
|
||||
model.set({result: void 0}, {silent: true});
|
||||
model.set({result: null}, {silent: true});
|
||||
model.set({result: false}, {silent: true});
|
||||
model.change();
|
||||
model.set({result: void 0});
|
||||
});
|
||||
|
||||
test("multiple unsets", 1, function() {
|
||||
@@ -245,14 +281,12 @@ $(document).ready(function() {
|
||||
equal(i, 2, 'Unset does not fire an event for missing attributes.');
|
||||
});
|
||||
|
||||
test("unset and changedAttributes", 2, function() {
|
||||
test("unset and changedAttributes", 1, function() {
|
||||
var model = new Backbone.Model({a: 1});
|
||||
model.unset('a', {silent: true});
|
||||
var changedAttributes = model.changedAttributes();
|
||||
ok('a' in changedAttributes, 'changedAttributes should contain unset properties');
|
||||
|
||||
changedAttributes = model.changedAttributes();
|
||||
ok('a' in changedAttributes, 'changedAttributes should contain unset properties when running changedAttributes again after an unset.');
|
||||
model.on('change', function() {
|
||||
ok('a' in model.changedAttributes(), 'changedAttributes should contain unset properties');
|
||||
});
|
||||
model.unset('a');
|
||||
});
|
||||
|
||||
test("using a non-default id attribute.", 5, function() {
|
||||
@@ -272,6 +306,21 @@ $(document).ready(function() {
|
||||
equal(model.get('name'), '');
|
||||
});
|
||||
|
||||
test("setting an object", 1, function() {
|
||||
var model = new Backbone.Model({
|
||||
custom: { foo: 1 }
|
||||
});
|
||||
model.on('change', function() {
|
||||
ok(1);
|
||||
});
|
||||
model.set({
|
||||
custom: { foo: 1 } // no change should be fired
|
||||
});
|
||||
model.set({
|
||||
custom: { foo: 2 } // change event should be fired
|
||||
});
|
||||
});
|
||||
|
||||
test("clear", 3, function() {
|
||||
var changed;
|
||||
var model = new Backbone.Model({id: 1, name : "Model"});
|
||||
@@ -292,7 +341,7 @@ $(document).ready(function() {
|
||||
"two": 2
|
||||
}
|
||||
});
|
||||
var model = new Defaulted({two: null});
|
||||
var model = new Defaulted({two: undefined});
|
||||
equal(model.get('one'), 1);
|
||||
equal(model.get('two'), 2);
|
||||
Defaulted = Backbone.Model.extend({
|
||||
@@ -303,14 +352,14 @@ $(document).ready(function() {
|
||||
};
|
||||
}
|
||||
});
|
||||
model = new Defaulted({two: null});
|
||||
model = new Defaulted({two: undefined});
|
||||
equal(model.get('one'), 3);
|
||||
equal(model.get('two'), 4);
|
||||
});
|
||||
|
||||
test("change, hasChanged, changedAttributes, previous, previousAttributes", 12, function() {
|
||||
var model = new Backbone.Model({name : "Tim", age : 10});
|
||||
equal(model.changedAttributes(), false);
|
||||
test("change, hasChanged, changedAttributes, previous, previousAttributes", 9, function() {
|
||||
var model = new Backbone.Model({name: "Tim", age: 10});
|
||||
deepEqual(model.changedAttributes(), false);
|
||||
model.on('change', function() {
|
||||
ok(model.hasChanged('name'), 'name changed');
|
||||
ok(!model.hasChanged('age'), 'age did not');
|
||||
@@ -320,17 +369,13 @@ $(document).ready(function() {
|
||||
});
|
||||
equal(model.hasChanged(), false);
|
||||
equal(model.hasChanged(undefined), false);
|
||||
model.set({name : 'Rob'}, {silent : true});
|
||||
equal(model.hasChanged(), true);
|
||||
equal(model.hasChanged(undefined), true);
|
||||
equal(model.hasChanged('name'), true);
|
||||
model.change();
|
||||
model.set({name : 'Rob'});
|
||||
equal(model.get('name'), 'Rob');
|
||||
});
|
||||
|
||||
test("changedAttributes", 3, function() {
|
||||
var model = new Backbone.Model({a: 'a', b: 'b'});
|
||||
equal(model.changedAttributes(), false);
|
||||
deepEqual(model.changedAttributes(), false);
|
||||
equal(model.changedAttributes({a: 'a'}), false);
|
||||
equal(model.changedAttributes({a: 'b'}).a, 'b');
|
||||
});
|
||||
@@ -341,8 +386,7 @@ $(document).ready(function() {
|
||||
model.on('change', function(model, options) {
|
||||
value = options.prefix + model.get('name');
|
||||
});
|
||||
model.set({name: 'Bob'}, {silent: true});
|
||||
model.change({prefix: 'Mr. '});
|
||||
model.set({name: 'Bob'}, {prefix: 'Mr. '});
|
||||
equal(value, 'Mr. Bob');
|
||||
model.set({name: 'Sue'}, {prefix: 'Ms. '});
|
||||
equal(value, 'Ms. Sue');
|
||||
@@ -368,7 +412,7 @@ $(document).ready(function() {
|
||||
model.set({lastName: 'Hicks'});
|
||||
});
|
||||
|
||||
test("validate after save", 1, function() {
|
||||
test("validate after save", 2, function() {
|
||||
var lastError, model = new Backbone.Model();
|
||||
model.validate = function(attrs) {
|
||||
if (attrs.admin) return "Can't change admin status.";
|
||||
@@ -376,11 +420,13 @@ $(document).ready(function() {
|
||||
model.sync = function(method, model, options) {
|
||||
options.success.call(this, {admin: true});
|
||||
};
|
||||
model.save(null, {error: function(model, error) {
|
||||
model.on('invalid', function(model, error) {
|
||||
lastError = error;
|
||||
}});
|
||||
});
|
||||
model.save(null);
|
||||
|
||||
equal(lastError, "Can't change admin status.");
|
||||
equal(model.validationError, "Can't change admin status.");
|
||||
});
|
||||
|
||||
test("save", 2, function() {
|
||||
@@ -389,6 +435,19 @@ $(document).ready(function() {
|
||||
ok(_.isEqual(this.syncArgs.model, doc));
|
||||
});
|
||||
|
||||
test("save, fetch, destroy triggers error event when an error occurs", 3, function () {
|
||||
var model = new Backbone.Model();
|
||||
model.on('error', function () {
|
||||
ok(true);
|
||||
});
|
||||
model.sync = function (method, model, options) {
|
||||
options.error();
|
||||
};
|
||||
model.save({data: 2, id: 1});
|
||||
model.fetch();
|
||||
model.destroy();
|
||||
});
|
||||
|
||||
test("save with PATCH", function() {
|
||||
doc.clear().set({id: 1, a: 1, b: 2, c: 3, d: 4});
|
||||
doc.save();
|
||||
@@ -412,7 +471,18 @@ $(document).ready(function() {
|
||||
equal(model.get('title'), 'Twelfth Night');
|
||||
});
|
||||
|
||||
|
||||
test("save with non-object success response", 2, function () {
|
||||
var model = new Backbone.Model();
|
||||
model.sync = function(method, model, options) {
|
||||
options.success('', options);
|
||||
options.success(null, options);
|
||||
};
|
||||
model.save({testing:'empty'}, {
|
||||
success: function (model) {
|
||||
deepEqual(model.attributes, {testing:'empty'});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
test("fetch", 2, function() {
|
||||
doc.fetch();
|
||||
@@ -442,14 +512,16 @@ $(document).ready(function() {
|
||||
model.validate = function(attrs) {
|
||||
if (attrs.admin != this.get('admin')) return "Can't change admin status.";
|
||||
};
|
||||
model.on('error', function(model, error) {
|
||||
model.on('invalid', function(model, error) {
|
||||
lastError = error;
|
||||
});
|
||||
var result = model.set({a: 100});
|
||||
equal(result, model);
|
||||
equal(model.get('a'), 100);
|
||||
equal(lastError, undefined);
|
||||
result = model.set({a: 200, admin: false});
|
||||
result = model.set({admin: true});
|
||||
equal(model.get('admin'), true);
|
||||
result = model.set({a: 200, admin: false}, {validate:true});
|
||||
equal(lastError, "Can't change admin status.");
|
||||
equal(result, false);
|
||||
equal(model.get('a'), 100);
|
||||
@@ -467,10 +539,10 @@ $(document).ready(function() {
|
||||
model.set({name: "Two"});
|
||||
equal(model.get('name'), 'Two');
|
||||
equal(error, undefined);
|
||||
model.unset('name');
|
||||
model.unset('name', {validate: true});
|
||||
equal(error, true);
|
||||
equal(model.get('name'), 'Two');
|
||||
model.clear();
|
||||
model.clear({validate:true});
|
||||
equal(model.get('name'), 'Two');
|
||||
delete model.validate;
|
||||
model.clear();
|
||||
@@ -483,21 +555,18 @@ $(document).ready(function() {
|
||||
model.validate = function(attrs) {
|
||||
if (attrs.admin) return "Can't change admin status.";
|
||||
};
|
||||
var callback = function(model, error) {
|
||||
lastError = error;
|
||||
};
|
||||
model.on('error', function(model, error) {
|
||||
model.on('invalid', function(model, error) {
|
||||
boundError = true;
|
||||
});
|
||||
var result = model.set({a: 100}, {error: callback});
|
||||
var result = model.set({a: 100}, {validate:true});
|
||||
equal(result, model);
|
||||
equal(model.get('a'), 100);
|
||||
equal(lastError, undefined);
|
||||
equal(model.validationError, null);
|
||||
equal(boundError, undefined);
|
||||
result = model.set({a: 200, admin: true}, {error: callback});
|
||||
result = model.set({a: 200, admin: true}, {validate:true});
|
||||
equal(result, false);
|
||||
equal(model.get('a'), 100);
|
||||
equal(lastError, "Can't change admin status.");
|
||||
equal(model.validationError, "Can't change admin status.");
|
||||
equal(boundError, true);
|
||||
});
|
||||
|
||||
@@ -592,6 +661,13 @@ $(document).ready(function() {
|
||||
ok(model.get('x') === a);
|
||||
});
|
||||
|
||||
test("set same value does not trigger change", 0, function() {
|
||||
var model = new Backbone.Model({x: 1});
|
||||
model.on('change change:x', function() { ok(false); });
|
||||
model.set({x: 1});
|
||||
model.set({x: 1});
|
||||
});
|
||||
|
||||
test("unset does not fire a change for undefined attributes", 0, function() {
|
||||
var model = new Backbone.Model({x: undefined});
|
||||
model.on('change:x', function(){ ok(false); });
|
||||
@@ -603,19 +679,29 @@ $(document).ready(function() {
|
||||
ok('x' in model.attributes);
|
||||
});
|
||||
|
||||
test("change fires change:attr", 1, function() {
|
||||
test("hasChanged works outside of change events, and true within", 6, function() {
|
||||
var model = new Backbone.Model({x: 1});
|
||||
model.set({x: 2}, {silent: true});
|
||||
model.on('change:x', function(){ ok(true); });
|
||||
model.change();
|
||||
});
|
||||
|
||||
test("hasChanged is false after original values are set", 2, function() {
|
||||
var model = new Backbone.Model({x: 1});
|
||||
model.on('change:x', function(){ ok(false); });
|
||||
model.on('change:x', function() {
|
||||
ok(model.hasChanged('x'));
|
||||
equal(model.get('x'), 1);
|
||||
});
|
||||
model.set({x: 2}, {silent: true});
|
||||
ok(model.hasChanged());
|
||||
model.set({x: 1}, {silent: true});
|
||||
equal(model.hasChanged('x'), true);
|
||||
model.set({x: 1});
|
||||
ok(model.hasChanged());
|
||||
equal(model.hasChanged('x'), true);
|
||||
});
|
||||
|
||||
test("hasChanged gets cleared on the following set", 4, function() {
|
||||
var model = new Backbone.Model;
|
||||
model.set({x: 1});
|
||||
ok(model.hasChanged());
|
||||
model.set({x: 1});
|
||||
ok(!model.hasChanged());
|
||||
model.set({x: 2});
|
||||
ok(model.hasChanged());
|
||||
model.set({});
|
||||
ok(!model.hasChanged());
|
||||
});
|
||||
|
||||
@@ -678,6 +764,13 @@ $(document).ready(function() {
|
||||
model.save({x: 1}, {wait: true});
|
||||
});
|
||||
|
||||
test("save turns on parse flag", function () {
|
||||
var Model = Backbone.Model.extend({
|
||||
sync: function(method, model, options) { ok(options.parse); }
|
||||
});
|
||||
new Model().save();
|
||||
});
|
||||
|
||||
test("nested `set` during `'change:attr'`", 2, function() {
|
||||
var events = [];
|
||||
var model = new Backbone.Model();
|
||||
@@ -691,25 +784,19 @@ $(document).ready(function() {
|
||||
model.set({x: true});
|
||||
deepEqual(events, ['change:y', 'change:x', 'change']);
|
||||
events = [];
|
||||
model.change();
|
||||
deepEqual(events, ['change:z', 'change']);
|
||||
model.set({z: true});
|
||||
deepEqual(events, []);
|
||||
});
|
||||
|
||||
test("nested `change` only fires once", 1, function() {
|
||||
var model = new Backbone.Model();
|
||||
model.on('change', function() {
|
||||
ok(true);
|
||||
model.change();
|
||||
model.set({x: true});
|
||||
});
|
||||
model.set({x: true});
|
||||
});
|
||||
|
||||
test("no `'change'` event if no changes", 0, function() {
|
||||
var model = new Backbone.Model();
|
||||
model.on('change', function() { ok(false); });
|
||||
model.change();
|
||||
});
|
||||
|
||||
test("nested `set` during `'change'`", 6, function() {
|
||||
var count = 0;
|
||||
var model = new Backbone.Model();
|
||||
@@ -721,13 +808,13 @@ $(document).ready(function() {
|
||||
model.set({y: true});
|
||||
break;
|
||||
case 1:
|
||||
deepEqual(this.changedAttributes(), {y: true});
|
||||
equal(model.previous('x'), true);
|
||||
deepEqual(this.changedAttributes(), {x: true, y: true});
|
||||
equal(model.previous('x'), undefined);
|
||||
model.set({z: true});
|
||||
break;
|
||||
case 2:
|
||||
deepEqual(this.changedAttributes(), {z: true});
|
||||
equal(model.previous('y'), true);
|
||||
deepEqual(this.changedAttributes(), {x: true, y: true, z: true});
|
||||
equal(model.previous('y'), undefined);
|
||||
break;
|
||||
default:
|
||||
ok(false);
|
||||
@@ -736,30 +823,34 @@ $(document).ready(function() {
|
||||
model.set({x: true});
|
||||
});
|
||||
|
||||
test("nested `'change'` with silent", 3, function() {
|
||||
test("nested `change` with silent", 3, function() {
|
||||
var count = 0;
|
||||
var model = new Backbone.Model();
|
||||
model.on('change:y', function() { ok(true); });
|
||||
model.on('change:y', function() { ok(false); });
|
||||
model.on('change', function() {
|
||||
switch(count++) {
|
||||
case 0:
|
||||
deepEqual(this.changedAttributes(), {x: true});
|
||||
model.set({y: true}, {silent: true});
|
||||
model.set({z: true});
|
||||
break;
|
||||
case 1:
|
||||
deepEqual(this.changedAttributes(), {y: true, z: true});
|
||||
deepEqual(this.changedAttributes(), {x: true, y: true, z: true});
|
||||
break;
|
||||
case 2:
|
||||
deepEqual(this.changedAttributes(), {z: false});
|
||||
break;
|
||||
default:
|
||||
ok(false);
|
||||
}
|
||||
});
|
||||
model.set({x: true});
|
||||
model.set({z: true});
|
||||
model.set({z: false});
|
||||
});
|
||||
|
||||
test("nested `'change:attr'` with silent", 1, function() {
|
||||
test("nested `change:attr` with silent", 0, function() {
|
||||
var model = new Backbone.Model();
|
||||
model.on('change:y', function(){ ok(true); });
|
||||
model.on('change:y', function(){ ok(false); });
|
||||
model.on('change', function() {
|
||||
model.set({y: true}, {silent: true});
|
||||
model.set({z: true});
|
||||
@@ -777,21 +868,25 @@ $(document).ready(function() {
|
||||
equal(val, 2);
|
||||
});
|
||||
model.set({x: true});
|
||||
model.change();
|
||||
});
|
||||
|
||||
test("multiple nested changes with silent", 2, function() {
|
||||
test("multiple nested changes with silent", 1, function() {
|
||||
var changes = [];
|
||||
var model = new Backbone.Model();
|
||||
model.on('change:b', function(model, val) { changes.push(val); });
|
||||
model.on('change', function() {
|
||||
model.set({b: 1});
|
||||
model.set({b: 2}, {silent: true});
|
||||
});
|
||||
model.set({b: 0});
|
||||
deepEqual(changes, [0, 1]);
|
||||
model.change();
|
||||
deepEqual(changes, [0, 1, 2, 1]);
|
||||
});
|
||||
|
||||
test("basic silent change semantics", 1, function() {
|
||||
var model = new Backbone.Model;
|
||||
model.set({x: 1});
|
||||
model.on('change', function(){ ok(true); });
|
||||
model.set({x: 2}, {silent: true});
|
||||
model.set({x: 1});
|
||||
});
|
||||
|
||||
test("nested set multiple times", 1, function() {
|
||||
@@ -837,9 +932,8 @@ $(document).ready(function() {
|
||||
|
||||
test("#1412 - Trigger 'sync' event.", 3, function() {
|
||||
var model = new Backbone.Model({id: 1});
|
||||
model.url = '/test';
|
||||
model.sync = function (method, model, options) { options.success(); };
|
||||
model.on('sync', function(){ ok(true); });
|
||||
Backbone.ajax = function(settings){ settings.success(); };
|
||||
model.fetch();
|
||||
model.save();
|
||||
model.destroy();
|
||||
@@ -866,7 +960,7 @@ $(document).ready(function() {
|
||||
validate: function(){ return 'invalid'; }
|
||||
});
|
||||
var model = new Model({id: 1});
|
||||
model.on('error', function(){ ok(true); });
|
||||
model.on('invalid', function(){ ok(true); });
|
||||
model.save();
|
||||
});
|
||||
|
||||
@@ -895,9 +989,9 @@ $(document).ready(function() {
|
||||
.save(null, {wait: true});
|
||||
});
|
||||
|
||||
test("#1664 - Changing from one value, silently to another, back to original does not trigger change.", 0, function() {
|
||||
test("#1664 - Changing from one value, silently to another, back to original triggers a change.", 1, function() {
|
||||
var model = new Backbone.Model({x:1});
|
||||
model.on('change:x', function() { ok(false); });
|
||||
model.on('change:x', function() { ok(true); });
|
||||
model.set({x:2},{silent:true});
|
||||
model.set({x:3},{silent:true});
|
||||
model.set({x:1});
|
||||
@@ -910,15 +1004,11 @@ $(document).ready(function() {
|
||||
model.set({a:'c'}, {silent:true});
|
||||
model.set({b:2}, {silent:true});
|
||||
model.unset('c', {silent:true});
|
||||
model.set({a:'a'}, {silent:true});
|
||||
model.set({b:1}, {silent:true});
|
||||
model.set({c:'item'}, {silent:true});
|
||||
});
|
||||
model.on('change:a change:b change:c', function(model, val) { changes.push(val); });
|
||||
model.set({a:'a', b:1, c:'item'});
|
||||
deepEqual(changes, ['a',1,'item']);
|
||||
model.change();
|
||||
deepEqual(changes, ['a',1,'item']);
|
||||
deepEqual(model.attributes, {a: 'c', b: 2});
|
||||
});
|
||||
|
||||
test("#1791 - `attributes` is available for `parse`", function() {
|
||||
@@ -929,7 +1019,7 @@ $(document).ready(function() {
|
||||
expect(0);
|
||||
});
|
||||
|
||||
test("silent changes in last `change` event back to original does not trigger change", 2, function() {
|
||||
test("silent changes in last `change` event back to original triggers change", 2, function() {
|
||||
var changes = [];
|
||||
var model = new Backbone.Model();
|
||||
model.on('change:a change:b change:c', function(model, val) { changes.push(val); });
|
||||
@@ -938,9 +1028,8 @@ $(document).ready(function() {
|
||||
});
|
||||
model.set({a:'a'});
|
||||
deepEqual(changes, ['a']);
|
||||
model.set({a:'a'}, {silent:true});
|
||||
model.change();
|
||||
deepEqual(changes, ['a']);
|
||||
model.set({a:'a'});
|
||||
deepEqual(changes, ['a', 'a']);
|
||||
});
|
||||
|
||||
test("#1943 change calculations should use _.isEqual", function() {
|
||||
@@ -949,4 +1038,65 @@ $(document).ready(function() {
|
||||
equal(model.changedAttributes(), false);
|
||||
});
|
||||
|
||||
test("#1964 - final `change` event is always fired, regardless of interim changes", 1, function () {
|
||||
var model = new Backbone.Model();
|
||||
model.on('change:property', function() {
|
||||
model.set('property', 'bar');
|
||||
});
|
||||
model.on('change', function() {
|
||||
ok(true);
|
||||
});
|
||||
model.set('property', 'foo');
|
||||
});
|
||||
|
||||
test("isValid", function() {
|
||||
var model = new Backbone.Model({valid: true});
|
||||
model.validate = function(attrs) {
|
||||
if (!attrs.valid) return "invalid";
|
||||
};
|
||||
equal(model.isValid(), true);
|
||||
equal(model.set({valid: false}, {validate:true}), false);
|
||||
equal(model.isValid(), true);
|
||||
model.set({valid:false});
|
||||
equal(model.isValid(), false);
|
||||
ok(!model.set('valid', false, {validate: true}));
|
||||
});
|
||||
|
||||
test("#1179 - isValid returns true in the absence of validate.", 1, function() {
|
||||
var model = new Backbone.Model();
|
||||
model.validate = null;
|
||||
ok(model.isValid());
|
||||
});
|
||||
|
||||
test("#1961 - Creating a model with {validate:true} will call validate and use the error callback", function () {
|
||||
var Model = Backbone.Model.extend({
|
||||
validate: function (attrs) {
|
||||
if (attrs.id === 1) return "This shouldn't happen";
|
||||
}
|
||||
});
|
||||
var model = new Model({id: 1}, {validate: true});
|
||||
equal(model.validationError, "This shouldn't happen");
|
||||
});
|
||||
|
||||
test("toJSON receives attrs during save(..., {wait: true})", 1, function() {
|
||||
var Model = Backbone.Model.extend({
|
||||
url: '/test',
|
||||
toJSON: function() {
|
||||
strictEqual(this.attributes.x, 1);
|
||||
return _.clone(this.attributes);
|
||||
}
|
||||
});
|
||||
var model = new Model;
|
||||
model.save({x: 1}, {wait: true});
|
||||
});
|
||||
|
||||
test("#2034 - nested set with silent only triggers one change", 1, function() {
|
||||
var model = new Backbone.Model();
|
||||
model.on('change', function() {
|
||||
model.set({b: true}, {silent: true});
|
||||
ok(true);
|
||||
});
|
||||
model.set({a: true});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
123
vendor/backbone/test/router.js
vendored
@@ -57,6 +57,15 @@ $(document).ready(function() {
|
||||
|
||||
});
|
||||
|
||||
var ExternalObject = {
|
||||
value: 'unset',
|
||||
|
||||
routingFunction: function(value) {
|
||||
this.value = value;
|
||||
}
|
||||
};
|
||||
_.bindAll(ExternalObject);
|
||||
|
||||
var Router = Backbone.Router.extend({
|
||||
|
||||
count: 0,
|
||||
@@ -69,10 +78,15 @@ $(document).ready(function() {
|
||||
"contacts": "contacts",
|
||||
"contacts/new": "newContact",
|
||||
"contacts/:id": "loadContact",
|
||||
"route-event/:arg": "routeEvent",
|
||||
"optional(/:item)": "optionalItem",
|
||||
"named/optional/(y:z)": "namedOptional",
|
||||
"splat/*args/end": "splat",
|
||||
"*first/complex-:part/*rest": "complex",
|
||||
":repo/compare/*from...*to": "github",
|
||||
"decode/:named/*splat": "decode",
|
||||
"*first/complex-*part/*rest": "complex",
|
||||
":entity?*args": "query",
|
||||
"function/:value": ExternalObject.routingFunction,
|
||||
"*anything": "anything"
|
||||
},
|
||||
|
||||
@@ -110,23 +124,41 @@ $(document).ready(function() {
|
||||
this.arg = arg != void 0 ? arg : null;
|
||||
},
|
||||
|
||||
splat : function(args) {
|
||||
splat: function(args) {
|
||||
this.args = args;
|
||||
},
|
||||
|
||||
complex : function(first, part, rest) {
|
||||
github: function(repo, from, to) {
|
||||
this.repo = repo;
|
||||
this.from = from;
|
||||
this.to = to;
|
||||
},
|
||||
|
||||
complex: function(first, part, rest) {
|
||||
this.first = first;
|
||||
this.part = part;
|
||||
this.rest = rest;
|
||||
},
|
||||
|
||||
query : function(entity, args) {
|
||||
query: function(entity, args) {
|
||||
this.entity = entity;
|
||||
this.queryArgs = args;
|
||||
},
|
||||
|
||||
anything : function(whatever) {
|
||||
anything: function(whatever) {
|
||||
this.anything = whatever;
|
||||
},
|
||||
|
||||
namedOptional: function(z) {
|
||||
this.z = z;
|
||||
},
|
||||
|
||||
decode: function(named, path) {
|
||||
this.named = named;
|
||||
this.path = path;
|
||||
},
|
||||
|
||||
routeEvent: function(arg) {
|
||||
}
|
||||
|
||||
});
|
||||
@@ -144,6 +176,15 @@ $(document).ready(function() {
|
||||
equal(lastArgs[0], 'news');
|
||||
});
|
||||
|
||||
test("routes (simple, but unicode)", 4, function() {
|
||||
location.replace('http://example.com#search/тест');
|
||||
Backbone.history.checkUrl();
|
||||
equal(router.query, "тест");
|
||||
equal(router.page, void 0);
|
||||
equal(lastRoute, 'search');
|
||||
equal(lastArgs[0], "тест");
|
||||
});
|
||||
|
||||
test("routes (two part)", 2, function() {
|
||||
location.replace('http://example.com#search/nyc/p10');
|
||||
Backbone.history.checkUrl();
|
||||
@@ -204,6 +245,14 @@ $(document).ready(function() {
|
||||
equal(router.args, 'long-list/of/splatted_99args');
|
||||
});
|
||||
|
||||
test("routes (github)", 3, function() {
|
||||
location.replace('http://example.com#backbone/compare/1.0...braddunbar:with/slash');
|
||||
Backbone.history.checkUrl();
|
||||
equal(router.repo, 'backbone');
|
||||
equal(router.from, '1.0');
|
||||
equal(router.to, 'braddunbar:with/slash');
|
||||
});
|
||||
|
||||
test("routes (optional)", 2, function() {
|
||||
location.replace('http://example.com#optional');
|
||||
Backbone.history.checkUrl();
|
||||
@@ -237,6 +286,23 @@ $(document).ready(function() {
|
||||
equal(router.anything, 'doesnt-match-a-route');
|
||||
});
|
||||
|
||||
test("routes (function)", 3, function() {
|
||||
router.on('route', function(name) {
|
||||
ok(name === '');
|
||||
});
|
||||
equal(ExternalObject.value, 'unset');
|
||||
location.replace('http://example.com#function/set');
|
||||
Backbone.history.checkUrl();
|
||||
equal(ExternalObject.value, 'set');
|
||||
});
|
||||
|
||||
test("Decode named parameters, not splats.", 2, function() {
|
||||
location.replace('http://example.com#decode/a%2Fb/c%2Fd/e');
|
||||
Backbone.history.checkUrl();
|
||||
strictEqual(router.named, 'a/b');
|
||||
strictEqual(router.path, 'c/d/e');
|
||||
});
|
||||
|
||||
test("fires event when router doesn't have callback on it", 1, function() {
|
||||
router.on("route:noCallback", function(){ ok(true); });
|
||||
location.replace('http://example.com#noCallback');
|
||||
@@ -268,9 +334,9 @@ $(document).ready(function() {
|
||||
test("#967 - Route callback gets passed encoded values.", 3, function() {
|
||||
var route = 'has%2Fslash/complex-has%23hash/has%20space';
|
||||
Backbone.history.navigate(route, {trigger: true});
|
||||
strictEqual(router.first, 'has%2Fslash');
|
||||
strictEqual(router.part, 'has%23hash');
|
||||
strictEqual(router.rest, 'has%20space');
|
||||
strictEqual(router.first, 'has/slash');
|
||||
strictEqual(router.part, 'has#hash');
|
||||
strictEqual(router.rest, 'has space');
|
||||
});
|
||||
|
||||
test("correctly handles URLs with % (#868)", 3, function() {
|
||||
@@ -502,4 +568,45 @@ $(document).ready(function() {
|
||||
strictEqual(history.getFragment('/fragment '), 'fragment');
|
||||
});
|
||||
|
||||
test("#1980 - Optional parameters.", 2, function() {
|
||||
location.replace('http://example.com#named/optional/y');
|
||||
Backbone.history.checkUrl();
|
||||
strictEqual(router.z, undefined);
|
||||
location.replace('http://example.com#named/optional/y123');
|
||||
Backbone.history.checkUrl();
|
||||
strictEqual(router.z, '123');
|
||||
});
|
||||
|
||||
test("#2062 - Trigger 'route' event on router instance.", 2, function() {
|
||||
router.on('route', function(name, args) {
|
||||
strictEqual(name, 'routeEvent');
|
||||
deepEqual(args, ['x']);
|
||||
});
|
||||
location.replace('http://example.com#route-event/x');
|
||||
Backbone.history.checkUrl();
|
||||
});
|
||||
|
||||
test("#2255 - Extend routes by making routes a function.", 1, function() {
|
||||
var RouterBase = Backbone.Router.extend({
|
||||
routes: function() {
|
||||
return {
|
||||
home: "root",
|
||||
index: "index.html"
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
var RouterExtended = RouterBase.extend({
|
||||
routes: function() {
|
||||
var _super = RouterExtended.__super__.routes;
|
||||
return _.extend(_super(),
|
||||
{ show: "show",
|
||||
search: "search" });
|
||||
}
|
||||
});
|
||||
|
||||
var router = new RouterExtended();
|
||||
deepEqual({home: "root", index: "index.html", show: "show", search: "search"}, router.routes);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
23
vendor/backbone/test/view.js
vendored
@@ -29,22 +29,6 @@ $(document).ready(function() {
|
||||
strictEqual(view.$('a b').html(), 'test');
|
||||
});
|
||||
|
||||
test("make", 3, function() {
|
||||
var div = view.make('div', {id: 'test-div'}, "one two three");
|
||||
|
||||
equal(div.tagName.toLowerCase(), 'div');
|
||||
equal(div.id, 'test-div');
|
||||
equal($(div).text(), 'one two three');
|
||||
});
|
||||
|
||||
test("make can take falsy values for content", 2, function() {
|
||||
var div = view.make('div', {id: 'test-div'}, 0);
|
||||
equal($(div).text(), '0');
|
||||
|
||||
div = view.make('div', {id: 'test-div'}, '');
|
||||
equal($(div).text(), '');
|
||||
});
|
||||
|
||||
test("initialize", 1, function() {
|
||||
var View = Backbone.View.extend({
|
||||
initialize: function() {
|
||||
@@ -101,6 +85,13 @@ $(document).ready(function() {
|
||||
equal(view.counter, 3);
|
||||
});
|
||||
|
||||
|
||||
test("delegateEvents ignore undefined methods", 0, function() {
|
||||
var view = new Backbone.View({el: '<p></p>'});
|
||||
view.delegateEvents({'click': 'undefinedMethod'});
|
||||
view.$el.trigger('click');
|
||||
});
|
||||
|
||||
test("undelegateEvents", 6, function() {
|
||||
var counter1 = 0, counter2 = 0;
|
||||
|
||||
|
||||
4
vendor/benchmark.js/LICENSE.txt
vendored
@@ -1,4 +1,4 @@
|
||||
Copyright 2010-2012 Mathias Bynens <http://mathiasbynens.be/>
|
||||
Copyright 2010-2013 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.
|
||||
26
vendor/benchmark.js/README.md
vendored
@@ -15,13 +15,16 @@ For a list of upcoming features, check out our [roadmap](https://github.com/best
|
||||
|
||||
## Support
|
||||
|
||||
Benchmark.js has been tested in at least Adobe AIR 3.1, Chrome 5-21, Firefox 1-15, IE 6-9, Opera 9.25-12, Safari 3-6, Node.js 0.8.8, Narwhal 0.3.2, RingoJS 0.8, and Rhino 1.7RC5.
|
||||
Benchmark.js has been tested in at least Chrome 5~26, Firefox 1~19, IE 6-10, Opera 9.25-12, Safari 3-6, Node.js 0.4.8-0.10.4, Narwhal 0.3.2, PhantomJS 1.9.0, RingoJS 0.9, and Rhino 1.7RC5.
|
||||
|
||||
## Installation and usage
|
||||
|
||||
In a browser or Adobe AIR:
|
||||
Benchmark.js’ only hard dependency is [Lo-Dash](http://lodash.com/).
|
||||
|
||||
In a browser:
|
||||
|
||||
```html
|
||||
<script src="lodash.js"></script>
|
||||
<script src="benchmark.js"></script>
|
||||
```
|
||||
|
||||
@@ -68,25 +71,14 @@ load('benchmark.js');
|
||||
In an AMD loader like [RequireJS](http://requirejs.org/):
|
||||
|
||||
```js
|
||||
require({
|
||||
'paths': {
|
||||
'benchmark': 'path/to/benchmark'
|
||||
}
|
||||
},
|
||||
['benchmark'], function(Benchmark) {
|
||||
console.log(Benchmark.version);
|
||||
});
|
||||
|
||||
// or with platform.js
|
||||
// https://github.com/bestiejs/platform.js
|
||||
require({
|
||||
'paths': {
|
||||
'benchmark': 'path/to/benchmark',
|
||||
'lodash': 'path/to/lodash',
|
||||
'platform': 'path/to/platform'
|
||||
}
|
||||
},
|
||||
['benchmark', 'platform'], function(Benchmark, platform) {
|
||||
Benchmark.platform = platform;
|
||||
['benchmark'], function(Benchmark) {
|
||||
console.log(Benchmark.platform.name);
|
||||
});
|
||||
```
|
||||
@@ -108,7 +100,7 @@ suite.add('RegExp#test', function() {
|
||||
console.log(String(event.target));
|
||||
})
|
||||
.on('complete', function() {
|
||||
console.log('Fastest is ' + this.filter('fastest').pluck('name'));
|
||||
console.log('Fastest is ' + _.pluck(this.filter('fastest'), 'name'));
|
||||
})
|
||||
// run async
|
||||
.run({ 'async': true });
|
||||
@@ -121,7 +113,7 @@ suite.add('RegExp#test', function() {
|
||||
|
||||
## BestieJS
|
||||
|
||||
Benchmark.js is part of the BestieJS *"Best in Class"* module collection. This means we promote solid browser/environment support, ES5 precedents, unit testing, and plenty of documentation.
|
||||
Benchmark.js is part of the BestieJS *"Best in Class"* module collection. This means we promote solid browser/environment support, ES5+ precedents, unit testing, and plenty of documentation.
|
||||
|
||||
## Authors
|
||||
|
||||
|
||||
6466
vendor/benchmark.js/benchmark.js
vendored
2
vendor/docdown/LICENSE.txt
vendored
@@ -1,4 +1,4 @@
|
||||
Copyright 2011-2012 John-David Dalton <http://allyoucanleet.com/>
|
||||
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
|
||||
|
||||
2
vendor/docdown/docdown.php
vendored
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/*!
|
||||
* Docdown v1.0.0-pre
|
||||
* Copyright 2011-2012 John-David Dalton <http://allyoucanleet.com/>
|
||||
* Copyright 2011-2013 John-David Dalton <http://allyoucanleet.com/>
|
||||
* Available under MIT license <http://mths.be/mit>
|
||||
*/
|
||||
require(dirname(__FILE__) . '/src/DocDown/Generator.php');
|
||||
|
||||
119
vendor/docdown/src/DocDown/Alias.php
vendored
@@ -29,15 +29,16 @@ class Alias {
|
||||
$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();
|
||||
$this->_isCtor = $owner->isCtor();
|
||||
$this->_isPlugin = $owner->isPlugin();
|
||||
$this->_isPrivate = $owner->isPrivate();
|
||||
$this->_isStatic = $owner->isStatic();
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
@@ -96,6 +97,66 @@ class Alias {
|
||||
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.
|
||||
*
|
||||
@@ -161,55 +222,5 @@ class Alias {
|
||||
public function getType() {
|
||||
return $this->_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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* 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;
|
||||
}
|
||||
}
|
||||
?>
|
||||
175
vendor/docdown/src/DocDown/Entry.php
vendored
@@ -217,6 +217,100 @@ class Entry {
|
||||
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('/\* *@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('/\* *@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('/\* *@private\b/', $this->entry) || !preg_match('/\* *@[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('/\* *@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.
|
||||
*
|
||||
@@ -344,86 +438,5 @@ class Entry {
|
||||
$this->_type = $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('/\* *@constructor\b/', $this->entry);
|
||||
}
|
||||
return $this->_isCtor;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 = !!preg_match('/\* *@private\b/', $this->entry) || !preg_match('/\* *@[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('/\* *@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;
|
||||
}
|
||||
}
|
||||
?>
|
||||
0
vendor/firebug-lite/license.txt
vendored
Normal file → Executable file
0
vendor/firebug-lite/skin/xp/blank.gif
vendored
Normal file → Executable file
|
Before Width: | Height: | Size: 43 B After Width: | Height: | Size: 43 B |
0
vendor/firebug-lite/skin/xp/buttonBg.png
vendored
Normal file → Executable file
|
Before Width: | Height: | Size: 167 B After Width: | Height: | Size: 167 B |
0
vendor/firebug-lite/skin/xp/buttonBgHover.png
vendored
Normal file → Executable file
|
Before Width: | Height: | Size: 171 B After Width: | Height: | Size: 171 B |
0
vendor/firebug-lite/skin/xp/debugger.css
vendored
Normal file → Executable file
0
vendor/firebug-lite/skin/xp/detach.png
vendored
Normal file → Executable file
|
Before Width: | Height: | Size: 655 B After Width: | Height: | Size: 655 B |
0
vendor/firebug-lite/skin/xp/detachHover.png
vendored
Normal file → Executable file
|
Before Width: | Height: | Size: 586 B After Width: | Height: | Size: 586 B |
0
vendor/firebug-lite/skin/xp/disable.gif
vendored
Normal file → Executable file
|
Before Width: | Height: | Size: 340 B After Width: | Height: | Size: 340 B |
0
vendor/firebug-lite/skin/xp/disable.png
vendored
Normal file → Executable file
|
Before Width: | Height: | Size: 543 B After Width: | Height: | Size: 543 B |
0
vendor/firebug-lite/skin/xp/disableHover.gif
vendored
Normal file → Executable file
|
Before Width: | Height: | Size: 344 B After Width: | Height: | Size: 344 B |
0
vendor/firebug-lite/skin/xp/disableHover.png
vendored
Normal file → Executable file
|
Before Width: | Height: | Size: 512 B After Width: | Height: | Size: 512 B |
0
vendor/firebug-lite/skin/xp/down.png
vendored
Normal file → Executable file
|
Before Width: | Height: | Size: 637 B After Width: | Height: | Size: 637 B |
0
vendor/firebug-lite/skin/xp/downActive.png
vendored
Normal file → Executable file
|
Before Width: | Height: | Size: 543 B After Width: | Height: | Size: 543 B |
0
vendor/firebug-lite/skin/xp/downHover.png
vendored
Normal file → Executable file
|
Before Width: | Height: | Size: 526 B After Width: | Height: | Size: 526 B |
0
vendor/firebug-lite/skin/xp/errorIcon-sm.png
vendored
Normal file → Executable file
|
Before Width: | Height: | Size: 447 B After Width: | Height: | Size: 447 B |
0
vendor/firebug-lite/skin/xp/errorIcon.gif
vendored
Normal file → Executable file
|
Before Width: | Height: | Size: 365 B After Width: | Height: | Size: 365 B |
0
vendor/firebug-lite/skin/xp/errorIcon.png
vendored
Normal file → Executable file
|
Before Width: | Height: | Size: 457 B After Width: | Height: | Size: 457 B |
0
vendor/firebug-lite/skin/xp/firebug-1.3a2.css
vendored
Normal file → Executable file
0
vendor/firebug-lite/skin/xp/firebug.IE6.css
vendored
Normal file → Executable file
0
vendor/firebug-lite/skin/xp/firebug.css
vendored
Normal file → Executable file
0
vendor/firebug-lite/skin/xp/firebug.html
vendored
Normal file → Executable file
0
vendor/firebug-lite/skin/xp/firebug.png
vendored
Normal file → Executable file
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
0
vendor/firebug-lite/skin/xp/group.gif
vendored
Normal file → Executable file
|
Before Width: | Height: | Size: 158 B After Width: | Height: | Size: 158 B |
0
vendor/firebug-lite/skin/xp/html.css
vendored
Normal file → Executable file
0
vendor/firebug-lite/skin/xp/infoIcon.gif
vendored
Normal file → Executable file
|
Before Width: | Height: | Size: 359 B After Width: | Height: | Size: 359 B |
0
vendor/firebug-lite/skin/xp/infoIcon.png
vendored
Normal file → Executable file
|
Before Width: | Height: | Size: 524 B After Width: | Height: | Size: 524 B |
0
vendor/firebug-lite/skin/xp/loading_16.gif
vendored
Normal file → Executable file
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
0
vendor/firebug-lite/skin/xp/min.png
vendored
Normal file → Executable file
|
Before Width: | Height: | Size: 552 B After Width: | Height: | Size: 552 B |
0
vendor/firebug-lite/skin/xp/minHover.png
vendored
Normal file → Executable file
|
Before Width: | Height: | Size: 485 B After Width: | Height: | Size: 485 B |
0
vendor/firebug-lite/skin/xp/off.png
vendored
Normal file → Executable file
|
Before Width: | Height: | Size: 742 B After Width: | Height: | Size: 742 B |
0
vendor/firebug-lite/skin/xp/offHover.png
vendored
Normal file → Executable file
|
Before Width: | Height: | Size: 680 B After Width: | Height: | Size: 680 B |
0
vendor/firebug-lite/skin/xp/pixel_transparent.gif
vendored
Normal file → Executable file
|
Before Width: | Height: | Size: 43 B After Width: | Height: | Size: 43 B |
0
vendor/firebug-lite/skin/xp/roundCorner.svg
vendored
Normal file → Executable file
|
Before Width: | Height: | Size: 228 B After Width: | Height: | Size: 228 B |
0
vendor/firebug-lite/skin/xp/search.gif
vendored
Normal file → Executable file
|
Before Width: | Height: | Size: 550 B After Width: | Height: | Size: 550 B |
0
vendor/firebug-lite/skin/xp/search.png
vendored
Normal file → Executable file
|
Before Width: | Height: | Size: 685 B After Width: | Height: | Size: 685 B |
0
vendor/firebug-lite/skin/xp/shadow.gif
vendored
Normal file → Executable file
|
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
0
vendor/firebug-lite/skin/xp/shadow2.gif
vendored
Normal file → Executable file
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
0
vendor/firebug-lite/skin/xp/shadowAlpha.png
vendored
Normal file → Executable file
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
0
vendor/firebug-lite/skin/xp/sprite.png
vendored
Normal file → Executable file
|
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 39 KiB |
0
vendor/firebug-lite/skin/xp/tabHoverLeft.png
vendored
Normal file → Executable file
|
Before Width: | Height: | Size: 438 B After Width: | Height: | Size: 438 B |
0
vendor/firebug-lite/skin/xp/tabHoverMid.png
vendored
Normal file → Executable file
|
Before Width: | Height: | Size: 261 B After Width: | Height: | Size: 261 B |
0
vendor/firebug-lite/skin/xp/tabHoverRight.png
vendored
Normal file → Executable file
|
Before Width: | Height: | Size: 436 B After Width: | Height: | Size: 436 B |
0
vendor/firebug-lite/skin/xp/tabLeft.png
vendored
Normal file → Executable file
|
Before Width: | Height: | Size: 449 B After Width: | Height: | Size: 449 B |
0
vendor/firebug-lite/skin/xp/tabMenuCheckbox.png
vendored
Normal file → Executable file
|
Before Width: | Height: | Size: 220 B After Width: | Height: | Size: 220 B |
0
vendor/firebug-lite/skin/xp/tabMenuPin.png
vendored
Normal file → Executable file
|
Before Width: | Height: | Size: 207 B After Width: | Height: | Size: 207 B |
0
vendor/firebug-lite/skin/xp/tabMenuRadio.png
vendored
Normal file → Executable file
|
Before Width: | Height: | Size: 192 B After Width: | Height: | Size: 192 B |
0
vendor/firebug-lite/skin/xp/tabMenuTarget.png
vendored
Normal file → Executable file
|
Before Width: | Height: | Size: 142 B After Width: | Height: | Size: 142 B |