Compare commits

...

132 Commits
1.0.2 ... 1.1.0

Author SHA1 Message Date
John-David Dalton
d7c74b8004 Bump to v1.1.0.
Former-commit-id: 7d103159263b2ad339cd1e2dba90df0d6c42a61d
2013-03-26 00:18:12 -07:00
John-David Dalton
aaa8003418 Update Benchmark.js to work in PhantomJS.
Former-commit-id: 9145f027f58a3c9f0c8b57b6e340f500ba4c7131
2013-03-25 23:23:15 -07:00
John-David Dalton
86890b13c6 Ensure consistent unit test count depending on build.
Former-commit-id: 390020635374f6fb1165a6adef0648847ec9cb9e
2013-03-25 22:12:25 -07:00
John-David Dalton
39158b0eb6 Add missing semicolons. [ci skip]
Former-commit-id: 7c9c39e84600f41d1a4f94224dfe5b2be8791d20
2013-03-25 20:37:54 -07:00
John-David Dalton
87f1d55bc2 Update docs and builds.
Former-commit-id: 21791e052114af5907d76251c58c3ba2ca138873
2013-03-25 08:35:20 -07:00
John-David Dalton
14343b5410 Make object iteration that uses _.keys work correctly in IE < 9 and _.isPlainObject work correctly in IE < 8.
Former-commit-id: ad9a3c36acb38e36cd21fe82a29b7e65a767e049
2013-03-25 08:22:40 -07:00
John-David Dalton
ffdac30b3c Make _.toArray work in legacy build.
Former-commit-id: 36866e65670f563b587af51168db9f95f01ed248
2013-03-25 08:21:43 -07:00
John-David Dalton
244c8dc391 Add dist/lodash.backbone.js. [ci skip]
Former-commit-id: c9abf959bbc0e30dd5da728e3c7903905d4e751a
2013-03-24 00:11:57 -07:00
John-David Dalton
e593344461 Add copyright header to minified Underscore file. [ci skip]
Former-commit-id: dce520ee6e1e2a175e4671ddcf7c2408efdff69f
2013-03-23 23:51:42 -07:00
John-David Dalton
74c46f6e93 Reduce the lodash underscore build.
Former-commit-id: 2f928d053faf4b8e45d5ef26e2697c25426b7a90
2013-03-23 23:46:40 -07:00
John-David Dalton
bbfd8aa249 Update Backbone method dependencies.
Former-commit-id: 031a5f31c289ad32c8ef0d30272a02c756a341ce
2013-03-23 23:24:25 -07:00
John-David Dalton
2705a488ad Update vendors.
Former-commit-id: b1b94d80548df89b3ce0ddd71b1e938f31666052
2013-03-23 23:23:57 -07:00
John-David Dalton
850c253e08 Use _.contains instead of indexOf in build/test files.
Former-commit-id: b0947f4f24c23e011f3ac781d400ee3ebbc94609
2013-03-23 22:49:28 -07:00
John-David Dalton
80e0e3fcd7 Optimize _.pluck for modern environments.
Former-commit-id: 1a6bbb9866b8ac20faaa707be5f33814579e1df8
2013-03-23 12:21:43 -07:00
John-David Dalton
2cc2d696f1 _.bind should throw a TypeError if func is not a function. [closes #213]
Former-commit-id: b6035736d9cb042b7fa4a9d0b7b4d9c6cb0ea4f8
2013-03-23 09:00:24 -07:00
John-David Dalton
8a83a6b5be Add AMD exports to the dist/lodash.underscore.js builds. [closes #214]
Former-commit-id: 4635d0c4f1ff315b08fb459ab64ef2b9ac6cbaa8
2013-03-23 00:40:06 -07:00
John-David Dalton
002d5338a0 Correct build.
Former-commit-id: 360983e61c6c6460f344d53dbda5c68e21530e32
2013-03-23 00:36:12 -07:00
John-David Dalton
743aa472f0 Ensure _.keys use in createIterator is consistent per build.
Former-commit-id: a4e0aef177d4d1c26ed5ce088574b591a6666d0d
2013-03-19 23:50:56 -07:00
John-David Dalton
ba85d5d351 Remove the _.isEqual dependency from createCallback in the underscore build and avoid potentially unnecessary string coercion in the underscore build _.isEqual method.
Former-commit-id: 1e8ce4fd9a35ad36c2b24457e519cb587c49c93b
2013-03-18 03:08:12 -06:00
John-David Dalton
4e2ef908dc Limit the category build option to adding only those methods available for specific builds (i.e. underscore and backbone builds).
Former-commit-id: 63a5509cd953b20376723335d42fb5a136eb3a5c
2013-03-18 02:43:02 -06:00
John-David Dalton
f5dd05ba8e Fix _.findIndex and _.findKey doc typos.
Former-commit-id: 7d4ae05db116e324b4b143e77bca67787476030f
2013-03-18 01:49:36 -06:00
John-David Dalton
17eda2a4cc Rebuild files and docs.
Former-commit-id: a3948db17af507d28d568d07d3e1a2afbd2c70ad
2013-03-17 19:43:23 -05:00
John-David Dalton
d219c6e019 Avoid creating intermediate strings when not needed.
Former-commit-id: 1e7457ff131f867adbf799e20af11cf714f5da7e
2013-03-17 19:31:37 -05:00
John-David Dalton
2dc539747b Add _.findIndex and _.findKey. [closes #199]
Former-commit-id: 5ac98b559e074082d4019cd30c27bface063f9c9
2013-03-17 19:28:46 -05:00
John-David Dalton
e941de50e8 Add fast path for callback back to _.forEach and ensure createCallback is called from lodash.
Former-commit-id: 5d589344897878d529d59ebba987a163b9704b37
2013-03-15 06:34:13 -07:00
John-David Dalton
63052257a2 Adjust large array size for _.difference and cleanup large array optimization code.
Former-commit-id: c3623ce2e0639a9e98d77e36e4dae51063c76e92
2013-03-14 14:38:48 -07:00
John-David Dalton
ac5d2a714e Make modern build pass unit tests again.
Former-commit-id: 6269bdbaa7cd96217568504921da097c2352cef8
2013-03-13 10:13:59 -07:00
John-David Dalton
59f78c16b1 Remove internal each for modern and underscore builds.
Former-commit-id: d090f9d0a21f8086d9e34d1171dc046a93327bb8
2013-03-13 07:56:15 -07:00
John-David Dalton
3f7f8133df Make pref.'s work for various lodash builds.
Former-commit-id: cdde1730e7b402c1f6475fc796af683faf6a8e88
2013-03-13 07:54:46 -07:00
John-David Dalton
fef5e1ce2c Simplify "Collections" methods for the modern and underscore builds.
Former-commit-id: 4ee5052537f7aed6816a886bee6da4e75c17099c
2013-03-12 07:32:02 -07:00
John-David Dalton
0b97b3864f Add isHostType to perf.js.
Former-commit-id: 36a1818a5272966ac9bd7f2394f2bd466fe6a4d4
2013-03-11 01:10:31 -07:00
John-David Dalton
3d1330c85d Remove assignment to undeclared variable in perf.js.
Former-commit-id: 6c8c6bd2db9a3ab137f6a705e2dabb2c07ccdc34
2013-03-10 23:51:17 -07:00
John-David Dalton
041c0cc322 Make pref.js work in Rhino, Narwhal, and Ringo again.
Former-commit-id: 1969153262cbc3ac134018aa021de92a86d6d7ef
2013-03-10 23:40:33 -07:00
John-David Dalton
e72712640c Allow lodash underscore plus=cloneDeep without also needing to include clone.
Former-commit-id: 90f89296ab47eff635c3c30ed34466e347ea13d3
2013-03-10 22:32:57 -07:00
John-David Dalton
6830195127 Cleanup build and docs.
Former-commit-id: 7e0719bb11e3f22ab09d51b52ab930699cbecf17
2013-03-10 11:05:07 -07:00
John-David Dalton
f9b5d6644d Ensure _.isPlainObject returns false for objects without a [[Class]] of "Object".
Former-commit-id: ce034f55733cd1929f09bf80e4a461c6e1502d1b
2013-03-10 04:27:45 -07:00
John-David Dalton
40f9eeda36 Remove reLeadingZeros from lodash underscore build.
Former-commit-id: 289d53be5b6af17ace4118ea0e6d9784667d09d3
2013-03-10 03:28:59 -07:00
John-David Dalton
0fa0b0b1ea Remove Closure Compiler escape from eachIteratorOptions.
Former-commit-id: 532e73f570bed2bc5941d0a6d1cb13618da0441b
2013-03-10 00:55:50 -08:00
John-David Dalton
ff0b23f200 Update vendor/platform.js again.
Former-commit-id: 39d31dcc7ef75a2bc62d9147f39c7adab2f2369f
2013-03-10 00:43:31 -08:00
John-David Dalton
5456d4081b Move regexp used in _.parseInt to outside the method.
Former-commit-id: 5b93dcdff39089ed5467ba52040f2e352716c49e
2013-03-10 00:30:58 -08:00
John-David Dalton
8948fae780 Update vendor/platform.js but remove it from test.'s.
Former-commit-id: 4f72d2b4454e7de42754c98c7b17f47f1f30718c
2013-03-09 23:52:20 -08:00
John-David Dalton
ee4542a699 Optimize lodash function to avoid slow path for arrays.
Former-commit-id: 24e2c4ac2525ae38e214fdb0ea8e3ab664d784b7
2013-03-09 18:24:29 -08:00
John-David Dalton
31e4e631f9 Cleanup test.js and perf.js and add _(array) benchmark.
Former-commit-id: bcd120c9ee332db39c7b637894751f2861bac069
2013-03-09 18:15:32 -08:00
John-David Dalton
cbf20b3271 Update vendors.
Former-commit-id: 7b8fe528a3e3887321505cf68b61cc3d774ef60b
2013-03-09 17:15:35 -08:00
John-David Dalton
a65fd50723 Add note to _.createCallback docs.
Former-commit-id: 0e5dfa9b4dc9aeea1c821b47d2f3d755678ea1aa
2013-03-09 13:32:15 -08:00
John-David Dalton
63a6aac2d8 Expanded _.createCallback and _.after docs and ensure _.times calls lodash.createCallback.
Former-commit-id: 2d6a480a5ee449295ec40acd5e8bbef6fe955473
2013-03-09 12:22:19 -08:00
John-David Dalton
afde4804c9 Fix build test and add extra "Arrays" and "Functions" method category tests.
Former-commit-id: 924e034ec6ec8d05d573dff969f064f1bb32ea33
2013-03-09 01:30:45 -08:00
John-David Dalton
bc8ec9cd3e Make _.times use _.createCallback and rebuild docs and dist/builds.
Former-commit-id: 62393b4833b64cea226abdbb6f1488369de46677
2013-03-09 01:29:42 -08:00
John-David Dalton
b63ab18e29 Rebuild docs and custom builds.
Former-commit-id: 6fea0c6b4c7bb28ee3d55b4af27874e40cd9813f
2013-03-08 22:57:20 -08:00
John-David Dalton
e7325f58c3 Correct unit test for rhino -require support.
Former-commit-id: 83c076f881daccd18d7e11006e3fab75ecea27ea
2013-03-08 09:00:20 -08:00
John-David Dalton
7b35bb8c96 Correct support.nonEnumArgs.
Former-commit-id: 69b09827404bae997846daa681d96d8c9264af78
2013-03-08 08:56:30 -08:00
John-David Dalton
e84671ce5d Correct _.result docs and cleanup _.support docs.
Former-commit-id: 6edb1956885d61408188d2809eeacd3aa975f283
2013-03-08 08:32:50 -08:00
John-David Dalton
b01d50fe05 Add _.support unit tests and remove _.support from the lodash underscore build.
Former-commit-id: 986c02d5363329f16cde720430b26edb6bc865f0
2013-03-08 00:53:27 -08:00
John-David Dalton
3f163051b1 Avoid hardcoded indents in build.js.
Former-commit-id: ece1e6a32f5d308e4674774f8875ee34c06b4d43
2013-03-08 00:20:07 -08:00
John-David Dalton
4f1d03e1d4 Cleanup the inlined iteratorTemplate.
Former-commit-id: 0964f0fda4a21a2009ebfd022e9d9c33bd78bbee
2013-03-08 00:03:57 -08:00
John-David Dalton
fc39e4a225 Fix build.
Former-commit-id: 17c97c9e2cad21ea6eb0af3d7b93ebb5caa89720
2013-03-07 23:20:25 -08:00
John-David Dalton
bf88ad7fc8 Update builds and docs.
Former-commit-id: 104839a253a7f3711dad357899128ccf839b01cf
2013-03-07 23:09:35 -08:00
John-David Dalton
11ba02067e Ensure _.times doesn't error when passed negative numbers.
Former-commit-id: 5d694743fbda0f477250fe3c90cf29168834ac6f
2013-03-07 09:05:27 -08:00
John-David Dalton
952afa05ce Add the _.support object.
Former-commit-id: b81ec9e5dbd41c729b3ad71187cb5e77e0755b9f
2013-03-07 09:02:44 -08:00
John-David Dalton
3131cc3160 Replace createWrapper references with new lodashWrapper references and refine Closure Compiler fix.
Former-commit-id: 552b98a4e9ccd42a00a980dd850e3b154cb7cd32
2013-03-05 02:05:44 -08:00
John-David Dalton
792f768479 Update vendor/requirejs.
Former-commit-id: 90bd5bc12f9159b65d485c540474404a61cad7ef
2013-03-05 00:22:03 -08:00
John-David Dalton
ff312a15dd Update minifiers, fix new Closure Compiler issue, and re-minify builds.
Former-commit-id: fb9993cb39c5c43d430e038253ab717ceb4c705f
2013-03-05 00:21:41 -08:00
John-David Dalton
36207c9a98 Modify the Lo-Dash description.
Former-commit-id: 910b51eb69b12df04345f8e97d7c288aee1525f7
2013-03-04 22:15:29 -08:00
John-David Dalton
b92105e888 Simplify the lodash wrapper.
Former-commit-id: 389c9ca8aa8414b04f7f99caf955862a1925d42e
2013-03-04 22:03:34 -08:00
John-David Dalton
35bd7c55d0 Move lodash instance check up in lodash function and tweak chaining benchmark.
Former-commit-id: 799ae05e5180ee87bb2a5249be3e442ed0425ef7
2013-03-04 01:40:55 -08:00
John-David Dalton
9f19c302d8 Cleanup _.bind benchmarks and add chaining benchmarks. [ci skip]
Former-commit-id: 9198c34679709610a440f71856a3869eaa83090e
2013-03-04 00:43:02 -08:00
John-David Dalton
87b1ac776f Remove extraneous spaces from non-minified builds.
Former-commit-id: ec8e18d00884cab96031c061ed32002f41edc0e5
2013-03-03 23:29:54 -08:00
John-David Dalton
41e401b05e Add callback and thisArg arguments to _.flatten. [closes #204]
Former-commit-id: 166d6af35c3905c87498ee74abd143f6fdba451d
2013-03-03 23:26:28 -08:00
John-David Dalton
d88da3589d Update docs and builds.
Former-commit-id: 1f7bfb21276f1c871f4e6ce8a6bf168784509994
2013-03-03 20:12:06 -08:00
John-David Dalton
9638c393bb Expose createCallback.
Former-commit-id: d0c0b02a68e33a2bf220a1605a6fe62eb4a11a83
2013-03-03 19:46:27 -08:00
John-David Dalton
9961ddc2a8 Ensure callback shorthands work with _.uniq. [\ht @jden, @motowilliams]
Former-commit-id: d9a0e688414edc4167b5f8e9ca123bab587f8264
2013-03-03 14:40:15 -08:00
John-David Dalton
2d40dfd8d4 Merge branch 'master' of github.com:bestiejs/lodash
Former-commit-id: e3d0b12d132d3eee4490575e5b18beb8faaf69c6
2013-03-03 13:46:57 -08:00
John-David Dalton
99c9bdf71d Fix misspellings in the docs.
Former-commit-id: 5c318a9fd6b624dbd9befb314644cb7967dc4fe9
2013-03-03 13:46:45 -08:00
John-David Dalton
4fcd25ec88 Merge pull request #202 from drewish/master
Fixing some misspellings.

Former-commit-id: 5315bcc098e909972d93312cf8c14889d17efef0
2013-03-03 13:44:10 -08:00
John-David Dalton
440218da67 Fix build.
Former-commit-id: 9d57351081959276735f8f3df81ecde71c4b9344
2013-03-03 13:36:10 -08:00
andrew morton
fefdb9fc8d Fix some misspellings in the docs.
Former-commit-id: 38ec1d19f1e5ea1fbb05306e5b5cfc9fac550562
2013-03-03 13:08:01 -08:00
John-David Dalton
21a0eff593 Fix build, and rebuild files & docs.
Former-commit-id: af57dd1de6b20e93caa79f05cb9b43647a1de578
2013-03-03 01:37:33 -08:00
John-David Dalton
8825a094ae Use native Object.create when available, optimize the creation of lodash instances, and ensure methods like forEach return the existing wrapper object when chaining, instead of creating a new one.
Former-commit-id: fa9ec371ba23ce8c35c15a66dd9b1f09f183b3a9
2013-03-03 01:21:19 -08:00
John-David Dalton
aa49ce5c56 Tweak platform placement in test.js and runner.
Former-commit-id: a261884dfda6f046431007bef6d9fe109fb1d887
2013-03-02 20:48:42 -08:00
John-David Dalton
1522d3385d Rename _.object to _.zipObject and make _.object an alias of _.zipObject.
Former-commit-id: 7ae3c9d8be32b1430945ffeafc20c740f1d7f409
2013-03-02 20:48:04 -08:00
John-David Dalton
510c41440a Rebuild docs and files.
Former-commit-id: ae6f8f4117b7baab2a47e7c8302edc1fa8dfdb07
2013-03-01 00:39:02 -08:00
John-David Dalton
aa0c34ba1c If _.cloneDeep callback result is not undefined then return the result instead of going deeper.
Former-commit-id: 6a0588dbe158211061ec88badf4d4e3b89b02aa5
2013-03-01 00:36:19 -08:00
John-David Dalton
af87e6ef62 Correct _.cloneDeep docs.
Former-commit-id: 93849f67b49fbba0d91ea8693a4d0b324f55352c
2013-03-01 00:24:48 -08:00
John-David Dalton
30291ce6e6 Make setting context work in older ES3 environments that will use values, named after built-in constructors, for the creation of literals.
Former-commit-id: 981139db2a30f9c69d3e616021f697b8403dee26
2013-02-28 20:34:14 -08:00
John-David Dalton
890c2eb564 Remove unneeded contextProp value.
Former-commit-id: f73bf05faece643fea8b1b67edfa240ba47beec5
2013-02-28 03:26:02 -08:00
John-David Dalton
67a269b89c Update builds and docs.
Former-commit-id: 57709d874ed5b6855daf536c2a0977738665c3c1
2013-02-28 02:53:09 -08:00
John-David Dalton
4b9ee81a78 Adjust build for renamed variables and _.runInContext dependencies, and cleanup build.js and build/pre-compile.js.
Former-commit-id: 0d813bc111617e9b8cd922b505ec8c90ce09063b
2013-02-28 02:51:43 -08:00
John-David Dalton
4343f4d229 Tweak _.parseInt docs.
Former-commit-id: 960256bab36fbecb8aa06679c10d8033e2013de2
2013-02-28 02:49:54 -08:00
John-David Dalton
2162baa6c0 Add contextProps to make _.runInContext work in older IEs.
Former-commit-id: 208f25296d35ed29a283fb1598de0052a5a2703d
2013-02-28 02:49:26 -08:00
John-David Dalton
7e7f792710 Add _.parseInt and _.runInContext to the underscore build tests.
Former-commit-id: a5f8d936e912d0bd53f689d23c3393731fe97f47
2013-02-28 02:48:11 -08:00
John-David Dalton
1bbd9e24b0 Fix and cleanup [[DontEnum]] unit test.
Former-commit-id: 9e47eeb03c88a52d2e1d6dd2c0373c2df2f576fe
2013-02-28 02:47:14 -08:00
John-David Dalton
6435aaa64f Ensure the exports object is not a DOM element. [closes #197]
Former-commit-id: 3adb679f7f4d7a64e0bc37ed80a443c211a17510
2013-02-27 09:10:13 -08:00
John-David Dalton
999aae0a33 Add _.parseInt.
Former-commit-id: 0c0f10af3dc50a4d1b684523f19d02e423d738f5
2013-02-27 08:54:15 -08:00
John-David Dalton
ba795639b4 Fix iife build tests.
Former-commit-id: 0fa103c21297672c018d66fba16ef376d3599b41
2013-02-27 02:17:19 -08:00
John-David Dalton
4c4b205721 Use setImmediate reference of the context object.
Former-commit-id: 28c11df25ceb1a414caaa61eaee54fae27a2ff03
2013-02-27 01:15:59 -08:00
John-David Dalton
b3c550b7c0 Make _.runInContext not require a fully populated context object.
Former-commit-id: 11bf3cad2bfd3e922e7701eb7b0f48028f522ba6
2013-02-27 01:03:45 -08:00
John-David Dalton
eb8953e784 Remove isJSC in mobile and underscore builds. [closes #196]
Former-commit-id: 77ddbbcfcf17b5074a7fba137dc426f20a6ab5dd
2013-02-26 21:08:35 -08:00
John-David Dalton
b88b292d5d Fix lodash.underscore usage example in README.md. [ci skip] [closes #194]
Former-commit-id: 5df59e98d58dc13eeff1ff9a4a76c7ef6811a0a7
2013-02-25 21:59:05 -08:00
John-David Dalton
5f42c3b319 Add rhino -require to the run-test.sh.
Former-commit-id: 105f76b6058b8a1493d1a56716df7f22391e4bdd
2013-02-24 22:51:11 -08:00
John-David Dalton
5b27ae0371 Cleanup comments in various source files.
Former-commit-id: 02e8223692e4678e78a0eadc4ffaed3e27b5a49f
2013-02-24 22:50:10 -08:00
John-David Dalton
f26b1da1b5 Simplify build/mkdirp-sync.js.
Former-commit-id: b49bbea9e565dbf1d23f601af74443b33fe9fc7d
2013-02-24 17:49:47 -08:00
John-David Dalton
7a853e2dcb Update vendors.
Former-commit-id: 92fe8e8ceacd0993fadd35c5feffddcbe319d6c7
2013-02-24 15:35:56 -08:00
John-David Dalton
9b22748bd0 Cleanup perf/perf.js and test/test.js.
Former-commit-id: fba43c75aa25227e771a3cdd0cce0ee8ee9cdba6
2013-02-24 15:25:56 -08:00
John-David Dalton
c1e9dd3373 Ensure relative paths work with --output and template=… build options.
Former-commit-id: 2447466a006dc8d968969bba70a0e44f91610154
2013-02-24 11:40:56 -08:00
John-David Dalton
8cbbc47043 Ensure all temp folders made during the --output build tests are removed.
Former-commit-id: d5c98deebd879f594aac73d4b835c97516ee4e89
2013-02-24 09:48:33 -08:00
John-David Dalton
81b3567133 Add path.sep for older versions of Node.js.
Former-commit-id: 1a058681fc5c6aae426902a7d6dd76b3a5849837
2013-02-24 09:29:23 -08:00
John-David Dalton
fc6568f390 Cleanup build tests and inline _.mixin when it's removed to preserve chaining behavior.
Former-commit-id: ed24a9acfabb70fb7093479a5c3484d966cbc5bb
2013-02-24 03:05:49 -08:00
John-David Dalton
8e30fe2946 Fix build.
Former-commit-id: 41b9584b63962a71f146c61fda056d15a2be4e14
2013-02-24 01:54:35 -08:00
John-David Dalton
6c811a3261 Move mkdir -p functionality to its own module and cleanup --output build tests.
Former-commit-id: b7ea2a41c60357e780e10bd3d665db3d50e7f044
2013-02-24 01:24:47 -08:00
John-David Dalton
afbe5aa540 Merge pull request #192 from phated/master
Implement `mkdir -p` for `--output` build option.

Former-commit-id: cb7a6753d15f495a1ab8b0016edd34d5626727de
2013-02-23 22:55:18 -08:00
John-David Dalton
324afd2d6c Add doc not for chaining support in custom builds and tweak support rules in build.js. [closes #193]
Former-commit-id: c87f6bfe28f00d9228f4112463635d555e138a41
2013-02-23 22:52:21 -08:00
John-David Dalton
58d94ef61e Clarify docs for callback use in _.first, _.initial, _.last, and _.rest. [ci skip] [closes #189]
Former-commit-id: 12ee5f957fa67e93e40630e627d90b9aaa7eff37
2013-02-23 21:49:02 -08:00
John-David Dalton
39974b0982 Make optionsToArray remove falsey values.
Former-commit-id: 5c82f8ab92f67bd35030320fae06811dbb8f442b
2013-02-23 20:30:14 -08:00
John-David Dalton
323d7306e2 Add QUnit.config.noglobals to build tests.
Former-commit-id: 4519f5322a51632ce23dc4c574365472338a18e0
2013-02-23 20:29:23 -08:00
John-David Dalton
251e228ce4 Remove isFunction fallback from modern builds
Former-commit-id: 21f51b3041b60136bb07ca775abfe91df7687639
2013-02-23 19:07:19 -08:00
Blaine Bublitz
a99f3f217a really basic version of mkdir -p for -o option
Former-commit-id: 0fb635efd2043ee901c4f4eae7c6670d5b44a068
2013-02-23 19:37:46 -07:00
John-David Dalton
e2acbee113 Adjust iife build test and add strict build tests.
Former-commit-id: 1422311e7c7106e7def75b7b75800975c59127ff
2013-02-23 16:19:52 -08:00
John-David Dalton
37b69eddf2 Tweak detection of the Node.js executable in command-line arguments.
Former-commit-id: 74047748237f8defe36aea2a27e54ac72a648c93
2013-02-23 15:58:43 -08:00
John-David Dalton
f0322e6f2c Rebuild files, adding lodash.legacy and lodash.mobile builds, and update docs. [closes #190]
Former-commit-id: 6167b81d8baf1e491b8cbb3e3c68c01ae6ddd865
2013-02-23 14:56:50 -08:00
John-David Dalton
756587d080 Remove undefined from the IIFE to allow easier customizations with the iife build option.
Former-commit-id: a496b1fba74fdab3b2819d27b769371f73364684
2013-02-23 14:08:48 -08:00
John-David Dalton
1ad2c92324 Fix lodash underscore build.
Former-commit-id: 017208b28865b10b068ba4ae5e4a7baa9c01a80f
2013-02-22 03:33:15 -08:00
John-David Dalton
e5433adf78 Rebuild files and docs.
Former-commit-id: 1a834e5811525e9fb99def149cb4c455b3d4367d
2013-02-22 02:02:51 -08:00
John-David Dalton
ed765f75d8 Fix alais -> alias typo in README.md.
Former-commit-id: 7c919c834f729d03d26c0b3eb14203585099333b
2013-02-22 02:01:36 -08:00
John-David Dalton
4136f1b377 Fix build indenting.
Former-commit-id: 87a7793799ee3ed28fe67cb894aa2876be103c50
2013-02-22 02:00:42 -08:00
John-David Dalton
860339b90e Fix failing tests in Narwhal.
Former-commit-id: 986262a14784d94f616663724e52d11a0e11a56d
2013-02-21 23:33:23 -08:00
John-David Dalton
03254a0c0f Make isKeysFast true for Firefox too.
Former-commit-id: cf14455782375eccc4c32c5bfca41c3f918db2e8
2013-02-21 23:19:26 -08:00
John-David Dalton
a76081c979 Add require call to compiled templates.
Former-commit-id: 3d97f6cc71a3c7e6ac9b12cc876ace4790efbae8
2013-02-21 22:08:09 -08:00
John-David Dalton
71a207079f Update vendors.
Former-commit-id: 25cce48fee2dfb010eb6a9c2e4235890f20b19aa
2013-02-21 08:40:09 -08:00
John-David Dalton
f6e724c4c5 Update build to work with _.runInContext.
Former-commit-id: da4a9da0e2c74bbcbd142c077794486d0ac45835
2013-02-21 08:39:25 -08:00
John-David Dalton
4251b36b25 Add _.runInContext.
Former-commit-id: f427f7d4704fb1b6af578b095e417ee25ca029e7
2013-02-21 00:47:19 -08:00
John-David Dalton
b8f39cbfdf Cleanup _.template comments.
Former-commit-id: cff1c86d3a7e9c5ee32e00762ce522690726ef09
2013-02-19 08:08:31 -08:00
John-David Dalton
088c621862 Tweak _.defer and _.delay docs. [ci skip]
Former-commit-id: 921eec8f2e8e7701f14095d221a5e72a2c45f470
2013-02-19 01:53:21 -08:00
38 changed files with 22422 additions and 20971 deletions

View File

@@ -18,6 +18,7 @@ vendor/docdown/
vendor/firebug-lite/ vendor/firebug-lite/
vendor/json3/ vendor/json3/
vendor/jquery/ vendor/jquery/
vendor/platform.js/
vendor/qunit/qunit/*.css vendor/qunit/qunit/*.css
vendor/qunit/qunit/*-1.8.0.js vendor/qunit/qunit/*-1.8.0.js
vendor/requirejs/ vendor/requirejs/

View File

@@ -1,29 +1,29 @@
# Lo-Dash <sup>v1.0.1</sup> # Lo-Dash <sup>v1.1.0</sup>
[![build status](https://secure.travis-ci.org/bestiejs/lodash.png)](http://travis-ci.org/bestiejs/lodash) [![build status](https://secure.travis-ci.org/bestiejs/lodash.png)](http://travis-ci.org/bestiejs/lodash)
An alternative to Underscore.js, 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.0.1/dist/lodash.js) and [Development](https://raw.github.com/bestiejs/lodash/v1.1.0/dist/lodash.js) and
[Production](https://raw.github.com/bestiejs/lodash/v1.0.1/dist/lodash.min.js) [Production](https://raw.github.com/bestiejs/lodash/v1.1.0/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.0.1/dist/lodash.compat.js) and [Development](https://raw.github.com/bestiejs/lodash/v1.1.0/dist/lodash.compat.js) and
[Production](https://raw.github.com/bestiejs/lodash/v1.0.1/dist/lodash.compat.min.js) [Production](https://raw.github.com/bestiejs/lodash/v1.1.0/dist/lodash.compat.min.js)
* Underscore compatibility builds:<br> * Underscore compatibility builds:<br>
[Development](https://raw.github.com/bestiejs/lodash/v1.0.1/dist/lodash.underscore.js) and [Development](https://raw.github.com/bestiejs/lodash/v1.1.0/dist/lodash.underscore.js) and
[Production](https://raw.github.com/bestiejs/lodash/v1.0.1/dist/lodash.underscore.min.js) [Production](https://raw.github.com/bestiejs/lodash/v1.1.0/dist/lodash.underscore.min.js)
* CDN copies of ≤ v1.0.1s builds are available on [cdnjs](http://cdnjs.com/) thanks to [CloudFlare](http://www.cloudflare.com/):<br> * CDN copies of ≤ v1.1.0s builds are available on [cdnjs](http://cdnjs.com/) thanks to [CloudFlare](http://www.cloudflare.com/):<br>
[Lo-Dash dev](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.0.1/lodash.js), [Lo-Dash dev](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.1.0/lodash.js),
[Lo-Dash prod](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.0.1/lodash.min.js),<br> [Lo-Dash prod](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.1.0/lodash.min.js),<br>
[Lo-Dash compat-dev](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.0.1/lodash.compat.js), [Lo-Dash compat-dev](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.1.0/lodash.compat.js),
[Lo-Dash compat-prod](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.0.1/lodash.compat.min.js),<br> [Lo-Dash compat-prod](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.1.0/lodash.compat.min.js),<br>
[Underscore compat-dev](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.0.1/lodash.underscore.js), and [Underscore compat-dev](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.1.0/lodash.underscore.js), and
[Underscore compat-prod](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.0.1/lodash.underscore.min.js) [Underscore compat-prod](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.1.0/lodash.underscore.min.js)
* For optimal file size, [create a custom build](https://github.com/bestiejs/lodash#custom-builds) with only the features you need * For optimal file size, [create a custom build](https://github.com/bestiejs/lodash#custom-builds) with only the features you need
@@ -56,12 +56,17 @@ 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
* [_.createCallback](http://lodash.com/docs#createCallback) to customize how callback arguments are handled and support callback shorthands in mixins
* [_.findIndex](http://lodash.com/docs#findIndex) and [_.findKey](http://lodash.com/docs#findKey) for finding indexes and keys of collections
* [_.forEach](http://lodash.com/docs#forEach) is chainable and supports exiting iteration early * [_.forEach](http://lodash.com/docs#forEach) is chainable and supports exiting iteration early
* [_.forIn](http://lodash.com/docs#forIn) for iterating over an objects own and inherited properties * [_.forIn](http://lodash.com/docs#forIn) for iterating over an objects own and inherited properties
* [_.forOwn](http://lodash.com/docs#forOwn) for iterating over an objects own properties * [_.forOwn](http://lodash.com/docs#forOwn) for iterating over an objects own properties
* [_.isPlainObject](http://lodash.com/docs#isPlainObject) checks if values are created by the `Object` constructor * [_.isPlainObject](http://lodash.com/docs#isPlainObject) checks if values are created by the `Object` constructor
* [_.merge](http://lodash.com/docs#merge) for a deep [_.extend](http://lodash.com/docs#extend) * [_.merge](http://lodash.com/docs#merge) for a deep [_.extend](http://lodash.com/docs#extend)
* [_.parseInt](http://lodash.com/docs#parseInt) for consistent cross-environment behavior
* [_.partial](http://lodash.com/docs#partial) and [_.partialRight](http://lodash.com/docs#partialRight) for partial application without `this` binding * [_.partial](http://lodash.com/docs#partial) and [_.partialRight](http://lodash.com/docs#partialRight) for partial application without `this` binding
* [_.runInContext](http://lodash.com/docs#runInContext) for easier mocking and extended environment support
* [_.support](http://lodash.com/docs#support) to flag environment features
* [_.template](http://lodash.com/docs#template) supports [*“imports”* options](http://lodash.com/docs#templateSettings_imports), [ES6 template delimiters](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-7.8.6), and [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) * [_.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)
* [_.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),
@@ -73,7 +78,7 @@ For more information check out these articles, screencasts, and other videos ove
## Support ## Support
Lo-Dash has been tested in at least Chrome 5~24, Firefox 1~18, IE 6-10, Opera 9.25-12, Safari 3-6, Node.js 0.4.8-0.8.20, 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~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.
## Custom builds ## Custom builds
@@ -86,7 +91,7 @@ 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. * 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 alais 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). 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 ```bash
lodash csp lodash csp
``` ```
@@ -209,18 +214,18 @@ To avoid potential issues, update `npm` before installing Lo-Dash:
npm install npm -g npm install npm -g
``` ```
In [Node.js](http://nodejs.org/) and [RingoJS v0.8.0+](http://ringojs.org/): In [Node.js](http://nodejs.org/) and [RingoJS v0.8.0](http://ringojs.org/):
```js ```js
var _ = require('lodash'); var _ = require('lodash');
// or as a drop-in replacement for Underscore // or as a drop-in replacement for Underscore
var _ = require('lodash/lodash.underscore'); var _ = require('lodash/dist/lodash.underscore');
``` ```
**Note:** If Lo-Dash is installed globally, run [`npm link lodash`](http://blog.nodejs.org/2011/03/23/npm-1-0-global-vs-local-installation/) in your projects root directory before requiring it. **Note:** If Lo-Dash is installed globally, run [`npm link lodash`](http://blog.nodejs.org/2011/03/23/npm-1-0-global-vs-local-installation/) in your projects root directory before requiring it.
In [RingoJS v0.7.0-](http://ringojs.org/): In [RingoJS v0.7.0](http://ringojs.org/):
```js ```js
var _ = require('lodash')._; var _ = require('lodash')._;
@@ -247,21 +252,25 @@ require({
## Release Notes ## Release Notes
### <sup>v1.0.1</sup> ### <sup>v1.1.0</sup>
* Add support for specifying source map URLs in `-p`/`--source-map` build options * Added `rhino -require` support
* Ensured the second argument passed to `_.assign` is not treated as a `callback` * Added `_.createCallback`, `_findIndex`, `_.findKey`, `_.parseInt`, `_.runInContext`, and `_.support`
* Ensured `-p`/`--source-map` build options correctly set the `sourceMappingURL` * Added support for `callback` and `thisArg` arguments to `_.flatten`
* Made `-p`/`--source-map` build options set source map *“sources”* keys based on the builds performed * Added CommonJS/Node support to precompiled templates
* Made `_.defer` use `setImmediate`, in Node.js, when available * Ensured the `exports` object is not a DOM element
* Made `_.where` search arrays for values regardless of their index position * Ensured `_.isPlainObject` returns `false` for objects without a `[[Class]]` of “Object”
* Removed dead code from `_.template` * 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).
## BestieJS ## BestieJS
Lo-Dash is part of the BestieJS *“Best in Class”* module collection. This means we promote solid browser/environment support, ES5 precedents, unit testing, and plenty of documentation. Lo-Dash is part of the BestieJS *“Best in Class”* module collection. This means we promote solid browser/environment support, ES5+ precedents, unit testing, and plenty of documentation.
## Author ## Author

2037
build.js

File diff suppressed because it is too large Load Diff

View File

@@ -2,24 +2,31 @@
;(function() { ;(function() {
'use strict'; 'use strict';
/** Load Node modules */ /** Load Node.js modules */
var fs = require('fs'), var fs = require('fs'),
https = require('https'), https = require('https'),
path = require('path'), path = require('path'),
spawn = require('child_process').spawn, spawn = require('child_process').spawn,
zlib = require('zlib'), zlib = require('zlib');
tar = require('../vendor/tar/tar.js'),
_ = require('../lodash.js');
/** Load other modules */ /** Load other modules */
var preprocess = require('./pre-compile.js'), var _ = require('../lodash.js'),
postprocess = require('./post-compile.js'); mkdirpSync = require('./mkdirp-sync.js'),
preprocess = require('./pre-compile.js'),
postprocess = require('./post-compile.js'),
tar = require('../vendor/tar/tar.js');
/** Add `fs.existsSync` for older versions of Node.js */
fs.existsSync || (fs.existsSync = path.existsSync);
/** 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 = '23cf67d0f0b979d97631fc108a2a43bb82225994'; var closureId = 'a95a8007892aa824ce90c6aa3d3abb0489bf0fff';
/** The Git object ID of `uglifyjs.tar.gz` */ /** The Git object ID of `uglifyjs.tar.gz` */
var uglifyId = 'a934fb18f8fa2768c6a68de44b6e035fe96a268b'; var uglifyId = '41308bd569db41a32d4f08af115875d0342e8bfb';
/** 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, '..'));
@@ -39,6 +46,9 @@
/** The media type for raw blob data */ /** The media type for raw blob data */
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 */
var reNode = RegExp('(?:^|' + path.sep + ')node(?:\\.exe)?$');
/** Used to reference parts of the blob href */ /** Used to reference parts of the blob href */
var location = (function() { var location = (function() {
var host = 'api.github.com', var host = 'api.github.com',
@@ -59,9 +69,6 @@
'advanced': 'ADVANCED_OPTIMIZATIONS' 'advanced': 'ADVANCED_OPTIMIZATIONS'
}; };
/** Reassign `existsSync` for older versions of Node */
fs.existsSync || (fs.existsSync = path.existsSync);
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
/** /**
@@ -96,7 +103,7 @@
options = source; options = source;
// used to report invalid command-line arguments // used to report invalid command-line arguments
var invalidArgs = _.reject(options.slice(options[0] == 'node' ? 2 : 0), function(value, index, options) { var invalidArgs = _.reject(options.slice(reNode.test(options[0]) ? 2 : 0), function(value, index, options) {
if (/^(?:-o|--output)$/.test(options[index - 1]) || if (/^(?:-o|--output)$/.test(options[index - 1]) ||
/^modes=.*$/.test(value)) { /^modes=.*$/.test(value)) {
return true; return true;
@@ -125,9 +132,9 @@
return; return;
} }
var filePath = options[options.length - 1], var filePath = options[options.length - 1],
isMapped = options.indexOf('-p') > -1 || options.indexOf('--source-map') > -1, isMapped = _.contains(options, '-p') || _.contains(options, '--source-map'),
isSilent = options.indexOf('-s') > -1 || options.indexOf('--silent') > -1, isSilent = _.contains(options, '-s') || _.contains(options, '--silent'),
isTemplate = options.indexOf('-t') > -1 || options.indexOf('--template') > -1, isTemplate = _.contains(options, '-t') || _.contains(options, '--template'),
outputPath = path.join(path.dirname(filePath), path.basename(filePath, '.js') + '.min.js'); outputPath = path.join(path.dirname(filePath), path.basename(filePath, '.js') + '.min.js');
modes = options.reduce(function(result, value) { modes = options.reduce(function(result, value) {
@@ -138,7 +145,9 @@
outputPath = options.reduce(function(result, value, index) { outputPath = options.reduce(function(result, value, index) {
if (/-o|--output/.test(value)) { if (/-o|--output/.test(value)) {
result = options[index + 1]; result = options[index + 1];
result = path.join(fs.realpathSync(path.dirname(result)), path.basename(result)); var dirname = path.dirname(result);
mkdirpSync(dirname);
result = path.join(fs.realpathSync(dirname), path.basename(result));
} }
return result; return result;
}, outputPath); }, outputPath);
@@ -238,9 +247,9 @@
}; };
// begin the minification process // begin the minification process
if (modes.indexOf('simple') > -1) { if (_.contains(modes, 'simple')) {
closureCompile.call(this, source, 'simple', onClosureSimpleCompile.bind(this)); closureCompile.call(this, source, 'simple', onClosureSimpleCompile.bind(this));
} else if (modes.indexOf('advanced') > -1) { } else if (_.contains(modes, 'advanced')) {
onClosureSimpleGzip.call(this); onClosureSimpleGzip.call(this);
} else { } else {
onClosureAdvancedGzip.call(this); onClosureAdvancedGzip.call(this);
@@ -353,7 +362,7 @@
source = source.replace(license, ''); source = source.replace(license, '');
} }
var hasIIFE = /^;?\(function[^{]+{\s*/.test(source), var hasIIFE = /^;?\(function[^{]+{/.test(source),
isStrict = hasIIFE && /^;?\(function[^{]+{\s*["']use strict["']/.test(source); isStrict = hasIIFE && /^;?\(function[^{]+{\s*["']use strict["']/.test(source);
// to avoid stripping the IIFE, convert it to a function call // to avoid stripping the IIFE, convert it to a function call
@@ -446,6 +455,7 @@
toplevel.figure_out_scope(); toplevel.figure_out_scope();
toplevel = toplevel.transform(uglifyJS.Compressor({ toplevel = toplevel.transform(uglifyJS.Compressor({
'comparisons': false, 'comparisons': false,
'unsafe': true,
'unsafe_comps': true, 'unsafe_comps': true,
'warnings': false 'warnings': false
})); }));
@@ -514,7 +524,7 @@
this.compiled.simple.gzip = result; this.compiled.simple.gzip = result;
} }
// compile the source using advanced optimizations // compile the source using advanced optimizations
if (this.modes.indexOf('advanced') > -1) { if (_.contains(this.modes, 'advanced')) {
closureCompile.call(this, this.source, 'advanced', onClosureAdvancedCompile.bind(this)); closureCompile.call(this, this.source, 'advanced', onClosureAdvancedCompile.bind(this));
} else { } else {
onClosureAdvancedGzip.call(this); onClosureAdvancedGzip.call(this);
@@ -601,10 +611,10 @@
} }
// minify the already Closure Compiler simple optimized source using UglifyJS // minify the already Closure Compiler simple optimized source using UglifyJS
var modes = this.modes; var modes = this.modes;
if (modes.indexOf('hybrid') > -1) { if (_.contains(modes, 'hybrid')) {
if (modes.indexOf('simple') > -1) { if (_.contains(modes, 'simple')) {
uglify.call(this, this.compiled.simple.source, 'hybrid (simple)', onSimpleHybrid.bind(this)); uglify.call(this, this.compiled.simple.source, 'hybrid (simple)', onSimpleHybrid.bind(this));
} else if (modes.indexOf('advanced') > -1) { } else if (_.contains(modes, 'advanced')) {
onSimpleHybridGzip.call(this); onSimpleHybridGzip.call(this);
} }
} else { } else {
@@ -646,7 +656,7 @@
this.hybrid.simple.gzip = result; this.hybrid.simple.gzip = result;
} }
// minify the already Closure Compiler advance optimized source using UglifyJS // minify the already Closure Compiler advance optimized source using UglifyJS
if (this.modes.indexOf('advanced') > -1) { if (_.contains(this.modes, 'advanced')) {
uglify.call(this, this.compiled.advanced.source, 'hybrid (advanced)', onAdvancedHybrid.bind(this)); uglify.call(this, this.compiled.advanced.source, 'hybrid (advanced)', onAdvancedHybrid.bind(this));
} else { } else {
onComplete.call(this); onComplete.call(this);

43
build/mkdirp-sync.js Executable file
View File

@@ -0,0 +1,43 @@
#!/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

@@ -2,7 +2,7 @@
;(function() { ;(function() {
'use strict'; 'use strict';
/** The Node filesystem module */ /** The Node.js filesystem module */
var fs = require('fs'); var fs = require('fs');
/** The minimal license/copyright template */ /** The minimal license/copyright template */
@@ -30,7 +30,11 @@
// correct overly aggressive Closure Compiler advanced optimizations // correct overly aggressive Closure Compiler advanced optimizations
source = source source = source
.replace(/prototype\s*=\s*{\s*valueOf\s*:\s*1\s*}/, 'prototype={valueOf:1,y:1}') .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}+"")')
source = source.replace(/(\w+\.prototype\s*=\s*)\w+(?=\.prototype;)/, function(match, left) {
return left + /\w+(?=\.VERSION)/.exec(source);
});
// 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

@@ -2,7 +2,7 @@
;(function() { ;(function() {
'use strict'; 'use strict';
/** The Node filesystem module */ /** The Node.js filesystem module */
var fs = require('fs'); var fs = require('fs');
/** Used to minify variables embedded in compiled strings */ /** Used to minify variables embedded in compiled strings */
@@ -12,7 +12,6 @@
'argsLength', 'argsLength',
'callback', 'callback',
'collection', 'collection',
'createCallback',
'ctor', 'ctor',
'guard', 'guard',
'hasOwnProperty', 'hasOwnProperty',
@@ -22,7 +21,8 @@
'isString', 'isString',
'iterable', 'iterable',
'length', 'length',
'nativeKeys', 'keys',
'lodash',
'object', 'object',
'objectTypes', 'objectTypes',
'ownIndex', 'ownIndex',
@@ -33,21 +33,18 @@
'thisArg' 'thisArg'
]; ];
/** Used to minify `compileIterator` option properties */ /** Used to minify `iteratorTemplate` data properties */
var iteratorOptions = [ var iteratorOptions = [
'args', 'args',
'arrays', 'arrays',
'bottom', 'bottom',
'firstArg', 'firstArg',
'hasDontEnumBug', 'init',
'hasEnumPrototype',
'isKeysFast',
'loop', 'loop',
'nonEnumArgs', 'shadowedProps',
'noCharByIndex',
'shadowed',
'top', 'top',
'useHas' 'useHas',
'useKeys'
]; ];
/** Used to minify variables and string values to a single character */ /** Used to minify variables and string values to a single character */
@@ -58,12 +55,25 @@
/** Used to protect the specified properties from getting minified */ /** Used to protect the specified properties from getting minified */
var propWhitelist = [ var propWhitelist = [
'Array',
'Boolean',
'Date',
'Function',
'Math',
'Number',
'Object',
'RegExp',
'String',
'TypeError',
'VERSION',
'_', '_',
'__wrapped__', '__wrapped__',
'after', 'after',
'all', 'all',
'amd', 'amd',
'any', 'any',
'argsClass',
'argsObject',
'assign', 'assign',
'at', 'at',
'attachEvent', 'attachEvent',
@@ -78,6 +88,7 @@
'compose', 'compose',
'contains', 'contains',
'countBy', 'countBy',
'createCallback',
'criteria', 'criteria',
'debounce', 'debounce',
'defaults', 'defaults',
@@ -87,14 +98,19 @@
'difference', 'difference',
'drop', 'drop',
'each', 'each',
'enumPrototypes',
'environment', 'environment',
'escape', 'escape',
'evaluate', 'evaluate',
'every', 'every',
'exports', 'exports',
'extend', 'extend',
'fastBind',
'fastKeys',
'filter', 'filter',
'find', 'find',
'findIndex',
'findKey',
'first', 'first',
'flatten', 'flatten',
'foldl', 'foldl',
@@ -107,8 +123,8 @@
'groupBy', 'groupBy',
'has', 'has',
'head', 'head',
'imports',
'identity', 'identity',
'imports',
'include', 'include',
'index', 'index',
'indexOf', 'indexOf',
@@ -148,11 +164,15 @@
'min', 'min',
'mixin', 'mixin',
'noConflict', 'noConflict',
'nodeClass',
'nonEnumArgs',
'nonEnumShadows',
'object', 'object',
'omit', 'omit',
'once', 'once',
'opera', 'ownLast',
'pairs', 'pairs',
'parseInt',
'partial', 'partial',
'partialRight', 'partialRight',
'pick', 'pick',
@@ -164,6 +184,7 @@
'reject', 'reject',
'rest', 'rest',
'result', 'result',
'runInContext',
'select', 'select',
'setImmediate', 'setImmediate',
'setTimeout', 'setTimeout',
@@ -173,6 +194,8 @@
'sortBy', 'sortBy',
'sortedIndex', 'sortedIndex',
'source', 'source',
'spliceObjects',
'support',
'tail', 'tail',
'take', 'take',
'tap', 'tap',
@@ -182,6 +205,7 @@
'times', 'times',
'toArray', 'toArray',
'unescape', 'unescape',
'unindexedChars',
'union', 'union',
'uniq', 'uniq',
'unique', 'unique',
@@ -189,11 +213,11 @@
'value', 'value',
'values', 'values',
'variable', 'variable',
'VERSION',
'where', 'where',
'without', 'without',
'wrap', 'wrap',
'zip', 'zip',
'zipObject',
// properties used by the `backbone` and `underscore` builds // properties used by the `backbone` and `underscore` builds
'__chain__', '__chain__',
@@ -226,7 +250,13 @@
return "['" + prop.replace(/['\n\r\t]/g, '\\$&') + "']"; return "['" + prop.replace(/['\n\r\t]/g, '\\$&') + "']";
}); });
// remove brackets from `_.escape()` in `_.template` // remove brackets from `lodash.createCallback` in `eachIteratorOptions`
source = source.replace('lodash[\'createCallback\'](callback, thisArg)"', 'lodash.createCallback(callback, thisArg)"');
// remove brackets from `lodash.createCallback` in `_.assign`
source = source.replace("' var callback = lodash['createCallback']", "'var callback=lodash.createCallback");
// remove brackets from `_.escape` in `_.template`
source = source.replace(/__e *= *_\['escape']/g, '__e=_.escape'); source = source.replace(/__e *= *_\['escape']/g, '__e=_.escape');
// remove brackets from `collection.indexOf` in `_.contains` // remove brackets from `collection.indexOf` in `_.contains`
@@ -236,17 +266,17 @@
source = source.replace("result[length]['value']", 'result[length].value'); source = source.replace("result[length]['value']", 'result[length].value');
// remove whitespace from string literals // remove whitespace from string literals
source = source.replace(/^([ "'\w]+:)? *"[^"\\\n]*(?:\\.[^"\\\n]*)*"|'[^'\\\n]*(?:\\.[^'\\\n]*)*'/gm, function(string, captured) { source = source.replace(/^((?:[ "'\w]+:)? *)"[^"\\\n]*(?:\\.[^"\\\n]*)*"|'[^'\\\n]*(?:\\.[^'\\\n]*)*'/gm, function(string, left) {
// remove object literal property name // clip after an object literal property name or leading spaces
if (/:$/.test(captured)) { if (left) {
string = string.slice(captured.length); string = string.slice(left.length);
} }
// avoids removing the '\n' of the `stringEscapes` object // avoids removing the '\n' of the `stringEscapes` object
string = string.replace(/\[object |delete |else (?!{)|function | in |return\s+[\w"']|throw |typeof |use strict|var |@ |(["'])\\n\1|\\\\n|\\n|\s+/g, function(match) { string = string.replace(/\[object |delete |else (?!{)|function | in |return\s+[\w"']|throw |typeof |use strict|var |@ |(["'])\\n\1|\\\\n|\\n|\s+/g, function(match) {
return match == false || match == '\\n' ? '' : match; return match == false || match == '\\n' ? '' : match;
}); });
// prepend object literal property name // unclip
return (captured || '') + string; return (left || '') + string;
}); });
// remove whitespace from `_.template` related regexes // remove whitespace from `_.template` related regexes
@@ -287,7 +317,9 @@
}); });
// replace with modified snippet // replace with modified snippet
source = source.replace(snippet, modified); source = source.replace(snippet, function() {
return modified;
});
}); });
}()); }());
@@ -297,7 +329,7 @@
// match the `iteratorTemplate` // match the `iteratorTemplate`
'( +)var iteratorTemplate\\b[\\s\\S]+?\\n\\1}', '( +)var iteratorTemplate\\b[\\s\\S]+?\\n\\1}',
// match methods created by `createIterator` calls // match methods created by `createIterator` calls
'createIterator\\((?:{|[a-zA-Z]+)[\\s\\S]+?\\);\\n', 'createIterator\\((?:{|[a-zA-Z]+)[\\s\\S]*?\\);\\n',
// match variables storing `createIterator` options // match variables storing `createIterator` options
'( +)var [a-zA-Z]+IteratorOptions\\b[\\s\\S]+?\\n\\2}', '( +)var [a-zA-Z]+IteratorOptions\\b[\\s\\S]+?\\n\\2}',
// match the the `createIterator` function // match the the `createIterator` function
@@ -320,11 +352,6 @@
return "['" + prop.replace(/['\n\r\t]/g, '\\$&') + "']"; return "['" + prop.replace(/['\n\r\t]/g, '\\$&') + "']";
}); });
if (isCreateIterator) {
// clip before the `factory` call to avoid minifying its arguments
source = source.replace(snippet, modified);
snippet = modified = modified.replace(/return factory\([\s\S]+$/, '');
}
// minify `createIterator` option property names // minify `createIterator` option property names
iteratorOptions.forEach(function(property, index) { iteratorOptions.forEach(function(property, index) {
var minName = minNames[index]; var minName = minNames[index];
@@ -336,20 +363,27 @@
}); });
// minify snippet variables / arguments // minify snippet variables / arguments
compiledVars.forEach(function(variable, index) { compiledVars.forEach(function(varName, index) {
var minName = minNames[index]; var minName = minNames[index];
// minify variable names present in strings
if (isCreateIterator) {
modified = modified.replace(RegExp('(([\'"])[^\\n\\2]*?)\\b' + varName + '\\b(?=[^\\n\\2]*\\2[ ,+]+$)', 'gm'), '$1' + minName);
}
// ensure properties in compiled strings aren't minified // ensure properties in compiled strings aren't minified
modified = modified.replace(RegExp('([^.]\\b)' + variable + '\\b(?!\' *[\\]:])', 'g'), '$1' + minName); else {
modified = modified.replace(RegExp('([^.])\\b' + varName + '\\b(?!\' *[\\]:])', 'g'), '$1' + minName);
}
// correct `typeof` values // correct `typeof` values
if (/^(?:boolean|function|object|number|string|undefined)$/.test(variable)) { if (/^(?:boolean|function|object|number|string|undefined)$/.test(varName)) {
modified = modified.replace(RegExp("(typeof [^']+')" + minName + "'", 'g'), '$1' + variable + "'"); modified = modified.replace(RegExp("(typeof [^']+')" + minName + "'", 'g'), '$1' + varName + "'");
} }
}); });
// replace with modified snippet // replace with modified snippet
source = source.replace(snippet, modified); source = source.replace(snippet, function() {
return modified;
});
}); });
return source; return source;

10078
dist/lodash.compat.js vendored

File diff suppressed because it is too large Load Diff

View File

@@ -1,42 +1,46 @@
/** /**
* @license * @license
* Lo-Dash 1.0.1 (Custom Build) lodash.com/license * Lo-Dash 1.1.0 (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,t){function r(n){return n&&typeof n=="object"&&n.__wrapped__?n:this instanceof r?(this.__wrapped__=n,void 0):new r(n)}function e(n,t,r){t||(t=0);var e=n.length,u=e-t>=(r||at);if(u){var o={};for(r=t-1;++r<e;){var i=n[r]+"";(St.call(o,i)?o[i]:o[i]=[]).push(n[r])}}return function(r){if(u){var e=r+"";return St.call(o,e)&&-1<z(o[e],r)}return-1<z(n,r,t)}}function u(n){return n.charCodeAt(0)}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 ;(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
}return r<e?-1:1}function i(n,t,r,e){function u(){var a=arguments,c=i?this:t;return o||(n=t[f]),r.length&&(a=a.length?(a=v(a),e?a.concat(r):r.concat(a)):r),this instanceof u?(s.prototype=n.prototype,c=new s,s.prototype=W,a=n.apply(c,a),x(a)?a:c):n.apply(c,a)}var o=w(n),i=!r,f=t;return i&&(r=t),o||(t=n),u}function f(n,t,r){if(n==W)return G;var e=typeof n;if("function"!=e){if("object"!=e)return function(t){return t[n]};var u=vr(n);return function(t){for(var r=u.length,e=X;r--&&(e=j(t[u[r]],n[u[r]],ft)););return e }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 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 a(){for(var n,t={e:tt,f:rt,g:Jt,i:Wt,j:Zt,k:jt,b:"l(n)",c:"",h:"",l:"",m:Q},r=0;n=arguments[r];r++)for(var e in n)t[e]=n[e];if(n=t.a,t.d=/^[^,]+/.exec(n)[0],r="var j,n="+t.d+",u=n;if(!n)return u;"+t.l+";",t.b?(r+="var o=n.length;j=-1;if("+t.b+"){",t.j&&(r+="if(m(n)){n=n.split('')}"),r+="while(++j<o){"+t.h+"}}else{"):t.i&&(r+="var o=n.length;j=-1;if(o&&k(n)){while(++j<o){j+='';"+t.h+"}}else{"),t.f&&(r+="var v=typeof n=='function';"),t.g&&t.m?(r+="var s=-1,t=r[typeof n]?p(n):[],o=t.length;while(++s<o){j=t[s];",t.f&&(r+="if(!(v&&j=='prototype')){"),r+=t.h+"",t.f&&(r+="}")):(r+="for(j in n){",(t.f||t.m)&&(r+="if(",t.f&&(r+="!(v&&j=='prototype')"),t.f&&t.m&&(r+="&&"),t.m&&(r+="i.call(n,j)"),r+="){"),r+=t.h+";",(t.f||t.m)&&(r+="}")),r+="}",t.e)for(r+="var g=n.constructor;",e=0;7>e;e++)r+="j='"+t.k[e]+"';if(","constructor"==t.k[e]&&(r+="!(g&&g.prototype===n)&&"),r+="i.call(n,j)){"+t.h+"}"; 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)
return(t.b||t.i)&&(r+="}"),r+=t.c+";return u",Function("f,i,k,l,m,r,p","return function("+n+"){"+r+"}")(f,St,y,sr,A,ur,Ft)}function c(n){return"\\"+or[n]}function l(n){return gr[n]}function p(n){return typeof n.toString!="function"&&typeof(n+"")=="string"}function s(){}function v(n,t,r){t||(t=0),typeof r=="undefined"&&(r=n?n.length:0);var e=-1;r=r-t||0;for(var u=Array(0>r?0:r);++e<r;)u[e]=n[t+e];return u}function g(n){return yr[n]}function y(n){return kt.call(n)==Bt}function h(n){var t=X;if(!n||typeof n!="object"||y(n))return t; }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);
var r=n.constructor;return!w(r)&&(!nr||!p(n))||r instanceof r?et?(lr(n,function(n,r,e){return t=!St.call(e,r),X}),t===X):(lr(n,function(n,r){t=r}),t===X||St.call(n,t)):t}function m(n){var t=[];return pr(n,function(n,r){t.push(r)}),t}function d(n,r,e,u,o,i){var a=n;if(typeof r=="function"&&(u=e,e=r,r=X),typeof e=="function"){e=typeof u=="undefined"?e:f(e,u,1);var a=e(a),c=typeof a!="undefined";c||(a=n)}if(u=x(a)){var l=kt.call(a);if(!rr[l]||nr&&p(a))return a;var s=sr(a)}if(!u||!r)return u&&!c?s?v(a):hr({},a):a; 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);
switch(u=er[l],l){case Pt:case zt:return c?a:new u(+a);case Ct:case Ut:return c?a:new u(a);case Lt:return c?a:u(a.source,gt.exec(a))}for(o||(o=[]),i||(i=[]),l=o.length;l--;)if(o[l]==n)return i[l];return c||(a=s?u(a.length):{},s&&(St.call(n,"index")&&(a.index=n.index),St.call(n,"input")&&(a.input=n.input))),o.push(n),i.push(a),(s?$:pr)(c?a:n,function(n,u){a[u]=d(n,r,e,t,o,i)}),a}function _(n){var t=[];return lr(n,function(n,r){w(n)&&t.push(r)}),t.sort()}function b(n){for(var t=-1,r=vr(n),e=r.length,u={};++t<e;){var o=r[t]; 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);
u[n[o]]=o}return u}function j(n,t,r,e,u,o){var i=r===ft;if(r&&!i){r=typeof e=="undefined"?r:f(r,e,2);var a=r(n,t);if(typeof a!="undefined")return!!a}if(n===t)return 0!==n||1/n==1/t;var c=typeof n,l=typeof t;if(n===n&&(!n||"function"!=c&&"object"!=c)&&(!t||"function"!=l&&"object"!=l))return X;if(n==W||t==W)return n===t;if(l=kt.call(n),c=kt.call(t),l==Bt&&(l=Kt),c==Bt&&(c=Kt),l!=c)return X;switch(l){case Pt:case zt:return+n==+t;case Ct:return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case Lt:case Ut:return n==t+"" 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);
}if(c=l==Mt,!c){if(n.__wrapped__||t.__wrapped__)return j(n.__wrapped__||n,t.__wrapped__||t,r,e,u,o);if(l!=Kt||nr&&(p(n)||p(t)))return X;var l=!Xt&&y(n)?Object:n.constructor,s=!Xt&&y(t)?Object:t.constructor;if(l!=s&&(!w(l)||!(l instanceof l&&w(s)&&s instanceof s)))return X}for(u||(u=[]),o||(o=[]),l=u.length;l--;)if(u[l]==n)return o[l]==t;var v=0,a=Q;if(u.push(n),o.push(t),c){if(l=n.length,v=t.length,a=v==n.length,!a&&!i)return a;for(;v--;)if(c=l,s=t[v],i)for(;c--&&!(a=j(n[c],s,r,e,u,o)););else if(!(a=j(n[v],s,r,e,u,o)))break; 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
return a}return lr(t,function(t,i,f){return St.call(f,i)?(v++,a=St.call(n,i)&&j(n[i],t,r,e,u,o)):void 0}),a&&!i&&lr(n,function(n,t,r){return St.call(r,t)?a=-1<--v:void 0}),a}function w(n){return typeof n=="function"}function x(n){return n?ur[typeof n]:X}function O(n){return typeof n=="number"||kt.call(n)==Ct}function A(n){return typeof n=="string"||kt.call(n)==Ut}function S(n,t,r){var e=arguments,u=0,o=2;if(!x(n))return n;if(r===ft)var i=e[3],a=e[4],c=e[5];else a=[],c=[],typeof r!="number"&&(o=e.length),3<o&&"function"==typeof e[o-2]?i=f(e[--o-1],e[o--],2):2<o&&"function"==typeof e[o-1]&&(i=e[--o]); }),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]);
for(;++u<o;)(sr(e[u])?$:pr)(e[u],function(t,r){var e,u,o=t,f=n[r];if(t&&((u=sr(t))||dr(t))){for(o=a.length;o--;)if(e=a[o]==t){f=c[o];break}e||(f=u?sr(f)?f:[]:dr(f)?f:{},i&&(o=i(f,t),typeof o!="undefined"&&(f=o)),a.push(t),c.push(f),i||(f=S(f,t,ft,i,a,c)))}else i&&(o=i(f,t),typeof o=="undefined"&&(o=t)),typeof o!="undefined"&&(f=o);n[r]=f});return n}function E(n){for(var t=-1,r=vr(n),e=r.length,u=Array(e);++t<e;)u[t]=n[r[t]];return u}function k(n,t,r){var e=-1,u=n?n.length:0,o=X;return r=(0>r?qt(0,u+r):r)||0,typeof u=="number"?o=-1<(A(n)?n.indexOf(t,r):z(n,t,r)):cr(n,function(n){return++e<r?void 0:!(o=n===t) 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)
}),o}function I(n,t,r){var e=Q;if(t=f(t,r),sr(n)){r=-1;for(var u=n.length;++r<u&&(e=!!t(n[r],r,n)););}else cr(n,function(n,r,u){return e=!!t(n,r,u)});return e}function N(n,t,r){var e=[];if(t=f(t,r),sr(n)){r=-1;for(var u=n.length;++r<u;){var o=n[r];t(o,r,n)&&e.push(o)}}else cr(n,function(n,r,u){t(n,r,u)&&e.push(n)});return e}function R(n,t,r){var e;return t=f(t,r),$(n,function(n,r,u){return t(n,r,u)?(e=n,X):void 0}),e}function $(n,t,r){if(t&&typeof r=="undefined"&&sr(n)){r=-1;for(var e=n.length;++r<e&&t(n[r],r,n)!==X;);}else cr(n,t,r); }),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];
return n}function F(n,t,r){var e=-1,u=n?n.length:0,o=Array(typeof u=="number"?u:0);if(t=f(t,r),sr(n))for(;++e<u;)o[e]=t(n[e],e,n);else cr(n,function(n,r,u){o[++e]=t(n,r,u)});return o}function q(n,t,r){var e=-1/0,o=e;if(!t&&sr(n)){r=-1;for(var i=n.length;++r<i;){var a=n[r];a>o&&(o=a)}}else t=!t&&A(n)?u:f(t,r),cr(n,function(n,r,u){r=t(n,r,u),r>e&&(e=r,o=n)});return o}function D(n,t,r,e){var u=3>arguments.length;if(t=f(t,e,4),sr(n)){var o=-1,i=n.length;for(u&&(r=n[++o]);++o<i;)r=t(r,n[o],o,n)}else cr(n,function(n,e,o){r=u?(u=X,n):t(r,n,e,o) 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)
});return r}function T(n,t,r,e){var u=n,o=n?n.length:0,i=3>arguments.length;if(typeof o!="number")var a=vr(n),o=a.length;else Zt&&A(n)&&(u=n.split(""));return t=f(t,e,4),$(n,function(n,e,f){e=a?a[--o]:--o,r=i?(i=X,u[e]):t(r,u[e],e,f)}),r}function B(n,t,r){var e;if(t=f(t,r),sr(n)){r=-1;for(var u=n.length;++r<u&&!(e=t(n[r],r,n)););}else cr(n,function(n,r,u){return!(e=t(n,r,u))});return!!e}function M(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&t!=W){var o=-1;for(t=f(t,r);++o<u&&t(n[o],o,n);)e++ });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;
}else if(e=t,e==W||r)return n[0];return v(n,0,Dt(qt(0,e),u))}}function P(n,t){for(var r=-1,e=n?n.length:0,u=[];++r<e;){var o=n[r];sr(o)?Et.apply(u,t?o:P(o)):u.push(o)}return u}function z(n,t,r){var e=-1,u=n?n.length:0;if(typeof r=="number")e=(0>r?qt(0,u+r):r||0)-1;else if(r)return e=K(n,t),n[e]===t?e:-1;for(;++e<u;)if(n[e]===t)return e;return-1}function C(n,t,r){if(typeof t!="number"&&t!=W){var e=0,u=-1,o=n?n.length:0;for(t=f(t,r);++u<o&&t(n[u],u,n);)e++}else e=t==W||r?1:qt(0,t);return v(n,e)}function K(n,t,r,e){var u=0,o=n?n.length:u; 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);
for(r=r?f(r,e,1):G,t=r(t);u<o;)e=u+o>>>1,r(n[e])<t?u=e+1:o=e;return u}function L(n,t,r,e){var u=-1,o=n?n.length:0,i=[],a=i;typeof t=="function"&&(e=r,r=t,t=X);var c=!t&&75<=o;if(c)var l={};for(r&&(a=[],r=f(r,e));++u<o;){e=n[u];var p=r?r(e,u,n):e;if(c)var s=p+"",s=St.call(l,s)?!(a=l[s]):a=l[s]=[];(t?!u||a[a.length-1]!==p:s||0>z(a,p))&&((r||c)&&a.push(p),i.push(e))}return i}function U(n,t){return Ht||It&&2<arguments.length?It.call.apply(It,arguments):i(n,t,v(arguments,2))}function V(n){var r=v(arguments,1); 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;
return setTimeout(function(){n.apply(t,r)},1)}function G(n){return n}function H(n){$(_(n),function(t){var e=r[t]=n[t];r.prototype[t]=function(){var n=[this.__wrapped__];return Et.apply(n,arguments),new r(e.apply(r,n))}})}function J(){return this.__wrapped__}var Q=!0,W=null,X=!1,Y=typeof exports=="object"&&exports,Z=typeof module=="object"&&module&&module.exports==Y&&module,nt=typeof global=="object"&&global;nt.global===nt&&(n=nt);var tt,rt,et,ut=[],ot={},it=0,ft=ot,at=30,ct=n._,lt=/&(?:amp|lt|gt|quot|#39);/g,pt=/\b__p\+='';/g,st=/\b(__p\+=)''\+/g,vt=/(__e\(.*?\)|\b__t\))\+'';/g,gt=/\w*$/,yt=RegExp("^"+(ot.valueOf+"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),ht=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,mt=/<%=([\s\S]+?)%>/g,dt=/($^)/,_t=/[&<>"']/g,bt=/['\n\r\t\u2028\u2029\\]/g,jt="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),wt=Math.ceil,xt=ut.concat,Ot=Math.floor,At=yt.test(At=Object.getPrototypeOf)&&At,St=ot.hasOwnProperty,Et=ut.push,kt=ot.toString,It=yt.test(It=v.bind)&&It,Nt=yt.test(Nt=Array.isArray)&&Nt,Rt=n.isFinite,$t=n.isNaN,Ft=yt.test(Ft=Object.keys)&&Ft,qt=Math.max,Dt=Math.min,Tt=Math.random,Bt="[object Arguments]",Mt="[object Array]",Pt="[object Boolean]",zt="[object Date]",Ct="[object Number]",Kt="[object Object]",Lt="[object RegExp]",Ut="[object String]",Vt=!!n.attachEvent,Gt=It&&!/\n|true/.test(It+Vt),Ht=It&&!Gt,Jt=Ft&&(Vt||Gt),Qt=(Qt={0:1,length:1},ut.splice.call(Qt,0,1),Qt[0]),Wt=Q; 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(){function n(){this.x=1}var t=[];n.prototype={valueOf:1,y:1};for(var r in new n)t.push(r);for(r in arguments)Wt=!r;tt=!/valueOf/.test(t),rt=n.propertyIsEnumerable("prototype"),et="x"!=t[0]})(1);var Xt=arguments.constructor==Object,Yt=!y(arguments),Zt="xx"!="x"[0]+Object("x")[0];try{var nr=kt.call(document)==Kt&&!({toString:0}+"")}catch(tr){}var rr={"[object Function]":X};rr[Bt]=rr[Mt]=rr[Pt]=rr[zt]=rr[Ct]=rr[Kt]=rr[Lt]=rr[Ut]=Q;var er={};er[Mt]=Array,er[Pt]=Boolean,er[zt]=Date,er[Kt]=Object,er[Ct]=Number,er[Lt]=RegExp,er[Ut]=String; 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={};
var ur={"boolean":X,"function":Q,object:Q,number:X,string:X,undefined:X},or={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"};r.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:mt,variable:"",imports:{_:r}};var ir={a:"q,w,h",l:"var a=arguments,b=0,c=typeof h=='number'?2:a.length;while(++b<c){n=a[b];if(n&&r[typeof n]){",h:"if(typeof u[j]=='undefined')u[j]=n[j]",c:"}}"},fr={a:"e,d,x",l:"d=d&&typeof x=='undefined'?d:f(d,x)",b:"typeof o=='number'",h:"if(d(n[j],j,e)===false)return u"},ar={l:"if(!r[typeof n])return u;"+fr.l,b:X},cr=a(fr); 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];
Yt&&(y=function(n){return n?St.call(n,"callee"):X});var lr=a(fr,ar,{m:X}),pr=a(fr,ar),sr=Nt||function(n){return Xt&&n instanceof Array||kt.call(n)==Mt},vr=Ft?function(n){return x(n)?rt&&typeof n=="function"||Wt&&n.length&&y(n)?m(n):Ft(n):[]}:m,gr={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},yr=b(gr),hr=a(ir,{l:ir.l.replace(";",";if(c>3&&typeof a[c-2]=='function'){var d=f(a[--c-1],a[c--],2);}else if(c>2&&typeof a[c-1]=='function'){d=a[--c];}"),h:"u[j]=d?d(u[j],n[j]):n[j]"}),mr=a(ir); 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
w(/x/)&&(w=function(n){return n instanceof Function||"[object Function]"==kt.call(n)});var dr=At?function(n){if(!n||typeof n!="object")return X;var t=n.valueOf,r=typeof t=="function"&&(r=At(t))&&At(r);return r?n==r||At(n)==r&&!y(n):h(n)}:h,_r=F,br=N;Gt&&Z&&typeof setImmediate=="function"&&(V=U(setImmediate,n)),r.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},r.assign=hr,r.at=function(n){var t=-1,r=xt.apply(ut,v(arguments,1)),e=r.length,u=Array(e);for(Zt&&A(n)&&(n=n.split(""));++t<e;)u[t]=n[r[t]]; });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);
return u},r.bind=U,r.bindAll=function(n){for(var t=xt.apply(ut,arguments),r=1<t.length?0:(t=_(n),-1),e=t.length;++r<e;){var u=t[r];n[u]=U(n[u],n)}return n},r.bindKey=function(n,t){return i(n,t,v(arguments,2))},r.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},r.compose=function(){var n=arguments;return function(){for(var t=arguments,r=n.length;r--;)t=[n[r].apply(this,t)];return t[0]}},r.countBy=function(n,t,r){var e={};return t=f(t,r),$(n,function(n,r,u){r=t(n,r,u)+"",St.call(e,r)?e[r]++:e[r]=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);
}),e},r.debounce=function(n,t,r){function e(){f=W,r||(o=n.apply(i,u))}var u,o,i,f;return function(){var a=r&&!f;return u=arguments,i=this,clearTimeout(f),f=setTimeout(e,t),a&&(o=n.apply(i,u)),o}},r.defaults=mr,r.defer=V,r.delay=function(n,r){var e=v(arguments,2);return setTimeout(function(){n.apply(t,e)},r)},r.difference=function(n){for(var t=-1,r=n?n.length:0,u=xt.apply(ut,arguments),u=e(u,r),o=[];++t<r;){var i=n[t];u(i)||o.push(i)}return o},r.filter=N,r.flatten=P,r.forEach=$,r.forIn=lr,r.forOwn=pr,r.functions=_,r.groupBy=function(n,t,r){var e={}; 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]
return t=f(t,r),$(n,function(n,r,u){r=t(n,r,u)+"",(St.call(e,r)?e[r]:e[r]=[]).push(n)}),e},r.initial=function(n,t,r){if(!n)return[];var e=0,u=n.length;if(typeof t!="number"&&t!=W){var o=u;for(t=f(t,r);o--&&t(n[o],o,n);)e++}else e=t==W||r?1:t||e;return v(n,0,Dt(qt(0,u-e),u))},r.intersection=function(n){var t=arguments,r=t.length,u={0:{}},o=-1,i=n?n.length:0,f=100<=i,a=[],c=a;n:for(;++o<i;){var l=n[o];if(f)var p=l+"",p=St.call(u[0],p)?!(c=u[0][p]):c=u[0][p]=[];if(p||0>z(c,l)){f&&c.push(l);for(var s=r;--s;)if(!(u[s]||(u[s]=e(t[s],0,100)))(l))continue n; }},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)
a.push(l)}}return a},r.invert=b,r.invoke=function(n,t){var r=v(arguments,2),e=-1,u=typeof t=="function",o=n?n.length:0,i=Array(typeof o=="number"?o:0);return $(n,function(n){i[++e]=(u?t:n[t]).apply(n,r)}),i},r.keys=vr,r.map=F,r.max=q,r.memoize=function(n,t){var r={};return function(){var e=(t?t.apply(this,arguments):arguments[0])+"";return St.call(r,e)?r[e]:r[e]=n.apply(this,arguments)}},r.merge=S,r.min=function(n,t,r){var e=1/0,o=e;if(!t&&sr(n)){r=-1;for(var i=n.length;++r<i;){var a=n[r];a<o&&(o=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,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={};
}}else t=!t&&A(n)?u:f(t,r),cr(n,function(n,r,u){r=t(n,r,u),r<e&&(e=r,o=n)});return o},r.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},r.omit=function(n,t,r){var e=typeof t=="function",u={};if(e)t=f(t,r);else var o=xt.apply(ut,arguments);return lr(n,function(n,r,i){(e?!t(n,r,i):0>z(o,r,1))&&(u[r]=n)}),u},r.once=function(n){var t,r;return function(){return t?r:(t=Q,r=n.apply(this,arguments),n=W,r)}},r.pairs=function(n){for(var t=-1,r=vr(n),e=r.length,u=Array(e);++t<e;){var o=r[t]; 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]=[];
u[t]=[o,n[o]]}return u},r.partial=function(n){return i(n,v(arguments,1))},r.partialRight=function(n){return i(n,v(arguments,1),W,ft)},r.pick=function(n,t,r){var e={};if(typeof t!="function")for(var u=0,o=xt.apply(ut,arguments),i=x(n)?o.length:0;++u<i;){var a=o[u];a in n&&(e[a]=n[a])}else t=f(t,r),lr(n,function(n,r,u){t(n,r,u)&&(e[r]=n)});return e},r.pluck=_r,r.range=function(n,t,r){n=+n||0,r=+r||1,t==W&&(t=n,n=0);var e=-1;t=qt(0,wt((t-n)/r));for(var u=Array(t);++e<t;)u[e]=n,n+=r;return u},r.reject=function(n,t,r){return t=f(t,r),N(n,function(n,r,e){return!t(n,r,e) 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;
})},r.rest=C,r.shuffle=function(n){var t=-1,r=n?n.length:0,e=Array(typeof r=="number"?r:0);return $(n,function(n){var r=Ot(Tt()*(++t+1));e[t]=e[r],e[r]=n}),e},r.sortBy=function(n,t,r){var e=-1,u=n?n.length:0,i=Array(typeof u=="number"?u:0);for(t=f(t,r),$(n,function(n,r,u){i[++e]={a:t(n,r,u),b:e,c:n}}),u=i.length,i.sort(o);u--;)i[u]=i[u].c;return i},r.tap=function(n,t){return t(n),n},r.throttle=function(n,t){function r(){f=new Date,i=W,u=n.apply(o,e)}var e,u,o,i,f=0;return function(){var a=new Date,c=t-(a-f); 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];
return e=arguments,o=this,0<c?i||(i=setTimeout(r,c)):(clearTimeout(i),i=W,f=a,u=n.apply(o,e)),u}},r.times=function(n,t,r){n=+n||0;for(var e=-1,u=Array(n);++e<n;)u[e]=t.call(r,e);return u},r.toArray=function(n){return n&&typeof n.length=="number"?Zt&&A(n)?n.split(""):v(n):E(n)},r.union=function(){return L(xt.apply(ut,arguments))},r.uniq=L,r.values=E,r.where=br,r.without=function(n){for(var t=-1,r=n?n.length:0,u=e(arguments,1),o=[];++t<r;){var i=n[t];u(i)||o.push(i)}return o},r.wrap=function(n,t){return function(){var r=[n]; 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;
return Et.apply(r,arguments),t.apply(this,r)}},r.zip=function(n){for(var t=-1,r=n?q(_r(arguments,"length")):0,e=Array(r);++t<r;)e[t]=_r(arguments,t);return e},r.collect=F,r.drop=C,r.each=$,r.extend=hr,r.methods=_,r.select=N,r.tail=C,r.unique=L,H(r),r.clone=d,r.cloneDeep=function(n,t,r){return d(n,Q,t,r)},r.contains=k,r.escape=function(n){return n==W?"":(n+"").replace(_t,l)},r.every=I,r.find=R,r.has=function(n,t){return n?St.call(n,t):X},r.identity=G,r.indexOf=z,r.isArguments=y,r.isArray=sr,r.isBoolean=function(n){return n===Q||n===X||kt.call(n)==Pt 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)
},r.isDate=function(n){return n instanceof Date||kt.call(n)==zt},r.isElement=function(n){return n?1===n.nodeType:X},r.isEmpty=function(n){var t=Q;if(!n)return t;var r=kt.call(n),e=n.length;return r==Mt||r==Ut||r==Bt||Yt&&y(n)||r==Kt&&typeof e=="number"&&w(n.splice)?!e:(pr(n,function(){return t=X}),t)},r.isEqual=j,r.isFinite=function(n){return Rt(n)&&!$t(parseFloat(n))},r.isFunction=w,r.isNaN=function(n){return O(n)&&n!=+n},r.isNull=function(n){return n===W},r.isNumber=O,r.isObject=x,r.isPlainObject=dr,r.isRegExp=function(n){return n instanceof RegExp||kt.call(n)==Lt }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];
},r.isString=A,r.isUndefined=function(n){return typeof n=="undefined"},r.lastIndexOf=function(n,t,r){var e=n?n.length:0;for(typeof r=="number"&&(e=(0>r?qt(0,e+r):Dt(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},r.mixin=H,r.noConflict=function(){return n._=ct,this},r.random=function(n,t){return n==W&&t==W&&(t=1),n=+n||0,t==W&&(t=n,n=0),n+Ot(Tt()*((+t||0)-n+1))},r.reduce=D,r.reduceRight=T,r.result=function(n,r){var e=n?n[r]:t;return w(e)?n[r]():e},r.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:vr(n).length 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;
},r.some=B,r.sortedIndex=K,r.template=function(n,e,u){var o=r.templateSettings;n||(n=""),u=mr({},u,o);var i,f=mr({},u.imports,o.imports),o=vr(f),f=E(f),a=0,l=u.interpolate||dt,p="__p+='";n.replace(RegExp((u.escape||dt).source+"|"+l.source+"|"+(l===mt?ht:dt).source+"|"+(u.evaluate||dt).source+"|$","g"),function(t,r,e,u,o,f){return e||(e=u),p+=n.slice(a,f).replace(bt,c),r&&(p+="'+__e("+r+")+'"),o&&(i=Q,p+="';"+o+";__p+='"),e&&(p+="'+((__t=("+e+"))==null?'':__t)+'"),a=f+t.length,t}),p+="';\n",l=u=u.variable,l||(u="obj",p="with("+u+"){"+p+"}"),p=(i?p.replace(pt,""):p).replace(st,"$1").replace(vt,"$1;"),p="function("+u+"){"+(l?"":u+"||("+u+"={});")+"var __t,__p='',__e=_.escape"+(i?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+p+"return __p}"; 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;
try{var s=Function(o,"return "+p).apply(t,f)}catch(v){throw v.source=p,v}return e?s(e):(s.source=p,s)},r.unescape=function(n){return n==W?"":(n+"").replace(lt,g)},r.uniqueId=function(n){var t=++it;return(n==W?"":n+"")+t},r.all=I,r.any=B,r.detect=R,r.foldl=D,r.foldr=T,r.include=k,r.inject=D,pr(r,function(n,t){r.prototype[t]||(r.prototype[t]=function(){var t=[this.__wrapped__];return Et.apply(t,arguments),n.apply(r,t)})}),r.first=M,r.last=function(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&t!=W){var o=u; 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;
for(t=f(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,e==W||r)return n[u-1];return v(n,qt(0,u-e))}},r.take=M,r.head=M,pr(r,function(n,t){r.prototype[t]||(r.prototype[t]=function(t,e){var u=n(this.__wrapped__,t,e);return t==W||e&&typeof t!="function"?u:new r(u)})}),r.VERSION="1.0.1",r.prototype.toString=function(){return this.__wrapped__+""},r.prototype.value=J,r.prototype.valueOf=J,cr(["join","pop","shift"],function(n){var t=ut[n];r.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),cr(["push","reverse","sort","unshift"],function(n){var t=ut[n]; 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;
r.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),cr(["concat","slice","splice"],function(n){var t=ut[n];r.prototype[n]=function(){return new r(t.apply(this.__wrapped__,arguments))}}),Qt&&cr(["pop","shift","splice"],function(n){var t=ut[n],e="splice"==n;r.prototype[n]=function(){var n=this.__wrapped__,u=t.apply(n,arguments);return 0===n.length&&delete n[0],e?new r(u):u}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=r,define(function(){return r 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}";
})):Y?Z?(Z.exports=r)._=r:Y._=r:n._=r})(this); 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;
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.0",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)
}}),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.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={};
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);

9662
dist/lodash.js vendored

File diff suppressed because it is too large Load Diff

72
dist/lodash.min.js vendored
View File

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

File diff suppressed because it is too large Load Diff

View File

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

File diff suppressed because it is too large Load Diff

View File

@@ -21,7 +21,7 @@
// generate Markdown // generate Markdown
$markdown = docdown(array( $markdown = docdown(array(
'path' => '../' . $file, 'path' => '../' . $file,
'title' => 'Lo-Dash <sup>v1.0.1</sup>', 'title' => 'Lo-Dash <sup>v1.1.0</sup>',
'toc' => 'categories', 'toc' => 'categories',
'url' => 'https://github.com/bestiejs/lodash/blob/master/lodash.js' 'url' => 'https://github.com/bestiejs/lodash/blob/master/lodash.js'
)); ));

10104
lodash.js

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,7 @@
{ {
"name": "lodash", "name": "lodash",
"version": "1.0.1", "version": "1.1.0",
"description": "An alternative to Underscore.js, 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", "main": "./dist/lodash",
"keywords": [ "keywords": [

View File

@@ -29,6 +29,7 @@
<body> <body>
<div id="perf-toolbar"></div> <div id="perf-toolbar"></div>
<script src="../vendor/platform.js/platform.js"></script> <script src="../vendor/platform.js/platform.js"></script>
<script src="../lodash.js"></script>
<script src="../vendor/benchmark.js/benchmark.js"></script> <script src="../vendor/benchmark.js/benchmark.js"></script>
<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>

View File

@@ -14,7 +14,9 @@
); );
var last = result[result.length - 1]; var last = result[result.length - 1];
result = (result.length > min && last != 'test.js') ? last : '../lodash.js'; result = (result.length > min && !/perf(?:\.js)?$/.test(last))
? last
: '../lodash.js';
try { try {
result = require('fs').realpathSync(result); result = require('fs').realpathSync(result);
@@ -23,42 +25,52 @@
return result; return result;
}()); }());
/** Load Benchmark.js */
var Benchmark =
window.Benchmark || (
Benchmark = load('../vendor/benchmark.js/benchmark.js') || window.Benchmark,
Benchmark.Benchmark || Benchmark
);
/** Load Lo-Dash */ /** Load Lo-Dash */
var lodash = var lodash = window.lodash || (window.lodash = (
window.lodash || ( lodash = load(filePath) || window._,
lodash = load(filePath) || window._, lodash = lodash._ || lodash,
lodash = lodash._ || lodash, lodash.noConflict()
lodash.noConflict() ));
);
/** Load Benchmark.js */
var Benchmark = window.Benchmark || (window.Benchmark = (
Benchmark = load('../vendor/benchmark.js/benchmark.js') || window.Benchmark,
Benchmark = Benchmark.Benchmark || Benchmark,
Benchmark.runInContext(lodash.extend({}, window, { '_': lodash }))
));
/** Load Underscore */ /** Load Underscore */
var _ = var _ = window._ || (window._ = (
window._ || ( _ = load('../vendor/underscore/underscore.js') || window._,
_ = load('../vendor/underscore/underscore.js') || window._, _._ || _
_._ || _ ));
);
/** Used to access the Firebug Lite panel (set by `run`) */ /** Used to access the Firebug Lite panel (set by `run`) */
var fbPanel; var fbPanel;
/** Used to match path separators */
var rePathSeparator = /[\/\\]/;
/** Used to detect primitive types */
var rePrimitive = /^(?:boolean|number|string|undefined)$/;
/** Used to match RegExp special characters */
var reSpecialChars = /[.*+?^=!:${}()|[\]\/\\]/g;
/** Used to score performance */ /** Used to score performance */
var score = { 'a': 0, 'b': 0 }; var score = { 'a': 0, 'b': 0 };
/** Used to queue benchmark suites */ /** Used to queue benchmark suites */
var suites = []; var suites = [];
/** Used to resolve a value's internal [[Class]] */
var toString = Object.prototype.toString;
/** The `ui` object */ /** The `ui` object */
var ui = window.ui || { var 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 = basename(ui.buildPath, '.js');
@@ -66,15 +78,14 @@
/** The other library basename */ /** The other library basename */
var otherName = basename(ui.otherPath, '.js'); var otherName = basename(ui.otherPath, '.js');
/** Expose functions to the global object */ /** Detect if in a browser environment */
window._ = _; var isBrowser = isHostType(window, 'document') && isHostType(window, 'navigator');
window.Benchmark = Benchmark;
window.lodash = lodash;
/** Add `console.log()` support for Narwhal and RingoJS */ /** Detect Java environment */
if (!window.console && window.print) { var isJava = !isBrowser && /Java/.test(toString.call(window.java));
window.console = { 'log': window.print };
} /** Add `console.log()` support for Narwhal, Rhino, and RingoJS */
var console = window.console || (window.console = { 'log': window.print });
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
@@ -88,10 +99,10 @@
* @returns {String} Returns the basename. * @returns {String} Returns the basename.
*/ */
function basename(filePath, extension) { function basename(filePath, extension) {
var result = (filePath || '').split(/[\\/]/).pop(); var result = (filePath || '').split(rePathSeparator).pop();
return arguments.length < 2 return (arguments.length < 2)
? result ? result
: result.replace(RegExp(extension.replace(/[.*+?^=!:${}()|[\]\/\\]/g, '\\$&') + '$'), ''); : result.replace(RegExp(extension.replace(reSpecialChars, '\\$&') + '$'), '');
} }
/** /**
@@ -107,6 +118,24 @@
return isFinite(result) ? result : 0; return isFinite(result) ? result : 0;
} }
/**
* Host objects can return type values that are different from their actual
* data type. The objects we are concerned with usually return non-primitive
* types of "object", "function", or "unknown".
*
* @private
* @param {Mixed} object The owner of the property.
* @param {String} property The property to check.
* @returns {Boolean} Returns `true` if the property value is a non-primitive, else `false`.
*/
function isHostType(object, property) {
if (object == null) {
return false;
}
var type = typeof object[property];
return !rePrimitive.test(type) && (type != 'object' || !!object[property]);
}
/** /**
* Logs text to the console. * Logs text to the console.
* *
@@ -132,7 +161,7 @@
fbPanel.getElementById('fbPanel1'); fbPanel.getElementById('fbPanel1');
log('\nSit back and relax, this may take a while.'); log('\nSit back and relax, this may take a while.');
suites[0].run(); suites[0].run({ 'async': !isJava });
} }
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
@@ -175,7 +204,7 @@
if (suites.length) { if (suites.length) {
// run next suite // run next suite
suites[0].run(); suites[0].run({ 'async': !isJava });
} }
else { else {
var fastestTotalHz = Math.max(score.a, score.b), var fastestTotalHz = Math.max(score.a, score.b),
@@ -199,8 +228,7 @@
lodash.extend(Benchmark.options, { lodash.extend(Benchmark.options, {
'async': true, 'async': true,
'setup': '\ 'setup': '\
var window = Function("return this || global")(),\ var _ = window._,\
_ = window._,\
lodash = window.lodash,\ lodash = window.lodash,\
belt = this.name == "Lo-Dash" ? lodash : _;\ belt = this.name == "Lo-Dash" ? lodash : _;\
\ \
@@ -222,18 +250,18 @@
}\ }\
\ \
if (typeof bind != "undefined") {\ if (typeof bind != "undefined") {\
var contextObject = { "name": "moe" },\ var thisArg = { "name": "moe" },\
ctor = function() {};\ ctor = function() {};\
\ \
var func = function(greeting, punctuation) {\ var func = function(greeting, punctuation) {\
return greeting + ", " + this.name + (punctuation || ".");\ return greeting + ", " + this.name + (punctuation || ".");\
};\ };\
\ \
var lodashBoundNormal = lodash.bind(func, contextObject),\ var _boundNormal = _.bind(func, thisArg),\
lodashBoundPartial = lodash.bind(func, contextObject, "hi");\ _boundPartial = _.bind(func, thisArg, "hi");\
\ \
var _boundNormal = _.bind(func, contextObject),\ var lodashBoundNormal = lodash.bind(func, thisArg),\
_boundPartial = _.bind(func, contextObject, "hi");\ lodashBoundPartial = lodash.bind(func, thisArg, "hi");\
}\ }\
\ \
if (typeof bindAll != "undefined") {\ if (typeof bindAll != "undefined") {\
@@ -248,6 +276,10 @@
}, {});\ }, {});\
}\ }\
}\ }\
if (typeof chaining != "undefined") {\
var _chaining = _.chain ? _(numbers).chain() : _(numbers),\
lodashChaining = lodash(numbers);\
}\
if (typeof compact != "undefined") {\ if (typeof compact != "undefined") {\
var uncompacted = numbers.slice();\ var uncompacted = numbers.slice();\
uncompacted[2] = false;\ uncompacted[2] = false;\
@@ -445,16 +477,68 @@
\ \
var settingsObject = { "variable": "data" };\ var settingsObject = { "variable": "data" };\
\ \
var lodashTpl = lodash.template(tpl),\
lodashTplVerbose = lodash.template(tplVerbose, null, settingsObject);\
\
var _tpl = _.template(tpl),\ var _tpl = _.template(tpl),\
_tplVerbose = _.template(tplVerbose, null, settingsObject);\ _tplVerbose = _.template(tplVerbose, null, settingsObject);\
\
var lodashTpl = lodash.template(tpl),\
lodashTplVerbose = lodash.template(tplVerbose, null, settingsObject);\
}\
if (typeof where != "undefined") {\
var _findWhere = _.findWhere || _.find,\
lodashFindWhere = lodash.findWhere || lodash.find,\
whereObject = { "num": 9 };\
}' }'
}); });
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
suites.push(
Benchmark.Suite('`_(...)` with a number')
.add(buildName, '\
lodash(2)'
)
.add(otherName, '\
_(2)'
)
);
suites.push(
Benchmark.Suite('`_(...)` with an array')
.add(buildName, '\
lodash(numbers)'
)
.add(otherName, '\
_(numbers)'
)
);
suites.push(
Benchmark.Suite('`_(...)` with an object')
.add(buildName, '\
lodash(object)'
)
.add(otherName, '\
_(object)'
)
);
// avoid Underscore induced `OutOfMemoryError` in Rhino, Narwhal, and Ringo
if (!isJava) {
suites.push(
Benchmark.Suite('`_(...).tap(...)`')
.add(buildName, {
'fn': 'lodashChaining.tap(lodash.identity)',
'teardown': 'function chaining(){}'
})
.add(otherName, {
'fn': '_chaining.tap(_.identity)',
'teardown': 'function chaining(){}'
})
);
}
/*--------------------------------------------------------------------------*/
suites.push( suites.push(
Benchmark.Suite('`_.bind` (uses native `Function#bind` if available and inferred fast)') Benchmark.Suite('`_.bind` (uses native `Function#bind` if available and inferred fast)')
.add(buildName, { .add(buildName, {
@@ -650,13 +734,13 @@
); );
suites.push( suites.push(
Benchmark.Suite('`_.difference` iterating 30 elements') Benchmark.Suite('`_.difference` iterating 100 elements')
.add(buildName, { .add(buildName, {
'fn': 'lodash.difference(thirtyValues, thirtyValues2)', 'fn': 'lodash.difference(hundredValues, hundredValues2)',
'teardown': 'function multiArrays(){}' 'teardown': 'function multiArrays(){}'
}) })
.add(otherName, { .add(otherName, {
'fn': '_.difference(thirtyValues, thirtyValues2)', 'fn': '_.difference(hundredValues, hundredValues2)',
'teardown': 'function multiArrays(){}' 'teardown': 'function multiArrays(){}'
}) })
); );
@@ -839,15 +923,20 @@
) )
); );
suites.push( // avoid Underscore induced `OutOfMemoryError` in Rhino, Narwhal, and Ringo
Benchmark.Suite('`_.find` with `properties`') if (!isJava) {
.add(buildName, '\ suites.push(
lodash.find(objects, { "num": 9 });' Benchmark.Suite('`_.find` with `properties`')
) .add(buildName, {
.add(otherName, '\ 'fn': 'lodashFindWhere(objects, whereObject)',
_.findWhere(objects, { "num": 9 });' 'teardown': 'function where(){}'
) })
); .add(otherName, {
'fn': '_findWhere(objects, whereObject)',
'teardown': 'function where(){}'
})
);
}
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
@@ -1228,7 +1317,7 @@
'teardown': 'function omit(){}' 'teardown': 'function omit(){}'
}) })
.add(otherName, { .add(otherName, {
'fn': 'result = _.omit(wordToNumber, words)', 'fn': '_.omit(wordToNumber, words)',
'teardown': 'function omit(){}' 'teardown': 'function omit(){}'
}) })
); );
@@ -1291,13 +1380,13 @@
Benchmark.Suite('`_.reduce` iterating an object') Benchmark.Suite('`_.reduce` iterating an object')
.add(buildName, '\ .add(buildName, '\
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;\
}, []);' }, []);'
) )
@@ -1325,13 +1414,13 @@
Benchmark.Suite('`_.reduceRight` iterating an object') Benchmark.Suite('`_.reduceRight` iterating an object')
.add(buildName, '\ .add(buildName, '\
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;\
}, []);' }, []);'
) )
@@ -1677,12 +1766,14 @@
suites.push( suites.push(
Benchmark.Suite('`_.where`') Benchmark.Suite('`_.where`')
.add(buildName, '\ .add(buildName, {
lodash.where(objects, { "num": 9 });' 'fn': 'lodash.where(objects, whereObject);',
) 'teardown': 'function where(){}'
.add(otherName, '\ })
_.where(objects, { "num": 9 });' .add(otherName, {
) 'fn': '_.where(objects, whereObject);',
'teardown': 'function where(){}'
})
); );
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
@@ -1714,7 +1805,6 @@
if (Benchmark.platform + '') { if (Benchmark.platform + '') {
log(Benchmark.platform); log(Benchmark.platform);
} }
// in the browser, expose `run` to be called later // in the browser, expose `run` to be called later
if (window.document && !window.phantom) { if (window.document && !window.phantom) {
window.run = run; window.run = run;

View File

@@ -3,7 +3,7 @@ cd "$(dirname "$0")"
echo "Running performance suite in node..." echo "Running performance suite in node..."
node perf.js ../dist/lodash.js && node perf.js ../dist/lodash.min.js node perf.js ../dist/lodash.js && node perf.js ../dist/lodash.min.js
for cmd in rhino narwhal ringo phantomjs; do for cmd in rhino "rhino -require" narwhal ringo phantomjs; do
echo "" echo ""
echo "Running performance suite in $cmd..." echo "Running performance suite in $cmd..."
$cmd perf.js ../dist/lodash.compat.js && $cmd perf.js ../dist/lodash.compat.min.js $cmd perf.js ../dist/lodash.compat.js && $cmd perf.js ../dist/lodash.compat.min.js

View File

@@ -4,12 +4,18 @@
<meta charset="utf-8"> <meta charset="utf-8">
<title>Lo-Dash Test Suite</title> <title>Lo-Dash Test Suite</title>
<link rel="stylesheet" href="../vendor/qunit/qunit/qunit.css"> <link rel="stylesheet" href="../vendor/qunit/qunit/qunit.css">
<style>
#exports {
display: none;
}
</style>
</head> </head>
<body> <body>
<div id="qunit"></div>
<script src="../vendor/platform.js/platform.js"></script>
<script src="../vendor/qunit/qunit/qunit.js"></script> <script src="../vendor/qunit/qunit/qunit.js"></script>
<script src="../vendor/platform.js/platform.js"></script>
<script src="test-ui.js"></script> <script src="test-ui.js"></script>
<div id="qunit"></div>
<div id="exports"></div>
<script> <script>
// set a bad shim // set a bad shim
Object._keys = Object.keys; Object._keys = Object.keys;

View File

@@ -1,6 +1,6 @@
cd "$(dirname "$0")" cd "$(dirname "$0")"
for cmd in rhino narwhal ringo phantomjs; do for cmd in rhino "rhino -require" narwhal ringo phantomjs; do
echo "Testing in $cmd..." echo "Testing in $cmd..."
$cmd test.js ../dist/lodash.compat.js && $cmd test.js ../dist/lodash.compat.min.js $cmd test.js ../dist/lodash.compat.js && $cmd test.js ../dist/lodash.compat.min.js
echo "" echo ""

View File

@@ -2,23 +2,40 @@
;(function(undefined) { ;(function(undefined) {
'use strict'; 'use strict';
/** Load modules */ /** Load Node.js modules */
var fs = require('fs'), var fs = require('fs'),
path = require('path'), path = require('path'),
vm = require('vm'), vm = require('vm');
build = require('../build.js'),
/** Load other modules */
var build = require('../build.js'),
minify = require('../build/minify'), minify = require('../build/minify'),
_ = require('../lodash.js'); _ = require('../lodash.js');
/** Used to avoid `noglobal` false positives caused by `errno` leaked in Node.js */
global.errno = true;
/** Add `path.sep` for older versions of Node.js */
path.sep || (path.sep = process.platform == 'win32' ? '\\' : '/');
/** The current working directory */
var cwd = process.cwd();
/** Used to prefix relative paths from the current directory */
var relativePrefix = '.' + path.sep;
/** The unit testing framework */ /** The unit testing framework */
var QUnit = ( var QUnit = (
global.addEventListener || (global.addEventListener = Function.prototype), global.addEventListener = Function.prototype,
global.QUnit = require('../vendor/qunit/qunit/qunit.js'), global.QUnit = require('../vendor/qunit/qunit/qunit.js'),
require('../vendor/qunit-clib/qunit-clib.js'), require('../vendor/qunit-clib/qunit-clib.js').runInContext(global),
global.addEventListener === Function.prototype && delete global.addEventListener, delete global.addEventListener,
global.QUnit global.QUnit
); );
/** Shortcut used to push arrays of values to an array */
var push = Array.prototype.push;
/** The time limit for the tests to run (milliseconds) */ /** The time limit for the tests to run (milliseconds) */
var timeLimit = process.argv.reduce(function(result, value, index) { var timeLimit = process.argv.reduce(function(result, value, index) {
if (/--time-limit/.test(value)) { if (/--time-limit/.test(value)) {
@@ -46,6 +63,7 @@
'include': 'contains', 'include': 'contains',
'inject': 'reduce', 'inject': 'reduce',
'methods': 'functions', 'methods': 'functions',
'object': 'zipObject',
'select': 'filter', 'select': 'filter',
'tail': 'rest', 'tail': 'rest',
'take': 'first', 'take': 'first',
@@ -67,7 +85,8 @@
'reduceRight': ['foldr'], 'reduceRight': ['foldr'],
'rest': ['drop', 'tail'], 'rest': ['drop', 'tail'],
'some': ['any'], 'some': ['any'],
'uniq': ['unique'] 'uniq': ['unique'],
'zipObject': ['object']
}; };
/** List of all Lo-Dash methods */ /** List of all Lo-Dash methods */
@@ -81,6 +100,7 @@
'compact', 'compact',
'difference', 'difference',
'drop', 'drop',
'findIndex',
'first', 'first',
'flatten', 'flatten',
'head', 'head',
@@ -99,12 +119,12 @@
'uniq', 'uniq',
'unique', 'unique',
'without', 'without',
'zip' 'zip',
'zipObject'
]; ];
/** List of "Chaining" category methods */ /** List of "Chaining" category methods */
var chainingMethods = [ var chainingMethods = [
'mixin',
'tap', 'tap',
'value' 'value'
]; ];
@@ -151,6 +171,7 @@
'bind', 'bind',
'bindAll', 'bindAll',
'bindKey', 'bindKey',
'createCallback',
'compose', 'compose',
'debounce', 'debounce',
'defer', 'defer',
@@ -170,6 +191,7 @@
'cloneDeep', 'cloneDeep',
'defaults', 'defaults',
'extend', 'extend',
'findKey',
'forIn', 'forIn',
'forOwn', 'forOwn',
'functions', 'functions',
@@ -205,9 +227,12 @@
var utilityMethods = [ var utilityMethods = [
'escape', 'escape',
'identity', 'identity',
'mixin',
'noConflict', 'noConflict',
'parseInt',
'random', 'random',
'result', 'result',
'runInContext',
'template', 'template',
'times', 'times',
'unescape', 'unescape',
@@ -234,6 +259,7 @@
'has', 'has',
'indexOf', 'indexOf',
'initial', 'initial',
'invert',
'invoke', 'invoke',
'isArray', 'isArray',
'isEmpty', 'isEmpty',
@@ -249,7 +275,9 @@
'max', 'max',
'min', 'min',
'mixin', 'mixin',
'omit',
'once', 'once',
'pairs',
'pick', 'pick',
'reduce', 'reduce',
'reduceRight', 'reduceRight',
@@ -264,6 +292,7 @@
'toArray', 'toArray',
'uniqueId', 'uniqueId',
'value', 'value',
'values',
'without' 'without'
]; ];
@@ -272,15 +301,31 @@
'at', 'at',
'bindKey', 'bindKey',
'cloneDeep', 'cloneDeep',
'createCallback',
'findIndex',
'findKey',
'forIn', 'forIn',
'forOwn', 'forOwn',
'isPlainObject', 'isPlainObject',
'merge', 'merge',
'partialRight' 'parseInt',
'partialRight',
'runInContext'
])); ]));
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
/**
* Capitalizes a given string.
*
* @private
* @param {String} string The string to capitalize.
* @returns {String} Returns the capitalized string.
*/
function capitalize(string) {
return string[0].toUpperCase() + string.toLowerCase().slice(1);
}
/** /**
* Creates a context object to use with `vm.runInContext`. * Creates a context object to use with `vm.runInContext`.
* *
@@ -304,7 +349,7 @@
function expandMethodNames(methodNames) { function expandMethodNames(methodNames) {
return methodNames.reduce(function(result, methodName) { return methodNames.reduce(function(result, methodName) {
var realName = getRealName(methodName); var realName = getRealName(methodName);
result.push.apply(result, [realName].concat(getAliases(realName))); push.apply(result, [realName].concat(getAliases(realName)));
return result; return result;
}, []); }, []);
} }
@@ -374,7 +419,7 @@
func = lodash[methodName]; func = lodash[methodName];
try { try {
if (arraysMethods.indexOf(methodName) > -1) { if (_.contains(arraysMethods, methodName)) {
if (/(?:indexOf|sortedIndex|without)$/i.test(methodName)) { if (/(?:indexOf|sortedIndex|without)$/i.test(methodName)) {
func(array, string); func(array, string);
} else if (/^(?:difference|intersection|union|uniq|zip)/.test(methodName)) { } else if (/^(?:difference|intersection|union|uniq|zip)/.test(methodName)) {
@@ -385,19 +430,10 @@
func(array); func(array);
} }
} }
else if (chainingMethods.indexOf(methodName) > -1) { else if (_.contains(chainingMethods, methodName)) {
if (methodName == 'chain') { lodash(array)[methodName](noop);
lodash.chain(array);
lodash(array).chain();
}
else if (methodName == 'mixin') {
lodash.mixin({});
}
else {
lodash(array)[methodName](noop);
}
} }
else if (collectionsMethods.indexOf(methodName) > -1) { else if (_.contains(collectionsMethods, methodName)) {
if (/^(?:count|group|sort)By$/.test(methodName)) { if (/^(?:count|group|sort)By$/.test(methodName)) {
func(array, noop); func(array, noop);
func(array, string); func(array, string);
@@ -425,7 +461,7 @@
func(object, noop, object); func(object, noop, object);
} }
} }
else if (functionsMethods.indexOf(methodName) > -1) { else if (_.contains(functionsMethods, methodName)) {
if (methodName == 'after') { if (methodName == 'after') {
func(1, noop); func(1, noop);
} else if (methodName == 'bindAll') { } else if (methodName == 'bindAll') {
@@ -442,7 +478,7 @@
func(noop); func(noop);
} }
} }
else if (objectsMethods.indexOf(methodName) > -1) { else if (_.contains(objectsMethods, methodName)) {
if (methodName == 'clone') { if (methodName == 'clone') {
func(object); func(object);
func(object, true); func(object, true);
@@ -459,9 +495,13 @@
func(object); func(object);
} }
} }
else if (utilityMethods.indexOf(methodName) > -1) { else if (_.contains(utilityMethods, methodName)) {
if (methodName == 'result') { if (methodName == 'mixin') {
func({});
} else if (methodName == 'result') {
func(object, 'b'); func(object, 'b');
} else if (methodName == 'runInContext') {
func();
} else if (methodName == 'template') { } else if (methodName == 'template') {
func(template, object); func(template, object);
func(template, null, { 'imports': object })(object); func(template, null, { 'imports': object })(object);
@@ -484,10 +524,10 @@
QUnit.module('minified AMD snippet'); QUnit.module('minified AMD snippet');
(function() { (function() {
var start = _.once(QUnit.start); var start = _.after(2, _.once(QUnit.start));
asyncTest('`lodash`', function() { asyncTest('`lodash`', function() {
build(['-s'], function(data) { build(['-s', 'exclude='], function(data) {
// used by r.js build optimizer // used by r.js build optimizer
var defineHasRegExp = /typeof\s+define\s*==(=)?\s*['"]function['"]\s*&&\s*typeof\s+define\.amd\s*==(=)?\s*['"]object['"]\s*&&\s*define\.amd/g, var defineHasRegExp = /typeof\s+define\s*==(=)?\s*['"]function['"]\s*&&\s*typeof\s+define\.amd\s*==(=)?\s*['"]object['"]\s*&&\s*define\.amd/g,
basename = path.basename(data.outputPath, '.js'); basename = path.basename(data.outputPath, '.js');
@@ -503,33 +543,46 @@
QUnit.module('template builds'); QUnit.module('template builds');
(function() { (function() {
var templatePath = __dirname + '/template'; var templatePath = path.join(__dirname, 'template');
asyncTest('`lodash template=*.jst`', function() { var commands = [
var start = _.after(2, _.once(QUnit.start)); 'template=' + path.join('template', '*.jst'),
'template=' + relativePrefix + path.join('template', '*.jst'),
'template=' + path.join(templatePath, '*.jst')
];
build(['-s', 'template=' + templatePath + '/*.jst'], function(data) { commands.forEach(function(command) {
var basename = path.basename(data.outputPath, '.js'), asyncTest('`lodash ' + command +'`', function() {
context = createContext(); var start = _.after(2, _.once(function() {
process.chdir(cwd);
QUnit.start();
}));
var object = { process.chdir(__dirname);
'a': { 'people': ['moe', 'larry', 'curly'] },
'b': { 'epithet': 'stooge' },
'c': { 'name': 'ES6' }
};
context._ = _; build(['-s', command], function(data) {
vm.runInContext(data.source, context); var basename = path.basename(data.outputPath, '.js'),
context = createContext();
equal(_.templates.a(object.a).replace(/[\r\n]+/g, ''), '<ul><li>moe</li><li>larry</li><li>curly</li></ul>', basename); var object = {
equal(_.templates.b(object.b), 'Hello stooge.', basename); 'a': { 'people': ['moe', 'larry', 'curly'] },
equal(_.templates.c(object.c), 'Hello ES6!', basename); 'b': { 'epithet': 'stooge' },
delete _.templates; 'c': { 'name': 'ES6' }
start(); };
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);
equal(_.templates.b(object.b), 'Hello stooge.', basename);
equal(_.templates.c(object.c), 'Hello ES6!', basename);
delete _.templates;
start();
});
}); });
}); });
var commands = [ commands = [
'', '',
'moduleId=underscore' 'moduleId=underscore'
]; ];
@@ -540,7 +593,7 @@
asyncTest('`lodash template=*.jst exports=amd' + (command ? ' ' + command : '') + '`', function() { asyncTest('`lodash template=*.jst exports=amd' + (command ? ' ' + command : '') + '`', function() {
var start = _.after(2, _.once(QUnit.start)); var start = _.after(2, _.once(QUnit.start));
build(['-s', 'template=' + templatePath + '/*.jst', 'exports=amd'].concat(command || []), function(data) { build(['-s', 'template=' + path.join(templatePath, '*.jst'), 'exports=amd'].concat(command || []), function(data) {
var moduleId, var moduleId,
basename = path.basename(data.outputPath, '.js'), basename = path.basename(data.outputPath, '.js'),
context = createContext(); context = createContext();
@@ -565,7 +618,7 @@
asyncTest('`lodash settings=...' + (command ? ' ' + command : '') + '`', function() { asyncTest('`lodash settings=...' + (command ? ' ' + command : '') + '`', function() {
var start = _.after(2, _.once(QUnit.start)); var start = _.after(2, _.once(QUnit.start));
build(['-s', 'template=' + templatePath + '/*.tpl', 'settings={interpolate:/{{([\\s\\S]+?)}}/}'].concat(command || []), function(data) { build(['-s', 'template=' + path.join(templatePath, '*.tpl'), 'settings={interpolate:/{{([\\s\\S]+?)}}/}'].concat(command || []), function(data) {
var moduleId, var moduleId,
basename = path.basename(data.outputPath, '.js'), basename = path.basename(data.outputPath, '.js'),
context = createContext(); context = createContext();
@@ -670,11 +723,14 @@
equal(sourceMap.file, basename + '.js', basename); equal(sourceMap.file, basename + '.js', basename);
deepEqual(sourceMap.sources, sources, basename); deepEqual(sourceMap.sources, sources, basename);
process.chdir(cwd);
QUnit.start(); QUnit.start();
}); });
process.chdir(__dirname);
outputCommand = outputCommand ? outputCommand.split(' ') : []; outputCommand = outputCommand ? outputCommand.split(' ') : [];
if (outputCommand.indexOf('-m') < 0) { if (!_.contains(outputCommand, '-m')) {
callback = _.after(2, callback); callback = _.after(2, callback);
} }
build(['-s'].concat(mapCommand.split(' '), outputCommand), callback); build(['-s'].concat(mapCommand.split(' '), outputCommand), callback);
@@ -787,8 +843,7 @@
var start = _.after(2, _.once(QUnit.start)); var start = _.after(2, _.once(QUnit.start));
build(['-s', 'underscore'], function(data) { build(['-s', 'underscore'], function(data) {
var last, var array = [{ 'a': 1, 'b': 2 }, { 'a': 2, 'b': 2 }],
array = [{ 'a': 1, 'b': 2 }, { 'a': 2, 'b': 2 }],
basename = path.basename(data.outputPath, '.js'), basename = path.basename(data.outputPath, '.js'),
context = createContext(); context = createContext();
@@ -835,6 +890,7 @@
equal(actual, _.first(array), '_.find: ' + basename); equal(actual, _.first(array), '_.find: ' + basename);
var last;
actual = lodash.forEach(array, function(value) { actual = lodash.forEach(array, function(value) {
last = value; last = value;
return false; return false;
@@ -843,6 +899,15 @@
equal(last, _.last(array), '_.forEach should not exit early: ' + basename); equal(last, _.last(array), '_.forEach should not exit early: ' + basename);
equal(actual, undefined, '_.forEach should return `undefined`: ' + basename); equal(actual, undefined, '_.forEach should return `undefined`: ' + basename);
array = [{ 'a': [1, 2] }, { 'a': [3] }];
actual = lodash.flatten(array, function(value, index) {
return this[index].a;
}, array);
deepEqual(actual, array, '_.flatten should should ignore `callback` and `thisArg`: ' + basename);
deepEqual(lodash.flatten(array, 'a'), array, '_.flatten should should ignore string `callback` values: ' + basename);
object = { 'length': 0, 'splice': Array.prototype.splice }; object = { 'length': 0, 'splice': Array.prototype.splice };
equal(lodash.isEmpty(object), false, '_.isEmpty should return `false` for jQuery/MooTools DOM query collections: ' + basename); equal(lodash.isEmpty(object), false, '_.isEmpty should return `false` for jQuery/MooTools DOM query collections: ' + basename);
@@ -868,7 +933,9 @@
strictEqual(lodash.result(), null, '_.result should return `null` for falsey `object` arguments: ' + basename); strictEqual(lodash.result(), null, '_.result should return `null` for falsey `object` arguments: ' + basename);
strictEqual(lodash.some([false, true, false]), true, '_.some: ' + basename); strictEqual(lodash.some([false, true, false]), true, '_.some: ' + basename);
deepEqual(lodash.times(null, function() {}), [null], '_.times should not coerce `n` to a number: ' + basename);
equal(lodash.template('${a}', object), '${a}', '_.template should ignore ES6 delimiters: ' + basename); equal(lodash.template('${a}', object), '${a}', '_.template should ignore ES6 delimiters: ' + basename);
equal('support' in lodash, false, '_.support should not exist: ' + basename);
equal('imports' in lodash.templateSettings, false, '_.templateSettings should not have an "imports" property: ' + basename); equal('imports' in lodash.templateSettings, false, '_.templateSettings should not have an "imports" property: ' + basename);
strictEqual(lodash.uniqueId(0), '1', '_.uniqueId should ignore a prefix of `0`: ' + basename); strictEqual(lodash.uniqueId(0), '1', '_.uniqueId should ignore a prefix of `0`: ' + basename);
@@ -900,11 +967,17 @@
'assign', 'assign',
'at', 'at',
'bindKey', 'bindKey',
'createCallback',
'findIndex',
'findKey',
'forIn', 'forIn',
'forOwn', 'forOwn',
'isPlainObject', 'isPlainObject',
'merge', 'merge',
'partialRight' 'parseInt',
'partialRight',
'runInContext',
'zipObject'
], function(methodName) { ], function(methodName) {
equal(lodash[methodName], undefined, '_.' + methodName + ' should not exist: ' + basename); equal(lodash[methodName], undefined, '_.' + methodName + ' should not exist: ' + basename);
}); });
@@ -945,21 +1018,34 @@
}); });
}); });
asyncTest('`lodash underscore plus=clone`', function() { var commands = [
var start = _.after(2, _.once(QUnit.start)); 'plus=clone',
'plus=cloneDeep'
];
build(['-s', 'underscore', 'plus=clone'], function(data) { commands.forEach(function(command, index) {
var array = [{ 'value': 1 }], asyncTest('`lodash ' + command +'`', function() {
basename = path.basename(data.outputPath, '.js'), var start = _.after(2, _.once(QUnit.start));
context = createContext();
vm.runInContext(data.source, context); build(['-s', 'underscore', command], function(data) {
var lodash = context._, var array = [{ 'value': 1 }],
clone = lodash.clone(array, true); basename = path.basename(data.outputPath, '.js'),
context = createContext();
ok(_.isEqual(array, clone), basename); vm.runInContext(data.source, context, true);
notEqual(array[0], clone[0], basename); var lodash = context._;
start();
_.each(index ? ['clone','cloneDeep'] : ['clone'], function(methodName) {
var clone = (methodName == 'clone')
? lodash.clone(array, true)
: lodash.cloneDeep(array);
ok(_.isEqual(array, clone), basename);
notEqual(array[0], clone[0], basename);
});
start();
});
}); });
}); });
}()); }());
@@ -1034,8 +1120,8 @@
(function() { (function() {
var commands = [ var commands = [
'iife=this["lodash"]=(function(window,undefined){%output%;return lodash}(this))', 'iife=this["lodash"]=(function(window){%output%;return _}(this))',
'iife=define(function(window,undefined){return function(){%output%;return lodash}}(this));' 'iife=define(function(window){return function(){%output%;return _}}(this));'
]; ];
commands.forEach(function(command) { commands.forEach(function(command) {
@@ -1066,21 +1152,77 @@
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
QUnit.module('output options'); QUnit.module('include command');
(function() { (function() {
var commands = [ var commands = [
'-o a.js', 'include=mixin',
'--output a.js' 'include=mixin,tap',
'include=mixin,value'
]; ];
commands.forEach(function(command, index) { commands.forEach(function(command, index) {
asyncTest('`lodash ' + command +'`', function() { asyncTest('`lodash ' + command +'`', function() {
var counter = -1, var start = _.after(2, _.once(QUnit.start));
start = _.after(2, _.once(QUnit.start));
build(['-s', command], function(data) {
var basename = path.basename(data.outputPath, '.js'),
context = createContext(),
noop = function() {},
source = data.source;
vm.runInContext(data.source, context);
var lodash = context._;
lodash.mixin({ 'x': noop });
equal(lodash.x, noop, basename);
if (index) {
equal(typeof lodash.prototype.x, 'function', basename);
} else {
equal('x' in lodash.prototype, false, basename);
}
start();
});
});
});
}());
/*--------------------------------------------------------------------------*/
QUnit.module('output options');
(function() {
var nestedPath = path.join(__dirname, 'a', 'b');
var commands = [
'-o a.js',
'--output b.js',
'-o ' + path.join('a', 'b', 'c.js'),
'-o ' + relativePrefix + path.join('a', 'b', 'c.js'),
'-o ' + path.join(nestedPath, 'c.js')
];
commands.forEach(function(command) {
asyncTest('`lodash ' + command +'`', function() {
var counter = 0,
dirs = _.contains(command, 'c.js'),
expected = /(\w+)(?=\.js$)/.exec(command)[0];
var start = _.after(2, _.once(function() {
if (dirs) {
fs.rmdirSync(nestedPath);
fs.rmdirSync(path.dirname(nestedPath));
}
process.chdir(cwd);
QUnit.start();
}));
process.chdir(__dirname);
build(['-s'].concat(command.split(' ')), function(data) { build(['-s'].concat(command.split(' ')), function(data) {
equal(path.basename(data.outputPath, '.js'), (++counter ? 'a.min' : 'a'), command); var basename = path.basename(data.outputPath, '.js');
equal(basename, expected + (counter++ ? '.min' : ''), command);
start(); start();
}); });
}); });
@@ -1127,26 +1269,21 @@
var start = _.after(2, _.once(QUnit.start)); var start = _.after(2, _.once(QUnit.start));
build(['-s', 'mobile'], function(data) { build(['-s', 'mobile'], function(data) {
var basename = path.basename(data.outputPath, '.js'),
context = createContext();
try {
vm.runInContext(data.source, context);
} catch(e) {
console.log(e);
}
var array = [1, 2, 3], var array = [1, 2, 3],
basename = path.basename(data.outputPath, '.js'),
context = createContext(),
object1 = [{ 'a': 1 }], object1 = [{ 'a': 1 }],
object2 = [{ 'b': 2 }], object2 = [{ 'b': 2 }],
object3 = [{ 'a': 1, 'b': 2 }], object3 = [{ 'a': 1, 'b': 2 }],
circular1 = { 'a': 1 }, circular1 = { 'a': 1 },
circular2 = { 'a': 1 }, circular2 = { 'a': 1 };
lodash = context._;
circular1.b = circular1; circular1.b = circular1;
circular2.b = circular2; circular2.b = circular2;
vm.runInContext(data.source, context);
var lodash = context._;
deepEqual(lodash.merge(object1, object2), object3, basename); deepEqual(lodash.merge(object1, object2), object3, basename);
deepEqual(lodash.sortBy([3, 2, 1], _.identity), array, basename); deepEqual(lodash.sortBy([3, 2, 1], _.identity), array, basename);
strictEqual(lodash.isEqual(circular1, circular2), true, basename); strictEqual(lodash.isEqual(circular1, circular2), true, basename);
@@ -1161,12 +1298,17 @@
var sources = []; var sources = [];
var check = _.after(2, _.once(function() { 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]); equal(sources[0], sources[1]);
QUnit.start(); QUnit.start();
})); }));
var callback = function(data) { var callback = function(data) {
// remove copyright header and append source // remove copyright header and append to `sources`
sources.push(data.source.replace(/^\/\**[\s\S]+?\*\/\n/, '')); sources.push(data.source.replace(/^\/\**[\s\S]+?\*\/\n/, ''));
check(); check();
}; };
@@ -1202,6 +1344,7 @@
'backbone legacy category=utilities minus=first,last', 'backbone legacy category=utilities minus=first,last',
'legacy include=defer', 'legacy include=defer',
'legacy underscore', 'legacy underscore',
'modern strict include=isArguments,isArray,isFunction,isPlainObject,key',
'underscore include=debounce,throttle plus=after minus=throttle', 'underscore include=debounce,throttle plus=after minus=throttle',
'underscore mobile strict category=functions exports=amd,global plus=pick,uniq', 'underscore mobile strict category=functions exports=amd,global plus=pick,uniq',
] ]
@@ -1221,13 +1364,13 @@
} }
command = 'mobile ' + command; command = 'mobile ' + command;
} }
if (index == 2) { else if (index == 2) {
if (/legacy|modern/.test(command)) { if (/legacy|modern/.test(command)) {
return; return;
} }
command = 'modern ' + command; command = 'modern ' + command;
} }
if (index == 3) { else if (index == 3) {
if (/category|legacy|underscore/.test(command)) { if (/category|legacy|underscore/.test(command)) {
return; return;
} }
@@ -1240,8 +1383,10 @@
var methodNames, var methodNames,
basename = path.basename(data.outputPath, '.js'), basename = path.basename(data.outputPath, '.js'),
context = createContext(), context = createContext(),
isUnderscore = /backbone|underscore/.test(command), isBackbone = /backbone/.test(command),
exposeAssign = !isUnderscore; isUnderscore = isBackbone || /underscore/.test(command),
exposeAssign = !isUnderscore,
exposeZipObject = !isUnderscore;
try { try {
vm.runInContext(data.source, context); vm.runInContext(data.source, context);
@@ -1258,20 +1403,15 @@
} }
if (isUnderscore) { if (isUnderscore) {
if (methodNames) { if (methodNames) {
exposeAssign = methodNames.indexOf('assign') > -1; exposeAssign = _.contains(methodNames, 'assign');
exposeZipObject = _.contains(methodNames, 'zipObject');
} else { } else {
methodNames = underscoreMethods.slice(); methodNames = underscoreMethods.slice();
} }
} }
// add method names explicitly by category
if (/category/.test(command)) { if (/category/.test(command)) {
// resolve method names belonging to each category (case-insensitive) methodNames = (methodNames || []).concat(command.match(/category=(\S*)/)[1].split(/, */).map(capitalize));
methodNames = command.match(/category=(\S*)/)[1].split(/, */).reduce(function(result, category) {
var capitalized = category[0].toUpperCase() + category.toLowerCase().slice(1);
return result.concat(getMethodsByCategory(capitalized));
}, methodNames || []);
} }
// init `methodNames` if it hasn't been inited
if (!methodNames) { if (!methodNames) {
methodNames = allMethods.slice(); methodNames = allMethods.slice();
} }
@@ -1279,25 +1419,42 @@
methodNames = methodNames.concat(command.match(/plus=(\S*)/)[1].split(/, */)); methodNames = methodNames.concat(command.match(/plus=(\S*)/)[1].split(/, */));
} }
if (/minus/.test(command)) { if (/minus/.test(command)) {
methodNames = _.without.apply(_, [methodNames] methodNames = _.without.apply(_, [methodNames].concat(expandMethodNames(command.match(/minus=(\S*)/)[1].split(/, */))));
.concat(expandMethodNames(command.match(/minus=(\S*)/)[1].split(/, */))));
} }
if (/exclude/.test(command)) { if (/exclude/.test(command)) {
methodNames = _.without.apply(_, [methodNames] methodNames = _.without.apply(_, [methodNames].concat(expandMethodNames(command.match(/exclude=(\S*)/)[1].split(/, */))));
.concat(expandMethodNames(command.match(/exclude=(\S*)/)[1].split(/, */))));
} }
// expand aliases and categories to real method names // expand categories to real method names
methodNames = expandMethodNames(methodNames).reduce(function(result, methodName) { methodNames.slice().forEach(function(category) {
return result.concat(methodName, getMethodsByCategory(methodName)); var result = getMethodsByCategory(category);
}, []);
// remove nonexistent and duplicate method names // limit category methods to those available for specific builds
if (isBackbone) {
result = result.filter(function(methodName) {
return _.contains(backboneDependencies, methodName);
});
}
else if (isUnderscore) {
result = result.filter(function(methodName) {
return _.contains(underscoreMethods, methodName);
});
}
if (result.length) {
methodNames = _.without(methodNames, category);
push.apply(methodNames, result);
}
});
// expand aliases and remove nonexistent and duplicate method names
methodNames = _.uniq(_.intersection(allMethods, expandMethodNames(methodNames))); methodNames = _.uniq(_.intersection(allMethods, expandMethodNames(methodNames)));
if (!exposeAssign) { if (!exposeAssign) {
methodNames = _.without(methodNames, 'assign'); methodNames = _.without(methodNames, 'assign');
} }
if (!exposeZipObject) {
methodNames = _.without(methodNames, 'zipObject');
}
var lodash = context._ || {}; var lodash = context._ || {};
methodNames.forEach(function(methodName) { methodNames.forEach(function(methodName) {
testMethod(lodash, methodName, basename); testMethod(lodash, methodName, basename);
@@ -1317,8 +1474,6 @@
process.exit(QUnit.config.stats.bad ? 1 : 0); process.exit(QUnit.config.stats.bad ? 1 : 0);
}, timeLimit); }, timeLimit);
} }
// explicitly call `QUnit.start()` for Narwhal, Node.js, Rhino, and RingoJS QUnit.config.noglobals = true;
if (!global.document) { QUnit.start();
QUnit.start();
}
}()); }());

View File

@@ -15,40 +15,39 @@
); );
var last = result[result.length - 1]; var last = result[result.length - 1];
result = (result.length > min && last != 'test.js') ? last : '../lodash.js'; result = (result.length > min && !/test(?:\.js)?$/.test(last))
? last
: '../lodash.js';
try { try {
result = require('fs').realpathSync(result); return require('fs').realpathSync(result);
} catch(e) { } } catch(e) {
return result;
return result; }
}()); }());
/** The basename of the Lo-Dash file to test */ /** The basename of the Lo-Dash file to test */
var basename = /[\w.-]+$/.exec(filePath)[0]; var basename = /[\w.-]+$/.exec(filePath)[0];
/** The `platform` object to check */
var platform =
window.platform ||
load('../vendor/platform.js/platform.js') ||
window.platform;
/** The unit testing framework */ /** The unit testing framework */
var QUnit = var QUnit = (function() {
window.QUnit || ( var noop = Function.prototype;
window.addEventListener || (window.addEventListener = Function.prototype), return window.QUnit || (
window.setTimeout || (window.setTimeout = Function.prototype), window.addEventListener || (window.addEventListener = noop),
window.setTimeout || (window.setTimeout = noop),
window.QUnit = load('../vendor/qunit/qunit/qunit.js') || window.QUnit, window.QUnit = load('../vendor/qunit/qunit/qunit.js') || window.QUnit,
load('../vendor/qunit-clib/qunit-clib.js'), (load('../vendor/qunit-clib/qunit-clib.js') || { 'runInContext': noop }).runInContext(window),
window.addEventListener === Function.prototype && delete window.addEventListener, addEventListener === noop && delete window.addEventListener,
window.QUnit window.QUnit
); );
}());
/** The `lodash` function to test */ /** The `lodash` function to test */
var _ = window._ || ( var _ = window._ || (window._ = (
_ = load(filePath) || window._, _ = load(filePath) || window._,
_._ || _ _ = _._ || _,
); _.runInContext(window)
));
/** Used to pass falsey values to methods */ /** Used to pass falsey values to methods */
var falsey = [ var falsey = [
@@ -65,29 +64,20 @@
var freeze = Object.freeze; var freeze = Object.freeze;
/** Used to set property descriptors */ /** Used to set property descriptors */
var setDescriptor = (function(fn) { var setDescriptor = (function() {
try { try {
var o = {}; var o = {},
return fn(o, o, o) && fn; fn = Object.defineProperty,
result = fn(o, o, o) && fn;
} catch(e) { } } catch(e) { }
}(Object.defineProperty)); return result;
}());
/** Shortcut used to convert array-like objects to arrays */ /** Shortcut used to convert array-like objects to arrays */
var slice = [].slice; 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 shadowed = { var shadowedProps = [
'constructor': 1,
'hasOwnProperty': 2,
'isPrototypeOf': 3,
'propertyIsEnumerable': 4,
'toLocaleString': 5,
'toString': 6,
'valueOf': 7
};
/** Used to check problem JScript properties too */
var shadowedKeys = [
'constructor', 'constructor',
'hasOwnProperty', 'hasOwnProperty',
'isPrototypeOf', 'isPrototypeOf',
@@ -97,6 +87,9 @@
'valueOf' 'valueOf'
]; ];
/** Used to check problem JScript properties too */
var shadowedObject = _.invert(shadowedProps);
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
/** /**
@@ -178,8 +171,8 @@
ok(_() instanceof _); ok(_() instanceof _);
}); });
test('should return passed LoDash instances', function() { test('should return passed `lodash` instances', function() {
var wrapped = _([]); var wrapped = _(false);
equal(_(wrapped), wrapped); equal(_(wrapped), wrapped);
}); });
}()); }());
@@ -252,6 +245,10 @@
ok(new bound instanceof func); ok(new bound instanceof func);
}); });
test('should throw a TypeError if `func` is not a function', function() {
raises(function() { _.bind(); }, TypeError);
});
}()); }());
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
@@ -406,10 +403,10 @@
}); });
test('should clone problem JScript properties (test in IE < 9)', function() { test('should clone problem JScript properties (test in IE < 9)', function() {
deepEqual(_.clone(shadowed), shadowed); deepEqual(_.clone(shadowedObject), shadowedObject);
notEqual(_.clone(shadowed), shadowed); notEqual(_.clone(shadowedObject), shadowedObject);
deepEqual(_.cloneDeep(shadowed), shadowed); deepEqual(_.cloneDeep(shadowedObject), shadowedObject);
notEqual(_.cloneDeep(shadowed), shadowed); notEqual(_.cloneDeep(shadowedObject), shadowedObject);
}); });
_.each([ _.each([
@@ -678,8 +675,6 @@
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
QUnit.module('lodash.find');
(function() { (function() {
var objects = [ var objects = [
{ 'a': 0, 'b': 0 }, { 'a': 0, 'b': 0 },
@@ -687,20 +682,31 @@
{ 'a': 2, 'b': 2 } { 'a': 2, 'b': 2 }
]; ];
test('should return found `value`', function() { _.each({
equal(_.find(objects, function(object) { return object.a == 1; }), objects[1]); 'find': [objects[1], undefined, objects[2], objects[1]],
}); 'findIndex': [1, -1, 2, 1],
'findKey': ['1', undefined, '2', '1']
},
function(expected, methodName) {
QUnit.module('lodash.' + methodName);
test('should return `undefined` if `value` is not found', function() { var func = _[methodName];
equal(_.find(objects, function(object) { return object.a == 3; }), undefined);
});
test('should work with an object for `callback`', function() { test('should return the correct value', function() {
equal(_.find(objects, { 'b': 2 }), objects[2]); strictEqual(func(objects, function(object) { return object.a == 1; }), expected[0]);
}); });
test('should work with a string for `callback`', function() { test('should return `' + expected[1] + '` if value is not found', function() {
equal(_.find(objects, 'b'), objects[1]); strictEqual(func(objects, function(object) { return object.a == 3; }), expected[1]);
});
test('should work with an object for `callback`', function() {
strictEqual(func(objects, { 'b': 2 }), expected[2]);
});
test('should work with a string for `callback`', function() {
strictEqual(func(objects, 'b'), expected[3]);
});
}); });
}()); }());
@@ -788,6 +794,46 @@
QUnit.module('lodash.flatten'); QUnit.module('lodash.flatten');
(function() { (function() {
var array = [{ 'a': [1, [2]] }, { 'a': [3] }];
test('should work with a `callback`', function() {
var actual = _.flatten(array, function(value) {
return value.a;
});
deepEqual(actual, [1, 2, 3]);
});
test('should work with `isShallow` and `callback`', function() {
var actual = _.flatten(array, true, function(value) {
return value.a;
});
deepEqual(actual, [1, [2], 3]);
});
test('should pass the correct `callback` arguments', function() {
var args;
_.flatten(array, function() {
args || (args = slice.call(arguments));
});
deepEqual(args, [{ 'a': [1, [2]] }, 0, array]);
});
test('supports the `thisArg` argument', function() {
var actual = _.flatten(array, function(value, index) {
return this[index].a;
}, array);
deepEqual(actual, [1, 2, 3]);
});
test('should work with a string for `callback`', function() {
deepEqual(_.flatten(array, 'a'), [1, 2, 3]);
});
test('should treat sparse arrays as dense', function() { test('should treat sparse arrays as dense', function() {
var array = [[1, 2, 3], Array(3)], var array = [[1, 2, 3], Array(3)],
expected = [1, 2, 3], expected = [1, 2, 3],
@@ -809,11 +855,16 @@
QUnit.module('lodash.forEach'); QUnit.module('lodash.forEach');
(function() { (function() {
test('returns the collection', function() { test('should return the collection', function() {
var collection = [1, 2, 3]; var collection = [1, 2, 3];
equal(_.forEach(collection, Boolean), collection); equal(_.forEach(collection, Boolean), collection);
}); });
test('should return the existing wrapper when chaining', function() {
var wrapper = _([1, 2, 3]);
equal(wrapper.forEach(Boolean), wrapper);
});
_.each({ _.each({
'literal': 'abc', 'literal': 'abc',
'object': Object('abc') 'object': Object('abc')
@@ -872,8 +923,8 @@
test('lodash.' + methodName + ' fixes the JScript [[DontEnum]] bug (test in IE < 9)', function() { test('lodash.' + methodName + ' fixes the JScript [[DontEnum]] bug (test in IE < 9)', function() {
var keys = []; var keys = [];
func(shadowed, function(value, key) { keys.push(key); }); func(shadowedObject, function(value, key) { keys.push(key); });
deepEqual(keys.sort(), shadowedKeys); deepEqual(keys.sort(), shadowedProps);
}); });
test('lodash.' + methodName + ' skips the prototype property of functions (test in Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1)', function() { test('lodash.' + methodName + ' skips the prototype property of functions (test in Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1)', function() {
@@ -900,11 +951,17 @@
_.each(['assign', 'defaults', 'merge'], function(methodName) { _.each(['assign', 'defaults', 'merge'], function(methodName) {
var func = _[methodName]; var func = _[methodName];
test('should return the existing wrapper when chaining', function() {
var wrapper = _({ 'a': 1 });
equal(wrapper[methodName]({ 'b': 2 }), wrapper);
});
test('lodash.' + methodName + ' should assign problem JScript properties (test in IE < 9)', function() { test('lodash.' + methodName + ' should assign problem JScript properties (test in IE < 9)', function() {
var object = { var object = {
'constructor': 1, 'constructor': '0',
'hasOwnProperty': 2, 'hasOwnProperty': '1',
'isPrototypeOf': 3, 'isPrototypeOf': '2',
'propertyIsEnumerable': undefined, 'propertyIsEnumerable': undefined,
'toLocaleString': undefined, 'toLocaleString': undefined,
'toString': undefined, 'toString': undefined,
@@ -912,13 +969,13 @@
}; };
var source = { var source = {
'propertyIsEnumerable': 4, 'propertyIsEnumerable': '3',
'toLocaleString': 5, 'toLocaleString': '4',
'toString': 6, 'toString': '5',
'valueOf': 7 'valueOf': '6'
}; };
deepEqual(func(object, source), shadowed); deepEqual(func(object, source), shadowedObject);
}); });
test('lodash.' + methodName + ' skips the prototype property of functions (test in Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1)', function() { test('lodash.' + methodName + ' skips the prototype property of functions (test in Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1)', function() {
@@ -1184,7 +1241,7 @@
var args = arguments; var args = arguments;
test('fixes the JScript [[DontEnum]] bug (test in IE < 9)', function() { test('fixes the JScript [[DontEnum]] bug (test in IE < 9)', function() {
equal(_.isEmpty(shadowed), false); equal(_.isEmpty(shadowedObject), false);
}); });
test('skips the prototype property of functions (test in Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1)', function() { test('skips the prototype property of functions (test in Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1)', function() {
@@ -1227,7 +1284,7 @@
}); });
test('fixes the JScript [[DontEnum]] bug (test in IE < 9)', function() { test('fixes the JScript [[DontEnum]] bug (test in IE < 9)', function() {
strictEqual(_.isEqual(shadowed, {}), false); strictEqual(_.isEqual(shadowedObject, {}), false);
}); });
test('should return `true` for like-objects from different documents', function() { test('should return `true` for like-objects from different documents', function() {
@@ -1362,6 +1419,13 @@
strictEqual(_.isPlainObject([1, 2, 3]), false); strictEqual(_.isPlainObject([1, 2, 3]), false);
strictEqual(_.isPlainObject({ 'a': 1 }), true); strictEqual(_.isPlainObject({ 'a': 1 }), true);
}); });
test('should return `false` for objects without a [[Class]] of "Object"', function() {
strictEqual(_.isPlainObject(arguments), false);
strictEqual(_.isPlainObject(Error), false);
strictEqual(_.isPlainObject(Math), false);
strictEqual(_.isPlainObject(window), false);
})
}()); }());
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
@@ -1426,7 +1490,7 @@
Foo.prototype.a = 1; Foo.prototype.a = 1;
deepEqual(_.keys(Foo.prototype), ['a']); deepEqual(_.keys(Foo.prototype), ['a']);
deepEqual(_.keys(shadowed).sort(), shadowedKeys); deepEqual(_.keys(shadowedObject).sort(), shadowedProps);
}); });
test('skips the prototype property of functions (test in Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1)', function() { test('skips the prototype property of functions (test in Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1)', function() {
@@ -1759,6 +1823,22 @@
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
QUnit.module('lodash.parseInt');
(function() {
test('should parse strings with leading zeros with a `radix` of 10 by default (test in Firefox and Opera)', function() {
equal(_.parseInt('08'), 8);
});
test('should internally use a radix of 10 if `radix` is `undefined` or `0`', function() {
equal(_.parseInt('10', 0), 10);
equal(_.parseInt('10'), 10);
equal(_.parseInt('10', undefined), 10);
});
}());
/*--------------------------------------------------------------------------*/
QUnit.module('partial methods'); QUnit.module('partial methods');
_.each(['partial', 'partialRight'], function(methodName) { _.each(['partial', 'partialRight'], function(methodName) {
@@ -2106,6 +2186,25 @@
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
QUnit.module('lodash.runInContext');
(function() {
test('should not require a fully populated `context` object', function() {
var pass = false;
var lodash = _.runInContext({
'setTimeout': function(callback) {
callback();
}
});
lodash.delay(function() { pass = true; }, 32);
ok(pass);
});
}());
/*--------------------------------------------------------------------------*/
QUnit.module('lodash.shuffle'); QUnit.module('lodash.shuffle');
(function() { (function() {
@@ -2143,7 +2242,7 @@
}); });
test('fixes the JScript [[DontEnum]] bug (test in IE < 9)', function() { test('fixes the JScript [[DontEnum]] bug (test in IE < 9)', function() {
equal(_.size(shadowed), 7); equal(_.size(shadowedObject), 7);
}); });
_.each({ _.each({
@@ -2157,7 +2256,6 @@
}); });
}(1, 2, 3)); }(1, 2, 3));
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
QUnit.module('lodash.some'); QUnit.module('lodash.some');
@@ -2242,6 +2340,36 @@
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
QUnit.module('lodash.support');
(function() {
test('should contain properties with boolean values', function() {
var props = [
'argsObject',
'argsClass',
'enumPrototypes',
'fastBind',
'fastKeys',
'ownLast',
'nonEnumArgs',
'nonEnumShadows',
'spliceObjects',
'unindexedChars',
'nodeClass'
];
_.each(props, function(prop) {
if (_.has(_.support, prop)) {
equal(typeof _.support[prop], 'boolean');
} else {
skipTest();
}
});
});
}());
/*--------------------------------------------------------------------------*/
QUnit.module('lodash.template'); QUnit.module('lodash.template');
(function() { (function() {
@@ -2351,7 +2479,7 @@
}); });
test('should work with "interpolate" delimiters containing global values', function() { test('should work with "interpolate" delimiters containing global values', function() {
var compiled = _.template('<%= typeof QUnit.init %>'); var compiled = _.template('<%= typeof Math.abs %>');
try { try {
var actual = compiled(); var actual = compiled();
@@ -2395,18 +2523,24 @@
}); });
test('should clear timeout when `func` is called', function() { test('should clear timeout when `func` is called', function() {
var counter = 0, var callCount = 0,
oldDate = Date, dateCount = 0;
throttled = _.throttle(function() { counter++; }, 32);
var lodash = _.runInContext(_.extend({}, window, {
'Date': function() {
return ++dateCount < 3 ? new Date : Object(Infinity);
}
}));
var throttled = lodash.throttle(function() {
callCount++;
}, 32);
throttled(); throttled();
throttled(); throttled();
window.Date = function() { return Object(Infinity); };
throttled(); throttled();
window.Date = oldDate;
equal(counter, 2); equal(callCount, 2);
}); });
asyncTest('supports recursive calls', function() { asyncTest('supports recursive calls', function() {
@@ -2510,6 +2644,20 @@
test('should return an array of the results of each `callback` execution', function() { test('should return an array of the results of each `callback` execution', function() {
deepEqual(_.times(3, function(n) { return n * 2; }), [0, 2, 4]); deepEqual(_.times(3, function(n) { return n * 2; }), [0, 2, 4]);
}); });
test('should coerce `n` to a number', function() {
deepEqual(_.times(null), []);
});
test('should not error on negative `n` values', function() {
var pass = true;
try {
_.times(-1);
} catch(e) {
pass = false;
}
ok(pass);
});
}()); }());
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
@@ -2557,6 +2705,18 @@
deepEqual(actual, expected); deepEqual(actual, expected);
}); });
_.each({
'an object': ['a'],
'a number': 0,
'a string': '0'
},
function(callback, key) {
test('should work with ' + key + ' for `callback`', function() {
var actual = _.uniq([['a'], ['b'], ['a']], callback);
deepEqual(actual, [['a'], ['b']]);
});
});
}()); }());
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
@@ -2606,8 +2766,8 @@
}); });
test('should filter by problem JScript properties (test in IE < 9)', function() { test('should filter by problem JScript properties (test in IE < 9)', function() {
var collection = [shadowed]; var collection = [shadowedObject];
deepEqual(_.where(collection, shadowed), [shadowed]); deepEqual(_.where(collection, shadowedObject), [shadowedObject]);
}); });
test('should work with an object for `collection`', function() { test('should work with an object for `collection`', function() {
@@ -2796,21 +2956,39 @@
oldDash = window._; oldDash = window._;
var returnArrays = [ var returnArrays = [
'at',
'compact',
'difference',
'filter', 'filter',
'flatten',
'functions',
'initial',
'intersection',
'invoke', 'invoke',
'keys',
'map', 'map',
'pairs',
'pluck', 'pluck',
'range',
'reject', 'reject',
'rest',
'shuffle', 'shuffle',
'sortBy', 'sortBy',
'times',
'toArray', 'toArray',
'where' 'union',
'uniq',
'values',
'where',
'without',
'zip'
]; ];
var funcs = _.without.apply(_, [_.functions(_)].concat([ var allMethods = _.reject(_.functions(_), function(methodName) {
'_', return /^_/.test(methodName);
'_each', });
'_iteratorTemplate',
var funcs = _.without.apply(_, [allMethods].concat([
'after', 'after',
'bind', 'bind',
'bindAll', 'bindAll',
@@ -2822,6 +3000,7 @@
'memoize', 'memoize',
'once', 'once',
'partial', 'partial',
'partialRight',
'tap', 'tap',
'throttle', 'throttle',
'wrap' 'wrap'
@@ -2829,10 +3008,13 @@
_.each(funcs, function(methodName) { _.each(funcs, function(methodName) {
var actual = [], var actual = [],
expected = _.times(falsey.length, 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());
@@ -2912,7 +3094,8 @@
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
// configure QUnit and call `QUnit.start()` for Narwhal, Node.js, PhantomJS, Rhino, and RingoJS // configure QUnit and call `QUnit.start()` for
// Narwhal, Node.js, PhantomJS, Rhino, and RingoJS
if (!window.document || window.phantom) { if (!window.document || window.phantom) {
QUnit.config.noglobals = true; QUnit.config.noglobals = true;
QUnit.start(); QUnit.start();

View File

@@ -1,4 +1,4 @@
Copyright (c) 2010-2012 Jeremy Ashkenas, DocumentCloud Copyright (c) 2010-2013 Jeremy Ashkenas, DocumentCloud
Permission is hereby granted, free of charge, to any person Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation obtaining a copy of this software and associated documentation
@@ -19,4 +19,4 @@ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE. OTHER DEALINGS IN THE SOFTWARE.

File diff suppressed because it is too large Load Diff

View File

@@ -62,30 +62,29 @@ $(document).ready(function() {
strictEqual(collection.last().get('a'), 4); strictEqual(collection.last().get('a'), 4);
}); });
test("get", 5, function() { test("get", 6, function() {
equal(col.get(0), d); equal(col.get(0), d);
equal(col.get(d.clone()), d);
equal(col.get(2), b); equal(col.get(2), b);
equal(col.get({id: 1}), c); equal(col.get({id: 1}), c);
equal(col.get(c.clone()), c); equal(col.get(c.clone()), c);
equal(col.get(col.first().cid), col.first()); equal(col.get(col.first().cid), col.first());
}); });
test("get with non-default ids", 4, function() { test("get with non-default ids", 5, function() {
var col = new Backbone.Collection(); var col = new Backbone.Collection();
var MongoModel = Backbone.Model.extend({ var MongoModel = Backbone.Model.extend({idAttribute: '_id'});
idAttribute: '_id'
});
var model = new MongoModel({_id: 100}); var model = new MongoModel({_id: 100});
col.push(model); col.add(model);
equal(col.get(100), model); equal(col.get(100), model);
model.set({_id: 101}); equal(col.get(model.cid), model);
equal(col.get(101), model); equal(col.get(model), model);
equal(col.get(101), void 0);
var Col2 = Backbone.Collection.extend({ model: MongoModel }); var col2 = new Backbone.Collection();
var col2 = new Col2(); col2.model = MongoModel;
col2.push(model); col2.add(model.attributes);
equal(col2.get({_id: 101}), model); equal(col2.get(model.clone()), col2.first());
equal(col2.get(model.clone()), model);
}); });
test("update index when id changes", 3, function() { test("update index when id changes", 3, function() {
@@ -226,6 +225,19 @@ $(document).ready(function() {
equal(col.at(0).get('value'), 2); equal(col.at(0).get('value'), 2);
}); });
test("add with parse and merge", function() {
var Model = Backbone.Model.extend({
parse: function (data) {
return data.model;
}
});
var collection = new Backbone.Collection();
collection.model = Model;
collection.add({id: 1});
collection.add({model: {id: 1, name: 'Alf'}}, {parse: true, merge: true});
equal(collection.first().get('name'), 'Alf');
});
test("add model to collection with sort()-style comparator", 3, function() { test("add model to collection with sort()-style comparator", 3, function() {
var col = new Backbone.Collection; var col = new Backbone.Collection;
col.comparator = function(a, b) { col.comparator = function(a, b) {
@@ -362,9 +374,7 @@ $(document).ready(function() {
test("model destroy removes from all collections", 3, function() { test("model destroy removes from all collections", 3, function() {
var e = new Backbone.Model({id: 5, title: 'Othello'}); var e = new Backbone.Model({id: 5, title: 'Othello'});
e.sync = function(method, model, options) { e.sync = function(method, model, options) { options.success(); };
options.success(model, [], options);
};
var colE = new Backbone.Collection([e]); var colE = new Backbone.Collection([e]);
var colF = new Backbone.Collection([e]); var colF = new Backbone.Collection([e]);
e.destroy(); e.destroy();
@@ -396,6 +406,15 @@ $(document).ready(function() {
equal(this.syncArgs.options.parse, false); equal(this.syncArgs.options.parse, false);
}); });
test("fetch with an error response triggers an error event", 1, function () {
var collection = new Backbone.Collection();
collection.on('error', function () {
ok(true);
});
collection.sync = function (method, model, options) { options.error(); };
collection.fetch();
});
test("ensure fetch only parses once", 1, function() { test("ensure fetch only parses once", 1, function() {
var collection = new Backbone.Collection; var collection = new Backbone.Collection;
var counter = 0; var counter = 0;
@@ -405,7 +424,7 @@ $(document).ready(function() {
}; };
collection.url = '/test'; collection.url = '/test';
collection.fetch(); collection.fetch();
this.syncArgs.options.success([]); this.syncArgs.options.success();
equal(counter, 1); equal(counter, 1);
}); });
@@ -419,7 +438,7 @@ $(document).ready(function() {
equal(model.collection, collection); equal(model.collection, collection);
}); });
test("create with validate:true enforces validation", 1, function() { test("create with validate:true enforces validation", 2, function() {
var ValidatingModel = Backbone.Model.extend({ var ValidatingModel = Backbone.Model.extend({
validate: function(attrs) { validate: function(attrs) {
return "fail"; return "fail";
@@ -429,6 +448,9 @@ $(document).ready(function() {
model: ValidatingModel model: ValidatingModel
}); });
var col = new ValidatingCollection(); var col = new ValidatingCollection();
col.on('invalid', function (collection, attrs, options) {
equal(options.validationError, 'fail');
});
equal(col.create({"foo":"bar"}, {validate:true}), false); equal(col.create({"foo":"bar"}, {validate:true}), false);
}); });
@@ -461,9 +483,10 @@ $(document).ready(function() {
equal(JSON.stringify(col), '[{"id":3,"label":"a"},{"id":2,"label":"b"},{"id":1,"label":"c"},{"id":0,"label":"d"}]'); equal(JSON.stringify(col), '[{"id":3,"label":"a"},{"id":2,"label":"b"},{"id":1,"label":"c"},{"id":0,"label":"d"}]');
}); });
test("where", 6, function() { test("where and findWhere", 8, function() {
var model = new Backbone.Model({a: 1});
var coll = new Backbone.Collection([ var coll = new Backbone.Collection([
{a: 1}, model,
{a: 1}, {a: 1},
{a: 1, b: 2}, {a: 1, b: 2},
{a: 2, b: 2}, {a: 2, b: 2},
@@ -475,6 +498,8 @@ $(document).ready(function() {
equal(coll.where({b: 1}).length, 0); equal(coll.where({b: 1}).length, 0);
equal(coll.where({b: 2}).length, 2); equal(coll.where({b: 2}).length, 2);
equal(coll.where({a: 1, b: 2}).length, 1); equal(coll.where({a: 1, b: 2}).length, 1);
equal(coll.findWhere({a: 1}), model);
equal(coll.findWhere({a: 4}), void 0);
}); });
test("Underscore methods", 13, function() { test("Underscore methods", 13, function() {
@@ -484,10 +509,10 @@ $(document).ready(function() {
equal(col.indexOf(b), 1); equal(col.indexOf(b), 1);
equal(col.size(), 4); equal(col.size(), 4);
equal(col.rest().length, 3); equal(col.rest().length, 3);
ok(!_.include(col.rest()), a); ok(!_.include(col.rest(), a));
ok(!_.include(col.rest()), d); ok(_.include(col.rest(), d));
ok(!col.isEmpty()); ok(!col.isEmpty());
ok(!_.include(col.without(d)), d); ok(!_.include(col.without(d), d));
equal(col.max(function(model){ return model.id; }).id, 3); equal(col.max(function(model){ return model.id; }).id, 3);
equal(col.min(function(model){ return model.id; }).id, 0); equal(col.min(function(model){ return model.id; }).id, 0);
deepEqual(col.chain() deepEqual(col.chain()
@@ -509,9 +534,9 @@ $(document).ready(function() {
}), 1); }), 1);
}); });
test("reset", 10, function() { test("reset", 12, function() {
var resetCount = 0; var resetCount = 0;
var models = col.models.slice(); var models = col.models;
col.on('reset', function() { resetCount += 1; }); col.on('reset', function() { resetCount += 1; });
col.reset([]); col.reset([]);
equal(resetCount, 1); equal(resetCount, 1);
@@ -526,6 +551,22 @@ $(document).ready(function() {
equal(col.length, 4); equal(col.length, 4);
ok(col.last() !== d); ok(col.last() !== d);
ok(_.isEqual(col.last().attributes, d.attributes)); ok(_.isEqual(col.last().attributes, d.attributes));
col.reset();
equal(col.length, 0);
equal(resetCount, 4);
});
test ("reset with different values", function(){
var col = new Backbone.Collection({id: 1});
col.reset({id: 1, a: 1});
equal(col.get(1).get('a'), 1);
});
test("same references in reset", function() {
var model = new Backbone.Model({id: 1});
var collection = new Backbone.Collection({id: 1});
collection.reset(model);
equal(collection.get(1), model);
}); });
test("reset passes caller options", 3, function() { test("reset passes caller options", 3, function() {
@@ -702,9 +743,7 @@ $(document).ready(function() {
test("#1447 - create with wait adds model.", 1, function() { test("#1447 - create with wait adds model.", 1, function() {
var collection = new Backbone.Collection; var collection = new Backbone.Collection;
var model = new Backbone.Model; var model = new Backbone.Model;
model.sync = function(method, model, options){ model.sync = function(method, model, options){ options.success(); };
options.success(model, [], options);
};
collection.on('add', function(){ ok(true); }); collection.on('add', function(){ ok(true); });
collection.create(model, {wait: true}); collection.create(model, {wait: true});
}); });
@@ -834,7 +873,7 @@ $(document).ready(function() {
collection.reset([]); collection.reset([]);
}); });
test("update", function() { test("set", function() {
var m1 = new Backbone.Model(); var m1 = new Backbone.Model();
var m2 = new Backbone.Model({id: 2}); var m2 = new Backbone.Model({id: 2});
var m3 = new Backbone.Model(); var m3 = new Backbone.Model();
@@ -852,24 +891,24 @@ $(document).ready(function() {
}); });
// remove: false doesn't remove any models // remove: false doesn't remove any models
c.update([], {remove: false}); c.set([], {remove: false});
strictEqual(c.length, 2); strictEqual(c.length, 2);
// add: false doesn't add any models // add: false doesn't add any models
c.update([m1, m2, m3], {add: false}); c.set([m1, m2, m3], {add: false});
strictEqual(c.length, 2); strictEqual(c.length, 2);
// merge: false doesn't change any models // merge: false doesn't change any models
c.update([m1, {id: 2, a: 1}], {merge: false}); c.set([m1, {id: 2, a: 1}], {merge: false});
strictEqual(m2.get('a'), void 0); strictEqual(m2.get('a'), void 0);
// add: false, remove: false only merges existing models // add: false, remove: false only merges existing models
c.update([m1, {id: 2, a: 0}, m3, {id: 4}], {add: false, remove: false}); c.set([m1, {id: 2, a: 0}, m3, {id: 4}], {add: false, remove: false});
strictEqual(c.length, 2); strictEqual(c.length, 2);
strictEqual(m2.get('a'), 0); strictEqual(m2.get('a'), 0);
// default options add/remove/merge as appropriate // default options add/remove/merge as appropriate
c.update([{id: 2, a: 1}, m3]); c.set([{id: 2, a: 1}, m3]);
strictEqual(c.length, 2); strictEqual(c.length, 2);
strictEqual(m2.get('a'), 1); strictEqual(m2.get('a'), 1);
@@ -877,23 +916,23 @@ $(document).ready(function() {
c.off('remove').on('remove', function(model) { c.off('remove').on('remove', function(model) {
ok(model === m2 || model === m3); ok(model === m2 || model === m3);
}); });
c.update([]); c.set([]);
strictEqual(c.length, 0); strictEqual(c.length, 0);
}); });
test("update with only cids", 3, function() { test("set with only cids", 3, function() {
var m1 = new Backbone.Model; var m1 = new Backbone.Model;
var m2 = new Backbone.Model; var m2 = new Backbone.Model;
var c = new Backbone.Collection; var c = new Backbone.Collection;
c.update([m1, m2]); c.set([m1, m2]);
equal(c.length, 2); equal(c.length, 2);
c.update([m1]); c.set([m1]);
equal(c.length, 1); equal(c.length, 1);
c.update([m1, m1, m1, m2, m2], {remove: false}); c.set([m1, m1, m1, m2, m2], {remove: false});
equal(c.length, 2); equal(c.length, 2);
}); });
test("update with only idAttribute", 3, function() { test("set with only idAttribute", 3, function() {
var m1 = { _id: 1 }; var m1 = { _id: 1 };
var m2 = { _id: 2 }; var m2 = { _id: 2 };
var col = Backbone.Collection.extend({ var col = Backbone.Collection.extend({
@@ -902,15 +941,15 @@ $(document).ready(function() {
}) })
}); });
var c = new col; var c = new col;
c.update([m1, m2]); c.set([m1, m2]);
equal(c.length, 2); equal(c.length, 2);
c.update([m1]); c.set([m1]);
equal(c.length, 1); equal(c.length, 1);
c.update([m1, m1, m1, m2, m2], {remove: false}); c.set([m1, m1, m1, m2, m2], {remove: false});
equal(c.length, 2); equal(c.length, 2);
}); });
test("update + merge with default values defined", function() { test("set + merge with default values defined", function() {
var Model = Backbone.Model.extend({ var Model = Backbone.Model.extend({
defaults: { defaults: {
key: 'value' key: 'value'
@@ -920,14 +959,43 @@ $(document).ready(function() {
var col = new Backbone.Collection([m], {model: Model}); var col = new Backbone.Collection([m], {model: Model});
equal(col.first().get('key'), 'value'); equal(col.first().get('key'), 'value');
col.update({id: 1, key: 'other'}); col.set({id: 1, key: 'other'});
equal(col.first().get('key'), 'other'); equal(col.first().get('key'), 'other');
col.update({id: 1, other: 'value'}); col.set({id: 1, other: 'value'});
equal(col.first().get('key'), 'other'); equal(col.first().get('key'), 'value');
equal(col.length, 1); equal(col.length, 1);
}); });
test("`set` and model level `parse`", function() {
var Model = Backbone.Model.extend({
parse: function (res) { return res.model; }
});
var Collection = Backbone.Collection.extend({
model: Model,
parse: function (res) { return res.models; }
});
var model = new Model({id: 1});
var collection = new Collection(model);
collection.set({models: [
{model: {id: 1}},
{model: {id: 2}}
]}, {parse: true});
equal(collection.first(), model);
});
test("`set` data is only parsed once", function() {
var collection = new Backbone.Collection();
collection.model = Backbone.Model.extend({
parse: function (data) {
equal(data.parsed, void 0);
data.parsed = true;
return data;
}
});
collection.set({}, {parse: true});
});
test("#1894 - Push should not trigger a sort", 0, function() { test("#1894 - Push should not trigger a sort", 0, function() {
var Collection = Backbone.Collection.extend({ var Collection = Backbone.Collection.extend({
comparator: 'id', comparator: 'id',
@@ -938,12 +1006,12 @@ $(document).ready(function() {
new Collection().push({id: 1}); new Collection().push({id: 1});
}); });
test("`update` with non-normal id", function() { test("`set` with non-normal id", function() {
var Collection = Backbone.Collection.extend({ var Collection = Backbone.Collection.extend({
model: Backbone.Model.extend({idAttribute: '_id'}) model: Backbone.Model.extend({idAttribute: '_id'})
}); });
var collection = new Collection({_id: 1}); var collection = new Collection({_id: 1});
collection.update([{_id: 1, a: 1}], {add: false}); collection.set([{_id: 1, a: 1}], {add: false});
equal(collection.first().get('a'), 1); equal(collection.first().get('a'), 1);
}); });
@@ -955,7 +1023,7 @@ $(document).ready(function() {
new Collection().add({id: 1}, {sort: false}); new Collection().add({id: 1}, {sort: false});
}); });
test("#1915 - `parse` data in the right order in `update`", function() { test("#1915 - `parse` data in the right order in `set`", function() {
var collection = new (Backbone.Collection.extend({ var collection = new (Backbone.Collection.extend({
parse: function (data) { parse: function (data) {
strictEqual(data.status, 'ok'); strictEqual(data.status, 'ok');
@@ -963,7 +1031,7 @@ $(document).ready(function() {
} }
})); }));
var res = {status: 'ok', data:[{id: 1}]}; var res = {status: 'ok', data:[{id: 1}]};
collection.update(res, {parse: true}); collection.set(res, {parse: true});
}); });
asyncTest("#1939 - `parse` is passed `options`", 1, function () { asyncTest("#1939 - `parse` is passed `options`", 1, function () {
@@ -1001,7 +1069,7 @@ $(document).ready(function() {
test("`add` only `sort`s when necessary with comparator function", 3, function () { test("`add` only `sort`s when necessary with comparator function", 3, function () {
var collection = new (Backbone.Collection.extend({ var collection = new (Backbone.Collection.extend({
comparator: function(a, b) { comparator: function(a, b) {
a.get('a') > b.get('a') ? 1 : (a.get('a') < b.get('a') ? -1 : 0); return a.get('a') > b.get('a') ? 1 : (a.get('a') < b.get('a') ? -1 : 0);
} }
}))([{id: 1}, {id: 2}, {id: 3}]); }))([{id: 1}, {id: 2}, {id: 3}]);
collection.on('sort', function () { ok(true); }); collection.on('sort', function () { ok(true); });
@@ -1013,4 +1081,20 @@ $(document).ready(function() {
collection.add(collection.models, {merge: true}); // don't sort collection.add(collection.models, {merge: true}); // don't sort
}); });
test("Attach options to collection.", 3, function() {
var url = '/somewhere';
var model = new Backbone.Model;
var comparator = function(){};
var collection = new Backbone.Collection([], {
url: url,
model: model,
comparator: comparator
});
strictEqual(collection.url, url);
ok(collection.model === model);
ok(collection.comparator === comparator);
});
}); });

View File

@@ -99,6 +99,43 @@ $(document).ready(function() {
a.listenTo(b, 'event2', cb); a.listenTo(b, 'event2', cb);
a.stopListening(null, {event: cb}); a.stopListening(null, {event: cb});
b.trigger('event event2'); b.trigger('event event2');
b.off();
a.listenTo(b, 'event event2', cb);
a.stopListening(null, 'event');
a.stopListening();
b.trigger('event2');
});
test("listenToOnce and stopListening", 1, function() {
var a = _.extend({}, Backbone.Events);
var b = _.extend({}, Backbone.Events);
a.listenToOnce(b, 'all', function() { ok(true); });
b.trigger('anything');
b.trigger('anything');
a.listenToOnce(b, 'all', function() { ok(false); });
a.stopListening();
b.trigger('anything');
});
test("listenTo, listenToOnce and stopListening", 1, function() {
var a = _.extend({}, Backbone.Events);
var b = _.extend({}, Backbone.Events);
a.listenToOnce(b, 'all', function() { ok(true); });
b.trigger('anything');
b.trigger('anything');
a.listenTo(b, 'all', function() { ok(false); });
a.stopListening();
b.trigger('anything');
});
test("listenTo and stopListening with event maps", 1, function() {
var a = _.extend({}, Backbone.Events);
var b = _.extend({}, Backbone.Events);
a.listenTo(b, {change: function(){ ok(true); }});
b.trigger('change');
a.listenTo(b, {change: function(){ ok(false); }});
a.stopListening();
b.trigger('change');
}); });
test("listenTo yourself", 1, function(){ test("listenTo yourself", 1, function(){
@@ -241,6 +278,13 @@ $(document).ready(function() {
_.extend({}, Backbone.Events).on('test').trigger('test'); _.extend({}, Backbone.Events).on('test').trigger('test');
}); });
test("if callback is truthy but not a function, `on` should throw an error just like jQuery", 1, function() {
var view = _.extend({}, Backbone.Events).on('test', 'noop');
throws(function() {
view.trigger('test');
});
});
test("remove all events for a specific context", 4, function() { test("remove all events for a specific context", 4, function() {
var obj = _.extend({}, Backbone.Events); var obj = _.extend({}, Backbone.Events);
obj.on('x y all', function() { ok(true); }); obj.on('x y all', function() { ok(true); });
@@ -259,18 +303,6 @@ $(document).ready(function() {
obj.trigger('x y'); obj.trigger('x y');
}); });
test("off is chainable", 3, function() {
var obj = _.extend({}, Backbone.Events);
// With no events
ok(obj.off() === obj);
// When removing all events
obj.on('event', function(){}, obj);
ok(obj.off() === obj);
// When removing some events
obj.on('event', function(){}, obj);
ok(obj.off('event') === obj);
});
test("#1310 - off does not skip consecutive events", 0, function() { test("#1310 - off does not skip consecutive events", 0, function() {
var obj = _.extend({}, Backbone.Events); var obj = _.extend({}, Backbone.Events);
obj.on('event', function() { ok(false); }, obj); obj.on('event', function() { ok(false); }, obj);
@@ -400,4 +432,21 @@ $(document).ready(function() {
_.extend({}, Backbone.Events).once('event').trigger('event'); _.extend({}, Backbone.Events).once('event').trigger('event');
}); });
test("event functions are chainable", function() {
var obj = _.extend({}, Backbone.Events);
var obj2 = _.extend({}, Backbone.Events);
var fn = function() {};
equal(obj, obj.trigger('noeventssetyet'));
equal(obj, obj.off('noeventssetyet'));
equal(obj, obj.stopListening('noeventssetyet'));
equal(obj, obj.on('a', fn));
equal(obj, obj.once('c', fn));
equal(obj, obj.trigger('a'));
equal(obj, obj.listenTo(obj2, 'a', fn));
equal(obj, obj.listenToOnce(obj2, 'b', fn));
equal(obj, obj.off('a c'));
equal(obj, obj.stopListening(obj2, 'a'));
equal(obj, obj.stopListening());
});
}); });

View File

@@ -46,9 +46,9 @@ $(document).ready(function() {
test("initialize with parsed attributes", 1, function() { test("initialize with parsed attributes", 1, function() {
var Model = Backbone.Model.extend({ var Model = Backbone.Model.extend({
parse: function(obj) { parse: function(attrs) {
obj.value += 1; attrs.value += 1;
return obj; return attrs;
} }
}); });
var model = new Model({value: 1}, {parse: true}); var model = new Model({value: 1}, {parse: true});
@@ -69,8 +69,8 @@ $(document).ready(function() {
test("parse can return null", 1, function() { test("parse can return null", 1, function() {
var Model = Backbone.Model.extend({ var Model = Backbone.Model.extend({
parse: function(obj) { parse: function(attrs) {
obj.value += 1; attrs.value += 1;
return null; return null;
} }
}); });
@@ -111,6 +111,23 @@ $(document).ready(function() {
equal(model.url(), '/nested/1/collection/2'); equal(model.url(), '/nested/1/collection/2');
}); });
test('url and urlRoot are directly attached if passed in the options', 2, function () {
var model = new Backbone.Model({a: 1}, {url: '/test'});
var model2 = new Backbone.Model({a: 2}, {urlRoot: '/test2'});
equal(model.url, '/test');
equal(model2.urlRoot, '/test2');
});
test("underscore methods", 5, function() {
var model = new Backbone.Model({ 'foo': 'a', 'bar': 'b', 'baz': 'c' });
var model2 = model.clone();
deepEqual(model.keys(), ['foo', 'bar', 'baz']);
deepEqual(model.values(), ['a', 'b', 'c']);
deepEqual(model.invert(), { 'a': 'foo', 'b': 'bar', 'c': 'baz' });
deepEqual(model.pick('foo', 'baz'), {'foo': 'a', 'baz': 'c'});
deepEqual(model.omit('foo', 'bar'), {'baz': 'c'});
});
test("clone", 10, function() { test("clone", 10, function() {
var a = new Backbone.Model({ 'foo': 1, 'bar': 2, 'baz': 3}); var a = new Backbone.Model({ 'foo': 1, 'bar': 2, 'baz': 3});
var b = a.clone(); var b = a.clone();
@@ -324,7 +341,7 @@ $(document).ready(function() {
"two": 2 "two": 2
} }
}); });
var model = new Defaulted({two: null}); var model = new Defaulted({two: undefined});
equal(model.get('one'), 1); equal(model.get('one'), 1);
equal(model.get('two'), 2); equal(model.get('two'), 2);
Defaulted = Backbone.Model.extend({ Defaulted = Backbone.Model.extend({
@@ -335,7 +352,7 @@ $(document).ready(function() {
}; };
} }
}); });
model = new Defaulted({two: null}); model = new Defaulted({two: undefined});
equal(model.get('one'), 3); equal(model.get('one'), 3);
equal(model.get('two'), 4); equal(model.get('two'), 4);
}); });
@@ -401,7 +418,7 @@ $(document).ready(function() {
if (attrs.admin) return "Can't change admin status."; if (attrs.admin) return "Can't change admin status.";
}; };
model.sync = function(method, model, options) { model.sync = function(method, model, options) {
options.success.call(this, this, {admin: true}, options); options.success.call(this, {admin: true});
}; };
model.on('invalid', function(model, error) { model.on('invalid', function(model, error) {
lastError = error; lastError = error;
@@ -418,6 +435,19 @@ $(document).ready(function() {
ok(_.isEqual(this.syncArgs.model, doc)); ok(_.isEqual(this.syncArgs.model, doc));
}); });
test("save, fetch, destroy triggers error event when an error occurs", 3, function () {
var model = new Backbone.Model();
model.on('error', function () {
ok(true);
});
model.sync = function (method, model, options) {
options.error();
};
model.save({data: 2, id: 1});
model.fetch();
model.destroy();
});
test("save with PATCH", function() { test("save with PATCH", function() {
doc.clear().set({id: 1, a: 1, b: 2, c: 3, d: 4}); doc.clear().set({id: 1, a: 1, b: 2, c: 3, d: 4});
doc.save(); doc.save();
@@ -435,7 +465,7 @@ $(document).ready(function() {
test("save in positional style", 1, function() { test("save in positional style", 1, function() {
var model = new Backbone.Model(); var model = new Backbone.Model();
model.sync = function(method, model, options) { model.sync = function(method, model, options) {
options.success(model, {}, options); options.success();
}; };
model.save('title', 'Twelfth Night'); model.save('title', 'Twelfth Night');
equal(model.get('title'), 'Twelfth Night'); equal(model.get('title'), 'Twelfth Night');
@@ -444,8 +474,8 @@ $(document).ready(function() {
test("save with non-object success response", 2, function () { test("save with non-object success response", 2, function () {
var model = new Backbone.Model(); var model = new Backbone.Model();
model.sync = function(method, model, options) { model.sync = function(method, model, options) {
options.success(model, '', options); options.success('', options);
options.success(model, null, options); options.success(null, options);
}; };
model.save({testing:'empty'}, { model.save({testing:'empty'}, {
success: function (model) { success: function (model) {
@@ -720,7 +750,7 @@ $(document).ready(function() {
test("#1030 - `save` with `wait` results in correct attributes if success is called during sync", 2, function() { test("#1030 - `save` with `wait` results in correct attributes if success is called during sync", 2, function() {
var model = new Backbone.Model({x: 1, y: 2}); var model = new Backbone.Model({x: 1, y: 2});
model.sync = function(method, model, options) { model.sync = function(method, model, options) {
options.success(model, {}, options); options.success();
}; };
model.on("change:x", function() { ok(true); }); model.on("change:x", function() { ok(true); });
model.save({x: 3}, {wait: true}); model.save({x: 3}, {wait: true});
@@ -893,7 +923,7 @@ $(document).ready(function() {
} }
}; };
model.sync = function(method, model, options) { model.sync = function(method, model, options) {
options.success(model, {}, options); options.success();
}; };
model.save({id: 1}, opts); model.save({id: 1}, opts);
model.fetch(opts); model.fetch(opts);
@@ -902,9 +932,8 @@ $(document).ready(function() {
test("#1412 - Trigger 'sync' event.", 3, function() { test("#1412 - Trigger 'sync' event.", 3, function() {
var model = new Backbone.Model({id: 1}); var model = new Backbone.Model({id: 1});
model.url = '/test'; model.sync = function (method, model, options) { options.success(); };
model.on('sync', function(){ ok(true); }); model.on('sync', function(){ ok(true); });
Backbone.ajax = function(settings){ settings.success(); };
model.fetch(); model.fetch();
model.save(); model.save();
model.destroy(); model.destroy();
@@ -950,7 +979,7 @@ $(document).ready(function() {
var Model = Backbone.Model.extend({ var Model = Backbone.Model.extend({
sync: function(method, model, options) { sync: function(method, model, options) {
setTimeout(function(){ setTimeout(function(){
options.success(model, {}, options); options.success();
start(); start();
}, 0); }, 0);
} }

View File

@@ -57,6 +57,15 @@ $(document).ready(function() {
}); });
var ExternalObject = {
value: 'unset',
routingFunction: function(value) {
this.value = value;
}
};
_.bindAll(ExternalObject);
var Router = Backbone.Router.extend({ var Router = Backbone.Router.extend({
count: 0, count: 0,
@@ -73,8 +82,11 @@ $(document).ready(function() {
"optional(/:item)": "optionalItem", "optional(/:item)": "optionalItem",
"named/optional/(y:z)": "namedOptional", "named/optional/(y:z)": "namedOptional",
"splat/*args/end": "splat", "splat/*args/end": "splat",
"*first/complex-:part/*rest": "complex", ":repo/compare/*from...*to": "github",
"decode/:named/*splat": "decode",
"*first/complex-*part/*rest": "complex",
":entity?*args": "query", ":entity?*args": "query",
"function/:value": ExternalObject.routingFunction,
"*anything": "anything" "*anything": "anything"
}, },
@@ -116,6 +128,12 @@ $(document).ready(function() {
this.args = args; this.args = args;
}, },
github: function(repo, from, to) {
this.repo = repo;
this.from = from;
this.to = to;
},
complex: function(first, part, rest) { complex: function(first, part, rest) {
this.first = first; this.first = first;
this.part = part; this.part = part;
@@ -135,6 +153,11 @@ $(document).ready(function() {
this.z = z; this.z = z;
}, },
decode: function(named, path) {
this.named = named;
this.path = path;
},
routeEvent: function(arg) { routeEvent: function(arg) {
} }
@@ -153,6 +176,15 @@ $(document).ready(function() {
equal(lastArgs[0], 'news'); equal(lastArgs[0], 'news');
}); });
test("routes (simple, but unicode)", 4, function() {
location.replace('http://example.com#search/тест');
Backbone.history.checkUrl();
equal(router.query, "тест");
equal(router.page, void 0);
equal(lastRoute, 'search');
equal(lastArgs[0], "тест");
});
test("routes (two part)", 2, function() { test("routes (two part)", 2, function() {
location.replace('http://example.com#search/nyc/p10'); location.replace('http://example.com#search/nyc/p10');
Backbone.history.checkUrl(); Backbone.history.checkUrl();
@@ -213,6 +245,14 @@ $(document).ready(function() {
equal(router.args, 'long-list/of/splatted_99args'); equal(router.args, 'long-list/of/splatted_99args');
}); });
test("routes (github)", 3, function() {
location.replace('http://example.com#backbone/compare/1.0...braddunbar:with/slash');
Backbone.history.checkUrl();
equal(router.repo, 'backbone');
equal(router.from, '1.0');
equal(router.to, 'braddunbar:with/slash');
});
test("routes (optional)", 2, function() { test("routes (optional)", 2, function() {
location.replace('http://example.com#optional'); location.replace('http://example.com#optional');
Backbone.history.checkUrl(); Backbone.history.checkUrl();
@@ -246,6 +286,23 @@ $(document).ready(function() {
equal(router.anything, 'doesnt-match-a-route'); equal(router.anything, 'doesnt-match-a-route');
}); });
test("routes (function)", 3, function() {
router.on('route', function(name) {
ok(name === '');
});
equal(ExternalObject.value, 'unset');
location.replace('http://example.com#function/set');
Backbone.history.checkUrl();
equal(ExternalObject.value, 'set');
});
test("Decode named parameters, not splats.", 2, function() {
location.replace('http://example.com#decode/a%2Fb/c%2Fd/e');
Backbone.history.checkUrl();
strictEqual(router.named, 'a/b');
strictEqual(router.path, 'c/d/e');
});
test("fires event when router doesn't have callback on it", 1, function() { test("fires event when router doesn't have callback on it", 1, function() {
router.on("route:noCallback", function(){ ok(true); }); router.on("route:noCallback", function(){ ok(true); });
location.replace('http://example.com#noCallback'); location.replace('http://example.com#noCallback');
@@ -277,9 +334,9 @@ $(document).ready(function() {
test("#967 - Route callback gets passed encoded values.", 3, function() { test("#967 - Route callback gets passed encoded values.", 3, function() {
var route = 'has%2Fslash/complex-has%23hash/has%20space'; var route = 'has%2Fslash/complex-has%23hash/has%20space';
Backbone.history.navigate(route, {trigger: true}); Backbone.history.navigate(route, {trigger: true});
strictEqual(router.first, 'has%2Fslash'); strictEqual(router.first, 'has/slash');
strictEqual(router.part, 'has%23hash'); strictEqual(router.part, 'has#hash');
strictEqual(router.rest, 'has%20space'); strictEqual(router.rest, 'has space');
}); });
test("correctly handles URLs with % (#868)", 3, function() { test("correctly handles URLs with % (#868)", 3, function() {
@@ -529,4 +586,27 @@ $(document).ready(function() {
Backbone.history.checkUrl(); Backbone.history.checkUrl();
}); });
test("#2255 - Extend routes by making routes a function.", 1, function() {
var RouterBase = Backbone.Router.extend({
routes: function() {
return {
home: "root",
index: "index.html"
};
}
});
var RouterExtended = RouterBase.extend({
routes: function() {
var _super = RouterExtended.__super__.routes;
return _.extend(_super(),
{ show: "show",
search: "search" });
}
});
var router = new RouterExtended();
deepEqual({home: "root", index: "index.html", show: "show", search: "search"}, router.routes);
});
}); });

View File

@@ -85,6 +85,13 @@ $(document).ready(function() {
equal(view.counter, 3); equal(view.counter, 3);
}); });
test("delegateEvents ignore undefined methods", 0, function() {
var view = new Backbone.View({el: '<p></p>'});
view.delegateEvents({'click': 'undefinedMethod'});
view.$el.trigger('click');
});
test("undelegateEvents", 6, function() { test("undelegateEvents", 6, function() {
var counter1 = 0, counter2 = 0; var counter1 = 0, counter2 = 0;

View File

@@ -15,13 +15,16 @@ For a list of upcoming features, check out our [roadmap](https://github.com/best
## Support ## Support
Benchmark.js has been tested in at least Adobe AIR 3.1, Chrome 5-21, Firefox 1-15, IE 6-9, Opera 9.25-12, Safari 3-6, Node.js 0.8.8, Narwhal 0.3.2, RingoJS 0.8, and Rhino 1.7RC5. Benchmark.js has been tested in at least Chrome 5~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.
## Installation and usage ## Installation and usage
In a browser or Adobe AIR: Benchmark.js only hard dependency is [Lo-Dash](http://lodash.com/).
In a browser:
```html ```html
<script src="lodash.js"></script>
<script src="benchmark.js"></script> <script src="benchmark.js"></script>
``` ```
@@ -68,25 +71,14 @@ load('benchmark.js');
In an AMD loader like [RequireJS](http://requirejs.org/): In an AMD loader like [RequireJS](http://requirejs.org/):
```js ```js
require({
'paths': {
'benchmark': 'path/to/benchmark'
}
},
['benchmark'], function(Benchmark) {
console.log(Benchmark.version);
});
// or with platform.js
// https://github.com/bestiejs/platform.js
require({ require({
'paths': { 'paths': {
'benchmark': 'path/to/benchmark', 'benchmark': 'path/to/benchmark',
'lodash': 'path/to/lodash',
'platform': 'path/to/platform' 'platform': 'path/to/platform'
} }
}, },
['benchmark', 'platform'], function(Benchmark, platform) { ['benchmark'], function(Benchmark) {
Benchmark.platform = platform;
console.log(Benchmark.platform.name); console.log(Benchmark.platform.name);
}); });
``` ```
@@ -108,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 ' + this.filter('fastest').pluck('name')); console.log('Fastest is ' + _.pluck(this.filter('fastest'), 'name'));
}) })
// run async // run async
.run({ 'async': true }); .run({ 'async': true });
@@ -121,7 +113,7 @@ suite.add('RegExp#test', function() {
## BestieJS ## BestieJS
Benchmark.js is part of the BestieJS *"Best in Class"* module collection. This means we promote solid browser/environment support, ES5 precedents, unit testing, and plenty of documentation. Benchmark.js is part of the BestieJS *"Best in Class"* module collection. This means we promote solid browser/environment support, ES5+ precedents, unit testing, and plenty of documentation.
## Authors ## Authors

File diff suppressed because it is too large Load Diff

View File

@@ -8,7 +8,7 @@ Platform.js is for informational purposes only and **not** intended as a substit
## BestieJS ## BestieJS
Platform.js is part of the BestieJS *"Best in Class"* module collection. This means we promote solid browser/environment support, ES5 precedents, unit testing, and plenty of documentation. Platform.js is part of the BestieJS *"Best in Class"* module collection. This means we promote solid browser/environment support, ES5+ precedents, unit testing, and plenty of documentation.
## Documentation ## Documentation
@@ -18,7 +18,7 @@ For a list of upcoming features, check out our [roadmap](https://github.com/best
## Support ## Support
Platform.js has been tested in at least Adobe AIR 3.1, Chrome 5-21, Firefox 1-14, IE 6-9, Opera 9.25-12, Safari 3-6, Node.js 0.8.6, Narwhal 0.3.2, RingoJS 0.8, and Rhino 1.7RC5. Platform.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.
## Installation and usage ## Installation and usage

View File

@@ -20,11 +20,14 @@
var reOpera = /Opera/; var reOpera = /Opera/;
/** Used to resolve a value's internal [[Class]] */ /** Used to resolve a value's internal [[Class]] */
var toString = {}.toString; var toString = Object.prototype.toString;
/** Detect Java environment */ /** Detect Java environment */
var java = /Java/.test(getClassOf(window.java)) && window.java; var java = /Java/.test(getClassOf(window.java)) && window.java;
/** Detect Rhino */
var rhino = java && getClassOf(window.environment) == 'Environment';
/** A character to represent alpha */ /** A character to represent alpha */
var alpha = java ? 'a' : '\u03b1'; var alpha = java ? 'a' : '\u03b1';
@@ -581,10 +584,11 @@
// detect stubborn layout engines // detect stubborn layout engines
if (layout == 'iCab' && parseFloat(version) > 3) { if (layout == 'iCab' && parseFloat(version) > 3) {
layout = ['WebKit']; layout = ['WebKit'];
} else if (data = } else if ((data =
/Opera/.test(name) && 'Presto' || /Opera/.test(name) && 'Presto' ||
/\b(?:Midori|Nook|Safari)\b/i.test(ua) && 'WebKit' || /\b(?:Midori|Nook|Safari)\b/i.test(ua) && 'WebKit' ||
!layout && /\bMSIE\b/i.test(ua) && (/^Mac/.test(os) ? 'Tasman' : 'Trident')) { !layout && /\bMSIE\b/i.test(ua) && (/^Mac/.test(os) ? 'Tasman' : 'Trident')
)) {
layout = [data]; layout = [data];
} }
// leverage environment features // leverage environment features
@@ -597,7 +601,7 @@
arch = data.getProperty('os.arch'); arch = data.getProperty('os.arch');
os = os || data.getProperty('os.name') + ' ' + data.getProperty('os.version'); os = os || data.getProperty('os.name') + ' ' + data.getProperty('os.version');
} }
if (typeof exports == 'object' && exports) { if (freeExports) {
// if `thisBinding` is the [ModuleScope] // if `thisBinding` is the [ModuleScope]
if (thisBinding == oldWin && typeof system == 'object' && (data = [system])[0]) { if (thisBinding == oldWin && typeof system == 'object' && (data = [system])[0]) {
os || (os = data[0].os || null); os || (os = data[0].os || null);
@@ -610,23 +614,28 @@
name = 'Narwhal'; name = 'Narwhal';
} }
} }
} else if (typeof process == 'object' && (data = process)) { }
else if (typeof process == 'object' && (data = process)) {
name = 'Node.js'; name = 'Node.js';
arch = data.arch; arch = data.arch;
os = data.platform; os = data.platform;
version = /[\d.]+/.exec(data.version)[0]; version = /[\d.]+/.exec(data.version)[0];
} }
} else if (getClassOf(window.environment) == 'Environment') { else if (rhino) {
name = 'Rhino';
}
}
else if (rhino) {
name = 'Rhino'; name = 'Rhino';
} }
} }
// detect Adobe AIR // detect Adobe AIR
else if (getClassOf(data = window.runtime) == 'ScriptBridgingProxyObject') { else if (getClassOf((data = window.runtime)) == 'ScriptBridgingProxyObject') {
name = 'Adobe AIR'; name = 'Adobe AIR';
os = data.flash.system.Capabilities.os; os = data.flash.system.Capabilities.os;
} }
// detect PhantomJS // detect PhantomJS
else if (getClassOf(data = window.phantom) == 'RuntimeObject') { else if (getClassOf((data = window.phantom)) == 'RuntimeObject') {
name = 'PhantomJS'; name = 'PhantomJS';
version = (data = data.version || null) && (data.major + '.' + data.minor + '.' + data.patch); version = (data = data.version || null) && (data.major + '.' + data.minor + '.' + data.patch);
} }
@@ -646,9 +655,10 @@
} }
// detect prerelease phases // detect prerelease phases
if (version && (data = if (version && (data =
/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(version) || /(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(version) ||
/(?:alpha|beta)(?: ?\d)?/i.exec(ua + ';' + (useFeatures && nav.appMinorVersion)) || /(?:alpha|beta)(?: ?\d)?/i.exec(ua + ';' + (useFeatures && nav.appMinorVersion)) ||
/\bMinefield\b/i.test(ua) && 'a')) { /\bMinefield\b/i.test(ua) && 'a'
)) {
prerelease = /b/i.test(data) ? 'beta' : 'alpha'; prerelease = /b/i.test(data) ? 'beta' : 'alpha';
version = version.replace(RegExp(data + '\\+?$'), '') + version = version.replace(RegExp(data + '\\+?$'), '') +
(prerelease == 'beta' ? beta : alpha) + (/\d+\+?/.exec(data) || ''); (prerelease == 'beta' ? beta : alpha) + (/\d+\+?/.exec(data) || '');
@@ -689,8 +699,9 @@
// detect BlackBerry OS version // detect BlackBerry OS version
// http://docs.blackberry.com/en/developers/deliverables/18169/HTTP_headers_sent_by_BB_Browser_1234911_11.jsp // http://docs.blackberry.com/en/developers/deliverables/18169/HTTP_headers_sent_by_BB_Browser_1234911_11.jsp
else if (/BlackBerry/.test(product) && (data = else if (/BlackBerry/.test(product) && (data =
(RegExp(product.replace(/ +/g, ' *') + '/([.\\d]+)', 'i').exec(ua) || 0)[1] || (RegExp(product.replace(/ +/g, ' *') + '/([.\\d]+)', 'i').exec(ua) || 0)[1] ||
version)) { version
)) {
os = 'Device Software ' + data; os = 'Device Software ' + data;
version = null; version = null;
} }
@@ -705,7 +716,7 @@
/Windows XP/.test(os) && version > 8 || /Windows XP/.test(os) && version > 8 ||
version == 8 && !/Trident/.test(ua) version == 8 && !/Trident/.test(ua)
)) ))
) && !reOpera.test(data = parse.call(forOwn, ua.replace(reOpera, '') + ';')) && data.name) { ) && !reOpera.test((data = parse.call(forOwn, ua.replace(reOpera, '') + ';'))) && data.name) {
// when "indentifying", the UA contains both Opera and the other browser's name // when "indentifying", the UA contains both Opera and the other browser's name
data = 'ing as ' + data.name + ((data = data.version) ? ' ' + data : ''); data = 'ing as ' + data.name + ((data = data.version) ? ' ' + data : '');
@@ -793,7 +804,7 @@
} }
} }
// strip incorrect OS versions // strip incorrect OS versions
if (version && version.indexOf(data = /[\d.]+$/.exec(os)) == 0 && if (version && version.indexOf((data = /[\d.]+$/.exec(os))) == 0 &&
ua.indexOf('/' + data + '-') > -1) { ua.indexOf('/' + data + '-') > -1) {
os = trim(os.replace(data, '')); os = trim(os.replace(data, ''));
} }
@@ -981,7 +992,7 @@
}); });
} }
// check for `exports` after `define` in case a build optimizer adds an `exports` object // check for `exports` after `define` in case a build optimizer adds an `exports` object
else if (freeExports) { else if (freeExports && !freeExports.nodeType) {
// in Narwhal, Node.js, or RingoJS // in Narwhal, Node.js, or RingoJS
forOwn(parse(), function(value, key) { forOwn(parse(), function(value, key) {
freeExports[key] = value; freeExports[key] = value;
@@ -989,8 +1000,6 @@
} }
// in a browser or Rhino // in a browser or Rhino
else { else {
// use square bracket notation so Closure Compiler won't munge `platform` window.platform = parse();
// http://code.google.com/closure/compiler/docs/api-tutorial3.html#export
window['platform'] = parse();
} }
}(this)); }(this));

View File

@@ -1,7 +1,7 @@
# QUnit CLIB <sup>v1.2.0</sup> # QUnit CLIB <sup>v1.3.0</sup>
## command-line interface boilerplate ## command-line interface boilerplate
QUnit CLIB helps extend QUnit's CLI support to many common CLI environments. QUnit CLIB helps extend QUnits CLI support to many common CLI environments.
## Screenshot ## Screenshot
@@ -9,26 +9,29 @@ QUnit CLIB helps extend QUnit's CLI support to many common CLI environments.
## Support ## Support
QUnit CLIB has been tested in at least Node.js 0.4.8-0.8.19, Narwhal v0.3.2, PhantomJS 1.8.1, RingoJS v0.9, and Rhino v1.7RC5. QUnit CLIB has been tested in at least Node.js 0.4.8-0.10.1, Narwhal 0.3.2, PhantomJS 1.8.1, RingoJS 0.9, and Rhino 1.7RC5.
## Usage ## Usage
```js ```js
(function(window) { ;(function(window) {
'use strict';
// 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;
// load QUnit and CLIB if needed // load QUnit and CLIB if needed
var QUnit = var QUnit = (function() {
window.QUnit || ( var noop = Function.prototype;
window.addEventListener || (window.addEventListener = Function.prototype), return window.QUnit || (
window.setTimeout || (window.setTimeout = Function.prototype), window.addEventListener || (window.addEventListener = noop),
window.QUnit = load('path/to/qunit.js') || window.QUnit, window.setTimeout || (window.setTimeout = noop),
load('path/to/qunit-clib.js'), window.QUnit = load('../vendor/qunit/qunit/qunit.js') || window.QUnit,
window.addEventListener === Function.prototype && delete window.addEventListener, (load('../vendor/qunit-clib/qunit-clib.js') || { 'runInContext': noop }).runInContext(window),
addEventListener === noop && delete window.addEventListener,
window.QUnit window.QUnit
); );
}());
// explicitly call `QUnit.module()` instead of `module()` // explicitly call `QUnit.module()` instead of `module()`
// in case we are in a CLI environment // in case we are in a CLI environment
@@ -38,9 +41,8 @@ QUnit CLIB has been tested in at least Node.js 0.4.8-0.8.19, Narwhal v0.3.2, Pha
// ... // ...
}); });
// must call `QUnit.start()` if using QUnit < 1.3.0 with Node.js or any // call `QUnit.start()` for Narwhal, Node.js, PhantomJS, Rhino, and RingoJS
// version of QUnit with Narwhal, PhantomJS, Rhino, or RingoJS if (!window.document || window.phantom) {
if (!window.document) {
QUnit.start(); QUnit.start();
} }
}(typeof global == 'object' && global || this)); }(typeof global == 'object' && global || this));
@@ -49,7 +51,6 @@ QUnit CLIB has been tested in at least Node.js 0.4.8-0.8.19, Narwhal v0.3.2, Pha
## Footnotes ## Footnotes
1. QUnit v1.3.0 does not work with Narwhal or Ringo < v0.8.0 1. QUnit v1.3.0 does not work with Narwhal or Ringo < v0.8.0
2. Rhino v1.7RC4 does not support timeout fallbacks `clearTimeout` and `setTimeout` 2. Rhino v1.7RC4 does not support timeout fallbacks `clearTimeout` and `setTimeout`
## Author ## Author

View File

@@ -1,5 +1,5 @@
/*! /*!
* QUnit CLI Boilerplate v1.2.0 * QUnit CLI Boilerplate v1.3.0
* Copyright 2011-2012 John-David Dalton <http://allyoucanleet.com/> * Copyright 2011-2012 John-David Dalton <http://allyoucanleet.com/>
* Based on a gist by Jörn Zaefferer <https://gist.github.com/722381> * Based on a gist by Jörn Zaefferer <https://gist.github.com/722381>
* Available under MIT license <http://mths.be/mit> * Available under MIT license <http://mths.be/mit>
@@ -7,12 +7,28 @@
;(function(window) { ;(function(window) {
'use strict'; 'use strict';
/** Detect free variable `exports` */
var freeExports = typeof exports == 'object' && exports;
/** Detect free variable `global` and use it as `window` */
var freeGlobal = typeof global == 'object' && global;
if (freeGlobal.global === freeGlobal) {
window = freeGlobal;
}
/*--------------------------------------------------------------------------*/
/** /**
* Timeout fallbacks based on the work of Andrea Giammarchi and Weston C. * Installs the CLI boilerplate additions on the given `context` object.
* https://github.com/WebReflection/wru/blob/master/src/rhinoTimers.js *
* http://stackoverflow.com/questions/2261705/how-to-run-a-javascript-function-asynchronously-without-using-settimeout * @memberOf exports
* @param {Object} context The context object.
*/ */
(function() { function runInContext(context) {
// exit early if no `context` is provided or if `QUnit` does not exist
if (!context || !context.QUnit) {
return;
}
/** /**
* Schedules timer-based callbacks. * Schedules timer-based callbacks.
@@ -29,7 +45,7 @@
// https://bugzilla.mozilla.org/show_bug.cgi?id=775566 // https://bugzilla.mozilla.org/show_bug.cgi?id=775566
var task = ids[++counter] = new JavaAdapter(java.util.TimerTask, { var task = ids[++counter] = new JavaAdapter(java.util.TimerTask, {
'run': function() { 'run': function() {
fn.apply(window, args); fn.apply(context, args);
} }
}); });
// support non-functions // support non-functions
@@ -53,7 +69,7 @@
/** /**
* Clears the delay set by `setInterval` or `setTimeout`. * Clears the delay set by `setInterval` or `setTimeout`.
* *
* @memberOf window * @memberOf context
* @param {Number} id The ID of the timeout to be cleared. * @param {Number} id The ID of the timeout to be cleared.
*/ */
function clearTimer(id) { function clearTimer(id) {
@@ -67,7 +83,7 @@
/** /**
* Executes a code snippet or function repeatedly, with a delay between each call. * Executes a code snippet or function repeatedly, with a delay between each call.
* *
* @memberOf window * @memberOf context
* @param {Function|String} fn The function to call or string to evaluate. * @param {Function|String} fn The function to call or string to evaluate.
* @oaram {Number} delay The number of milliseconds to delay each `fn` call. * @oaram {Number} delay The number of milliseconds to delay each `fn` call.
* @param [arg1, arg2, ...] Arguments to invoke `fn` with. * @param [arg1, arg2, ...] Arguments to invoke `fn` with.
@@ -80,7 +96,7 @@
/** /**
* Executes a code snippet or a function after specified delay. * Executes a code snippet or a function after specified delay.
* *
* @memberOf window * @memberOf context
* @param {Function|String} fn The function to call or string to evaluate. * @param {Function|String} fn The function to call or string to evaluate.
* @oaram {Number} delay The number of milliseconds to delay the `fn` call. * @oaram {Number} delay The number of milliseconds to delay the `fn` call.
* @param [arg1, arg2, ...] Arguments to invoke `fn` with. * @param [arg1, arg2, ...] Arguments to invoke `fn` with.
@@ -90,29 +106,17 @@
return schedule(fn, delay, slice.call(arguments, 2)); return schedule(fn, delay, slice.call(arguments, 2));
} }
try { /*------------------------------------------------------------------------*/
var counter = 0,
ids = {},
slice = Array.prototype.slice,
timer = new java.util.Timer;
window.clearInterval = /** Add `console.log()` support for Narwhal, Rhino, and RingoJS */
window.clearTimeout = clearTimer; var console = context.console || (context.console = { 'log': context.print });
window.setInterval = setInterval;
window.setTimeout = setTimeout;
} catch(e) { }
}());
/*--------------------------------------------------------------------------*/ /** Shorten `context.QUnit.QUnit` to `context.QUnit` */
var QUnit = context.QUnit = context.QUnit.QUnit || context.QUnit;
(function() {
/** Used as a horizontal rule in console output */ /** Used as a horizontal rule in console output */
var hr = '----------------------------------------'; var hr = '----------------------------------------';
/** Shorten `window.QUnit.QUnit` to `window.QUnit` */
window.QUnit && (QUnit = QUnit.QUnit || QUnit);
/** /**
* A logging callback triggered when all testing is completed. * A logging callback triggered when all testing is completed.
* *
@@ -134,14 +138,14 @@
console.log(' Finished in ' + details.runtime + ' milliseconds.'); console.log(' Finished in ' + details.runtime + ' milliseconds.');
console.log(hr); console.log(hr);
// exit out of Rhino // exit out of Narhwal, Rhino, or Ringo
try { try {
quit(); quit();
} catch(e) { } } catch(e) { }
// exit out of Node.js or PhantomJS // exit out of Node.js or PhantomJS
try { try {
var process = window.process || window.phantom; var process = context.process || context.phantom;
if (details.failed) { if (details.failed) {
console.error('Error: ' + details.failed + ' of ' + details.total + ' tests failed.'); console.error('Error: ' + details.failed + ' of ' + details.total + ' tests failed.');
process.exit(1); process.exit(1);
@@ -247,23 +251,42 @@
*/ */
'assertions': [] 'assertions': []
}; };
}());
/*------------------------------------------------------------------------*/
// Timeout fallbacks based on the work of Andrea Giammarchi and Weston C.
// https://github.com/WebReflection/wru/blob/master/src/rhinoTimers.js
// http://stackoverflow.com/questions/2261705/how-to-run-a-javascript-function-asynchronously-without-using-settimeout
try {
var counter = 0,
ids = {},
slice = Array.prototype.slice,
timer = new java.util.Timer;
context.clearInterval =
context.clearTimeout = clearTimer;
context.setInterval = setInterval;
context.setTimeout = setTimeout;
} catch(e) { }
// expose shortcuts
// exclude `module` because some environments have it as a built-in object
('asyncTest deepEqual equal equals expect notDeepEqual notEqual notStrictEqual ' +
'ok raises same start stop strictEqual test throws').replace(/\S+/g, function(methodName) {
context[methodName] = QUnit[methodName];
});
// must call `QUnit.start()` in the test file if using QUnit < 1.3.0 with
// Node.js or any version of QUnit with Narwhal, PhantomJS, Rhino, or RingoJS
QUnit.init();
}
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
// expose shortcuts // expose QUnit CLIB
// exclude `module` because some environments have it as a built-in object if (freeExports) {
('asyncTest deepEqual equal equals expect notDeepEqual notEqual notStrictEqual ' + freeExports.runInContext = runInContext;
'ok raises same start stop strictEqual test throws').replace(/\S+/g, function(methodName) { } else {
window[methodName] = QUnit[methodName]; runInContext(window);
});
// add `console.log()` support for Narwhal, Rhino, and RingoJS
if (!window.console && window.print) {
window.console = { 'log': window.print };
} }
// must call `QUnit.start()` in the test file if using QUnit < 1.3.0 with }(this));
// Node.js or any version of QUnit with Narwhal, PhantomJS, Rhino, or RingoJS
QUnit.init();
}(typeof global == 'object' && global || this));

View File

@@ -1,5 +1,5 @@
/** vim: et:ts=4:sw=4:sts=4 /** vim: et:ts=4:sw=4:sts=4
* @license RequireJS 2.1.4 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved. * @license RequireJS 2.1.5 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
* Available via the MIT or new BSD license. * Available via the MIT or new BSD license.
* see: http://github.com/jrburke/requirejs for details * see: http://github.com/jrburke/requirejs for details
*/ */
@@ -12,7 +12,7 @@ var requirejs, require, define;
(function (global) { (function (global) {
var req, s, head, baseElement, dataMain, src, var req, s, head, baseElement, dataMain, src,
interactiveScript, currentlyAddingScript, mainScript, subPath, interactiveScript, currentlyAddingScript, mainScript, subPath,
version = '2.1.4', version = '2.1.5',
commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg, commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,
cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g, cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,
jsSuffixRegExp = /\.js$/, jsSuffixRegExp = /\.js$/,
@@ -191,15 +191,21 @@ var requirejs, require, define;
var inCheckLoaded, Module, context, handlers, var inCheckLoaded, Module, context, handlers,
checkLoadedTimeoutId, checkLoadedTimeoutId,
config = { config = {
//Defaults. Do not set a default for map
//config to speed up normalize(), which
//will run faster if there is no default.
waitSeconds: 7, waitSeconds: 7,
baseUrl: './', baseUrl: './',
paths: {}, paths: {},
pkgs: {}, pkgs: {},
shim: {}, shim: {},
map: {},
config: {} config: {}
}, },
registry = {}, registry = {},
//registry of just enabled modules, to speed
//cycle breaking code when lots of modules
//are registered, but not activated.
enabledRegistry = {},
undefEvents = {}, undefEvents = {},
defQueue = [], defQueue = [],
defined = {}, defined = {},
@@ -295,7 +301,7 @@ var requirejs, require, define;
} }
//Apply map config if available. //Apply map config if available.
if (applyMap && (baseParts || starMap) && map) { if (applyMap && map && (baseParts || starMap)) {
nameParts = name.split('/'); nameParts = name.split('/');
for (i = nameParts.length; i > 0; i -= 1) { for (i = nameParts.length; i > 0; i -= 1) {
@@ -576,6 +582,7 @@ var requirejs, require, define;
function cleanRegistry(id) { function cleanRegistry(id) {
//Clean up machinery used for waiting modules. //Clean up machinery used for waiting modules.
delete registry[id]; delete registry[id];
delete enabledRegistry[id];
} }
function breakCycle(mod, traced, processed) { function breakCycle(mod, traced, processed) {
@@ -624,7 +631,7 @@ var requirejs, require, define;
inCheckLoaded = true; inCheckLoaded = true;
//Figure out the state of all the modules. //Figure out the state of all the modules.
eachProp(registry, function (mod) { eachProp(enabledRegistry, function (mod) {
map = mod.map; map = mod.map;
modId = map.id; modId = map.id;
@@ -805,7 +812,7 @@ var requirejs, require, define;
}, },
/** /**
* Checks is the module is ready to define itself, and if so, * Checks if the module is ready to define itself, and if so,
* define it. * define it.
*/ */
check: function () { check: function () {
@@ -883,7 +890,7 @@ var requirejs, require, define;
} }
//Clean up //Clean up
delete registry[id]; cleanRegistry(id);
this.defined = true; this.defined = true;
} }
@@ -1049,6 +1056,7 @@ var requirejs, require, define;
}, },
enable: function () { enable: function () {
enabledRegistry[this.map.id] = this;
this.enabled = true; this.enabled = true;
//Set flag mentioning that the module is enabling, //Set flag mentioning that the module is enabling,
@@ -1208,6 +1216,7 @@ var requirejs, require, define;
Module: Module, Module: Module,
makeModuleMap: makeModuleMap, makeModuleMap: makeModuleMap,
nextTick: req.nextTick, nextTick: req.nextTick,
onError: onError,
/** /**
* Set a configuration for the context. * Set a configuration for the context.
@@ -1234,6 +1243,9 @@ var requirejs, require, define;
eachProp(cfg, function (value, prop) { eachProp(cfg, function (value, prop) {
if (objs[prop]) { if (objs[prop]) {
if (prop === 'map') { if (prop === 'map') {
if (!config.map) {
config.map = {};
}
mixin(config[prop], value, true, true); mixin(config[prop], value, true, true);
} else { } else {
mixin(config[prop], value, true); mixin(config[prop], value, true);
@@ -1345,7 +1357,7 @@ var requirejs, require, define;
//Synchronous access to one module. If require.get is //Synchronous access to one module. If require.get is
//available (as in the Node adapter), prefer that. //available (as in the Node adapter), prefer that.
if (req.get) { if (req.get) {
return req.get(context, deps, relMap); return req.get(context, deps, relMap, localRequire);
} }
//Normalize module name, if it contains . or .. //Normalize module name, if it contains . or ..
@@ -1396,7 +1408,7 @@ var requirejs, require, define;
* plain URLs like nameToUrl. * plain URLs like nameToUrl.
*/ */
toUrl: function (moduleNamePlusExt) { toUrl: function (moduleNamePlusExt) {
var ext, url, var ext,
index = moduleNamePlusExt.lastIndexOf('.'), index = moduleNamePlusExt.lastIndexOf('.'),
segment = moduleNamePlusExt.split('/')[0], segment = moduleNamePlusExt.split('/')[0],
isRelative = segment === '.' || segment === '..'; isRelative = segment === '.' || segment === '..';
@@ -1408,9 +1420,8 @@ var requirejs, require, define;
moduleNamePlusExt = moduleNamePlusExt.substring(0, index); moduleNamePlusExt = moduleNamePlusExt.substring(0, index);
} }
url = context.nameToUrl(normalize(moduleNamePlusExt, return context.nameToUrl(normalize(moduleNamePlusExt,
relMap && relMap.id, true), ext || '.fake'); relMap && relMap.id, true), ext, true);
return ext ? url : url.substring(0, url.length - 5);
}, },
defined: function (id) { defined: function (id) {
@@ -1529,7 +1540,7 @@ var requirejs, require, define;
* it is assumed to have already been normalized. This is an * it is assumed to have already been normalized. This is an
* internal API, not a public one. Use toUrl for the public API. * internal API, not a public one. Use toUrl for the public API.
*/ */
nameToUrl: function (moduleName, ext) { nameToUrl: function (moduleName, ext, skipExt) {
var paths, pkgs, pkg, pkgPath, syms, i, parentModule, url, var paths, pkgs, pkg, pkgPath, syms, i, parentModule, url,
parentPath; parentPath;
@@ -1578,7 +1589,7 @@ var requirejs, require, define;
//Join the path parts together, then figure out if baseUrl is needed. //Join the path parts together, then figure out if baseUrl is needed.
url = syms.join('/'); url = syms.join('/');
url += (ext || (/\?/.test(url) ? '' : '.js')); url += (ext || (/\?/.test(url) || skipExt ? '' : '.js'));
url = (url.charAt(0) === '/' || url.match(/^[\w\+\.\-]+:/) ? '' : config.baseUrl) + url; url = (url.charAt(0) === '/' || url.match(/^[\w\+\.\-]+:/) ? '' : config.baseUrl) + url;
} }
@@ -1817,7 +1828,7 @@ var requirejs, require, define;
node.attachEvent('onreadystatechange', context.onScriptLoad); node.attachEvent('onreadystatechange', context.onScriptLoad);
//It would be great to add an error handler here to catch //It would be great to add an error handler here to catch
//404s in IE9+. However, onreadystatechange will fire before //404s in IE9+. However, onreadystatechange will fire before
//the error handler, so that does not help. If addEvenListener //the error handler, so that does not help. If addEventListener
//is used, then IE will fire error before load, but we cannot //is used, then IE will fire error before load, but we cannot
//use that pathway given the connect.microsoft.com issue //use that pathway given the connect.microsoft.com issue
//mentioned above about not doing the 'script execute, //mentioned above about not doing the 'script execute,
@@ -1846,16 +1857,24 @@ var requirejs, require, define;
return node; return node;
} else if (isWebWorker) { } else if (isWebWorker) {
//In a web worker, use importScripts. This is not a very try {
//efficient use of importScripts, importScripts will block until //In a web worker, use importScripts. This is not a very
//its script is downloaded and evaluated. However, if web workers //efficient use of importScripts, importScripts will block until
//are in play, the expectation that a build has been done so that //its script is downloaded and evaluated. However, if web workers
//only one script needs to be loaded anyway. This may need to be //are in play, the expectation that a build has been done so that
//reevaluated if other use cases become common. //only one script needs to be loaded anyway. This may need to be
importScripts(url); //reevaluated if other use cases become common.
importScripts(url);
//Account for anonymous modules //Account for anonymous modules
context.completeLoad(moduleName); context.completeLoad(moduleName);
} catch (e) {
context.onError(makeError('importscripts',
'importScripts failed for ' +
moduleName + ' at ' + url,
e,
[moduleName]));
}
} }
}; };