Compare commits

..

89 Commits
1.1.1 ... 1.2.1

Author SHA1 Message Date
Benjamin Tan
ba364547f9 Update v1.2.1 docs 2015-01-23 16:11:33 +08:00
John-David Dalton
c938017baa Bump to v1.2.1.
Former-commit-id: ddffb32b2aa61001e81fccfa59b9e9bb38bf7883
2013-04-29 09:10:51 -07:00
John-David Dalton
728eea3ae1 Use zopfli to compress minifiers.
Former-commit-id: 0c68644b7602caf00b02a4977951508aceeb4156
2013-04-29 08:55:07 -07:00
John-David Dalton
88f9c1e539 Add modern build test.
Former-commit-id: 5f1addf774bd9d128095d477c227c4d8420ead5d
2013-04-29 08:54:46 -07:00
John-David Dalton
76540c20f3 Add .map to the ignore files. [ci skip]
Former-commit-id: 129c53ab38b4fbb178b4a832a7abdbf8b055d615
2013-04-29 08:54:15 -07:00
John-David Dalton
70761cf1d9 Avoid false test fails in isType unit tests.
Former-commit-id: b7311a8c3844000efab5d56d3632b99f0bf16ce8
2013-04-28 19:28:40 -07:00
John-David Dalton
ace913a97d Update avatars in READMEs. [ci skip]
Former-commit-id: a4ca090094770481959cd4d4e68ec49696c12f9d
2013-04-28 16:51:53 -07:00
John-David Dalton
d6e269c7f6 Avoid special characters in the whitespace unit test.
Former-commit-id: 5344bbdb0cd96a3a7d275facc7160c1afa1e971e
2013-04-28 16:48:54 -07:00
John-David Dalton
ec10550b3a Ensure the _.isRegExp is correct for various builds.
Former-commit-id: 38cf57053b89b1011bbfbd0b6a9cd31e91589c31
2013-04-28 16:48:13 -07:00
John-David Dalton
86e2374b48 Ensure _.isArray assignment is handled correctly for builds.
Former-commit-id: a844909ada5fbb394cbb91d06e6c76ccc6c40ff7
2013-04-28 15:53:36 -07:00
John-David Dalton
d156dacbb9 Add more .json files to the various ignore files. [ci skip]
Former-commit-id: ff1bce7c404799856f838aab301e60b654309c96
2013-04-28 15:23:53 -07:00
John-David Dalton
1af5517da0 Add component.json. [closes #58]
Former-commit-id: a7edbb3ee80687f3c74fdb2ae37cad553e009766
2013-04-28 00:18:37 -07:00
John-David Dalton
e5d34890a9 Cleanup whitespace characters in strings and fix a whitespace bug in Closure Compiler.
Former-commit-id: d1ab43648f3084b7bcfbd471728b71cea48aa9be
2013-04-27 02:24:25 -07:00
John-David Dalton
183b2548cf Document the radix argument of _.parseInt and ensure it ignores leading whitespace. [closes #254]
Former-commit-id: b1d0f7688402b3f41cfb030c63dcd097ba3f4e68
2013-04-26 22:48:14 -07:00
John-David Dalton
d2de489e3a Update vendors.
Former-commit-id: a36c775be95f95737129965826c2ffcab3fde4f3
2013-04-26 10:44:59 -07:00
Kit Cambridge
90f8dbd86e minify: Send a User-Agent header to avoid 403 responses from GitHub. [ci skip] [closes #255]
Former-commit-id: 1879b790b4ace543430edba6ae62d33c963f0344
2013-04-26 09:38:04 -07:00
John-David Dalton
3508ce19f3 Remove support.argsObject from the underscore build.
Former-commit-id: 4b25a64d662bde78ab6956109b072ed0a4755e53
2013-04-25 09:15:12 -07:00
John-David Dalton
00188c9818 Use -1 as the selectedIndex of the drop down lists when a custom url is used in the perf suite. [ci skip]
Former-commit-id: a3946b9a1d1e129b202606172803daf93afb1fbe
2013-04-24 23:40:41 -07:00
John-David Dalton
499232f0e6 Use lodash.reduce in getGeometricMean of perf.js. [ci skip]
Former-commit-id: 7c5af9afcd56958e03f96d3f13f396894cf95f4b
2013-04-24 21:48:04 -07:00
John-David Dalton
17471a12d2 Add legacy build to the perf suite and ensure belt is assigned the correct value.
Former-commit-id: 568bbd8157155d76d406ae0e33fe71418f4632f4
2013-04-24 12:53:18 -07:00
John-David Dalton
de4b5eeda7 Allow external scripts to be specified and run in the perf suite.
Former-commit-id: 474f0a24d54c800830e2bcec98f6536a17a12bfb
2013-04-24 09:08:46 -07:00
John-David Dalton
d0a0193707 Add missing backticks in the docs. [ci skip]
Former-commit-id: 77e7f0275b820e02d52dea90181fc48ae0f650fe
2013-04-23 20:28:52 -07:00
John-David Dalton
5269a26b69 Merge pull request #253 from ajoslin/master
Fix missing backtick in uniq docs

Former-commit-id: 37b7007e2f2bc8e30f09fb04dc1a2a69c84795e2
2013-04-23 20:14:24 -07:00
Andy Joslin
8dc6ad587f Fix missing backtick in uniq docs
Former-commit-id: f43321cad9391c1b6167cf1ba7a7814e5128948c
2013-04-23 23:07:55 -04:00
John-David Dalton
757339c52d Add more builds to the drop down lists of the perf and test suite.
Former-commit-id: ab565c850a553e70137b064383813812eee4acce
2013-04-23 00:05:37 -07:00
John-David Dalton
6e289339d7 Ensure _.isArray fallback returns a boolean value.
Former-commit-id: c96fb8e95c40d546099796f8337db6d4d3d33aea
2013-04-22 23:56:36 -07:00
John-David Dalton
3ff0a44a1c Tweak perf suite to use geometric mean and remove tests with high variability.
Former-commit-id: ce4ff88ee6be007b761bcf991c59f30f28880973
2013-04-22 08:33:01 -07:00
John-David Dalton
0562228e9a Ensure the modern build version of _.isPlainObject doesn't error when passed an object created via Object.create. [closes #248]
Former-commit-id: d24641ed2562925fbbd2b64653e8e93ab1aa02bc
2013-04-20 19:40:48 -07:00
John-David Dalton
0b6993bb7c Fix _.debounce doc typo.
Former-commit-id: e2659ca38818d15a4080aa8dd605fed99a9eaa43
2013-04-19 09:07:55 -07:00
John-David Dalton
4a19d90d48 Add _.isObject to the isType benchmark.
Former-commit-id: 4e2a61fab31b506bac1d5ce7ad47f7bb2d9e11b6
2013-04-19 01:03:09 -07:00
John-David Dalton
038b1bcf7b Update _.debounce and _.throttle doc examples and rebuild.
Former-commit-id: fc094e857aeae0ab9581ad56dca894cc96bc7b2e
2013-04-19 01:02:36 -07:00
John-David Dalton
a707c2fe8e Ensure isType methods return false for subclassed values.
Former-commit-id: e300d12eb506c6ae4949bd37cf8eb33c3a4be2e1
2013-04-19 00:12:22 -07:00
John-David Dalton
3bb119f578 Update _.debounce and _.throttled docs. [ci skip]
Former-commit-id: 5a94c9d35069952c72303541409b88656deaa6a7
2013-04-17 22:40:49 -07:00
John-David Dalton
2a92600fa7 Add _.throttle unit test to test lastCalled.
Former-commit-id: 528ebd3514aacafcde55fad989f955f1fe403811
2013-04-17 21:36:37 -07:00
John-David Dalton
e80e1dab4d Add lodash underscore build tests for isType methods.
Former-commit-id: 80898964d46abebb3acf1e5e3586f4df700cd85b
2013-04-17 19:53:14 -07:00
John-David Dalton
45d59d75ba Remove stray fs.writeFileSync in build.js.
Former-commit-id: ba94c84ac7e3d2fe9be8e578035132c86cd59790
2013-04-17 19:52:49 -07:00
John-David Dalton
28cd4c3ee9 Update docs & builds.
Former-commit-id: 84fbc06fe506451e70fb76cef16cbc072468df99
2013-04-17 09:04:07 -07:00
John-David Dalton
e7c44274b0 Ensure _.debounce performs a trailing call, when both leading and trailing are true, only after the throttled function is called more than once. [closes #243]
Former-commit-id: 59ac6bc4ece373623f2bd753b662b8cc974cabc8
2013-04-17 08:43:18 -07:00
John-David Dalton
3b2e0e34ef Tweak release notes in README.md. [ci skip]
Former-commit-id: 316e7610ad00ca0b9d6a80ec44d38e1e739dcfd8
2013-04-17 08:07:28 -07:00
John-David Dalton
2276df07bd Bump to v1.2.0.
Former-commit-id: bb045c043e8f1bbf6cf7fbf463952daa1c24c855
2013-04-16 09:00:33 -07:00
John-David Dalton
758ff03520 Exclude bower.json from Jam and NPM packages.
Former-commit-id: 93ce567c4cfd70bcba58fff27d0dc6c6cca12b7d
2013-04-16 08:58:57 -07:00
John-David Dalton
c3ac172960 Simplify _.debounce and _.throttle for the underscore build.
Former-commit-id: 56dc526cf71130084651d06b8caadce573471131
2013-04-16 01:52:47 -07:00
John-David Dalton
562b4eb531 Ensure unit tests pass in Narwhal.
Former-commit-id: a86ce088a72ea0be7b31e4bccc51ce1286b9418b
2013-04-16 01:04:47 -07:00
John-David Dalton
b1f8e845df Make _.isArray consistent with the other isType methods.
Former-commit-id: adcf242ba7692c96fb8f570118acd7fd0a4602da
2013-04-15 23:58:33 -07:00
John-David Dalton
bda869ea54 Add more to the .gitattributes and tweak template built tests.
Former-commit-id: 7f6c20de3981edb4afeb848ef7721f0075c51b54
2013-04-14 22:05:44 -07:00
John-David Dalton
19cfbf082a Fix corrupt vendor/closure-compiler.tar.gz.
Former-commit-id: 118cbaae80df4751552569211cd7b6436fb6b30f
2013-04-14 15:51:43 -07:00
John-David Dalton
07078bdd1f Tweak how the build handles support property cleanup and ensure the mobile build fixes some old WebKit bugs.
Former-commit-id: 34c3aeb2b58cf83a5a141ffc423245922082a714
2013-04-14 14:02:11 -07:00
John-David Dalton
03657a98e1 Fix typo in no-dep test title.
Former-commit-id: 30d904ab630012c4ba1f07b2762a33d25151486b
2013-04-14 10:19:34 -07:00
John-David Dalton
b3f64abfae Update vendors.
Former-commit-id: 43e57a1a75bdd66e95d3608f180514cfe5e0075c
2013-04-14 01:18:54 -07:00
John-David Dalton
5d73c8f002 Add -n/--no-dep build option.
Former-commit-id: 57571d0df4e17402b9055bae5ccfbc2b94f03613
2013-04-14 00:43:39 -07:00
John-David Dalton
ba0882762d Reorganize build tests.
Former-commit-id: 6f6aea86b84f8b4936785653fbfaa3a146af66a2
2013-04-13 23:47:51 -07:00
John-David Dalton
bb8855b628 Don't include tests that error in the total score of the perf.js suite. [ci skip]
Former-commit-id: ea71d436ecec9297b2d991e9f17e3665a9e53d23
2013-04-13 16:58:28 -07:00
John-David Dalton
883d5917f5 Fix build.
Former-commit-id: 99b283a2f26a9f5973799ad6757bfdc57d0a0404
2013-04-13 14:22:29 -07:00
John-David Dalton
0275e99fe2 Remove the lodash csp build as the default modern build no longer uses compilation.
Former-commit-id: 97f0722cae9190fd11aa9f458c9c7bc281fd82e4
2013-04-13 14:19:41 -07:00
John-David Dalton
5d109077e5 Use _.cloneDeep in build/util.js.
Former-commit-id: 06094c21fe084192933665982edc9a4212016406
2013-04-13 11:13:26 -07:00
John-David Dalton
540851ab6a Reorganize build.js modifications and remove compilation from the lodash modern build.
Former-commit-id: af5d0500be9e11d108bf941604ce2316cbd8c4b5
2013-04-13 11:12:01 -07:00
John-David Dalton
6b920fa5e6 Don't prefix paths with drive letters with dots in mkdirpSync. [closes #238]
Former-commit-id: dd0c8d7b1906210e5f26604d4149ba542727c78d
2013-04-12 13:15:44 -07:00
John-David Dalton
d1498bb9fb Tweak lodash, shimIsPlainObject, shimKeys, and reduce function docs. [ci skip]
Former-commit-id: f24dd4de2a5a6c8103f26d000f1f16b5be3d8165
2013-04-10 20:38:26 -07:00
John-David Dalton
54eeef173a Force lf in .gitattributes.
Former-commit-id: 075ae2c3b8655159095cd7ea5d1b4aae7792f39f
2013-04-10 08:38:35 -07:00
John-David Dalton
723ddf8cda Cleanup ignore files and package files, adding bower.json.
Former-commit-id: eb817fdaa786f35a7906d56dc1bd7e4af1bee33a
2013-04-09 20:49:42 -07:00
John-David Dalton
9f12552907 Add _.once unit tests.
Former-commit-id: cb79b4a5e73ec0cb7bae959693bb14599277ffe0
2013-04-09 20:23:58 -07:00
John-David Dalton
a8b6fa413e Cleanup build files and add build/util.js.
Former-commit-id: 67e5564a17ec4a438e3d0768e8963a1384d4ce98
2013-04-09 20:23:16 -07:00
John-David Dalton
76aae8ce42 Escape path separator when using it as part of a regexp. [closes #233]
Former-commit-id: 95d28187ee573ecc26e44f30cb5fb7457877dd06
2013-04-09 08:35:05 -07:00
John-David Dalton
ad0c287053 Ensure _.merge passes the right arguments to the callback when comparing objects. [closes #231]
Former-commit-id: 7c1ff861f753d3a2bdf62a753c94df2052d03d78
2013-04-08 21:01:57 -07:00
John-David Dalton
4a11a3559d Fix typo in iteratorTemplate and _.template docs. [ci skip] [closes #232]
Former-commit-id: b7870c00a2ab788c233696d3ca40f8306ee7bc3a
2013-04-08 20:01:19 -07:00
John-David Dalton
1faa5a80e4 Add unit tests to ensure non-underscore builds may include _.chain and _.findWhere methods.
Former-commit-id: 91a4ea5114a45bc5038a37d7ff4ea4b6212182ca
2013-04-07 22:55:52 -07:00
John-David Dalton
f1d3df1ec0 Update builds and docs.
Former-commit-id: 6409ea5dfeb50e5e69c844847b57b4853b7622c3
2013-04-07 20:15:23 -07:00
John-David Dalton
e7c94d3351 Cleanup _.union.
Former-commit-id: ed927c495c93121371d852f5239a068967ec6a6c
2013-04-07 20:06:09 -07:00
John-David Dalton
954f76dcf5 Reduce package size. [closes #230]
Former-commit-id: 91e7564f799866453783c9319af405a7aea65b2c
2013-04-07 20:00:44 -07:00
John-David Dalton
43037c0ff9 Ensure "Arrays" and "Objects" methods work with arguments objects and arrays respectively.
Former-commit-id: aebb7a0004d804b7fd43d73e24d1da28c67f4059
2013-04-07 15:53:52 -07:00
John-David Dalton
93df901b71 Switch to using useLodashMethod in build.js and allow non-underscore builds to include _.chain and _.findWhere.
Former-commit-id: 6c99623286059caf7a74dd4a19394da3562d7932
2013-04-07 08:56:43 -07:00
John-David Dalton
e97e645eda Use nativeSlice when possible and adjust largeArraySize to account for the recent cachedContains tweaks.
Former-commit-id: 9fe4dc10c74fb7a4b8e5cff434a4146d274f15d4
2013-04-06 01:26:21 -07:00
John-David Dalton
4a03ba3874 Add more _.debounce and _.throttle tests.
Former-commit-id: db3cb30a8eac82850a056f85d0c363e752d10027
2013-04-05 22:14:44 -07:00
John-David Dalton
7f637e4acc Update builds, vendors, and docs.
Former-commit-id: 67aec5a64de61ac2b8948b31315395a727c10071
2013-04-05 09:04:01 -07:00
John-David Dalton
8f3eeefafd Should ensure callback is a function in _.isEqual.
Former-commit-id: b53f8e0ab1bafff395ff19cd069940ba6c37eb5f
2013-04-05 08:59:09 -07:00
John-David Dalton
5dc550a0ce Cleanup doc examples for _.find and _.findKey.
Former-commit-id: 198149aa9caf277b2a819ee5c06c73e38fa6beae
2013-04-05 08:35:07 -07:00
John-David Dalton
6fe322da27 Add an options object argument to _.debounce and _.throttle. [closes #222]
Former-commit-id: d5eb3bc21d4a5c6d25314153f98d43a3d11eb4fa
2013-04-04 08:52:42 -07:00
John-David Dalton
3cfe7c9a56 Reduce --time-limit in .travis.yml.
Former-commit-id: 8fcd6b73eafbbb7c23e29cd60ee75fc83577673b
2013-04-03 23:04:47 -07:00
John-David Dalton
be7d5917cb Update vendor/underscore.
Former-commit-id: d1cca79a4f6732ee8cd48dd4574041b4ebe19edf
2013-04-02 22:38:48 -07:00
John-David Dalton
ca28aa6ebd Tweak argument names and docs.
Former-commit-id: 38d7f9cc7dea76e038ede22b6c6b4e779e28237b
2013-04-02 22:37:40 -07:00
John-David Dalton
e76360c1b5 Add _.unzip. [closes #225]
Former-commit-id: 4b2c7fc068fd430f3d78de850a5f7670fd0e1a4e
2013-04-02 22:34:15 -07:00
John-David Dalton
265ca8ba67 Update docs and builds.
Former-commit-id: 6bb15d3ad0d4d189ad5e27e1dd79d2a070a568b2
2013-04-02 00:37:19 -07:00
John-David Dalton
b0d942d0ec Ensure _.merge applies a given callback to nested properties. [closes #227]
Former-commit-id: 1a58c178e0ecb9c50512f221b4aed82762709066
2013-04-01 23:54:09 -07:00
John-David Dalton
6c25905ae4 Add keyPrefix to avoid issues with __proto__. [closes #226]
Former-commit-id: 55dee782acdd5e28229b1fcb7587424d3fdfd445
2013-04-01 22:32:50 -07:00
John-David Dalton
80a39393fe Use toString.bind instead of slice.bind in nativeBind assignment.
Former-commit-id: f08d16b1fa8eb98cf848daff96f7449c0dc51c90
2013-03-30 22:07:24 -07:00
John-David Dalton
d4aed71abf Make Lo-Dash work with Browserify. [closes #223]
Former-commit-id: 33b53dd075d6c4ed9682881af463bdd3c241ca44
2013-03-29 19:04:20 -07:00
John-David Dalton
ebb72bb992 Remove useUnderscoreClone check from the underscore build _.toArray replacement.
Former-commit-id: 62777dbc108689aa7bd0e258e64341aad8fa6cb3
2013-03-27 19:43:37 -07:00
John-David Dalton
8ffcd30b4d Simplify license in package.json. [ci skip]
Former-commit-id: 1915ba400e5f45713a018d26081bb6666fb6683a
2013-03-27 19:37:56 -07:00
John-David Dalton
06804c37e2 Remove travis-ci badge from README.md.
Former-commit-id: f978ab7e86a15b4f599c3f20afd8e1b8cfe1183a
2013-03-27 09:47:27 -07:00
105 changed files with 3144 additions and 1978 deletions

4
.gitattributes vendored
View File

@@ -1 +1,5 @@
* text=auto * text=auto
*.js text eol=lf
*.jst text eol=lf
*.sh text eol=lf
*.tpl text eol=lf

7
.gitignore vendored
View File

@@ -1,5 +1,6 @@
.DS_Store .DS_Store
*.custom.* *.custom.*
node_modules/ *.map
vendor/closure-compiler/ node_modules
vendor/uglifyjs/ vendor/closure-compiler
vendor/uglifyjs

View File

@@ -1,12 +1,16 @@
.* .*
*.custom.* *.custom.*
*.d.ts
*.map
*.md *.md
*.txt *.txt
build.js build.js
index.js index.js
build/ bower.json
doc/ component.json
node_modules/ build
perf/ doc
test/ node_modules
vendor/ perf
test
vendor

View File

@@ -1,27 +1,25 @@
.* .*
*.custom.* *.custom.*
*.d.ts *.d.ts
CONTRIBUTING.md *.map
doc/*.php *.md
node_modules/ bower.json
perf/*.html component.json
perf/*-ui.js doc
perf/*.sh node_modules
test/*.html perf
test/*-ui.js test
test/*.sh
vendor/*.gz vendor/*.gz
vendor/backbone/ vendor/backbone
vendor/benchmark.js/*.jar vendor/benchmark.js
vendor/closure-compiler/ vendor/closure-compiler
vendor/docdown/ vendor/docdown
vendor/firebug-lite/ vendor/firebug-lite
vendor/json3/ vendor/jquery
vendor/jquery/ vendor/json3
vendor/platform.js/ vendor/platform.js
vendor/qunit/qunit/*.css vendor/qunit
vendor/qunit/qunit/*-1.8.0.js vendor/qunit-clib
vendor/requirejs/ vendor/requirejs
vendor/underscore/*-min.js vendor/uglifyjs
vendor/uglifyjs/ vendor/underscore
vendor/underscore/test/

View File

@@ -7,7 +7,7 @@ env:
- TEST_COMMAND="phantomjs ./test/test.js ../dist/lodash.compat.min.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.js"
- TEST_COMMAND="node ./test/test.js ../dist/lodash.min.js" - TEST_COMMAND="node ./test/test.js ../dist/lodash.min.js"
- TEST_COMMAND="node ./test/test-build.js --time-limit 49m40s" - TEST_COMMAND="node ./test/test-build.js --time-limit 49m30s"
git: git:
depth: 1 depth: 1
branches: branches:

View File

@@ -1,29 +1,28 @@
# Lo-Dash <sup>v1.1.1</sup> # Lo-Dash <sup>v1.2.1</sup>
[![build status](https://secure.travis-ci.org/bestiejs/lodash.png)](http://travis-ci.org/bestiejs/lodash)
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). 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 ## Download
* Lo-Dash builds (for modern environments):<br> * Lo-Dash builds (for modern environments):<br>
[Development](https://raw.github.com/bestiejs/lodash/v1.1.1/dist/lodash.js) and [Development](https://raw.github.com/bestiejs/lodash/v1.2.1/dist/lodash.js) and
[Production](https://raw.github.com/bestiejs/lodash/v1.1.1/dist/lodash.min.js) [Production](https://raw.github.com/bestiejs/lodash/v1.2.1/dist/lodash.min.js)
* Lo-Dash compatibility builds (for legacy and modern environments):<br> * Lo-Dash compatibility builds (for legacy and modern environments):<br>
[Development](https://raw.github.com/bestiejs/lodash/v1.1.1/dist/lodash.compat.js) and [Development](https://raw.github.com/bestiejs/lodash/v1.2.1/dist/lodash.compat.js) and
[Production](https://raw.github.com/bestiejs/lodash/v1.1.1/dist/lodash.compat.min.js) [Production](https://raw.github.com/bestiejs/lodash/v1.2.1/dist/lodash.compat.min.js)
* Underscore compatibility builds:<br> * Underscore compatibility builds:<br>
[Development](https://raw.github.com/bestiejs/lodash/v1.1.1/dist/lodash.underscore.js) and [Development](https://raw.github.com/bestiejs/lodash/v1.2.1/dist/lodash.underscore.js) and
[Production](https://raw.github.com/bestiejs/lodash/v1.1.1/dist/lodash.underscore.min.js) [Production](https://raw.github.com/bestiejs/lodash/v1.2.1/dist/lodash.underscore.min.js)
* CDN copies of ≤ v1.1.1s builds are available on [cdnjs](http://cdnjs.com/) thanks to [CloudFlare](http://www.cloudflare.com/):<br> * CDN copies of ≤ v1.2.1s 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.1.1/lodash.js), [Lo-Dash dev](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.2.1/lodash.js),
[Lo-Dash prod](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.1.1/lodash.min.js),<br> [Lo-Dash prod](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.2.1/lodash.min.js),<br>
[Lo-Dash compat-dev](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.1.1/lodash.compat.js), [Lo-Dash compat-dev](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.2.1/lodash.compat.js),
[Lo-Dash compat-prod](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.1.1/lodash.compat.min.js),<br> [Lo-Dash compat-prod](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.2.1/lodash.compat.min.js),<br>
[Underscore compat-dev](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.1.1/lodash.underscore.js), and [Underscore compat-dev](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.2.1/lodash.underscore.js), and
[Underscore compat-prod](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.1.1/lodash.underscore.min.js) [Underscore compat-prod](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.2.1/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 * For optimal file size, [create a custom build](https://github.com/bestiejs/lodash#custom-builds) with only the features you need
@@ -56,6 +55,7 @@ For more information check out these articles, screencasts, and other videos ove
* [_.bindKey](http://lodash.com/docs#bindKey) for binding [*“lazy”* defined](http://michaux.ca/articles/lazy-function-definition-pattern) methods * [_.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 * [_.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 * [_.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 * [_.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 * [_.forEach](http://lodash.com/docs#forEach) is chainable and supports exiting iteration early
@@ -68,6 +68,7 @@ For more information check out these articles, screencasts, and other videos ove
* [_.runInContext](http://lodash.com/docs#runInContext) for easier mocking and extended environment support * [_.runInContext](http://lodash.com/docs#runInContext) for easier mocking and extended environment support
* [_.support](http://lodash.com/docs#support) to flag environment features * [_.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) * [_.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 * [_.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), * [_.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 [and more…](http://lodash.com/docs "_.assign, _.cloneDeep, _.first, _.initial, _.isEqual, _.last, _.merge, _.rest") accept `callback` and `thisArg` arguments
@@ -78,22 +79,17 @@ For more information check out these articles, screencasts, and other videos ove
## Support ## Support
Lo-Dash has been tested in at least Chrome 5~25, Firefox 2~19, IE 6-10, Opera 9.25-12, Safari 3-6, Node.js 0.4.8-0.10.1, Narwhal 0.3.2, PhantomJS 1.8.1, RingoJS 0.9, and Rhino 1.7RC5. Lo-Dash has been tested in at least Chrome 5~26, Firefox 2~20, IE 6-10, Opera 9.25~12, Safari 3-6, Node.js 0.4.8-0.10.5, Narwhal 0.3.2, PhantomJS 1.9.0, RingoJS 0.9, and Rhino 1.7RC5.
## Custom builds ## Custom builds
Custom builds make it easy to create lightweight versions of Lo-Dash containing only the methods you need. Custom builds make it easy to create lightweight versions of Lo-Dash containing only the methods you need.
To top it off, we handle all method dependency and alias mapping for you. To top it off, we handle all method dependency and alias mapping for you.
For a more detailed summary over the differences between various builds, check out our [wiki entry](https://github.com/bestiejs/lodash/wiki/build-differences).
* Backbone builds, with only methods required by Backbone, may be created using the `backbone` modifier argument. * Backbone builds, with only methods required by Backbone, may be created using the `backbone` modifier argument.
```bash ```bash
lodash backbone lodash backbone
```
* CSP builds, supporting default [Content Security Policy](https://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 alias of the `mobile` modifier. Lo-Dash may be used in Chrome extensions by using either the `csp`, `mobile`, or `underscore` build and using precompiled templates, or loading Lo-Dash in a [sandbox](http://developer.chrome.com/stable/extensions/sandboxingEval.html).
```bash
lodash csp
``` ```
* Legacy builds, tailored for older environments 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.
@@ -175,7 +171,7 @@ lodash settings="{interpolate:/\{\{([\s\S]+?)\}\}/g}"
lodash moduleId="underscore" lodash moduleId="underscore"
``` ```
All arguments, except `legacy` with `csp`, `mobile`, `modern`, or `underscore`, 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. Unless specified by `-o` or `--output`, all files created are saved to the current working directory.
The following options are also supported: The following options are also supported:
@@ -252,24 +248,14 @@ require({
## Release Notes ## Release Notes
### <sup>v1.1.1</sup> ### <sup>v1.2.1</sup>
* Ensured the `underscore` build version of `_.forEach` accepts a `thisArg` argument * Added Component package support
* Updated vendor/tar to work with Node v0.10.x * Updated the build utility to work with changes in GitHubs API
* Ensured `_.isPlainObject` works with objects created by `Object.create(null)`
### <sup>v1.1.0</sup> * Ensured *“isType”* methods return `false` for subclassed values
* Ensured debounced functions, with `leading` and `trailing` calls enabled,<br>
* Added `rhino -require` support only perform trailing calls after theyre called more than once
* Added `_.createCallback`, `_findIndex`, `_.findKey`, `_.parseInt`, `_.runInContext`, and `_.support`
* Added support for `callback` and `thisArg` arguments to `_.flatten`
* Added CommonJS/Node support to precompiled templates
* Ensured the `exports` object is not a DOM element
* Ensured `_.isPlainObject` returns `false` for objects without a `[[Class]]` of “Object”
* Made `_.cloneDeep`s `callback` support more closely follow its documentation
* Made the template precompiler create nonexistent directories of `--output` paths
* Made `_.object` an alias of `_.zipObject`
* Optimized method chaining, object iteration, `_.find`, and `_.pluck` (an average of 18% overall better performance)
* Updated `backbone` build Lo-Dash method dependencies
The full changelog is available [here](https://github.com/bestiejs/lodash/wiki/Changelog). The full changelog is available [here](https://github.com/bestiejs/lodash/wiki/Changelog).
@@ -279,12 +265,12 @@ Lo-Dash is part of the BestieJS *“Best in Class”* module collection. This me
## Author ## Author
* [John-David Dalton](http://allyoucanleet.com/) | [![twitter/jdalton](http://gravatar.com/avatar/299a3d891ff1920b69c364d061007043?s=70)](http://twitter.com/jdalton "Follow @jdalton on Twitter") |
[![twitter/jdalton](http://gravatar.com/avatar/299a3d891ff1920b69c364d061007043?s=70)](https://twitter.com/jdalton "Follow @jdalton on Twitter") |---|
| [John-David Dalton](http://allyoucanleet.com/) |
## Contributors ## Contributors
* [Kit Cambridge](http://kitcambridge.github.com/) | [![twitter/kitcambridge](http://gravatar.com/avatar/6662a1d02f351b5ef2f8b4d815804661?s=70)](https://twitter.com/kitcambridge "Follow @kitcambridge on Twitter") | [![twitter/mathias](http://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](http://twitter.com/mathias "Follow @mathias on Twitter") |
[![twitter/kitcambridge](http://gravatar.com/avatar/6662a1d02f351b5ef2f8b4d815804661?s=70)](https://twitter.com/kitcambridge "Follow @kitcambridge on Twitter") |---|---|
* [Mathias Bynens](http://mathiasbynens.be/) | [Kit Cambridge](http://kitcambridge.github.io/) | [Mathias Bynens](http://mathiasbynens.be/) |
[![twitter/mathias](http://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](https://twitter.com/mathias "Follow @mathias on Twitter")

23
bower.json Normal file
View File

@@ -0,0 +1,23 @@
{
"name": "lodash",
"version": "1.2.1",
"main": "./dist/lodash.compat.js",
"ignore": [
".*",
"*.custom.*",
"*.d.ts",
"*.map",
"*.md",
"*.txt",
"build.js",
"index.js",
"component.json",
"package.json",
"build",
"doc",
"node_modules",
"perf",
"test",
"vendor"
]
}

919
build.js

File diff suppressed because it is too large Load Diff

View File

@@ -3,30 +3,26 @@
'use strict'; 'use strict';
/** Load Node.js modules */ /** Load Node.js modules */
var fs = require('fs'), var https = require('https'),
https = require('https'),
path = require('path'),
spawn = require('child_process').spawn, spawn = require('child_process').spawn,
zlib = require('zlib'); zlib = require('zlib');
/** Load other modules */ /** Load other modules */
var _ = require('../lodash.js'), var _ = require('../lodash.js'),
mkdirpSync = require('./mkdirp-sync.js'),
preprocess = require('./pre-compile.js'), preprocess = require('./pre-compile.js'),
postprocess = require('./post-compile.js'), postprocess = require('./post-compile.js'),
tar = require('../vendor/tar/tar.js'); tar = require('../vendor/tar/tar.js'),
util = require('./util.js');
/** Add `fs.existsSync` for older versions of Node.js */ /** Module shortcuts */
fs.existsSync || (fs.existsSync = path.existsSync); var fs = util.fs,
path = util.path;
/** Add `path.sep` for older versions of Node.js */
path.sep || (path.sep = process.platform == 'win32' ? '\\' : '/');
/** The Git object ID of `closure-compiler.tar.gz` */ /** The Git object ID of `closure-compiler.tar.gz` */
var closureId = 'a95a8007892aa824ce90c6aa3d3abb0489bf0fff'; var closureId = '7815712f73ccb21f587bf3fb72a2f50be788515d';
/** The Git object ID of `uglifyjs.tar.gz` */ /** The Git object ID of `uglifyjs.tar.gz` */
var uglifyId = '41308bd569db41a32d4f08af115875d0342e8bfb'; var uglifyId = 'fb620e8672ad194b3ab501790e19c40c8ac79286';
/** The path of the directory that is the base of the repository */ /** The path of the directory that is the base of the repository */
var basePath = fs.realpathSync(path.join(__dirname, '..')); var basePath = fs.realpathSync(path.join(__dirname, '..'));
@@ -47,7 +43,7 @@
var mediaType = 'application/vnd.github.v3.raw'; var mediaType = 'application/vnd.github.v3.raw';
/** Used to detect the Node.js executable in command-line arguments */ /** Used to detect the Node.js executable in command-line arguments */
var reNode = RegExp('(?:^|' + path.sep + ')node(?:\\.exe)?$'); var reNode = RegExp('(?:^|' + path.sepEscaped + ')node(?:\\.exe)?$');
/** Used to reference parts of the blob href */ /** Used to reference parts of the blob href */
var location = (function() { var location = (function() {
@@ -146,7 +142,7 @@
if (/-o|--output/.test(value)) { if (/-o|--output/.test(value)) {
result = options[index + 1]; result = options[index + 1];
var dirname = path.dirname(result); var dirname = path.dirname(result);
mkdirpSync(dirname); fs.mkdirpSync(dirname);
result = path.join(fs.realpathSync(dirname), path.basename(result)); result = path.join(fs.realpathSync(dirname), path.basename(result));
} }
return result; return result;
@@ -314,7 +310,10 @@
// containing Base64-encoded blob data. Overriding the `Accept` header // containing Base64-encoded blob data. Overriding the `Accept` header
// with the GitHub raw media type returns the blob data directly. // with the GitHub raw media type returns the blob data directly.
// See http://developer.github.com/v3/media/. // See http://developer.github.com/v3/media/.
'Accept': mediaType 'Accept': mediaType,
// As of 2013-04-24, the GitHub API mandates the `User-Agent` header
// for all requests.
'User-Agent': 'Lo-Dash/' + _.VERSION
} }
}, function(response) { }, function(response) {
var decompressor = zlib.createUnzip(), var decompressor = zlib.createUnzip(),

View File

@@ -1,43 +0,0 @@
#!/usr/bin/env node
;(function() {
'use strict';
/** Load Node.js modules */
var fs = require('fs'),
path = require('path');
/** Add `path.sep` for older versions of Node.js */
path.sep || (path.sep = process.platform == 'win32' ? '\\' : '/');
/*--------------------------------------------------------------------------*/
/**
* Makes the given `dirname` directory, without throwing errors for existing
* directories and making parent directories as needed.
*
* @param {String} dirname The path of the directory.
* @param {Number|String} [mode='0777'] The permission mode.
*/
function mkdirpSync(dirname, mode) {
var sep = path.sep;
// ensure relative paths are prefixed with `./`
if (!RegExp('^\\.?' + sep).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;
});
}
/*--------------------------------------------------------------------------*/
// expose
module.exports = mkdirpSync;
}());

View File

@@ -27,14 +27,15 @@
// remove copyright header // remove copyright header
source = source.replace(/^\/\**[\s\S]+?\*\/\n/, ''); source = source.replace(/^\/\**[\s\S]+?\*\/\n/, '');
// correct overly aggressive Closure Compiler advanced optimizations // correct overly aggressive Closure Compiler advanced optimization
source = source source = source
.replace(/prototype\s*=\s*{\s*valueOf\s*:\s*1\s*}/, 'prototype={valueOf:1,y:1}')
.replace(/(document[^&]+&&)\s*(?:\w+|!\d)/, '$1!({toString:0}+"")') .replace(/(document[^&]+&&)\s*(?:\w+|!\d)/, '$1!({toString:0}+"")')
.replace(/"\t"/g, '"\\t"')
source = source.replace(/(\w+\.prototype\s*=\s*)\w+(?=\.prototype;)/, function(match, left) { .replace(/"[^"]*?\\u180e[^"]*?"/g,
return left + /\w+(?=\.VERSION)/.exec(source); '" \\t\\x0B\\f\\xa0\\ufeff' +
}); '\\n\\r\\u2028\\u2029' +
'\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000"'
);
// flip `typeof` expressions to help optimize Safari and // flip `typeof` expressions to help optimize Safari and
// correct the AMD module definition for AMD build optimizers // correct the AMD module definition for AMD build optimizers

View File

@@ -156,6 +156,7 @@
'keys', 'keys',
'last', 'last',
'lastIndexOf', 'lastIndexOf',
'leading',
'map', 'map',
'max', 'max',
'memoize', 'memoize',
@@ -204,16 +205,19 @@
'throttle', 'throttle',
'times', 'times',
'toArray', 'toArray',
'trailing',
'unescape', 'unescape',
'unindexedChars', 'unindexedChars',
'union', 'union',
'uniq', 'uniq',
'unique', 'unique',
'uniqueId', 'uniqueId',
'unzip',
'value', 'value',
'values', 'values',
'variable', 'variable',
'where', 'where',
'window',
'without', 'without',
'wrap', 'wrap',
'zip', 'zip',

98
build/util.js Executable file
View 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;
}());

20
component.json Normal file
View File

@@ -0,0 +1,20 @@
{
"name": "lodash",
"repo": "bestiejs/lodash",
"version": "1.2.1",
"description": "A low-level utility library delivering consistency, customization, performance, and extra features.",
"license": "MIT",
"scripts": [
"./index.js",
"./dist/lodash.compat.js"
],
"keywords": [
"browser",
"client",
"functional",
"performance",
"server",
"speed",
"util"
]
}

369
dist/lodash.compat.js vendored
View File

@@ -1,6 +1,6 @@
/** /**
* @license * @license
* Lo-Dash 1.1.1 (Custom Build) <http://lodash.com/> * Lo-Dash 1.2.1 (Custom Build) <http://lodash.com/>
* Build: `lodash -o ./dist/lodash.compat.js` * Build: `lodash -o ./dist/lodash.compat.js`
* Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/> * Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/>
* Based on Underscore.js 1.4.4 <http://underscorejs.org/> * Based on Underscore.js 1.4.4 <http://underscorejs.org/>
@@ -18,9 +18,9 @@
/** Detect free variable `module` */ /** Detect free variable `module` */
var freeModule = typeof module == 'object' && module && module.exports == freeExports && module; var freeModule = typeof module == 'object' && module && module.exports == freeExports && module;
/** Detect free variable `global` and use it as `window` */ /** Detect free variable `global`, from Node.js or Browserified code, and use it as `window` */
var freeGlobal = typeof global == 'object' && global; var freeGlobal = typeof global == 'object' && global;
if (freeGlobal.global === freeGlobal) { if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {
window = freeGlobal; window = freeGlobal;
} }
@@ -30,6 +30,12 @@
/** Used internally to indicate various things */ /** Used internally to indicate various things */
var indicatorObject = {}; var indicatorObject = {};
/** Used to prefix keys to avoid issues with `__proto__` and properties on `Object.prototype` */
var keyPrefix = +new Date + '';
/** Used as the size when optimizations are enabled for large arrays */
var largeArraySize = 200;
/** Used to match empty string literals in compiled template source */ /** Used to match empty string literals in compiled template source */
var reEmptyStringLeading = /\b__p \+= '';/g, var reEmptyStringLeading = /\b__p \+= '';/g,
reEmptyStringMiddle = /\b(__p \+=) '' \+/g, reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
@@ -50,8 +56,20 @@
/** Used to match "interpolate" template delimiters */ /** Used to match "interpolate" template delimiters */
var reInterpolate = /<%=([\s\S]+?)%>/g; var reInterpolate = /<%=([\s\S]+?)%>/g;
/** Used to match leading zeros to be removed */ /** Used to detect and test whitespace */
var reLeadingZeros = /^0+(?=.$)/; var whitespace = (
// whitespace
' \t\x0B\f\xA0\ufeff' +
// line terminators
'\n\r\u2028\u2029' +
// unicode category "Zs" space separators
'\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000'
);
/** Used to match leading whitespace and zeros to be removed */
var reLeadingSpacesAndZeros = RegExp('^[' + whitespace + ']*0+(?=.$)');
/** Used to ensure capturing order of template delimiters */ /** Used to ensure capturing order of template delimiters */
var reNoMatch = /($^)/; var reNoMatch = /($^)/;
@@ -175,7 +193,7 @@
toString = objectRef.toString; toString = objectRef.toString;
/* Native method shortcuts for methods with the same name as other `lodash` methods */ /* Native method shortcuts for methods with the same name as other `lodash` methods */
var nativeBind = reNative.test(nativeBind = slice.bind) && nativeBind, var nativeBind = reNative.test(nativeBind = toString.bind) && nativeBind,
nativeIsArray = reNative.test(nativeIsArray = Array.isArray) && nativeIsArray, nativeIsArray = reNative.test(nativeIsArray = Array.isArray) && nativeIsArray,
nativeIsFinite = context.isFinite, nativeIsFinite = context.isFinite,
nativeIsNaN = context.isNaN, nativeIsNaN = context.isNaN,
@@ -183,7 +201,8 @@
nativeMax = Math.max, nativeMax = Math.max,
nativeMin = Math.min, nativeMin = Math.min,
nativeParseInt = context.parseInt, nativeParseInt = context.parseInt,
nativeRandom = Math.random; nativeRandom = Math.random,
nativeSlice = arrayRef.slice;
/** Detect various environments */ /** Detect various environments */
var isIeOpera = reNative.test(context.attachEvent), var isIeOpera = reNative.test(context.attachEvent),
@@ -202,7 +221,7 @@
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
/** /**
* Creates a `lodash` object, that wraps the given `value`, to enable method * Creates a `lodash` object, which wraps the given `value`, to enable method
* chaining. * chaining.
* *
* In addition to Lo-Dash methods, wrappers also have the following `Array` methods: * In addition to Lo-Dash methods, wrappers also have the following `Array` methods:
@@ -220,8 +239,8 @@
* `invoke`, `keys`, `map`, `max`, `memoize`, `merge`, `min`, `object`, `omit`, * `invoke`, `keys`, `map`, `max`, `memoize`, `merge`, `min`, `object`, `omit`,
* `once`, `pairs`, `partial`, `partialRight`, `pick`, `pluck`, `push`, `range`, * `once`, `pairs`, `partial`, `partialRight`, `pick`, `pluck`, `push`, `range`,
* `reject`, `rest`, `reverse`, `shuffle`, `slice`, `sort`, `sortBy`, `splice`, * `reject`, `rest`, `reverse`, `shuffle`, `slice`, `sort`, `sortBy`, `splice`,
* `tap`, `throttle`, `times`, `toArray`, `union`, `uniq`, `unshift`, `values`, * `tap`, `throttle`, `times`, `toArray`, `union`, `uniq`, `unshift`, `unzip`,
* `where`, `without`, `wrap`, and `zip` * `values`, `where`, `without`, `wrap`, and `zip`
* *
* The non-chainable wrapper functions are: * The non-chainable wrapper functions are:
* `clone`, `cloneDeep`, `contains`, `escape`, `every`, `find`, `has`, * `clone`, `cloneDeep`, `contains`, `escape`, `every`, `find`, `has`,
@@ -240,6 +259,26 @@
* @category Chaining * @category Chaining
* @param {Mixed} value The value to wrap in a `lodash` instance. * @param {Mixed} value The value to wrap in a `lodash` instance.
* @returns {Object} Returns a `lodash` instance. * @returns {Object} Returns a `lodash` instance.
* @example
*
* var wrapped = _([1, 2, 3]);
*
* // returns an unwrapped value
* wrapped.reduce(function(sum, num) {
* return sum + num;
* });
* // => 6
*
* // returns a wrapped value
* var squares = wrapped.map(function(num) {
* return num * num;
* });
*
* _.isArray(squares);
* // => false
*
* _.isArray(squares.value());
* // => true
*/ */
function lodash(value) { function lodash(value) {
// don't wrap if already wrapped, even if wrapped by a different `lodash` constructor // don't wrap if already wrapped, even if wrapped by a different `lodash` constructor
@@ -267,12 +306,12 @@
for (prop in arguments) { } for (prop in arguments) { }
/** /**
* Detect if `arguments` objects are `Object` objects (all but Opera < 10.5). * Detect if `arguments` objects are `Object` objects (all but Narwhal and Opera < 10.5).
* *
* @memberOf _.support * @memberOf _.support
* @type Boolean * @type Boolean
*/ */
support.argsObject = arguments.constructor == Object; support.argsObject = arguments.constructor == Object && !(arguments instanceof Array);
/** /**
* Detect if an `arguments` object's [[Class]] is resolvable (all but Firefox < 4, IE < 9). * Detect if an `arguments` object's [[Class]] is resolvable (all but Firefox < 4, IE < 9).
@@ -438,7 +477,7 @@
* The template used to create iterator functions. * The template used to create iterator functions.
* *
* @private * @private
* @param {Obect} data The data object used to populate the text. * @param {Object} data The data object used to populate the text.
* @returns {String} Returns the interpolated text. * @returns {String} Returns the interpolated text.
*/ */
var iteratorTemplate = function(obj) { var iteratorTemplate = function(obj) {
@@ -566,31 +605,27 @@
* @private * @private
* @param {Array} array The array to search. * @param {Array} array The array to search.
* @param {Mixed} value The value to search for. * @param {Mixed} value The value to search for.
* @param {Number} fromIndex The index to search from.
* @param {Number} largeSize The length at which an array is considered large.
* @returns {Boolean} Returns `true`, if `value` is found, else `false`. * @returns {Boolean} Returns `true`, if `value` is found, else `false`.
*/ */
function cachedContains(array, fromIndex, largeSize) { function cachedContains(array) {
var length = array.length, var length = array.length,
isLarge = (length - fromIndex) >= largeSize; isLarge = length >= largeArraySize;
if (isLarge) { if (isLarge) {
var cache = {}, var cache = {},
index = fromIndex - 1; index = -1;
while (++index < length) { while (++index < length) {
// manually coerce `value` to a string because `hasOwnProperty`, in some var key = keyPrefix + array[index];
// older versions of Firefox, coerces objects incorrectly (cache[key] || (cache[key] = [])).push(array[index]);
var key = String(array[index]);
(hasOwnProperty.call(cache, key) ? cache[key] : (cache[key] = [])).push(array[index]);
} }
} }
return function(value) { return function(value) {
if (isLarge) { if (isLarge) {
var key = String(value); var key = keyPrefix + value;
return hasOwnProperty.call(cache, key) && indexOf(cache[key], value) > -1; return cache[key] && indexOf(cache[key], value) > -1;
} }
return indexOf(array, value, fromIndex) > -1; return indexOf(array, value) > -1;
} }
} }
@@ -676,7 +711,7 @@
} }
if (partialArgs.length) { if (partialArgs.length) {
args = args.length args = args.length
? (args = slice(args), rightIndicator ? args.concat(partialArgs) : partialArgs.concat(args)) ? (args = nativeSlice.call(args), rightIndicator ? args.concat(partialArgs) : partialArgs.concat(args))
: partialArgs; : partialArgs;
} }
if (this instanceof bound) { if (this instanceof bound) {
@@ -702,6 +737,7 @@
* @param {Object} [options1, options2, ...] The compile options object(s). * @param {Object} [options1, options2, ...] The compile options object(s).
* arrays - A string of code to determine if the iterable is an array or array-like. * arrays - A string of code to determine if the iterable is an array or array-like.
* useHas - A boolean to specify using `hasOwnProperty` checks in the object loop. * useHas - A boolean to specify using `hasOwnProperty` checks in the object loop.
* useKeys - A boolean to specify using `_.keys` for own property iteration.
* args - A string of comma separated arguments the iteration function will accept. * args - A string of comma separated arguments the iteration function will accept.
* top - A string of code to execute before the iteration branches. * top - A string of code to execute before the iteration branches.
* loop - A string of code to execute in the object loop. * loop - A string of code to execute in the object loop.
@@ -803,7 +839,7 @@
} }
/** /**
* A fallback implementation of `isPlainObject` that checks if a given `value` * A fallback implementation of `isPlainObject` which checks if a given `value`
* is an object created by the `Object` constructor, assuming objects created * is an object created by the `Object` constructor, assuming objects created
* by the `Object` constructor have no inherited enumerable properties and that * by the `Object` constructor have no inherited enumerable properties and that
* there are no `Object.prototype` extensions. * there are no `Object.prototype` extensions.
@@ -927,13 +963,11 @@
* // => true * // => true
*/ */
var isArray = nativeIsArray || function(value) { var isArray = nativeIsArray || function(value) {
// `instanceof` may cause a memory leak in IE 7 if `value` is a host object return value ? (typeof value == 'object' && toString.call(value) == arrayClass) : false;
// http://ajaxian.com/archives/working-aroung-the-instanceof-memory-leak
return (support.argsObject && value instanceof Array) || toString.call(value) == arrayClass;
}; };
/** /**
* A fallback implementation of `Object.keys` that produces an array of the * A fallback implementation of `Object.keys` which produces an array of the
* given object's own enumerable property names. * given object's own enumerable property names.
* *
* @private * @private
@@ -1253,7 +1287,7 @@
* @static * @static
* @memberOf _ * @memberOf _
* @category Objects * @category Objects
* @param {Array|Object|String} collection The collection to iterate over. * @param {Object} object The object to search.
* @param {Function|Object|String} [callback=identity] The function called per * @param {Function|Object|String} [callback=identity] The function called per
* iteration. If a property name or object is passed, it will be used to create * iteration. If a property name or object is passed, it will be used to create
* a "_.pluck" or "_.where" style callback, respectively. * a "_.pluck" or "_.where" style callback, respectively.
@@ -1261,14 +1295,16 @@
* @returns {Mixed} Returns the key of the found element, else `undefined`. * @returns {Mixed} Returns the key of the found element, else `undefined`.
* @example * @example
* *
* _.findKey({ 'a': 1, 'b': 2, 'c': 3, 'd': 4 }, function(num) { return num % 2 == 0; }); * _.findKey({ 'a': 1, 'b': 2, 'c': 3, 'd': 4 }, function(num) {
* return num % 2 == 0;
* });
* // => 'b' * // => 'b'
*/ */
function findKey(collection, callback, thisArg) { function findKey(object, callback, thisArg) {
var result; var result;
callback = lodash.createCallback(callback, thisArg); callback = lodash.createCallback(callback, thisArg);
forOwn(collection, function(value, key, collection) { forOwn(object, function(value, key, object) {
if (callback(value, key, collection)) { if (callback(value, key, object)) {
result = key; result = key;
return false; return false;
} }
@@ -1433,7 +1469,7 @@
* // => true * // => true
*/ */
function isDate(value) { function isDate(value) {
return value instanceof Date || toString.call(value) == dateClass; return value ? (typeof value == 'object' && toString.call(value) == dateClass) : false;
} }
/** /**
@@ -1536,11 +1572,8 @@
function isEqual(a, b, callback, thisArg, stackA, stackB) { function isEqual(a, b, callback, thisArg, stackA, stackB) {
// used to indicate that when comparing objects, `a` has at least the properties of `b` // used to indicate that when comparing objects, `a` has at least the properties of `b`
var whereIndicator = callback === indicatorObject; var whereIndicator = callback === indicatorObject;
if (callback && !whereIndicator) { if (typeof callback == 'function' && !whereIndicator) {
callback = (typeof thisArg == 'undefined') callback = lodash.createCallback(callback, thisArg, 2);
? callback
: lodash.createCallback(callback, thisArg, 2);
var result = callback(a, b); var result = callback(a, b);
if (typeof result != 'undefined') { if (typeof result != 'undefined') {
return !!result; return !!result;
@@ -1740,7 +1773,7 @@
// fallback for older versions of Chrome and Safari // fallback for older versions of Chrome and Safari
if (isFunction(/x/)) { if (isFunction(/x/)) {
isFunction = function(value) { isFunction = function(value) {
return value instanceof Function || toString.call(value) == funcClass; return typeof value == 'function' && toString.call(value) == funcClass;
}; };
} }
@@ -1890,7 +1923,7 @@
* // => true * // => true
*/ */
function isRegExp(value) { function isRegExp(value) {
return value instanceof RegExp || toString.call(value) == regexpClass; return value ? (objectTypes[typeof value] && toString.call(value) == regexpClass) : false;
} }
/** /**
@@ -2026,22 +2059,24 @@
} }
} }
if (!found) { if (!found) {
value = isArr var isShallow;
? (isArray(value) ? value : [])
: (isPlainObject(value) ? value : {});
if (callback) { if (callback) {
result = callback(value, source); result = callback(value, source);
if (typeof result != 'undefined') { if ((isShallow = typeof result != 'undefined')) {
value = result; value = result;
} }
} }
if (!isShallow) {
value = isArr
? (isArray(value) ? value : [])
: (isPlainObject(value) ? value : {});
}
// add `source` and associated `value` to the stack of traversed objects // add `source` and associated `value` to the stack of traversed objects
stackA.push(source); stackA.push(source);
stackB.push(value); stackB.push(value);
// recursively merge objects and arrays (susceptible to call stack limits) // recursively merge objects and arrays (susceptible to call stack limits)
if (!callback) { if (!isShallow) {
value = merge(value, source, indicatorObject, callback, stackA, stackB); value = merge(value, source, indicatorObject, callback, stackA, stackB);
} }
} }
@@ -2096,12 +2131,12 @@
if (isFunc) { if (isFunc) {
callback = lodash.createCallback(callback, thisArg); callback = lodash.createCallback(callback, thisArg);
} else { } else {
var props = concat.apply(arrayRef, arguments); var props = concat.apply(arrayRef, nativeSlice.call(arguments, 1));
} }
forIn(object, function(value, key, object) { forIn(object, function(value, key, object) {
if (isFunc if (isFunc
? !callback(value, key, object) ? !callback(value, key, object)
: indexOf(props, key, 1) < 0 : indexOf(props, key) < 0
) { ) {
result[key] = value; result[key] = value;
} }
@@ -2164,8 +2199,8 @@
function pick(object, callback, thisArg) { function pick(object, callback, thisArg) {
var result = {}; var result = {};
if (typeof callback != 'function') { if (typeof callback != 'function') {
var index = 0, var index = -1,
props = concat.apply(arrayRef, arguments), props = concat.apply(arrayRef, nativeSlice.call(arguments, 1)),
length = isObject(object) ? props.length : 0; length = isObject(object) ? props.length : 0;
while (++index < length) { while (++index < length) {
@@ -2235,7 +2270,7 @@
*/ */
function at(collection) { function at(collection) {
var index = -1, var index = -1,
props = concat.apply(arrayRef, slice(arguments, 1)), props = concat.apply(arrayRef, nativeSlice.call(arguments, 1)),
length = props.length, length = props.length,
result = Array(length); result = Array(length);
@@ -2490,7 +2525,9 @@
* @returns {Mixed} Returns the found element, else `undefined`. * @returns {Mixed} Returns the found element, else `undefined`.
* @example * @example
* *
* _.find([1, 2, 3, 4], function(num) { return num % 2 == 0; }); * _.find([1, 2, 3, 4], function(num) {
* return num % 2 == 0;
* });
* // => 2 * // => 2
* *
* var food = [ * var food = [
@@ -2638,7 +2675,7 @@
* // => [['1', '2', '3'], ['4', '5', '6']] * // => [['1', '2', '3'], ['4', '5', '6']]
*/ */
function invoke(collection, methodName) { function invoke(collection, methodName) {
var args = slice(arguments, 2), var args = nativeSlice.call(arguments, 2),
index = -1, index = -1,
isFunc = typeof methodName == 'function', isFunc = typeof methodName == 'function',
length = collection ? collection.length : 0, length = collection ? collection.length : 0,
@@ -2868,7 +2905,7 @@
var pluck = map; var pluck = map;
/** /**
* Reduces a `collection` to a value that is the accumulated result of running * Reduces a `collection` to a value which is the accumulated result of running
* each element in the `collection` through the `callback`, where each successive * each element in the `collection` through the `callback`, where each successive
* `callback` execution consumes the return value of the previous execution. * `callback` execution consumes the return value of the previous execution.
* If `accumulator` is not passed, the first element of the `collection` will be * If `accumulator` is not passed, the first element of the `collection` will be
@@ -3275,8 +3312,8 @@
function difference(array) { function difference(array) {
var index = -1, var index = -1,
length = array ? array.length : 0, length = array ? array.length : 0,
flattened = concat.apply(arrayRef, arguments), flattened = concat.apply(arrayRef, nativeSlice.call(arguments, 1)),
contains = cachedContains(flattened, length, 100), contains = cachedContains(flattened),
result = []; result = [];
while (++index < length) { while (++index < length) {
@@ -3295,7 +3332,7 @@
* @static * @static
* @memberOf _ * @memberOf _
* @category Arrays * @category Arrays
* @param {Array|Object|String} collection The collection to iterate over. * @param {Array} array The array to search.
* @param {Function|Object|String} [callback=identity] The function called per * @param {Function|Object|String} [callback=identity] The function called per
* iteration. If a property name or object is passed, it will be used to create * iteration. If a property name or object is passed, it will be used to create
* a "_.pluck" or "_.where" style callback, respectively. * a "_.pluck" or "_.where" style callback, respectively.
@@ -3303,16 +3340,18 @@
* @returns {Mixed} Returns the index of the found element, else `-1`. * @returns {Mixed} Returns the index of the found element, else `-1`.
* @example * @example
* *
* _.findIndex(['apple', 'banana', 'beet'], function(food) { return /^b/.test(food); }); * _.findIndex(['apple', 'banana', 'beet'], function(food) {
* return /^b/.test(food);
* });
* // => 1 * // => 1
*/ */
function findIndex(collection, callback, thisArg) { function findIndex(array, callback, thisArg) {
var index = -1, var index = -1,
length = collection ? collection.length : 0; length = array ? array.length : 0;
callback = lodash.createCallback(callback, thisArg); callback = lodash.createCallback(callback, thisArg);
while (++index < length) { while (++index < length) {
if (callback(collection[index], index, collection)) { if (callback(array[index], index, array)) {
return index; return index;
} }
} }
@@ -3400,7 +3439,7 @@
/** /**
* Flattens a nested array (the nesting can be to any depth). If `isShallow` * Flattens a nested array (the nesting can be to any depth). If `isShallow`
* is truthy, `array` will only be flattened a single level. If `callback` * is truthy, `array` will only be flattened a single level. If `callback`
* is passed, each element of `array` is passed through a callback` before * is passed, each element of `array` is passed through a `callback` before
* flattening. The `callback` is bound to `thisArg` and invoked with three * flattening. The `callback` is bound to `thisArg` and invoked with three
* arguments; (value, index, array). * arguments; (value, index, array).
* *
@@ -3414,7 +3453,7 @@
* @static * @static
* @memberOf _ * @memberOf _
* @category Arrays * @category Arrays
* @param {Array} array The array to compact. * @param {Array} array The array to flatten.
* @param {Boolean} [isShallow=false] A flag to indicate only flattening a single level. * @param {Boolean} [isShallow=false] A flag to indicate only flattening a single level.
* @param {Function|Object|String} [callback=identity] The function called per * @param {Function|Object|String} [callback=identity] The function called per
* iteration. If a property name or object is passed, it will be used to create * iteration. If a property name or object is passed, it will be used to create
@@ -3605,7 +3644,7 @@
cache = { '0': {} }, cache = { '0': {} },
index = -1, index = -1,
length = array ? array.length : 0, length = array ? array.length : 0,
isLarge = length >= 100, isLarge = length >= largeArraySize,
result = [], result = [],
seen = result; seen = result;
@@ -3613,8 +3652,8 @@
while (++index < length) { while (++index < length) {
var value = array[index]; var value = array[index];
if (isLarge) { if (isLarge) {
var key = String(value); var key = keyPrefix + value;
var inited = hasOwnProperty.call(cache[0], key) var inited = cache[0][key]
? !(seen = cache[0][key]) ? !(seen = cache[0][key])
: (seen = cache[0][key] = []); : (seen = cache[0][key] = []);
} }
@@ -3624,7 +3663,7 @@
} }
var argsIndex = argsLength; var argsIndex = argsLength;
while (--argsIndex) { while (--argsIndex) {
if (!(cache[argsIndex] || (cache[argsIndex] = cachedContains(args[argsIndex], 0, 100)))(value)) { if (!(cache[argsIndex] || (cache[argsIndex] = cachedContains(args[argsIndex])))(value)) {
continue outer; continue outer;
} }
} }
@@ -3885,7 +3924,7 @@
* @static * @static
* @memberOf _ * @memberOf _
* @category Arrays * @category Arrays
* @param {Array} array The array to iterate over. * @param {Array} array The array to inspect.
* @param {Mixed} value The value to evaluate. * @param {Mixed} value The value to evaluate.
* @param {Function|Object|String} [callback=identity] The function called per * @param {Function|Object|String} [callback=identity] The function called per
* iteration. If a property name or object is passed, it will be used to create * iteration. If a property name or object is passed, it will be used to create
@@ -3948,7 +3987,10 @@
* _.union([1, 2, 3], [101, 2, 1, 10], [2, 1]); * _.union([1, 2, 3], [101, 2, 1, 10], [2, 1]);
* // => [1, 2, 3, 101, 10] * // => [1, 2, 3, 101, 10]
*/ */
function union() { function union(array) {
if (!isArray(array)) {
arguments[0] = array ? nativeSlice.call(array) : arrayRef;
}
return uniq(concat.apply(arrayRef, arguments)); return uniq(concat.apply(arrayRef, arguments));
} }
@@ -3956,7 +3998,7 @@
* Creates a duplicate-value-free version of the `array` using strict equality * Creates a duplicate-value-free version of the `array` using strict equality
* for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` * for comparisons, i.e. `===`. If the `array` is already sorted, passing `true`
* for `isSorted` will run a faster algorithm. If `callback` is passed, each * for `isSorted` will run a faster algorithm. If `callback` is passed, each
* element of `array` is passed through a callback` before uniqueness is computed. * element of `array` is passed through a `callback` before uniqueness is computed.
* The `callback` is bound to `thisArg` and invoked with three arguments; (value, index, array). * The `callback` is bound to `thisArg` and invoked with three arguments; (value, index, array).
* *
* If a property name is passed for `callback`, the created "_.pluck" style * If a property name is passed for `callback`, the created "_.pluck" style
@@ -4008,7 +4050,7 @@
isSorted = false; isSorted = false;
} }
// init value cache for large arrays // init value cache for large arrays
var isLarge = !isSorted && length >= 75; var isLarge = !isSorted && length >= largeArraySize;
if (isLarge) { if (isLarge) {
var cache = {}; var cache = {};
} }
@@ -4021,8 +4063,8 @@
computed = callback ? callback(value, index, array) : value; computed = callback ? callback(value, index, array) : value;
if (isLarge) { if (isLarge) {
var key = String(computed); var key = keyPrefix + computed;
var inited = hasOwnProperty.call(cache, key) var inited = cache[key]
? !(seen = cache[key]) ? !(seen = cache[key])
: (seen = cache[key] = []); : (seen = cache[key] = []);
} }
@@ -4039,6 +4081,37 @@
return result; return result;
} }
/**
* The inverse of `_.zip`, this method splits groups of elements into arrays
* composed of elements from each group at their corresponding indexes.
*
* @static
* @memberOf _
* @category Arrays
* @param {Array} array The array to process.
* @returns {Array} Returns a new array of the composed arrays.
* @example
*
* _.unzip([['moe', 30, true], ['larry', 40, false]]);
* // => [['moe', 'larry'], [30, 40], [true, false]];
*/
function unzip(array) {
var index = -1,
length = array ? array.length : 0,
tupleLength = length ? max(pluck(array, 'length')) : 0,
result = Array(tupleLength);
while (++index < length) {
var tupleIndex = -1,
tuple = array[index];
while (++tupleIndex < tupleLength) {
(result[tupleIndex] || (result[tupleIndex] = Array(length)))[index] = tuple[tupleIndex];
}
}
return result;
}
/** /**
* Creates an array with all occurrences of the passed values removed using * Creates an array with all occurrences of the passed values removed using
* strict equality for comparisons, i.e. `===`. * strict equality for comparisons, i.e. `===`.
@@ -4055,18 +4128,7 @@
* // => [2, 3, 4] * // => [2, 3, 4]
*/ */
function without(array) { function without(array) {
var index = -1, return difference(array, nativeSlice.call(arguments, 1));
length = array ? array.length : 0,
contains = cachedContains(arguments, 1, 30),
result = [];
while (++index < length) {
var value = array[index];
if (!contains(value)) {
result.push(value);
}
}
return result;
} }
/** /**
@@ -4192,7 +4254,7 @@
// (in V8 `Function#bind` is slower except when partially applied) // (in V8 `Function#bind` is slower except when partially applied)
return support.fastBind || (nativeBind && arguments.length > 2) return support.fastBind || (nativeBind && arguments.length > 2)
? nativeBind.call.apply(nativeBind, arguments) ? nativeBind.call.apply(nativeBind, arguments)
: createBound(func, thisArg, slice(arguments, 2)); : createBound(func, thisArg, nativeSlice.call(arguments, 2));
} }
/** /**
@@ -4219,8 +4281,8 @@
* // => alerts 'clicked docs', when the button is clicked * // => alerts 'clicked docs', when the button is clicked
*/ */
function bindAll(object) { function bindAll(object) {
var funcs = concat.apply(arrayRef, arguments), var funcs = arguments.length > 1 ? concat.apply(arrayRef, nativeSlice.call(arguments, 1)) : functions(object),
index = funcs.length > 1 ? 0 : (funcs = functions(object), -1), index = -1,
length = funcs.length; length = funcs.length;
while (++index < length) { while (++index < length) {
@@ -4265,7 +4327,7 @@
* // => 'hi, moe!' * // => 'hi, moe!'
*/ */
function bindKey(object, key) { function bindKey(object, key) {
return createBound(object, key, slice(arguments, 2), indicatorObject); return createBound(object, key, nativeSlice.call(arguments, 2), indicatorObject);
} }
/** /**
@@ -4395,45 +4457,64 @@
/** /**
* Creates a function that will delay the execution of `func` until after * Creates a function that will delay the execution of `func` until after
* `wait` milliseconds have elapsed since the last time it was invoked. Pass * `wait` milliseconds have elapsed since the last time it was invoked. Pass
* `true` for `immediate` to cause debounce to invoke `func` on the leading, * an `options` object to indicate that `func` should be invoked on the leading
* instead of the trailing, edge of the `wait` timeout. Subsequent calls to * and/or trailing edge of the `wait` timeout. Subsequent calls to the debounced
* the debounced function will return the result of the last `func` call. * function will return the result of the last `func` call.
*
* Note: If `leading` and `trailing` options are `true`, `func` will be called
* on the trailing edge of the timeout only if the the debounced function is
* invoked more than once during the `wait` timeout.
* *
* @static * @static
* @memberOf _ * @memberOf _
* @category Functions * @category Functions
* @param {Function} func The function to debounce. * @param {Function} func The function to debounce.
* @param {Number} wait The number of milliseconds to delay. * @param {Number} wait The number of milliseconds to delay.
* @param {Boolean} immediate A flag to indicate execution is on the leading * @param {Object} options The options object.
* edge of the timeout. * [leading=false] A boolean to specify execution on the leading edge of the timeout.
* [trailing=true] A boolean to specify execution on the trailing edge of the timeout.
* @returns {Function} Returns the new debounced function. * @returns {Function} Returns the new debounced function.
* @example * @example
* *
* var lazyLayout = _.debounce(calculateLayout, 300); * var lazyLayout = _.debounce(calculateLayout, 300);
* jQuery(window).on('resize', lazyLayout); * jQuery(window).on('resize', lazyLayout);
*
* jQuery('#postbox').on('click', _.debounce(sendMail, 200, {
* 'leading': true,
* 'trailing': false
* });
*/ */
function debounce(func, wait, immediate) { function debounce(func, wait, options) {
var args, var args,
inited,
result, result,
thisArg, thisArg,
timeoutId; timeoutId,
trailing = true;
function delayed() { function delayed() {
timeoutId = null; inited = timeoutId = null;
if (!immediate) { if (trailing) {
result = func.apply(thisArg, args); result = func.apply(thisArg, args);
} }
} }
if (options === true) {
var leading = true;
trailing = false;
} else if (options && objectTypes[typeof options]) {
leading = options.leading;
trailing = 'trailing' in options ? options.trailing : trailing;
}
return function() { return function() {
var isImmediate = immediate && !timeoutId;
args = arguments; args = arguments;
thisArg = this; thisArg = this;
clearTimeout(timeoutId); clearTimeout(timeoutId);
timeoutId = setTimeout(delayed, wait);
if (isImmediate) { if (!inited && leading) {
inited = true;
result = func.apply(thisArg, args); result = func.apply(thisArg, args);
} else {
timeoutId = setTimeout(delayed, wait);
} }
return result; return result;
}; };
@@ -4455,7 +4536,7 @@
* // returns from the function before `alert` is called * // returns from the function before `alert` is called
*/ */
function defer(func) { function defer(func) {
var args = slice(arguments, 1); var args = nativeSlice.call(arguments, 1);
return setTimeout(function() { func.apply(undefined, args); }, 1); return setTimeout(function() { func.apply(undefined, args); }, 1);
} }
// use `setImmediate` if it's available in Node.js // use `setImmediate` if it's available in Node.js
@@ -4481,7 +4562,7 @@
* // => 'logged later' (Appears after one second.) * // => 'logged later' (Appears after one second.)
*/ */
function delay(func, wait) { function delay(func, wait) {
var args = slice(arguments, 2); var args = nativeSlice.call(arguments, 2);
return setTimeout(function() { func.apply(undefined, args); }, wait); return setTimeout(function() { func.apply(undefined, args); }, wait);
} }
@@ -4507,7 +4588,7 @@
function memoize(func, resolver) { function memoize(func, resolver) {
var cache = {}; var cache = {};
return function() { return function() {
var key = String(resolver ? resolver.apply(this, arguments) : arguments[0]); var key = keyPrefix + (resolver ? resolver.apply(this, arguments) : arguments[0]);
return hasOwnProperty.call(cache, key) return hasOwnProperty.call(cache, key)
? cache[key] ? cache[key]
: (cache[key] = func.apply(this, arguments)); : (cache[key] = func.apply(this, arguments));
@@ -4567,7 +4648,7 @@
* // => 'hi moe' * // => 'hi moe'
*/ */
function partial(func) { function partial(func) {
return createBound(func, slice(arguments, 1)); return createBound(func, nativeSlice.call(arguments, 1));
} }
/** /**
@@ -4598,43 +4679,66 @@
* // => { '_': _, 'jq': $ } * // => { '_': _, 'jq': $ }
*/ */
function partialRight(func) { function partialRight(func) {
return createBound(func, slice(arguments, 1), null, indicatorObject); return createBound(func, nativeSlice.call(arguments, 1), null, indicatorObject);
} }
/** /**
* Creates a function that, when executed, will only call the `func` * Creates a function that, when executed, will only call the `func` function
* function at most once per every `wait` milliseconds. If the throttled * at most once per every `wait` milliseconds. Pass an `options` object to
* function is invoked more than once during the `wait` timeout, `func` will * indicate that `func` should be invoked on the leading and/or trailing edge
* also be called on the trailing edge of the timeout. Subsequent calls to the * of the `wait` timeout. Subsequent calls to the throttled function will
* throttled function will return the result of the last `func` call. * return the result of the last `func` call.
*
* Note: If `leading` and `trailing` options are `true`, `func` will be called
* on the trailing edge of the timeout only if the the throttled function is
* invoked more than once during the `wait` timeout.
* *
* @static * @static
* @memberOf _ * @memberOf _
* @category Functions * @category Functions
* @param {Function} func The function to throttle. * @param {Function} func The function to throttle.
* @param {Number} wait The number of milliseconds to throttle executions to. * @param {Number} wait The number of milliseconds to throttle executions to.
* @param {Object} options The options object.
* [leading=true] A boolean to specify execution on the leading edge of the timeout.
* [trailing=true] A boolean to specify execution on the trailing edge of the timeout.
* @returns {Function} Returns the new throttled function. * @returns {Function} Returns the new throttled function.
* @example * @example
* *
* var throttled = _.throttle(updatePosition, 100); * var throttled = _.throttle(updatePosition, 100);
* jQuery(window).on('scroll', throttled); * jQuery(window).on('scroll', throttled);
*
* jQuery('.interactive').on('click', _.throttle(renewToken, 300000, {
* 'trailing': false
* }));
*/ */
function throttle(func, wait) { function throttle(func, wait, options) {
var args, var args,
result, result,
thisArg, thisArg,
timeoutId, timeoutId,
lastCalled = 0; lastCalled = 0,
leading = true,
trailing = true;
function trailingCall() { function trailingCall() {
lastCalled = new Date;
timeoutId = null; timeoutId = null;
result = func.apply(thisArg, args); if (trailing) {
lastCalled = new Date;
result = func.apply(thisArg, args);
}
}
if (options === false) {
leading = false;
} else if (options && objectTypes[typeof options]) {
leading = 'leading' in options ? options.leading : leading;
trailing = 'trailing' in options ? options.trailing : trailing;
} }
return function() { return function() {
var now = new Date, var now = new Date;
remaining = wait - (now - lastCalled); if (!timeoutId && !leading) {
lastCalled = now;
}
var remaining = wait - (now - lastCalled);
args = arguments; args = arguments;
thisArg = this; thisArg = this;
@@ -4776,6 +4880,8 @@
/** /**
* Converts the given `value` into an integer of the specified `radix`. * Converts the given `value` into an integer of the specified `radix`.
* If `radix` is `undefined` or `0`, a `radix` of `10` is used unless the
* `value` is a hexadecimal, in which case a `radix` of `16` is used.
* *
* Note: This method avoids differences in native ES3 and ES5 `parseInt` * Note: This method avoids differences in native ES3 and ES5 `parseInt`
* implementations. See http://es5.github.com/#E. * implementations. See http://es5.github.com/#E.
@@ -4783,16 +4889,17 @@
* @static * @static
* @memberOf _ * @memberOf _
* @category Utilities * @category Utilities
* @param {Mixed} value The value to parse. * @param {String} value The value to parse.
* @param {Number} [radix] The radix used to interpret the value to parse.
* @returns {Number} Returns the new integer value. * @returns {Number} Returns the new integer value.
* @example * @example
* *
* _.parseInt('08'); * _.parseInt('08');
* // => 8 * // => 8
*/ */
var parseInt = nativeParseInt('08') == 8 ? nativeParseInt : function(value, radix) { var parseInt = nativeParseInt(whitespace + '08') == 8 ? nativeParseInt : function(value, radix) {
// Firefox and Opera still follow the ES3 specified implementation of `parseInt` // Firefox and Opera still follow the ES3 specified implementation of `parseInt`
return nativeParseInt(isString(value) ? value.replace(reLeadingZeros, '') : value, radix || 0); return nativeParseInt(isString(value) ? value.replace(reLeadingSpacesAndZeros, '') : value, radix || 0);
}; };
/** /**
@@ -4864,9 +4971,6 @@
* Note: In the development build, `_.template` utilizes sourceURLs for easier * Note: In the development build, `_.template` utilizes sourceURLs for easier
* debugging. See http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl * debugging. See http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl
* *
* Note: Lo-Dash may be used in Chrome extensions by either creating a `lodash csp`
* build and using precompiled templates, or loading Lo-Dash in a sandbox.
*
* For more information on precompiling templates see: * For more information on precompiling templates see:
* http://lodash.com/#custom-builds * http://lodash.com/#custom-builds
* *
@@ -4877,7 +4981,7 @@
* @memberOf _ * @memberOf _
* @category Utilities * @category Utilities
* @param {String} text The template text. * @param {String} text The template text.
* @param {Obect} data The data object used to populate the text. * @param {Object} data The data object used to populate the text.
* @param {Object} options The options object. * @param {Object} options The options object.
* escape - The "escape" delimiter regexp. * escape - The "escape" delimiter regexp.
* evaluate - The "evaluate" delimiter regexp. * evaluate - The "evaluate" delimiter regexp.
@@ -5077,7 +5181,7 @@
} }
/** /**
* The opposite of `_.escape`, this method converts the HTML entities * The inverse of `_.escape`, this method converts the HTML entities
* `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to their * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to their
* corresponding characters. * corresponding characters.
* *
@@ -5230,6 +5334,7 @@
lodash.toArray = toArray; lodash.toArray = toArray;
lodash.union = union; lodash.union = union;
lodash.uniq = uniq; lodash.uniq = uniq;
lodash.unzip = unzip;
lodash.values = values; lodash.values = values;
lodash.where = where; lodash.where = where;
lodash.without = without; lodash.without = without;
@@ -5347,7 +5452,7 @@
* @memberOf _ * @memberOf _
* @type String * @type String
*/ */
lodash.VERSION = '1.1.1'; lodash.VERSION = '1.2.1';
// add "Chaining" functions to the wrapper // add "Chaining" functions to the wrapper
lodash.prototype.toString = wrapperToString; lodash.prototype.toString = wrapperToString;

View File

@@ -1,46 +1,47 @@
/** /**
* @license * @license
* Lo-Dash 1.1.1 (Custom Build) lodash.com/license * Lo-Dash 1.2.1 (Custom Build) lodash.com/license
* Build: `lodash -o ./dist/lodash.compat.js` * Build: `lodash -o ./dist/lodash.compat.js`
* Underscore.js 1.4.4 underscorejs.org/LICENSE * Underscore.js 1.4.4 underscorejs.org/LICENSE
*/ */
;(function(n){function t(r){function a(n){return n&&typeof n=="object"&&!fe(n)&&Vt.call(n,"__wrapped__")?n:new K(n)}function q(n,t,e){var r=n.length,u=r-t>=e;if(u){var a={};for(e=t-1;++e<r;){var o=qt(n[e]);(Vt.call(a,o)?a[o]:a[o]=[]).push(n[e])}}return function(e){if(u){var r=qt(e);return Vt.call(a,r)&&-1<yt(a[r],e)}return-1<yt(n,e,t)}}function B(n){return n.charCodeAt(0)}function F(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 ;(function(n){function t(r){function a(n){return n&&typeof n=="object"&&!me(n)&&Qt.call(n,"__wrapped__")?n:new V(n)}function R(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 T(n){return n.charCodeAt(0)}function D(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 z(n,t,e,r){function u(){var r=arguments,l=o?this:t;
}return e<r?-1:1}function R(n,t,e,r){function u(){var r=arguments,c=o?this:t;return a||(n=t[i]),e.length&&(r=r.length?(r=V(r),f?r.concat(e):e.concat(r)):e),this instanceof u?(M.prototype=n.prototype,c=new M,M.prototype=null,r=n.apply(c,r),Z(r)?r:c):n.apply(c,r)}var a=Y(n),o=!e,i=t;if(o){var f=r;e=t}else if(!a){if(!r)throw new Bt;t=n}return u}function T(){for(var n,t={g:_,b:"k(m)",c:"",e:"m",f:"",h:"",i:!0,j:!!le},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=At,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+"){",ie.unindexedChars&&(r+="if(l(m)){m=m.split('')}"),r+="while(++i<n){"+t.f+"}}else{"):ie.nonEnumArgs&&(r+="var n=m.length;i=-1;if(n&&j(m)){while(++i<n){i+='';"+t.f+"}}else{"),ie.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];",ie.enumPrototypes&&(r+="if(!(v&&i=='prototype')){"),r+=t.f,ie.enumPrototypes&&(r+="}"),r+="}"; 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?(G.prototype=n.prototype,l=new G,G.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 L(){for(var n,t={g:j,b:"k(m)",c:"",e:"m",f:"",h:"",i:!0,j:!!be},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){",(ie.enumPrototypes||t.i)&&(r+="if(",ie.enumPrototypes&&(r+="!(v&&i=='prototype')"),ie.enumPrototypes&&t.i&&(r+="&&"),t.i&&(r+="h.call(m,i)"),r+="){"),r+=t.f+";",(ie.enumPrototypes||t.i)&&(r+="}"),r+="}",ie.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||ie.nonEnumArgs)&&(r+="}"),r+=t.c+";return u",e("h,j,k,l,o,p,r","return function("+n+"){"+r+"}")(Vt,H,fe,tt,le,a,P) 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,W,me,ut,be,a,q)
}function D(n){return"\\"+N[n]}function z(n){return se[n]}function L(n){return typeof n.toString!="function"&&typeof(n+"")=="string"}function K(n){this.__wrapped__=n}function M(){}function U(n){var t=!1;if(!n||Qt.call(n)!=E||!ie.argsClass&&H(n))return t;var e=n.constructor;return(Y(e)?e instanceof e:ie.nodeClass||!L(n))?ie.ownLast?(ye(n,function(n,e,r){return t=Vt.call(r,e),!1}),!0===t):(ye(n,function(n,e){t=e}),!1===t||Vt.call(n,t)):t}function V(n,t,e){t||(t=0),typeof e=="undefined"&&(e=n?n.length:0); }function K(n){return"\\"+B[n]}function M(n){return we[n]}function U(n){return typeof n.toString!="function"&&typeof(n+"")=="string"}function V(n){this.__wrapped__=n}function G(){}function H(n){var t=!1;if(!n||Zt.call(n)!=I||!ve.argsClass&&W(n))return t;var e=n.constructor;return(tt(e)?e instanceof e:ve.nodeClass||!U(n))?ve.ownLast?(xe(n,function(n,e,r){return t=Qt.call(r,e),!1}),!0===t):(xe(n,function(n,e){t=e}),!1===t||Qt.call(n,t)):t}function J(n,t,e){t||(t=0),typeof e=="undefined"&&(e=n?n.length:0);
var r=-1;e=e-t||0;for(var u=Ot(0>e?0:e);++r<e;)u[r]=n[t+r];return u}function G(n){return ve[n]}function H(n){return Qt.call(n)==C}function J(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=Z(f)){var c=Qt.call(f);if(!I[c]||!ie.nodeClass&&L(f))return f;var l=fe(f)}if(!u||!t)return u?l?V(f):ge({},f):f;switch(u=oe[c],c){case j:case k:return new u(+f);case O:case A:return new u(f); 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 Q(n){return Ce[n]}function W(n){return Zt.call(n)==k}function X(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(!$[l]||!ve.nodeClass&&U(f))return f;var c=me(f)}if(!u||!t)return u?c?J(f):je({},f):f;switch(u=se[l],l){case O:case E:return new u(+f);case A:case N:return new u(f);
case S:return u(f.source,v.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&&(Vt.call(n,"index")&&(f.index=n.index),Vt.call(n,"input")&&(f.input=n.input)),o.push(n),i.push(f),(l?ft:me)(n,function(n,u){f[u]=J(n,t,r,e,o,i)}),f}function Q(n){var t=[];return ye(n,function(n,e){Y(n)&&t.push(e)}),t.sort()}function W(n){for(var t=-1,e=le(n),r=e.length,u={};++t<r;){var a=e[t];u[n[a]]=a}return u}function X(n,t,e,r,u,o){var f=e===i;if(e&&!f){e=typeof r=="undefined"?e:a.createCallback(e,r,2); case P:return u(f.source,y.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:Oe)(n,function(n,u){f[u]=X(n,t,r,e,o,i)}),f}function Y(n){var t=[];return xe(n,function(n,e){tt(n)&&t.push(e)}),t.sort()}function Z(n){for(var t=-1,e=be(n),r=e.length,u={};++t<r;){var a=e[t];u[n[a]]=a}return u}function nt(n,t,e,r,u,o){var f=e===i;if(typeof e=="function"&&!f){e=a.createCallback(e,r,2);
var c=e(n,t);if(typeof c!="undefined")return!!c}if(n===t)return 0!==n||1/n==1/t;var l=typeof n,p=typeof t;if(n===n&&(!n||"function"!=l&&"object"!=l)&&(!t||"function"!=p&&"object"!=p))return!1;if(null==n||null==t)return n===t;if(p=Qt.call(n),l=Qt.call(t),p==C&&(p=E),l==C&&(l=E),p!=l)return!1;switch(p){case j:case k:return+n==+t;case O:return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case S:case A:return n==qt(t)}if(l=p==w,!l){if(Vt.call(n,"__wrapped__")||Vt.call(t,"__wrapped__"))return X(n.__wrapped__||n,t.__wrapped__||t,e,r,u,o); 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==k&&(p=I),c==k&&(c=I),p!=c)return!1;switch(p){case O:case E:return+n==+t;case A:return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case P:case N:return n==Tt(t)}if(c=p==x,!c){if(Qt.call(n,"__wrapped__")||Qt.call(t,"__wrapped__"))return nt(n.__wrapped__||n,t.__wrapped__||t,e,r,u,o);
if(p!=E||!ie.nodeClass&&(L(n)||L(t)))return!1;var p=!ie.argsObject&&H(n)?Nt:n.constructor,s=!ie.argsObject&&H(t)?Nt:t.constructor;if(p!=s&&(!Y(p)||!(p instanceof p&&Y(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,c=!0;if(u.push(n),o.push(t),l){if(p=n.length,v=t.length,c=v==n.length,!c&&!f)return c;for(;v--;)if(l=p,s=t[v],f)for(;l--&&!(c=X(n[l],s,e,r,u,o)););else if(!(c=X(n[v],s,e,r,u,o)))break;return c}return ye(t,function(t,a,i){return Vt.call(i,a)?(v++,c=Vt.call(n,a)&&X(n[a],t,e,r,u,o)):void 0 if(p!=I||!ve.nodeClass&&(U(n)||U(t)))return!1;var p=!ve.argsObject&&W(n)?Ft:n.constructor,s=!ve.argsObject&&W(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 xe(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
}),c&&!f&&ye(n,function(n,t,e){return Vt.call(e,t)?c=-1<--v:void 0}),c}function Y(n){return typeof n=="function"}function Z(n){return n?P[typeof n]:!1}function nt(n){return typeof n=="number"||Qt.call(n)==O}function tt(n){return typeof n=="string"||Qt.call(n)==A}function et(n,t,e){var r=arguments,u=0,o=2;if(!Z(n))return n;if(e===i)var f=r[3],c=r[4],l=r[5];else c=[],l=[],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]); }),l&&!f&&xe(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?q[typeof n]:!1}function rt(n){return typeof n=="number"||Zt.call(n)==A}function ut(n){return typeof n=="string"||Zt.call(n)==N}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;)(fe(r[u])?ft:me)(r[u],function(t,e){var r,u,a=t,o=n[e];if(t&&((u=fe(t))||de(t))){for(a=c.length;a--;)if(r=c[a]==t){o=l[a];break}r||(o=u?fe(o)?o:[]:de(o)?o:{},f&&(a=f(o,t),typeof a!="undefined"&&(o=a)),c.push(t),l.push(o),f||(o=et(o,t,i,f,c,l)))}else f&&(a=f(o,t),typeof a=="undefined"&&(a=t)),typeof a!="undefined"&&(o=a);n[e]=o});return n}function rt(n){for(var t=-1,e=le(n),r=e.length,u=Ot(r);++t<r;)u[t]=n[e[t]];return u}function ut(n,t,e){var r=-1,u=n?n.length:0,a=!1;return e=(0>e?te(0,u+e):e)||0,typeof u=="number"?a=-1<(tt(n)?n.indexOf(t,e):yt(n,t,e)):pe(n,function(n){return++r<e?void 0:!(a=n===t) for(;++u<o;)(me(r[u])?pt:Oe)(r[u],function(t,e){var r,u,a=t,o=n[e];if(t&&((u=me(t))||Ee(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?me(o)?o:[]:Ee(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=be(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)):_e(n,function(n){return++r<e?void 0:!(a=n===t)
}),a}function at(n,t,e){var r=!0;if(t=a.createCallback(t,e),fe(n)){e=-1;for(var u=n.length;++e<u&&(r=!!t(n[e],e,n)););}else pe(n,function(n,e,u){return r=!!t(n,e,u)});return r}function ot(n,t,e){var r=[];if(t=a.createCallback(t,e),fe(n)){e=-1;for(var u=n.length;++e<u;){var o=n[e];t(o,e,n)&&r.push(o)}}else pe(n,function(n,e,u){t(n,e,u)&&r.push(n)});return r}function it(n,t,e){if(t=a.createCallback(t,e),!fe(n)){var r;return pe(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]; }),a}function ft(n,t,e){var r=!0;if(t=a.createCallback(t,e),me(n)){e=-1;for(var u=n.length;++e<u&&(r=!!t(n[e],e,n)););}else _e(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),me(n)){e=-1;for(var u=n.length;++e<u;){var o=n[e];t(o,e,n)&&r.push(o)}}else _e(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),!me(n)){var r;return _e(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 ft(n,t,e){if(t&&typeof e=="undefined"&&fe(n)){e=-1;for(var r=n.length;++e<r&&!1!==t(n[e],e,n););}else pe(n,t,e);return n}function ct(n,t,e){var r=-1,u=n?n.length:0,o=Ot(typeof u=="number"?u:0);if(t=a.createCallback(t,e),fe(n))for(;++r<u;)o[r]=t(n[r],r,n);else pe(n,function(n,e,u){o[++r]=t(n,e,u)});return o}function lt(n,t,e){var r=-1/0,u=r;if(!t&&fe(n)){e=-1;for(var o=n.length;++e<o;){var i=n[e];i>u&&(u=i)}}else t=!t&&tt(n)?B:a.createCallback(t,e),pe(n,function(n,e,a){e=t(n,e,a),e>r&&(r=e,u=n) if(t(o,e,n))return o}}function pt(n,t,e){if(t&&typeof e=="undefined"&&me(n)){e=-1;for(var r=n.length;++e<r&&!1!==t(n[e],e,n););}else _e(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),me(n))for(;++r<u;)o[r]=t(n[r],r,n);else _e(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&&me(n)){e=-1;for(var o=n.length;++e<o;){var i=n[e];i>u&&(u=i)}}else t=!t&&ut(n)?T:a.createCallback(t,e),_e(n,function(n,e,a){e=t(n,e,a),e>r&&(r=e,u=n)
});return u}function pt(n,t,e,r){var u=3>arguments.length;if(t=a.createCallback(t,r,4),fe(n)){var o=-1,i=n.length;for(u&&(e=n[++o]);++o<i;)e=t(e,n[o],o,n)}else pe(n,function(n,r,a){e=u?(u=!1,n):t(e,n,r,a)});return e}function st(n,t,e,r){var u=n,o=n?n.length:0,i=3>arguments.length;if(typeof o!="number")var f=le(n),o=f.length;else ie.unindexedChars&&tt(n)&&(u=n.split(""));return t=a.createCallback(t,r,4),ft(n,function(n,r,a){r=f?f[--o]:--o,e=i?(i=!1,u[r]):t(e,u[r],r,a)}),e}function vt(n,t,e){var r; });return u}function gt(n,t,e,r){var u=3>arguments.length;if(t=a.createCallback(t,r,4),me(n)){var o=-1,i=n.length;for(u&&(e=n[++o]);++o<i;)e=t(e,n[o],o,n)}else _e(n,function(n,r,a){e=u?(u=!1,n):t(e,n,r,a)});return e}function yt(n,t,e,r){var u=n,o=n?n.length:0,i=3>arguments.length;if(typeof o!="number")var f=be(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 ht(n,t,e){var r;
if(t=a.createCallback(t,e),fe(n)){e=-1;for(var u=n.length;++e<u&&!(r=t(n[e],e,n)););}else pe(n,function(n,e,u){return!(r=t(n,e,u))});return!!r}function gt(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 V(n,0,ee(te(0,r),u))}}function ht(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)),fe(r)?Gt.apply(i,t?r:ht(r)):i.push(r); if(t=a.createCallback(t,e),me(n)){e=-1;for(var u=n.length;++e<u&&!(r=t(n[e],e,n)););}else _e(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=R(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 J(n,0,oe(ae(0,r),u))}}function bt(n,t,e,r){var u=-1,o=n?n.length:0,i=[];
return i}function yt(n,t,e){var r=-1,u=n?n.length:0;if(typeof e=="number")r=(0>e?te(0,u+e):e||0)-1;else if(e)return r=dt(n,t),n[r]===t?r:-1;for(;++r<u;)if(n[r]===t)return r;return-1}function mt(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:te(0,t);return V(n,r)}function dt(n,t,e,r){var u=0,o=n?n.length:u;for(e=e?a.createCallback(e,r,1):jt,t=e(t);u<o;)r=u+o>>>1,e(n[r])<t?u=r+1:o=r;return u}function bt(n,t,e,r){var u=-1,o=n?n.length:0,i=[],f=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)),me(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 J(n,r)
typeof t!="boolean"&&null!=t&&(r=e,e=t,t=!1);var c=!t&&75<=o;if(c)var l={};for(null!=e&&(f=[],e=a.createCallback(e,r));++u<o;){r=n[u];var p=e?e(r,u,n):r;if(c)var s=qt(p),s=Vt.call(l,s)?!(f=l[s]):f=l[s]=[];(t?!u||f[f.length-1]!==p:s||0>yt(f,p))&&((e||c)&&f.push(p),i.push(r))}return i}function _t(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 Ct(n,t){return ie.fastBind||Wt&&2<arguments.length?Wt.call.apply(Wt,arguments):R(n,t,V(arguments,2))}function wt(n){var t=V(arguments,1); }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];
return Jt(function(){n.apply(e,t)},1)}function jt(n){return n}function kt(n){ft(Q(n),function(t){var e=a[t]=n[t];a.prototype[t]=function(){var n=this.__wrapped__,t=[n];return Gt.apply(t,arguments),t=e.apply(a,t),n&&typeof n=="object"&&n==t?this:new K(t)}})}function xt(){return this.__wrapped__}r=r?$.defaults(n.Object(),r,$.pick(n,b)):n;var Ot=r.Array,Et=r.Boolean,St=r.Date,At=r.Function,It=r.Math,Pt=r.Number,Nt=r.Object,$t=r.RegExp,qt=r.String,Bt=r.TypeError,Ft=Ot(),Rt=Nt(),Tt=r._,Dt=$t("^"+qt(Rt.valueOf).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),zt=It.ceil,Lt=r.clearTimeout,Kt=Ft.concat,Mt=It.floor,Ut=Dt.test(Ut=Nt.getPrototypeOf)&&Ut,Vt=Rt.hasOwnProperty,Gt=Ft.push,Ht=r.setImmediate,Jt=r.setTimeout,Qt=Rt.toString,Wt=Dt.test(Wt=V.bind)&&Wt,Xt=Dt.test(Xt=Ot.isArray)&&Xt,Yt=r.isFinite,Zt=r.isNaN,ne=Dt.test(ne=Nt.keys)&&ne,te=It.max,ee=It.min,re=r.parseInt,ue=It.random,It=Dt.test(r.attachEvent),ae=Wt&&!/\n|true/.test(Wt+It),oe={}; 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):z(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(Y(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 V(t)}})}function At(){return this.__wrapped__}r=r?F.defaults(n.Object(),r,F.pick(n,C)):n;
oe[w]=Ot,oe[j]=Et,oe[k]=St,oe[E]=Nt,oe[O]=Pt,oe[S]=$t,oe[A]=qt;var ie=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);ie.argsObject=arguments.constructor==Nt,ie.argsClass=H(arguments),ie.enumPrototypes=n.propertyIsEnumerable("prototype"),ie.fastBind=Wt&&!ae,ie.ownLast="x"!=e[0],ie.nonEnumArgs=0!=r,ie.nonEnumShadows=!/valueOf/.test(e),ie.spliceObjects=(Ft.splice.call(t,0,1),!t[0]),ie.unindexedChars="xx"!="x"[0]+Nt("x")[0]; 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={};
try{ie.nodeClass=!(Qt.call(document)==E&&!({toString:0}+""))}catch(u){ie.nodeClass=!0}})(1),a.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:g,variable:"",imports:{_:a}},Et={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:"}}"},Pt={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"},It={h:"if(!r[typeof m])return u;"+Pt.h,b:!1},K.prototype=a.prototype,ie.argsClass||(H=function(n){return n?Vt.call(n,"callee"):!1 se[x]=It,se[O]=Pt,se[E]=Nt,se[I]=Ft,se[A]=Bt,se[P]=Rt,se[N]=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=W(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];
});var fe=Xt||function(n){return ie.argsObject&&n instanceof Ot||Qt.call(n)==w},ce=T({a:"q",e:"[]",h:"if(!(r[typeof q]))return u",f:"u.push(i)",b:!1}),le=ne?function(n){return Z(n)?ie.enumPrototypes&&typeof n=="function"||ie.nonEnumArgs&&n.length&&H(n)?ce(n):ne(n):[]}:ce,pe=T(Pt),se={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},ve=W(se),ge=T(Et,{h:Et.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]"}),he=T(Et),ye=T(Pt,It,{i:!1}),me=T(Pt,It); try{ve.nodeClass=!(Zt.call(document)==I&&!({toString:0}+""))}catch(u){ve.nodeClass=!0}})(1),a.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:h,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:"}}"},ye={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"},he={h:"if(!r[typeof m])return u;"+ye.h,b:!1};
Y(/x/)&&(Y=function(n){return n instanceof At||Qt.call(n)==x});var de=Ut?function(n){if(!n||Qt.call(n)!=E||!ie.argsClass&&H(n))return!1;var t=n.valueOf,e=typeof t=="function"&&(e=Ut(t))&&Ut(e);return e?n==e||Ut(n)==e:U(n)}:U;return ae&&u&&typeof Ht=="function"&&(wt=Ct(Ht,r)),Ht=8==re("08")?re:function(n,t){return re(tt(n)?n.replace(h,""):n,t||0)},a.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},a.assign=ge,a.at=function(n){var t=-1,e=Kt.apply(Ft,V(arguments,1)),r=e.length,u=Ot(r); V.prototype=a.prototype,ve.argsClass||(W=function(n){return n?Qt.call(n,"callee"):!1});var me=te||function(n){return n?typeof n=="object"&&Zt.call(n)==x:!1},de=L({a:"q",e:"[]",h:"if(!(r[typeof q]))return u",f:"u.push(i)",b:!1}),be=ue?function(n){return et(n)?ve.enumPrototypes&&typeof n=="function"||ve.nonEnumArgs&&n.length&&W(n)?de(n):ue(n):[]}:de,_e=L(ye),we={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Ce=Z(we),je=L(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]"}),ke=L(ge),xe=L(ye,he,{i:!1}),Oe=L(ye,he);
for(ie.unindexedChars&&tt(n)&&(n=n.split(""));++t<r;)u[t]=n[e[t]];return u},a.bind=Ct,a.bindAll=function(n){for(var t=Kt.apply(Ft,arguments),e=1<t.length?0:(t=Q(n),-1),r=t.length;++e<r;){var u=t[e];n[u]=Ct(n[u],n)}return n},a.bindKey=function(n,t){return R(n,t,V(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] tt(/x/)&&(tt=function(n){return typeof n=="function"&&Zt.call(n)==S});var Ee=Jt?function(n){if(!n||Zt.call(n)!=I||!ve.argsClass&&W(n))return!1;var t=n.valueOf,e=typeof t=="function"&&(e=Jt(t))&&Jt(e);return e?n==e||Jt(n)==e:H(n)}:H;pe&&u&&typeof Xt=="function"&&(Ot=xt(Xt,r));var Se=8==ie(m+"08")?ie:function(n,t){return ie(ut(n)?n.replace(d,""):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=je,a.at=function(n){var t=-1,e=Gt.apply(zt,le.call(arguments,1)),r=e.length,u=It(r);
}},a.countBy=function(n,t,e){var r={};return t=a.createCallback(t,e),ft(n,function(n,e,u){e=qt(t(n,e,u)),Vt.call(r,e)?r[e]++:r[e]=1}),r},a.createCallback=function(n,t,e){if(null==n)return jt;var r=typeof n;if("function"!=r){if("object"!=r)return function(t){return t[n]};var u=le(n);return function(t){for(var e=u.length,r=!1;e--&&(r=X(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) 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)):Y(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 z(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)];
}:function(e,r,u){return n.call(t,e,r,u)}:n},a.debounce=function(n,t,e){function r(){i=null,e||(a=n.apply(o,u))}var u,a,o,i;return function(){var f=e&&!i;return u=arguments,o=this,Lt(i),i=Jt(r,t),f&&(a=n.apply(o,u)),a}},a.defaults=he,a.defer=wt,a.delay=function(n,t){var r=V(arguments,2);return Jt(function(){n.apply(e,r)},t)},a.difference=function(n){for(var t=-1,e=n?n.length:0,r=Kt.apply(Ft,arguments),r=q(r,e,100),u=[];++t<e;){var a=n[t];r(a)||u.push(a)}return u},a.filter=ot,a.flatten=ht,a.forEach=ft,a.forIn=ye,a.forOwn=me,a.functions=Q,a.groupBy=function(n,t,e){var r={}; 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=be(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)
return t=a.createCallback(t,e),ft(n,function(n,e,u){e=qt(t(n,e,u)),(Vt.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 V(n,0,ee(te(0,u-r),u))},a.intersection=function(n){var t=arguments,e=t.length,r={0:{}},u=-1,a=n?n.length:0,o=100<=a,i=[],f=i;n:for(;++u<a;){var c=n[u];if(o)var l=qt(c),l=Vt.call(r[0],l)?!(f=r[0][l]):f=r[0][l]=[]; }:function(e,r,u){return n.call(t,e,r,u)}:n},a.debounce=function(n,t,e){function r(){a=f=null,l&&(o=n.apply(i,u))}var u,a,o,i,f,l=!0;if(!0===e)var c=!0,l=!1;else e&&q[typeof e]&&(c=e.leading,l="trailing"in e?e.trailing:l);return function(){return u=arguments,i=this,Vt(f),!a&&c?(a=!0,o=n.apply(i,u)):f=Yt(r,t),o}},a.defaults=ke,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=xe,a.forOwn=Oe,a.functions=Y,a.groupBy=function(n,t,e){var r={};
if(l||0>yt(f,c)){o&&f.push(c);for(var p=e;--p;)if(!(r[p]||(r[p]=q(t[p],0,100)))(c))continue n;i.push(c)}}return i},a.invert=W,a.invoke=function(n,t){var e=V(arguments,2),r=-1,u=typeof t=="function",a=n?n.length:0,o=Ot(typeof a=="number"?a:0);return ft(n,function(n){o[++r]=(u?t:n[t]).apply(n,e)}),o},a.keys=le,a.map=ct,a.max=lt,a.memoize=function(n,t){var e={};return function(){var r=qt(t?t.apply(this,arguments):arguments[0]);return Vt.call(e,r)?e[r]:e[r]=n.apply(this,arguments)}},a.merge=et,a.min=function(n,t,e){var r=1/0,u=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 J(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);
if(!t&&fe(n)){e=-1;for(var o=n.length;++e<o;){var i=n[e];i<u&&(u=i)}}else t=!t&&tt(n)?B:a.createCallback(t,e),pe(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=Kt.apply(Ft,arguments);return ye(n,function(n,e,a){(r?!t(n,e,a):0>yt(o,e,1))&&(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=le(n),r=e.length,u=Ot(r);++t<r;){var a=e[t]; for(var v=e;--v;)if(!(r[v]||(r[v]=R(t[v])))(p))continue n;i.push(p)}}return i},a.invert=Z,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=be,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;
u[t]=[a,n[a]]}return u},a.partial=function(n){return R(n,V(arguments,1))},a.partialRight=function(n){return R(n,V(arguments,1),null,i)},a.pick=function(n,t,e){var r={};if(typeof t!="function")for(var u=0,o=Kt.apply(Ft,arguments),i=Z(n)?o.length:0;++u<i;){var f=o[u];f in n&&(r[f]=n[f])}else t=a.createCallback(t,e),ye(n,function(n,e,u){t(n,e,u)&&(r[e]=n)});return r},a.pluck=ct,a.range=function(n,t,e){n=+n||0,e=+e||1,null==t&&(t=n,n=0);var r=-1;t=te(0,zt((t-n)/e));for(var u=Ot(t);++r<t;)u[r]=n,n+=e; if(!t&&me(n)){e=-1;for(var o=n.length;++e<o;){var i=n[e];i<u&&(u=i)}}else t=!t&&ut(n)?T:a.createCallback(t,e),_e(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 xe(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=be(n),r=e.length,u=It(r);++t<r;){var a=e[t];
return u},a.reject=function(n,t,e){return t=a.createCallback(t,e),ot(n,function(n,e,r){return!t(n,e,r)})},a.rest=mt,a.shuffle=function(n){var t=-1,e=n?n.length:0,r=Ot(typeof e=="number"?e:0);return ft(n,function(n){var e=Mt(ue()*(++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=Ot(typeof u=="number"?u:0);for(t=a.createCallback(t,e),ft(n,function(n,e,u){o[++r]={a:t(n,e,u),b:r,c:n}}),u=o.length,o.sort(F);u--;)o[u]=o[u].c;return o},a.tap=function(n,t){return t(n),n},a.throttle=function(n,t){function e(){i=new St,o=null,u=n.apply(a,r) u[t]=[a,n[a]]}return u},a.partial=function(n){return z(n,le.call(arguments,1))},a.partialRight=function(n){return z(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),xe(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;
}var r,u,a,o,i=0;return function(){var f=new St,c=t-(f-i);return r=arguments,a=this,0<c?o||(o=Jt(e,c)):(Lt(o),o=null,i=f,u=n.apply(a,r)),u}},a.times=function(n,t,e){n=-1<(n=+n)?n:0;var r=-1,u=Ot(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"?ie.unindexedChars&&tt(n)?n.split(""):V(n):rt(n)},a.union=function(){return bt(Kt.apply(Ft,arguments))},a.uniq=bt,a.values=rt,a.where=ot,a.without=function(n){for(var t=-1,e=n?n.length:0,r=q(arguments,1,30),u=[];++t<e;){var a=n[t]; 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(D);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(){i=null,c&&(f=new Nt,a=n.apply(o,u))
r(a)||u.push(a)}return u},a.wrap=function(n,t){return function(){var e=[n];return Gt.apply(e,arguments),t.apply(this,e)}},a.zip=function(n){for(var t=-1,e=n?lt(ct(arguments,"length")):0,r=Ot(e);++t<e;)r[t]=ct(arguments,t);return r},a.zipObject=_t,a.collect=ct,a.drop=mt,a.each=ft,a.extend=ge,a.methods=Q,a.object=_t,a.select=ot,a.tail=mt,a.unique=bt,kt(a),a.clone=J,a.cloneDeep=function(n,t,e){return J(n,!0,t,e)},a.contains=ut,a.escape=function(n){return null==n?"":qt(n).replace(m,z)},a.every=at,a.find=it,a.findIndex=function(n,t,e){var r=-1,u=n?n.length:0; }var u,a,o,i,f=0,l=!0,c=!0;return!1===e?l=!1:e&&q[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(""):J(n):ot(n)},a.union=function(n){return me(n)||(arguments[0]=n?le.call(n):zt),jt(Gt.apply(zt,arguments))
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),me(n,function(n,e,u){return t(n,e,u)?(r=e,!1):void 0}),r},a.has=function(n,t){return n?Vt.call(n,t):!1},a.identity=jt,a.indexOf=yt,a.isArguments=H,a.isArray=fe,a.isBoolean=function(n){return!0===n||!1===n||Qt.call(n)==j},a.isDate=function(n){return n instanceof St||Qt.call(n)==k},a.isElement=function(n){return n?1===n.nodeType:!1},a.isEmpty=function(n){var t=!0;if(!n)return t; },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=je,a.methods=Y,a.object=kt,a.select=lt,a.tail=wt,a.unique=jt,St(a),a.clone=X,a.cloneDeep=function(n,t,e){return X(n,!0,t,e)
var e=Qt.call(n),r=n.length;return e==w||e==A||(ie.argsClass?e==C:H(n))||e==E&&typeof r=="number"&&Y(n.splice)?!r:(me(n,function(){return t=!1}),t)},a.isEqual=X,a.isFinite=function(n){return Yt(n)&&!Zt(parseFloat(n))},a.isFunction=Y,a.isNaN=function(n){return nt(n)&&n!=+n},a.isNull=function(n){return null===n},a.isNumber=nt,a.isObject=Z,a.isPlainObject=de,a.isRegExp=function(n){return n instanceof $t||Qt.call(n)==S},a.isString=tt,a.isUndefined=function(n){return typeof n=="undefined"},a.lastIndexOf=function(n,t,e){var r=n?n.length:0; },a.contains=it,a.escape=function(n){return null==n?"":Tt(n).replace(_,M)},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),Oe(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=W,a.isArray=me,a.isBoolean=function(n){return!0===n||!1===n||Zt.call(n)==O},a.isDate=function(n){return n?typeof n=="object"&&Zt.call(n)==E:!1
for(typeof e=="number"&&(r=(0>e?te(0,r+e):ee(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},a.mixin=kt,a.noConflict=function(){return r._=Tt,this},a.parseInt=Ht,a.random=function(n,t){return null==n&&null==t&&(t=1),n=+n||0,null==t&&(t=n,n=0),n+Mt(ue()*((+t||0)-n+1))},a.reduce=pt,a.reduceRight=st,a.result=function(n,t){var r=n?n[t]:e;return Y(r)?n[t]():r},a.runInContext=t,a.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:le(n).length},a.some=vt,a.sortedIndex=dt,a.template=function(n,t,r){var u=a.templateSettings; },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==x||e==N||(ve.argsClass?e==k:W(n))||e==I&&typeof r=="number"&&tt(n.splice)?!r:(Oe(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=Ee,a.isRegExp=function(n){return n?q[typeof n]&&Zt.call(n)==P:!1
n||(n=""),r=he({},r,u);var o,i=he({},r.imports,u.imports),u=le(i),i=rt(i),p=0,v=r.interpolate||y,h="__p+='",v=$t((r.escape||y).source+"|"+v.source+"|"+(v===g?s:y).source+"|"+(r.evaluate||y).source+"|$","g");n.replace(v,function(t,e,r,u,a,i){return r||(r=u),h+=n.slice(p,i).replace(d,D),e&&(h+="'+__e("+e+")+'"),a&&(o=!0,h+="';"+a+";__p+='"),r&&(h+="'+((__t=("+r+"))==null?'':__t)+'"),p=i+t.length,t}),h+="';\n",v=r=r.variable,v||(r="obj",h="with("+r+"){"+h+"}"),h=(o?h.replace(f,""):h).replace(c,"$1").replace(l,"$1;"),h="function("+r+"){"+(v?"":r+"||("+r+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+h+"return __p}"; },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=Se,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=yt,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;
try{var m=At(u,"return "+h).apply(e,i)}catch(b){throw b.source=h,b}return t?m(t):(m.source=h,m)},a.unescape=function(n){return null==n?"":qt(n).replace(p,G)},a.uniqueId=function(n){var t=++o;return qt(null==n?"":n)+t},a.all=at,a.any=vt,a.detect=it,a.foldl=pt,a.foldr=st,a.include=ut,a.inject=pt,me(a,function(n,t){a.prototype[t]||(a.prototype[t]=function(){var t=[this.__wrapped__];return Gt.apply(t,arguments),n.apply(a,t)})}),a.first=gt,a.last=function(n,t,e){if(n){var r=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u; return typeof t=="number"?t:be(n).length},a.some=ht,a.sortedIndex=Ct,a.template=function(n,t,r){var u=a.templateSettings;n||(n=""),r=ke({},r,u);var o,i=ke({},r.imports,u.imports),u=be(i),i=ot(i),f=0,l=r.interpolate||b,v="__p+='",l=Rt((r.escape||b).source+"|"+l.source+"|"+(l===h?g:b).source+"|"+(r.evaluate||b).source+"|$","g");n.replace(l,function(t,e,r,u,a,i){return r||(r=u),v+=n.slice(f,i).replace(w,K),e&&(v+="'+__e("+e+")+'"),a&&(o=!0,v+="';"+a+";__p+='"),r&&(v+="'+((__t=("+r+"))==null?'':__t)+'"),f=i+t.length,t
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 V(n,te(0,u-r))}},a.take=gt,a.head=gt,me(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 K(r)})}),a.VERSION="1.1.1",a.prototype.toString=function(){return qt(this.__wrapped__)},a.prototype.value=xt,a.prototype.valueOf=xt,pe(["join","pop","shift"],function(n){var t=Ft[n];a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments) }),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 y=$t(u,"return "+v).apply(e,i)}catch(m){throw m.source=v,m}return t?y(t):(y.source=v,y)},a.unescape=function(n){return null==n?"":Tt(n).replace(v,Q)},a.uniqueId=function(n){var t=++o;return Tt(null==n?"":n)+t
}}),pe(["push","reverse","sort","unshift"],function(n){var t=Ft[n];a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),pe(["concat","slice","splice"],function(n){var t=Ft[n];a.prototype[n]=function(){return new K(t.apply(this.__wrapped__,arguments))}}),ie.spliceObjects||pe(["pop","shift","splice"],function(n){var t=Ft[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 K(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.all=ft,a.any=ht,a.detect=ct,a.foldl=gt,a.foldr=yt,a.include=it,a.inject=gt,Oe(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 J(n,ae(0,u-r))}},a.take=dt,a.head=dt,Oe(a,function(n,t){a.prototype[t]||(a.prototype[t]=function(t,e){var r=n(this.__wrapped__,t,e);
a.global===a&&(n=a);var o=0,i={},f=/\b__p\+='';/g,c=/\b(__p\+=)''\+/g,l=/(__e\(.*?\)|\b__t\))\+'';/g,p=/&(?:amp|lt|gt|quot|#39);/g,s=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,v=/\w*$/,g=/<%=([\s\S]+?)%>/g,h=/^0+(?=.$)/,y=/($^)/,m=/[&<>"']/g,d=/['\n\r\t\u2028\u2029\\]/g,b="Array Boolean Date Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),_="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),C="[object Arguments]",w="[object Array]",j="[object Boolean]",k="[object Date]",x="[object Function]",O="[object Number]",E="[object Object]",S="[object RegExp]",A="[object String]",I={}; return null==t||e&&typeof t!="function"?r:new V(r)})}),a.VERSION="1.2.1",a.prototype.toString=function(){return Tt(this.__wrapped__)},a.prototype.value=At,a.prototype.valueOf=At,_e(["join","pop","shift"],function(n){var t=zt[n];a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),_e(["push","reverse","sort","unshift"],function(n){var t=zt[n];a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),_e(["concat","slice","splice"],function(n){var t=zt[n];a.prototype[n]=function(){return new V(t.apply(this.__wrapped__,arguments))
I[x]=!1,I[C]=I[w]=I[j]=I[k]=I[O]=I[E]=I[S]=I[A]=!0;var P={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},N={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"},$=t();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=$,define(function(){return $})):r&&!r.nodeType?u?(u.exports=$)._=$:r._=$:n._=$})(this); }}),ve.spliceObjects||_e(["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 V(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,y=/\w*$/,h=/<%=([\s\S]+?)%>/g,m=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",d=RegExp("^["+m+"]*0+(?=.$)"),b=/($^)/,_=/[&<>"']/g,w=/['\n\r\t\u2028\u2029\\]/g,C="Array Boolean Date Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),j="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),k="[object Arguments]",x="[object Array]",O="[object Boolean]",E="[object Date]",S="[object Function]",A="[object Number]",I="[object Object]",P="[object RegExp]",N="[object String]",$={};
$[S]=!1,$[k]=$[x]=$[O]=$[E]=$[A]=$[I]=$[P]=$[N]=!0;var q={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},B={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},F=t();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=F,define(function(){return F})):r&&!r.nodeType?u?(u.exports=F)._=F:r._=F:n._=F})(this);

623
dist/lodash.js vendored

File diff suppressed because it is too large Load Diff

76
dist/lodash.min.js vendored
View File

@@ -1,42 +1,44 @@
/** /**
* @license * @license
* Lo-Dash 1.1.1 (Custom Build) lodash.com/license * Lo-Dash 1.2.1 (Custom Build) lodash.com/license
* Build: `lodash modern -o ./dist/lodash.js` * Build: `lodash modern -o ./dist/lodash.js`
* Underscore.js 1.4.4 underscorejs.org/LICENSE * Underscore.js 1.4.4 underscorejs.org/LICENSE
*/ */
;(function(n){function t(r){function a(n){return n&&typeof n=="object"&&!ae(n)&&Ut.call(n,"__wrapped__")?n:new z(n)}function $(n,t,e){var r=n.length,u=r-t>=e;if(u){var a={};for(e=t-1;++e<r;){var o=$t(n[e]);(Ut.call(a,o)?a[o]:a[o]=[]).push(n[e])}}return function(e){if(u){var r=$t(e);return Ut.call(a,r)&&-1<gt(a[r],e)}return-1<gt(n,e,t)}}function q(n){return n.charCodeAt(0)}function B(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 ;(function(n){function t(o){function f(n){if(!n||ue.call(n)!=A)return a;var t=n.valueOf,e=typeof t=="function"&&(e=Zt(t))&&Zt(e);return e?n==e||Zt(n)==e:Y(n)}function D(n,t,e){if(!n||!R[typeof n])return n;t=t&&typeof e=="undefined"?t:U.createCallback(t,e);for(var r=-1,u=R[typeof n]?be(n):[],o=u.length;++r<o&&(e=u[r],!(t(n[e],e,n)===a)););return n}function z(n,t,e){var r;if(!n||!R[typeof n])return n;t=t&&typeof e=="undefined"?t:U.createCallback(t,e);for(r in n)if(t(n[r],r,n)===a)break;return n}function P(n,t,e){var r,u=n,a=u;
}return e<r?-1:1}function F(n,t,e,r){function u(){var r=arguments,c=o?this:t;return a||(n=t[i]),e.length&&(r=r.length?(r=M(r),f?r.concat(e):e.concat(r)):e),this instanceof u?(P.prototype=n.prototype,c=new P,P.prototype=null,r=n.apply(c,r),W(r)?r:c):n.apply(c,r)}var a=Q(n),o=!e,i=t;if(o){var f=r;e=t}else if(!a){if(!r)throw new qt;t=n}return u}function R(){for(var n,t={b:"k(m)",c:"",e:"m",f:"",h:"",i:!0,j:!!oe},e=0;n=arguments[e];e++)for(var r in n)t[r]=n[r];return n=t.a,t.d=/^[^,]+/.exec(n)[0],e=Nt,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+"){while(++i<n){"+t.f+"}}else{"),t.i&&t.j?r+="var s=-1,t=r[typeof m]?o(m):[],n=t.length;while(++s<n){i=t[s];"+t.f+"}":(r+="for(i in m){",t.i&&(r+="if(",t.i&&(r+="h.call(m,i)"),r+="){"),r+=t.f+";",t.i&&(r+="}"),r+="}"),t.b&&(r+="}"),r+=t.c+";return u",e("h,j,k,l,o,p,r","return function("+n+"){"+r+"}")(Ut,V,ae,Y,oe,a,I) if(!u)return a;for(var o=arguments,i=0,f=typeof e=="number"?2:o.length;++i<f;)if((u=o[i])&&R[typeof u]){var c=u.length;if(r=-1,me(u))for(;++r<c;)"undefined"==typeof a[r]&&(a[r]=u[r]);else for(var l=-1,p=R[typeof u]?be(u):[],c=p.length;++l<c;)r=p[l],"undefined"==typeof a[r]&&(a[r]=u[r])}return a}function K(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=U.createCallback(o[--f-1],o[f--],2);else 2<f&&"function"==typeof o[f-1]&&(c=o[--f]);
}function T(n){return"\\"+S[n]}function D(n){return ie[n]}function z(n){this.__wrapped__=n}function P(){}function K(n){var t=!1;if(!n||Jt.call(n)!=x)return t;var e=n.constructor;return(Q(e)?e instanceof e:ue.nodeClass||!isNode(n))?(pe(n,function(n,e){t=e}),!1===t||Ut.call(n,t)):t}function M(n,t,e){t||(t=0),typeof e=="undefined"&&(e=n?n.length:0);var r=-1;e=e-t||0;for(var u=Ct(0>e?0:e);++r<e;)u[r]=n[t+r];return u}function U(n){return fe[n]}function V(n){return Jt.call(n)==_}function G(n,t,r,u,o,i){var f=n; for(;++i<f;)if((u=o[i])&&R[typeof u]){var l=u.length;if(r=-1,me(u))for(;++r<l;)a[r]=c?c(a[r],u[r]):u[r];else for(var p=-1,s=R[typeof u]?be(u):[],l=s.length;++p<l;)r=s[p],a[r]=c?c(a[r],u[r]):u[r]}return a}function M(n){var t,e=[];if(!n||!R[typeof n])return e;for(t in n)ne.call(n,t)&&e.push(t);return e}function U(n){return n&&typeof n=="object"&&!me(n)&&ne.call(n,"__wrapped__")?n:new W(n)}function V(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;
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=W(f)){var c=Jt.call(f);if(!E[c])return f;var l=ae(f)}if(!u||!t)return u?l?M(f):ce({},f):f;switch(u=re[c],c){case w:case j:return new u(+f);case C:case N:return new u(f);case O:return u(f.source,v.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&&(Ut.call(n,"index")&&(f.index=n.index),Ut.call(n,"input")&&(f.input=n.input)),o.push(n),i.push(f),(l?at:se)(n,function(n,u){f[u]=G(n,t,r,e,o,i) return r[u]&&-1<xt(r[u],t)}return-1<xt(n,t)}}function G(n){return n.charCodeAt(0)}function H(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 J(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?(X.prototype=n.prototype,l=new X,X.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;
}),f}function H(n){var t=[];return pe(n,function(n,e){Q(n)&&t.push(e)}),t.sort()}function J(n){for(var t=-1,e=oe(n),r=e.length,u={};++t<r;){var a=e[t];u[n[a]]=a}return u}function L(n,t,e,r,u,o){var f=e===i;if(e&&!f){e=typeof r=="undefined"?e:a.createCallback(e,r,2);var c=e(n,t);if(typeof c!="undefined")return!!c}if(n===t)return 0!==n||1/n==1/t;var l=typeof n,p=typeof t;if(n===n&&(!n||"function"!=l&&"object"!=l)&&(!t||"function"!=p&&"object"!=p))return!1;if(null==n||null==t)return n===t;if(p=Jt.call(n),l=Jt.call(t),p==_&&(p=x),l==_&&(l=x),p!=l)return!1; e=t}else if(!o){if(!r)throw new Vt;t=n}return a}function L(n){return"\\"+T[n]}function Q(n){return de[n]}function W(n){this.__wrapped__=n}function X(){}function Y(n){var t=a;if(!n||ue.call(n)!=A)return t;var e=n.constructor;return(at(e)?e instanceof e:1)?(z(n,function(n,e){t=e}),t===a||ne.call(n,t)):t}function Z(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 nt(n){return _e[n]}function tt(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:U.createCallback(r,u,1),f=r(f),typeof f!="undefined")return f;
switch(p){case w:case j:return+n==+t;case C:return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case O:case N:return n==$t(t)}if(l=p==k,!l){if(Ut.call(n,"__wrapped__")||Ut.call(t,"__wrapped__"))return L(n.__wrapped__||n,t.__wrapped__||t,e,r,u,o);if(p!=x)return!1;var p=n.constructor,s=t.constructor;if(p!=s&&(!Q(p)||!(p instanceof p&&Q(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,c=!0;if(u.push(n),o.push(t),l){if(p=n.length,v=t.length,c=v==n.length,!c&&!f)return c; f=n}if(u=ot(f)){var c=ue.call(f);if(!F[c])return f;var l=me(f)}if(!u||!t)return u?l?Z(f):K({},f):f;switch(u=ye[c],c){case I:case N:return new u(+f);case S:case B:return new u(f);case $: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:D)(n,function(n,u){f[u]=tt(n,t,r,e,o,i)}),f}function et(n){var t=[];return z(n,function(n,e){at(n)&&t.push(e)
for(;v--;)if(l=p,s=t[v],f)for(;l--&&!(c=L(n[l],s,e,r,u,o)););else if(!(c=L(n[v],s,e,r,u,o)))break;return c}return pe(t,function(t,a,i){return Ut.call(i,a)?(v++,c=Ut.call(n,a)&&L(n[a],t,e,r,u,o)):void 0}),c&&!f&&pe(n,function(n,t,e){return Ut.call(e,t)?c=-1<--v:void 0}),c}function Q(n){return typeof n=="function"}function W(n){return n?I[typeof n]:!1}function X(n){return typeof n=="number"||Jt.call(n)==C}function Y(n){return typeof n=="string"||Jt.call(n)==N}function Z(n,t,e){var r=arguments,u=0,o=2; }),t.sort()}function rt(n){for(var t=-1,e=be(n),r=e.length,u={};++t<r;){var a=e[t];u[n[a]]=a}return u}function ut(n,t,e,o,i,f){var c=e===l;if(typeof e=="function"&&!c){e=U.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==O&&(v=A),s==O&&(s=A),v!=s)return a;switch(v){case I:case N:return+n==+t;
if(!W(n))return n;if(e===i)var f=r[3],c=r[4],l=r[5];else c=[],l=[],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;)(ae(r[u])?at:se)(r[u],function(t,e){var r,u,a=t,o=n[e];if(t&&((u=ae(t))||ve(t))){for(a=c.length;a--;)if(r=c[a]==t){o=l[a];break}r||(o=u?ae(o)?o:[]:ve(o)?o:{},f&&(a=f(o,t),typeof a!="undefined"&&(o=a)),c.push(t),l.push(o),f||(o=Z(o,t,i,f,c,l)))}else f&&(a=f(o,t),typeof a=="undefined"&&(a=t)),typeof a!="undefined"&&(o=a); case S:return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case $:case B:return n==Ut(t)}if(s=v==E,!s){if(ne.call(n,"__wrapped__")||ne.call(t,"__wrapped__"))return ut(n.__wrapped__||n,t.__wrapped__||t,e,o,i,f);if(v!=A)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;
n[e]=o});return n}function nt(n){for(var t=-1,e=oe(n),r=e.length,u=Ct(r);++t<r;)u[t]=n[e[t]];return u}function tt(n,t,e){var r=-1,u=n?n.length:0,a=!1;return e=(0>e?Zt(0,u+e):e)||0,typeof u=="number"?a=-1<(Y(n)?n.indexOf(t,e):gt(n,t,e)):se(n,function(n){return++r<e?void 0:!(a=n===t)}),a}function et(n,t,e){var r=!0;t=a.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 se(n,function(n,e,u){return r=!!t(n,e,u)});return r}function rt(n,t,e){var r=[]; return p}return z(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&&z(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?R[typeof n]:a}function it(n){return typeof n=="number"||ue.call(n)==S}function ft(n){return typeof n=="string"||ue.call(n)==B}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=U.createCallback(r[--a-1],r[a--],2):2<a&&"function"==typeof r[a-1]&&(o=r[--a]);
t=a.createCallback(t,e),e=-1;var u=n?n.length:0;if(typeof u=="number")for(;++e<u;){var o=n[e];t(o,e,n)&&r.push(o)}else se(n,function(n,e,u){t(n,e,u)&&r.push(n)});return r}function ut(n,t,e){t=a.createCallback(t,e),e=-1;var r=n?n.length:0;if(typeof r!="number"){var u;return se(n,function(n,e,r){return t(n,e,r)?(u=n,!1):void 0}),u}for(;++e<r;){var o=n[e];if(t(o,e,n))return o}}function at(n,t,e){var r=-1,u=n?n.length:0;if(t=t&&typeof e=="undefined"?t:a.createCallback(t,e),typeof u=="number")for(;++r<u&&!1!==t(n[r],r,n););else se(n,t); for(;++u<a;)(me(r[u])?yt:D)(r[u],function(t,e){var r,u,a=t,p=n[e];if(t&&((u=me(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?me(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=be(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)):D(n,function(n){return++r<e?void 0:!(o=n===t)
return n}function ot(n,t,e){var r=-1,u=n?n.length:0;if(t=a.createCallback(t,e),typeof u=="number")for(var o=Ct(u);++r<u;)o[r]=t(n[r],r,n);else o=[],se(n,function(n,e,u){o[++r]=t(n,e,u)});return o}function it(n,t,e){var r=-1/0,u=r;if(!t&&ae(n)){e=-1;for(var o=n.length;++e<o;){var i=n[e];i>u&&(u=i)}}else t=!t&&Y(n)?q:a.createCallback(t,e),at(n,function(n,e,a){e=t(n,e,a),e>r&&(r=e,u=n)});return u}function ft(n,t){var e=-1,r=n?n.length:0;if(typeof r=="number")for(var u=Ct(r);++e<r;)u[e]=n[e][t];return u||ot(n,t) }),o}function st(n,t,e){var u=r;t=U.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 D(n,function(n,e,r){return u=!!t(n,e,r)});return u}function vt(n,t,e){var r=[];t=U.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 D(n,function(n,e,u){t(n,e,u)&&r.push(n)});return r}function gt(n,t,e){t=U.createCallback(t,e),e=-1;var r=n?n.length:0;if(typeof r!="number"){var u;return D(n,function(n,e,r){return t(n,e,r)?(u=n,a):void 0
}function ct(n,t,e,r){if(!n)return e;var u=3>arguments.length;t=a.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 se(n,function(n,r,a){e=u?(u=!1,n):t(e,n,r,a)});return e}function lt(n,t,e,r){var u=n?n.length:0,o=3>arguments.length;if(typeof u!="number")var i=oe(n),u=i.length;return t=a.createCallback(t,r,4),at(n,function(r,a,f){a=i?i[--u]:--u,e=o?(o=!1,n[a]):t(e,n[a],a,f)}),e}function pt(n,t,e){var r;t=a.createCallback(t,e),e=-1;var u=n?n.length: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:U.createCallback(t,e),typeof u=="number")for(;++r<u&&t(n[r],r,n)!==a;);else D(n,t);return n}function ht(n,t,e){var r=-1,u=n?n.length:0;if(t=U.createCallback(t,e),typeof u=="number")for(var a=Rt(u);++r<u;)a[r]=t(n[r],r,n);else a=[],D(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&&me(n)){e=-1;for(var a=n.length;++e<a;){var o=n[e];o>u&&(u=o)
if(typeof u=="number")for(;++e<u&&!(r=t(n[e],e,n)););else se(n,function(n,e,u){return!(r=t(n,e,u))});return!!r}function st(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 M(n,0,ne(Zt(0,r),u))}}function vt(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)),ae(r)?Vt.apply(i,t?r:vt(r)):i.push(r); }}else t=!t&&ft(n)?G:U.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=U.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 D(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;
return i}function gt(n,t,e){var r=-1,u=n?n.length:0;if(typeof e=="number")r=(0>e?Zt(0,u+e):e||0)-1;else if(e)return r=yt(n,t),n[r]===t?r:-1;for(;++r<u;)if(n[r]===t)return r;return-1}function ht(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:Zt(0,t);return M(n,r)}function yt(n,t,e,r){var u=0,o=n?n.length:u;for(e=e?a.createCallback(e,r,1):kt,t=e(t);u<o;)r=u+o>>>1,e(n[r])<t?u=r+1:o=r;return u}function mt(n,t,e,r){var u=-1,o=n?n.length:0,i=[],f=i; if(typeof u!="number")var i=be(n),u=i.length;return t=U.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=U.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 D(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=V(r),u=[];++t<e;){var a=n[t];r(a)||u.push(a)}return u}function jt(n,t,e){if(n){var r=0,a=n.length;
typeof t!="boolean"&&null!=t&&(r=e,e=t,t=!1);var c=!t&&75<=o;if(c)var l={};for(null!=e&&(f=[],e=a.createCallback(e,r));++u<o;){r=n[u];var p=e?e(r,u,n):r;if(c)var s=$t(p),s=Ut.call(l,s)?!(f=l[s]):f=l[s]=[];(t?!u||f[f.length-1]!==p:s||0>gt(f,p))&&((e||c)&&f.push(p),i.push(r))}return i}function bt(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 dt(n,t){return ue.fastBind||Lt&&2<arguments.length?Lt.call.apply(Lt,arguments):F(n,t,M(arguments,2))}function _t(n){var t=M(arguments,1); if(typeof t!="number"&&t!=u){var o=-1;for(t=U.createCallback(t,e);++o<a&&t(n[o],o,n);)r++}else if(r=t,r==u||e)return n[0];return Z(n,0,pe(le(0,r),a))}}function Ct(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=U.createCallback(e,r));++o<i;)r=n[o],e&&(r=e(r,o,n)),me(r)?te.apply(f,t?r:Ct(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=Et(n,t),n[r]===t?r:-1;for(;++r<u;)if(n[r]===t)return r;
return Ht(function(){n.apply(e,t)},1)}function kt(n){return n}function wt(n){at(H(n),function(t){var e=a[t]=n[t];a.prototype[t]=function(){var n=this.__wrapped__,t=[n];return Vt.apply(t,arguments),t=e.apply(a,t),n&&typeof n=="object"&&n==t?this:new z(t)}})}function jt(){return this.__wrapped__}r=r?A.defaults(n.Object(),r,A.pick(n,d)):n;var Ct=r.Array,xt=r.Boolean,Ot=r.Date,Nt=r.Function,Et=r.Math,It=r.Number,St=r.Object,At=r.RegExp,$t=r.String,qt=r.TypeError,Bt=Ct(),Ft=St(),Rt=r._,Tt=At("^"+$t(Ft.valueOf).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),Dt=Et.ceil,zt=r.clearTimeout,Pt=Bt.concat,Kt=Et.floor,Mt=Tt.test(Mt=St.getPrototypeOf)&&Mt,Ut=Ft.hasOwnProperty,Vt=Bt.push,Gt=r.setImmediate,Ht=r.setTimeout,Jt=Ft.toString,Lt=Tt.test(Lt=M.bind)&&Lt,Qt=Tt.test(Qt=Ct.isArray)&&Qt,Wt=r.isFinite,Xt=r.isNaN,Yt=Tt.test(Yt=St.keys)&&Yt,Zt=Et.max,ne=Et.min,te=r.parseInt,ee=Et.random,Et=Tt.test(r.attachEvent),Et=Lt&&!/\n|true/.test(Lt+Et),re={}; 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=U.createCallback(t,e);++a<o&&t(n[a],a,n);)r++}else r=t==u||e?1:le(0,t);return Z(n,r)}function Et(n,t,e,r){var u=0,a=n?n.length:u;for(e=e?U.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 It(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=U.createCallback(e,r));++o<i;){r=n[o];var g=e?e(r,o,n):r;
re[k]=Ct,re[w]=xt,re[j]=Ot,re[x]=St,re[C]=It,re[O]=At,re[N]=$t;var ue=a.support={};ue.fastBind=Lt&&!Et,a.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:g,variable:"",imports:{_:a}},xt={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:"}}"},It={a:"e,d,x",h:"d=d&&typeof x=='undefined'?d:p.createCallback(d,x)",b:!1,f:"if(d(m[i],i,e)===false)return u"},St={h:"if(!r[typeof m])return u;"+It.h,b:!1},z.prototype=a.prototype; 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 Nt(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):J(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(et(n),function(t){var e=U[t]=n[t];U.prototype[t]=function(){var n=this.__wrapped__,t=[n];
var ae=Qt||function(n){return n instanceof Ct||Jt.call(n)==k},Qt=R({a:"q",e:"[]",h:"if(!(r[typeof q]))return u",f:"u.push(i)",b:!1}),oe=Yt?function(n){return W(n)?Yt(n):[]}:Qt,ie={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},fe=J(ie),ce=R(xt,{h:xt.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]"}),le=R(xt),pe=R(It,St,{i:!1}),se=R(It,St),ve=function(n){if(!n||Jt.call(n)!=x)return!1; return te.apply(t,arguments),t=e.apply(U,t),n&&typeof n=="object"&&n==t?this:new W(t)}})}function Ft(){return this.__wrapped__}o=o?q.defaults(n.Object(),o,q.pick(n,x)):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={};
var t=n.valueOf,e=typeof t=="function"&&(e=Mt(t))&&Mt(e);return e?n==e||Mt(n)==e:K(n)};return Et&&u&&typeof Gt=="function"&&(_t=dt(Gt,r)),Gt=8==te("08")?te:function(n,t){return te(Y(n)?n.replace(h,""):n,t||0)},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){for(var t=-1,e=Pt.apply(Bt,M(arguments,1)),r=e.length,u=Ct(r);++t<r;)u[t]=n[e[t]];return u},a.bind=dt,a.bindAll=function(n){for(var t=Pt.apply(Bt,arguments),e=1<t.length?0:(t=H(n),-1),r=t.length;++e<r;){var u=t[e]; ye[E]=Rt,ye[I]=Tt,ye[N]=qt,ye[A]=Kt,ye[S]=Pt,ye[$]=Mt,ye[B]=Ut;var he=U.support={};he.fastBind=ae&&!zt,U.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:d,variable:"",imports:{_:U}},W.prototype=U.prototype;var me=oe,be=ce?function(n){return ot(n)?ce(n):[]}:M,de={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},_e=rt(de);return zt&&i&&typeof ee=="function"&&(At=St(ee,o)),Tt=8==se(_+"08")?se:function(n,t){return se(ft(n)?n.replace(k,""):n,t||0)},U.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0
n[u]=dt(n[u],n)}return n},a.bindKey=function(n,t){return F(n,t,M(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),at(n,function(n,e,u){e=$t(t(n,e,u)),Ut.call(r,e)?r[e]++:r[e]=1}),r},a.createCallback=function(n,t,e){if(null==n)return kt;var r=typeof n; }},U.assign=K,U.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},U.bind=St,U.bindAll=function(n){for(var t=1<arguments.length?Xt.apply(Gt,ge.call(arguments,1)):et(n),e=-1,r=t.length;++e<r;){var u=t[e];n[u]=St(n[u],n)}return n},U.bindKey=function(n,t){return J(n,t,ge.call(arguments,2),l)},U.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},U.compose=function(){var n=arguments;return function(){for(var t=arguments,e=n.length;e--;)t=[n[e].apply(this,t)];
if("function"!=r){if("object"!=r)return function(t){return t[n]};var u=oe(n);return function(t){for(var e=u.length,r=!1;e--&&(r=L(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,e||(a=n.apply(o,u))}var u,a,o,i;return function(){var f=e&&!i;return u=arguments,o=this,zt(i),i=Ht(r,t),f&&(a=n.apply(o,u)),a return t[0]}},U.countBy=function(n,t,e){var r={};return t=U.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},U.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=be(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)
}},a.defaults=le,a.defer=_t,a.delay=function(n,t){var r=M(arguments,2);return Ht(function(){n.apply(e,r)},t)},a.difference=function(n){for(var t=-1,e=n?n.length:0,r=Pt.apply(Bt,arguments),r=$(r,e,100),u=[];++t<e;){var a=n[t];r(a)||u.push(a)}return u},a.filter=rt,a.flatten=vt,a.forEach=at,a.forIn=pe,a.forOwn=se,a.functions=H,a.groupBy=function(n,t,e){var r={};return t=a.createCallback(t,e),at(n,function(n,e,u){e=$t(t(n,e,u)),(Ut.call(r,e)?r[e]:r[e]=[]).push(n)}),r},a.initial=function(n,t,e){if(!n)return[]; }:function(e,r,u){return n.call(t,e,r,u)}:n},U.debounce=function(n,t,e){function o(){f=p=u,s&&(c=n.apply(l,i))}var i,f,c,l,p,s=r;if(e===r)var v=r,s=a;else e&&R[typeof e]&&(v=e.leading,s="trailing"in e?e.trailing:s);return function(){return i=arguments,l=this,Wt(p),!f&&v?(f=r,c=n.apply(l,i)):p=re(o,t),c}},U.defaults=P,U.defer=At,U.delay=function(n,t){var r=ge.call(arguments,2);return re(function(){n.apply(e,r)},t)},U.difference=wt,U.filter=vt,U.flatten=Ct,U.forEach=yt,U.forIn=z,U.forOwn=D,U.functions=et,U.groupBy=function(n,t,e){var r={};
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 M(n,0,ne(Zt(0,u-r),u))},a.intersection=function(n){var t=arguments,e=t.length,r={0:{}},u=-1,a=n?n.length:0,o=100<=a,i=[],f=i;n:for(;++u<a;){var c=n[u];if(o)var l=$t(c),l=Ut.call(r[0],l)?!(f=r[0][l]):f=r[0][l]=[];if(l||0>gt(f,c)){o&&f.push(c);for(var p=e;--p;)if(!(r[p]||(r[p]=$(t[p],0,100)))(c))continue n;i.push(c)}}return i},a.invert=J,a.invoke=function(n,t){var e=M(arguments,2),r=-1,u=typeof t=="function",a=n?n.length:0,o=Ct(typeof a=="number"?a:0); return t=U.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},U.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=U.createCallback(t,e);o--&&t(n[o],o,n);)r++}else r=t==u||e?1:t||r;return Z(n,0,pe(le(0,a-r),a))},U.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);
return at(n,function(n){o[++r]=(u?t:n[t]).apply(n,e)}),o},a.keys=oe,a.map=ot,a.max=it,a.memoize=function(n,t){var e={};return function(){var r=$t(t?t.apply(this,arguments):arguments[0]);return Ut.call(e,r)?e[r]:e[r]=n.apply(this,arguments)}},a.merge=Z,a.min=function(n,t,e){var r=1/0,u=r;if(!t&&ae(n)){e=-1;for(var o=n.length;++e<o;){var i=n[e];i<u&&(u=i)}}else t=!t&&Y(n)?q:a.createCallback(t,e),at(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={}; for(var v=e;--v;)if(!(r[v]||(r[v]=V(t[v])))(c))continue n;i.push(c)}}return i},U.invert=rt,U.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},U.keys=be,U.map=ht,U.max=mt,U.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)}},U.merge=ct,U.min=function(n,t,e){var r=1/0,u=r;
if(r)t=a.createCallback(t,e);else var o=Pt.apply(Bt,arguments);return pe(n,function(n,e,a){(r?!t(n,e,a):0>gt(o,e,1))&&(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=oe(n),r=e.length,u=Ct(r);++t<r;){var a=e[t];u[t]=[a,n[a]]}return u},a.partial=function(n){return F(n,M(arguments,1))},a.partialRight=function(n){return F(n,M(arguments,1),null,i)},a.pick=function(n,t,e){var r={};if(typeof t!="function")for(var u=0,o=Pt.apply(Bt,arguments),i=W(n)?o.length:0;++u<i;){var f=o[u]; if(!t&&me(n)){e=-1;for(var a=n.length;++e<a;){var o=n[e];o<u&&(u=o)}}else t=!t&&ft(n)?G:U.createCallback(t,e),yt(n,function(n,e,a){e=t(n,e,a),e<r&&(r=e,u=n)});return u},U.omit=function(n,t,e){var r=typeof t=="function",u={};if(r)t=U.createCallback(t,e);else var a=Xt.apply(Gt,ge.call(arguments,1));return z(n,function(n,e,o){(r?!t(n,e,o):0>xt(a,e))&&(u[e]=n)}),u},U.once=function(n){var t,e;return function(){return t?e:(t=r,e=n.apply(this,arguments),n=u,e)}},U.pairs=function(n){for(var t=-1,e=be(n),r=e.length,u=Rt(r);++t<r;){var a=e[t];
f in n&&(r[f]=n[f])}else t=a.createCallback(t,e),pe(n,function(n,e,u){t(n,e,u)&&(r[e]=n)});return r},a.pluck=ft,a.range=function(n,t,e){n=+n||0,e=+e||1,null==t&&(t=n,n=0);var r=-1;t=Zt(0,Dt((t-n)/e));for(var u=Ct(t);++r<t;)u[r]=n,n+=e;return u},a.reject=function(n,t,e){return t=a.createCallback(t,e),rt(n,function(n,e,r){return!t(n,e,r)})},a.rest=ht,a.shuffle=function(n){var t=-1,e=n?n.length:0,r=Ct(typeof e=="number"?e:0);return at(n,function(n){var e=Kt(ee()*(++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=Ct(typeof u=="number"?u:0); u[t]=[a,n[a]]}return u},U.partial=function(n){return J(n,ge.call(arguments,1))},U.partialRight=function(n){return J(n,ge.call(arguments,1),u,l)},U.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=U.createCallback(t,e),z(n,function(n,e,u){t(n,e,u)&&(r[e]=n)});return r},U.pluck=bt,U.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;
for(t=a.createCallback(t,e),at(n,function(n,e,u){o[++r]={a:t(n,e,u),b:r,c:n}}),u=o.length,o.sort(B);u--;)o[u]=o[u].c;return o},a.tap=function(n,t){return t(n),n},a.throttle=function(n,t){function e(){i=new Ot,o=null,u=n.apply(a,r)}var r,u,a,o,i=0;return function(){var f=new Ot,c=t-(f-i);return r=arguments,a=this,0<c?o||(o=Ht(e,c)):(zt(o),o=null,i=f,u=n.apply(a,r)),u}},a.times=function(n,t,e){n=-1<(n=+n)?n:0;var r=-1,u=Ct(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"?M(n):nt(n) return a},U.reject=function(n,t,e){return t=U.createCallback(t,e),vt(n,function(n,e,r){return!t(n,e,r)})},U.rest=Ot,U.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},U.sortBy=function(n,t,e){var r=-1,u=n?n.length:0,a=Rt(typeof u=="number"?u:0);for(t=U.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(H);u--;)a[u]=a[u].c;return a},U.tap=function(n,t){return t(n),n},U.throttle=function(n,t,e){function o(){l=u,v&&(p=new qt,f=n.apply(c,i))
},a.union=function(){return mt(Pt.apply(Bt,arguments))},a.uniq=mt,a.values=nt,a.where=rt,a.without=function(n){for(var t=-1,e=n?n.length:0,r=$(arguments,1,30),u=[];++t<e;){var a=n[t];r(a)||u.push(a)}return u},a.wrap=function(n,t){return function(){var e=[n];return Vt.apply(e,arguments),t.apply(this,e)}},a.zip=function(n){for(var t=-1,e=n?it(ft(arguments,"length")):0,r=Ct(e);++t<e;)r[t]=ft(arguments,t);return r},a.zipObject=bt,a.collect=ot,a.drop=ht,a.each=at,a.extend=ce,a.methods=H,a.object=bt,a.select=rt,a.tail=ht,a.unique=mt,wt(a),a.clone=G,a.cloneDeep=function(n,t,e){return G(n,!0,t,e) }var i,f,c,l,p=0,s=r,v=r;return e===a?s=a:e&&R[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}},U.times=function(n,t,e){n=-1<(n=+n)?n:0;var r=-1,u=Rt(n);for(t=U.createCallback(t,e,1);++r<n;)u[r]=t(r);return u},U.toArray=function(n){return n&&typeof n.length=="number"?Z(n):lt(n)},U.union=function(n){return me(n)||(arguments[0]=n?ge.call(n):Gt),It(Xt.apply(Gt,arguments))
},a.contains=tt,a.escape=function(n){return null==n?"":$t(n).replace(m,D)},a.every=et,a.find=ut,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),se(n,function(n,e,u){return t(n,e,u)?(r=e,!1):void 0}),r},a.has=function(n,t){return n?Ut.call(n,t):!1},a.identity=kt,a.indexOf=gt,a.isArguments=V,a.isArray=ae,a.isBoolean=function(n){return!0===n||!1===n||Jt.call(n)==w},a.isDate=function(n){return n instanceof Ot||Jt.call(n)==j },U.uniq=It,U.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},U.values=lt,U.where=vt,U.without=function(n){return wt(n,ge.call(arguments,1))},U.wrap=function(n,t){return function(){var e=[n];return te.apply(e,arguments),t.apply(this,e)}},U.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},U.zipObject=Nt,U.collect=ht,U.drop=Ot,U.each=yt,U.extend=K,U.methods=et,U.object=Nt,U.select=vt,U.tail=Ot,U.unique=It,Bt(U),U.clone=tt,U.cloneDeep=function(n,t,e){return tt(n,r,t,e)
},a.isElement=function(n){return n?1===n.nodeType:!1},a.isEmpty=function(n){var t=!0;if(!n)return t;var e=Jt.call(n),r=n.length;return e==k||e==N||e==_||e==x&&typeof r=="number"&&Q(n.splice)?!r:(se(n,function(){return t=!1}),t)},a.isEqual=L,a.isFinite=function(n){return Wt(n)&&!Xt(parseFloat(n))},a.isFunction=Q,a.isNaN=function(n){return X(n)&&n!=+n},a.isNull=function(n){return null===n},a.isNumber=X,a.isObject=W,a.isPlainObject=ve,a.isRegExp=function(n){return n instanceof At||Jt.call(n)==O},a.isString=Y,a.isUndefined=function(n){return typeof n=="undefined" },U.contains=pt,U.escape=function(n){return n==u?"":Ut(n).replace(j,Q)},U.every=st,U.find=gt,U.findIndex=function(n,t,e){var r=-1,u=n?n.length:0;for(t=U.createCallback(t,e);++r<u;)if(t(n[r],r,n))return r;return-1},U.findKey=function(n,t,e){var r;return t=U.createCallback(t,e),D(n,function(n,e,u){return t(n,e,u)?(r=e,a):void 0}),r},U.has=function(n,t){return n?ne.call(n,t):a},U.identity=$t,U.indexOf=xt,U.isArguments=function(n){return ue.call(n)==O},U.isArray=me,U.isBoolean=function(n){return n===r||n===a||ue.call(n)==I
},a.lastIndexOf=function(n,t,e){var r=n?n.length:0;for(typeof e=="number"&&(r=(0>e?Zt(0,r+e):ne(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},a.mixin=wt,a.noConflict=function(){return r._=Rt,this},a.parseInt=Gt,a.random=function(n,t){return null==n&&null==t&&(t=1),n=+n||0,null==t&&(t=n,n=0),n+Kt(ee()*((+t||0)-n+1))},a.reduce=ct,a.reduceRight=lt,a.result=function(n,t){var r=n?n[t]:e;return Q(r)?n[t]():r},a.runInContext=t,a.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:oe(n).length },U.isDate=function(n){return n?typeof n=="object"&&ue.call(n)==N:a},U.isElement=function(n){return n?1===n.nodeType:a},U.isEmpty=function(n){var t=r;if(!n)return t;var e=ue.call(n),u=n.length;return e==E||e==B||e==O||e==A&&typeof u=="number"&&at(n.splice)?!u:(D(n,function(){return t=a}),t)},U.isEqual=ut,U.isFinite=function(n){return ie(n)&&!fe(parseFloat(n))},U.isFunction=at,U.isNaN=function(n){return it(n)&&n!=+n},U.isNull=function(n){return n===u},U.isNumber=it,U.isObject=ot,U.isPlainObject=f,U.isRegExp=function(n){return n?typeof n=="object"&&ue.call(n)==$:a
},a.some=pt,a.sortedIndex=yt,a.template=function(n,t,r){var u=a.templateSettings;n||(n=""),r=le({},r,u);var o,i=le({},r.imports,u.imports),u=oe(i),i=nt(i),p=0,v=r.interpolate||y,h="__p+='",v=At((r.escape||y).source+"|"+v.source+"|"+(v===g?s:y).source+"|"+(r.evaluate||y).source+"|$","g");n.replace(v,function(t,e,r,u,a,i){return r||(r=u),h+=n.slice(p,i).replace(b,T),e&&(h+="'+__e("+e+")+'"),a&&(o=!0,h+="';"+a+";__p+='"),r&&(h+="'+((__t=("+r+"))==null?'':__t)+'"),p=i+t.length,t}),h+="';\n",v=r=r.variable,v||(r="obj",h="with("+r+"){"+h+"}"),h=(o?h.replace(f,""):h).replace(c,"$1").replace(l,"$1;"),h="function("+r+"){"+(v?"":r+"||("+r+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+h+"return __p}"; },U.isString=ft,U.isUndefined=function(n){return typeof n=="undefined"},U.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},U.mixin=Bt,U.noConflict=function(){return o._=Jt,this},U.parseInt=Tt,U.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))},U.reduce=dt,U.reduceRight=_t,U.result=function(n,t){var r=n?n[t]:e;return at(r)?n[t]():r},U.runInContext=t,U.size=function(n){var t=n?n.length:0;
try{var m=Nt(u,"return "+h).apply(e,i)}catch(d){throw d.source=h,d}return t?m(t):(m.source=h,m)},a.unescape=function(n){return null==n?"":$t(n).replace(p,U)},a.uniqueId=function(n){var t=++o;return $t(null==n?"":n)+t},a.all=et,a.any=pt,a.detect=ut,a.foldl=ct,a.foldr=lt,a.include=tt,a.inject=ct,se(a,function(n,t){a.prototype[t]||(a.prototype[t]=function(){var t=[this.__wrapped__];return Vt.apply(t,arguments),n.apply(a,t)})}),a.first=st,a.last=function(n,t,e){if(n){var r=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u; return typeof t=="number"?t:be(n).length},U.some=kt,U.sortedIndex=Et,U.template=function(n,t,u){var a=U.templateSettings;n||(n=""),u=P({},u,a);var o,i=P({},u.imports,a.imports),a=be(i),i=lt(i),f=0,c=u.interpolate||w,l="__p+='",c=Mt((u.escape||w).source+"|"+c.source+"|"+(c===d?m:w).source+"|"+(u.evaluate||w).source+"|$","g");n.replace(c,function(t,e,u,a,i,c){return u||(u=a),l+=n.slice(f,c).replace(C,L),e&&(l+="'+__e("+e+")+'"),i&&(o=r,l+="';"+i+";__p+='"),u&&(l+="'+((__t=("+u+"))==null?'':__t)+'"),f=c+t.length,t
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 M(n,Zt(0,u-r))}},a.take=st,a.head=st,se(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 z(r)})}),a.VERSION="1.1.1",a.prototype.toString=function(){return $t(this.__wrapped__)},a.prototype.value=jt,a.prototype.valueOf=jt,at(["join","pop","shift"],function(n){var t=Bt[n];a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments) }),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)},U.unescape=function(n){return n==u?"":Ut(n).replace(h,nt)},U.uniqueId=function(n){var t=++c;return Ut(n==u?"":n)+t
}}),at(["push","reverse","sort","unshift"],function(n){var t=Bt[n];a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),at(["concat","slice","splice"],function(n){var t=Bt[n];a.prototype[n]=function(){return new z(t.apply(this.__wrapped__,arguments))}}),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&&(n=a);var o=0,i={},f=/\b__p\+='';/g,c=/\b(__p\+=)''\+/g,l=/(__e\(.*?\)|\b__t\))\+'';/g,p=/&(?:amp|lt|gt|quot|#39);/g,s=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,v=/\w*$/,g=/<%=([\s\S]+?)%>/g,h=/^0+(?=.$)/,y=/($^)/,m=/[&<>"']/g,b=/['\n\r\t\u2028\u2029\\]/g,d="Array Boolean Date Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),_="[object Arguments]",k="[object Array]",w="[object Boolean]",j="[object Date]",C="[object Number]",x="[object Object]",O="[object RegExp]",N="[object String]",E={"[object Function]":!1}; },U.all=st,U.any=kt,U.detect=gt,U.foldl=dt,U.foldr=_t,U.include=pt,U.inject=dt,D(U,function(n,t){U.prototype[t]||(U.prototype[t]=function(){var t=[this.__wrapped__];return te.apply(t,arguments),n.apply(U,t)})}),U.first=jt,U.last=function(n,t,e){if(n){var r=0,a=n.length;if(typeof t!="number"&&t!=u){var o=a;for(t=U.createCallback(t,e);o--&&t(n[o],o,n);)r++}else if(r=t,r==u||e)return n[a-1];return Z(n,le(0,a-r))}},U.take=jt,U.head=jt,D(U,function(n,t){U.prototype[t]||(U.prototype[t]=function(t,e){var r=n(this.__wrapped__,t,e);
E[_]=E[k]=E[w]=E[j]=E[C]=E[x]=E[O]=E[N]=!0;var I={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},S={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"},A=t();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=A,define(function(){return A})):r&&!r.nodeType?u?(u.exports=A)._=A:r._=A:n._=A})(this); return t==u||e&&typeof t!="function"?r:new W(r)})}),U.VERSION="1.2.1",U.prototype.toString=function(){return Ut(this.__wrapped__)},U.prototype.value=Ft,U.prototype.valueOf=Ft,yt(["join","pop","shift"],function(n){var t=Gt[n];U.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),yt(["push","reverse","sort","unshift"],function(n){var t=Gt[n];U.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),yt(["concat","slice","splice"],function(n){var t=Gt[n];U.prototype[n]=function(){return new W(t.apply(this.__wrapped__,arguments))
}}),U}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,_=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",k=RegExp("^["+_+"]*0+(?=.$)"),w=/($^)/,j=/[&<>"']/g,C=/['\n\r\t\u2028\u2029\\]/g,x="Array Boolean Date Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),O="[object Arguments]",E="[object Array]",I="[object Boolean]",N="[object Date]",S="[object Number]",A="[object Object]",$="[object RegExp]",B="[object String]",F={"[object Function]":a};
F[O]=F[E]=F[I]=F[N]=F[S]=F[A]=F[$]=F[B]=r;var R={"boolean":a,"function":r,object:r,number:a,string:a,undefined:a},T={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},q=t();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=q,define(function(){return q})):o&&!o.nodeType?i?(i.exports=q)._=q:o._=q:n._=q})(this);

View File

@@ -1,6 +1,6 @@
/** /**
* @license * @license
* Lo-Dash 1.1.1 (Custom Build) <http://lodash.com/> * Lo-Dash 1.2.1 (Custom Build) <http://lodash.com/>
* Build: `lodash underscore exports="amd,commonjs,global,node" -o ./dist/lodash.underscore.js` * Build: `lodash underscore exports="amd,commonjs,global,node" -o ./dist/lodash.underscore.js`
* Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/> * Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/>
* Based on Underscore.js 1.4.4 <http://underscorejs.org/> * Based on Underscore.js 1.4.4 <http://underscorejs.org/>
@@ -18,9 +18,9 @@
/** Detect free variable `module` */ /** Detect free variable `module` */
var freeModule = typeof module == 'object' && module && module.exports == freeExports && module; var freeModule = typeof module == 'object' && module && module.exports == freeExports && module;
/** Detect free variable `global` and use it as `window` */ /** Detect free variable `global`, from Node.js or Browserified code, and use it as `window` */
var freeGlobal = typeof global == 'object' && global; var freeGlobal = typeof global == 'object' && global;
if (freeGlobal.global === freeGlobal) { if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {
window = freeGlobal; window = freeGlobal;
} }
@@ -30,6 +30,12 @@
/** Used internally to indicate various things */ /** Used internally to indicate various things */
var indicatorObject = {}; var indicatorObject = {};
/** Used to prefix keys to avoid issues with `__proto__` and properties on `Object.prototype` */
var keyPrefix = +new Date + '';
/** Used as the size when optimizations are enabled for large arrays */
var largeArraySize = 200;
/** Used to match empty string literals in compiled template source */ /** Used to match empty string literals in compiled template source */
var reEmptyStringLeading = /\b__p \+= '';/g, var reEmptyStringLeading = /\b__p \+= '';/g,
reEmptyStringMiddle = /\b(__p \+=) '' \+/g, reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
@@ -118,18 +124,18 @@
hasOwnProperty = objectRef.hasOwnProperty, hasOwnProperty = objectRef.hasOwnProperty,
push = arrayRef.push, push = arrayRef.push,
setTimeout = window.setTimeout, setTimeout = window.setTimeout,
slice = arrayRef.slice,
toString = objectRef.toString; toString = objectRef.toString;
/* Native method shortcuts for methods with the same name as other `lodash` methods */ /* Native method shortcuts for methods with the same name as other `lodash` methods */
var nativeBind = reNative.test(nativeBind = slice.bind) && nativeBind, var nativeBind = reNative.test(nativeBind = toString.bind) && nativeBind,
nativeIsArray = reNative.test(nativeIsArray = Array.isArray) && nativeIsArray, nativeIsArray = reNative.test(nativeIsArray = Array.isArray) && nativeIsArray,
nativeIsFinite = window.isFinite, nativeIsFinite = window.isFinite,
nativeIsNaN = window.isNaN, nativeIsNaN = window.isNaN,
nativeKeys = reNative.test(nativeKeys = Object.keys) && nativeKeys, nativeKeys = reNative.test(nativeKeys = Object.keys) && nativeKeys,
nativeMax = Math.max, nativeMax = Math.max,
nativeMin = Math.min, nativeMin = Math.min,
nativeRandom = Math.random; nativeRandom = Math.random,
nativeSlice = arrayRef.slice;
/** Detect various environments */ /** Detect various environments */
var isIeOpera = reNative.test(window.attachEvent), var isIeOpera = reNative.test(window.attachEvent),
@@ -138,7 +144,7 @@
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
/** /**
* Creates a `lodash` object, that wraps the given `value`, to enable method * Creates a `lodash` object, which wraps the given `value`, to enable method
* chaining. * chaining.
* *
* In addition to Lo-Dash methods, wrappers also have the following `Array` methods: * In addition to Lo-Dash methods, wrappers also have the following `Array` methods:
@@ -156,8 +162,8 @@
* `invoke`, `keys`, `map`, `max`, `memoize`, `merge`, `min`, `object`, `omit`, * `invoke`, `keys`, `map`, `max`, `memoize`, `merge`, `min`, `object`, `omit`,
* `once`, `pairs`, `partial`, `partialRight`, `pick`, `pluck`, `push`, `range`, * `once`, `pairs`, `partial`, `partialRight`, `pick`, `pluck`, `push`, `range`,
* `reject`, `rest`, `reverse`, `shuffle`, `slice`, `sort`, `sortBy`, `splice`, * `reject`, `rest`, `reverse`, `shuffle`, `slice`, `sort`, `sortBy`, `splice`,
* `tap`, `throttle`, `times`, `toArray`, `union`, `uniq`, `unshift`, `values`, * `tap`, `throttle`, `times`, `toArray`, `union`, `uniq`, `unshift`, `unzip`,
* `where`, `without`, `wrap`, and `zip` * `values`, `where`, `without`, `wrap`, and `zip`
* *
* The non-chainable wrapper functions are: * The non-chainable wrapper functions are:
* `clone`, `cloneDeep`, `contains`, `escape`, `every`, `find`, `has`, * `clone`, `cloneDeep`, `contains`, `escape`, `every`, `find`, `has`,
@@ -176,6 +182,26 @@
* @category Chaining * @category Chaining
* @param {Mixed} value The value to wrap in a `lodash` instance. * @param {Mixed} value The value to wrap in a `lodash` instance.
* @returns {Object} Returns a `lodash` instance. * @returns {Object} Returns a `lodash` instance.
* @example
*
* var wrapped = _([1, 2, 3]);
*
* // returns an unwrapped value
* wrapped.reduce(function(sum, num) {
* return sum + num;
* });
* // => 6
*
* // returns a wrapped value
* var squares = wrapped.map(function(num) {
* return num * num;
* });
*
* _.isArray(squares);
* // => false
*
* _.isArray(squares.value());
* // => true
*/ */
function lodash(value) { function lodash(value) {
return (value instanceof lodash) return (value instanceof lodash)
@@ -195,14 +221,6 @@
(function() { (function() {
var object = { '0': 1, 'length': 1 }; var object = { '0': 1, 'length': 1 };
/**
* Detect if `arguments` objects are `Object` objects (all but Opera < 10.5).
*
* @memberOf _.support
* @type Boolean
*/
support.argsObject = arguments.constructor == Object;
/** /**
* Detect if `Function#bind` exists and is inferred to be fast (all but V8). * Detect if `Function#bind` exists and is inferred to be fast (all but V8).
* *
@@ -354,7 +372,7 @@
} }
if (partialArgs.length) { if (partialArgs.length) {
args = args.length args = args.length
? (args = slice.call(args), rightIndicator ? args.concat(partialArgs) : partialArgs.concat(args)) ? (args = nativeSlice.call(args), rightIndicator ? args.concat(partialArgs) : partialArgs.concat(args))
: partialArgs; : partialArgs;
} }
if (this instanceof bound) { if (this instanceof bound) {
@@ -474,13 +492,11 @@
* // => true * // => true
*/ */
var isArray = nativeIsArray || function(value) { var isArray = nativeIsArray || function(value) {
// `instanceof` may cause a memory leak in IE 7 if `value` is a host object return value ? (typeof value == 'object' && toString.call(value) == arrayClass) : false;
// http://ajaxian.com/archives/working-aroung-the-instanceof-memory-leak
return (support.argsObject && value instanceof Array) || toString.call(value) == arrayClass;
}; };
/** /**
* A fallback implementation of `Object.keys` that produces an array of the * A fallback implementation of `Object.keys` which produces an array of the
* given object's own enumerable property names. * given object's own enumerable property names.
* *
* @private * @private
@@ -631,7 +647,7 @@
*/ */
function clone(value) { function clone(value) {
return isObject(value) return isObject(value)
? (isArray(value) ? slice.call(value) : assign({}, value)) ? (isArray(value) ? nativeSlice.call(value) : assign({}, value))
: value; : value;
} }
@@ -847,7 +863,7 @@
* // => true * // => true
*/ */
function isDate(value) { function isDate(value) {
return value instanceof Date || toString.call(value) == dateClass; return value ? (typeof value == 'object' && toString.call(value) == dateClass) : false;
} }
/** /**
@@ -1092,7 +1108,7 @@
// fallback for older versions of Chrome and Safari // fallback for older versions of Chrome and Safari
if (isFunction(/x/)) { if (isFunction(/x/)) {
isFunction = function(value) { isFunction = function(value) {
return value instanceof Function || toString.call(value) == funcClass; return typeof value == 'function' && toString.call(value) == funcClass;
}; };
} }
@@ -1206,7 +1222,7 @@
* // => true * // => true
*/ */
function isRegExp(value) { function isRegExp(value) {
return value instanceof RegExp || toString.call(value) == regexpClass; return value ? (objectTypes[typeof value] && toString.call(value) == regexpClass) : false;
} }
/** /**
@@ -1270,11 +1286,11 @@
* // => { 'name': 'moe' } * // => { 'name': 'moe' }
*/ */
function omit(object) { function omit(object) {
var props = concat.apply(arrayRef, arguments), var props = concat.apply(arrayRef, nativeSlice.call(arguments, 1)),
result = {}; result = {};
forIn(object, function(value, key) { forIn(object, function(value, key) {
if (indexOf(props, key, 1) < 0) { if (indexOf(props, key) < 0) {
result[key] = value; result[key] = value;
} }
}); });
@@ -1334,8 +1350,8 @@
* // => { 'name': 'moe' } * // => { 'name': 'moe' }
*/ */
function pick(object) { function pick(object) {
var index = 0, var index = -1,
props = concat.apply(arrayRef, arguments), props = concat.apply(arrayRef, nativeSlice.call(arguments, 1)),
length = props.length, length = props.length,
result = {}; result = {};
@@ -1609,7 +1625,9 @@
* @returns {Mixed} Returns the found element, else `undefined`. * @returns {Mixed} Returns the found element, else `undefined`.
* @example * @example
* *
* _.find([1, 2, 3, 4], function(num) { return num % 2 == 0; }); * _.find([1, 2, 3, 4], function(num) {
* return num % 2 == 0;
* });
* // => 2 * // => 2
* *
* var food = [ * var food = [
@@ -1651,6 +1669,29 @@
} }
} }
/**
* Examines each element in a `collection`, returning the first that
* has the given `properties`. When checking `properties`, this method
* performs a deep comparison between values to determine if they are
* equivalent to each other.
*
* @static
* @memberOf _
* @category Collections
* @param {Array|Object|String} collection The collection to iterate over.
* @param {Object} properties The object of property values to filter by.
* @returns {Mixed} Returns the found element, else `undefined`.
* @example
*
* var food = [
* { 'name': 'apple', 'organic': false, 'type': 'fruit' },
* { 'name': 'banana', 'organic': true, 'type': 'fruit' },
* { 'name': 'beet', 'organic': false, 'type': 'vegetable' }
* ];
*
* _.findWhere(food, { 'type': 'vegetable' });
* // => { 'name': 'beet', 'organic': false, 'type': 'vegetable' }
*/
function findWhere(object, properties) { function findWhere(object, properties) {
return where(object, properties, true); return where(object, properties, true);
} }
@@ -1761,7 +1802,7 @@
* // => [['1', '2', '3'], ['4', '5', '6']] * // => [['1', '2', '3'], ['4', '5', '6']]
*/ */
function invoke(collection, methodName) { function invoke(collection, methodName) {
var args = slice.call(arguments, 2), var args = nativeSlice.call(arguments, 2),
index = -1, index = -1,
isFunc = typeof methodName == 'function', isFunc = typeof methodName == 'function',
length = collection ? collection.length : 0, length = collection ? collection.length : 0,
@@ -1999,7 +2040,7 @@
} }
/** /**
* Reduces a `collection` to a value that is the accumulated result of running * Reduces a `collection` to a value which is the accumulated result of running
* each element in the `collection` through the `callback`, where each successive * each element in the `collection` through the `callback`, where each successive
* `callback` execution consumes the return value of the previous execution. * `callback` execution consumes the return value of the previous execution.
* If `accumulator` is not passed, the first element of the `collection` will be * If `accumulator` is not passed, the first element of the `collection` will be
@@ -2324,7 +2365,7 @@
*/ */
function toArray(collection) { function toArray(collection) {
if (isArray(collection)) { if (isArray(collection)) {
return slice.call(collection); return nativeSlice.call(collection);
} }
if (collection && typeof collection.length == 'number') { if (collection && typeof collection.length == 'number') {
return map(collection); return map(collection);
@@ -2410,12 +2451,12 @@
function difference(array) { function difference(array) {
var index = -1, var index = -1,
length = array.length, length = array.length,
flattened = concat.apply(arrayRef, arguments), flattened = concat.apply(arrayRef, nativeSlice.call(arguments, 1)),
result = []; result = [];
while (++index < length) { while (++index < length) {
var value = array[index]; var value = array[index];
if (indexOf(flattened, value, length) < 0) { if (indexOf(flattened, value) < 0) {
result.push(value); result.push(value);
} }
} }
@@ -2496,14 +2537,14 @@
return array[0]; return array[0];
} }
} }
return slice.call(array, 0, nativeMin(nativeMax(0, n), length)); return nativeSlice.call(array, 0, nativeMin(nativeMax(0, n), length));
} }
} }
/** /**
* Flattens a nested array (the nesting can be to any depth). If `isShallow` * Flattens a nested array (the nesting can be to any depth). If `isShallow`
* is truthy, `array` will only be flattened a single level. If `callback` * is truthy, `array` will only be flattened a single level. If `callback`
* is passed, each element of `array` is passed through a callback` before * is passed, each element of `array` is passed through a `callback` before
* flattening. The `callback` is bound to `thisArg` and invoked with three * flattening. The `callback` is bound to `thisArg` and invoked with three
* arguments; (value, index, array). * arguments; (value, index, array).
* *
@@ -2517,7 +2558,7 @@
* @static * @static
* @memberOf _ * @memberOf _
* @category Arrays * @category Arrays
* @param {Array} array The array to compact. * @param {Array} array The array to flatten.
* @param {Boolean} [isShallow=false] A flag to indicate only flattening a single level. * @param {Boolean} [isShallow=false] A flag to indicate only flattening a single level.
* @param {Function|Object|String} [callback=identity] The function called per * @param {Function|Object|String} [callback=identity] The function called per
* iteration. If a property name or object is passed, it will be used to create * iteration. If a property name or object is passed, it will be used to create
@@ -2671,7 +2712,7 @@
} else { } else {
n = (callback == null || thisArg) ? 1 : callback || n; n = (callback == null || thisArg) ? 1 : callback || n;
} }
return slice.call(array, 0, nativeMin(nativeMax(0, length - n), length)); return nativeSlice.call(array, 0, nativeMin(nativeMax(0, length - n), length));
} }
/** /**
@@ -2786,7 +2827,7 @@
return array[length - 1]; return array[length - 1];
} }
} }
return slice.call(array, nativeMax(0, length - n)); return nativeSlice.call(array, nativeMax(0, length - n));
} }
} }
@@ -2943,7 +2984,7 @@
} else { } else {
n = (callback == null || thisArg) ? 1 : nativeMax(0, callback); n = (callback == null || thisArg) ? 1 : nativeMax(0, callback);
} }
return slice.call(array, n); return nativeSlice.call(array, n);
} }
/** /**
@@ -2963,7 +3004,7 @@
* @static * @static
* @memberOf _ * @memberOf _
* @category Arrays * @category Arrays
* @param {Array} array The array to iterate over. * @param {Array} array The array to inspect.
* @param {Mixed} value The value to evaluate. * @param {Mixed} value The value to evaluate.
* @param {Function|Object|String} [callback=identity] The function called per * @param {Function|Object|String} [callback=identity] The function called per
* iteration. If a property name or object is passed, it will be used to create * iteration. If a property name or object is passed, it will be used to create
@@ -3026,7 +3067,10 @@
* _.union([1, 2, 3], [101, 2, 1, 10], [2, 1]); * _.union([1, 2, 3], [101, 2, 1, 10], [2, 1]);
* // => [1, 2, 3, 101, 10] * // => [1, 2, 3, 101, 10]
*/ */
function union() { function union(array) {
if (!isArray(array)) {
arguments[0] = array ? nativeSlice.call(array) : arrayRef;
}
return uniq(concat.apply(arrayRef, arguments)); return uniq(concat.apply(arrayRef, arguments));
} }
@@ -3034,7 +3078,7 @@
* Creates a duplicate-value-free version of the `array` using strict equality * Creates a duplicate-value-free version of the `array` using strict equality
* for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` * for comparisons, i.e. `===`. If the `array` is already sorted, passing `true`
* for `isSorted` will run a faster algorithm. If `callback` is passed, each * for `isSorted` will run a faster algorithm. If `callback` is passed, each
* element of `array` is passed through a callback` before uniqueness is computed. * element of `array` is passed through a `callback` before uniqueness is computed.
* The `callback` is bound to `thisArg` and invoked with three arguments; (value, index, array). * The `callback` is bound to `thisArg` and invoked with three arguments; (value, index, array).
* *
* If a property name is passed for `callback`, the created "_.pluck" style * If a property name is passed for `callback`, the created "_.pluck" style
@@ -3121,17 +3165,7 @@
* // => [2, 3, 4] * // => [2, 3, 4]
*/ */
function without(array) { function without(array) {
var index = -1, return difference(array, nativeSlice.call(arguments, 1));
length = array.length,
result = [];
while (++index < length) {
var value = array[index];
if (indexOf(arguments, value, 1) < 0) {
result.push(value);
}
}
return result
} }
/** /**
@@ -3257,7 +3291,7 @@
// (in V8 `Function#bind` is slower except when partially applied) // (in V8 `Function#bind` is slower except when partially applied)
return support.fastBind || (nativeBind && arguments.length > 2) return support.fastBind || (nativeBind && arguments.length > 2)
? nativeBind.call.apply(nativeBind, arguments) ? nativeBind.call.apply(nativeBind, arguments)
: createBound(func, thisArg, slice.call(arguments, 2)); : createBound(func, thisArg, nativeSlice.call(arguments, 2));
} }
/** /**
@@ -3284,8 +3318,8 @@
* // => alerts 'clicked docs', when the button is clicked * // => alerts 'clicked docs', when the button is clicked
*/ */
function bindAll(object) { function bindAll(object) {
var funcs = concat.apply(arrayRef, arguments), var funcs = arguments.length > 1 ? concat.apply(arrayRef, nativeSlice.call(arguments, 1)) : functions(object),
index = funcs.length > 1 ? 0 : (funcs = functions(object), -1), index = -1,
length = funcs.length; length = funcs.length;
while (++index < length) { while (++index < length) {
@@ -3422,22 +3456,32 @@
/** /**
* Creates a function that will delay the execution of `func` until after * Creates a function that will delay the execution of `func` until after
* `wait` milliseconds have elapsed since the last time it was invoked. Pass * `wait` milliseconds have elapsed since the last time it was invoked. Pass
* `true` for `immediate` to cause debounce to invoke `func` on the leading, * an `options` object to indicate that `func` should be invoked on the leading
* instead of the trailing, edge of the `wait` timeout. Subsequent calls to * and/or trailing edge of the `wait` timeout. Subsequent calls to the debounced
* the debounced function will return the result of the last `func` call. * function will return the result of the last `func` call.
*
* Note: If `leading` and `trailing` options are `true`, `func` will be called
* on the trailing edge of the timeout only if the the debounced function is
* invoked more than once during the `wait` timeout.
* *
* @static * @static
* @memberOf _ * @memberOf _
* @category Functions * @category Functions
* @param {Function} func The function to debounce. * @param {Function} func The function to debounce.
* @param {Number} wait The number of milliseconds to delay. * @param {Number} wait The number of milliseconds to delay.
* @param {Boolean} immediate A flag to indicate execution is on the leading * @param {Object} options The options object.
* edge of the timeout. * [leading=false] A boolean to specify execution on the leading edge of the timeout.
* [trailing=true] A boolean to specify execution on the trailing edge of the timeout.
* @returns {Function} Returns the new debounced function. * @returns {Function} Returns the new debounced function.
* @example * @example
* *
* var lazyLayout = _.debounce(calculateLayout, 300); * var lazyLayout = _.debounce(calculateLayout, 300);
* jQuery(window).on('resize', lazyLayout); * jQuery(window).on('resize', lazyLayout);
*
* jQuery('#postbox').on('click', _.debounce(sendMail, 200, {
* 'leading': true,
* 'trailing': false
* });
*/ */
function debounce(func, wait, immediate) { function debounce(func, wait, immediate) {
var args, var args,
@@ -3482,7 +3526,7 @@
* // returns from the function before `alert` is called * // returns from the function before `alert` is called
*/ */
function defer(func) { function defer(func) {
var args = slice.call(arguments, 1); var args = nativeSlice.call(arguments, 1);
return setTimeout(function() { func.apply(undefined, args); }, 1); return setTimeout(function() { func.apply(undefined, args); }, 1);
} }
@@ -3504,7 +3548,7 @@
* // => 'logged later' (Appears after one second.) * // => 'logged later' (Appears after one second.)
*/ */
function delay(func, wait) { function delay(func, wait) {
var args = slice.call(arguments, 2); var args = nativeSlice.call(arguments, 2);
return setTimeout(function() { func.apply(undefined, args); }, wait); return setTimeout(function() { func.apply(undefined, args); }, wait);
} }
@@ -3530,7 +3574,7 @@
function memoize(func, resolver) { function memoize(func, resolver) {
var cache = {}; var cache = {};
return function() { return function() {
var key = String(resolver ? resolver.apply(this, arguments) : arguments[0]); var key = keyPrefix + (resolver ? resolver.apply(this, arguments) : arguments[0]);
return hasOwnProperty.call(cache, key) return hasOwnProperty.call(cache, key)
? cache[key] ? cache[key]
: (cache[key] = func.apply(this, arguments)); : (cache[key] = func.apply(this, arguments));
@@ -3590,26 +3634,37 @@
* // => 'hi moe' * // => 'hi moe'
*/ */
function partial(func) { function partial(func) {
return createBound(func, slice.call(arguments, 1)); return createBound(func, nativeSlice.call(arguments, 1));
} }
/** /**
* Creates a function that, when executed, will only call the `func` * Creates a function that, when executed, will only call the `func` function
* function at most once per every `wait` milliseconds. If the throttled * at most once per every `wait` milliseconds. Pass an `options` object to
* function is invoked more than once during the `wait` timeout, `func` will * indicate that `func` should be invoked on the leading and/or trailing edge
* also be called on the trailing edge of the timeout. Subsequent calls to the * of the `wait` timeout. Subsequent calls to the throttled function will
* throttled function will return the result of the last `func` call. * return the result of the last `func` call.
*
* Note: If `leading` and `trailing` options are `true`, `func` will be called
* on the trailing edge of the timeout only if the the throttled function is
* invoked more than once during the `wait` timeout.
* *
* @static * @static
* @memberOf _ * @memberOf _
* @category Functions * @category Functions
* @param {Function} func The function to throttle. * @param {Function} func The function to throttle.
* @param {Number} wait The number of milliseconds to throttle executions to. * @param {Number} wait The number of milliseconds to throttle executions to.
* @param {Object} options The options object.
* [leading=true] A boolean to specify execution on the leading edge of the timeout.
* [trailing=true] A boolean to specify execution on the trailing edge of the timeout.
* @returns {Function} Returns the new throttled function. * @returns {Function} Returns the new throttled function.
* @example * @example
* *
* var throttled = _.throttle(updatePosition, 100); * var throttled = _.throttle(updatePosition, 100);
* jQuery(window).on('scroll', throttled); * jQuery(window).on('scroll', throttled);
*
* jQuery('.interactive').on('click', _.throttle(renewToken, 300000, {
* 'trailing': false
* }));
*/ */
function throttle(func, wait) { function throttle(func, wait) {
var args, var args,
@@ -3836,9 +3891,6 @@
* Note: In the development build, `_.template` utilizes sourceURLs for easier * Note: In the development build, `_.template` utilizes sourceURLs for easier
* debugging. See http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl * debugging. See http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl
* *
* Note: Lo-Dash may be used in Chrome extensions by either creating a `lodash csp`
* build and using precompiled templates, or loading Lo-Dash in a sandbox.
*
* For more information on precompiling templates see: * For more information on precompiling templates see:
* http://lodash.com/#custom-builds * http://lodash.com/#custom-builds
* *
@@ -3849,7 +3901,7 @@
* @memberOf _ * @memberOf _
* @category Utilities * @category Utilities
* @param {String} text The template text. * @param {String} text The template text.
* @param {Obect} data The data object used to populate the text. * @param {Object} data The data object used to populate the text.
* @param {Object} options The options object. * @param {Object} options The options object.
* escape - The "escape" delimiter regexp. * escape - The "escape" delimiter regexp.
* evaluate - The "evaluate" delimiter regexp. * evaluate - The "evaluate" delimiter regexp.
@@ -3998,7 +4050,7 @@
} }
/** /**
* The opposite of `_.escape`, this method converts the HTML entities * The inverse of `_.escape`, this method converts the HTML entities
* `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to their * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to their
* corresponding characters. * corresponding characters.
* *
@@ -4280,7 +4332,7 @@
* @memberOf _ * @memberOf _
* @type String * @type String
*/ */
lodash.VERSION = '1.1.1'; lodash.VERSION = '1.2.1';
// add functions to `lodash.prototype` // add functions to `lodash.prototype`
mixin(lodash); mixin(lodash);
@@ -4289,36 +4341,36 @@
lodash.prototype.chain = wrapperChain; lodash.prototype.chain = wrapperChain;
lodash.prototype.value = wrapperValueOf; lodash.prototype.value = wrapperValueOf;
// add `Array` mutator functions to the wrapper // add `Array` mutator functions to the wrapper
forEach(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(methodName) { forEach(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
var func = arrayRef[methodName]; var func = arrayRef[methodName];
lodash.prototype[methodName] = function() { lodash.prototype[methodName] = function() {
var value = this.__wrapped__; var value = this.__wrapped__;
func.apply(value, arguments); func.apply(value, arguments);
// avoid array-like object bugs with `Array#shift` and `Array#splice` // avoid array-like object bugs with `Array#shift` and `Array#splice`
// in Firefox < 10 and IE < 9 // in Firefox < 10 and IE < 9
if (!support.spliceObjects && value.length === 0) { if (!support.spliceObjects && value.length === 0) {
delete value[0]; delete value[0];
} }
return this; return this;
}; };
}); });
// add `Array` accessor functions to the wrapper // add `Array` accessor functions to the wrapper
forEach(['concat', 'join', 'slice'], function(methodName) { forEach(['concat', 'join', 'slice'], function(methodName) {
var func = arrayRef[methodName]; var func = arrayRef[methodName];
lodash.prototype[methodName] = function() { lodash.prototype[methodName] = function() {
var value = this.__wrapped__, var value = this.__wrapped__,
result = func.apply(value, arguments); result = func.apply(value, arguments);
if (this.__chain__) { if (this.__chain__) {
result = new lodashWrapper(result); result = new lodashWrapper(result);
result.__chain__ = true; result.__chain__ = true;
} }
return result; return result;
}; };
}); });
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/

View File

@@ -1,34 +1,35 @@
/** /**
* @license * @license
* Lo-Dash 1.1.1 (Custom Build) lodash.com/license * Lo-Dash 1.2.1 (Custom Build) lodash.com/license
* Build: `lodash underscore exports="amd,commonjs,global,node" -o ./dist/lodash.underscore.js` * Build: `lodash underscore exports="amd,commonjs,global,node" -o ./dist/lodash.underscore.js`
* Underscore.js 1.4.4 underscorejs.org/LICENSE * Underscore.js 1.4.4 underscorejs.org/LICENSE
*/ */
;(function(n){function t(n,t){var r;if(n&&st[typeof n])for(r in n)if(jt.call(n,r)&&t(n[r],r,n)===Z)break}function r(n,t){var r;if(n&&st[typeof n])for(r in n)if(t(n[r],r,n)===Z)break}function e(n){var t,r=[];if(!n||!st[typeof n])return r;for(t in n)jt.call(n,t)&&r.push(t);return r}function u(n){return n instanceof u?n:new c(n)}function o(n,t){var r=n.b,e=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 r<e?-1:1}function i(n,t,r){function e(){var f=arguments,c=o?this:t; ;(function(n){function t(n){return n instanceof t?n:new i(n)}function r(n,t){var r=n.b,e=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 r<e?-1:1}function e(n,t,r,e){function u(){var e=arguments,c=i?this:t;return o||(n=t[f]),r.length&&(e=e.length?(e=Bt.call(e),l?e.concat(r):r.concat(e)):r),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=!r,f=t;if(i){var l=e;r=t}else if(!o){if(!e)throw new TypeError;
return u||(n=t[i]),r.length&&(f=f.length?(f=xt.call(f),a?f.concat(r):r.concat(f)):r),this instanceof e?(l.prototype=n.prototype,c=new l,l.prototype=J,f=n.apply(c,f),d(f)?f:c):n.apply(c,f)}var u=b(n),o=!r,i=t;if(o){var a=void 0;r=t}else if(!u)throw new TypeError;return e}function a(n){return"\\"+vt[n]}function f(n){return It[n]}function c(n){this.__wrapped__=n}function l(){}function p(n){return zt[n]}function s(n){return Ot.call(n)==ut}function v(n){if(!n)return n;for(var t=1,r=arguments.length;t<r;t++){var e=arguments[t]; t=n}return u}function u(n){return"\\"+lt[n]}function o(n){return Dt[n]}function i(n){this.__wrapped__=n}function a(){}function f(n){return Mt[n]}function l(n){return dt.call(n)==nt}function c(n){if(!n)return n;for(var t=1,r=arguments.length;t<r;t++){var e=arguments[t];if(e)for(var u in e)n[u]=e[u]}return n}function p(n){if(!n)return n;for(var t=1,r=arguments.length;t<r;t++){var e=arguments[t];if(e)for(var u in e)null==n[u]&&(n[u]=e[u])}return n}function s(n){var t=[];return Tt(n,function(n,r){y(n)&&t.push(r)
if(e)for(var u in e)n[u]=e[u]}return n}function g(n){if(!n)return n;for(var t=1,r=arguments.length;t<r;t++){var e=arguments[t];if(e)for(var u in e)n[u]==J&&(n[u]=e[u])}return n}function h(n){var t=[];return r(n,function(n,r){b(n)&&t.push(r)}),t.sort()}function y(n){for(var t=-1,r=$t(n),e=r.length,u={};++t<e;){var o=r[t];u[n[o]]=o}return u}function m(n){if(!n)return H;if(Tt(n)||w(n))return!n.length;for(var t in n)if(jt.call(n,t))return K;return H}function _(n,t,e,o){if(n===t)return 0!==n||1/n==1/t; }),t.sort()}function v(n){for(var t=-1,r=Rt(n),e=r.length,u={};++t<e;){var o=r[t];u[n[o]]=o}return u}function g(n){if(!n)return!0;if(Ft(n)||b(n))return!n.length;for(var t in n)if(mt.call(n,t))return!1;return!0}function h(n,r,e,u){if(n===r)return 0!==n||1/n==1/r;var o=typeof n,i=typeof r;if(n===n&&(!n||"function"!=o&&"object"!=o)&&(!r||"function"!=i&&"object"!=i))return!1;if(null==n||null==r)return n===r;if(i=dt.call(n),o=dt.call(r),i!=o)return!1;switch(i){case rt:case et:return+n==+r;case ut:return n!=+n?r!=+r:0==n?1/n==1/r:n==+r;
var i=typeof n,a=typeof t;if(n===n&&(!n||"function"!=i&&"object"!=i)&&(!t||"function"!=a&&"object"!=a))return K;if(n==J||t==J)return n===t;if(a=Ot.call(n),i=Ot.call(t),a!=i)return K;switch(a){case it:case at:return+n==+t;case ft:return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case lt:case pt:return n==t+""}if(i=a==ot,!i){if(n instanceof u||t instanceof u)return _(n.__wrapped__||n,t.__wrapped__||t,e,o);if(a!=ct)return K;var a=n.constructor,f=t.constructor;if(a!=f&&(!b(a)||!(a instanceof a&&b(f)&&f instanceof f)))return K case it:case at:return n==r+""}if(o=i==tt,!o){if(n instanceof t||r instanceof t)return h(n.__wrapped__||n,r.__wrapped__||r,e,u);if(i!=ot)return!1;var i=n.constructor,a=r.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]==r;var f=!0,l=0;if(e.push(n),u.push(r),o){if(l=r.length,f=l==n.length)for(;l--&&(f=h(n[l],r[l],e,u)););return f}return Tt(r,function(t,r,o){return mt.call(o,r)?(l++,!(f=mt.call(n,r)&&h(n[r],t,e,u))&&K):void 0
}for(e||(e=[]),o||(o=[]),a=e.length;a--;)if(e[a]==n)return o[a]==t;var c=H,l=0;if(e.push(n),o.push(t),i){if(l=t.length,c=l==n.length)for(;l--&&(c=_(n[l],t[l],e,o)););return c}return r(t,function(t,r,u){return jt.call(u,r)?(l++,!(c=jt.call(n,r)&&_(n[r],t,e,o))&&Z):void 0}),c&&r(n,function(n,t,r){return jt.call(r,t)?!(c=-1<--l)&&Z:void 0}),c}function b(n){return typeof n=="function"}function d(n){return n?st[typeof n]:K}function j(n){return typeof n=="number"||Ot.call(n)==ft}function w(n){return typeof n=="string"||Ot.call(n)==pt }),f&&Tt(n,function(n,t,r){return mt.call(r,t)?!(f=-1<--l)&&K:void 0}),f}function y(n){return typeof n=="function"}function m(n){return n?ft[typeof n]:!1}function _(n){return typeof n=="number"||dt.call(n)==ut}function b(n){return typeof n=="string"||dt.call(n)==at}function d(n){for(var t=-1,r=Rt(n),e=r.length,u=Array(e);++t<e;)u[t]=n[r[t]];return u}function j(n,t){var r=!1;return typeof(n?n.length:0)=="number"?r=-1<T(n,t):$t(n,function(n){return(r=n===t)&&K}),r}function w(n,t,r){var e=!0;t=P(t,r),r=-1;
}function A(n){for(var t=-1,r=$t(n),e=r.length,u=Array(e);++t<e;)u[t]=n[r[t]];return u}function x(n,r){var e=K;return typeof(n?n.length:0)=="number"?e=-1<I(n,r):t(n,function(n){return(e=n===r)&&Z}),e}function O(n,r,e){var u=H;r=V(r,e),e=-1;var o=n?n.length:0;if(typeof o=="number")for(;++e<o&&(u=!!r(n[e],e,n)););else t(n,function(n,t,e){return!(u=!!r(n,t,e))&&Z});return u}function E(n,r,e){var u=[];r=V(r,e),e=-1;var o=n?n.length:0;if(typeof o=="number")for(;++e<o;){var i=n[e];r(i,e,n)&&u.push(i)}else t(n,function(n,t,e){r(n,t,e)&&u.push(n) var u=n?n.length:0;if(typeof u=="number")for(;++r<u&&(e=!!t(n[r],r,n)););else $t(n,function(n,r,u){return!(e=!!t(n,r,u))&&K});return e}function A(n,t,r){var e=[];t=P(t,r),r=-1;var u=n?n.length:0;if(typeof u=="number")for(;++r<u;){var o=n[r];t(o,r,n)&&e.push(o)}else $t(n,function(n,r,u){t(n,r,u)&&e.push(n)});return e}function x(n,t,r){t=P(t,r),r=-1;var e=n?n.length:0;if(typeof e!="number"){var u;return $t(n,function(n,r,e){return t(n,r,e)?(u=n,K):void 0}),u}for(;++r<e;){var o=n[r];if(t(o,r,n))return o
});return u}function S(n,r,e){r=V(r,e),e=-1;var u=n?n.length:0;if(typeof u!="number"){var o;return t(n,function(n,t,e){return r(n,t,e)?(o=n,Z):void 0}),o}for(;++e<u;){var i=n[e];if(r(i,e,n))return i}}function N(n,r,e){var u=-1,o=n?n.length:0;if(r=r&&typeof e=="undefined"?r:V(r,e),typeof o=="number")for(;++u<o&&r(n[u],u,n)!==Z;);else t(n,r)}function k(n,r,e){var u=-1,o=n?n.length:0;if(r=V(r,e),typeof o=="number")for(var i=Array(o);++u<o;)i[u]=r(n[u],u,n);else i=[],t(n,function(n,t,e){i[++u]=r(n,t,e) }}function E(n,t,r){var e=-1,u=n?n.length:0;if(t=t&&typeof r=="undefined"?t:P(t,r),typeof u=="number")for(;++e<u&&t(n[e],e,n)!==K;);else $t(n,t)}function O(n,t,r){var e=-1,u=n?n.length:0;if(t=P(t,r),typeof u=="number")for(var o=Array(u);++e<u;)o[e]=t(n[e],e,n);else o=[],$t(n,function(n,r,u){o[++e]=t(n,r,u)});return o}function S(n,t,r){var e=-1/0,u=e,o=-1,i=n?n.length:0;if(t||typeof i!="number")t=P(t,r),E(n,function(n,r,o){r=t(n,r,o),r>e&&(e=r,u=n)});else for(;++o<i;)r=n[o],r>u&&(u=r);return u}function N(n,t){var r=-1,e=n?n.length:0;
});return i}function B(n,t,r){var e=-1/0,u=e,o=-1,i=n?n.length:0;if(t||typeof i!="number")t=V(t,r),N(n,function(n,r,o){r=t(n,r,o),r>e&&(e=r,u=n)});else for(;++o<i;)r=n[o],r>u&&(u=r);return u}function F(n,t){var r=-1,e=n?n.length:0;if(typeof e=="number")for(var u=Array(e);++r<e;)u[r]=n[r][t];return u||k(n,t)}function R(n,r,e,u){if(!n)return e;var o=3>arguments.length;r=V(r,u,4);var i=-1,a=n.length;if(typeof a=="number")for(o&&(e=n[++i]);++i<a;)e=r(e,n[i],i,n);else t(n,function(n,t,u){e=o?(o=K,n):r(e,n,t,u) if(typeof e=="number")for(var u=Array(e);++r<e;)u[r]=n[r][t];return u||O(n,t)}function B(n,t,r,e){if(!n)return r;var u=3>arguments.length;t=P(t,e,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(r=n[++o]);++o<i;)r=t(r,n[o],o,n);else $t(n,function(n,e,o){r=u?(u=!1,n):t(r,n,e,o)});return r}function k(n,t,r,e){var u=n?n.length:0,o=3>arguments.length;if(typeof u!="number")var i=Rt(n),u=i.length;return t=P(t,e,4),E(n,function(e,a,f){a=i?i[--u]:--u,r=o?(o=!1,n[a]):t(r,n[a],a,f)}),r}function q(n,t,r){var e;
});return e}function q(n,t,r,e){var u=n?n.length:0,o=3>arguments.length;if(typeof u!="number")var i=$t(n),u=i.length;return t=V(t,e,4),N(n,function(e,a,f){a=i?i[--u]:--u,r=o?(o=K,n[a]):t(r,n[a],a,f)}),r}function D(n,r,e){var u;r=V(r,e),e=-1;var o=n?n.length:0;if(typeof o=="number")for(;++e<o&&!(u=r(n[e],e,n)););else t(n,function(n,t,e){return(u=r(n,t,e))&&Z});return!!u}function M(n,t,r){return r&&m(t)?J:(r?S:E)(n,t)}function T(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&t!=J){var o=-1; t=P(t,r),r=-1;var u=n?n.length:0;if(typeof u=="number")for(;++r<u&&!(e=t(n[r],r,n)););else $t(n,function(n,r,u){return(e=t(n,r,u))&&K});return!!e}function F(n,t,r){return r&&g(t)?null:(r?x:A)(n,t)}function R(n){for(var t=-1,r=n.length,e=ht.apply(ct,Bt.call(arguments,1)),u=[];++t<r;){var o=n[t];0>T(e,o)&&u.push(o)}return u}function D(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=-1;for(t=P(t,r);++o<u&&t(n[o],o,n);)e++}else if(e=t,null==e||r)return n[0];return Bt.call(n,0,St(Ot(0,e),u))
for(t=V(t,r);++o<u&&t(n[o],o,n);)e++}else if(e=t,e==J||r)return n[0];return xt.call(n,0,Rt(Ft(0,e),u))}}function $(n,t){for(var r=-1,e=n?n.length:0,u=[];++r<e;){var o=n[r];Tt(o)?wt.apply(u,t?o:$(o)):u.push(o)}return u}function I(n,t,r){var e=-1,u=n?n.length:0;if(typeof r=="number")e=(0>r?Ft(0,u+r):r||0)-1;else if(r)return e=C(n,t),n[e]===t?e:-1;for(;++e<u;)if(n[e]===t)return e;return-1}function z(n,t,r){if(typeof t!="number"&&t!=J){var e=0,u=-1,o=n?n.length:0;for(t=V(t,r);++u<o&&t(n[u],u,n);)e++}else e=t==J||r?1:Ft(0,t); }}function M(n,t){for(var r=-1,e=n?n.length:0,u=[];++r<e;){var o=n[r];Ft(o)?_t.apply(u,t?o:M(o)):u.push(o)}return u}function T(n,t,r){var e=-1,u=n?n.length:0;if(typeof r=="number")e=(0>r?Ot(0,u+r):r||0)-1;else if(r)return e=I(n,t),n[e]===t?e:-1;for(;++e<u;)if(n[e]===t)return e;return-1}function $(n,t,r){if(typeof t!="number"&&null!=t){var e=0,u=-1,o=n?n.length:0;for(t=P(t,r);++u<o&&t(n[u],u,n);)e++}else e=null==t||r?1:Ot(0,t);return Bt.call(n,e)}function I(n,t,r,e){var u=0,o=n?n.length:u;for(r=r?P(r,e,1):U,t=r(t);u<o;)e=u+o>>>1,r(n[e])<t?u=e+1:o=e;
return xt.call(n,e)}function C(n,t,r,e){var u=0,o=n?n.length:u;for(r=r?V(r,e,1):W,t=r(t);u<o;)e=u+o>>>1,r(n[e])<t?u=e+1:o=e;return u}function P(n,t,r,e){var u=-1,o=n?n.length:0,i=[],a=i;for(typeof t!="boolean"&&t!=J&&(e=r,r=t,t=K),r!=J&&(a=[],r=V(r,e));++u<o;){e=n[u];var f=r?r(e,u,n):e;(t?!u||a[a.length-1]!==f:0>I(a,f))&&(r&&a.push(f),i.push(e))}return i}function U(n,t){return Mt.fastBind||Et&&2<arguments.length?Et.call.apply(Et,arguments):i(n,t,xt.call(arguments,2))}function V(n,t,r){if(n==J)return W; return u}function z(n,t,r,e){var u=-1,o=n?n.length:0,i=[],a=i;for(typeof t!="boolean"&&null!=t&&(e=r,r=t,t=!1),null!=r&&(a=[],r=P(r,e));++u<o;){e=n[u];var f=r?r(e,u,n):e;(t?!u||a[a.length-1]!==f:0>T(a,f))&&(r&&a.push(f),i.push(e))}return i}function C(n,t){return qt.fastBind||jt&&2<arguments.length?jt.call.apply(jt,arguments):e(n,t,Bt.call(arguments,2))}function P(n,t,r){if(null==n)return U;var e=typeof n;if("function"!=e){if("object"!=e)return function(t){return t[n]};var u=Rt(n);return function(t){for(var r=u.length,e=!1;r--&&(e=t[u[r]]===n[u[r]]););return e
var e=typeof n;if("function"!=e){if("object"!=e)return function(t){return t[n]};var u=$t(n);return function(t){for(var r=u.length,e=K;r--&&(e=t[u[r]]===n[u[r]]););return e}}return typeof t!="undefined"?1===r?function(r){return n.call(t,r)}:2===r?function(r,e){return n.call(t,r,e)}:4===r?function(r,e,u,o){return n.call(t,r,e,u,o)}:function(r,e,u){return n.call(t,r,e,u)}:n}function W(n){return n}function G(n){N(h(n),function(t){var r=u[t]=n[t];u.prototype[t]=function(){var n=[this.__wrapped__];return wt.apply(n,arguments),n=r.apply(u,n),this.__chain__&&(n=new c(n),n.__chain__=H),n }}return typeof t!="undefined"?1===r?function(r){return n.call(t,r)}:2===r?function(r,e){return n.call(t,r,e)}:4===r?function(r,e,u,o){return n.call(t,r,e,u,o)}:function(r,e,u){return n.call(t,r,e,u)}:n}function U(n){return n}function V(n){E(s(n),function(r){var e=t[r]=n[r];t.prototype[r]=function(){var n=[this.__wrapped__];return _t.apply(n,arguments),n=e.apply(t,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;
}})}var H=!0,J=null,K=!1,L=typeof exports=="object"&&exports,Q=typeof module=="object"&&module&&module.exports==L&&module,X=typeof global=="object"&&global;X.global===X&&(n=X);var Y=0,Z={},nt=/&(?:amp|lt|gt|quot|#39);/g,tt=/($^)/,rt=/[&<>"']/g,et=/['\n\r\t\u2028\u2029\\]/g,ut="[object Arguments]",ot="[object Array]",it="[object Boolean]",at="[object Date]",ft="[object Number]",ct="[object Object]",lt="[object RegExp]",pt="[object String]",st={"boolean":K,"function":H,object:H,number:K,string:K,undefined:K},vt={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"},gt=[],X={},ht=n._,yt=RegExp("^"+(X.valueOf+"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),mt=Math.ceil,_t=n.clearTimeout,bt=gt.concat,dt=Math.floor,jt=X.hasOwnProperty,wt=gt.push,At=n.setTimeout,xt=gt.slice,Ot=X.toString,Et=yt.test(Et=xt.bind)&&Et,St=yt.test(St=Array.isArray)&&St,Nt=n.isFinite,kt=n.isNaN,Bt=yt.test(Bt=Object.keys)&&Bt,Ft=Math.max,Rt=Math.min,qt=Math.random,X=yt.test(n.attachEvent),Dt=Et&&!/\n|true/.test(Et+X),Mt={}; (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,nt="[object Arguments]",tt="[object Array]",rt="[object Boolean]",et="[object Date]",ut="[object Number]",ot="[object Object]",it="[object RegExp]",at="[object String]",ft={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},lt={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},ct=[],H={},pt=n._,st=RegExp("^"+(H.valueOf+"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),vt=Math.ceil,gt=n.clearTimeout,ht=ct.concat,yt=Math.floor,mt=H.hasOwnProperty,_t=ct.push,bt=n.setTimeout,dt=H.toString,jt=st.test(jt=dt.bind)&&jt,wt=st.test(wt=Array.isArray)&&wt,At=n.isFinite,xt=n.isNaN,Et=st.test(Et=Object.keys)&&Et,Ot=Math.max,St=Math.min,Nt=Math.random,Bt=ct.slice,H=st.test(n.attachEvent),kt=jt&&!/\n|true/.test(jt+H),qt={};
(function(){var n={0:1,length:1};Mt.argsObject=arguments.constructor==Object,Mt.fastBind=Et&&!Dt,Mt.spliceObjects=(gt.splice.call(n,0,1),!n[0])})(1),u.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},c.prototype=u.prototype,s(arguments)||(s=function(n){return n?jt.call(n,"callee"):K});var Tt=St||function(n){return Mt.argsObject&&n instanceof Array||Ot.call(n)==ot},$t=Bt?function(n){return d(n)?Bt(n):[]}:e,It={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},zt=y(It); (function(){var n={0:1,length:1};qt.fastBind=jt&&!kt,qt.spliceObjects=(ct.splice.call(n,0,1),!n[0])})(1),t.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},i.prototype=t.prototype,l(arguments)||(l=function(n){return n?mt.call(n,"callee"):!1});var Ft=wt||function(n){return n?typeof n=="object"&&dt.call(n)==tt:!1},wt=function(n){var t,r=[];if(!n||!ft[typeof n])return r;for(t in n)mt.call(n,t)&&r.push(t);return r},Rt=Et?function(n){return m(n)?Et(n):[]
b(/x/)&&(b=function(n){return n instanceof Function||"[object Function]"==Ot.call(n)}),u.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},u.bind=U,u.bindAll=function(n){for(var t=bt.apply(gt,arguments),r=1<t.length?0:(t=h(n),-1),e=t.length;++r<e;){var u=t[r];n[u]=U(n[u],n)}return n},u.compact=function(n){for(var t=-1,r=n?n.length:0,e=[];++t<r;){var u=n[t];u&&e.push(u)}return e},u.compose=function(){var n=arguments;return function(){for(var t=arguments,r=n.length;r--;)t=[n[r].apply(this,t)]; }:wt,Dt={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Mt=v(Dt),Tt=function(n,t){var r;if(!n||!ft[typeof n])return n;for(r in n)if(t(n[r],r,n)===K)break;return n},$t=function(n,t){var r;if(!n||!ft[typeof n])return n;for(r in n)if(mt.call(n,r)&&t(n[r],r,n)===K)break;return n};y(/x/)&&(y=function(n){return typeof n=="function"&&"[object Function]"==dt.call(n)}),t.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},t.bind=C,t.bindAll=function(n){for(var t=1<arguments.length?ht.apply(ct,Bt.call(arguments,1)):s(n),r=-1,e=t.length;++r<e;){var u=t[r];
return t[0]}},u.countBy=function(n,t,r){var e={};return t=V(t,r),N(n,function(n,r,u){r=t(n,r,u)+"",jt.call(e,r)?e[r]++:e[r]=1}),e},u.debounce=function(n,t,r){function e(){a=J,r||(o=n.apply(i,u))}var u,o,i,a;return function(){var f=r&&!a;return u=arguments,i=this,_t(a),a=At(e,t),f&&(o=n.apply(i,u)),o}},u.defaults=g,u.defer=function(n){var t=xt.call(arguments,1);return At(function(){n.apply(void 0,t)},1)},u.delay=function(n,t){var r=xt.call(arguments,2);return At(function(){n.apply(void 0,r)},t)},u.difference=function(n){for(var t=-1,r=n.length,e=bt.apply(gt,arguments),u=[];++t<r;){var o=n[t]; n[u]=C(n[u],n)}return n},t.compact=function(n){for(var t=-1,r=n?n.length:0,e=[];++t<r;){var u=n[t];u&&e.push(u)}return e},t.compose=function(){var n=arguments;return function(){for(var t=arguments,r=n.length;r--;)t=[n[r].apply(this,t)];return t[0]}},t.countBy=function(n,t,r){var e={};return t=P(t,r),E(n,function(n,r,u){r=t(n,r,u)+"",mt.call(e,r)?e[r]++:e[r]=1}),e},t.debounce=function(n,t,r){function e(){a=null,r||(o=n.apply(i,u))}var u,o,i,a;return function(){var f=r&&!a;return u=arguments,i=this,gt(a),a=bt(e,t),f&&(o=n.apply(i,u)),o
0>I(e,o,r)&&u.push(o)}return u},u.filter=E,u.flatten=$,u.forEach=N,u.functions=h,u.groupBy=function(n,t,r){var e={};return t=V(t,r),N(n,function(n,r,u){r=t(n,r,u)+"",(jt.call(e,r)?e[r]:e[r]=[]).push(n)}),e},u.initial=function(n,t,r){if(!n)return[];var e=0,u=n.length;if(typeof t!="number"&&t!=J){var o=u;for(t=V(t,r);o--&&t(n[o],o,n);)e++}else e=t==J||r?1:t||e;return xt.call(n,0,Rt(Ft(0,u-e),u))},u.intersection=function(n){var t=arguments,r=t.length,e=-1,u=n?n.length:0,o=[];n:for(;++e<u;){var i=n[e]; }},t.defaults=p,t.defer=function(n){var t=Bt.call(arguments,1);return bt(function(){n.apply(void 0,t)},1)},t.delay=function(n,t){var r=Bt.call(arguments,2);return bt(function(){n.apply(void 0,r)},t)},t.difference=R,t.filter=A,t.flatten=M,t.forEach=E,t.functions=s,t.groupBy=function(n,t,r){var e={};return t=P(t,r),E(n,function(n,r,u){r=t(n,r,u)+"",(mt.call(e,r)?e[r]:e[r]=[]).push(n)}),e},t.initial=function(n,t,r){if(!n)return[];var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=P(t,r);o--&&t(n[o],o,n);)e++
if(0>I(o,i)){for(var a=r;--a;)if(0>I(t[a],i))continue n;o.push(i)}}return o},u.invert=y,u.invoke=function(n,t){var r=xt.call(arguments,2),e=-1,u=typeof t=="function",o=n?n.length:0,i=Array(typeof o=="number"?o:0);return N(n,function(n){i[++e]=(u?t:n[t]).apply(n,r)}),i},u.keys=$t,u.map=k,u.max=B,u.memoize=function(n,t){var r={};return function(){var e=(t?t.apply(this,arguments):arguments[0])+"";return jt.call(r,e)?r[e]:r[e]=n.apply(this,arguments)}},u.min=function(n,t,r){var e=1/0,u=e,o=-1,i=n?n.length:0; }else e=null==t||r?1:t||e;return Bt.call(n,0,St(Ot(0,u-e),u))},t.intersection=function(n){var t=arguments,r=t.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=r;--a;)if(0>T(t[a],i))continue n;o.push(i)}}return o},t.invert=v,t.invoke=function(n,t){var r=Bt.call(arguments,2),e=-1,u=typeof t=="function",o=n?n.length:0,i=Array(typeof o=="number"?o:0);return E(n,function(n){i[++e]=(u?t:n[t]).apply(n,r)}),i},t.keys=Rt,t.map=O,t.max=S,t.memoize=function(n,t){var r={};return function(){var e=L+(t?t.apply(this,arguments):arguments[0]);
if(t||typeof i!="number")t=V(t,r),N(n,function(n,r,o){r=t(n,r,o),r<e&&(e=r,u=n)});else for(;++o<i;)r=n[o],r<u&&(u=r);return u},u.omit=function(n){var t=bt.apply(gt,arguments),e={};return r(n,function(n,r){0>I(t,r,1)&&(e[r]=n)}),e},u.once=function(n){var t,r;return function(){return t?r:(t=H,r=n.apply(this,arguments),n=J,r)}},u.pairs=function(n){for(var t=-1,r=$t(n),e=r.length,u=Array(e);++t<e;){var o=r[t];u[t]=[o,n[o]]}return u},u.partial=function(n){return i(n,xt.call(arguments,1))},u.pick=function(n){for(var t=0,r=bt.apply(gt,arguments),e=r.length,u={};++t<e;){var o=r[t]; return mt.call(r,e)?r[e]:r[e]=n.apply(this,arguments)}},t.min=function(n,t,r){var e=1/0,u=e,o=-1,i=n?n.length:0;if(t||typeof i!="number")t=P(t,r),E(n,function(n,r,o){r=t(n,r,o),r<e&&(e=r,u=n)});else for(;++o<i;)r=n[o],r<u&&(u=r);return u},t.omit=function(n){var t=ht.apply(ct,Bt.call(arguments,1)),r={};return Tt(n,function(n,e){0>T(t,e)&&(r[e]=n)}),r},t.once=function(n){var t,r;return function(){return t?r:(t=!0,r=n.apply(this,arguments),n=null,r)}},t.pairs=function(n){for(var t=-1,r=Rt(n),e=r.length,u=Array(e);++t<e;){var o=r[t];
o in n&&(u[o]=n[o])}return u},u.pluck=F,u.range=function(n,t,r){n=+n||0,r=+r||1,t==J&&(t=n,n=0);var e=-1;t=Ft(0,mt((t-n)/r));for(var u=Array(t);++e<t;)u[e]=n,n+=r;return u},u.reject=function(n,t,r){return t=V(t,r),E(n,function(n,r,e){return!t(n,r,e)})},u.rest=z,u.shuffle=function(n){var t=-1,r=n?n.length:0,e=Array(typeof r=="number"?r:0);return N(n,function(n){var r=dt(qt()*(++t+1));e[t]=e[r],e[r]=n}),e},u.sortBy=function(n,t,r){var e=-1,u=n?n.length:0,i=Array(typeof u=="number"?u:0);for(t=V(t,r),N(n,function(n,r,u){i[++e]={a:t(n,r,u),b:e,c:n} u[t]=[o,n[o]]}return u},t.partial=function(n){return e(n,Bt.call(arguments,1))},t.pick=function(n){for(var t=-1,r=ht.apply(ct,Bt.call(arguments,1)),e=r.length,u={};++t<e;){var o=r[t];o in n&&(u[o]=n[o])}return u},t.pluck=N,t.range=function(n,t,r){n=+n||0,r=+r||1,null==t&&(t=n,n=0);var e=-1;t=Ot(0,vt((t-n)/r));for(var u=Array(t);++e<t;)u[e]=n,n+=r;return u},t.reject=function(n,t,r){return t=P(t,r),A(n,function(n,r,e){return!t(n,r,e)})},t.rest=$,t.shuffle=function(n){var t=-1,r=n?n.length:0,e=Array(typeof r=="number"?r:0);
}),u=i.length,i.sort(o);u--;)i[u]=i[u].c;return i},u.tap=function(n,t){return t(n),n},u.throttle=function(n,t){function r(){a=new Date,i=J,u=n.apply(o,e)}var e,u,o,i,a=0;return function(){var f=new Date,c=t-(f-a);return e=arguments,o=this,0<c?i||(i=At(r,c)):(_t(i),i=J,a=f,u=n.apply(o,e)),u}},u.times=function(n,t,r){for(var e=-1,u=Array(-1<n?n:0);++e<n;)u[e]=t.call(r,e);return u},u.toArray=function(n){return Tt(n)?xt.call(n):n&&typeof n.length=="number"?k(n):A(n)},u.union=function(){return P(bt.apply(gt,arguments)) return E(n,function(n){var r=yt(Nt()*(++t+1));e[t]=e[r],e[r]=n}),e},t.sortBy=function(n,t,e){var u=-1,o=n?n.length:0,i=Array(typeof o=="number"?o:0);for(t=P(t,e),E(n,function(n,r,e){i[++u]={a:t(n,r,e),b:u,c:n}}),o=i.length,i.sort(r);o--;)i[o]=i[o].c;return i},t.tap=function(n,t){return t(n),n},t.throttle=function(n,t){function r(){a=new Date,i=null,u=n.apply(o,e)}var e,u,o,i,a=0;return function(){var f=new Date,l=t-(f-a);return e=arguments,o=this,0<l?i||(i=bt(r,l)):(gt(i),i=null,a=f,u=n.apply(o,e)),u
},u.uniq=P,u.values=A,u.where=M,u.without=function(n){for(var t=-1,r=n.length,e=[];++t<r;){var u=n[t];0>I(arguments,u,1)&&e.push(u)}return e},u.wrap=function(n,t){return function(){var r=[n];return wt.apply(r,arguments),t.apply(this,r)}},u.zip=function(n){for(var t=-1,r=n?B(F(arguments,"length")):0,e=Array(r);++t<r;)e[t]=F(arguments,t);return e},u.collect=k,u.drop=z,u.each=N,u.extend=v,u.methods=h,u.object=function(n,t){for(var r=-1,e=n?n.length:0,u={};++r<e;){var o=n[r];t?u[o]=t[r]:u[o[0]]=o[1]}return u }},t.times=function(n,t,r){for(var e=-1,u=Array(-1<n?n:0);++e<n;)u[e]=t.call(r,e);return u},t.toArray=function(n){return Ft(n)?Bt.call(n):n&&typeof n.length=="number"?O(n):d(n)},t.union=function(n){return Ft(n)||(arguments[0]=n?Bt.call(n):ct),z(ht.apply(ct,arguments))},t.uniq=z,t.values=d,t.where=F,t.without=function(n){return R(n,Bt.call(arguments,1))},t.wrap=function(n,t){return function(){var r=[n];return _t.apply(r,arguments),t.apply(this,r)}},t.zip=function(n){for(var t=-1,r=n?S(N(arguments,"length")):0,e=Array(r);++t<r;)e[t]=N(arguments,t);
},u.select=E,u.tail=z,u.unique=P,u.clone=function(n){return d(n)?Tt(n)?xt.call(n):v({},n):n},u.contains=x,u.escape=function(n){return n==J?"":(n+"").replace(rt,f)},u.every=O,u.find=S,u.findWhere=function(n,t){return M(n,t,H)},u.has=function(n,t){return n?jt.call(n,t):K},u.identity=W,u.indexOf=I,u.isArguments=s,u.isArray=Tt,u.isBoolean=function(n){return n===H||n===K||Ot.call(n)==it},u.isDate=function(n){return n instanceof Date||Ot.call(n)==at},u.isElement=function(n){return n?1===n.nodeType:K},u.isEmpty=m,u.isEqual=_,u.isFinite=function(n){return Nt(n)&&!kt(parseFloat(n)) return e},t.collect=O,t.drop=$,t.each=E,t.extend=c,t.methods=s,t.object=function(n,t){for(var r=-1,e=n?n.length:0,u={};++r<e;){var o=n[r];t?u[o]=t[r]:u[o[0]]=o[1]}return u},t.select=A,t.tail=$,t.unique=z,t.clone=function(n){return m(n)?Ft(n)?Bt.call(n):c({},n):n},t.contains=j,t.escape=function(n){return null==n?"":(n+"").replace(Y,o)},t.every=w,t.find=x,t.findWhere=function(n,t){return F(n,t,!0)},t.has=function(n,t){return n?mt.call(n,t):!1},t.identity=U,t.indexOf=T,t.isArguments=l,t.isArray=Ft,t.isBoolean=function(n){return!0===n||!1===n||dt.call(n)==rt
},u.isFunction=b,u.isNaN=function(n){return j(n)&&n!=+n},u.isNull=function(n){return n===J},u.isNumber=j,u.isObject=d,u.isRegExp=function(n){return n instanceof RegExp||Ot.call(n)==lt},u.isString=w,u.isUndefined=function(n){return typeof n=="undefined"},u.lastIndexOf=function(n,t,r){var e=n?n.length:0;for(typeof r=="number"&&(e=(0>r?Ft(0,e+r):Rt(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},u.mixin=G,u.noConflict=function(){return n._=ht,this},u.random=function(n,t){return n==J&&t==J&&(t=1),n=+n||0,t==J&&(t=n,n=0),n+dt(qt()*((+t||0)-n+1)) },t.isDate=function(n){return n?typeof n=="object"&&dt.call(n)==et:!1},t.isElement=function(n){return n?1===n.nodeType:!1},t.isEmpty=g,t.isEqual=h,t.isFinite=function(n){return At(n)&&!xt(parseFloat(n))},t.isFunction=y,t.isNaN=function(n){return _(n)&&n!=+n},t.isNull=function(n){return null===n},t.isNumber=_,t.isObject=m,t.isRegExp=function(n){return n?ft[typeof n]&&dt.call(n)==it:!1},t.isString=b,t.isUndefined=function(n){return typeof n=="undefined"},t.lastIndexOf=function(n,t,r){var e=n?n.length:0;
},u.reduce=R,u.reduceRight=q,u.result=function(n,t){var r=n?n[t]:J;return b(r)?n[t]():r},u.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:$t(n).length},u.some=D,u.sortedIndex=C,u.template=function(n,t,r){n||(n=""),r=g({},r,u.templateSettings);var e=0,o="__p+='",i=r.variable;n.replace(RegExp((r.escape||tt).source+"|"+(r.interpolate||tt).source+"|"+(r.evaluate||tt).source+"|$","g"),function(t,r,u,i,f){return o+=n.slice(e,f).replace(et,a),r&&(o+="'+_['escape']("+r+")+'"),i&&(o+="';"+i+";__p+='"),u&&(o+="'+((__t=("+u+"))==null?'':__t)+'"),e=f+t.length,t for(typeof r=="number"&&(e=(0>r?Ot(0,e+r):St(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},t.mixin=V,t.noConflict=function(){return n._=pt,this},t.random=function(n,t){return null==n&&null==t&&(t=1),n=+n||0,null==t&&(t=n,n=0),n+yt(Nt()*((+t||0)-n+1))},t.reduce=B,t.reduceRight=k,t.result=function(n,t){var r=n?n[t]:null;return y(r)?n[t]():r},t.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Rt(n).length},t.some=q,t.sortedIndex=I,t.template=function(n,r,e){n||(n=""),e=p({},e,t.templateSettings);
}),o+="';\n",i||(i="obj",o="with("+i+"||{}){"+o+"}"),o="function("+i+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+o+"return __p}";try{var f=Function("_","return "+o)(u)}catch(c){throw c.source=o,c}return t?f(t):(f.source=o,f)},u.unescape=function(n){return n==J?"":(n+"").replace(nt,p)},u.uniqueId=function(n){var t=++Y+"";return n?n+t:t},u.all=O,u.any=D,u.detect=S,u.foldl=R,u.foldr=q,u.include=x,u.inject=R,u.first=T,u.last=function(n,t,r){if(n){var e=0,u=n.length; 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(t,r,e,a,f){return i+=n.slice(o,f).replace(Z,u),r&&(i+="'+_['escape']("+r+")+'"),a&&(i+="';"+a+";__p+='"),e&&(i+="'+((__t=("+e+"))==null?'':__t)+'"),o=f+t.length,t}),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)(t)
if(typeof t!="number"&&t!=J){var o=u;for(t=V(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,e==J||r)return n[u-1];return xt.call(n,Ft(0,u-e))}},u.take=T,u.head=T,u.chain=function(n){return n=new c(n),n.__chain__=H,n},u.VERSION="1.1.1",G(u),u.prototype.chain=function(){return this.__chain__=H,this},u.prototype.value=function(){return this.__wrapped__},N("pop push reverse shift sort splice unshift".split(" "),function(n){var t=gt[n];u.prototype[n]=function(){var n=this.__wrapped__;return t.apply(n,arguments),!Mt.spliceObjects&&0===n.length&&delete n[0],this }catch(l){throw l.source=i,l}return r?f(r):(f.source=i,f)},t.unescape=function(n){return null==n?"":(n+"").replace(Q,f)},t.uniqueId=function(n){var t=++J+"";return n?n+t:t},t.all=w,t.any=q,t.detect=x,t.foldl=B,t.foldr=k,t.include=j,t.inject=B,t.first=D,t.last=function(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=P(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,null==e||r)return n[u-1];return Bt.call(n,Ot(0,u-e))}},t.take=D,t.head=D,t.chain=function(n){return n=new i(n),n.__chain__=!0,n
}}),N(["concat","join","slice"],function(n){var t=gt[n];u.prototype[n]=function(){var n=t.apply(this.__wrapped__,arguments);return this.__chain__&&(n=new c(n),n.__chain__=H),n}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=u,define(function(){return u})):L&&!L.nodeType?Q?(Q.exports=u)._=u:L._=u:n._=u})(this); },t.VERSION="1.2.1",V(t),t.prototype.chain=function(){return this.__chain__=!0,this},t.prototype.value=function(){return this.__wrapped__},E("pop push reverse shift sort splice unshift".split(" "),function(n){var r=ct[n];t.prototype[n]=function(){var n=this.__wrapped__;return r.apply(n,arguments),!qt.spliceObjects&&0===n.length&&delete n[0],this}}),E(["concat","join","slice"],function(n){var r=ct[n];t.prototype[n]=function(){var n=r.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._=t,define(function(){return t})):W&&!W.nodeType?G?(G.exports=t)._=t:W._=t:n._=t})(this);

File diff suppressed because it is too large Load Diff

View File

@@ -21,9 +21,9 @@
// generate Markdown // generate Markdown
$markdown = docdown(array( $markdown = docdown(array(
'path' => '../' . $file, 'path' => '../' . $file,
'title' => 'Lo-Dash <sup>v1.1.1</sup>', 'title' => 'Lo-Dash <sup>v1.2.1</sup>',
'toc' => 'categories', 'toc' => 'categories',
'url' => 'https://github.com/lodash/lodash/blob/1.1.1/lodash.js' 'url' => 'https://github.com/lodash/lodash/blob/1.2.1/lodash.js'
)); ));
// save to a .md file // save to a .md file

View File

@@ -1 +1 @@
module.exports = require('./lodash'); module.exports = require('./dist/lodash.compat.js');

370
lodash.js
View File

@@ -1,6 +1,6 @@
/** /**
* @license * @license
* Lo-Dash 1.1.1 <http://lodash.com/> * Lo-Dash 1.2.1 <http://lodash.com/>
* Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/> * Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/>
* Based on Underscore.js 1.4.4 <http://underscorejs.org/> * Based on Underscore.js 1.4.4 <http://underscorejs.org/>
* Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud Inc. * Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud Inc.
@@ -17,9 +17,9 @@
/** Detect free variable `module` */ /** Detect free variable `module` */
var freeModule = typeof module == 'object' && module && module.exports == freeExports && module; var freeModule = typeof module == 'object' && module && module.exports == freeExports && module;
/** Detect free variable `global` and use it as `window` */ /** Detect free variable `global`, from Node.js or Browserified code, and use it as `window` */
var freeGlobal = typeof global == 'object' && global; var freeGlobal = typeof global == 'object' && global;
if (freeGlobal.global === freeGlobal) { if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {
window = freeGlobal; window = freeGlobal;
} }
@@ -29,6 +29,12 @@
/** Used internally to indicate various things */ /** Used internally to indicate various things */
var indicatorObject = {}; var indicatorObject = {};
/** Used to prefix keys to avoid issues with `__proto__` and properties on `Object.prototype` */
var keyPrefix = +new Date + '';
/** Used as the size when optimizations are enabled for large arrays */
var largeArraySize = 200;
/** Used to match empty string literals in compiled template source */ /** Used to match empty string literals in compiled template source */
var reEmptyStringLeading = /\b__p \+= '';/g, var reEmptyStringLeading = /\b__p \+= '';/g,
reEmptyStringMiddle = /\b(__p \+=) '' \+/g, reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
@@ -49,8 +55,20 @@
/** Used to match "interpolate" template delimiters */ /** Used to match "interpolate" template delimiters */
var reInterpolate = /<%=([\s\S]+?)%>/g; var reInterpolate = /<%=([\s\S]+?)%>/g;
/** Used to match leading zeros to be removed */ /** Used to detect and test whitespace */
var reLeadingZeros = /^0+(?=.$)/; var whitespace = (
// whitespace
' \t\x0B\f\xA0\ufeff' +
// line terminators
'\n\r\u2028\u2029' +
// unicode category "Zs" space separators
'\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000'
);
/** Used to match leading whitespace and zeros to be removed */
var reLeadingSpacesAndZeros = RegExp('^[' + whitespace + ']*0+(?=.$)');
/** Used to ensure capturing order of template delimiters */ /** Used to ensure capturing order of template delimiters */
var reNoMatch = /($^)/; var reNoMatch = /($^)/;
@@ -174,7 +192,7 @@
toString = objectRef.toString; toString = objectRef.toString;
/* Native method shortcuts for methods with the same name as other `lodash` methods */ /* Native method shortcuts for methods with the same name as other `lodash` methods */
var nativeBind = reNative.test(nativeBind = slice.bind) && nativeBind, var nativeBind = reNative.test(nativeBind = toString.bind) && nativeBind,
nativeIsArray = reNative.test(nativeIsArray = Array.isArray) && nativeIsArray, nativeIsArray = reNative.test(nativeIsArray = Array.isArray) && nativeIsArray,
nativeIsFinite = context.isFinite, nativeIsFinite = context.isFinite,
nativeIsNaN = context.isNaN, nativeIsNaN = context.isNaN,
@@ -182,7 +200,8 @@
nativeMax = Math.max, nativeMax = Math.max,
nativeMin = Math.min, nativeMin = Math.min,
nativeParseInt = context.parseInt, nativeParseInt = context.parseInt,
nativeRandom = Math.random; nativeRandom = Math.random,
nativeSlice = arrayRef.slice;
/** Detect various environments */ /** Detect various environments */
var isIeOpera = reNative.test(context.attachEvent), var isIeOpera = reNative.test(context.attachEvent),
@@ -201,7 +220,7 @@
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
/** /**
* Creates a `lodash` object, that wraps the given `value`, to enable method * Creates a `lodash` object, which wraps the given `value`, to enable method
* chaining. * chaining.
* *
* In addition to Lo-Dash methods, wrappers also have the following `Array` methods: * In addition to Lo-Dash methods, wrappers also have the following `Array` methods:
@@ -219,8 +238,8 @@
* `invoke`, `keys`, `map`, `max`, `memoize`, `merge`, `min`, `object`, `omit`, * `invoke`, `keys`, `map`, `max`, `memoize`, `merge`, `min`, `object`, `omit`,
* `once`, `pairs`, `partial`, `partialRight`, `pick`, `pluck`, `push`, `range`, * `once`, `pairs`, `partial`, `partialRight`, `pick`, `pluck`, `push`, `range`,
* `reject`, `rest`, `reverse`, `shuffle`, `slice`, `sort`, `sortBy`, `splice`, * `reject`, `rest`, `reverse`, `shuffle`, `slice`, `sort`, `sortBy`, `splice`,
* `tap`, `throttle`, `times`, `toArray`, `union`, `uniq`, `unshift`, `values`, * `tap`, `throttle`, `times`, `toArray`, `union`, `uniq`, `unshift`, `unzip`,
* `where`, `without`, `wrap`, and `zip` * `values`, `where`, `without`, `wrap`, and `zip`
* *
* The non-chainable wrapper functions are: * The non-chainable wrapper functions are:
* `clone`, `cloneDeep`, `contains`, `escape`, `every`, `find`, `has`, * `clone`, `cloneDeep`, `contains`, `escape`, `every`, `find`, `has`,
@@ -239,6 +258,26 @@
* @category Chaining * @category Chaining
* @param {Mixed} value The value to wrap in a `lodash` instance. * @param {Mixed} value The value to wrap in a `lodash` instance.
* @returns {Object} Returns a `lodash` instance. * @returns {Object} Returns a `lodash` instance.
* @example
*
* var wrapped = _([1, 2, 3]);
*
* // returns an unwrapped value
* wrapped.reduce(function(sum, num) {
* return sum + num;
* });
* // => 6
*
* // returns a wrapped value
* var squares = wrapped.map(function(num) {
* return num * num;
* });
*
* _.isArray(squares);
* // => false
*
* _.isArray(squares.value());
* // => true
*/ */
function lodash(value) { function lodash(value) {
// don't wrap if already wrapped, even if wrapped by a different `lodash` constructor // don't wrap if already wrapped, even if wrapped by a different `lodash` constructor
@@ -266,12 +305,12 @@
for (prop in arguments) { } for (prop in arguments) { }
/** /**
* Detect if `arguments` objects are `Object` objects (all but Opera < 10.5). * Detect if `arguments` objects are `Object` objects (all but Narwhal and Opera < 10.5).
* *
* @memberOf _.support * @memberOf _.support
* @type Boolean * @type Boolean
*/ */
support.argsObject = arguments.constructor == Object; support.argsObject = arguments.constructor == Object && !(arguments instanceof Array);
/** /**
* Detect if an `arguments` object's [[Class]] is resolvable (all but Firefox < 4, IE < 9). * Detect if an `arguments` object's [[Class]] is resolvable (all but Firefox < 4, IE < 9).
@@ -437,7 +476,7 @@
* The template used to create iterator functions. * The template used to create iterator functions.
* *
* @private * @private
* @param {Obect} data The data object used to populate the text. * @param {Object} data The data object used to populate the text.
* @returns {String} Returns the interpolated text. * @returns {String} Returns the interpolated text.
*/ */
var iteratorTemplate = template( var iteratorTemplate = template(
@@ -573,31 +612,27 @@
* @private * @private
* @param {Array} array The array to search. * @param {Array} array The array to search.
* @param {Mixed} value The value to search for. * @param {Mixed} value The value to search for.
* @param {Number} fromIndex The index to search from.
* @param {Number} largeSize The length at which an array is considered large.
* @returns {Boolean} Returns `true`, if `value` is found, else `false`. * @returns {Boolean} Returns `true`, if `value` is found, else `false`.
*/ */
function cachedContains(array, fromIndex, largeSize) { function cachedContains(array) {
var length = array.length, var length = array.length,
isLarge = (length - fromIndex) >= largeSize; isLarge = length >= largeArraySize;
if (isLarge) { if (isLarge) {
var cache = {}, var cache = {},
index = fromIndex - 1; index = -1;
while (++index < length) { while (++index < length) {
// manually coerce `value` to a string because `hasOwnProperty`, in some var key = keyPrefix + array[index];
// older versions of Firefox, coerces objects incorrectly (cache[key] || (cache[key] = [])).push(array[index]);
var key = String(array[index]);
(hasOwnProperty.call(cache, key) ? cache[key] : (cache[key] = [])).push(array[index]);
} }
} }
return function(value) { return function(value) {
if (isLarge) { if (isLarge) {
var key = String(value); var key = keyPrefix + value;
return hasOwnProperty.call(cache, key) && indexOf(cache[key], value) > -1; return cache[key] && indexOf(cache[key], value) > -1;
} }
return indexOf(array, value, fromIndex) > -1; return indexOf(array, value) > -1;
} }
} }
@@ -683,7 +718,7 @@
} }
if (partialArgs.length) { if (partialArgs.length) {
args = args.length args = args.length
? (args = slice(args), rightIndicator ? args.concat(partialArgs) : partialArgs.concat(args)) ? (args = nativeSlice.call(args), rightIndicator ? args.concat(partialArgs) : partialArgs.concat(args))
: partialArgs; : partialArgs;
} }
if (this instanceof bound) { if (this instanceof bound) {
@@ -709,6 +744,7 @@
* @param {Object} [options1, options2, ...] The compile options object(s). * @param {Object} [options1, options2, ...] The compile options object(s).
* arrays - A string of code to determine if the iterable is an array or array-like. * arrays - A string of code to determine if the iterable is an array or array-like.
* useHas - A boolean to specify using `hasOwnProperty` checks in the object loop. * useHas - A boolean to specify using `hasOwnProperty` checks in the object loop.
* useKeys - A boolean to specify using `_.keys` for own property iteration.
* args - A string of comma separated arguments the iteration function will accept. * args - A string of comma separated arguments the iteration function will accept.
* top - A string of code to execute before the iteration branches. * top - A string of code to execute before the iteration branches.
* loop - A string of code to execute in the object loop. * loop - A string of code to execute in the object loop.
@@ -812,7 +848,7 @@
} }
/** /**
* A fallback implementation of `isPlainObject` that checks if a given `value` * A fallback implementation of `isPlainObject` which checks if a given `value`
* is an object created by the `Object` constructor, assuming objects created * is an object created by the `Object` constructor, assuming objects created
* by the `Object` constructor have no inherited enumerable properties and that * by the `Object` constructor have no inherited enumerable properties and that
* there are no `Object.prototype` extensions. * there are no `Object.prototype` extensions.
@@ -936,13 +972,11 @@
* // => true * // => true
*/ */
var isArray = nativeIsArray || function(value) { var isArray = nativeIsArray || function(value) {
// `instanceof` may cause a memory leak in IE 7 if `value` is a host object return value ? (typeof value == 'object' && toString.call(value) == arrayClass) : false;
// http://ajaxian.com/archives/working-aroung-the-instanceof-memory-leak
return (support.argsObject && value instanceof Array) || toString.call(value) == arrayClass;
}; };
/** /**
* A fallback implementation of `Object.keys` that produces an array of the * A fallback implementation of `Object.keys` which produces an array of the
* given object's own enumerable property names. * given object's own enumerable property names.
* *
* @private * @private
@@ -1255,7 +1289,6 @@
*/ */
var defaults = createIterator(defaultsIteratorOptions); var defaults = createIterator(defaultsIteratorOptions);
/** /**
* This method is similar to `_.find`, except that it returns the key of the * This method is similar to `_.find`, except that it returns the key of the
* element that passes the callback check, instead of the element itself. * element that passes the callback check, instead of the element itself.
@@ -1263,7 +1296,7 @@
* @static * @static
* @memberOf _ * @memberOf _
* @category Objects * @category Objects
* @param {Array|Object|String} collection The collection to iterate over. * @param {Object} object The object to search.
* @param {Function|Object|String} [callback=identity] The function called per * @param {Function|Object|String} [callback=identity] The function called per
* iteration. If a property name or object is passed, it will be used to create * iteration. If a property name or object is passed, it will be used to create
* a "_.pluck" or "_.where" style callback, respectively. * a "_.pluck" or "_.where" style callback, respectively.
@@ -1271,14 +1304,16 @@
* @returns {Mixed} Returns the key of the found element, else `undefined`. * @returns {Mixed} Returns the key of the found element, else `undefined`.
* @example * @example
* *
* _.findKey({ 'a': 1, 'b': 2, 'c': 3, 'd': 4 }, function(num) { return num % 2 == 0; }); * _.findKey({ 'a': 1, 'b': 2, 'c': 3, 'd': 4 }, function(num) {
* return num % 2 == 0;
* });
* // => 'b' * // => 'b'
*/ */
function findKey(collection, callback, thisArg) { function findKey(object, callback, thisArg) {
var result; var result;
callback = lodash.createCallback(callback, thisArg); callback = lodash.createCallback(callback, thisArg);
forOwn(collection, function(value, key, collection) { forOwn(object, function(value, key, object) {
if (callback(value, key, collection)) { if (callback(value, key, object)) {
result = key; result = key;
return false; return false;
} }
@@ -1443,7 +1478,7 @@
* // => true * // => true
*/ */
function isDate(value) { function isDate(value) {
return value instanceof Date || toString.call(value) == dateClass; return value ? (typeof value == 'object' && toString.call(value) == dateClass) : false;
} }
/** /**
@@ -1546,11 +1581,8 @@
function isEqual(a, b, callback, thisArg, stackA, stackB) { function isEqual(a, b, callback, thisArg, stackA, stackB) {
// used to indicate that when comparing objects, `a` has at least the properties of `b` // used to indicate that when comparing objects, `a` has at least the properties of `b`
var whereIndicator = callback === indicatorObject; var whereIndicator = callback === indicatorObject;
if (callback && !whereIndicator) { if (typeof callback == 'function' && !whereIndicator) {
callback = (typeof thisArg == 'undefined') callback = lodash.createCallback(callback, thisArg, 2);
? callback
: lodash.createCallback(callback, thisArg, 2);
var result = callback(a, b); var result = callback(a, b);
if (typeof result != 'undefined') { if (typeof result != 'undefined') {
return !!result; return !!result;
@@ -1750,7 +1782,7 @@
// fallback for older versions of Chrome and Safari // fallback for older versions of Chrome and Safari
if (isFunction(/x/)) { if (isFunction(/x/)) {
isFunction = function(value) { isFunction = function(value) {
return value instanceof Function || toString.call(value) == funcClass; return typeof value == 'function' && toString.call(value) == funcClass;
}; };
} }
@@ -1900,7 +1932,7 @@
* // => true * // => true
*/ */
function isRegExp(value) { function isRegExp(value) {
return value instanceof RegExp || toString.call(value) == regexpClass; return value ? (objectTypes[typeof value] && toString.call(value) == regexpClass) : false;
} }
/** /**
@@ -2036,22 +2068,24 @@
} }
} }
if (!found) { if (!found) {
value = isArr var isShallow;
? (isArray(value) ? value : [])
: (isPlainObject(value) ? value : {});
if (callback) { if (callback) {
result = callback(value, source); result = callback(value, source);
if (typeof result != 'undefined') { if ((isShallow = typeof result != 'undefined')) {
value = result; value = result;
} }
} }
if (!isShallow) {
value = isArr
? (isArray(value) ? value : [])
: (isPlainObject(value) ? value : {});
}
// add `source` and associated `value` to the stack of traversed objects // add `source` and associated `value` to the stack of traversed objects
stackA.push(source); stackA.push(source);
stackB.push(value); stackB.push(value);
// recursively merge objects and arrays (susceptible to call stack limits) // recursively merge objects and arrays (susceptible to call stack limits)
if (!callback) { if (!isShallow) {
value = merge(value, source, indicatorObject, callback, stackA, stackB); value = merge(value, source, indicatorObject, callback, stackA, stackB);
} }
} }
@@ -2106,12 +2140,12 @@
if (isFunc) { if (isFunc) {
callback = lodash.createCallback(callback, thisArg); callback = lodash.createCallback(callback, thisArg);
} else { } else {
var props = concat.apply(arrayRef, arguments); var props = concat.apply(arrayRef, nativeSlice.call(arguments, 1));
} }
forIn(object, function(value, key, object) { forIn(object, function(value, key, object) {
if (isFunc if (isFunc
? !callback(value, key, object) ? !callback(value, key, object)
: indexOf(props, key, 1) < 0 : indexOf(props, key) < 0
) { ) {
result[key] = value; result[key] = value;
} }
@@ -2174,8 +2208,8 @@
function pick(object, callback, thisArg) { function pick(object, callback, thisArg) {
var result = {}; var result = {};
if (typeof callback != 'function') { if (typeof callback != 'function') {
var index = 0, var index = -1,
props = concat.apply(arrayRef, arguments), props = concat.apply(arrayRef, nativeSlice.call(arguments, 1)),
length = isObject(object) ? props.length : 0; length = isObject(object) ? props.length : 0;
while (++index < length) { while (++index < length) {
@@ -2245,7 +2279,7 @@
*/ */
function at(collection) { function at(collection) {
var index = -1, var index = -1,
props = concat.apply(arrayRef, slice(arguments, 1)), props = concat.apply(arrayRef, nativeSlice.call(arguments, 1)),
length = props.length, length = props.length,
result = Array(length); result = Array(length);
@@ -2500,7 +2534,9 @@
* @returns {Mixed} Returns the found element, else `undefined`. * @returns {Mixed} Returns the found element, else `undefined`.
* @example * @example
* *
* _.find([1, 2, 3, 4], function(num) { return num % 2 == 0; }); * _.find([1, 2, 3, 4], function(num) {
* return num % 2 == 0;
* });
* // => 2 * // => 2
* *
* var food = [ * var food = [
@@ -2648,7 +2684,7 @@
* // => [['1', '2', '3'], ['4', '5', '6']] * // => [['1', '2', '3'], ['4', '5', '6']]
*/ */
function invoke(collection, methodName) { function invoke(collection, methodName) {
var args = slice(arguments, 2), var args = nativeSlice.call(arguments, 2),
index = -1, index = -1,
isFunc = typeof methodName == 'function', isFunc = typeof methodName == 'function',
length = collection ? collection.length : 0, length = collection ? collection.length : 0,
@@ -2878,7 +2914,7 @@
var pluck = map; var pluck = map;
/** /**
* Reduces a `collection` to a value that is the accumulated result of running * Reduces a `collection` to a value which is the accumulated result of running
* each element in the `collection` through the `callback`, where each successive * each element in the `collection` through the `callback`, where each successive
* `callback` execution consumes the return value of the previous execution. * `callback` execution consumes the return value of the previous execution.
* If `accumulator` is not passed, the first element of the `collection` will be * If `accumulator` is not passed, the first element of the `collection` will be
@@ -3285,8 +3321,8 @@
function difference(array) { function difference(array) {
var index = -1, var index = -1,
length = array ? array.length : 0, length = array ? array.length : 0,
flattened = concat.apply(arrayRef, arguments), flattened = concat.apply(arrayRef, nativeSlice.call(arguments, 1)),
contains = cachedContains(flattened, length, 100), contains = cachedContains(flattened),
result = []; result = [];
while (++index < length) { while (++index < length) {
@@ -3305,7 +3341,7 @@
* @static * @static
* @memberOf _ * @memberOf _
* @category Arrays * @category Arrays
* @param {Array|Object|String} collection The collection to iterate over. * @param {Array} array The array to search.
* @param {Function|Object|String} [callback=identity] The function called per * @param {Function|Object|String} [callback=identity] The function called per
* iteration. If a property name or object is passed, it will be used to create * iteration. If a property name or object is passed, it will be used to create
* a "_.pluck" or "_.where" style callback, respectively. * a "_.pluck" or "_.where" style callback, respectively.
@@ -3313,16 +3349,18 @@
* @returns {Mixed} Returns the index of the found element, else `-1`. * @returns {Mixed} Returns the index of the found element, else `-1`.
* @example * @example
* *
* _.findIndex(['apple', 'banana', 'beet'], function(food) { return /^b/.test(food); }); * _.findIndex(['apple', 'banana', 'beet'], function(food) {
* return /^b/.test(food);
* });
* // => 1 * // => 1
*/ */
function findIndex(collection, callback, thisArg) { function findIndex(array, callback, thisArg) {
var index = -1, var index = -1,
length = collection ? collection.length : 0; length = array ? array.length : 0;
callback = lodash.createCallback(callback, thisArg); callback = lodash.createCallback(callback, thisArg);
while (++index < length) { while (++index < length) {
if (callback(collection[index], index, collection)) { if (callback(array[index], index, array)) {
return index; return index;
} }
} }
@@ -3410,7 +3448,7 @@
/** /**
* Flattens a nested array (the nesting can be to any depth). If `isShallow` * Flattens a nested array (the nesting can be to any depth). If `isShallow`
* is truthy, `array` will only be flattened a single level. If `callback` * is truthy, `array` will only be flattened a single level. If `callback`
* is passed, each element of `array` is passed through a callback` before * is passed, each element of `array` is passed through a `callback` before
* flattening. The `callback` is bound to `thisArg` and invoked with three * flattening. The `callback` is bound to `thisArg` and invoked with three
* arguments; (value, index, array). * arguments; (value, index, array).
* *
@@ -3424,7 +3462,7 @@
* @static * @static
* @memberOf _ * @memberOf _
* @category Arrays * @category Arrays
* @param {Array} array The array to compact. * @param {Array} array The array to flatten.
* @param {Boolean} [isShallow=false] A flag to indicate only flattening a single level. * @param {Boolean} [isShallow=false] A flag to indicate only flattening a single level.
* @param {Function|Object|String} [callback=identity] The function called per * @param {Function|Object|String} [callback=identity] The function called per
* iteration. If a property name or object is passed, it will be used to create * iteration. If a property name or object is passed, it will be used to create
@@ -3615,7 +3653,7 @@
cache = { '0': {} }, cache = { '0': {} },
index = -1, index = -1,
length = array ? array.length : 0, length = array ? array.length : 0,
isLarge = length >= 100, isLarge = length >= largeArraySize,
result = [], result = [],
seen = result; seen = result;
@@ -3623,8 +3661,8 @@
while (++index < length) { while (++index < length) {
var value = array[index]; var value = array[index];
if (isLarge) { if (isLarge) {
var key = String(value); var key = keyPrefix + value;
var inited = hasOwnProperty.call(cache[0], key) var inited = cache[0][key]
? !(seen = cache[0][key]) ? !(seen = cache[0][key])
: (seen = cache[0][key] = []); : (seen = cache[0][key] = []);
} }
@@ -3634,7 +3672,7 @@
} }
var argsIndex = argsLength; var argsIndex = argsLength;
while (--argsIndex) { while (--argsIndex) {
if (!(cache[argsIndex] || (cache[argsIndex] = cachedContains(args[argsIndex], 0, 100)))(value)) { if (!(cache[argsIndex] || (cache[argsIndex] = cachedContains(args[argsIndex])))(value)) {
continue outer; continue outer;
} }
} }
@@ -3895,7 +3933,7 @@
* @static * @static
* @memberOf _ * @memberOf _
* @category Arrays * @category Arrays
* @param {Array} array The array to iterate over. * @param {Array} array The array to inspect.
* @param {Mixed} value The value to evaluate. * @param {Mixed} value The value to evaluate.
* @param {Function|Object|String} [callback=identity] The function called per * @param {Function|Object|String} [callback=identity] The function called per
* iteration. If a property name or object is passed, it will be used to create * iteration. If a property name or object is passed, it will be used to create
@@ -3958,7 +3996,10 @@
* _.union([1, 2, 3], [101, 2, 1, 10], [2, 1]); * _.union([1, 2, 3], [101, 2, 1, 10], [2, 1]);
* // => [1, 2, 3, 101, 10] * // => [1, 2, 3, 101, 10]
*/ */
function union() { function union(array) {
if (!isArray(array)) {
arguments[0] = array ? nativeSlice.call(array) : arrayRef;
}
return uniq(concat.apply(arrayRef, arguments)); return uniq(concat.apply(arrayRef, arguments));
} }
@@ -3966,7 +4007,7 @@
* Creates a duplicate-value-free version of the `array` using strict equality * Creates a duplicate-value-free version of the `array` using strict equality
* for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` * for comparisons, i.e. `===`. If the `array` is already sorted, passing `true`
* for `isSorted` will run a faster algorithm. If `callback` is passed, each * for `isSorted` will run a faster algorithm. If `callback` is passed, each
* element of `array` is passed through a callback` before uniqueness is computed. * element of `array` is passed through a `callback` before uniqueness is computed.
* The `callback` is bound to `thisArg` and invoked with three arguments; (value, index, array). * The `callback` is bound to `thisArg` and invoked with three arguments; (value, index, array).
* *
* If a property name is passed for `callback`, the created "_.pluck" style * If a property name is passed for `callback`, the created "_.pluck" style
@@ -4018,7 +4059,7 @@
isSorted = false; isSorted = false;
} }
// init value cache for large arrays // init value cache for large arrays
var isLarge = !isSorted && length >= 75; var isLarge = !isSorted && length >= largeArraySize;
if (isLarge) { if (isLarge) {
var cache = {}; var cache = {};
} }
@@ -4031,8 +4072,8 @@
computed = callback ? callback(value, index, array) : value; computed = callback ? callback(value, index, array) : value;
if (isLarge) { if (isLarge) {
var key = String(computed); var key = keyPrefix + computed;
var inited = hasOwnProperty.call(cache, key) var inited = cache[key]
? !(seen = cache[key]) ? !(seen = cache[key])
: (seen = cache[key] = []); : (seen = cache[key] = []);
} }
@@ -4049,6 +4090,37 @@
return result; return result;
} }
/**
* The inverse of `_.zip`, this method splits groups of elements into arrays
* composed of elements from each group at their corresponding indexes.
*
* @static
* @memberOf _
* @category Arrays
* @param {Array} array The array to process.
* @returns {Array} Returns a new array of the composed arrays.
* @example
*
* _.unzip([['moe', 30, true], ['larry', 40, false]]);
* // => [['moe', 'larry'], [30, 40], [true, false]];
*/
function unzip(array) {
var index = -1,
length = array ? array.length : 0,
tupleLength = length ? max(pluck(array, 'length')) : 0,
result = Array(tupleLength);
while (++index < length) {
var tupleIndex = -1,
tuple = array[index];
while (++tupleIndex < tupleLength) {
(result[tupleIndex] || (result[tupleIndex] = Array(length)))[index] = tuple[tupleIndex];
}
}
return result;
}
/** /**
* Creates an array with all occurrences of the passed values removed using * Creates an array with all occurrences of the passed values removed using
* strict equality for comparisons, i.e. `===`. * strict equality for comparisons, i.e. `===`.
@@ -4065,18 +4137,7 @@
* // => [2, 3, 4] * // => [2, 3, 4]
*/ */
function without(array) { function without(array) {
var index = -1, return difference(array, nativeSlice.call(arguments, 1));
length = array ? array.length : 0,
contains = cachedContains(arguments, 1, 30),
result = [];
while (++index < length) {
var value = array[index];
if (!contains(value)) {
result.push(value);
}
}
return result;
} }
/** /**
@@ -4202,7 +4263,7 @@
// (in V8 `Function#bind` is slower except when partially applied) // (in V8 `Function#bind` is slower except when partially applied)
return support.fastBind || (nativeBind && arguments.length > 2) return support.fastBind || (nativeBind && arguments.length > 2)
? nativeBind.call.apply(nativeBind, arguments) ? nativeBind.call.apply(nativeBind, arguments)
: createBound(func, thisArg, slice(arguments, 2)); : createBound(func, thisArg, nativeSlice.call(arguments, 2));
} }
/** /**
@@ -4229,8 +4290,8 @@
* // => alerts 'clicked docs', when the button is clicked * // => alerts 'clicked docs', when the button is clicked
*/ */
function bindAll(object) { function bindAll(object) {
var funcs = concat.apply(arrayRef, arguments), var funcs = arguments.length > 1 ? concat.apply(arrayRef, nativeSlice.call(arguments, 1)) : functions(object),
index = funcs.length > 1 ? 0 : (funcs = functions(object), -1), index = -1,
length = funcs.length; length = funcs.length;
while (++index < length) { while (++index < length) {
@@ -4275,7 +4336,7 @@
* // => 'hi, moe!' * // => 'hi, moe!'
*/ */
function bindKey(object, key) { function bindKey(object, key) {
return createBound(object, key, slice(arguments, 2), indicatorObject); return createBound(object, key, nativeSlice.call(arguments, 2), indicatorObject);
} }
/** /**
@@ -4405,45 +4466,64 @@
/** /**
* Creates a function that will delay the execution of `func` until after * Creates a function that will delay the execution of `func` until after
* `wait` milliseconds have elapsed since the last time it was invoked. Pass * `wait` milliseconds have elapsed since the last time it was invoked. Pass
* `true` for `immediate` to cause debounce to invoke `func` on the leading, * an `options` object to indicate that `func` should be invoked on the leading
* instead of the trailing, edge of the `wait` timeout. Subsequent calls to * and/or trailing edge of the `wait` timeout. Subsequent calls to the debounced
* the debounced function will return the result of the last `func` call. * function will return the result of the last `func` call.
*
* Note: If `leading` and `trailing` options are `true`, `func` will be called
* on the trailing edge of the timeout only if the the debounced function is
* invoked more than once during the `wait` timeout.
* *
* @static * @static
* @memberOf _ * @memberOf _
* @category Functions * @category Functions
* @param {Function} func The function to debounce. * @param {Function} func The function to debounce.
* @param {Number} wait The number of milliseconds to delay. * @param {Number} wait The number of milliseconds to delay.
* @param {Boolean} immediate A flag to indicate execution is on the leading * @param {Object} options The options object.
* edge of the timeout. * [leading=false] A boolean to specify execution on the leading edge of the timeout.
* [trailing=true] A boolean to specify execution on the trailing edge of the timeout.
* @returns {Function} Returns the new debounced function. * @returns {Function} Returns the new debounced function.
* @example * @example
* *
* var lazyLayout = _.debounce(calculateLayout, 300); * var lazyLayout = _.debounce(calculateLayout, 300);
* jQuery(window).on('resize', lazyLayout); * jQuery(window).on('resize', lazyLayout);
*
* jQuery('#postbox').on('click', _.debounce(sendMail, 200, {
* 'leading': true,
* 'trailing': false
* });
*/ */
function debounce(func, wait, immediate) { function debounce(func, wait, options) {
var args, var args,
inited,
result, result,
thisArg, thisArg,
timeoutId; timeoutId,
trailing = true;
function delayed() { function delayed() {
timeoutId = null; inited = timeoutId = null;
if (!immediate) { if (trailing) {
result = func.apply(thisArg, args); result = func.apply(thisArg, args);
} }
} }
if (options === true) {
var leading = true;
trailing = false;
} else if (options && objectTypes[typeof options]) {
leading = options.leading;
trailing = 'trailing' in options ? options.trailing : trailing;
}
return function() { return function() {
var isImmediate = immediate && !timeoutId;
args = arguments; args = arguments;
thisArg = this; thisArg = this;
clearTimeout(timeoutId); clearTimeout(timeoutId);
timeoutId = setTimeout(delayed, wait);
if (isImmediate) { if (!inited && leading) {
inited = true;
result = func.apply(thisArg, args); result = func.apply(thisArg, args);
} else {
timeoutId = setTimeout(delayed, wait);
} }
return result; return result;
}; };
@@ -4465,7 +4545,7 @@
* // returns from the function before `alert` is called * // returns from the function before `alert` is called
*/ */
function defer(func) { function defer(func) {
var args = slice(arguments, 1); var args = nativeSlice.call(arguments, 1);
return setTimeout(function() { func.apply(undefined, args); }, 1); return setTimeout(function() { func.apply(undefined, args); }, 1);
} }
// use `setImmediate` if it's available in Node.js // use `setImmediate` if it's available in Node.js
@@ -4491,7 +4571,7 @@
* // => 'logged later' (Appears after one second.) * // => 'logged later' (Appears after one second.)
*/ */
function delay(func, wait) { function delay(func, wait) {
var args = slice(arguments, 2); var args = nativeSlice.call(arguments, 2);
return setTimeout(function() { func.apply(undefined, args); }, wait); return setTimeout(function() { func.apply(undefined, args); }, wait);
} }
@@ -4517,7 +4597,7 @@
function memoize(func, resolver) { function memoize(func, resolver) {
var cache = {}; var cache = {};
return function() { return function() {
var key = String(resolver ? resolver.apply(this, arguments) : arguments[0]); var key = keyPrefix + (resolver ? resolver.apply(this, arguments) : arguments[0]);
return hasOwnProperty.call(cache, key) return hasOwnProperty.call(cache, key)
? cache[key] ? cache[key]
: (cache[key] = func.apply(this, arguments)); : (cache[key] = func.apply(this, arguments));
@@ -4577,7 +4657,7 @@
* // => 'hi moe' * // => 'hi moe'
*/ */
function partial(func) { function partial(func) {
return createBound(func, slice(arguments, 1)); return createBound(func, nativeSlice.call(arguments, 1));
} }
/** /**
@@ -4608,43 +4688,66 @@
* // => { '_': _, 'jq': $ } * // => { '_': _, 'jq': $ }
*/ */
function partialRight(func) { function partialRight(func) {
return createBound(func, slice(arguments, 1), null, indicatorObject); return createBound(func, nativeSlice.call(arguments, 1), null, indicatorObject);
} }
/** /**
* Creates a function that, when executed, will only call the `func` * Creates a function that, when executed, will only call the `func` function
* function at most once per every `wait` milliseconds. If the throttled * at most once per every `wait` milliseconds. Pass an `options` object to
* function is invoked more than once during the `wait` timeout, `func` will * indicate that `func` should be invoked on the leading and/or trailing edge
* also be called on the trailing edge of the timeout. Subsequent calls to the * of the `wait` timeout. Subsequent calls to the throttled function will
* throttled function will return the result of the last `func` call. * return the result of the last `func` call.
*
* Note: If `leading` and `trailing` options are `true`, `func` will be called
* on the trailing edge of the timeout only if the the throttled function is
* invoked more than once during the `wait` timeout.
* *
* @static * @static
* @memberOf _ * @memberOf _
* @category Functions * @category Functions
* @param {Function} func The function to throttle. * @param {Function} func The function to throttle.
* @param {Number} wait The number of milliseconds to throttle executions to. * @param {Number} wait The number of milliseconds to throttle executions to.
* @param {Object} options The options object.
* [leading=true] A boolean to specify execution on the leading edge of the timeout.
* [trailing=true] A boolean to specify execution on the trailing edge of the timeout.
* @returns {Function} Returns the new throttled function. * @returns {Function} Returns the new throttled function.
* @example * @example
* *
* var throttled = _.throttle(updatePosition, 100); * var throttled = _.throttle(updatePosition, 100);
* jQuery(window).on('scroll', throttled); * jQuery(window).on('scroll', throttled);
*
* jQuery('.interactive').on('click', _.throttle(renewToken, 300000, {
* 'trailing': false
* }));
*/ */
function throttle(func, wait) { function throttle(func, wait, options) {
var args, var args,
result, result,
thisArg, thisArg,
timeoutId, timeoutId,
lastCalled = 0; lastCalled = 0,
leading = true,
trailing = true;
function trailingCall() { function trailingCall() {
lastCalled = new Date;
timeoutId = null; timeoutId = null;
result = func.apply(thisArg, args); if (trailing) {
lastCalled = new Date;
result = func.apply(thisArg, args);
}
}
if (options === false) {
leading = false;
} else if (options && objectTypes[typeof options]) {
leading = 'leading' in options ? options.leading : leading;
trailing = 'trailing' in options ? options.trailing : trailing;
} }
return function() { return function() {
var now = new Date, var now = new Date;
remaining = wait - (now - lastCalled); if (!timeoutId && !leading) {
lastCalled = now;
}
var remaining = wait - (now - lastCalled);
args = arguments; args = arguments;
thisArg = this; thisArg = this;
@@ -4786,6 +4889,8 @@
/** /**
* Converts the given `value` into an integer of the specified `radix`. * Converts the given `value` into an integer of the specified `radix`.
* If `radix` is `undefined` or `0`, a `radix` of `10` is used unless the
* `value` is a hexadecimal, in which case a `radix` of `16` is used.
* *
* Note: This method avoids differences in native ES3 and ES5 `parseInt` * Note: This method avoids differences in native ES3 and ES5 `parseInt`
* implementations. See http://es5.github.com/#E. * implementations. See http://es5.github.com/#E.
@@ -4793,16 +4898,17 @@
* @static * @static
* @memberOf _ * @memberOf _
* @category Utilities * @category Utilities
* @param {Mixed} value The value to parse. * @param {String} value The value to parse.
* @param {Number} [radix] The radix used to interpret the value to parse.
* @returns {Number} Returns the new integer value. * @returns {Number} Returns the new integer value.
* @example * @example
* *
* _.parseInt('08'); * _.parseInt('08');
* // => 8 * // => 8
*/ */
var parseInt = nativeParseInt('08') == 8 ? nativeParseInt : function(value, radix) { var parseInt = nativeParseInt(whitespace + '08') == 8 ? nativeParseInt : function(value, radix) {
// Firefox and Opera still follow the ES3 specified implementation of `parseInt` // Firefox and Opera still follow the ES3 specified implementation of `parseInt`
return nativeParseInt(isString(value) ? value.replace(reLeadingZeros, '') : value, radix || 0); return nativeParseInt(isString(value) ? value.replace(reLeadingSpacesAndZeros, '') : value, radix || 0);
}; };
/** /**
@@ -4874,9 +4980,6 @@
* Note: In the development build, `_.template` utilizes sourceURLs for easier * Note: In the development build, `_.template` utilizes sourceURLs for easier
* debugging. See http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl * debugging. See http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl
* *
* Note: Lo-Dash may be used in Chrome extensions by either creating a `lodash csp`
* build and using precompiled templates, or loading Lo-Dash in a sandbox.
*
* For more information on precompiling templates see: * For more information on precompiling templates see:
* http://lodash.com/#custom-builds * http://lodash.com/#custom-builds
* *
@@ -4887,7 +4990,7 @@
* @memberOf _ * @memberOf _
* @category Utilities * @category Utilities
* @param {String} text The template text. * @param {String} text The template text.
* @param {Obect} data The data object used to populate the text. * @param {Object} data The data object used to populate the text.
* @param {Object} options The options object. * @param {Object} options The options object.
* escape - The "escape" delimiter regexp. * escape - The "escape" delimiter regexp.
* evaluate - The "evaluate" delimiter regexp. * evaluate - The "evaluate" delimiter regexp.
@@ -5087,7 +5190,7 @@
} }
/** /**
* The opposite of `_.escape`, this method converts the HTML entities * The inverse of `_.escape`, this method converts the HTML entities
* `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to their * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to their
* corresponding characters. * corresponding characters.
* *
@@ -5240,6 +5343,7 @@
lodash.toArray = toArray; lodash.toArray = toArray;
lodash.union = union; lodash.union = union;
lodash.uniq = uniq; lodash.uniq = uniq;
lodash.unzip = unzip;
lodash.values = values; lodash.values = values;
lodash.where = where; lodash.where = where;
lodash.without = without; lodash.without = without;
@@ -5357,7 +5461,7 @@
* @memberOf _ * @memberOf _
* @type String * @type String
*/ */
lodash.VERSION = '1.1.1'; lodash.VERSION = '1.2.1';
// add "Chaining" functions to the wrapper // add "Chaining" functions to the wrapper
lodash.prototype.toString = wrapperToString; lodash.prototype.toString = wrapperToString;

View File

@@ -1,9 +1,10 @@
{ {
"name": "lodash", "name": "lodash",
"version": "1.1.1", "version": "1.2.1",
"description": "A low-level utility library delivering consistency, customization, performance, and extra features.", "description": "A low-level utility library delivering consistency, customization, performance, and extra features.",
"homepage": "http://lodash.com", "homepage": "http://lodash.com",
"main": "./dist/lodash", "license": "MIT",
"main": "./dist/lodash.js",
"keywords": [ "keywords": [
"browser", "browser",
"client", "client",
@@ -13,12 +14,6 @@
"speed", "speed",
"util" "util"
], ],
"licenses": [
{
"type": "MIT",
"url": "http://lodash.com/license"
}
],
"author": { "author": {
"name": "John-David Dalton", "name": "John-David Dalton",
"email": "john.david.dalton@gmail.com", "email": "john.david.dalton@gmail.com",
@@ -34,19 +29,11 @@
"bin": { "bin": {
"lodash": "./build.js" "lodash": "./build.js"
}, },
"directories": {
"doc": "./doc",
"test": "./test"
},
"engines": [ "engines": [
"node", "node",
"rhino" "rhino"
], ],
"jam": { "jam": {
"main": "./lodash.js" "main": "./dist/lodash.compat.js"
},
"scripts": {
"build": "node ./build.js",
"test": "node ./test/test.js ./dist/lodash.js && node ./test/test.js ./dist/lodash.min.js && node ./test/test-build.js"
} }
} }

View File

@@ -34,13 +34,13 @@
<script src="../vendor/firebug-lite/src/firebug-lite-debug.js"></script> <script src="../vendor/firebug-lite/src/firebug-lite-debug.js"></script>
<script src="perf-ui.js"></script> <script src="perf-ui.js"></script>
<script> <script>
document.write('<script src="../' + ui.buildPath + '"><\/script>'); document.write('<script src="' + ui.buildPath + '"><\/script>');
</script> </script>
<script> <script>
var lodash = _.noConflict(); var lodash = _.noConflict();
</script> </script>
<script> <script>
document.write('<script src="../' + ui.otherPath + '"><\/script>'); document.write('<script src="' + ui.otherPath + '"><\/script>');
</script> </script>
<script src="perf.js"></script> <script src="perf.js"></script>
<script> <script>

View File

@@ -1,6 +1,9 @@
;(function(window) { ;(function(window) {
'use strict'; 'use strict';
/** The base path of the builds */
var basePath = '../';
/** The Lo-Dash build to load */ /** The Lo-Dash build to load */
var build = (/build=([^&]+)/.exec(location.search) || [])[1]; var build = (/build=([^&]+)/.exec(location.search) || [])[1];
@@ -33,26 +36,38 @@
// expose Lo-Dash build file path // expose Lo-Dash build file path
ui.buildPath = (function() { ui.buildPath = (function() {
var result;
switch (build) { switch (build) {
case 'lodash-dev': return 'dist/lodash.compat.js'; case 'lodash-compat': result = 'dist/lodash.compat.min.js'; break;
case 'lodash-modern': return 'dist/lodash.min.js'; case 'lodash-legacy': result = 'dist/lodash.legacy.min.js'; break;
case 'lodash-underscore': return 'dist/lodash.underscore.min.js'; case 'lodash-mobile': result = 'dist/lodash.mobile.min.js'; break;
case 'lodash-custom': return 'lodash.custom.min.js'; case 'lodash-underscore': result = 'dist/lodash.underscore.min.js'; break;
case 'lodash-custom-dev': result = 'lodash.custom.js'; break;
case 'lodash-custom': result = 'lodash.custom.min.js'; break;
case 'lodash-modern':
case undefined: result = 'dist/lodash.min.js'; break;
default: result = build;
} }
return 'dist/lodash.compat.min.js'; return result == build ? result : (basePath + result);
}()); }());
// expose other library file path // expose other library file path
ui.otherPath = (function() { ui.otherPath = (function() {
var result;
switch (other) { switch (other) {
case 'lodash-dev': return 'dist/lodash.compat.js'; case 'lodash-compat': result = 'dist/lodash.compat.min.js'; break;
case 'lodash-prod': return 'dist/lodash.compat.min.js'; case 'lodash-legacy': result = 'dist/lodash.legacy.min.js'; break;
case 'lodash-modern': return 'dist/lodash.min.js'; case 'lodash-mobile': result = 'dist/lodash.mobile.min.js'; break;
case 'lodash-underscore': return 'dist/lodash.underscore.min.js'; case 'lodash-modern': result = 'dist/lodash.min.js'; break;
case 'lodash-custom': return 'lodash.custom.min.js'; case 'lodash-underscore': result = 'dist/lodash.underscore.min.js'; break;
case 'underscore-dev': return 'vendor/underscore/underscore.js'; case 'lodash-custom-dev': result = 'lodash.custom.js'; break;
case 'lodash-custom': result = 'lodash.custom.min.js'; break;
case 'underscore-dev': result = 'vendor/underscore/underscore.js'; break;
case 'underscore':
case undefined: result = 'vendor/underscore/underscore-min.js'; break;
default: result = other;
} }
return 'vendor/underscore/underscore-min.js'; return result == other ? result : (basePath + result);
}()); }());
// initialize controls // initialize controls
@@ -76,11 +91,13 @@
span1.innerHTML = span1.innerHTML =
'<label for="perf-build">Build: </label>' + '<label for="perf-build">Build: </label>' +
'<select id="perf-build">' + '<select id="perf-build">' +
'<option value="lodash-dev">Lo-Dash</option>' + '<option value="lodash-compat">Lo-Dash (compat)</option>' +
'<option value="lodash-prod">Lo-Dash (minified)</option>' + '<option value="lodash-legacy">Lo-Dash (legacy)</option>' +
'<option value="lodash-mobile">Lo-Dash (mobile)</option>' +
'<option value="lodash-modern">Lo-Dash (modern)</option>' + '<option value="lodash-modern">Lo-Dash (modern)</option>' +
'<option value="lodash-underscore">Lo-Dash (underscore)</option>' + '<option value="lodash-underscore">Lo-Dash (underscore)</option>' +
'<option value="lodash-custom">Lo-Dash (custom)</option>' + '<option value="lodash-custom-dev">Lo-Dash (custom development)</option>' +
'<option value="lodash-custom">Lo-Dash (custom production)</option>' +
'</select>'; '</select>';
var span2 = document.createElement('span'); var span2 = document.createElement('span');
@@ -88,13 +105,15 @@
span2.innerHTML = span2.innerHTML =
'<label for="perf-other">Other Library: </label>' + '<label for="perf-other">Other Library: </label>' +
'<select id="perf-other">' + '<select id="perf-other">' +
'<option value="underscore-dev">Underscore</option>' + '<option value="underscore-dev">Underscore (development)</option>' +
'<option value="underscore-prod">Underscore (minified)</option>' + '<option value="underscore">Underscore (production)</option>' +
'<option value="lodash-dev">Lo-Dash</option>' + '<option value="lodash-compat">Lo-Dash (compat)</option>' +
'<option value="lodash-prod">Lo-Dash (minified)</option>' + '<option value="lodash-legacy">Lo-Dash (legacy)</option>' +
'<option value="lodash-mobile">Lo-Dash (mobile)</option>' +
'<option value="lodash-modern">Lo-Dash (modern)</option>' + '<option value="lodash-modern">Lo-Dash (modern)</option>' +
'<option value="lodash-underscore">Lo-Dash (underscore)</option>' + '<option value="lodash-underscore">Lo-Dash (underscore)</option>' +
'<option value="lodash-custom">Lo-Dash (custom)</option>' + '<option value="lodash-custom-dev">Lo-Dash (custom development)</option>' +
'<option value="lodash-custom">Lo-Dash (custom production)</option>' +
'</select>'; '</select>';
var buildList = span1.lastChild, var buildList = span1.lastChild,
@@ -106,24 +125,32 @@
buildList.selectedIndex = (function() { buildList.selectedIndex = (function() {
switch (build) { switch (build) {
case 'lodash-dev': return 0; case 'lodash-compat': return 0;
case 'lodash-modern': return 2; case 'lodash-legacy': return 1;
case 'lodash-underscore': return 3; case 'lodash-mobile': return 2;
case 'lodash-custom': return 4; case 'lodash-underscore': return 4;
case 'lodash-custom-dev': return 5;
case 'lodash-custom': return 6;
case 'lodash-modern':
case undefined: return 3;
} }
return 1; return -1;
}()); }());
otherList.selectedIndex = (function() { otherList.selectedIndex = (function() {
switch (other) { switch (other) {
case 'underscore-dev': return 0; case 'underscore-dev': return 0;
case 'lodash-dev': return 2; case 'lodash-compat': return 2;
case 'lodash-prod': return 3; case 'lodash-legacy': return 3;
case 'lodash-modern': return 4; case 'lodash-mobile': return 4;
case 'lodash-underscore': return 5; case 'lodash-modern': return 5;
case 'lodash-custom': return 6; case 'lodash-underscore': return 6;
case 'lodash-custom-dev': return 7;
case 'lodash-custom': return 8;
case 'underscore':
case undefined: return 1;
} }
return 1; return -1;
}()); }());
addListener(buildList, 'change', eventHandler); addListener(buildList, 'change', eventHandler);

View File

@@ -58,7 +58,7 @@
var reSpecialChars = /[.*+?^=!:${}()|[\]\/\\]/g; var reSpecialChars = /[.*+?^=!:${}()|[\]\/\\]/g;
/** Used to score performance */ /** Used to score performance */
var score = { 'a': 0, 'b': 0 }; var score = { 'a': [], 'b': [] };
/** Used to queue benchmark suites */ /** Used to queue benchmark suites */
var suites = []; var suites = [];
@@ -67,16 +67,16 @@
var toString = Object.prototype.toString; var toString = Object.prototype.toString;
/** The `ui` object */ /** The `ui` object */
var ui = window.ui || ({ var ui = window.ui || (window.ui = {
'buildPath': basename(filePath, '.js'), 'buildPath': basename(filePath, '.js'),
'otherPath': 'underscore' 'otherPath': 'underscore'
}); });
/** The Lo-Dash build basename */ /** The Lo-Dash build basename */
var buildName = basename(ui.buildPath, '.js'); var buildName = window.buildName = basename(ui.buildPath, '.js');
/** The other library basename */ /** The other library basename */
var otherName = basename(ui.otherPath, '.js'); var otherName = window.otherName = basename(ui.otherPath, '.js');
/** Detect if in a browser environment */ /** Detect if in a browser environment */
var isBrowser = isHostType(window, 'document') && isHostType(window, 'navigator'); var isBrowser = isHostType(window, 'document') && isHostType(window, 'navigator');
@@ -105,6 +105,20 @@
: result.replace(RegExp(extension.replace(reSpecialChars, '\\$&') + '$'), ''); : result.replace(RegExp(extension.replace(reSpecialChars, '\\$&') + '$'), '');
} }
/**
* Computes the geometric mean (log-average) of an array of values.
* See http://en.wikipedia.org/wiki/Geometric_mean#Relationship_with_arithmetic_mean_of_logarithms.
*
* @private
* @param {Array} array The array of values.
* @returns {Number} The geometric mean.
*/
function getGeometricMean(array) {
return Math.pow(Math.E, lodash.reduce(array, function(sum, x) {
return sum + Math.log(x);
}, 0) / array.length) || 0;
}
/** /**
* Gets the Hz, i.e. operations per second, of `bench` adjusted for the * Gets the Hz, i.e. operations per second, of `bench` adjusted for the
* margin of error. * margin of error.
@@ -174,31 +188,41 @@
log(event.target); log(event.target);
}, },
'onComplete': function() { 'onComplete': function() {
var formatNumber = Benchmark.formatNumber, for (var index = 0, length = this.length; index < length; index++) {
fastest = this.filter('fastest'), var bench = this[index];
fastestHz = getHz(fastest[0]), if (bench.error) {
slowest = this.filter('slowest'), var errored = true;
slowestHz = getHz(slowest[0]), }
aHz = getHz(this[0]), }
bHz = getHz(this[1]); if (errored) {
log('There was a problem, skipping...');
if (fastest.length > 1) {
log('It\'s too close to call.');
aHz = bHz = slowestHz;
} }
else { else {
var percent = ((fastestHz / slowestHz) - 1) * 100; var formatNumber = Benchmark.formatNumber,
fastest = this.filter('fastest'),
fastestHz = getHz(fastest[0]),
slowest = this.filter('slowest'),
slowestHz = getHz(slowest[0]),
aHz = getHz(this[0]),
bHz = getHz(this[1]);
log( if (fastest.length > 1) {
fastest[0].name + ' is ' + log('It\'s too close to call.');
formatNumber(percent < 1 ? percent.toFixed(2) : Math.round(percent)) + aHz = bHz = slowestHz;
'% faster.' }
); else {
var percent = ((fastestHz / slowestHz) - 1) * 100;
log(
fastest[0].name + ' is ' +
formatNumber(percent < 1 ? percent.toFixed(2) : Math.round(percent)) +
'% faster.'
);
}
// add score adjusted for margin of error
score.a.push(aHz);
score.b.push(bHz);
} }
// add score adjusted for margin of error
score.a += aHz;
score.b += bHz;
// remove current suite from queue // remove current suite from queue
suites.shift(); suites.shift();
@@ -207,14 +231,16 @@
suites[0].run({ 'async': !isJava }); suites[0].run({ 'async': !isJava });
} }
else { else {
var fastestTotalHz = Math.max(score.a, score.b), var aMeanHz = getGeometricMean(score.a),
slowestTotalHz = Math.min(score.a, score.b), bMeanHz = getGeometricMean(score.b),
totalPercent = formatNumber(Math.round(((fastestTotalHz / slowestTotalHz) - 1) * 100)), fastestMeanHz = Math.max(aMeanHz, bMeanHz),
totalX = fastestTotalHz / slowestTotalHz, slowestMeanHz = Math.min(aMeanHz, bMeanHz),
message = 'is ' + totalPercent + '% ' + (totalX == 1 ? '' : '(' + formatNumber(totalX.toFixed(2)) + 'x) ') + 'faster than'; xFaster = fastestMeanHz / slowestMeanHz,
percentFaster = formatNumber(Math.round((xFaster - 1) * 100)),
message = 'is ' + percentFaster + '% ' + (xFaster == 1 ? '' : '(' + formatNumber(xFaster.toFixed(2)) + 'x) ') + 'faster than';
// report results // report results
if (score.a >= score.b) { if (aMeanHz >= bMeanHz) {
log('\n' + buildName + ' ' + message + ' ' + otherName + '.'); log('\n' + buildName + ' ' + message + ' ' + otherName + '.');
} else { } else {
log('\n' + otherName + ' ' + message + ' ' + buildName + '.'); log('\n' + otherName + ' ' + message + ' ' + buildName + '.');
@@ -230,7 +256,7 @@
'setup': '\ 'setup': '\
var _ = window._,\ var _ = window._,\
lodash = window.lodash,\ lodash = window.lodash,\
belt = this.name == "Lo-Dash" ? lodash : _;\ belt = this.name == buildName ? lodash : _;\
\ \
var index,\ var index,\
date = new Date,\ date = new Date,\
@@ -265,13 +291,17 @@
}\ }\
\ \
if (typeof bindAll != "undefined") {\ if (typeof bindAll != "undefined") {\
var bindAllObjects = Array(this.count),\ var bindAllCount = -1,\
funcNames = belt.functions(lodash);\ bindAllObjects = Array(this.count);\
\
var funcNames = belt.reject(belt.functions(belt).slice(0, 40), function(funcName) {\
return /^_/.test(funcName);\
});\
\ \
// potentially expensive\n\ // potentially expensive\n\
for (index = 0; index < this.count; index++) {\ for (index = 0; index < this.count; index++) {\
bindAllObjects[index] = belt.reduce(funcNames, function(object, funcName) {\ bindAllObjects[index] = belt.reduce(funcNames, function(object, funcName) {\
object[funcName] = lodash[funcName];\ object[funcName] = belt[funcName];\
return object;\ return object;\
}, {});\ }, {});\
}\ }\
@@ -378,12 +408,14 @@
fiftyValues2 = Array(50),\ fiftyValues2 = Array(50),\
seventyFiveValues = Array(75),\ seventyFiveValues = Array(75),\
seventyFiveValues2 = Array(75),\ seventyFiveValues2 = Array(75),\
hundredValues = Array(100),\ oneHundredValues = Array(100),\
hundredValues2 = Array(100),\ oneHundredValues2 = Array(100),\
twoHundredValues = Array(200),\
twoHundredValues2 = Array(200),\
lowerChars = "abcdefghijklmnopqrstuvwxyz".split(""),\ lowerChars = "abcdefghijklmnopqrstuvwxyz".split(""),\
upperChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");\ upperChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");\
\ \
for (index = 0; index < 100; index++) {\ for (index = 0; index < 200; index++) {\
if (index < 15) {\ if (index < 15) {\
twentyValues[index] = lowerChars[index];\ twentyValues[index] = lowerChars[index];\
twentyValues2[index] = upperChars[index];\ twentyValues2[index] = upperChars[index];\
@@ -403,13 +435,15 @@
fortyValues[index] =\ fortyValues[index] =\
fiftyValues[index] =\ fiftyValues[index] =\
seventyFiveValues[index] =\ seventyFiveValues[index] =\
hundredValues[index] = lowerChars[index];\ oneHundredValues[index] =\
twoHundredValues[index] = lowerChars[index];\
\ \
thirtyValues2[index] =\ thirtyValues2[index] =\
fortyValues2[index] =\ fortyValues2[index] =\
fiftyValues2[index] =\ fiftyValues2[index] =\
seventyFiveValues2[index] =\ seventyFiveValues2[index] =\
hundredValues2[index] = upperChars[index];\ oneHundredValues2[index] =\
twoHundredValues2[index] = upperChars[index];\
}\ }\
else {\ else {\
if (index < 30) {\ if (index < 30) {\
@@ -428,8 +462,12 @@
seventyFiveValues[index] =\ seventyFiveValues[index] =\
seventyFiveValues2[index] = index;\ seventyFiveValues2[index] = index;\
}\ }\
hundredValues[index] =\ if (index < 100) {\
hundredValues2[index] = index;\ oneHundredValues[index] =\
oneHundredValues2[index] = index;\
}\
twoHundredValues[index] =\
twoHundredValues2[index] = index;\
}\ }\
}\ }\
}\ }\
@@ -487,6 +525,10 @@
var _findWhere = _.findWhere || _.find,\ var _findWhere = _.findWhere || _.find,\
lodashFindWhere = lodash.findWhere || lodash.find,\ lodashFindWhere = lodash.findWhere || lodash.find,\
whereObject = { "num": 9 };\ 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]];\
}' }'
}); });
@@ -604,11 +646,11 @@
suites.push( suites.push(
Benchmark.Suite('`_.bindAll` iterating arguments') Benchmark.Suite('`_.bindAll` iterating arguments')
.add(buildName, { .add(buildName, {
'fn': 'lodash.bindAll.apply(lodash, [bindAllObjects.pop()].concat(funcNames))', 'fn': 'lodash.bindAll.apply(lodash, [bindAllObjects[++bindAllCount]].concat(funcNames))',
'teardown': 'function bindAll(){}' 'teardown': 'function bindAll(){}'
}) })
.add(otherName, { .add(otherName, {
'fn': '_.bindAll.apply(_, [bindAllObjects.pop()].concat(funcNames))', 'fn': '_.bindAll.apply(_, [bindAllObjects[++bindAllCount]].concat(funcNames))',
'teardown': 'function bindAll(){}' 'teardown': 'function bindAll(){}'
}) })
); );
@@ -616,11 +658,11 @@
suites.push( suites.push(
Benchmark.Suite('`_.bindAll` iterating the `object`') Benchmark.Suite('`_.bindAll` iterating the `object`')
.add(buildName, { .add(buildName, {
'fn': 'lodash.bindAll(bindAllObjects.pop())', 'fn': 'lodash.bindAll(bindAllObjects[++bindAllCount])',
'teardown': 'function bindAll(){}' 'teardown': 'function bindAll(){}'
}) })
.add(otherName, { .add(otherName, {
'fn': '_.bindAll(bindAllObjects.pop())', 'fn': '_.bindAll(bindAllObjects[++bindAllCount])',
'teardown': 'function bindAll(){}' 'teardown': 'function bindAll(){}'
}) })
); );
@@ -734,13 +776,13 @@
); );
suites.push( suites.push(
Benchmark.Suite('`_.difference` iterating 100 elements') Benchmark.Suite('`_.difference` iterating 200 elements')
.add(buildName, { .add(buildName, {
'fn': 'lodash.difference(hundredValues, hundredValues2)', 'fn': 'lodash.difference(twoHundredValues, twoHundredValues2)',
'teardown': 'function multiArrays(){}' 'teardown': 'function multiArrays(){}'
}) })
.add(otherName, { .add(otherName, {
'fn': '_.difference(hundredValues, hundredValues2)', 'fn': '_.difference(twoHundredValues, twoHundredValues2)',
'teardown': 'function multiArrays(){}' 'teardown': 'function multiArrays(){}'
}) })
); );
@@ -1012,22 +1054,14 @@
suites.push( suites.push(
Benchmark.Suite('`_.indexOf`') Benchmark.Suite('`_.indexOf`')
.add(buildName, '\ .add(buildName, {
lodash.indexOf(numbers, 9)' 'fn': 'lodash.indexOf(twoHundredValues, 199)',
) 'teardown': 'function multiArrays(){}'
.add(otherName, '\ })
_.indexOf(numbers, 9)' .add(buildName, {
) 'fn': '_.indexOf(twoHundredValues, 199)',
); 'teardown': 'function multiArrays(){}'
})
suites.push(
Benchmark.Suite('`_.indexOf` with `isSorted`')
.add(buildName, '\
lodash.indexOf(numbers, 19, true)'
)
.add(otherName, '\
_.indexOf(numbers, 19, true)'
)
); );
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
@@ -1043,13 +1077,13 @@
); );
suites.push( suites.push(
Benchmark.Suite('`_.intersection` iterating 100 elements') Benchmark.Suite('`_.intersection` iterating 200 elements')
.add(buildName, { .add(buildName, {
'fn': 'lodash.intersection(hundredValues, hundredValues2)', 'fn': 'lodash.intersection(twoHundredValues, twoHundredValues2)',
'teardown': 'function multiArrays(){}' 'teardown': 'function multiArrays(){}'
}) })
.add(otherName, { .add(otherName, {
'fn': '_.intersection(hundredValues, hundredValues2)', 'fn': '_.intersection(twoHundredValues, twoHundredValues2)',
'teardown': 'function multiArrays(){}' 'teardown': 'function multiArrays(){}'
}) })
); );
@@ -1117,13 +1151,13 @@
.add(buildName, { .add(buildName, {
'fn': '\ 'fn': '\
lodash.isEqual(numbers, numbers2);\ lodash.isEqual(numbers, numbers2);\
lodash.isEqual(twoNumbers, twoNumbers2);', lodash.isEqual(twoNumbers, twoNumbers2)',
'teardown': 'function isEqual(){}' 'teardown': 'function isEqual(){}'
}) })
.add(otherName, { .add(otherName, {
'fn': '\ 'fn': '\
_.isEqual(numbers, numbers2);\ _.isEqual(numbers, numbers2);\
_.isEqual(twoNumbers, twoNumbers2);', _.isEqual(twoNumbers, twoNumbers2)',
'teardown': 'function isEqual(){}' 'teardown': 'function isEqual(){}'
}) })
); );
@@ -1133,13 +1167,13 @@
.add(buildName, { .add(buildName, {
'fn': '\ 'fn': '\
lodash.isEqual(nestedNumbers, nestedNumbers2);\ lodash.isEqual(nestedNumbers, nestedNumbers2);\
lodash.isEqual(nestedNumbers2, nestedNumbers3);', lodash.isEqual(nestedNumbers2, nestedNumbers3)',
'teardown': 'function isEqual(){}' 'teardown': 'function isEqual(){}'
}) })
.add(otherName, { .add(otherName, {
'fn': '\ 'fn': '\
_.isEqual(nestedNumbers, nestedNumbers2);\ _.isEqual(nestedNumbers, nestedNumbers2);\
_.isEqual(nestedNumbers2, nestedNumbers3);', _.isEqual(nestedNumbers2, nestedNumbers3)',
'teardown': 'function isEqual(){}' 'teardown': 'function isEqual(){}'
}) })
); );
@@ -1149,13 +1183,13 @@
.add(buildName, { .add(buildName, {
'fn': '\ 'fn': '\
lodash.isEqual(objects, objects2);\ lodash.isEqual(objects, objects2);\
lodash.isEqual(simpleObjects, simpleObjects2);', lodash.isEqual(simpleObjects, simpleObjects2)',
'teardown': 'function isEqual(){}' 'teardown': 'function isEqual(){}'
}) })
.add(otherName, { .add(otherName, {
'fn': '\ 'fn': '\
_.isEqual(objects, objects2);\ _.isEqual(objects, objects2);\
_.isEqual(simpleObjects, simpleObjects2);', _.isEqual(simpleObjects, simpleObjects2)',
'teardown': 'function isEqual(){}' 'teardown': 'function isEqual(){}'
}) })
); );
@@ -1165,13 +1199,13 @@
.add(buildName, { .add(buildName, {
'fn': '\ 'fn': '\
lodash.isEqual(object, object2);\ lodash.isEqual(object, object2);\
lodash.isEqual(simpleObject, simpleObject2);', lodash.isEqual(simpleObject, simpleObject2)',
'teardown': 'function isEqual(){}' 'teardown': 'function isEqual(){}'
}) })
.add(otherName, { .add(otherName, {
'fn': '\ 'fn': '\
_.isEqual(object, object2);\ _.isEqual(object, object2);\
_.isEqual(simpleObject, simpleObject2);', _.isEqual(simpleObject, simpleObject2)',
'teardown': 'function isEqual(){}' 'teardown': 'function isEqual(){}'
}) })
); );
@@ -1179,7 +1213,7 @@
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
suites.push( suites.push(
Benchmark.Suite('`_.isArguments`, `_.isDate`, `_.isFunction`, `_.isNumber`, `_.isRegExp`') Benchmark.Suite('`_.isArguments`, `_.isDate`, `_.isFunction`, `_.isNumber`, `_.isObject`, `_.isRegExp`')
.add(buildName, '\ .add(buildName, '\
lodash.isArguments(arguments);\ lodash.isArguments(arguments);\
lodash.isArguments(object);\ lodash.isArguments(object);\
@@ -1189,8 +1223,10 @@
lodash.isFunction(object);\ lodash.isFunction(object);\
lodash.isNumber(1);\ lodash.isNumber(1);\
lodash.isNumber(object);\ lodash.isNumber(object);\
lodash.isObject(object);\
lodash.isObject(1);\
lodash.isRegExp(regexp);\ lodash.isRegExp(regexp);\
lodash.isRegExp(object);' lodash.isRegExp(object)'
) )
.add(otherName, '\ .add(otherName, '\
_.isArguments(arguments);\ _.isArguments(arguments);\
@@ -1201,8 +1237,10 @@
_.isFunction(object);\ _.isFunction(object);\
_.isNumber(1);\ _.isNumber(1);\
_.isNumber(object);\ _.isNumber(object);\
_.isObject(object);\
_.isObject(1);\
_.isRegExp(regexp);\ _.isRegExp(regexp);\
_.isRegExp(object);' _.isRegExp(object)'
) )
); );
@@ -1366,13 +1404,13 @@
lodash.reduce(numbers, function(result, value, index) {\ lodash.reduce(numbers, function(result, value, index) {\
result[index] = value;\ result[index] = value;\
return result;\ return result;\
}, {});' }, {})'
) )
.add(otherName, '\ .add(otherName, '\
_.reduce(numbers, function(result, value, index) {\ _.reduce(numbers, function(result, value, index) {\
result[index] = value;\ result[index] = value;\
return result;\ return result;\
}, {});' }, {})'
) )
); );
@@ -1382,13 +1420,13 @@
lodash.reduce(object, function(result, value, key) {\ lodash.reduce(object, function(result, value, key) {\
result.push(key, value);\ result.push(key, value);\
return result;\ return result;\
}, []);' }, [])'
) )
.add(otherName, '\ .add(otherName, '\
_.reduce(object, function(result, value, key) {\ _.reduce(object, function(result, value, key) {\
result.push(key, value);\ result.push(key, value);\
return result;\ return result;\
}, []);' }, [])'
) )
); );
@@ -1400,13 +1438,13 @@
lodash.reduceRight(numbers, function(result, value, index) {\ lodash.reduceRight(numbers, function(result, value, index) {\
result[index] = value;\ result[index] = value;\
return result;\ return result;\
}, {});' }, {})'
) )
.add(otherName, '\ .add(otherName, '\
_.reduceRight(numbers, function(result, value, index) {\ _.reduceRight(numbers, function(result, value, index) {\
result[index] = value;\ result[index] = value;\
return result;\ return result;\
}, {});' }, {})'
) )
); );
@@ -1416,13 +1454,13 @@
lodash.reduceRight(object, function(result, value, key) {\ lodash.reduceRight(object, function(result, value, key) {\
result.push(key, value);\ result.push(key, value);\
return result;\ return result;\
}, []);' }, [])'
) )
.add(otherName, '\ .add(otherName, '\
_.reduceRight(object, function(result, value, key) {\ _.reduceRight(object, function(result, value, key) {\
result.push(key, value);\ result.push(key, value);\
return result;\ return result;\
}, []);' }, [])'
) )
); );
@@ -1574,16 +1612,6 @@
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
suites.push(
Benchmark.Suite('`_.sortedIndex`')
.add(buildName, '\
lodash.sortedIndex(numbers, 25)'
)
.add(otherName, '\
_.sortedIndex(numbers, 25)'
)
);
suites.push( suites.push(
Benchmark.Suite('`_.sortedIndex` with `callback`') Benchmark.Suite('`_.sortedIndex` with `callback`')
.add(buildName, { .add(buildName, {
@@ -1703,11 +1731,11 @@
suites.push( suites.push(
Benchmark.Suite('`_.union` iterating an array of 75 elements') Benchmark.Suite('`_.union` iterating an array of 75 elements')
.add(buildName, { .add(buildName, {
'fn': 'lodash.union(fiftyValues, twentyFiveValues2);', 'fn': 'lodash.union(fiftyValues, twentyFiveValues2)',
'teardown': 'function multiArrays(){}' 'teardown': 'function multiArrays(){}'
}) })
.add(otherName, { .add(otherName, {
'fn': '_.union(fiftyValues, twentyFiveValues2);', 'fn': '_.union(fiftyValues, twentyFiveValues2)',
'teardown': 'function multiArrays(){}' 'teardown': 'function multiArrays(){}'
}) })
); );
@@ -1729,7 +1757,7 @@
.add(buildName, '\ .add(buildName, '\
lodash.uniq(numbers.concat(twoNumbers, fourNumbers), function(num) {\ lodash.uniq(numbers.concat(twoNumbers, fourNumbers), function(num) {\
return num % 2;\ return num % 2;\
});' })'
) )
.add(otherName, '\ .add(otherName, '\
_.uniq(numbers.concat(twoNumbers, fourNumbers), function(num) {\ _.uniq(numbers.concat(twoNumbers, fourNumbers), function(num) {\
@@ -1739,19 +1767,33 @@
); );
suites.push( suites.push(
Benchmark.Suite('`_.uniq` iterating an array of 75 elements') Benchmark.Suite('`_.uniq` iterating an array of 200 elements')
.add(buildName, { .add(buildName, {
'fn': 'lodash.uniq(fiftyValues.concat(twentyFiveValues2));', 'fn': 'lodash.uniq(oneHundredValues.concat(oneHundredValues2))',
'teardown': 'function multiArrays(){}' 'teardown': 'function multiArrays(){}'
}) })
.add(otherName, { .add(otherName, {
'fn': '_.uniq(fiftyValues.concat(twentyFiveValues2));', 'fn': '_.uniq(oneHundredValues.concat(oneHundredValues2))',
'teardown': 'function multiArrays(){}' '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( suites.push(
Benchmark.Suite('`_.values`') Benchmark.Suite('`_.values`')
.add(buildName, '\ .add(buildName, '\
@@ -1767,11 +1809,11 @@
suites.push( suites.push(
Benchmark.Suite('`_.where`') Benchmark.Suite('`_.where`')
.add(buildName, { .add(buildName, {
'fn': 'lodash.where(objects, whereObject);', 'fn': 'lodash.where(objects, whereObject)',
'teardown': 'function where(){}' 'teardown': 'function where(){}'
}) })
.add(otherName, { .add(otherName, {
'fn': '_.where(objects, whereObject);', 'fn': '_.where(objects, whereObject)',
'teardown': 'function where(){}' 'teardown': 'function where(){}'
}) })
); );
@@ -1788,15 +1830,17 @@
) )
); );
/*--------------------------------------------------------------------------*/
suites.push( suites.push(
Benchmark.Suite('`_.without` iterating an array of 30 elements') Benchmark.Suite('`_.zip`')
.add(buildName, { .add(buildName, {
'fn': 'lodash.without.apply(lodash, [thirtyValues].concat(thirtyValues2));', 'fn': 'lodash.zip.apply(lodash, unzipped)',
'teardown': 'function multiArrays(){}' 'teardown': 'function zip(){}'
}) })
.add(otherName, { .add(otherName, {
'fn': '_.without.apply(_, [thirtyValues].concat(thirtyValues2));', 'fn': '_.zip.apply(_, unzipped)',
'teardown': 'function multiArrays(){}' 'teardown': 'function zip(){}'
}) })
); );

View File

@@ -3,21 +3,21 @@
'use strict'; 'use strict';
/** Load Node.js modules */ /** Load Node.js modules */
var fs = require('fs'), var vm = require('vm');
path = require('path'),
vm = require('vm');
/** Load other modules */ /** Load other modules */
var build = require('../build.js'), var _ = require('../lodash.js'),
minify = require('../build/minify'), build = require('../build.js'),
_ = require('../lodash.js'); minify = require('../build/minify.js'),
util = require('../build/util.js');
/** Module shortcuts */
var fs = util.fs,
path = util.path;
/** Used to avoid `noglobal` false positives caused by `errno` leaked in Node.js */ /** Used to avoid `noglobal` false positives caused by `errno` leaked in Node.js */
global.errno = true; global.errno = true;
/** Add `path.sep` for older versions of Node.js */
path.sep || (path.sep = process.platform == 'win32' ? '\\' : '/');
/** The current working directory */ /** The current working directory */
var cwd = process.cwd(); var cwd = process.cwd();
@@ -90,10 +90,12 @@
}; };
/** List of all Lo-Dash methods */ /** List of all Lo-Dash methods */
var allMethods = _.functions(_) var lodashMethods = _.functions(_).filter(function(methodName) {
.filter(function(methodName) { return !/^_/.test(methodName); }) return !/^_/.test(methodName);
.concat('chain') });
.sort();
/** List of all methods */
var allMethods = lodashMethods.concat('chain', 'findWhere');
/** List of "Arrays" category methods */ /** List of "Arrays" category methods */
var arraysMethods = [ var arraysMethods = [
@@ -118,6 +120,7 @@
'union', 'union',
'uniq', 'uniq',
'unique', 'unique',
'unzip',
'without', 'without',
'zip', 'zip',
'zipObject' 'zipObject'
@@ -125,6 +128,7 @@
/** List of "Chaining" category methods */ /** List of "Chaining" category methods */
var chainingMethods = [ var chainingMethods = [
'chain',
'tap', 'tap',
'value' 'value'
]; ];
@@ -142,6 +146,7 @@
'every', 'every',
'filter', 'filter',
'find', 'find',
'findWhere',
'foldl', 'foldl',
'foldr', 'foldr',
'forEach', 'forEach',
@@ -296,8 +301,8 @@
'without' 'without'
]; ];
/** List of methods used by Underscore */ /** List of Lo-Dash only methods */
var underscoreMethods = _.without.apply(_, [allMethods].concat([ var lodashOnlyMethods = [
'at', 'at',
'bindKey', 'bindKey',
'cloneDeep', 'cloneDeep',
@@ -310,8 +315,12 @@
'merge', 'merge',
'parseInt', 'parseInt',
'partialRight', 'partialRight',
'runInContext' 'runInContext',
])); 'unzip'
];
/** List of Underscore methods */
var underscoreMethods = _.without.apply(_, [allMethods].concat(lodashOnlyMethods));
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
@@ -573,9 +582,12 @@
context._ = _; context._ = _;
vm.runInContext(data.source, context); vm.runInContext(data.source, context);
equal(_.templates.a(object.a).replace(/[\r\n]+/g, ''), '<ul><li>moe</li><li>larry</li><li>curly</li></ul>', basename); var actual = _.templates.a(object.a);
equal(actual.replace(/[\r\n]+/g, ''), '<ul><li>moe</li><li>larry</li><li>curly</li></ul>', basename);
equal(_.templates.b(object.b), 'Hello stooge.', basename); equal(_.templates.b(object.b), 'Hello stooge.', basename);
equal(_.templates.c(object.c), 'Hello ES6!', basename); equal(_.templates.c(object.c), 'Hello ES6!', basename);
delete _.templates; delete _.templates;
start(); start();
}); });
@@ -608,7 +620,9 @@
equal(moduleId, expectedId, basename); equal(moduleId, expectedId, basename);
ok('a' in _.templates && 'b' in _.templates, basename); ok('a' in _.templates && 'b' in _.templates, basename);
equal(_.templates.a({ 'people': ['moe', 'larry'] }), '<ul>\n<li>moe</li><li>larry</li>\n</ul>', basename);
var actual = _.templates.a({ 'people': ['moe', 'larry'] });
equal(actual.replace(/[\r\n]+/g, ''), '<ul><li>moe</li><li>larry</li></ul>', basename);
delete _.templates; delete _.templates;
start(); start();
@@ -693,7 +707,92 @@
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
QUnit.module('source maps'); QUnit.module('csp modifier');
(function() {
asyncTest('`lodash csp`', function() {
var sources = [];
var check = _.after(2, _.once(function() {
ok(_.every(sources, function(source) {
// remove `Function` in `_.template` before testing for additional use
return !/\bFunction\(/.test(source.replace(/= *\w+\(\w+, *['"]return.+?apply[^)]+\)/, ''));
}));
equal(sources[0], sources[1]);
QUnit.start();
}));
var callback = function(data) {
// remove copyright header and append to `sources`
sources.push(data.source.replace(/^\/\**[\s\S]+?\*\/\n/, ''));
check();
};
build(['-s', '-d', 'csp'], callback);
build(['-s', '-d', 'modern'], callback);
});
}());
/*--------------------------------------------------------------------------*/
QUnit.module('mobile modifier');
(function() {
asyncTest('`lodash mobile`', function() {
var start = _.after(2, _.once(QUnit.start));
build(['-s', 'mobile'], function(data) {
var array = [1, 2, 3],
basename = path.basename(data.outputPath, '.js'),
context = createContext(),
object1 = [{ 'a': 1 }],
object2 = [{ 'b': 2 }],
object3 = [{ 'a': 1, 'b': 2 }],
circular1 = { 'a': 1 },
circular2 = { 'a': 1 };
circular1.b = circular1;
circular2.b = circular2;
vm.runInContext(data.source, context);
var lodash = context._;
deepEqual(lodash.merge(object1, object2), object3, basename);
deepEqual(lodash.sortBy([3, 2, 1], _.identity), array, basename);
strictEqual(lodash.isEqual(circular1, circular2), true, basename);
var actual = lodash.cloneDeep(circular1);
ok(actual != circular1 && actual.b == actual, basename);
start();
});
});
}());
/*--------------------------------------------------------------------------*/
QUnit.module('modern modifier');
(function() {
asyncTest('`lodash modern`', function() {
var start = _.after(2, _.once(QUnit.start));
build(['-s', 'modern'], function(data) {
var basename = path.basename(data.outputPath, '.js'),
context = createContext();
vm.runInContext(data.source, context);
var lodash = context._;
strictEqual(lodash.isPlainObject(Object.create(null)), true, basename);
start();
});
});
}());
/*--------------------------------------------------------------------------*/
QUnit.module('source-map modifier');
(function() { (function() {
var mapCommands = [ var mapCommands = [
@@ -792,50 +891,6 @@
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
QUnit.module('underscore chaining methods');
(function() {
var commands = [
'backbone',
'underscore'
];
commands.forEach(function(command) {
asyncTest('`lodash ' + command +'`', function() {
var start = _.after(2, _.once(QUnit.start));
build(['-s', command], function(data) {
var basename = path.basename(data.outputPath, '.js'),
context = createContext();
vm.runInContext(data.source, context);
var lodash = context._;
ok(lodash.chain(1) instanceof lodash, '_.chain: ' + basename);
ok(lodash(1).chain() instanceof lodash, '_#chain: ' + basename);
var wrapped = lodash(1);
strictEqual(wrapped.identity(), 1, '_(...) wrapped values are not chainable by default: ' + basename);
equal(String(wrapped) === '1', false, '_#toString should not be implemented: ' + basename);
equal(Number(wrapped) === 1 , false, '_#valueOf should not be implemented: ' + basename);
wrapped.chain();
ok(wrapped.has('x') instanceof lodash, '_#has returns wrapped values when chaining: ' + basename);
ok(wrapped.join() instanceof lodash, '_#join returns wrapped values when chaining: ' + basename);
wrapped = lodash([1, 2, 3]);
ok(wrapped.pop() instanceof lodash, '_#pop returns wrapped values: ' + basename);
ok(wrapped.shift() instanceof lodash, '_#shift returns wrapped values: ' + basename);
deepEqual(wrapped.splice(0, 0).value(), [2], '_#splice returns wrapper: ' + basename);
start();
});
});
});
}());
/*--------------------------------------------------------------------------*/
QUnit.module('underscore modifier'); QUnit.module('underscore modifier');
(function() { (function() {
@@ -970,22 +1025,7 @@
vm.runInContext(data.source, context); vm.runInContext(data.source, context);
var lodash = context._; var lodash = context._;
_.each([ _.each(lodashOnlyMethods.concat('assign'), function(methodName) {
'assign',
'at',
'bindKey',
'createCallback',
'findIndex',
'findKey',
'forIn',
'forOwn',
'isPlainObject',
'merge',
'parseInt',
'partialRight',
'runInContext',
'zipObject'
], function(methodName) {
equal(lodash[methodName], undefined, '_.' + methodName + ' should not exist: ' + basename); equal(lodash[methodName], undefined, '_.' + methodName + ' should not exist: ' + basename);
}); });
@@ -993,23 +1033,6 @@
}); });
}); });
asyncTest('`lodash underscore include=findWhere`', function() {
var start = _.after(2, _.once(QUnit.start));
build(['-s', 'underscore', 'include=findWhere'], function(data) {
var basename = path.basename(data.outputPath, '.js'),
context = createContext();
vm.runInContext(data.source, context);
var lodash = context._;
var collection = [{ 'a': 1 }, { 'a': 1 }];
deepEqual(lodash.findWhere(collection, { 'a': 1 }), collection[0], '_.findWhere: ' + basename);
start();
});
});
asyncTest('`lodash underscore include=partial`', function() { asyncTest('`lodash underscore include=partial`', function() {
var start = _.after(2, _.once(QUnit.start)); var start = _.after(2, _.once(QUnit.start));
@@ -1059,6 +1082,51 @@
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
QUnit.module('underscore chaining methods');
(function() {
var commands = [
'backbone',
'underscore',
'modern plus=chain'
];
commands.forEach(function(command) {
asyncTest('`lodash ' + command +'`', function() {
var start = _.after(2, _.once(QUnit.start));
build(['-s'].concat(command.split(' ')), function(data) {
var basename = path.basename(data.outputPath, '.js'),
context = createContext();
vm.runInContext(data.source, context);
var lodash = context._;
ok(lodash.chain(1) instanceof lodash, '_.chain: ' + basename);
ok(lodash(1).chain() instanceof lodash, '_#chain: ' + basename);
var wrapped = lodash(1);
strictEqual(wrapped.identity(), 1, '_(...) wrapped values are not chainable by default: ' + basename);
equal(String(wrapped) === '1', false, '_#toString should not be implemented: ' + basename);
equal(Number(wrapped) === 1 , false, '_#valueOf should not be implemented: ' + basename);
wrapped.chain();
ok(wrapped.has('x') instanceof lodash, '_#has returns wrapped values when chaining: ' + basename);
ok(wrapped.join() instanceof lodash, '_#join returns wrapped values when chaining: ' + basename);
wrapped = lodash([1, 2, 3]);
ok(wrapped.pop() instanceof lodash, '_#pop returns wrapped values: ' + basename);
ok(wrapped.shift() instanceof lodash, '_#shift returns wrapped values: ' + basename);
deepEqual(wrapped.splice(0, 0).value(), [2], '_#splice returns wrapper: ' + basename);
start();
});
});
});
}());
/*--------------------------------------------------------------------------*/
QUnit.module('exports command'); QUnit.module('exports command');
(function() { (function() {
@@ -1197,7 +1265,66 @@
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
QUnit.module('output options'); QUnit.module('commands with findWhere');
(function() {
var commands = [
'underscore include=findWhere',
'modern include=findWhere',
'plus=findWhere'
];
commands.forEach(function(command) {
asyncTest('`lodash ' + command + '`', function() {
var start = _.after(2, _.once(QUnit.start));
build(['-s'].concat(command.split(' ')), function(data) {
var basename = path.basename(data.outputPath, '.js'),
context = createContext();
vm.runInContext(data.source, context);
var lodash = context._;
var collection = [{ 'a': 1 }, { 'a': 1 }];
deepEqual(lodash.findWhere(collection, { 'a': 1 }), collection[0], '_.findWhere: ' + basename);
start();
});
});
});
}());
/*--------------------------------------------------------------------------*/
QUnit.module('no-dep option');
(function() {
var commands = [
'-n',
'--no-dep'
];
commands.forEach(function(command) {
asyncTest('`lodash modern include=each ' + command +'`', function() {
var start = _.after(2, _.once(QUnit.start));
build(['-s', 'modern', 'include=each', command], function(data) {
var basename = path.basename(data.outputPath, '.js'),
context = createContext();
vm.runInContext(data.source, context);
var lodash = context._;
deepEqual(_.functions(lodash), ['each', 'forEach'], basename);
start();
});
});
});
}());
/*--------------------------------------------------------------------------*/
QUnit.module('output option');
(function() { (function() {
var nestedPath = path.join(__dirname, 'a', 'b'); var nestedPath = path.join(__dirname, 'a', 'b');
@@ -1238,7 +1365,7 @@
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
QUnit.module('stdout options'); QUnit.module('stdout option');
(function() { (function() {
var commands = [ var commands = [
@@ -1269,64 +1396,6 @@
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
QUnit.module('mobile build');
(function() {
asyncTest('`lodash mobile`', function() {
var start = _.after(2, _.once(QUnit.start));
build(['-s', 'mobile'], function(data) {
var array = [1, 2, 3],
basename = path.basename(data.outputPath, '.js'),
context = createContext(),
object1 = [{ 'a': 1 }],
object2 = [{ 'b': 2 }],
object3 = [{ 'a': 1, 'b': 2 }],
circular1 = { 'a': 1 },
circular2 = { 'a': 1 };
circular1.b = circular1;
circular2.b = circular2;
vm.runInContext(data.source, context);
var lodash = context._;
deepEqual(lodash.merge(object1, object2), object3, basename);
deepEqual(lodash.sortBy([3, 2, 1], _.identity), array, basename);
strictEqual(lodash.isEqual(circular1, circular2), true, basename);
var actual = lodash.cloneDeep(circular1);
ok(actual != circular1 && actual.b == actual, basename);
start();
});
});
asyncTest('`lodash csp`', function() {
var sources = [];
var check = _.after(2, _.once(function() {
ok(_.every(sources, function(source) {
// remove `Function` in `_.template` before testing for additional use
return !/\bFunction\(/.test(source.replace(/= *\w+\(\w+, *['"]return.+?apply[^)]+\)/, ''));
}));
equal(sources[0], sources[1]);
QUnit.start();
}));
var callback = function(data) {
// remove copyright header and append to `sources`
sources.push(data.source.replace(/^\/\**[\s\S]+?\*\/\n/, ''));
check();
};
build(['-s', '-d', 'csp'], callback);
build(['-s', '-d', 'mobile'], callback);
});
}());
/*--------------------------------------------------------------------------*/
QUnit.module('lodash build'); QUnit.module('lodash build');
(function() { (function() {
@@ -1420,7 +1489,7 @@
methodNames = (methodNames || []).concat(command.match(/category=(\S*)/)[1].split(/, */).map(capitalize)); methodNames = (methodNames || []).concat(command.match(/category=(\S*)/)[1].split(/, */).map(capitalize));
} }
if (!methodNames) { if (!methodNames) {
methodNames = allMethods.slice(); methodNames = lodashMethods.slice();
} }
if (/plus/.test(command)) { if (/plus/.test(command)) {
methodNames = methodNames.concat(command.match(/plus=(\S*)/)[1].split(/, */)); methodNames = methodNames.concat(command.match(/plus=(\S*)/)[1].split(/, */));
@@ -1437,16 +1506,13 @@
var result = getMethodsByCategory(category); var result = getMethodsByCategory(category);
// limit category methods to those available for specific builds // limit category methods to those available for specific builds
if (isBackbone) { result = result.filter(function(methodName) {
result = result.filter(function(methodName) { return _.contains(
return _.contains(backboneDependencies, methodName); isBackbone ? backboneDependencies :
}); isUnderscore ? underscoreMethods :
} lodashMethods, methodName
else if (isUnderscore) { );
result = result.filter(function(methodName) { });
return _.contains(underscoreMethods, methodName);
});
}
if (result.length) { if (result.length) {
methodNames = _.without(methodNames, category); methodNames = _.without(methodNames, category);
push.apply(methodNames, result); push.apply(methodNames, result);

View File

@@ -18,12 +18,14 @@
// expose Lo-Dash build file path // expose Lo-Dash build file path
ui.buildPath = (function() { ui.buildPath = (function() {
switch (build) { switch (build) {
case 'lodash-prod': return 'dist/lodash.compat.min.js'; case 'lodash-compat': return 'dist/lodash.compat.min.js';
case 'lodash-underscore': return 'dist/lodash.underscore.min.js'; case 'lodash-modern-dev': return 'dist/lodash.js';
case 'lodash-modern': return 'dist/lodash.min.js'; case 'lodash-modern': return 'dist/lodash.min.js';
case 'lodash-modern-debug': return 'dist/lodash.js'; case 'lodash-legacy': return 'dist/lodash.legacy.min.js';
case 'lodash-custom': return 'lodash.custom.min.js'; case 'lodash-mobile': return 'dist/lodash.mobile.min.js';
case 'lodash-custom-debug': return 'lodash.custom.js'; case 'lodash-underscore': return 'dist/lodash.underscore.min.js';
case 'lodash-custom-dev': return 'lodash.custom.js';
case 'lodash-custom': return 'lodash.custom.min.js';
} }
return 'lodash.js'; return 'lodash.js';
}()); }());
@@ -58,12 +60,14 @@
buildList.selectedIndex = (function() { buildList.selectedIndex = (function() {
switch (build) { switch (build) {
case 'lodash-prod': return 1; case 'lodash-compat': return 1;
case 'lodash-underscore': return 2; case 'lodash-modern-dev': return 2;
case 'lodash-modern': return 3; case 'lodash-modern': return 3;
case 'lodash-modern-debug': return 4; case 'lodash-legacy': return 4;
case 'lodash-custom': return 5; case 'lodash-mobile': return 5;
case 'lodash-custom-debug': return 6; case 'lodash-underscore': return 6;
case 'lodash-custom-dev': return 7;
case 'lodash-custom': return 8;
} }
return 0; return 0;
}()); }());
@@ -87,13 +91,15 @@
span2.innerHTML = span2.innerHTML =
'<label for="qunit-build">Build: </label>' + '<label for="qunit-build">Build: </label>' +
'<select id="qunit-build">' + '<select id="qunit-build">' +
'<option value="lodash-dev">Developement</option>' + '<option value="lodash-compat-dev">Lo-Dash (compat development)</option>' +
'<option value="lodash-prod">Production</option>' + '<option value="lodash-compat">Lo-Dash (compat production)</option>' +
'<option value="lodash-underscore">Underscore</option>' + '<option value="lodash-modern-dev">Lo-Dash (modern development)</option>' +
'<option value="lodash-modern">Modern</option>' + '<option value="lodash-modern">Lo-Dash (modern production)</option>' +
'<option value="lodash-modern-debug">Modern (debug)</option>' + '<option value="lodash-legacy">Lo-Dash (legacy)</option>' +
'<option value="lodash-custom">Custom</option>' + '<option value="lodash-mobile">Lo-Dash (mobile)</option>' +
'<option value="lodash-custom-debug">Custom (debug)</option>' + '<option value="lodash-underscore">Lo-Dash (underscore)</option>' +
'<option value="lodash-custom-dev">Lo-Dash (custom development)</option>' +
'<option value="lodash-custom">Lo-Dash (custom production)</option>' +
'</select>'; '</select>';
var checkbox = span1.firstChild, var checkbox = span1.firstChild,

View File

@@ -1,17 +1,29 @@
;(function(window, undefined) { ;(function(window, undefined) {
'use strict'; 'use strict';
/** Method and object shortcuts */
var document = window.document,
amd = window.define && define.amd,
body = document && document.body,
create = Object.create,
freeze = Object.freeze,
phantom = window.phantom,
process = window.process,
slice = Array.prototype.slice,
system = window.system,
toString = Object.prototype.toString;
/** Use a single "load" function */ /** Use a single "load" function */
var load = typeof require == 'function' ? require : window.load; var load = typeof require == 'function' ? require : window.load;
/** The file path of the Lo-Dash file to test */ /** The file path of the Lo-Dash file to test */
var filePath = (function() { var filePath = (function() {
var min = 0; var min = 0;
var result = window.phantom var result = phantom
? phantom.args ? phantom.args
: (window.system : (system
? (min = 1, system.args) ? (min = 1, system.args)
: (window.process ? (min = 2, process.argv) : (window.arguments || [])) : (process ? (min = 2, process.argv) : (window.arguments || []))
); );
var last = result[result.length - 1]; var last = result[result.length - 1];
@@ -60,9 +72,6 @@
undefined undefined
]; ];
/** Shortcut used to make object properties immutable */
var freeze = Object.freeze;
/** Used to set property descriptors */ /** Used to set property descriptors */
var setDescriptor = (function() { var setDescriptor = (function() {
try { try {
@@ -73,9 +82,6 @@
return result; return result;
}()); }());
/** Shortcut used to convert array-like objects to arrays */
var slice = Array.prototype.slice;
/** Used to check problem JScript properties (a.k.a. the [[DontEnum]] bug) */ /** Used to check problem JScript properties (a.k.a. the [[DontEnum]] bug) */
var shadowedProps = [ var shadowedProps = [
'constructor', 'constructor',
@@ -109,14 +115,13 @@
// add object from iframe // add object from iframe
(function() { (function() {
if (!window.document || window.phantom) { if (!document || phantom) {
return; return;
} }
var body = document.body, var iframe = document.createElement('iframe');
iframe = document.createElement('iframe');
iframe.frameBorder = iframe.height = iframe.width = 0; iframe.frameBorder = iframe.height = iframe.width = 0;
body.appendChild(iframe); body.appendChild(iframe);
var idoc = (idoc = iframe.contentDocument || iframe.contentWindow).document || idoc; var idoc = (idoc = iframe.contentDocument || iframe.contentWindow).document || idoc;
idoc.write("<script>parent._._object = { 'a': 1, 'b': 2, 'c': 3 };<\/script>"); idoc.write("<script>parent._._object = { 'a': 1, 'b': 2, 'c': 3 };<\/script>");
idoc.close(); idoc.close();
@@ -130,7 +135,7 @@
(function() { (function() {
test('supports loading ' + basename + ' as the "lodash" module', function() { test('supports loading ' + basename + ' as the "lodash" module', function() {
if (window.define && define.amd) { if (amd) {
equal((lodashModule || {}).moduleName, 'lodash'); equal((lodashModule || {}).moduleName, 'lodash');
} else { } else {
skipTest(); skipTest();
@@ -138,7 +143,7 @@
}); });
test('supports loading ' + basename + ' with the Require.js "shim" configuration option', function() { test('supports loading ' + basename + ' with the Require.js "shim" configuration option', function() {
if (window.define && define.amd) { if (amd) {
equal((shimmedModule || {}).moduleName, 'shimmed'); equal((shimmedModule || {}).moduleName, 'shimmed');
} else { } else {
skipTest(); skipTest();
@@ -146,7 +151,7 @@
}); });
test('supports loading ' + basename + ' as the "underscore" module', function() { test('supports loading ' + basename + ' as the "underscore" module', function() {
if (window.define && define.amd) { if (amd) {
equal((underscoreModule || {}).moduleName, 'underscore'); equal((underscoreModule || {}).moduleName, 'underscore');
} else { } else {
skipTest(); skipTest();
@@ -154,7 +159,7 @@
}); });
test('avoids overwritten native methods', function() { test('avoids overwritten native methods', function() {
if (window.document && !window.phantom) { if (document && !phantom) {
notDeepEqual(lodashBadShim.keys({ 'a': 1 }), []); notDeepEqual(lodashBadShim.keys({ 'a': 1 }), []);
} else { } else {
skipTest(); skipTest();
@@ -196,6 +201,8 @@
QUnit.module('lodash.at'); QUnit.module('lodash.at');
(function() { (function() {
var args = arguments;
test('should return `undefined` for nonexistent keys', function() { test('should return `undefined` for nonexistent keys', function() {
var actual = _.at(['a', 'b', 'c'], [0, 2, 4]); var actual = _.at(['a', 'b', 'c'], [0, 2, 4]);
deepEqual(actual, ['a', 'c', undefined]); deepEqual(actual, ['a', 'c', undefined]);
@@ -210,6 +217,11 @@
deepEqual(actual, ['a', 'c', 'd']); deepEqual(actual, ['a', 'c', 'd']);
}); });
test('should work with an `arguments` object for `collection`', function() {
var actual = _.at(args, [0, 2]);
deepEqual(actual, ['a', 'c']);
});
test('should work with an object for `collection`', function() { test('should work with an object for `collection`', function() {
var actual = _.at({ 'a': 1, 'b': 2, 'c': 3 }, ['a', 'c']); var actual = _.at({ 'a': 1, 'b': 2, 'c': 3 }, ['a', 'c']);
deepEqual(actual, [1, 3]); deepEqual(actual, [1, 3]);
@@ -224,7 +236,7 @@
deepEqual(_.at(collection, [0, 2]), ['a', 'c']); deepEqual(_.at(collection, [0, 2]), ['a', 'c']);
}); });
}); });
}()); }('a', 'b', 'c'));
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
@@ -295,6 +307,12 @@
deepEqual(actual, [1, 2, 3, undefined]); deepEqual(actual, [1, 2, 3, undefined]);
}); });
test('should work with an array `object` argument', function() {
var array = ['push', 'pop'];
_.bindAll(array);
equal(array.pop, Array.prototype.pop);
});
}()); }());
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
@@ -329,12 +347,12 @@
Klass.prototype = { 'b': 1 }; Klass.prototype = { 'b': 1 };
var nonCloneable = { var nonCloneable = {
'an element': window.document && document.body, 'an element': body,
'a function': Klass 'a function': Klass
}; };
var objects = { var objects = {
'an arguments object': arguments, 'an `arguments` object': arguments,
'an array': ['a', 'b', 'c', ''], 'an array': ['a', 'b', 'c', ''],
'an array-like-object': { '0': 'a', '1': 'b', '2': 'c', '3': '', 'length': 5 }, 'an array-like-object': { '0': 'a', '1': 'b', '2': 'c', '3': '', 'length': 5 },
'boolean': false, 'boolean': false,
@@ -507,14 +525,14 @@
(function() { (function() {
test('subsequent "immediate" debounced calls return the last `func` result', function() { test('subsequent "immediate" debounced calls return the last `func` result', function() {
var debounced = _.debounce(function(value) { return value; }, 32, true), var debounced = _.debounce(_.identity, 32, true),
result = [debounced('x'), debounced('y')]; result = [debounced('x'), debounced('y')];
deepEqual(result, ['x', 'x']); deepEqual(result, ['x', 'x']);
}); });
asyncTest('subsequent debounced calls return the last `func` result', function() { asyncTest('subsequent debounced calls return the last `func` result', function() {
var debounced = _.debounce(function(value) { return value; }, 32); var debounced = _.debounce(_.identity, 32);
debounced('x'); debounced('x');
setTimeout(function() { setTimeout(function() {
@@ -522,6 +540,71 @@
QUnit.start(); QUnit.start();
}, 64); }, 64);
}); });
asyncTest('should apply default options correctly', function() {
var count = 0;
var debounced = _.debounce(function(value) {
count++;
return value;
}, 32, {});
strictEqual(debounced('x'), undefined);
setTimeout(function() {
strictEqual(count, 1);
QUnit.start();
}, 64);
});
asyncTest('should work with `leading` option', function() {
var counts = [0, 0, 0];
_.each([true, { 'leading': true }], function(options, index) {
var withLeading = _.debounce(function(value) {
counts[index]++;
return value;
}, 32, options);
equal(withLeading('x'), 'x');
});
_.times(2, _.debounce(function() { counts[2]++; }, 32, { 'leading': true }));
strictEqual(counts[2], 1);
_.each([false, { 'leading': false }], function(options) {
var withoutLeading = _.debounce(_.identity, 32, options);
strictEqual(withoutLeading('x'), undefined);
});
setTimeout(function() {
deepEqual(counts, [1, 1, 2]);
QUnit.start();
}, 64);
});
asyncTest('should work with `trailing` option', function() {
var withCount = 0,
withoutCount = 0;
var withTrailing = _.debounce(function(value) {
withCount++;
return value;
}, 32, { 'trailing': true });
var withoutTrailing = _.debounce(function(value) {
withoutCount++;
return value;
}, 32, { 'trailing': false });
strictEqual(withTrailing('x'), undefined);
strictEqual(withoutTrailing('x'), undefined);
setTimeout(function() {
strictEqual(withCount, 1);
strictEqual(withoutCount, 0);
QUnit.start();
}, 64);
});
}()); }());
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
@@ -1020,12 +1103,21 @@
test('lodash.' + methodName + ' should pass the correct `callback` arguments', function() { test('lodash.' + methodName + ' should pass the correct `callback` arguments', function() {
var args; var args;
func({ 'a': 1 }, { 'a': 2 }, function() { func({ 'a': 1 }, { 'a': 2 }, function() {
args || (args = slice.call(arguments)); args || (args = slice.call(arguments));
}); });
deepEqual(args, [1, 2]); deepEqual(args, [1, 2], 'primitive property values');
var array = [1, 2],
object = { 'b': 2 };
args = null;
func({ 'a': array }, { 'a': object }, function() {
args || (args = slice.call(arguments));
});
deepEqual(args, [array, object], 'non-primitive property values');
}); });
test('lodash.' + methodName + ' should correct set the `this` binding', function() { test('lodash.' + methodName + ' should correct set the `this` binding', function() {
@@ -1074,6 +1166,36 @@
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
QUnit.module('`__proto__` property bugs');
(function() {
var stringLiteral = '__proto__',
stringObject = Object(stringLiteral),
expected = [stringLiteral, stringObject];
var array = _.times(100, function(count) {
return count % 2 ? stringObject : stringLiteral;
});
test('internal data objects should work with the `__proto__` key', function() {
deepEqual(_.difference(array, array), []);
deepEqual(_.intersection(array, array), expected);
deepEqual(_.uniq(array), expected);
deepEqual(_.without.apply(_, [array].concat(array)), []);
});
test('lodash.memoize should memoize values resolved to the `__proto__` key', function() {
var count = 0,
memoized = _.memoize(function() { return ++count; });
memoized('__proto__');
memoized('__proto__');
strictEqual(count, 1);
});
}());
/*--------------------------------------------------------------------------*/
QUnit.module('lodash.groupBy'); QUnit.module('lodash.groupBy');
(function() { (function() {
@@ -1236,7 +1358,7 @@
(function() { (function() {
test('should use strict equality in its duck type check', function() { test('should use strict equality in its duck type check', function() {
var element = window.document ? document.body : { 'nodeType': 1 }; var element = body || { 'nodeType': 1 };
strictEqual(_.isElement(element), true); strictEqual(_.isElement(element), true);
strictEqual(_.isElement({ 'nodeType': new Number(1) }), false); strictEqual(_.isElement({ 'nodeType': new Number(1) }), false);
@@ -1356,6 +1478,14 @@
strictEqual(actual, false); strictEqual(actual, false);
}); });
}); });
test('should ensure `callback` is a function', function() {
var array = [1, 2, 3],
eq = _.partial(_.isEqual, array),
actual = _.every([array, [1, 0, 3]], eq);
strictEqual(actual, false);
})
}()); }());
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
@@ -1432,9 +1562,20 @@
strictEqual(_.isPlainObject(new Foo(1)), false); strictEqual(_.isPlainObject(new Foo(1)), false);
strictEqual(_.isPlainObject([1, 2, 3]), false); strictEqual(_.isPlainObject([1, 2, 3]), false);
strictEqual(_.isPlainObject({ 'a': 1 }), true); strictEqual(_.isPlainObject({ 'a': 1 }), true);
if (create) {
strictEqual(_.isPlainObject(create(null)), true);
} else {
skipTest();
}
if (document) {
strictEqual(_.isPlainObject(body), false);
} else {
skipTest();
}
}); });
test('should return `false` for objects without a [[Class]] of "Object"', function() { test('should return `false` for Object objects without a [[Class]] of "Object"', function() {
strictEqual(_.isPlainObject(arguments), false); strictEqual(_.isPlainObject(arguments), false);
strictEqual(_.isPlainObject(Error), false); strictEqual(_.isPlainObject(Error), false);
strictEqual(_.isPlainObject(Math), false); strictEqual(_.isPlainObject(Math), false);
@@ -1475,7 +1616,7 @@
equal(typeof func(true), expected); equal(typeof func(true), expected);
equal(typeof func(false), expected); equal(typeof func(false), expected);
equal(typeof func(new Date), expected); equal(typeof func(new Date), expected);
equal(typeof func(window.document && document.body), expected); equal(typeof func(body), expected);
equal(typeof func({}), expected); equal(typeof func({}), expected);
equal(typeof func(undefined), expected); equal(typeof func(undefined), expected);
equal(typeof func(Infinity), expected); equal(typeof func(Infinity), expected);
@@ -1488,6 +1629,22 @@
}); });
}); });
(function() {
test('should return `false` for subclassed values', function() {
_.each(['isArray', 'isBoolean', 'isDate', 'isFunction', 'isNumber', 'isRegExp', 'isString'], function(methodName) {
function Foo() {}
Foo.prototype = window[methodName.slice(2)].prototype;
var object = new Foo;
if (toString.call(object) == '[object Object]') {
strictEqual(_[methodName](object), false, '_.' + methodName + ' returns `false`');
} else {
skipTest();
}
});
});
}());
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
QUnit.module('lodash.keys'); QUnit.module('lodash.keys');
@@ -1771,8 +1928,27 @@
}); });
test('should handle merging if `callback` returns `undefined`', function() { test('should handle merging if `callback` returns `undefined`', function() {
var actual = _.merge({ 'a': 1 }, { 'a': 2 }, function() { }); var actual = _.merge({ 'a': { 'b': [1, 1] } }, { 'a': { 'b': [0] } }, function() { });
deepEqual(actual, { 'a': 2 }); deepEqual(actual, { 'a': { 'b': [0, 1] } });
});
test('should defer to `callback` when it returns a value other than `undefined`', function() {
var actual = _.merge({ 'a': { 'b': [0, 1] } }, { 'a': { 'b': [2] } }, function(a, b) {
return _.isArray(a) ? a.concat(b) : undefined;
});
deepEqual(actual, { 'a': { 'b': [0, 1, 2] } });
});
test('should pass the correct values to `callback`', function() {
var argsList = [],
array = [1, 2],
object = { 'b': 2 };
_.merge({ 'a': array }, { 'a': object }, function(a, b) {
argsList.push(slice.call(arguments));
});
deepEqual(argsList, [[array, object], [undefined, 2]]);
}); });
}(1, 2, 3)); }(1, 2, 3));
@@ -1803,6 +1979,10 @@
deepEqual(_.omit(new Foo, 'a'), expected); deepEqual(_.omit(new Foo, 'a'), expected);
}); });
test('should work with an array `object` argument', function() {
deepEqual(_.omit([1, 2, 3], '0', '2'), { '1': 2 });
});
test('should work with a `callback` argument', function() { test('should work with a `callback` argument', function() {
var actual = _.omit(object, function(value) { var actual = _.omit(object, function(value) {
return value == 1; return value == 1;
@@ -1837,18 +2017,61 @@
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
QUnit.module('lodash.once');
(function() {
test('should ignore recursive calls', function() {
var count = 0;
var func = _.once(function() {
count++;
func();
});
func();
strictEqual(count, 1);
});
test('should not throw more than once', function() {
var pass = true;
var func = _.once(function() {
throw new Error;
});
raises(function() { func(); }, Error);
try {
func();
} catch(e) {
pass = false;
}
ok(pass);
});
}());
/*--------------------------------------------------------------------------*/
QUnit.module('lodash.parseInt'); QUnit.module('lodash.parseInt');
(function() { (function() {
test('should parse strings with leading zeros with a `radix` of 10 by default (test in Firefox and Opera)', function() { test('should parse strings with leading whitespace and zeros with a `radix` of 10 by default (test in Chrome, Firefox, and Opera)', function() {
var whitespace = ' \x09\x0B\x0C\xA0\ufeff\x0A\x0D\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000';
equal(_.parseInt('08'), 8); equal(_.parseInt('08'), 8);
equal(_.parseInt(whitespace + '08'), 8);
}); });
test('should internally use a radix of 10 if `radix` is `undefined` or `0`', function() { test('should use a radix of `10`, for non-hexadecimals, if `radix` is `undefined` or `0`', function() {
equal(_.parseInt('10', 0), 10); equal(_.parseInt('10', 0), 10);
equal(_.parseInt('10'), 10); equal(_.parseInt('10'), 10);
equal(_.parseInt('10', undefined), 10); equal(_.parseInt('10', undefined), 10);
}); });
test('should use a radix of `16`, for hexadecimals, if `radix` is `undefined` or `0`', function() {
equal(_.parseInt('0x20', 0), 32);
equal(_.parseInt('0x20'), 32);
equal(_.parseInt('0x20', undefined), 32);
});
}()); }());
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
@@ -1927,6 +2150,10 @@
deepEqual(_.pick(new Foo, 'b'), { 'b': 2 }); deepEqual(_.pick(new Foo, 'b'), { 'b': 2 });
}); });
test('should work with an array `object` argument', function() {
deepEqual(_.pick([1, 2, 3], '1'), { '1': 2 });
});
test('should work with a `callback` argument', function() { test('should work with a `callback` argument', function() {
var actual = _.pick(object, function(value) { var actual = _.pick(object, function(value) {
return value == 2; return value == 2;
@@ -2558,53 +2785,125 @@
}); });
asyncTest('supports recursive calls', function() { asyncTest('supports recursive calls', function() {
var counter = 0; var count = 0;
var throttled = _.throttle(function() { var throttled = _.throttle(function() {
counter++; count++;
if (counter < 10) { if (count < 10) {
throttled(); throttled();
} }
}, 32); }, 32);
throttled(); throttled();
equal(counter, 1); equal(count, 1);
setTimeout(function() { setTimeout(function() {
ok(counter < 3) ok(count < 3)
QUnit.start(); QUnit.start();
}, 32); }, 32);
}); });
asyncTest('should not trigger a trailing call when invoked once', function() { asyncTest('should not trigger a trailing call when invoked once', function() {
var counter = 0, var count = 0,
throttled = _.throttle(function() { counter++; }, 32); throttled = _.throttle(function() { count++; }, 32);
throttled(); throttled();
equal(counter, 1); equal(count, 1);
setTimeout(function() { setTimeout(function() {
equal(counter, 1); equal(count, 1);
QUnit.start(); QUnit.start();
}, 96); }, 96);
}); });
asyncTest('should trigger trailing call when invoked repeatedly', function() { asyncTest('should trigger trailing call when invoked repeatedly', function() {
var counter = 0, var count = 0,
limit = 48, limit = 48,
throttled = _.throttle(function() { counter++; }, 32), throttled = _.throttle(function() { count++; }, 32),
start = new Date; start = new Date;
while ((new Date - start) < limit) { while ((new Date - start) < limit) {
throttled(); throttled();
} }
var lastCount = counter; var lastCount = count;
ok(lastCount > 1); ok(lastCount > 1);
setTimeout(function() { setTimeout(function() {
ok(counter > lastCount); ok(count > lastCount);
QUnit.start(); QUnit.start();
}, 96); }, 96);
}); });
asyncTest('should apply default options correctly', function() {
var count = 0;
var throttled = _.throttle(function(value) {
count++;
return value;
}, 32, {});
_.times(2, function() {
equal(throttled('x'), 'x');
});
setTimeout(function() {
strictEqual(count, 2);
QUnit.start();
}, 64);
});
test('should work with `leading` option', function() {
_.each([true, { 'leading': true }], function(options) {
var withLeading = _.throttle(_.identity, 32, options);
equal(withLeading('x'), 'x');
});
_.each([false, { 'leading': false }], function(options) {
var withoutLeading = _.throttle(_.identity, 32, options);
strictEqual(withoutLeading('x'), undefined);
});
});
asyncTest('should work with `trailing` option', function() {
var withCount = 0,
withoutCount = 0;
var withTrailing = _.throttle(function(value) {
withCount++;
return value;
}, 32, { 'trailing': true });
var withoutTrailing = _.throttle(function(value) {
withoutCount++;
return value;
}, 32, { 'trailing': false });
_.times(2, function() {
equal(withTrailing('x'), 'x');
equal(withoutTrailing('x'), 'x');
});
setTimeout(function() {
equal(withCount, 2);
strictEqual(withoutCount, 1);
QUnit.start();
}, 64);
});
asyncTest('should not update `lastCalled`, at the end of the timeout, when `trailing` is `false`', function() {
var count = 0;
var throttled = _.throttle(function() {
count++;
}, 64, { 'trailing': false });
_.times(2, throttled);
setTimeout(function() { _.times(2, throttled); }, 100);
setTimeout(function() {
equal(count, 2);
QUnit.start();
}, 128);
});
}()); }());
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
@@ -2637,10 +2936,9 @@
}); });
test('should work with a node list for `collection` (test in IE < 9)', function() { test('should work with a node list for `collection` (test in IE < 9)', function() {
if (window.document) { if (document) {
try { try {
var nodeList = document.getElementsByTagName('body'), var nodeList = document.getElementsByTagName('body'),
body = nodeList[0],
actual = _.toArray(nodeList); actual = _.toArray(nodeList);
} catch(e) { } } catch(e) { }
deepEqual(actual, [body]); deepEqual(actual, [body]);
@@ -2702,6 +3000,19 @@
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
QUnit.module('lodash.union');
(function() {
test('should produce correct results when passed a falsey `array` argument', function() {
var expected = [1, 2, 3],
actual = _.union(null, expected);
deepEqual(actual, expected);
});
}());
/*--------------------------------------------------------------------------*/
QUnit.module('lodash.uniq'); QUnit.module('lodash.uniq');
(function() { (function() {
@@ -2714,10 +3025,14 @@
}); });
test('should distinguish between numbers and numeric strings', function() { test('should distinguish between numbers and numeric strings', function() {
var expected = ['2', 2, Object('2'), Object(2)], var array = [],
actual = _.uniq(expected); expected = ['2', 2, Object('2'), Object(2)];
deepEqual(actual, expected); _.times(50, function() {
array.push.apply(array, expected);
});
deepEqual(_.uniq(expected), expected);
}); });
_.each({ _.each({
@@ -2750,6 +3065,58 @@
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
QUnit.module('lodash.unzip');
(function() {
var object = {
'an empty array': [
[],
[]
],
'0-tuples': [
[[], []],
[]
],
'1-tuples': [
[['moe'], ['larry']],
[['moe', 'larry']]
],
'2-tuples': [
[['moe', 30], ['larry', 40]],
[['moe', 'larry'], [30, 40]]
],
'3-tuples': [
[['moe', 30, true], ['larry', 40, false]],
[['moe', 'larry'], [30, 40], [true, false]]
]
};
_.forOwn(object, function(pair, key) {
test('should work with ' + key, function() {
var actual = _.unzip(pair[0]);
deepEqual(actual, pair[1]);
deepEqual(_.zip.apply(_, actual), pair[1].length ? pair[0] : pair[1]);
});
});
test('should work with tuples of different lengths', function() {
var pair = [
[['moe', 30], ['larry', 40, false]],
[['moe', 'larry'], [30, 40], [undefined, false]]
];
var actual = _.unzip(pair[0]);
ok(1 in actual);
deepEqual(actual, pair[1]);
actual = _.zip.apply(_, actual);
ok(2 in actual[0]);
deepEqual(actual, [['moe', 30, undefined], ['larry', 40, false]]);
});
}());
/*--------------------------------------------------------------------------*/
QUnit.module('lodash.where'); QUnit.module('lodash.where');
(function() { (function() {
@@ -2962,6 +3329,37 @@
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
QUnit.module('"Arrays" category methods');
(function() {
var args = arguments;
test('should work with `arguments` objects', function() {
function message(methodName) {
return '_.' + methodName + ' should work with `arguments` objects';
}
deepEqual(_.compact(args), [1, [3], 5], message('compact'));
deepEqual(_.difference(args, [null]), [1, [3], 5], message('difference'));
deepEqual(_.findIndex(args, _.identity), 0, message('findIndex'));
deepEqual(_.first(args), 1, message('first'));
deepEqual(_.flatten(args), [1, null, 3, null, 5], message('flatten'));
deepEqual(_.indexOf(args, 5), 4, message('indexOf'));
deepEqual(_.initial(args, 4), [1], message('initial'));
deepEqual(_.intersection(args, [1]), [1], message('intersection'));
deepEqual(_.last(args), 5, message('last'));
deepEqual(_.lastIndexOf(args, 1), 0, message('lastIndexOf'));
deepEqual(_.rest(args, 4), [5], message('rest'));
deepEqual(_.sortedIndex(args, 6), 5, message('sortedIndex'));
deepEqual(_.union(args, [null, 6]), [1, null, [3], 5, 6], message('union'));
deepEqual(_.uniq(args), [1, null, [3], 5], message('uniq'));
deepEqual(_.without(args, null), [1, [3], 5], message('without'));
deepEqual(_.zip(args, args), [[1, 1], [null, null], [[3], [3]], [null, null], [5, 5]], message('zip'));
});
}(1, null, [3], null, 5));
/*--------------------------------------------------------------------------*/
QUnit.module('lodash methods'); QUnit.module('lodash methods');
(function() { (function() {
@@ -3022,13 +3420,10 @@
_.each(funcs, function(methodName) { _.each(funcs, function(methodName) {
var actual = [], var actual = [],
expected = _.map(falsey, function() { return []; }),
func = _[methodName], func = _[methodName],
pass = true; pass = true;
var expected = (methodName == 'union')
? _.map(falsey, function(value, index) { return index ? [value] : []; })
: _.map(falsey, function() { return []; });
_.each(falsey, function(value, index) { _.each(falsey, function(value, index) {
try { try {
actual.push(index ? func(value) : func()); actual.push(index ? func(value) : func());
@@ -3110,7 +3505,7 @@
// configure QUnit and call `QUnit.start()` for // configure QUnit and call `QUnit.start()` for
// Narwhal, Node.js, PhantomJS, Rhino, and RingoJS // Narwhal, Node.js, PhantomJS, Rhino, and RingoJS
if (!window.document || window.phantom) { if (!document || phantom) {
QUnit.config.noglobals = true; QUnit.config.noglobals = true;
QUnit.start(); QUnit.start();
} }

View File

@@ -15,7 +15,7 @@ For a list of upcoming features, check out our [roadmap](https://github.com/best
## Support ## Support
Benchmark.js has been tested in at least Chrome 5~25, Firefox 1~19, IE 6-10, Opera 9.25-12, Safari 3-6, Node.js 0.4.8-0.10.1, Narwhal 0.3.2, PhantomJS 1.8.1, RingoJS 0.9, and Rhino 1.7RC5. Benchmark.js has been tested in at least Chrome 5~26, Firefox 2~20, IE 6-10, Opera 9.25-12, Safari 3-6, Node.js 0.4.8-0.10.5, Narwhal 0.3.2, PhantomJS 1.9.0, RingoJS 0.9, and Rhino 1.7RC5.
## Installation and usage ## Installation and usage
@@ -100,7 +100,7 @@ suite.add('RegExp#test', function() {
console.log(String(event.target)); console.log(String(event.target));
}) })
.on('complete', function() { .on('complete', function() {
console.log('Fastest is ' + _.pluck(this.filter('fastest'), 'name')); console.log('Fastest is ' + this.filter('fastest').pluck('name'));
}) })
// run async // run async
.run({ 'async': true }); .run({ 'async': true });
@@ -117,12 +117,12 @@ Benchmark.js is part of the BestieJS *"Best in Class"* module collection. This m
## Authors ## Authors
* [Mathias Bynens](http://mathiasbynens.be/) | [![twitter/mathias](http://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](http://twitter.com/mathias "Follow @mathias on Twitter") | [![twitter/jdalton](http://gravatar.com/avatar/299a3d891ff1920b69c364d061007043?s=70)](http://twitter.com/jdalton "Follow @jdalton on Twitter") |
[![twitter/mathias](http://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](https://twitter.com/mathias "Follow @mathias on Twitter") |---|---|
* [John-David Dalton](http://allyoucanleet.com/) | [Mathias Bynens](http://mathiasbynens.be/) | [John-David Dalton](http://allyoucanleet.com/) |
[![twitter/jdalton](http://gravatar.com/avatar/299a3d891ff1920b69c364d061007043?s=70)](https://twitter.com/jdalton "Follow @jdalton on Twitter")
## Contributors ## Contributors
* [Kit Cambridge](http://kitcambridge.github.com/) | [![twitter/kitcambridge](http://gravatar.com/avatar/6662a1d02f351b5ef2f8b4d815804661?s=70)](https://twitter.com/kitcambridge "Follow @kitcambridge on Twitter") |
[![twitter/kitcambridge](http://gravatar.com/avatar/6662a1d02f351b5ef2f8b4d815804661?s=70)](https://twitter.com/kitcambridge "Follow @kitcambridge on Twitter") |---|
| [Kit Cambridge](http://kitcambridge.github.io/) |

View File

@@ -21,15 +21,18 @@
/** Detect free variable `require` */ /** Detect free variable `require` */
var freeRequire = typeof require == 'function' && require; var freeRequire = typeof require == 'function' && require;
/** Detect free variable `global` and use it as `window` */ /** Detect free variable `global`, from Node.js or Browserified code, and use it as `window` */
var freeGlobal = typeof global == 'object' && global; var freeGlobal = typeof global == 'object' && global;
if (freeGlobal.global === freeGlobal) { if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {
window = freeGlobal; window = freeGlobal;
} }
/** Used to assign each benchmark an incrimented id */ /** Used to assign each benchmark an incrimented id */
var counter = 0; var counter = 0;
/** Used to make every compiled test unique */
var uidCounter = 0;
/** Used to detect primitive types */ /** Used to detect primitive types */
var rePrimitive = /^(?:boolean|number|string|undefined)$/; var rePrimitive = /^(?:boolean|number|string|undefined)$/;
@@ -139,6 +142,7 @@
max = Math.max, max = Math.max,
min = Math.min, min = Math.min,
pow = Math.pow, pow = Math.pow,
push = arrayRef.push,
setTimeout = context.setTimeout, setTimeout = context.setTimeout,
shift = arrayRef.shift, shift = arrayRef.shift,
slice = arrayRef.slice, slice = arrayRef.slice,
@@ -738,13 +742,7 @@
cycle(deferred); cycle(deferred);
} }
else if (++deferred.cycles < clone.count) { else if (++deferred.cycles < clone.count) {
// continue the test loop clone.compiled.call(deferred, context, timer);
if (support.timeout) {
// use setTimeout to avoid a call stack overflow if called recursively
setTimeout(function() { clone.compiled.call(deferred, context, timer); }, 0);
} else {
clone.compiled.call(deferred, context, timer);
}
} }
else { else {
timer.stop(deferred); timer.stop(deferred);
@@ -1450,10 +1448,9 @@
// ...the z-stat is greater than 1.96 or less than -1.96 // ...the z-stat is greater than 1.96 or less than -1.96
// http://www.statisticslectures.com/topics/mannwhitneyu/ // http://www.statisticslectures.com/topics/mannwhitneyu/
zStat = getZ(u); zStat = getZ(u);
return abs(zStat) > 1.96 ? (zStat > 0 ? -1 : 1) : 0; return abs(zStat) > 1.96 ? (u == u1 ? 1 : -1) : 0;
} }
// ...the U value is less than or equal the critical U value // ...the U value is less than or equal the critical U value
// http://www.geoib.com/mann-whitney-u-test.html
critical = maxSize < 5 || minSize < 3 ? 0 : uTable[maxSize][minSize - 3]; critical = maxSize < 5 || minSize < 3 ? 0 : uTable[maxSize][minSize - 3];
return u <= critical ? (u == u1 ? 1 : -1) : 0; return u <= critical ? (u == u1 ? 1 : -1) : 0;
} }
@@ -1566,22 +1563,18 @@
function clock() { function clock() {
var applet, var applet,
options = Benchmark.options, options = Benchmark.options,
templateData = {},
timers = [{ 'ns': timer.ns, 'res': max(0.0015, getRes('ms')), 'unit': 'ms' }]; timers = [{ 'ns': timer.ns, 'res': max(0.0015, getRes('ms')), 'unit': 'ms' }];
var templateData = {
'begin': interpolate('s#=new n#'),
'end': interpolate('r#=(new n#-s#)/1e3'),
'uid': uid
};
// lazy define for hi-res timers // lazy define for hi-res timers
clock = function(clone) { clock = function(clone) {
var deferred; var deferred;
templateData.uid = uid + uidCounter++;
if (clone instanceof Deferred) { if (clone instanceof Deferred) {
deferred = clone; deferred = clone;
clone = deferred.benchmark; clone = deferred.benchmark;
} }
var bench = clone._original, var bench = clone._original,
fn = bench.fn, fn = bench.fn,
fnArg = deferred ? getFirstArgument(fn) || 'deferred' : '', fnArg = deferred ? getFirstArgument(fn) || 'deferred' : '',
@@ -1594,6 +1587,45 @@
'teardown': getSource(bench.teardown, interpolate('m#.teardown()')) 'teardown': getSource(bench.teardown, interpolate('m#.teardown()'))
}); });
// use API of chosen timer
if (timer.unit == 'ns') {
if (timer.ns.nanoTime) {
_.extend(templateData, {
'begin': interpolate('s#=n#.nanoTime()'),
'end': interpolate('r#=(n#.nanoTime()-s#)/1e9')
});
} else {
_.extend(templateData, {
'begin': interpolate('s#=n#()'),
'end': interpolate('r#=n#(s#);r#=r#[0]+(r#[1]/1e9)')
});
}
}
else if (timer.unit == 'us') {
if (timer.ns.stop) {
_.extend(templateData, {
'begin': interpolate('s#=n#.start()'),
'end': interpolate('r#=n#.microseconds()/1e6')
});
} else if (perfName) {
_.extend(templateData, {
'begin': interpolate('s#=n#.' + perfName + '()'),
'end': interpolate('r#=(n#.' + perfName + '()-s#)/1e3')
});
} else {
_.extend(templateData, {
'begin': interpolate('s#=n#()'),
'end': interpolate('r#=(n#()-s#)/1e6')
});
}
}
else {
_.extend(templateData, {
'begin': interpolate('s#=new n#'),
'end': interpolate('r#=(new n#-s#)/1e3')
});
}
var count = bench.count = clone.count, var count = bench.count = clone.count,
decompilable = support.decompilation || stringable, decompilable = support.decompilation || stringable,
id = bench.id, id = bench.id,
@@ -1615,6 +1647,16 @@
ns = timer.ns = new applet.Packages.nano; ns = timer.ns = new applet.Packages.nano;
} }
} }
// define `timer` methods
timer.start = createFunction(
interpolate('o#'),
interpolate('var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#')
);
timer.stop = createFunction(
interpolate('o#'),
interpolate('var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#')
);
// Compile in setup/teardown functions and the test loop. // Compile in setup/teardown functions and the test loop.
// Create a new compiled test, instead of using the cached `bench.compiled`, // Create a new compiled test, instead of using the cached `bench.compiled`,
@@ -1649,7 +1691,7 @@
// pretest to determine if compiled code is exits early, usually by a // pretest to determine if compiled code is exits early, usually by a
// rogue `return` statement, by checking for a return object with the uid // rogue `return` statement, by checking for a return object with the uid
bench.count = 1; bench.count = 1;
compiled = (compiled.call(bench, context, timer) || {}).uid == uid && compiled; compiled = (compiled.call(bench, context, timer) || {}).uid == templateData.uid && compiled;
bench.count = count; bench.count = count;
} }
} catch(e) { } catch(e) {
@@ -1768,7 +1810,7 @@
*/ */
function interpolate(string) { function interpolate(string) {
// replaces all occurrences of `#` with a unique number and template tokens with content // replaces all occurrences of `#` with a unique number and template tokens with content
return _.template(string.replace(/\#/g, /\d+/.exec(uid)), templateData || {}); return _.template(string.replace(/\#/g, /\d+/.exec(templateData.uid)), templateData);
} }
/*----------------------------------------------------------------------*/ /*----------------------------------------------------------------------*/
@@ -1822,50 +1864,6 @@
if (timer.res == Infinity) { if (timer.res == Infinity) {
throw new Error('Benchmark.js was unable to find a working timer.'); throw new Error('Benchmark.js was unable to find a working timer.');
} }
// use API of chosen timer
if (timer.unit == 'ns') {
if (timer.ns.nanoTime) {
_.extend(templateData, {
'begin': interpolate('s#=n#.nanoTime()'),
'end': interpolate('r#=(n#.nanoTime()-s#)/1e9')
});
} else {
_.extend(templateData, {
'begin': interpolate('s#=n#()'),
'end': interpolate('r#=n#(s#);r#=r#[0]+(r#[1]/1e9)')
});
}
}
else if (timer.unit == 'us') {
if (timer.ns.stop) {
_.extend(templateData, {
'begin': interpolate('s#=n#.start()'),
'end': interpolate('r#=n#.microseconds()/1e6')
});
} else if (perfName) {
_.extend(templateData, {
'begin': interpolate('s#=n#.' + perfName + '()'),
'end': interpolate('r#=(n#.' + perfName + '()-s#)/1e3')
});
} else {
_.extend(templateData, {
'begin': interpolate('s#=n#()'),
'end': interpolate('r#=(n#()-s#)/1e6')
});
}
}
// define `timer` methods
timer.start = createFunction(
interpolate('o#'),
interpolate('var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#')
);
timer.stop = createFunction(
interpolate('o#'),
interpolate('var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#')
);
// resolve time span required to achieve a percent uncertainty of at most 1% // resolve time span required to achieve a percent uncertainty of at most 1%
// http://spiff.rit.edu/classes/phys273/uncert/uncert.html // http://spiff.rit.edu/classes/phys273/uncert/uncert.html
options.minTime || (options.minTime = max(timer.res / 2 / 0.01, 0.05)); options.minTime || (options.minTime = max(timer.res / 2 / 0.01, 0.05));
@@ -2362,6 +2360,11 @@
'support': support 'support': support
}); });
// Add Lo-Dash methods to Benchmark
_.each(['each', 'forEach', 'forOwn', 'has', 'indexOf', 'map', 'pluck', 'reduce'], function(methodName) {
Benchmark[methodName] = _[methodName];
});
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
_.extend(Benchmark.prototype, { _.extend(Benchmark.prototype, {
@@ -2783,11 +2786,12 @@
'off': off, 'off': off,
'on': on, 'on': on,
'pop': arrayRef.pop, 'pop': arrayRef.pop,
'push': arrayRef.push, 'push': push,
'reset': resetSuite, 'reset': resetSuite,
'run': runSuite, 'run': runSuite,
'reverse': arrayRef.reverse, 'reverse': arrayRef.reverse,
'shift': shift, 'shift': shift,
'slice': arrayRef.slice,
'sort': arrayRef.sort, 'sort': arrayRef.sort,
'splice': arrayRef.splice, 'splice': arrayRef.splice,
'unshift': arrayRef.unshift 'unshift': arrayRef.unshift
@@ -2804,6 +2808,16 @@
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
// add Lo-Dash methods as Suite methods
_.each(['each', 'forEach', 'indexOf', 'map', 'pluck', 'reduce'], function(methodName) {
var func = _[methodName];
Suite.prototype[methodName] = function() {
var args = [this];
push.apply(args, arguments);
return func.apply(_, args);
};
});
// avoid array-like object bugs with `Array#shift` and `Array#splice` // avoid array-like object bugs with `Array#shift` and `Array#splice`
// in Firefox < 10 and IE < 9 // in Firefox < 10 and IE < 9
if (!_.support.spliceObjects) { if (!_.support.spliceObjects) {

View File

@@ -24,10 +24,12 @@ $markdown = docdown(array(
## Author ## Author
* [John-David Dalton](http://allyoucanleet.com/) | [![twitter/jdalton](http://gravatar.com/avatar/299a3d891ff1920b69c364d061007043?s=70)](http://twitter.com/jdalton "Follow @jdalton on Twitter") |
[![twitter/jdalton](http://gravatar.com/avatar/299a3d891ff1920b69c364d061007043?s=70)](https://twitter.com/jdalton "Follow @jdalton on Twitter") |---|
| [John-David Dalton](http://allyoucanleet.com/) |
## Contributors ## Contributors
* [Mathias Bynens](http://mathiasbynens.be/) | [![twitter/mathias](http://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](http://twitter.com/mathias "Follow @mathias on Twitter") |
[![twitter/mathias](http://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](https://twitter.com/mathias "Follow @mathias on Twitter") |---|
| [Mathias Bynens](http://mathiasbynens.be/) |

0
vendor/firebug-lite/license.txt vendored Normal file → Executable file
View File

0
vendor/firebug-lite/skin/xp/blank.gif vendored Normal file → Executable file
View 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
View 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
View 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
View File

0
vendor/firebug-lite/skin/xp/detach.png vendored Normal file → Executable file
View 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
View 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
View 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
View 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
View 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
View 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
View 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
View 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
View 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
View 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
View 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
View 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
View File

0
vendor/firebug-lite/skin/xp/firebug.IE6.css vendored Normal file → Executable file
View File

0
vendor/firebug-lite/skin/xp/firebug.css vendored Normal file → Executable file
View File

0
vendor/firebug-lite/skin/xp/firebug.html vendored Normal file → Executable file
View File

0
vendor/firebug-lite/skin/xp/firebug.png vendored Normal file → Executable file
View 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
View 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
View File

0
vendor/firebug-lite/skin/xp/infoIcon.gif vendored Normal file → Executable file
View 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
View 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
View 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
View 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
View 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
View 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
View 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
View 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
View 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
View 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
View 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
View 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
View 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
View 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
View 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
View 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
View 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
View 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
View 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
View 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
View 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
View 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
View File

Before

Width:  |  Height:  |  Size: 142 B

After

Width:  |  Height:  |  Size: 142 B

0
vendor/firebug-lite/skin/xp/tabMenuTargetHover.png vendored Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 148 B

After

Width:  |  Height:  |  Size: 148 B

0
vendor/firebug-lite/skin/xp/tabMid.png vendored Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 262 B

After

Width:  |  Height:  |  Size: 262 B

0
vendor/firebug-lite/skin/xp/tabRight.png vendored Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 448 B

After

Width:  |  Height:  |  Size: 448 B

0
vendor/firebug-lite/skin/xp/textEditorBorders.gif vendored Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 117 B

After

Width:  |  Height:  |  Size: 117 B

0
vendor/firebug-lite/skin/xp/textEditorBorders.png vendored Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

0
vendor/firebug-lite/skin/xp/textEditorCorners.gif vendored Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

0
vendor/firebug-lite/skin/xp/textEditorCorners.png vendored Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

0
vendor/firebug-lite/skin/xp/titlebarMid.png vendored Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 273 B

After

Width:  |  Height:  |  Size: 273 B

0
vendor/firebug-lite/skin/xp/toolbarMid.png vendored Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 242 B

After

Width:  |  Height:  |  Size: 242 B

0
vendor/firebug-lite/skin/xp/tree_close.gif vendored Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 300 B

After

Width:  |  Height:  |  Size: 300 B

0
vendor/firebug-lite/skin/xp/tree_open.gif vendored Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 202 B

After

Width:  |  Height:  |  Size: 202 B

0
vendor/firebug-lite/skin/xp/twistyClosed.png vendored Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 334 B

After

Width:  |  Height:  |  Size: 334 B

0
vendor/firebug-lite/skin/xp/twistyOpen.png vendored Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 309 B

After

Width:  |  Height:  |  Size: 309 B

0
vendor/firebug-lite/skin/xp/up.png vendored Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 619 B

After

Width:  |  Height:  |  Size: 619 B

0
vendor/firebug-lite/skin/xp/upActive.png vendored Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 551 B

After

Width:  |  Height:  |  Size: 551 B

0
vendor/firebug-lite/skin/xp/upHover.png vendored Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 526 B

After

Width:  |  Height:  |  Size: 526 B

0
vendor/firebug-lite/skin/xp/warningIcon.gif vendored Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 357 B

After

Width:  |  Height:  |  Size: 357 B

0
vendor/firebug-lite/skin/xp/warningIcon.png vendored Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 516 B

After

Width:  |  Height:  |  Size: 516 B

0
vendor/firebug-lite/src/firebug-lite-debug.js vendored Normal file → Executable file
View File

Some files were not shown because too many files have changed in this diff Show More