mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-02 16:17:50 +00:00
Compare commits
83 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
594002316c | ||
|
|
eccf92ebaf | ||
|
|
ad9ddc5621 | ||
|
|
1825dd916e | ||
|
|
dfcde8171e | ||
|
|
b0361183df | ||
|
|
71fe13b249 | ||
|
|
442f51224d | ||
|
|
974678f500 | ||
|
|
8329409c03 | ||
|
|
06c2ac2724 | ||
|
|
04e9e8f9d8 | ||
|
|
7a3330cb8c | ||
|
|
cae29941ea | ||
|
|
15cf2ad076 | ||
|
|
2f16f6dc23 | ||
|
|
528aebffe4 | ||
|
|
e82b2f0cbe | ||
|
|
73e64f3e4a | ||
|
|
15f5b1f830 | ||
|
|
1b0a77f9a8 | ||
|
|
0f82ae3644 | ||
|
|
de3b01b54b | ||
|
|
c17e3646d5 | ||
|
|
26aed3e89e | ||
|
|
74caea8f8f | ||
|
|
2cf07fa072 | ||
|
|
1181cd2fd7 | ||
|
|
850d55ab45 | ||
|
|
a0c91b8754 | ||
|
|
937bdc05c8 | ||
|
|
453755bfa1 | ||
|
|
400b6fbb61 | ||
|
|
8c4e882fa3 | ||
|
|
84eec23793 | ||
|
|
7dfe69f6a5 | ||
|
|
ada6115073 | ||
|
|
e1643566f9 | ||
|
|
053a9a6317 | ||
|
|
425b976cc0 | ||
|
|
5f5f1b1e09 | ||
|
|
e6f4935c7b | ||
|
|
6452e5976b | ||
|
|
2383dff317 | ||
|
|
de3e5042fb | ||
|
|
0dcc35152c | ||
|
|
8eecfcbfaf | ||
|
|
efa3e60f89 | ||
|
|
782df659bc | ||
|
|
0aa158824f | ||
|
|
da7fb44e5d | ||
|
|
4b59ef802e | ||
|
|
be5789cd56 | ||
|
|
9adf0e5d59 | ||
|
|
e2de22470e | ||
|
|
3b7ab2e553 | ||
|
|
8617dedc46 | ||
|
|
0b8f1a9a58 | ||
|
|
16748c0920 | ||
|
|
01ec585a44 | ||
|
|
b5f2295f37 | ||
|
|
d6ca0199b7 | ||
|
|
2257c5e547 | ||
|
|
b5a3d39799 | ||
|
|
a26c3e9d3c | ||
|
|
98a09532eb | ||
|
|
d736789bbc | ||
|
|
82a6cfc03a | ||
|
|
62e9c7c75a | ||
|
|
eb32bd45e7 | ||
|
|
4b95f07923 | ||
|
|
dea8ad4c49 | ||
|
|
96553b217c | ||
|
|
3f79ed5d91 | ||
|
|
1e4283aad3 | ||
|
|
1dda31a28c | ||
|
|
10c87012be | ||
|
|
bda00bf512 | ||
|
|
c8f871ff2a | ||
|
|
58dc0b1aef | ||
|
|
4cd4d8f31a | ||
|
|
b751fd738d | ||
|
|
f97c6fb94c |
4
.gitignore
vendored
4
.gitignore
vendored
@@ -1,3 +1,5 @@
|
|||||||
*.custom.*
|
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
*.custom.*
|
||||||
node_modules/
|
node_modules/
|
||||||
|
vendor/closure-compiler/
|
||||||
|
vendor/uglifyjs/
|
||||||
|
|||||||
12
.jamignore
12
.jamignore
@@ -1,14 +1,10 @@
|
|||||||
*.custom.*
|
|
||||||
.*
|
.*
|
||||||
|
*.custom.*
|
||||||
build.js
|
build.js
|
||||||
index.js
|
index.js
|
||||||
build/
|
build/
|
||||||
doc/*.php
|
doc/*.php
|
||||||
node_modules/
|
node_modules/
|
||||||
perf/*.sh
|
perf/
|
||||||
test/*.sh
|
test/
|
||||||
test/test-build.js
|
vendor/
|
||||||
test/template/
|
|
||||||
vendor/closure-compiler
|
|
||||||
vendor/docdown
|
|
||||||
vendor/uglifyjs
|
|
||||||
|
|||||||
11
.npmignore
11
.npmignore
@@ -1,15 +1,22 @@
|
|||||||
*.custom.*
|
|
||||||
.*
|
.*
|
||||||
|
*.custom.*
|
||||||
|
*.d.ts
|
||||||
doc/*.php
|
doc/*.php
|
||||||
node_modules/
|
node_modules/
|
||||||
perf/*.html
|
perf/*.html
|
||||||
|
perf/*-ui.js
|
||||||
perf/*.sh
|
perf/*.sh
|
||||||
test/*.html
|
test/*.html
|
||||||
test/*-ui.js
|
test/*-ui.js
|
||||||
test/*.sh
|
test/*.sh
|
||||||
|
vendor/*.gz
|
||||||
vendor/backbone/
|
vendor/backbone/
|
||||||
vendor/docdown/
|
vendor/benchmark.js/*.jar
|
||||||
|
vendor/closure-compiler
|
||||||
|
vendor/docdown
|
||||||
vendor/firebug-lite/
|
vendor/firebug-lite/
|
||||||
|
vendor/jquery/
|
||||||
vendor/qunit/qunit/*.css
|
vendor/qunit/qunit/*.css
|
||||||
vendor/requirejs/
|
vendor/requirejs/
|
||||||
|
vendor/uglifyjs
|
||||||
vendor/underscore/test/
|
vendor/underscore/test/
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
language: node_js
|
language: node_js
|
||||||
node_js:
|
node_js:
|
||||||
- 0.6
|
- 0.6
|
||||||
- 0.8
|
- 0.8
|
||||||
|
before_script:
|
||||||
|
- "curl -H 'Accept: application/vnd.github.v3.raw' https://api.github.com/repos/bestiejs/lodash/git/blobs/aa29a2ecf6f51d4da5a2a418c0d4ea0e368ee80d | tar xvz -C vendor"
|
||||||
|
- "curl -H 'Accept: application/vnd.github.v3.raw' https://api.github.com/repos/bestiejs/lodash/git/blobs/9869c4443fb22598235d1019fcc8245be41e8889 | tar xvz -C vendor"
|
||||||
|
|||||||
119
README.md
119
README.md
@@ -1,4 +1,4 @@
|
|||||||
# Lo-Dash <sup>v0.8.2</sup>
|
# Lo-Dash <sup>v0.9.0</sup>
|
||||||
[](http://travis-ci.org/bestiejs/lodash)
|
[](http://travis-ci.org/bestiejs/lodash)
|
||||||
|
|
||||||
A drop-in replacement<sup>[*](https://github.com/bestiejs/lodash/wiki/Drop-in-Disclaimer)</sup> for Underscore.js, from the devs behind [jsPerf.com](http://jsperf.com), delivering [performance](http://lodash.com/benchmarks), [bug fixes](https://github.com/bestiejs/lodash#resolved-underscorejs-issues), and [additional features](http://lodash.com/#features).
|
A drop-in replacement<sup>[*](https://github.com/bestiejs/lodash/wiki/Drop-in-Disclaimer)</sup> for Underscore.js, from the devs behind [jsPerf.com](http://jsperf.com), delivering [performance](http://lodash.com/benchmarks), [bug fixes](https://github.com/bestiejs/lodash#resolved-underscorejs-issues), and [additional features](http://lodash.com/#features).
|
||||||
@@ -7,10 +7,10 @@ Lo-Dash’s performance is gained by avoiding slower native methods, instead opt
|
|||||||
|
|
||||||
## Download
|
## Download
|
||||||
|
|
||||||
* [Development build](https://raw.github.com/bestiejs/lodash/v0.8.2/lodash.js)
|
* [Development build](https://raw.github.com/bestiejs/lodash/v0.9.0/lodash.js)
|
||||||
* [Production build](https://raw.github.com/bestiejs/lodash/v0.8.2/lodash.min.js)
|
* [Production build](https://raw.github.com/bestiejs/lodash/v0.9.0/lodash.min.js)
|
||||||
* [Underscore build](https://raw.github.com/bestiejs/lodash/v0.8.2/lodash.underscore.min.js) tailored for projects already using Underscore
|
* [Underscore build](https://raw.github.com/bestiejs/lodash/v0.9.0/lodash.underscore.min.js) tailored for projects already using Underscore
|
||||||
* CDN copies of ≤ [v0.8.2](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/0.8.2/lodash.min.js) are available on [cdnjs](http://cdnjs.com/) thanks to [CloudFlare](http://www.cloudflare.com/)
|
* CDN copies of ≤ [v0.9.0](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/0.9.0/lodash.min.js) are available on [cdnjs](http://cdnjs.com/) thanks to [CloudFlare](http://www.cloudflare.com/)
|
||||||
* 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
|
||||||
|
|
||||||
## Dive in
|
## Dive in
|
||||||
@@ -49,7 +49,7 @@ For more information check out these screencasts over Lo-Dash:
|
|||||||
|
|
||||||
## Support
|
## Support
|
||||||
|
|
||||||
Lo-Dash has been tested in at least Chrome 5~22, Firefox 1~16, IE 6-10, Opera 9.25-12, Safari 3-6, Node.js 0.4.8-0.8.11, Narwhal 0.3.2, RingoJS 0.8, and Rhino 1.7RC5.
|
Lo-Dash has been tested in at least Chrome 5~22, Firefox 1~16, IE 6-10, Opera 9.25-12, Safari 3-6, Node.js 0.4.8-0.8.12, Narwhal 0.3.2, RingoJS 0.8, and Rhino 1.7RC5.
|
||||||
|
|
||||||
## Custom builds
|
## Custom builds
|
||||||
|
|
||||||
@@ -173,7 +173,7 @@ In [Node.js](http://nodejs.org/) and [RingoJS v0.8.0+](http://ringojs.org/):
|
|||||||
var _ = require('lodash');
|
var _ = require('lodash');
|
||||||
```
|
```
|
||||||
|
|
||||||
**Note:** If Lo-Dash is installed globally, [run `npm link lodash`](http://blog.nodejs.org/2011/03/23/npm-1-0-global-vs-local-installation/) in your project’s root directory before attempting to `require` 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 project’s root directory before requiring it.
|
||||||
|
|
||||||
In [RingoJS v0.7.0-](http://ringojs.org/):
|
In [RingoJS v0.7.0-](http://ringojs.org/):
|
||||||
|
|
||||||
@@ -202,89 +202,36 @@ require({
|
|||||||
|
|
||||||
## Resolved Underscore.js issues
|
## Resolved Underscore.js issues
|
||||||
|
|
||||||
* Add AMD loader support [[#431](https://github.com/documentcloud/underscore/pull/431), [test](https://github.com/bestiejs/lodash/blob/v0.8.2/test/test.js#L118-140)]
|
* Add AMD loader support [[#431](https://github.com/documentcloud/underscore/pull/431), [test](https://github.com/bestiejs/lodash/blob/v0.9.0/test/test.js#L116-138)]
|
||||||
* Allow iteration of objects with a `length` property [[#799](https://github.com/documentcloud/underscore/pull/799), [test](https://github.com/bestiejs/lodash/blob/v0.8.2/test/test.js#L510-516)]
|
* Allow iteration of objects with a `length` property [[#799](https://github.com/documentcloud/underscore/pull/799), [test](https://github.com/bestiejs/lodash/blob/v0.9.0/test/test.js#L508-514)]
|
||||||
* Ensure *“Collections”* methods allow string `collection` arguments [[#247](https://github.com/documentcloud/underscore/issues/247), [#276](https://github.com/documentcloud/underscore/issues/276), [#561](https://github.com/documentcloud/underscore/pull/561), [test](https://github.com/bestiejs/lodash/blob/v0.8.2/test/test.js#L470-487)]
|
* Ensure *“Collections”* methods allow string `collection` arguments [[#247](https://github.com/documentcloud/underscore/issues/247), [#276](https://github.com/documentcloud/underscore/issues/276), [#561](https://github.com/documentcloud/underscore/pull/561), [test](https://github.com/bestiejs/lodash/blob/v0.9.0/test/test.js#L468-485)]
|
||||||
* Fix cross-browser object iteration bugs [[#60](https://github.com/documentcloud/underscore/issues/60), [#376](https://github.com/documentcloud/underscore/issues/376), [test](https://github.com/bestiejs/lodash/blob/v0.8.2/test/test.js#L523-547)]
|
* Fix cross-browser object iteration bugs [[#60](https://github.com/documentcloud/underscore/issues/60), [#376](https://github.com/documentcloud/underscore/issues/376), [test](https://github.com/bestiejs/lodash/blob/v0.9.0/test/test.js#L521-545)]
|
||||||
* Methods should work on pages with incorrectly shimmed native methods [[#7](https://github.com/documentcloud/underscore/issues/7), [#742](https://github.com/documentcloud/underscore/issues/742), [test](https://github.com/bestiejs/lodash/blob/v0.8.2/test/test.js#L142-148)]
|
* Methods should work on pages with incorrectly shimmed native methods [[#7](https://github.com/documentcloud/underscore/issues/7), [#742](https://github.com/documentcloud/underscore/issues/742), [test](https://github.com/bestiejs/lodash/blob/v0.9.0/test/test.js#L140-146)]
|
||||||
* `_.clone` should allow `deep` cloning [[#595](https://github.com/documentcloud/underscore/pull/595), [test](https://github.com/bestiejs/lodash/blob/v0.8.2/test/test.js#L214-225)]
|
* `_.clone` should allow `deep` cloning [[#595](https://github.com/documentcloud/underscore/pull/595), [test](https://github.com/bestiejs/lodash/blob/v0.9.0/test/test.js#L212-223)]
|
||||||
* `_.contains` should work with strings [[#667](https://github.com/documentcloud/underscore/pull/667), [test](https://github.com/bestiejs/lodash/blob/v0.8.2/test/test.js#L267-276)]
|
* `_.contains` should work with strings [[#667](https://github.com/documentcloud/underscore/pull/667), [test](https://github.com/bestiejs/lodash/blob/v0.9.0/test/test.js#L265-274)]
|
||||||
* `_.extend` should recursively extend objects [[#379](https://github.com/documentcloud/underscore/pull/379), [#718](https://github.com/documentcloud/underscore/issues/718), [test](https://github.com/bestiejs/lodash/blob/v0.8.2/test/test.js#L968-990)]
|
* `_.extend` should recursively extend objects [[#379](https://github.com/documentcloud/underscore/pull/379), [#718](https://github.com/documentcloud/underscore/issues/718), [test](https://github.com/bestiejs/lodash/blob/v0.9.0/test/test.js#L989-1011)]
|
||||||
* `_.forEach` should be chainable [[#142](https://github.com/documentcloud/underscore/issues/142), [test](https://github.com/bestiejs/lodash/blob/v0.8.2/test/test.js#L465-468)]
|
* `_.forEach` should be chainable [[#142](https://github.com/documentcloud/underscore/issues/142), [test](https://github.com/bestiejs/lodash/blob/v0.9.0/test/test.js#L463-466)]
|
||||||
* `_.forEach` should allow exiting iteration early [[#211](https://github.com/documentcloud/underscore/issues/211), [test](https://github.com/bestiejs/lodash/blob/v0.8.2/test/test.js#L553-571)]
|
* `_.forEach` should allow exiting iteration early [[#211](https://github.com/documentcloud/underscore/issues/211), [test](https://github.com/bestiejs/lodash/blob/v0.9.0/test/test.js#L551-569)]
|
||||||
* `_.isEmpty` should support jQuery/MooTools DOM query collections [[#690](https://github.com/documentcloud/underscore/pull/690), [test](https://github.com/bestiejs/lodash/blob/v0.8.2/test/test.js#L712-717)]
|
* `_.isEmpty` should support jQuery/MooTools DOM query collections [[#690](https://github.com/documentcloud/underscore/pull/690), [test](https://github.com/bestiejs/lodash/blob/v0.9.0/test/test.js#L710-715)]
|
||||||
* `_.isObject` should avoid V8 bug [#2291](http://code.google.com/p/v8/issues/detail?id=2291) [[#605](https://github.com/documentcloud/underscore/issues/605), [test](https://github.com/bestiejs/lodash/blob/v0.8.2/test/test.js#L772-784)]
|
* `_.isObject` should avoid V8 bug [#2291](http://code.google.com/p/v8/issues/detail?id=2291) [[#605](https://github.com/documentcloud/underscore/issues/605), [test](https://github.com/bestiejs/lodash/blob/v0.9.0/test/test.js#L770-782)]
|
||||||
* `_.keys` should work with `arguments` objects cross-browser [[#396](https://github.com/documentcloud/underscore/issues/396), [test](https://github.com/bestiejs/lodash/blob/v0.8.2/test/test.js#L865-867)]
|
* `_.keys` should work with `arguments` objects cross-browser [[#396](https://github.com/documentcloud/underscore/issues/396), [test](https://github.com/bestiejs/lodash/blob/v0.9.0/test/test.js#L863-865)]
|
||||||
* `_.range` should coerce arguments to numbers [[#634](https://github.com/documentcloud/underscore/issues/634), [#683](https://github.com/documentcloud/underscore/issues/683), [test](https://github.com/bestiejs/lodash/blob/v0.8.2/test/test.js#L1243-1246)]
|
* `_.range` should coerce arguments to numbers [[#634](https://github.com/documentcloud/underscore/issues/634), [#683](https://github.com/documentcloud/underscore/issues/683), [test](https://github.com/bestiejs/lodash/blob/v0.9.0/test/test.js#L1264-1267)]
|
||||||
|
|
||||||
## Optimized methods <sup>(50+)</sup>
|
|
||||||
|
|
||||||
* `_.bind`
|
|
||||||
* `_.bindAll`
|
|
||||||
* `_.compact`
|
|
||||||
* `_.contains`, `_.include`
|
|
||||||
* `_.defaults`
|
|
||||||
* `_.difference`
|
|
||||||
* `_.each`
|
|
||||||
* `_.every`, `_.all`
|
|
||||||
* `_.extend`
|
|
||||||
* `_.filter`, `_.select`
|
|
||||||
* `_.find`, `_.detect`
|
|
||||||
* `_.flatten`
|
|
||||||
* `_.forEach`, `_.each`
|
|
||||||
* `_.functions`, `_.methods`
|
|
||||||
* `_.groupBy`
|
|
||||||
* `_.indexOf`
|
|
||||||
* `_.intersection`
|
|
||||||
* `_.invert`
|
|
||||||
* `_.invoke`
|
|
||||||
* `_.isArguments`
|
|
||||||
* `_.isDate`
|
|
||||||
* `_.isFinite`
|
|
||||||
* `_.isFunction`
|
|
||||||
* `_.isObject`
|
|
||||||
* `_.isNumber`
|
|
||||||
* `_.isRegExp`
|
|
||||||
* `_.isString`
|
|
||||||
* `_.keys`
|
|
||||||
* `_.lastIndexOf`
|
|
||||||
* `_.map`, `_.collect`
|
|
||||||
* `_.max`
|
|
||||||
* `_.memoize`
|
|
||||||
* `_.min`
|
|
||||||
* `_.mixin`
|
|
||||||
* `_.omit`
|
|
||||||
* `_.pairs`
|
|
||||||
* `_.pick`
|
|
||||||
* `_.pluck`
|
|
||||||
* `_.reduce`, `_.foldl`, `_.inject`
|
|
||||||
* `_.reject`
|
|
||||||
* `_.result`
|
|
||||||
* `_.shuffle`
|
|
||||||
* `_.some`, `_.any`
|
|
||||||
* `_.sortBy`
|
|
||||||
* `_.sortedIndex`
|
|
||||||
* `_.template`
|
|
||||||
* `_.throttle`
|
|
||||||
* `_.toArray`
|
|
||||||
* `_.union`
|
|
||||||
* `_.uniq`, `_.unique`
|
|
||||||
* `_.values`
|
|
||||||
* `_.where`
|
|
||||||
* `_.without`
|
|
||||||
* `_.wrap`
|
|
||||||
* `_.zip`
|
|
||||||
* plus all `_(…)` method wrappers
|
|
||||||
|
|
||||||
## Release Notes
|
## Release Notes
|
||||||
|
|
||||||
### <sup>v0.8.2</sup>
|
### <sup>v0.9.0</sup>
|
||||||
|
|
||||||
* Ensured `_.map` returns an array when passed a falsey collection
|
* Added a `sourceURL` option to `_.template`
|
||||||
* Ensured `_.throttle` clears its timeout when `func` is called
|
* Ensured `_.where` returns an empty array if passed an empty `properties` object
|
||||||
* Made `_.max`, `_.min`, `_.shuffle` support iterating objects
|
* Expanded `_.isFinite` to return `true` for numeric strings
|
||||||
* Reduced `createIterator`, `_.clone`, and `_.compact`
|
* Reduced `_.intersection`, `_.omit`, `_.pick`, `_.sortedIndex`, and `_.where`
|
||||||
* Re-optimized `_.max`, `_.min`, and `_.sortedIndex`
|
* Reduced the `npm` package file size by only downloading the minifiers for global installs
|
||||||
|
* Reduced Lo-Dash's file size
|
||||||
|
* Removed compilation from `_.bindAll`, `_.contains`, `_.countBy`, `_.every`,
|
||||||
|
`_.filter`, `_.find`, `_.functions`, `_.groupBy`, `_.invert`, `_.invoke`,
|
||||||
|
`_.isEmpty`, `_.map`, `_.merge`, `_.omit`, `_.pairs`, `_.pick`, `_.pluck`,
|
||||||
|
`_.reduce`, `_.reject`, `_.some`, `_.sortBy`, `_.values`, `_.where`, and
|
||||||
|
internal `shimKeys`
|
||||||
|
|
||||||
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).
|
||||||
|
|
||||||
|
|||||||
406
build.js
406
build.js
@@ -12,14 +12,14 @@
|
|||||||
/** The current working directory */
|
/** The current working directory */
|
||||||
var cwd = process.cwd();
|
var cwd = process.cwd();
|
||||||
|
|
||||||
/** Shortcut to native `Array.prototype` */
|
/** Used for array method references */
|
||||||
var ArrayProto = Array.prototype;
|
var arrayRef = [];
|
||||||
|
|
||||||
/** Shortcut used to push arrays of values to an array */
|
/** Shortcut used to push arrays of values to an array */
|
||||||
var push = ArrayProto.push;
|
var push = arrayRef.push;
|
||||||
|
|
||||||
/** Shortcut used to convert array-like objects to arrays */
|
/** Shortcut used to convert array-like objects to arrays */
|
||||||
var slice = ArrayProto.slice;
|
var slice = arrayRef.slice;
|
||||||
|
|
||||||
/** Shortcut to the `stdout` object */
|
/** Shortcut to the `stdout` object */
|
||||||
var stdout = process.stdout;
|
var stdout = process.stdout;
|
||||||
@@ -65,43 +65,43 @@
|
|||||||
var dependencyMap = {
|
var dependencyMap = {
|
||||||
'after': [],
|
'after': [],
|
||||||
'bind': ['isFunction'],
|
'bind': ['isFunction'],
|
||||||
'bindAll': ['bind', 'isFunction'],
|
'bindAll': ['bind', 'functions'],
|
||||||
'chain': ['mixin'],
|
'chain': ['mixin'],
|
||||||
'clone': ['extend', 'forEach', 'forOwn', 'isArguments', 'isPlainObject'],
|
'clone': ['extend', 'forEach', 'forOwn', 'isArguments', 'isPlainObject'],
|
||||||
'compact': [],
|
'compact': [],
|
||||||
'compose': [],
|
'compose': [],
|
||||||
'contains': [],
|
'contains': ['indexOf', 'some'],
|
||||||
'countBy': ['identity'],
|
'countBy': ['forEach'],
|
||||||
'debounce': [],
|
'debounce': [],
|
||||||
'defaults': ['isArguments'],
|
'defaults': ['isArguments'],
|
||||||
'defer': [],
|
'defer': [],
|
||||||
'delay': [],
|
'delay': [],
|
||||||
'difference': ['indexOf'],
|
'difference': ['indexOf'],
|
||||||
'escape': [],
|
'escape': [],
|
||||||
'every': ['identity'],
|
'every': ['forEach'],
|
||||||
'extend': ['isArguments'],
|
'extend': ['isArguments'],
|
||||||
'filter': ['identity'],
|
'filter': ['forEach'],
|
||||||
'find': ['identity'],
|
'find': ['some'],
|
||||||
'first': [],
|
'first': [],
|
||||||
'flatten': ['isArray'],
|
'flatten': ['isArray'],
|
||||||
'forEach': ['identity'],
|
'forEach': ['identity'],
|
||||||
'forIn': ['identity', 'isArguments'],
|
'forIn': ['identity', 'isArguments'],
|
||||||
'forOwn': ['identity', 'isArguments'],
|
'forOwn': ['identity', 'isArguments'],
|
||||||
'functions': ['isArguments', 'isFunction'],
|
'functions': ['forIn', 'isFunction'],
|
||||||
'groupBy': ['identity'],
|
'groupBy': ['forEach'],
|
||||||
'has': [],
|
'has': [],
|
||||||
'identity': [],
|
'identity': [],
|
||||||
'indexOf': ['sortedIndex'],
|
'indexOf': ['sortedIndex'],
|
||||||
'initial': [],
|
'initial': [],
|
||||||
'intersection': ['indexOf'],
|
'intersection': ['filter', 'indexOf'],
|
||||||
'invert': [],
|
'invert': ['forOwn'],
|
||||||
'invoke': [],
|
'invoke': ['forEach'],
|
||||||
'isArguments': [],
|
'isArguments': [],
|
||||||
'isArray': [],
|
'isArray': [],
|
||||||
'isBoolean': [],
|
'isBoolean': [],
|
||||||
'isDate': [],
|
'isDate': [],
|
||||||
'isElement': [],
|
'isElement': [],
|
||||||
'isEmpty': ['isArguments', 'isFunction'],
|
'isEmpty': ['forOwn', 'isArguments', 'isFunction'],
|
||||||
'isEqual': ['isArguments', 'isFunction'],
|
'isEqual': ['isArguments', 'isFunction'],
|
||||||
'isFinite': [],
|
'isFinite': [],
|
||||||
'isFunction': [],
|
'isFunction': [],
|
||||||
@@ -113,48 +113,48 @@
|
|||||||
'isRegExp': [],
|
'isRegExp': [],
|
||||||
'isString': [],
|
'isString': [],
|
||||||
'isUndefined': [],
|
'isUndefined': [],
|
||||||
'keys': ['isArguments'],
|
'keys': ['forOwn', 'isArguments'],
|
||||||
'last': [],
|
'last': [],
|
||||||
'lastIndexOf': [],
|
'lastIndexOf': [],
|
||||||
'lateBind': ['isFunction'],
|
'lateBind': ['isFunction'],
|
||||||
'map': ['identity'],
|
'map': ['forEach', 'isArray'],
|
||||||
'max': ['forEach'],
|
'max': ['forEach'],
|
||||||
'memoize': [],
|
'memoize': [],
|
||||||
'merge': ['isArray', 'isPlainObject'],
|
'merge': ['forOwn', 'isArray', 'isPlainObject'],
|
||||||
'min': ['forEach'],
|
'min': ['forEach'],
|
||||||
'mixin': ['forEach', 'functions'],
|
'mixin': ['forEach', 'functions'],
|
||||||
'noConflict': [],
|
'noConflict': [],
|
||||||
'object': [],
|
'object': [],
|
||||||
'omit': ['indexOf', 'isArguments'],
|
'omit': ['forIn', 'indexOf'],
|
||||||
'once': [],
|
'once': [],
|
||||||
'pairs': [],
|
'pairs': ['forOwn'],
|
||||||
'partial': ['isFunction'],
|
'partial': ['isFunction'],
|
||||||
'pick': [],
|
'pick': ['forIn'],
|
||||||
'pluck': [],
|
'pluck': ['forEach'],
|
||||||
'random': [],
|
'random': [],
|
||||||
'range': [],
|
'range': [],
|
||||||
'reduce': ['identity'],
|
'reduce': ['forEach'],
|
||||||
'reduceRight': ['forEach', 'keys'],
|
'reduceRight': ['forEach', 'keys'],
|
||||||
'reject': ['identity'],
|
'reject': ['filter'],
|
||||||
'rest': [],
|
'rest': [],
|
||||||
'result': ['isFunction'],
|
'result': ['isFunction'],
|
||||||
'shuffle': ['forEach'],
|
'shuffle': ['forEach'],
|
||||||
'size': ['keys'],
|
'size': ['keys'],
|
||||||
'some': ['identity'],
|
'some': ['forEach'],
|
||||||
'sortBy': ['identity'],
|
'sortBy': ['forEach'],
|
||||||
'sortedIndex': ['identity'],
|
'sortedIndex': ['identity'],
|
||||||
'tap': ['mixin'],
|
'tap': ['mixin'],
|
||||||
'template': ['escape'],
|
'template': ['escape'],
|
||||||
'throttle': [],
|
'throttle': [],
|
||||||
'times': [],
|
'times': [],
|
||||||
'toArray': ['isFunction', 'values'],
|
'toArray': ['values'],
|
||||||
'unescape': [],
|
'unescape': [],
|
||||||
'union': ['indexOf'],
|
'union': ['indexOf'],
|
||||||
'uniq': ['identity', 'indexOf'],
|
'uniq': ['identity', 'indexOf'],
|
||||||
'uniqueId': [],
|
'uniqueId': [],
|
||||||
'value': ['mixin'],
|
'value': ['mixin'],
|
||||||
'values': ['isArguments'],
|
'values': ['forOwn'],
|
||||||
'where': ['forIn'],
|
'where': ['filter', 'forIn'],
|
||||||
'without': ['indexOf'],
|
'without': ['indexOf'],
|
||||||
'wrap': [],
|
'wrap': [],
|
||||||
'zip': ['max', 'pluck']
|
'zip': ['max', 'pluck']
|
||||||
@@ -163,17 +163,12 @@
|
|||||||
/** Used to inline `iteratorTemplate` */
|
/** Used to inline `iteratorTemplate` */
|
||||||
var iteratorOptions = [
|
var iteratorOptions = [
|
||||||
'args',
|
'args',
|
||||||
'array',
|
'arrayLoop',
|
||||||
'arrayBranch',
|
|
||||||
'beforeLoop',
|
|
||||||
'bottom',
|
'bottom',
|
||||||
'firstArg',
|
'firstArg',
|
||||||
'hasDontEnumBug',
|
'hasDontEnumBug',
|
||||||
'inLoop',
|
|
||||||
'init',
|
|
||||||
'isKeysFast',
|
'isKeysFast',
|
||||||
'object',
|
'objectLoop',
|
||||||
'objectBranch',
|
|
||||||
'noArgsEnum',
|
'noArgsEnum',
|
||||||
'noCharByIndex',
|
'noCharByIndex',
|
||||||
'shadowed',
|
'shadowed',
|
||||||
@@ -275,9 +270,8 @@
|
|||||||
" var freeExports = typeof exports == 'object' && exports &&",
|
" var freeExports = typeof exports == 'object' && exports &&",
|
||||||
" (typeof global == 'object' && global && global == global.global && (window = global), exports);",
|
" (typeof global == 'object' && global && global == global.global && (window = global), exports);",
|
||||||
'',
|
'',
|
||||||
' var templates = {};',
|
' var templates = {},',
|
||||||
'',
|
' _ = window._;',
|
||||||
' var _ = window._;',
|
|
||||||
''
|
''
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -295,16 +289,14 @@
|
|||||||
precompiled = getFunctionSource(_.template(text, null, options)),
|
precompiled = getFunctionSource(_.template(text, null, options)),
|
||||||
prop = filename.replace(/\..*$/, '');
|
prop = filename.replace(/\..*$/, '');
|
||||||
|
|
||||||
source.push(" templates['" + prop + "'] = " + precompiled + ';');
|
source.push(" templates['" + prop.replace(/'/g, "\\'") + "'] = " + precompiled + ';', '');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
source.push(
|
source.push(
|
||||||
'',
|
|
||||||
" if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {",
|
" if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {",
|
||||||
" define(['" + moduleName + "'], function(lodash) {",
|
" define(['" + moduleName + "'], function(lodash) {",
|
||||||
' _ = lodash;',
|
' lodash.templates = lodash.extend(lodash.templates || {}, templates);',
|
||||||
' _.templates = _.extend(_.templates || {}, templates);',
|
|
||||||
' });',
|
' });',
|
||||||
" } else if (freeExports) {",
|
" } else if (freeExports) {",
|
||||||
" if (typeof module == 'object' && module && module.exports == freeExports) {",
|
" if (typeof module == 'object' && module && module.exports == freeExports) {",
|
||||||
@@ -679,10 +671,6 @@
|
|||||||
return removeVar(source, 'isKeysFast')
|
return removeVar(source, 'isKeysFast')
|
||||||
// remove optimized branch in `iteratorTemplate`
|
// remove optimized branch in `iteratorTemplate`
|
||||||
.replace(/(?: *\/\/.*\n)* *'( *)<% *if *\(isKeysFast[\s\S]+?'\1<% *} *else *\{ *%>.+\n([\s\S]+?) *'\1<% *} *%>.+/, "'\\n' +\n$2")
|
.replace(/(?: *\/\/.*\n)* *'( *)<% *if *\(isKeysFast[\s\S]+?'\1<% *} *else *\{ *%>.+\n([\s\S]+?) *'\1<% *} *%>.+/, "'\\n' +\n$2")
|
||||||
// remove `isKeysFast` from `beforeLoop.object` of `mapIteratorOptions`
|
|
||||||
.replace(/=\s*'\s*\+\s*\(isKeysFast.+/, "= []'")
|
|
||||||
// remove `isKeysFast` from `inLoop.object` of `mapIteratorOptions`, `invoke`, `pairs`, `pluck`, and `sortBy`
|
|
||||||
.replace(/'\s*\+\s*\(isKeysFast[^)]+?\)\s*\+\s*'/g, '.push')
|
|
||||||
// remove data object property assignment in `createIterator`
|
// remove data object property assignment in `createIterator`
|
||||||
.replace(/ *'isKeysFast':.+\n/, '');
|
.replace(/ *'isKeysFast':.+\n/, '');
|
||||||
}
|
}
|
||||||
@@ -728,9 +716,13 @@
|
|||||||
* @returns {String} Returns the source with the variable removed.
|
* @returns {String} Returns the source with the variable removed.
|
||||||
*/
|
*/
|
||||||
function removeVar(source, varName) {
|
function removeVar(source, varName) {
|
||||||
// simplify `arrayLikeClasses` and `cloneableClasses`
|
// simplify `cloneableClasses`
|
||||||
if (/^(?:arrayLike|cloneable)Classes$/.test(varName)) {
|
if (varName == 'cloneableClasses') {
|
||||||
source = source.replace(RegExp('(var ' + varName + ' *=)[\\s\\S]+?(true;\\n)'), '$1$2');
|
source = source.replace(/(var cloneableClasses *=)[\s\S]+?(true;\n)/, '$1$2');
|
||||||
|
}
|
||||||
|
// simplify `hasObjectSpliceBug`
|
||||||
|
if (varName == 'hasObjectSpliceBug') {
|
||||||
|
source = source.replace(/(var hasObjectSpliceBug *=)[^;]+/, '$1false');
|
||||||
}
|
}
|
||||||
source = source.replace(RegExp(
|
source = source.replace(RegExp(
|
||||||
// match multi-line comment block
|
// match multi-line comment block
|
||||||
@@ -747,8 +739,8 @@
|
|||||||
// remove a variable at the end of a variable declaration list
|
// remove a variable at the end of a variable declaration list
|
||||||
source = source.replace(RegExp(',\\s*' + varName + ' *=.+?;'), ';');
|
source = source.replace(RegExp(',\\s*' + varName + ' *=.+?;'), ';');
|
||||||
|
|
||||||
// remove variable reference from `arrayLikeClasses` and `cloneableClasses` assignments
|
// remove variable reference from `cloneableClasses` assignments
|
||||||
source = source.replace(RegExp('(?:arrayLikeClasses|cloneableClasses)\\[' + varName + '\\] *= *(?:false|true)?', 'g'), '');
|
source = source.replace(RegExp('cloneableClasses\\[' + varName + '\\] *= *(?:false|true)?', 'g'), '');
|
||||||
|
|
||||||
return removeFromCreateIterator(source, varName);
|
return removeFromCreateIterator(source, varName);
|
||||||
}
|
}
|
||||||
@@ -789,21 +781,21 @@
|
|||||||
* @returns {String} Returns the modified source.
|
* @returns {String} Returns the modified source.
|
||||||
*/
|
*/
|
||||||
function setUseStrictOption(source, value) {
|
function setUseStrictOption(source, value) {
|
||||||
// remove `isStrictFast` assignment
|
// inject "use strict"
|
||||||
return removeVar(source, 'isStrictFast')
|
if (value) {
|
||||||
// replace `useStrict` branch in `value` with hard-coded option
|
source = source.replace(/^[\s\S]*?function[^{]+{/, "$&\n 'use strict';");
|
||||||
.replace(/(?: *\/\/.*\n)*(\s*)' *<% *if *\(useStrict\).+/, value ? "$1'\\'use strict\\';\\n' +" : '')
|
}
|
||||||
// remove `useStrict` from iterator options
|
// replace `useStrict` branch in `value` with hard-coded option
|
||||||
.replace(/ *'useStrict': *false,\n/g, '')
|
return source.replace(/(?: *\/\/.*\n)*(\s*)' *<%.+?useStrict.+/, value ? "$1'\\'use strict\\';\\n' +" : '');
|
||||||
// remove `useStrict` data object property assignment in `createIterator`
|
|
||||||
.replace(/ *'useStrict':.+\n/, '');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a debug and minified build, executing the `callback` for each.
|
* Creates a debug and/or minified build, executing the `callback` for each.
|
||||||
* The `callback` is invoked with 2 arguments; (filePath, source)
|
* The `callback` is invoked with two arguments; (filePath, outputSource).
|
||||||
|
*
|
||||||
|
* Note: For a list of commands see `displayHelp()` or run `lodash --help`.
|
||||||
*
|
*
|
||||||
* @param {Array} [options=[]] An array of commands.
|
* @param {Array} [options=[]] An array of commands.
|
||||||
* @param {Function} callback The function called per build.
|
* @param {Function} callback The function called per build.
|
||||||
@@ -945,12 +937,14 @@
|
|||||||
// the lodash.js source
|
// the lodash.js source
|
||||||
var source = fs.readFileSync(path.join(__dirname, 'lodash.js'), 'utf8');
|
var source = fs.readFileSync(path.join(__dirname, 'lodash.js'), 'utf8');
|
||||||
|
|
||||||
// flag used to specify if the build should include the "use strict" directive
|
|
||||||
var useStrict = isStrict || !(isLegacy || isMobile);
|
|
||||||
|
|
||||||
// flag used to specify replacing Lo-Dash's `_.clone` with Underscore's
|
// flag used to specify replacing Lo-Dash's `_.clone` with Underscore's
|
||||||
var useUnderscoreClone = isUnderscore;
|
var useUnderscoreClone = isUnderscore;
|
||||||
|
|
||||||
|
// flags used to specify exposing Lo-Dash methods in an Underscore build
|
||||||
|
var exposeForIn = !isUnderscore,
|
||||||
|
exposeForOwn = !isUnderscore,
|
||||||
|
exposeIsPlainObject = !isUnderscore;
|
||||||
|
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
|
|
||||||
// names of methods to include in the build
|
// names of methods to include in the build
|
||||||
@@ -969,17 +963,30 @@
|
|||||||
: accumulator;
|
: accumulator;
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
// update dependencies
|
||||||
|
if (isUnderscore) {
|
||||||
|
dependencyMap.isEqual = ['isArray', 'isFunction'];
|
||||||
|
dependencyMap.isEmpty = ['isArray', 'isString'];
|
||||||
|
dependencyMap.pick = [];
|
||||||
|
dependencyMap.template = ['defaults', 'escape'];
|
||||||
|
|
||||||
|
if (useUnderscoreClone) {
|
||||||
|
dependencyMap.clone = ['extend', 'isArray'];
|
||||||
|
}
|
||||||
|
}
|
||||||
// add method names explicitly
|
// add method names explicitly
|
||||||
options.some(function(value) {
|
options.some(function(value) {
|
||||||
return /include/.test(value) &&
|
return /include/.test(value) &&
|
||||||
(result = getDependencies(optionToMethodsArray(source, value)));
|
(result = getDependencies(optionToMethodsArray(source, value)));
|
||||||
});
|
});
|
||||||
|
|
||||||
// use Lo-Dash's clone if explicitly requested
|
// include Lo-Dash's methods if explicitly requested
|
||||||
if (result && result.indexOf('clone') > -1) {
|
if (result) {
|
||||||
useUnderscoreClone = false;
|
exposeForIn = result.indexOf('forIn') > -1;
|
||||||
|
exposeForOwn = result.indexOf('forOwn') > -1;
|
||||||
|
exposeIsPlainObject = result.indexOf('isPlainObject') > -1;
|
||||||
|
useUnderscoreClone = result.indexOf('clone') < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// add method names required by Backbone and Underscore builds
|
// add method names required by Backbone and Underscore builds
|
||||||
if (isBackbone && !result) {
|
if (isBackbone && !result) {
|
||||||
result = getDependencies(backboneDependencies);
|
result = getDependencies(backboneDependencies);
|
||||||
@@ -1002,11 +1009,9 @@
|
|||||||
return (result = _.union(result || [], getDependencies(methodNames)));
|
return (result = _.union(result || [], getDependencies(methodNames)));
|
||||||
});
|
});
|
||||||
|
|
||||||
// init `result` if it hasn't been inited
|
|
||||||
if (!result) {
|
if (!result) {
|
||||||
result = allMethods.slice();
|
result = allMethods.slice();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (plusMethods.length) {
|
if (plusMethods.length) {
|
||||||
result = _.union(result, getDependencies(plusMethods));
|
result = _.union(result, getDependencies(plusMethods));
|
||||||
}
|
}
|
||||||
@@ -1022,20 +1027,14 @@
|
|||||||
var lodash = !isTemplate && (function() {
|
var lodash = !isTemplate && (function() {
|
||||||
var context = vm.createContext({
|
var context = vm.createContext({
|
||||||
'clearTimeout': clearTimeout,
|
'clearTimeout': clearTimeout,
|
||||||
|
'console': console,
|
||||||
'setTimeout': setTimeout
|
'setTimeout': setTimeout
|
||||||
});
|
});
|
||||||
|
|
||||||
if (isStrict) {
|
source = setUseStrictOption(source, isStrict);
|
||||||
source = setUseStrictOption(source, true);
|
|
||||||
} else {
|
|
||||||
// remove "use strict" directive
|
|
||||||
source = source.replace(/(["'])use strict\1;( *\n)?/, '');
|
|
||||||
if (!useStrict) {
|
|
||||||
source = setUseStrictOption(source, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (isLegacy) {
|
if (isLegacy) {
|
||||||
_.each(['getPrototypeOf', 'isBindFast', 'isKeysFast', 'isStrictFast', 'nativeBind', 'nativeIsArray', 'nativeKeys'], function(varName) {
|
_.each(['getPrototypeOf', 'isBindFast', 'isKeysFast', 'nativeBind', 'nativeIsArray', 'nativeKeys'], function(varName) {
|
||||||
source = replaceVar(source, varName, 'false');
|
source = replaceVar(source, varName, 'false');
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1043,12 +1042,7 @@
|
|||||||
source = removeKeysOptimization(source);
|
source = removeKeysOptimization(source);
|
||||||
}
|
}
|
||||||
else if (isUnderscore) {
|
else if (isUnderscore) {
|
||||||
// update dependencies
|
|
||||||
dependencyMap.isEqual = ['isArray', 'isFunction'];
|
|
||||||
dependencyMap.isEmpty = ['isArray'];
|
|
||||||
|
|
||||||
// remove unneeded variables
|
// remove unneeded variables
|
||||||
source = removeVar(source, 'arrayLikeClasses');
|
|
||||||
source = removeVar(source, 'cloneableClasses');
|
source = removeVar(source, 'cloneableClasses');
|
||||||
|
|
||||||
// remove large array optimizations
|
// remove large array optimizations
|
||||||
@@ -1057,7 +1051,6 @@
|
|||||||
|
|
||||||
// replace `_.clone`
|
// replace `_.clone`
|
||||||
if (useUnderscoreClone) {
|
if (useUnderscoreClone) {
|
||||||
dependencyMap.clone = ['extend', 'isArray'];
|
|
||||||
source = source.replace(/^( +)function clone[\s\S]+?\n\1}/m, [
|
source = source.replace(/^( +)function clone[\s\S]+?\n\1}/m, [
|
||||||
' function clone(value) {',
|
' function clone(value) {',
|
||||||
' return value && objectTypes[typeof value]',
|
' return value && objectTypes[typeof value]',
|
||||||
@@ -1072,7 +1065,7 @@
|
|||||||
' function difference(array) {',
|
' function difference(array) {',
|
||||||
' var index = -1,',
|
' var index = -1,',
|
||||||
' length = array.length,',
|
' length = array.length,',
|
||||||
' flattened = concat.apply(ArrayProto, arguments),',
|
' flattened = concat.apply(arrayRef, arguments),',
|
||||||
' result = [];',
|
' result = [];',
|
||||||
'',
|
'',
|
||||||
' while (++index < length) {',
|
' while (++index < length) {',
|
||||||
@@ -1088,23 +1081,73 @@
|
|||||||
// replace `_.intersection`
|
// replace `_.intersection`
|
||||||
source = source.replace(/^( +)function intersection[\s\S]+?\n\1}/m, [
|
source = source.replace(/^( +)function intersection[\s\S]+?\n\1}/m, [
|
||||||
' function intersection(array) {',
|
' function intersection(array) {',
|
||||||
' var argsLength = arguments.length,',
|
' var args = arguments,',
|
||||||
' index = -1,',
|
' argsLength = args.length,',
|
||||||
' length = array.length,',
|
|
||||||
' result = [];',
|
' result = [];',
|
||||||
'',
|
'',
|
||||||
' array: while (++index < length) {',
|
' forEach(array, function(value) {',
|
||||||
' var value = array[index]',
|
|
||||||
' if (indexOf(result, value) < 0) {',
|
' if (indexOf(result, value) < 0) {',
|
||||||
' for (var argsIndex = 1; argsIndex < argsLength; argsIndex++) {',
|
' var length = argsLength;',
|
||||||
' if (indexOf(arguments[argsIndex], value) < 0) {',
|
' while (--length) {',
|
||||||
' continue array;',
|
' if (indexOf(args[length], value) < 0) {',
|
||||||
|
' return;',
|
||||||
' }',
|
' }',
|
||||||
' }',
|
' }',
|
||||||
' result.push(value);',
|
' result.push(value);',
|
||||||
' }',
|
' }',
|
||||||
|
' });',
|
||||||
|
' return result;',
|
||||||
|
' }'
|
||||||
|
].join('\n'));
|
||||||
|
|
||||||
|
// replace `_.isEmpty`
|
||||||
|
source = source.replace(/^( +)function isEmpty[\s\S]+?\n\1}/m, [
|
||||||
|
' function isEmpty(value) {',
|
||||||
|
' if (!value) {',
|
||||||
|
' return true;',
|
||||||
' }',
|
' }',
|
||||||
' return result',
|
' if (isArray(value) || isString(value)) {',
|
||||||
|
' return !value.length;',
|
||||||
|
' }',
|
||||||
|
' for (var key in value) {',
|
||||||
|
' if (hasOwnProperty.call(value, key)) {',
|
||||||
|
' return false;',
|
||||||
|
' }',
|
||||||
|
' }',
|
||||||
|
' return true;',
|
||||||
|
' }'
|
||||||
|
].join('\n'));
|
||||||
|
|
||||||
|
// replace `_.omit`
|
||||||
|
source = source.replace(/^( +)function omit[\s\S]+?\n\1}/m, [
|
||||||
|
' function omit(object) {',
|
||||||
|
' var props = concat.apply(arrayRef, arguments),',
|
||||||
|
' result = {};',
|
||||||
|
'',
|
||||||
|
' forIn(object, function(value, key) {',
|
||||||
|
' if (indexOf(props, key, 1) < 0) {',
|
||||||
|
' result[key] = value;',
|
||||||
|
' }',
|
||||||
|
' });',
|
||||||
|
' return result;',
|
||||||
|
' }'
|
||||||
|
].join('\n'));
|
||||||
|
|
||||||
|
// replace `_.pick`
|
||||||
|
source = source.replace(/^( +)function pick[\s\S]+?\n\1}/m, [
|
||||||
|
' function pick(object) {',
|
||||||
|
' var index = 0,',
|
||||||
|
' props = concat.apply(arrayRef, arguments),',
|
||||||
|
' length = props.length,',
|
||||||
|
' result = {};',
|
||||||
|
'',
|
||||||
|
' while (++index < length) {',
|
||||||
|
' var prop = props[index];',
|
||||||
|
' if (prop in object) {',
|
||||||
|
' result[prop] = object[prop];',
|
||||||
|
' }',
|
||||||
|
' }',
|
||||||
|
' return result;',
|
||||||
' }'
|
' }'
|
||||||
].join('\n'));
|
].join('\n'));
|
||||||
|
|
||||||
@@ -1125,15 +1168,18 @@
|
|||||||
' }'
|
' }'
|
||||||
].join('\n'));
|
].join('\n'));
|
||||||
|
|
||||||
// replace `arrayLikeClasses` in `_.isEmpty`
|
// remove string support from `_.contains`
|
||||||
source = source.replace(/'if *\(arrayLikeClasses[\s\S]+?' \|\|\\n/, "'if (isArray(value) || className == stringClass ||");
|
source = source.replace(/return *\(toString\.call.+?stringClass[\s\S]+?;/, 'return indexOf(collection, target) > -1;');
|
||||||
|
|
||||||
// replace `arrayLikeClasses` in `_.isEqual`
|
// remove `arguments` object check from `_.isEqual`
|
||||||
source = source.replace(/(?: *\/\/.*\n)*( +)var isArr *= *arrayLikeClasses[^}]+}/, '$1var isArr = isArray(a);');
|
source = source.replace(/ *\|\| *className *== *argsClass/, '');
|
||||||
|
|
||||||
// remove "exit early" feature from `_.each`
|
// simplify DOM node check from `_.isEqual`
|
||||||
source = source.replace(/( +)var baseIteratorOptions *=[\s\S]+?\n\1.+?;/, function(match) {
|
source = source.replace(/(if *\(className *!= *objectClass).+?noNodeClass[\s\S]+?{/, '$1) {');
|
||||||
return match.replace(/if *\(callback[^']+/, 'callback(value, index, collection)');
|
|
||||||
|
// remove arguments juggling from `_.uniq`
|
||||||
|
source = source.replace(matchFunction(source, 'uniq'), function(match) {
|
||||||
|
return match.replace(/(?: *\/\/.*\n)*( +)if *\(typeof isSorted[^}]+?}\n/, '');
|
||||||
});
|
});
|
||||||
|
|
||||||
// remove unused features from `createBound`
|
// remove unused features from `createBound`
|
||||||
@@ -1214,8 +1260,8 @@
|
|||||||
// replace `_.keys` with `shimKeys`
|
// replace `_.keys` with `shimKeys`
|
||||||
if (!isRemoved(source, 'keys')) {
|
if (!isRemoved(source, 'keys')) {
|
||||||
source = source.replace(
|
source = source.replace(
|
||||||
matchFunction(source, 'keys').replace(/[\s\S]+?var keys *=/, ''),
|
matchFunction(source, 'keys').replace(/[\s\S]+?var keys *= */, ''),
|
||||||
matchFunction(source, 'shimKeys').replace(/[\s\S]+?var shimKeys *=/, '')
|
matchFunction(source, 'shimKeys').replace(/[\s\S]+?function shimKeys/, 'function').replace(/}\n$/, '};\n')
|
||||||
);
|
);
|
||||||
|
|
||||||
source = removeFunction(source, 'shimKeys');
|
source = removeFunction(source, 'shimKeys');
|
||||||
@@ -1239,8 +1285,7 @@
|
|||||||
if (isMobile) {
|
if (isMobile) {
|
||||||
// inline all functions defined with `createIterator`
|
// inline all functions defined with `createIterator`
|
||||||
_.functions(lodash).forEach(function(methodName) {
|
_.functions(lodash).forEach(function(methodName) {
|
||||||
// match `methodName` with pseudo private `_` prefixes removed to allow matching `shimKeys`
|
var reFunc = RegExp('(\\bvar ' + methodName + ' *= *)createIterator\\(((?:{|[a-zA-Z])[\\s\\S]+?)\\);\\n');
|
||||||
var reFunc = RegExp('(\\bvar ' + methodName.replace(/^_/, '') + ' *= *)createIterator\\(((?:{|[a-zA-Z])[\\s\\S]+?)\\);\\n');
|
|
||||||
|
|
||||||
// skip if not defined with `createIterator`
|
// skip if not defined with `createIterator`
|
||||||
if (!reFunc.test(source)) {
|
if (!reFunc.test(source)) {
|
||||||
@@ -1250,17 +1295,23 @@
|
|||||||
source = source.replace(reFunc, '$1' + getFunctionSource(lodash[methodName]) + ';\n');
|
source = source.replace(reFunc, '$1' + getFunctionSource(lodash[methodName]) + ';\n');
|
||||||
});
|
});
|
||||||
|
|
||||||
// replace `callee` in `_.merge` with `merge`
|
|
||||||
source = source.replace(matchFunction(source, 'merge'), function(match) {
|
|
||||||
return match.replace(/\bcallee\b/g, 'merge');
|
|
||||||
});
|
|
||||||
|
|
||||||
if (isUnderscore) {
|
if (isUnderscore) {
|
||||||
// remove "compiled template cleanup" from `_.template`
|
// remove `_.forIn`, `_.forOwn`, and `_.isPlainObject` assignments
|
||||||
source = source.replace(/(?:\s*\/\/.*)*\n *source *=.+?isEvaluating.+?reEmptyStringLeading[\s\S]+?\);/, '');
|
(function() {
|
||||||
source = removeVar(source, 'reEmptyStringLeading');
|
var snippet = getMethodAssignments(source),
|
||||||
source = removeVar(source, 'reEmptyStringMiddle');
|
modified = snippet;
|
||||||
source = removeVar(source, 'reEmptyStringTrailing');
|
|
||||||
|
if (!exposeForIn) {
|
||||||
|
modified = modified.replace(/(?:\n *\/\/.*\s*)* *lodash\.forIn *= *.+\n/, '');
|
||||||
|
}
|
||||||
|
if (!exposeForOwn) {
|
||||||
|
modified = modified.replace(/(?:\n *\/\/.*\s*)* *lodash\.forOwn *= *.+\n/, '');
|
||||||
|
}
|
||||||
|
if (!exposeIsPlainObject) {
|
||||||
|
modified = modified.replace(/(?:\n *\/\/.*\s*)* *lodash\.isPlainObject *= *.+\n/, '');
|
||||||
|
}
|
||||||
|
source = source.replace(snippet, modified);
|
||||||
|
}());
|
||||||
|
|
||||||
// replace `isArguments` and its fallback
|
// replace `isArguments` and its fallback
|
||||||
(function() {
|
(function() {
|
||||||
@@ -1275,17 +1326,108 @@
|
|||||||
.replace(/\bnoArgsClass\b/g, '!lodash.isArguments(arguments)');
|
.replace(/\bnoArgsClass\b/g, '!lodash.isArguments(arguments)');
|
||||||
});
|
});
|
||||||
}());
|
}());
|
||||||
|
|
||||||
|
// unexpose "exit early" feature from `_.forEach`, `_.forIn`, and `_.forOwn`
|
||||||
|
_.each(['forEach', 'forIn', 'forOwn'], function(methodName) {
|
||||||
|
source = source.replace(matchFunction(source, methodName), function(match) {
|
||||||
|
return match.replace(/=== *false\)/g, '=== indicatorObject)');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// modify `_.every` and `_.some` to use the private `indicatorObject`
|
||||||
|
source = source.replace(matchFunction(source, 'every'), function(match) {
|
||||||
|
return match.replace(/\(result *= *(.+?)\);/, '!(result = $1) && indicatorObject;');
|
||||||
|
});
|
||||||
|
|
||||||
|
source = source.replace(matchFunction(source, 'some'), function(match) {
|
||||||
|
return match.replace(/!\(result *= *(.+?)\);/, '(result = $1) && indicatorObject;');
|
||||||
|
});
|
||||||
|
|
||||||
|
// replace `_.template`
|
||||||
|
source = source.replace(/^( +)function template[\s\S]+?\n\1}/m, function() {
|
||||||
|
return [
|
||||||
|
' function template(text, data, options) {',
|
||||||
|
" text || (text = '');",
|
||||||
|
' options = defaults({}, options, lodash.templateSettings);',
|
||||||
|
'',
|
||||||
|
' var index = 0,',
|
||||||
|
' source = "__p += \'",',
|
||||||
|
" variable = options.variable;",
|
||||||
|
'',
|
||||||
|
' var reDelimiters = RegExp(',
|
||||||
|
" (options.escape || reNoMatch).source + '|' +",
|
||||||
|
" (options.interpolate || reNoMatch).source + '|' +",
|
||||||
|
" (options.evaluate || reNoMatch).source + '|$'",
|
||||||
|
" , 'g');",
|
||||||
|
'',
|
||||||
|
' text.replace(reDelimiters, function(match, escapeValue, interpolateValue, evaluateValue, offset) {',
|
||||||
|
' source += text.slice(index, offset).replace(reUnescapedString, escapeStringChar);',
|
||||||
|
' source +=',
|
||||||
|
' escapeValue ? "\' +\\n_.escape(" + escapeValue + ") +\\n\'" :',
|
||||||
|
' evaluateValue ? "\';\\n" + evaluateValue + ";\\n__p += \'" :',
|
||||||
|
' interpolateValue ? "\' +\\n((__t = (" + interpolateValue + ")) == null ? \'\' : __t) +\\n\'" : \'\';',
|
||||||
|
'',
|
||||||
|
' index = offset + match.length;',
|
||||||
|
' });',
|
||||||
|
'',
|
||||||
|
' source += "\';\\n";',
|
||||||
|
' if (!variable) {',
|
||||||
|
" variable = 'obj';",
|
||||||
|
" source = 'with (' + variable + ' || {}) {\\n' + source + '\\n}\\n';",
|
||||||
|
' }',
|
||||||
|
" source = 'function(' + variable + ') {\\n' +",
|
||||||
|
" 'var __t, __p = \\'\\', __j = Array.prototype.join;\\n' +",
|
||||||
|
" 'function print() { __p += __j.call(arguments, \\'\\') }\\n' +",
|
||||||
|
' source +',
|
||||||
|
" 'return __p\\n}';",
|
||||||
|
'',
|
||||||
|
' try {',
|
||||||
|
" var result = Function('_', 'return ' + source)(lodash);",
|
||||||
|
' } catch(e) {',
|
||||||
|
' e.source = source;',
|
||||||
|
' throw e;',
|
||||||
|
' }',
|
||||||
|
' if (data) {',
|
||||||
|
' return result(data);',
|
||||||
|
' }',
|
||||||
|
' result.source = source;',
|
||||||
|
' return result;',
|
||||||
|
' }'
|
||||||
|
].join('\n');
|
||||||
|
});
|
||||||
|
|
||||||
|
// remove unneeded template related variables
|
||||||
|
source = removeVar(source, 'reComplexDelimiter');
|
||||||
|
source = removeVar(source, 'reEmptyStringLeading');
|
||||||
|
source = removeVar(source, 'reEmptyStringMiddle');
|
||||||
|
source = removeVar(source, 'reEmptyStringTrailing');
|
||||||
|
source = removeVar(source, 'reInsertVariable');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
source = removeIsArgumentsFallback(source);
|
source = removeIsArgumentsFallback(source);
|
||||||
|
source = removeVar(source, 'hasObjectSpliceBug');
|
||||||
// remove `hasDontEnumBug`, `hasObjectSpliceBug`, `iteratesOwnLast`, `noArgsEnum` assignment
|
|
||||||
source = source.replace(/(?:\n +\/\*[^*]*\*+(?:[^\/][^*]*\*+)*\/)?\n *var hasDontEnumBug\b[\s\S]+?}\(1\)\);\n/, '');
|
|
||||||
|
|
||||||
// remove `hasObjectSpliceBug` fix from the mutator Array functions mixin
|
// remove `hasObjectSpliceBug` fix from the mutator Array functions mixin
|
||||||
source = source.replace(/(?:\s*\/\/.*)*\n( +)if *\(hasObjectSpliceBug[\s\S]+?\n\1}/, '');
|
source = source.replace(/(?:\s*\/\/.*)*\n( +)if *\(hasObjectSpliceBug[\s\S]+?\n\1}/, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// remove `thisArg` from unexposed `forIn` and `forOwn`
|
||||||
|
_.each([
|
||||||
|
{ 'methodName': 'forIn', 'flag': exposeForIn },
|
||||||
|
{ 'methodName': 'forOwn', 'flag': exposeForOwn }
|
||||||
|
], function(data) {
|
||||||
|
if (!data.flag) {
|
||||||
|
source = source.replace(matchFunction(source, data.methodName), function(match) {
|
||||||
|
return match.replace(/(callback), *thisArg/g, '$1');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// remove `hasDontEnumBug`, `iteratesOwnLast`, and `noArgsEnum` declarations and assignments
|
||||||
|
source = source
|
||||||
|
.replace(/ *\(function\(\) *{[\s\S]+?}\(1\)\);\n/, '')
|
||||||
|
.replace(/(?:\n +\/\*[^*]*\*+(?:[^\/][^*]*\*+)*\/)?\n *var (?:hasDontEnumBug|iteratesOwnLast|noArgsEnum).+\n/g, '');
|
||||||
|
|
||||||
// remove `iteratesOwnLast` from `isPlainObject`
|
// remove `iteratesOwnLast` from `isPlainObject`
|
||||||
source = source.replace(/(?:\s*\/\/.*)*\n( +)if *\(iteratesOwnLast[\s\S]+?\n\1}/, '');
|
source = source.replace(/(?:\s*\/\/.*)*\n( +)if *\(iteratesOwnLast[\s\S]+?\n\1}/, '');
|
||||||
|
|
||||||
@@ -1382,7 +1524,7 @@
|
|||||||
if (isAMD && isGlobal) {
|
if (isAMD && isGlobal) {
|
||||||
source = source.replace(/(?: *\/\/.*\n)* *(?:else )?if *\(freeExports\) *{\s*}\n/, '');
|
source = source.replace(/(?: *\/\/.*\n)* *(?:else )?if *\(freeExports\) *{\s*}\n/, '');
|
||||||
} else {
|
} else {
|
||||||
source = source.replace(/(?: *\/\/.*\n)* *(?:else )?if *\(freeExports\) *{\s*}(?:\s*else *{([\s\S]+?) *})?\n/, '$1');
|
source = source.replace(/(?: *\/\/.*\n)* *(?:else )?if *\(freeExports\) *{\s*}(?:\s*else *{([\s\S]+?) *})?\n/, '$1\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((source.match(/\bfreeExports\b/g) || []).length < 2) {
|
if ((source.match(/\bfreeExports\b/g) || []).length < 2) {
|
||||||
@@ -1409,8 +1551,7 @@
|
|||||||
if (isRemoved(source, 'mixin')) {
|
if (isRemoved(source, 'mixin')) {
|
||||||
// remove `lodash.prototype` additions
|
// remove `lodash.prototype` additions
|
||||||
source = source.replace(/(?:\s*\/\/.*)*\s*mixin\(lodash\)[\s\S]+?\/\*-+\*\//, '');
|
source = source.replace(/(?:\s*\/\/.*)*\s*mixin\(lodash\)[\s\S]+?\/\*-+\*\//, '');
|
||||||
// remove `hasObjectSpliceBug` assignment
|
source = removeVar(source, 'hasObjectSpliceBug');
|
||||||
source = source.replace(/(?:\n +\/\*[^*]*\*+(?:[^\/][^*]*\*+)*\/)?\n *var hasObjectSpliceBug;|.+?hasObjectSpliceBug *=.+/g, '');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove pseudo private properties
|
// remove pseudo private properties
|
||||||
@@ -1452,15 +1593,11 @@
|
|||||||
}
|
}
|
||||||
if (isRemoved(source, 'createIterator', 'bind')) {
|
if (isRemoved(source, 'createIterator', 'bind')) {
|
||||||
source = removeVar(source, 'isBindFast');
|
source = removeVar(source, 'isBindFast');
|
||||||
source = removeVar(source, 'isStrictFast');
|
|
||||||
source = removeVar(source, 'nativeBind');
|
source = removeVar(source, 'nativeBind');
|
||||||
}
|
}
|
||||||
if (isRemoved(source, 'createIterator', 'bind', 'isArray', 'isPlainObject', 'keys')) {
|
if (isRemoved(source, 'createIterator', 'bind', 'isArray', 'isPlainObject', 'keys')) {
|
||||||
source = removeVar(source, 'reNative');
|
source = removeVar(source, 'reNative');
|
||||||
}
|
}
|
||||||
if (isRemoved(source, 'createIterator', 'isEmpty', 'isEqual')) {
|
|
||||||
source = removeVar(source, 'arrayLikeClasses');
|
|
||||||
}
|
|
||||||
if (isRemoved(source, 'createIterator', 'isEqual')) {
|
if (isRemoved(source, 'createIterator', 'isEqual')) {
|
||||||
source = source.replace(/(?:\n +\/\*[^*]*\*+(?:[^\/][^*]*\*+)*\/)?\n *var hasDontEnumBug;|.+?hasDontEnumBug *=.+/g, '');
|
source = source.replace(/(?:\n +\/\*[^*]*\*+(?:[^\/][^*]*\*+)*\/)?\n *var hasDontEnumBug;|.+?hasDontEnumBug *=.+/g, '');
|
||||||
}
|
}
|
||||||
@@ -1471,9 +1608,9 @@
|
|||||||
source = removeVar(source, 'nativeKeys');
|
source = removeVar(source, 'nativeKeys');
|
||||||
source = removeKeysOptimization(source);
|
source = removeKeysOptimization(source);
|
||||||
}
|
}
|
||||||
if (!source.match(/var (?:hasDontEnumBug|hasObjectSpliceBug|iteratesOwnLast|noArgsEnum)\b/g)) {
|
if (!source.match(/var (?:hasDontEnumBug|iteratesOwnLast|noArgsEnum)\b/g)) {
|
||||||
// remove `hasDontEnumBug`, `hasObjectSpliceBug`, `iteratesOwnLast`, and `noArgsEnum` assignment
|
// remove `hasDontEnumBug`, `iteratesOwnLast`, and `noArgsEnum` assignments
|
||||||
source = source.replace(/ *\(function\(\) *{[\s\S]+?}\(1\)\);/, '');
|
source = source.replace(/ *\(function\(\) *{[\s\S]+?}\(1\)\);\n/, '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1510,12 +1647,9 @@
|
|||||||
'isTemplate': isTemplate,
|
'isTemplate': isTemplate,
|
||||||
'outputPath': outputPath,
|
'outputPath': outputPath,
|
||||||
'onComplete': function(source) {
|
'onComplete': function(source) {
|
||||||
// correct overly aggressive Closure Compiler minification
|
|
||||||
source = source.replace(/prototype\s*=\s*{\s*valueOf\s*:\s*1\s*}/, 'prototype={valueOf:1,y:1}');
|
|
||||||
|
|
||||||
// inject "use strict" directive
|
// inject "use strict" directive
|
||||||
if (isStrict) {
|
if (isStrict) {
|
||||||
source = source.replace(/^(\/\*![\s\S]+?\*\/\n;\(function[^)]+\){)([^'"])/, '$1"use strict";$2');
|
source = source.replace(/^([\s\S]*?function[^{]+{)([^'"])/, '$1"use strict";$2');
|
||||||
}
|
}
|
||||||
if (isStdOut) {
|
if (isStdOut) {
|
||||||
stdout.write(source);
|
stdout.write(source);
|
||||||
|
|||||||
@@ -8,10 +8,10 @@
|
|||||||
path = require('path'),
|
path = require('path'),
|
||||||
spawn = require('child_process').spawn;
|
spawn = require('child_process').spawn;
|
||||||
|
|
||||||
/** 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, '..'));
|
||||||
|
|
||||||
/** The directory where the Closure Compiler is located */
|
/** The path of the directory where the Closure Compiler is located */
|
||||||
var closurePath = path.join(basePath, 'vendor', 'closure-compiler', 'compiler.jar');
|
var closurePath = path.join(basePath, 'vendor', 'closure-compiler', 'compiler.jar');
|
||||||
|
|
||||||
/** Load other modules */
|
/** Load other modules */
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
postprocess = require('./post-compile'),
|
postprocess = require('./post-compile'),
|
||||||
uglifyJS = require('../vendor/uglifyjs/uglify-js');
|
uglifyJS = require('../vendor/uglifyjs/uglify-js');
|
||||||
|
|
||||||
/** Closure Compiler command-line options */
|
/** The Closure Compiler command-line options */
|
||||||
var closureOptions = [
|
var closureOptions = [
|
||||||
'--compilation_level=ADVANCED_OPTIMIZATIONS',
|
'--compilation_level=ADVANCED_OPTIMIZATIONS',
|
||||||
'--warning_level=QUIET'
|
'--warning_level=QUIET'
|
||||||
@@ -31,11 +31,20 @@
|
|||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The exposed `minify` function minifies a given Lo-Dash `source` and invokes
|
* Minifies a given Lo-Dash `source` and invokes the `options.onComplete`
|
||||||
* the `onComplete` callback when finished.
|
* callback when finished. The `onComplete` callback is invoked with one
|
||||||
|
* argument; (outputSource).
|
||||||
*
|
*
|
||||||
* @param {Array|String} [source=''] The source to minify or array of commands.
|
* @param {Array|String} [source=''] The source to minify or array of commands.
|
||||||
|
* -o, --output - Write output to a given path/filename.
|
||||||
|
* -s, --silent - Skip status updates normally logged to the console.
|
||||||
|
* -t, --template - Applies template specific minifier options.
|
||||||
|
*
|
||||||
* @param {Object} [options={}] The options object.
|
* @param {Object} [options={}] The options object.
|
||||||
|
* outputPath - Write output to a given path/filename.
|
||||||
|
* isSilent - Skip status updates normally logged to the console.
|
||||||
|
* isTemplate - Applies template specific minifier options.
|
||||||
|
* onComplete - The function called once minification has finished.
|
||||||
*/
|
*/
|
||||||
function minify(source, options) {
|
function minify(source, options) {
|
||||||
source || (source = '');
|
source || (source = '');
|
||||||
@@ -77,6 +86,10 @@
|
|||||||
* @constructor
|
* @constructor
|
||||||
* @param {String} source The source to minify.
|
* @param {String} source The source to minify.
|
||||||
* @param {Object} options The options object.
|
* @param {Object} options The options object.
|
||||||
|
* outputPath - Write output to a given path/filename.
|
||||||
|
* isSilent - Skip status updates normally logged to the console.
|
||||||
|
* isTemplate - Applies template specific minifier options.
|
||||||
|
* onComplete - The function called once minification has finished.
|
||||||
*/
|
*/
|
||||||
function Minify(source, options) {
|
function Minify(source, options) {
|
||||||
// juggle arguments
|
// juggle arguments
|
||||||
@@ -111,7 +124,7 @@
|
|||||||
* @private
|
* @private
|
||||||
* @param {String} source The JavaScript source to minify.
|
* @param {String} source The JavaScript source to minify.
|
||||||
* @param {String} [message] The message to log.
|
* @param {String} [message] The message to log.
|
||||||
* @param {Function} callback The function to call once the process completes.
|
* @param {Function} callback The function called once the process has completed.
|
||||||
*/
|
*/
|
||||||
function closureCompile(source, message, callback) {
|
function closureCompile(source, message, callback) {
|
||||||
var options = closureOptions.slice();
|
var options = closureOptions.slice();
|
||||||
@@ -119,11 +132,10 @@
|
|||||||
// use simple optimizations when minifying template files
|
// use simple optimizations when minifying template files
|
||||||
if (this.isTemplate) {
|
if (this.isTemplate) {
|
||||||
options = options.map(function(value) {
|
options = options.map(function(value) {
|
||||||
return value.replace(/^(compilation_level)=.+$/, '$1=SIMPLE_OPTIMIZATIONS');
|
return value.replace(/^(--compilation_level)=.+$/, '$1=SIMPLE_OPTIMIZATIONS');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
// the standard error stream, standard output stream, and the Closure Compiler process
|
||||||
// the standard error stream, standard output stream, and Closure Compiler process
|
|
||||||
var error = '',
|
var error = '',
|
||||||
output = '',
|
output = '',
|
||||||
compiler = spawn('java', ['-jar', closurePath].concat(options));
|
compiler = spawn('java', ['-jar', closurePath].concat(options));
|
||||||
@@ -133,14 +145,12 @@
|
|||||||
callback = message;
|
callback = message;
|
||||||
message = null;
|
message = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.isSilent) {
|
if (!this.isSilent) {
|
||||||
console.log(message == null
|
console.log(message == null
|
||||||
? 'Compressing ' + path.basename(this.outputPath, '.js') + ' using the Closure Compiler...'
|
? 'Compressing ' + path.basename(this.outputPath, '.js') + ' using the Closure Compiler...'
|
||||||
: message
|
: message
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
compiler.stdout.on('data', function(data) {
|
compiler.stdout.on('data', function(data) {
|
||||||
// append the data to the output stream
|
// append the data to the output stream
|
||||||
output += data;
|
output += data;
|
||||||
@@ -174,7 +184,7 @@
|
|||||||
* @private
|
* @private
|
||||||
* @param {String} source The JavaScript source to minify.
|
* @param {String} source The JavaScript source to minify.
|
||||||
* @param {String} [message] The message to log.
|
* @param {String} [message] The message to log.
|
||||||
* @param {Function} callback The function to call once the process completes.
|
* @param {Function} callback The function called once the process has completed.
|
||||||
*/
|
*/
|
||||||
function uglify(source, message, callback) {
|
function uglify(source, message, callback) {
|
||||||
var exception,
|
var exception,
|
||||||
@@ -186,14 +196,12 @@
|
|||||||
callback = message;
|
callback = message;
|
||||||
message = null;
|
message = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.isSilent) {
|
if (!this.isSilent) {
|
||||||
console.log(message == null
|
console.log(message == null
|
||||||
? 'Compressing ' + path.basename(this.outputPath, '.js') + ' using UglifyJS...'
|
? 'Compressing ' + path.basename(this.outputPath, '.js') + ' using UglifyJS...'
|
||||||
: message
|
: message
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
result = ugly.gen_code(
|
result = ugly.gen_code(
|
||||||
// enable unsafe transformations
|
// enable unsafe transformations
|
||||||
@@ -246,7 +254,6 @@
|
|||||||
if (!this.isSilent) {
|
if (!this.isSilent) {
|
||||||
console.log('Done. Size: %d bytes.', result.length);
|
console.log('Done. Size: %d bytes.', result.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
// store the gzipped result and report the size
|
// store the gzipped result and report the size
|
||||||
this.compiled.gzip = result;
|
this.compiled.gzip = result;
|
||||||
|
|
||||||
@@ -341,7 +348,7 @@
|
|||||||
uglified = this.uglified;
|
uglified = this.uglified;
|
||||||
|
|
||||||
// select the smallest gzipped file and use its minified counterpart as the
|
// select the smallest gzipped file and use its minified counterpart as the
|
||||||
// official minified release (ties go to Closure Compiler)
|
// official minified release (ties go to the Closure Compiler)
|
||||||
var min = Math.min(compiled.gzip.length, hybrid.gzip.length, uglified.gzip.length);
|
var min = Math.min(compiled.gzip.length, hybrid.gzip.length, uglified.gzip.length);
|
||||||
|
|
||||||
// pass the minified source to the minify instances "onComplete" callback
|
// pass the minified source to the minify instances "onComplete" callback
|
||||||
|
|||||||
@@ -26,9 +26,17 @@
|
|||||||
* @returns {String} Returns the processed source.
|
* @returns {String} Returns the processed source.
|
||||||
*/
|
*/
|
||||||
function postprocess(source) {
|
function postprocess(source) {
|
||||||
// move vars exposed by Closure Compiler into the IIFE
|
// move vars exposed by the Closure Compiler into the IIFE
|
||||||
source = source.replace(/^((?:(['"])use strict\2;)?(?:var (?:[a-z]+=(?:!0|!1|null)[,;])+)?)([\s\S]*?function[^)]+\){)/, '$3$1');
|
source = source.replace(/^((?:(['"])use strict\2;)?(?:var (?:[a-z]+=(?:!0|!1|null)[,;])+)?)([\s\S]*?function[^)]+\){)/, '$3$1');
|
||||||
|
|
||||||
|
// avoid bugs with the Closure Compiler
|
||||||
|
source = source
|
||||||
|
// correct overly aggressive Closure Compiler minification
|
||||||
|
.replace(/prototype\s*=\s*{\s*valueOf\s*:\s*1\s*}/, 'prototype={valueOf:1,y:1}')
|
||||||
|
// restore `arrayRef` and `objectRef` values modified by pre-compile.js
|
||||||
|
.replace(/= *Array.prototype/, '=[]')
|
||||||
|
.replace(/= *Object.prototype/, '={}');
|
||||||
|
|
||||||
// unescape properties (i.e. foo["bar"] => foo.bar)
|
// unescape properties (i.e. foo["bar"] => foo.bar)
|
||||||
source = source.replace(/(\w)\["([^."]+)"\]/g, function(match, left, right) {
|
source = source.replace(/(\w)\["([^."]+)"\]/g, function(match, left, right) {
|
||||||
return /\W/.test(right) ? match : (left + '.' + right);
|
return /\W/.test(right) ? match : (left + '.' + right);
|
||||||
|
|||||||
106
build/post-install.js
Normal file
106
build/post-install.js
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
;(function () {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
/** Load Node modules */
|
||||||
|
var exec = require('child_process').exec,
|
||||||
|
fs = require('fs'),
|
||||||
|
https = require('https'),
|
||||||
|
path = require('path'),
|
||||||
|
tar = require('tar'),
|
||||||
|
zlib = require('zlib');
|
||||||
|
|
||||||
|
/** The path of the directory that is the base of the repository */
|
||||||
|
var basePath = fs.realpathSync(path.join(__dirname, '..'));
|
||||||
|
|
||||||
|
/** The path of the `vendor` directory */
|
||||||
|
var vendorPath = path.join(basePath, 'vendor');
|
||||||
|
|
||||||
|
/** The Git object ID of `closure-compiler.tar.gz` */
|
||||||
|
var closureId = 'aa29a2ecf6f51d4da5a2a418c0d4ea0e368ee80d';
|
||||||
|
|
||||||
|
/** The Git object ID of `uglifyjs.tar.gz` */
|
||||||
|
var uglifyId = '9869c4443fb22598235d1019fcc8245be41e8889';
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetches a required `.tar.gz` dependency with the given Git object ID from
|
||||||
|
* the Lo-Dash repo on GitHub. The object ID may be obtained by running
|
||||||
|
* `git hash-object path/to/dependency.tar.gz`.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {Object} options The options object.
|
||||||
|
*
|
||||||
|
* id - The Git object ID of the `.tar.gz` file.
|
||||||
|
* onComplete - The function, invoked with one argument (exception),
|
||||||
|
* called once the extraction has finished.
|
||||||
|
* path - The path of the extraction directory.
|
||||||
|
* title - The dependency's title used in status updates logged to the console.
|
||||||
|
*/
|
||||||
|
function getDependency(options) {
|
||||||
|
options || (options = {});
|
||||||
|
|
||||||
|
var onComplete = options.onComplete,
|
||||||
|
title = options.title;
|
||||||
|
|
||||||
|
function callback(exception) {
|
||||||
|
if (exception) {
|
||||||
|
console.error('There was a problem downloading ' + title + '.');
|
||||||
|
}
|
||||||
|
onComplete(exception);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('Downloading ' + title + '...');
|
||||||
|
|
||||||
|
https.get({
|
||||||
|
'host': 'api.github.com',
|
||||||
|
'path': '/repos/bestiejs/lodash/git/blobs/' + options.id,
|
||||||
|
'headers': {
|
||||||
|
// By default, all GitHub blob API endpoints return a JSON document
|
||||||
|
// containing Base64-encoded blob data. Overriding the `Accept` header
|
||||||
|
// with the GitHub raw media type returns the blob data directly.
|
||||||
|
'Accept': 'application/vnd.github.v3.raw'
|
||||||
|
}
|
||||||
|
}, function(response) {
|
||||||
|
var parser = new tar.Extract({
|
||||||
|
'path': options.path
|
||||||
|
})
|
||||||
|
.on('end', callback)
|
||||||
|
.on('error', callback);
|
||||||
|
|
||||||
|
response.pipe(zlib.createUnzip()).pipe(parser);
|
||||||
|
})
|
||||||
|
.on('error', callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
exec('npm -g root', function(exception, stdout, stderr) {
|
||||||
|
if (exception || stderr) {
|
||||||
|
console.error('There was a problem loading the npm registry.');
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
// exit early if not a global install
|
||||||
|
if (path.resolve(basePath, '..') != stdout.trim()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// download the Closure Compiler
|
||||||
|
getDependency({
|
||||||
|
'title': 'the Closure Compiler',
|
||||||
|
'id': closureId,
|
||||||
|
'path': vendorPath,
|
||||||
|
'onComplete':function(exceptionA) {
|
||||||
|
// download UglifyJS
|
||||||
|
getDependency({
|
||||||
|
'title': 'UglifyJS',
|
||||||
|
'id': uglifyId,
|
||||||
|
'path': vendorPath,
|
||||||
|
'onComplete': function(exceptionB) {
|
||||||
|
process.exit(exceptionA || exceptionB ? 1 : 0);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}());
|
||||||
@@ -11,80 +11,36 @@
|
|||||||
'argsLength',
|
'argsLength',
|
||||||
'callback',
|
'callback',
|
||||||
'collection',
|
'collection',
|
||||||
'concat',
|
|
||||||
'createCallback',
|
'createCallback',
|
||||||
'ctor',
|
'ctor',
|
||||||
'hasOwnProperty',
|
'hasOwnProperty',
|
||||||
'index',
|
'index',
|
||||||
|
'isArguments',
|
||||||
'iteratee',
|
'iteratee',
|
||||||
'length',
|
'length',
|
||||||
'nativeKeys',
|
'nativeKeys',
|
||||||
'object',
|
'object',
|
||||||
|
'objectTypes',
|
||||||
'ownIndex',
|
'ownIndex',
|
||||||
'ownProps',
|
'ownProps',
|
||||||
'prop',
|
|
||||||
'propertyIsEnumerable',
|
'propertyIsEnumerable',
|
||||||
'propIndex',
|
|
||||||
'props',
|
|
||||||
'result',
|
'result',
|
||||||
'skipProto',
|
'skipProto',
|
||||||
'slice',
|
|
||||||
'stringClass',
|
'stringClass',
|
||||||
'thisArg',
|
'thisArg',
|
||||||
'toString',
|
'toString',
|
||||||
'undefined',
|
'value'
|
||||||
'value',
|
|
||||||
|
|
||||||
// lesser used variables
|
|
||||||
'accumulator',
|
|
||||||
'args',
|
|
||||||
'arrayLikeClasses',
|
|
||||||
'ArrayProto',
|
|
||||||
'bind',
|
|
||||||
'callee',
|
|
||||||
'className',
|
|
||||||
'compareAscending',
|
|
||||||
'forIn',
|
|
||||||
'found',
|
|
||||||
'funcs',
|
|
||||||
'indexOf',
|
|
||||||
'indicator',
|
|
||||||
'isArguments',
|
|
||||||
'isArr',
|
|
||||||
'isArray',
|
|
||||||
'isFunc',
|
|
||||||
'isFunction',
|
|
||||||
'isPlainObject',
|
|
||||||
'methodName',
|
|
||||||
'noaccum',
|
|
||||||
'noop',
|
|
||||||
'objectClass',
|
|
||||||
'objectTypes',
|
|
||||||
'pass',
|
|
||||||
'properties',
|
|
||||||
'property',
|
|
||||||
'propsLength',
|
|
||||||
'source',
|
|
||||||
'stackA',
|
|
||||||
'stackB',
|
|
||||||
'stackLength',
|
|
||||||
'target'
|
|
||||||
];
|
];
|
||||||
|
|
||||||
/** Used to minify `compileIterator` option properties */
|
/** Used to minify `compileIterator` option properties */
|
||||||
var iteratorOptions = [
|
var iteratorOptions = [
|
||||||
'args',
|
'args',
|
||||||
'array',
|
'arrayLoop',
|
||||||
'arrayBranch',
|
|
||||||
'beforeLoop',
|
|
||||||
'bottom',
|
'bottom',
|
||||||
'firstArg',
|
'firstArg',
|
||||||
'hasDontEnumBug',
|
'hasDontEnumBug',
|
||||||
'inLoop',
|
|
||||||
'init',
|
|
||||||
'isKeysFast',
|
'isKeysFast',
|
||||||
'object',
|
'objectLoop',
|
||||||
'objectBranch',
|
|
||||||
'noArgsEnum',
|
'noArgsEnum',
|
||||||
'noCharByIndex',
|
'noCharByIndex',
|
||||||
'shadowed',
|
'shadowed',
|
||||||
@@ -112,7 +68,6 @@
|
|||||||
'bind',
|
'bind',
|
||||||
'bindAll',
|
'bindAll',
|
||||||
'chain',
|
'chain',
|
||||||
'clearTimeout',
|
|
||||||
'clone',
|
'clone',
|
||||||
'collect',
|
'collect',
|
||||||
'compact',
|
'compact',
|
||||||
@@ -144,6 +99,7 @@
|
|||||||
'forIn',
|
'forIn',
|
||||||
'forOwn',
|
'forOwn',
|
||||||
'functions',
|
'functions',
|
||||||
|
'global',
|
||||||
'groupBy',
|
'groupBy',
|
||||||
'has',
|
'has',
|
||||||
'head',
|
'head',
|
||||||
@@ -204,7 +160,6 @@
|
|||||||
'rest',
|
'rest',
|
||||||
'result',
|
'result',
|
||||||
'select',
|
'select',
|
||||||
'setTimeout',
|
|
||||||
'shuffle',
|
'shuffle',
|
||||||
'size',
|
'size',
|
||||||
'some',
|
'some',
|
||||||
@@ -215,7 +170,6 @@
|
|||||||
'take',
|
'take',
|
||||||
'tap',
|
'tap',
|
||||||
'template',
|
'template',
|
||||||
'templates',
|
|
||||||
'templateSettings',
|
'templateSettings',
|
||||||
'throttle',
|
'throttle',
|
||||||
'times',
|
'times',
|
||||||
@@ -252,7 +206,7 @@
|
|||||||
source || (source = '');
|
source || (source = '');
|
||||||
options || (options = {});
|
options || (options = {});
|
||||||
|
|
||||||
// remove unrecognized JSDoc tags so Closure Compiler won't complain
|
// remove unrecognized JSDoc tags so the Closure Compiler won't complain
|
||||||
source = source.replace(/@(?:alias|category)\b.*/g, '');
|
source = source.replace(/@(?:alias|category)\b.*/g, '');
|
||||||
|
|
||||||
if (options.isTemplate) {
|
if (options.isTemplate) {
|
||||||
@@ -262,7 +216,12 @@
|
|||||||
// remove copyright to add later in post-compile.js
|
// remove copyright to add later in post-compile.js
|
||||||
source = source.replace(/\/\*![\s\S]+?\*\//, '');
|
source = source.replace(/\/\*![\s\S]+?\*\//, '');
|
||||||
|
|
||||||
// add brackets to whitelisted properties so Closure Compiler won't mung them
|
// replace `arrayRef` and `objectRef` values to avoid a bug in the Closure Compiler
|
||||||
|
source = source
|
||||||
|
.replace(/(arrayRef *= *)\[\]/, '$1Array.prototype')
|
||||||
|
.replace(/(objectRef *= *)\{\}/, '$1Object.prototype');
|
||||||
|
|
||||||
|
// add brackets to whitelisted properties so the Closure Compiler won't mung them
|
||||||
// http://code.google.com/closure/compiler/docs/api-tutorial3.html#export
|
// http://code.google.com/closure/compiler/docs/api-tutorial3.html#export
|
||||||
source = source.replace(RegExp('\\.(' + propWhitelist.join('|') + ')\\b', 'g'), "['$1']");
|
source = source.replace(RegExp('\\.(' + propWhitelist.join('|') + ')\\b', 'g'), "['$1']");
|
||||||
|
|
||||||
@@ -308,18 +267,16 @@
|
|||||||
// remove debug sourceURL use in `_.template`
|
// remove debug sourceURL use in `_.template`
|
||||||
source = source.replace(/(?:\s*\/\/.*\n)* *var sourceURL[^;]+;|\+ *sourceURL/g, '');
|
source = source.replace(/(?:\s*\/\/.*\n)* *var sourceURL[^;]+;|\+ *sourceURL/g, '');
|
||||||
|
|
||||||
// minify internal properties used by 'compareAscending', `_.merge`, and `_.sortBy`
|
// minify internal properties used by 'compareAscending' and `_.sortBy`
|
||||||
(function() {
|
(function() {
|
||||||
var properties = ['criteria', 'index', 'value'],
|
var properties = ['criteria', 'index', 'value'],
|
||||||
snippets = source.match(/( +)(?:function compareAscending|var merge|var sortBy)\b[\s\S]+?\n\1}/g);
|
snippets = source.match(/( +)function (?:compareAscending|sortBy)\b[\s\S]+?\n\1}/g);
|
||||||
|
|
||||||
if (!snippets) {
|
if (!snippets) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
snippets.forEach(function(snippet) {
|
snippets.forEach(function(snippet) {
|
||||||
var modified = snippet,
|
var modified = snippet;
|
||||||
isCompilable = /(?:var merge|var sortBy)\b/.test(modified),
|
|
||||||
isInlined = !/\bcreateIterator\b/.test(modified);
|
|
||||||
|
|
||||||
// minify properties
|
// minify properties
|
||||||
properties.forEach(function(property, index) {
|
properties.forEach(function(property, index) {
|
||||||
@@ -327,33 +284,10 @@
|
|||||||
reDotProp = RegExp('\\.' + property + '\\b', 'g'),
|
reDotProp = RegExp('\\.' + property + '\\b', 'g'),
|
||||||
rePropColon = RegExp("([^?\\s])\\s*([\"'])?\\b" + property + "\\2 *:", 'g');
|
rePropColon = RegExp("([^?\\s])\\s*([\"'])?\\b" + property + "\\2 *:", 'g');
|
||||||
|
|
||||||
if (isCompilable) {
|
modified = modified
|
||||||
// add quotes around properties in the inlined `_.merge` and `_.sortBy`
|
.replace(reBracketProp, "['" + minNames[index] + "']")
|
||||||
// of the mobile build so Closure Compiler won't mung them
|
.replace(reDotProp, "['" + minNames[index] + "']")
|
||||||
if (isInlined) {
|
.replace(rePropColon, "$1'" + minNames[index] + "':");
|
||||||
modified = modified
|
|
||||||
.replace(reBracketProp, "['" + minNames[index] + "']")
|
|
||||||
.replace(reDotProp, "['" + minNames[index] + "']")
|
|
||||||
.replace(rePropColon, "$1'" + minNames[index] + "':");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
modified = modified
|
|
||||||
.replace(reBracketProp, '.' + minNames[index])
|
|
||||||
.replace(reDotProp, '.' + minNames[index])
|
|
||||||
.replace(rePropColon, '$1' + minNames[index] + ':');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
modified = modified
|
|
||||||
.replace(reBracketProp, "['" + minNames[index] + "']")
|
|
||||||
.replace(reDotProp, '.' + minNames[index])
|
|
||||||
.replace(rePropColon, "$1'" + minNames[index] + "':")
|
|
||||||
|
|
||||||
// correct `value.source` in regexp branch of `_.clone`
|
|
||||||
if (property == 'source') {
|
|
||||||
modified = modified.replace("value['" + minNames[index] + "']", "value['source']");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// replace with modified snippet
|
// replace with modified snippet
|
||||||
@@ -385,7 +319,7 @@
|
|||||||
isIteratorTemplate = /var iteratorTemplate\b/.test(snippet),
|
isIteratorTemplate = /var iteratorTemplate\b/.test(snippet),
|
||||||
modified = snippet;
|
modified = snippet;
|
||||||
|
|
||||||
// add brackets to whitelisted properties so Closure Compiler won't mung them
|
// add brackets to whitelisted properties so the Closure Compiler won't mung them
|
||||||
modified = modified.replace(RegExp('\\.(' + iteratorOptions.join('|') + ')\\b', 'g'), "['$1']");
|
modified = modified.replace(RegExp('\\.(' + iteratorOptions.join('|') + ')\\b', 'g'), "['$1']");
|
||||||
|
|
||||||
if (isCreateIterator) {
|
if (isCreateIterator) {
|
||||||
@@ -413,17 +347,11 @@
|
|||||||
modified = modified.replace(RegExp('\\b' + property + '\\b', 'g'), minNames[index]);
|
modified = modified.replace(RegExp('\\b' + property + '\\b', 'g'), minNames[index]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (property == 'array' || property == 'object') {
|
// minify property name strings
|
||||||
// minify "array" and "object" sub property names
|
modified = modified.replace(RegExp("'" + property + "'", 'g'), "'" + minNames[index] + "'");
|
||||||
modified = modified.replace(RegExp("'" + property + "'( *[\\]:])", 'g'), "'" + minNames[index] + "'$1");
|
// minify property names in accessors
|
||||||
}
|
if (isCreateIterator) {
|
||||||
else {
|
modified = modified.replace(RegExp('\\.' + property + '\\b' , 'g'), '.' + minNames[index]);
|
||||||
// minify property name strings
|
|
||||||
modified = modified.replace(RegExp("'" + property + "'", 'g'), "'" + minNames[index] + "'");
|
|
||||||
// minify property names in regexes and accessors
|
|
||||||
if (isCreateIterator) {
|
|
||||||
modified = modified.replace(RegExp('([\\.|/])' + property + '\\b' , 'g'), '$1' + minNames[index]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
255
doc/README.md
255
doc/README.md
@@ -1,4 +1,4 @@
|
|||||||
# Lo-Dash <sup>v0.8.2</sup>
|
# Lo-Dash <sup>v0.9.0</sup>
|
||||||
|
|
||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
@@ -184,7 +184,7 @@
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_compactarray"></a>`_.compact(array)`
|
### <a id="_compactarray"></a>`_.compact(array)`
|
||||||
<a href="#_compactarray">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2511 "View in source") [Ⓣ][1]
|
<a href="#_compactarray">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2495 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates an array with all falsey values of `array` removed. The values `false`, `null`, `0`, `""`, `undefined` and `NaN` are all falsey.
|
Creates an array with all falsey values of `array` removed. The values `false`, `null`, `0`, `""`, `undefined` and `NaN` are all falsey.
|
||||||
|
|
||||||
@@ -208,7 +208,7 @@ _.compact([0, 1, false, 2, '', 3]);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_differencearray--array1-array2-"></a>`_.difference(array [, array1, array2, ...])`
|
### <a id="_differencearray--array1-array2-"></a>`_.difference(array [, array1, array2, ...])`
|
||||||
<a href="#_differencearray--array1-array2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2541 "View in source") [Ⓣ][1]
|
<a href="#_differencearray--array1-array2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2525 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates an array of `array` elements not present in the other arrays using strict equality for comparisons, i.e. `===`.
|
Creates an array of `array` elements not present in the other arrays using strict equality for comparisons, i.e. `===`.
|
||||||
|
|
||||||
@@ -233,7 +233,7 @@ _.difference([1, 2, 3, 4, 5], [5, 2, 10]);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_firstarray--n"></a>`_.first(array [, n])`
|
### <a id="_firstarray--n"></a>`_.first(array [, n])`
|
||||||
<a href="#_firstarray--n">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2579 "View in source") [Ⓣ][1]
|
<a href="#_firstarray--n">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2560 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Gets the first element of the `array`. Pass `n` to return the first `n` elements of the `array`.
|
Gets the first element of the `array`. Pass `n` to return the first `n` elements of the `array`.
|
||||||
|
|
||||||
@@ -261,7 +261,7 @@ _.first([5, 4, 3, 2, 1]);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_flattenarray-shallow"></a>`_.flatten(array, shallow)`
|
### <a id="_flattenarray-shallow"></a>`_.flatten(array, shallow)`
|
||||||
<a href="#_flattenarray-shallow">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2603 "View in source") [Ⓣ][1]
|
<a href="#_flattenarray-shallow">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2584 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Flattens a nested array *(the nesting can be to any depth)*. If `shallow` is truthy, `array` will only be flattened a single level.
|
Flattens a nested array *(the nesting can be to any depth)*. If `shallow` is truthy, `array` will only be flattened a single level.
|
||||||
|
|
||||||
@@ -289,7 +289,7 @@ _.flatten([1, [2], [3, [[4]]]], true);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_indexofarray-value--fromindex0"></a>`_.indexOf(array, value [, fromIndex=0])`
|
### <a id="_indexofarray-value--fromindex0"></a>`_.indexOf(array, value [, fromIndex=0])`
|
||||||
<a href="#_indexofarray-value--fromindex0">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2645 "View in source") [Ⓣ][1]
|
<a href="#_indexofarray-value--fromindex0">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2626 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Gets the index at which the first occurrence of `value` is found using strict equality for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` for `fromIndex` will run a faster binary search.
|
Gets the index at which the first occurrence of `value` is found using strict equality for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` for `fromIndex` will run a faster binary search.
|
||||||
|
|
||||||
@@ -321,7 +321,7 @@ _.indexOf([1, 1, 2, 2, 3, 3], 2, true);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_initialarray--n"></a>`_.initial(array [, n])`
|
### <a id="_initialarray--n"></a>`_.initial(array [, n])`
|
||||||
<a href="#_initialarray--n">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2680 "View in source") [Ⓣ][1]
|
<a href="#_initialarray--n">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2661 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Gets all but the last element of `array`. Pass `n` to exclude the last `n` elements from the result.
|
Gets all but the last element of `array`. Pass `n` to exclude the last `n` elements from the result.
|
||||||
|
|
||||||
@@ -346,7 +346,7 @@ _.initial([3, 2, 1]);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_intersectionarray1-array2-"></a>`_.intersection([array1, array2, ...])`
|
### <a id="_intersectionarray1-array2-"></a>`_.intersection([array1, array2, ...])`
|
||||||
<a href="#_intersectionarray1-array2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2701 "View in source") [Ⓣ][1]
|
<a href="#_intersectionarray1-array2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2682 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Computes the intersection of all the passed-in arrays using strict equality for comparisons, i.e. `===`.
|
Computes the intersection of all the passed-in arrays using strict equality for comparisons, i.e. `===`.
|
||||||
|
|
||||||
@@ -370,7 +370,7 @@ _.intersection([1, 2, 3], [101, 2, 1, 10], [2, 1]);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_lastarray--n"></a>`_.last(array [, n])`
|
### <a id="_lastarray--n"></a>`_.last(array [, n])`
|
||||||
<a href="#_lastarray--n">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2740 "View in source") [Ⓣ][1]
|
<a href="#_lastarray--n">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2720 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Gets the last element of the `array`. Pass `n` to return the last `n` elements of the `array`.
|
Gets the last element of the `array`. Pass `n` to return the last `n` elements of the `array`.
|
||||||
|
|
||||||
@@ -395,7 +395,7 @@ _.last([3, 2, 1]);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_lastindexofarray-value--fromindexarraylength-1"></a>`_.lastIndexOf(array, value [, fromIndex=array.length-1])`
|
### <a id="_lastindexofarray-value--fromindexarraylength-1"></a>`_.lastIndexOf(array, value [, fromIndex=array.length-1])`
|
||||||
<a href="#_lastindexofarray-value--fromindexarraylength-1">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2766 "View in source") [Ⓣ][1]
|
<a href="#_lastindexofarray-value--fromindexarraylength-1">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2746 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Gets the index at which the last occurrence of `value` is found using strict equality for comparisons, i.e. `===`.
|
Gets the index at which the last occurrence of `value` is found using strict equality for comparisons, i.e. `===`.
|
||||||
|
|
||||||
@@ -424,7 +424,7 @@ _.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_objectkeys--values"></a>`_.object(keys [, values=[]])`
|
### <a id="_objectkeys--values"></a>`_.object(keys [, values=[]])`
|
||||||
<a href="#_objectkeys--values">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2796 "View in source") [Ⓣ][1]
|
<a href="#_objectkeys--values">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2776 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates an object composed from arrays of `keys` and `values`. Pass either a single two dimensional array, i.e. `[[key1, value1], [key2, value2]]`, or two arrays, one of `keys` and one of corresponding `values`.
|
Creates an object composed from arrays of `keys` and `values`. Pass either a single two dimensional array, i.e. `[[key1, value1], [key2, value2]]`, or two arrays, one of `keys` and one of corresponding `values`.
|
||||||
|
|
||||||
@@ -449,7 +449,7 @@ _.object(['moe', 'larry', 'curly'], [30, 40, 50]);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_rangestart0-end--step1"></a>`_.range([start=0], end [, step=1])`
|
### <a id="_rangestart0-end--step1"></a>`_.range([start=0], end [, step=1])`
|
||||||
<a href="#_rangestart0-end--step1">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2841 "View in source") [Ⓣ][1]
|
<a href="#_rangestart0-end--step1">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2821 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates an array of numbers *(positive and/or negative)* progressing from `start` up to but not including `stop`. This method is a port of Python's `range()` function. See http://docs.python.org/library/functions.html#range.
|
Creates an array of numbers *(positive and/or negative)* progressing from `start` up to but not including `stop`. This method is a port of Python's `range()` function. See http://docs.python.org/library/functions.html#range.
|
||||||
|
|
||||||
@@ -487,7 +487,7 @@ _.range(0);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_restarray--n"></a>`_.rest(array [, n])`
|
### <a id="_restarray--n"></a>`_.rest(array [, n])`
|
||||||
<a href="#_restarray--n">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2880 "View in source") [Ⓣ][1]
|
<a href="#_restarray--n">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2860 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
The opposite of `_.initial`, this method gets all but the first value of `array`. Pass `n` to exclude the first `n` values from the result.
|
The opposite of `_.initial`, this method gets all but the first value of `array`. Pass `n` to exclude the first `n` values from the result.
|
||||||
|
|
||||||
@@ -515,7 +515,7 @@ _.rest([3, 2, 1]);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_sortedindexarray-value--callbackidentityproperty-thisarg"></a>`_.sortedIndex(array, value [, callback=identity|property, thisArg])`
|
### <a id="_sortedindexarray-value--callbackidentityproperty-thisarg"></a>`_.sortedIndex(array, value [, callback=identity|property, thisArg])`
|
||||||
<a href="#_sortedindexarray-value--callbackidentityproperty-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2926 "View in source") [Ⓣ][1]
|
<a href="#_sortedindexarray-value--callbackidentityproperty-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2906 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Uses a binary search to determine the smallest index at which the `value` should be inserted into `array` in order to maintain the sort order of the sorted `array`. If `callback` is passed, it will be executed for `value` and each element in `array` to compute their sort ranking. The `callback` is bound to `thisArg` and invoked with one argument; *(value)*. The `callback` argument may also be the name of a property to order by.
|
Uses a binary search to determine the smallest index at which the `value` should be inserted into `array` in order to maintain the sort order of the sorted `array`. If `callback` is passed, it will be executed for `value` and each element in `array` to compute their sort ranking. The `callback` is bound to `thisArg` and invoked with one argument; *(value)*. The `callback` argument may also be the name of a property to order by.
|
||||||
|
|
||||||
@@ -559,7 +559,7 @@ _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) {
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_unionarray1-array2-"></a>`_.union([array1, array2, ...])`
|
### <a id="_unionarray1-array2-"></a>`_.union([array1, array2, ...])`
|
||||||
<a href="#_unionarray1-array2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2961 "View in source") [Ⓣ][1]
|
<a href="#_unionarray1-array2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2937 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Computes the union of the passed-in arrays using strict equality for comparisons, i.e. `===`.
|
Computes the union of the passed-in arrays using strict equality for comparisons, i.e. `===`.
|
||||||
|
|
||||||
@@ -583,7 +583,7 @@ _.union([1, 2, 3], [101, 2, 1, 10], [2, 1]);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_uniqarray--issortedfalse-callbackidentity-thisarg"></a>`_.uniq(array [, isSorted=false, callback=identity, thisArg])`
|
### <a id="_uniqarray--issortedfalse-callbackidentity-thisarg"></a>`_.uniq(array [, isSorted=false, callback=identity, thisArg])`
|
||||||
<a href="#_uniqarray--issortedfalse-callbackidentity-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3006 "View in source") [Ⓣ][1]
|
<a href="#_uniqarray--issortedfalse-callbackidentity-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2982 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates a duplicate-value-free version of the `array` using strict equality for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` for `isSorted` will run a faster algorithm. If `callback` is passed, each element of `array` is passed through a callback` before uniqueness is computed. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*.
|
Creates a duplicate-value-free version of the `array` using strict equality for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` for `isSorted` will run a faster algorithm. If `callback` is passed, each element of `array` is passed through a callback` before uniqueness is computed. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*.
|
||||||
|
|
||||||
@@ -622,7 +622,7 @@ _.uniq([1, 2, 1.5, 3, 2.5], function(num) { return this.floor(num); }, Math);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_withoutarray--value1-value2-"></a>`_.without(array [, value1, value2, ...])`
|
### <a id="_withoutarray--value1-value2-"></a>`_.without(array [, value1, value2, ...])`
|
||||||
<a href="#_withoutarray--value1-value2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3047 "View in source") [Ⓣ][1]
|
<a href="#_withoutarray--value1-value2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3023 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates an array with all occurrences of the passed values removed using strict equality for comparisons, i.e. `===`.
|
Creates an array with all occurrences of the passed values removed using strict equality for comparisons, i.e. `===`.
|
||||||
|
|
||||||
@@ -647,7 +647,7 @@ _.without([1, 2, 1, 0, 3, 1, 4], 0, 1);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_ziparray1-array2-"></a>`_.zip([array1, array2, ...])`
|
### <a id="_ziparray1-array2-"></a>`_.zip([array1, array2, ...])`
|
||||||
<a href="#_ziparray1-array2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3078 "View in source") [Ⓣ][1]
|
<a href="#_ziparray1-array2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3054 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Groups the elements of each array at their corresponding indexes. Useful for separate data sources that are coordinated through matching array indexes. For a matrix of nested arrays, `_.zip.apply(...)` can transpose the matrix in a similar fashion.
|
Groups the elements of each array at their corresponding indexes. Useful for separate data sources that are coordinated through matching array indexes. For a matrix of nested arrays, `_.zip.apply(...)` can transpose the matrix in a similar fashion.
|
||||||
|
|
||||||
@@ -678,7 +678,7 @@ _.zip(['moe', 'larry', 'curly'], [30, 40, 50], [true, false, false]);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_value"></a>`_(value)`
|
### <a id="_value"></a>`_(value)`
|
||||||
<a href="#_value">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L243 "View in source") [Ⓣ][1]
|
<a href="#_value">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L231 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
The `lodash` function.
|
The `lodash` function.
|
||||||
|
|
||||||
@@ -696,7 +696,7 @@ The `lodash` function.
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_chainvalue"></a>`_.chain(value)`
|
### <a id="_chainvalue"></a>`_.chain(value)`
|
||||||
<a href="#_chainvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3929 "View in source") [Ⓣ][1]
|
<a href="#_chainvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3906 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Wraps the value in a `lodash` wrapper object.
|
Wraps the value in a `lodash` wrapper object.
|
||||||
|
|
||||||
@@ -730,7 +730,7 @@ var youngest = _.chain(stooges)
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_tapvalue-interceptor"></a>`_.tap(value, interceptor)`
|
### <a id="_tapvalue-interceptor"></a>`_.tap(value, interceptor)`
|
||||||
<a href="#_tapvalue-interceptor">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3956 "View in source") [Ⓣ][1]
|
<a href="#_tapvalue-interceptor">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3933 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Invokes `interceptor` with the `value` as the first argument, and then returns `value`. The purpose of this method is to "tap into" a method chain, in order to perform operations on intermediate results within the chain.
|
Invokes `interceptor` with the `value` as the first argument, and then returns `value`. The purpose of this method is to "tap into" a method chain, in order to perform operations on intermediate results within the chain.
|
||||||
|
|
||||||
@@ -760,7 +760,7 @@ _.chain([1, 2, 3, 200])
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_prototypechain"></a>`_.prototype.chain()`
|
### <a id="_prototypechain"></a>`_.prototype.chain()`
|
||||||
<a href="#_prototypechain">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3974 "View in source") [Ⓣ][1]
|
<a href="#_prototypechain">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3951 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Enables method chaining on the wrapper object.
|
Enables method chaining on the wrapper object.
|
||||||
|
|
||||||
@@ -781,7 +781,7 @@ _([1, 2, 3]).value();
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_prototypevalue"></a>`_.prototype.value()`
|
### <a id="_prototypevalue"></a>`_.prototype.value()`
|
||||||
<a href="#_prototypevalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3991 "View in source") [Ⓣ][1]
|
<a href="#_prototypevalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3968 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Extracts the wrapped value.
|
Extracts the wrapped value.
|
||||||
|
|
||||||
@@ -809,7 +809,7 @@ _([1, 2, 3]).value();
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_containscollection-target"></a>`_.contains(collection, target)`
|
### <a id="_containscollection-target"></a>`_.contains(collection, target)`
|
||||||
<a href="#_containscollection-target">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1872 "View in source") [Ⓣ][1]
|
<a href="#_containscollection-target">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1814 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Checks if a given `target` element is present in a `collection` using strict equality for comparisons, i.e. `===`.
|
Checks if a given `target` element is present in a `collection` using strict equality for comparisons, i.e. `===`.
|
||||||
|
|
||||||
@@ -843,7 +843,7 @@ _.contains('curly', 'ur');
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_countbycollection-callbackproperty--thisarg"></a>`_.countBy(collection, callback|property [, thisArg])`
|
### <a id="_countbycollection-callbackproperty--thisarg"></a>`_.countBy(collection, callback|property [, thisArg])`
|
||||||
<a href="#_countbycollection-callbackproperty--thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1908 "View in source") [Ⓣ][1]
|
<a href="#_countbycollection-callbackproperty--thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1853 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates an object composed of keys returned from running each element of `collection` through a `callback`. The corresponding value of each key is the number of times the key was returned by `callback`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. The `callback` argument may also be the name of a property to count by *(e.g. 'length')*.
|
Creates an object composed of keys returned from running each element of `collection` through a `callback`. The corresponding value of each key is the number of times the key was returned by `callback`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. The `callback` argument may also be the name of a property to count by *(e.g. 'length')*.
|
||||||
|
|
||||||
@@ -875,7 +875,7 @@ _.countBy(['one', 'two', 'three'], 'length');
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_everycollection--callbackidentity-thisarg"></a>`_.every(collection [, callback=identity, thisArg])`
|
### <a id="_everycollection--callbackidentity-thisarg"></a>`_.every(collection [, callback=identity, thisArg])`
|
||||||
<a href="#_everycollection--callbackidentity-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1929 "View in source") [Ⓣ][1]
|
<a href="#_everycollection--callbackidentity-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1882 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Checks if the `callback` returns a truthy value for **all** elements of a `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*.
|
Checks if the `callback` returns a truthy value for **all** elements of a `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*.
|
||||||
|
|
||||||
@@ -904,7 +904,7 @@ _.every([true, 1, null, 'yes'], Boolean);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_filtercollection--callbackidentity-thisarg"></a>`_.filter(collection [, callback=identity, thisArg])`
|
### <a id="_filtercollection--callbackidentity-thisarg"></a>`_.filter(collection [, callback=identity, thisArg])`
|
||||||
<a href="#_filtercollection--callbackidentity-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1949 "View in source") [Ⓣ][1]
|
<a href="#_filtercollection--callbackidentity-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1909 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Examines each element in a `collection`, returning an array of all elements the `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*.
|
Examines each element in a `collection`, returning an array of all elements the `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*.
|
||||||
|
|
||||||
@@ -933,7 +933,7 @@ var evens = _.filter([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; })
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_findcollection-callback--thisarg"></a>`_.find(collection, callback [, thisArg])`
|
### <a id="_findcollection-callback--thisarg"></a>`_.find(collection, callback [, thisArg])`
|
||||||
<a href="#_findcollection-callback--thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1971 "View in source") [Ⓣ][1]
|
<a href="#_findcollection-callback--thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1940 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Examines each element in a `collection`, returning the first one the `callback` returns truthy for. The function returns as soon as it finds an acceptable element, and does not iterate over the entire `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*.
|
Examines each element in a `collection`, returning the first one the `callback` returns truthy for. The function returns as soon as it finds an acceptable element, and does not iterate over the entire `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*.
|
||||||
|
|
||||||
@@ -962,7 +962,7 @@ var even = _.find([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; });
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_foreachcollection-callback--thisarg"></a>`_.forEach(collection, callback [, thisArg])`
|
### <a id="_foreachcollection-callback--thisarg"></a>`_.forEach(collection, callback [, thisArg])`
|
||||||
<a href="#_foreachcollection-callback--thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1998 "View in source") [Ⓣ][1]
|
<a href="#_foreachcollection-callback--thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1971 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Iterates over a `collection`, executing the `callback` for each element in the `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. Callbacks may exit iteration early by explicitly returning `false`.
|
Iterates over a `collection`, executing the `callback` for each element in the `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. Callbacks may exit iteration early by explicitly returning `false`.
|
||||||
|
|
||||||
@@ -994,9 +994,9 @@ _.forEach({ 'one': 1, 'two': 2, 'three': 3 }, alert);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_groupbycollection-callbackproperty--thisarg"></a>`_.groupBy(collection, callback|property [, thisArg])`
|
### <a id="_groupbycollection-callbackproperty--thisarg"></a>`_.groupBy(collection, callback|property [, thisArg])`
|
||||||
<a href="#_groupbycollection-callbackproperty--thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2026 "View in source") [Ⓣ][1]
|
<a href="#_groupbycollection-callbackproperty--thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1999 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates an object composed of keys returned from running each element of `collection` through a `callback`. The corresponding value of each key is an array of elements passed to `callback` that returned the key. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. The `callback` argument may also be the name of a property to count by *(e.g. 'length')*.
|
Creates an object composed of keys returned from running each element of `collection` through a `callback`. The corresponding value of each key is an array of elements passed to `callback` that returned the key. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. The `callback` argument may also be the name of a property to group by *(e.g. 'length')*.
|
||||||
|
|
||||||
#### Arguments
|
#### Arguments
|
||||||
1. `collection` *(Array|Object|String)*: The collection to iterate over.
|
1. `collection` *(Array|Object|String)*: The collection to iterate over.
|
||||||
@@ -1026,7 +1026,7 @@ _.groupBy(['one', 'two', 'three'], 'length');
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_invokecollection-methodname--arg1-arg2-"></a>`_.invoke(collection, methodName [, arg1, arg2, ...])`
|
### <a id="_invokecollection-methodname--arg1-arg2-"></a>`_.invoke(collection, methodName [, arg1, arg2, ...])`
|
||||||
<a href="#_invokecollection-methodname--arg1-arg2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2054 "View in source") [Ⓣ][1]
|
<a href="#_invokecollection-methodname--arg1-arg2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2031 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Invokes the method named by `methodName` on each element in the `collection`, returning an array of the results of each invoked method. Additional arguments will be passed to each invoked method. If `methodName` is a function it will be invoked for, and `this` bound to, each element in the `collection`.
|
Invokes the method named by `methodName` on each element in the `collection`, returning an array of the results of each invoked method. Additional arguments will be passed to each invoked method. If `methodName` is a function it will be invoked for, and `this` bound to, each element in the `collection`.
|
||||||
|
|
||||||
@@ -1055,7 +1055,7 @@ _.invoke([123, 456], String.prototype.split, '');
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_mapcollection--callbackidentity-thisarg"></a>`_.map(collection [, callback=identity, thisArg])`
|
### <a id="_mapcollection--callbackidentity-thisarg"></a>`_.map(collection [, callback=identity, thisArg])`
|
||||||
<a href="#_mapcollection--callbackidentity-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2089 "View in source") [Ⓣ][1]
|
<a href="#_mapcollection--callbackidentity-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2063 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates an array of values by running each element in the `collection` through a `callback`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*.
|
Creates an array of values by running each element in the `collection` through a `callback`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*.
|
||||||
|
|
||||||
@@ -1087,7 +1087,7 @@ _.map({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { return num * 3; });
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_maxcollection--callback-thisarg"></a>`_.max(collection [, callback, thisArg])`
|
### <a id="_maxcollection--callback-thisarg"></a>`_.max(collection [, callback, thisArg])`
|
||||||
<a href="#_maxcollection--callback-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2115 "View in source") [Ⓣ][1]
|
<a href="#_maxcollection--callback-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2105 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Retrieves the maximum value of an `array`. If `callback` is passed, it will be executed for each value in the `array` to generate the criterion by which the value is ranked. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, collection)*.
|
Retrieves the maximum value of an `array`. If `callback` is passed, it will be executed for each value in the `array` to generate the criterion by which the value is ranked. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, collection)*.
|
||||||
|
|
||||||
@@ -1119,7 +1119,7 @@ _.max(stooges, function(stooge) { return stooge.age; });
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_mincollection--callback-thisarg"></a>`_.min(collection [, callback, thisArg])`
|
### <a id="_mincollection--callback-thisarg"></a>`_.min(collection [, callback, thisArg])`
|
||||||
<a href="#_mincollection--callback-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2158 "View in source") [Ⓣ][1]
|
<a href="#_mincollection--callback-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2148 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Retrieves the minimum value of an `array`. If `callback` is passed, it will be executed for each value in the `array` to generate the criterion by which the value is ranked. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, collection)*.
|
Retrieves the minimum value of an `array`. If `callback` is passed, it will be executed for each value in the `array` to generate the criterion by which the value is ranked. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, collection)*.
|
||||||
|
|
||||||
@@ -1145,7 +1145,7 @@ _.min([10, 5, 100, 2, 1000]);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_pluckcollection-property"></a>`_.pluck(collection, property)`
|
### <a id="_pluckcollection-property"></a>`_.pluck(collection, property)`
|
||||||
<a href="#_pluckcollection-property">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2204 "View in source") [Ⓣ][1]
|
<a href="#_pluckcollection-property">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2194 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Retrieves the value of a specified property from all elements in the `collection`.
|
Retrieves the value of a specified property from all elements in the `collection`.
|
||||||
|
|
||||||
@@ -1176,7 +1176,7 @@ _.pluck(stooges, 'name');
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_reducecollection-callback--accumulator-thisarg"></a>`_.reduce(collection, callback [, accumulator, thisArg])`
|
### <a id="_reducecollection-callback--accumulator-thisarg"></a>`_.reduce(collection, callback [, accumulator, thisArg])`
|
||||||
<a href="#_reducecollection-callback--accumulator-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2232 "View in source") [Ⓣ][1]
|
<a href="#_reducecollection-callback--accumulator-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2222 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Boils down a `collection` to a single value. The initial state of the reduction is `accumulator` and each successive step of it should be returned by the `callback`. The `callback` is bound to `thisArg` and invoked with `4` arguments; for arrays they are *(accumulator, value, index|key, collection)*.
|
Boils down a `collection` to a single value. The initial state of the reduction is `accumulator` and each successive step of it should be returned by the `callback`. The `callback` is bound to `thisArg` and invoked with `4` arguments; for arrays they are *(accumulator, value, index|key, collection)*.
|
||||||
|
|
||||||
@@ -1206,7 +1206,7 @@ var sum = _.reduce([1, 2, 3], function(memo, num) { return memo + num; });
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_reducerightcollection-callback--accumulator-thisarg"></a>`_.reduceRight(collection, callback [, accumulator, thisArg])`
|
### <a id="_reducerightcollection-callback--accumulator-thisarg"></a>`_.reduceRight(collection, callback [, accumulator, thisArg])`
|
||||||
<a href="#_reducerightcollection-callback--accumulator-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2269 "View in source") [Ⓣ][1]
|
<a href="#_reducerightcollection-callback--accumulator-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2251 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
The right-associative version of `_.reduce`.
|
The right-associative version of `_.reduce`.
|
||||||
|
|
||||||
@@ -1237,7 +1237,7 @@ var flat = _.reduceRight(list, function(a, b) { return a.concat(b); }, []);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_rejectcollection--callbackidentity-thisarg"></a>`_.reject(collection [, callback=identity, thisArg])`
|
### <a id="_rejectcollection--callbackidentity-thisarg"></a>`_.reject(collection [, callback=identity, thisArg])`
|
||||||
<a href="#_rejectcollection--callbackidentity-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2306 "View in source") [Ⓣ][1]
|
<a href="#_rejectcollection--callbackidentity-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2288 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
The opposite of `_.filter`, this method returns the values of a `collection` that `callback` does **not** return truthy for.
|
The opposite of `_.filter`, this method returns the values of a `collection` that `callback` does **not** return truthy for.
|
||||||
|
|
||||||
@@ -1263,7 +1263,7 @@ var odds = _.reject([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; });
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_shufflecollection"></a>`_.shuffle(collection)`
|
### <a id="_shufflecollection"></a>`_.shuffle(collection)`
|
||||||
<a href="#_shufflecollection">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2324 "View in source") [Ⓣ][1]
|
<a href="#_shufflecollection">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2309 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates an array of shuffled `array` values, using a version of the Fisher-Yates shuffle. See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle.
|
Creates an array of shuffled `array` values, using a version of the Fisher-Yates shuffle. See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle.
|
||||||
|
|
||||||
@@ -1287,7 +1287,7 @@ _.shuffle([1, 2, 3, 4, 5, 6]);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_sizecollection"></a>`_.size(collection)`
|
### <a id="_sizecollection"></a>`_.size(collection)`
|
||||||
<a href="#_sizecollection">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2356 "View in source") [Ⓣ][1]
|
<a href="#_sizecollection">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2341 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Gets the size of the `collection` by returning `collection.length` for arrays and array-like objects or the number of own enumerable properties for objects.
|
Gets the size of the `collection` by returning `collection.length` for arrays and array-like objects or the number of own enumerable properties for objects.
|
||||||
|
|
||||||
@@ -1317,7 +1317,7 @@ _.size('curly');
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_somecollection--callbackidentity-thisarg"></a>`_.some(collection [, callback=identity, thisArg])`
|
### <a id="_somecollection--callbackidentity-thisarg"></a>`_.some(collection [, callback=identity, thisArg])`
|
||||||
<a href="#_somecollection--callbackidentity-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2381 "View in source") [Ⓣ][1]
|
<a href="#_somecollection--callbackidentity-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2366 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Checks if the `callback` returns a truthy value for **any** element of a `collection`. The function returns as soon as it finds passing value, and does not iterate over the entire `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*.
|
Checks if the `callback` returns a truthy value for **any** element of a `collection`. The function returns as soon as it finds passing value, and does not iterate over the entire `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*.
|
||||||
|
|
||||||
@@ -1346,7 +1346,7 @@ _.some([null, 0, 'yes', false]);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_sortbycollection-callbackproperty--thisarg"></a>`_.sortBy(collection, callback|property [, thisArg])`
|
### <a id="_sortbycollection-callbackproperty--thisarg"></a>`_.sortBy(collection, callback|property [, thisArg])`
|
||||||
<a href="#_sortbycollection-callbackproperty--thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2411 "View in source") [Ⓣ][1]
|
<a href="#_sortbycollection-callbackproperty--thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2400 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates an array, stable sorted in ascending order by the results of running each element of `collection` through a `callback`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. The `callback` argument may also be the name of a property to sort by *(e.g. 'length')*.
|
Creates an array, stable sorted in ascending order by the results of running each element of `collection` through a `callback`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. The `callback` argument may also be the name of a property to sort by *(e.g. 'length')*.
|
||||||
|
|
||||||
@@ -1378,7 +1378,7 @@ _.sortBy(['larry', 'brendan', 'moe'], 'length');
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_toarraycollection"></a>`_.toArray(collection)`
|
### <a id="_toarraycollection"></a>`_.toArray(collection)`
|
||||||
<a href="#_toarraycollection">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2447 "View in source") [Ⓣ][1]
|
<a href="#_toarraycollection">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2432 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Converts the `collection`, to an array.
|
Converts the `collection`, to an array.
|
||||||
|
|
||||||
@@ -1402,13 +1402,13 @@ Converts the `collection`, to an array.
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_wherecollection-properties"></a>`_.where(collection, properties)`
|
### <a id="_wherecollection-properties"></a>`_.where(collection, properties)`
|
||||||
<a href="#_wherecollection-properties">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2481 "View in source") [Ⓣ][1]
|
<a href="#_wherecollection-properties">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2462 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Examines each element in a `collection`, returning an array of all elements that contain the given `properties`.
|
Examines each element in a `collection`, returning an array of all elements that contain the given `properties`.
|
||||||
|
|
||||||
#### Arguments
|
#### Arguments
|
||||||
1. `collection` *(Array|Object|String)*: The collection to iterate over.
|
1. `collection` *(Array|Object|String)*: The collection to iterate over.
|
||||||
2. `properties` *(Object)*: The object of properties/values to filter by.
|
2. `properties` *(Object)*: The object of property values to filter by.
|
||||||
|
|
||||||
#### Returns
|
#### Returns
|
||||||
*(Array)*: Returns a new array of elements that contain the given `properties`.
|
*(Array)*: Returns a new array of elements that contain the given `properties`.
|
||||||
@@ -1440,7 +1440,7 @@ _.where(stooges, { 'age': 40 });
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_aftern-func"></a>`_.after(n, func)`
|
### <a id="_aftern-func"></a>`_.after(n, func)`
|
||||||
<a href="#_aftern-func">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3110 "View in source") [Ⓣ][1]
|
<a href="#_aftern-func">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3086 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates a function that is restricted to executing only after it is called `n` times.
|
Creates a function that is restricted to executing only after it is called `n` times.
|
||||||
|
|
||||||
@@ -1468,7 +1468,7 @@ _.forEach(notes, function(note) {
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_bindfunc--thisarg-arg1-arg2-"></a>`_.bind(func [, thisArg, arg1, arg2, ...])`
|
### <a id="_bindfunc--thisarg-arg1-arg2-"></a>`_.bind(func [, thisArg, arg1, arg2, ...])`
|
||||||
<a href="#_bindfunc--thisarg-arg1-arg2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3143 "View in source") [Ⓣ][1]
|
<a href="#_bindfunc--thisarg-arg1-arg2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3119 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates a function that, when called, invokes `func` with the `this` binding of `thisArg` and prepends any additional `bind` arguments to those passed to the bound function.
|
Creates a function that, when called, invokes `func` with the `this` binding of `thisArg` and prepends any additional `bind` arguments to those passed to the bound function.
|
||||||
|
|
||||||
@@ -1499,7 +1499,7 @@ func();
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_bindallobject--methodname1-methodname2-"></a>`_.bindAll(object [, methodName1, methodName2, ...])`
|
### <a id="_bindallobject--methodname1-methodname2-"></a>`_.bindAll(object [, methodName1, methodName2, ...])`
|
||||||
<a href="#_bindallobject--methodname1-methodname2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3173 "View in source") [Ⓣ][1]
|
<a href="#_bindallobject--methodname1-methodname2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3149 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Binds methods on `object` to `object`, overwriting the existing method. If no method names are provided, all the function properties of `object` will be bound.
|
Binds methods on `object` to `object`, overwriting the existing method. If no method names are provided, all the function properties of `object` will be bound.
|
||||||
|
|
||||||
@@ -1530,7 +1530,7 @@ jQuery('#lodash_button').on('click', buttonView.onClick);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_composefunc1-func2-"></a>`_.compose([func1, func2, ...])`
|
### <a id="_composefunc1-func2-"></a>`_.compose([func1, func2, ...])`
|
||||||
<a href="#_composefunc1-func2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3209 "View in source") [Ⓣ][1]
|
<a href="#_composefunc1-func2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3179 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates a function that is the composition of the passed functions, where each function consumes the return value of the function that follows. In math terms, composing the functions `f()`, `g()`, and `h()` produces `f(g(h()))`.
|
Creates a function that is the composition of the passed functions, where each function consumes the return value of the function that follows. In math terms, composing the functions `f()`, `g()`, and `h()` produces `f(g(h()))`.
|
||||||
|
|
||||||
@@ -1557,7 +1557,7 @@ welcome('moe');
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_debouncefunc-wait-immediate"></a>`_.debounce(func, wait, immediate)`
|
### <a id="_debouncefunc-wait-immediate"></a>`_.debounce(func, wait, immediate)`
|
||||||
<a href="#_debouncefunc-wait-immediate">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3242 "View in source") [Ⓣ][1]
|
<a href="#_debouncefunc-wait-immediate">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3212 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates a function that will delay the execution of `func` until after `wait` milliseconds have elapsed since the last time it was invoked. Pass `true` for `immediate` to cause debounce to invoke `func` on the leading, instead of the trailing, edge of the `wait` timeout. Subsequent calls to the debounced function will return the result of the last `func` call.
|
Creates a function that will delay the execution of `func` until after `wait` milliseconds have elapsed since the last time it was invoked. Pass `true` for `immediate` to cause debounce to invoke `func` on the leading, instead of the trailing, edge of the `wait` timeout. Subsequent calls to the debounced function will return the result of the last `func` call.
|
||||||
|
|
||||||
@@ -1583,7 +1583,7 @@ jQuery(window).on('resize', lazyLayout);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_deferfunc--arg1-arg2-"></a>`_.defer(func [, arg1, arg2, ...])`
|
### <a id="_deferfunc--arg1-arg2-"></a>`_.defer(func [, arg1, arg2, ...])`
|
||||||
<a href="#_deferfunc--arg1-arg2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3307 "View in source") [Ⓣ][1]
|
<a href="#_deferfunc--arg1-arg2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3276 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Defers executing the `func` function until the current call stack has cleared. Additional arguments will be passed to `func` when it is invoked.
|
Defers executing the `func` function until the current call stack has cleared. Additional arguments will be passed to `func` when it is invoked.
|
||||||
|
|
||||||
@@ -1608,7 +1608,7 @@ _.defer(function() { alert('deferred'); });
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_delayfunc-wait--arg1-arg2-"></a>`_.delay(func, wait [, arg1, arg2, ...])`
|
### <a id="_delayfunc-wait--arg1-arg2-"></a>`_.delay(func, wait [, arg1, arg2, ...])`
|
||||||
<a href="#_delayfunc-wait--arg1-arg2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3287 "View in source") [Ⓣ][1]
|
<a href="#_delayfunc-wait--arg1-arg2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3256 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Executes the `func` function after `wait` milliseconds. Additional arguments will be passed to `func` when it is invoked.
|
Executes the `func` function after `wait` milliseconds. Additional arguments will be passed to `func` when it is invoked.
|
||||||
|
|
||||||
@@ -1635,7 +1635,7 @@ _.delay(log, 1000, 'logged later');
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_latebindobject-methodname--arg1-arg2-"></a>`_.lateBind(object, methodName [, arg1, arg2, ...])`
|
### <a id="_latebindobject-methodname--arg1-arg2-"></a>`_.lateBind(object, methodName [, arg1, arg2, ...])`
|
||||||
<a href="#_latebindobject-methodname--arg1-arg2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3345 "View in source") [Ⓣ][1]
|
<a href="#_latebindobject-methodname--arg1-arg2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3314 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates a function that, when called, invokes `object[methodName]` and prepends any additional `lateBind` arguments to those passed to the bound function. This method differs from `_.bind` by allowing bound functions to reference methods that will be redefined or don't yet exist.
|
Creates a function that, when called, invokes `object[methodName]` and prepends any additional `lateBind` arguments to those passed to the bound function. This method differs from `_.bind` by allowing bound functions to reference methods that will be redefined or don't yet exist.
|
||||||
|
|
||||||
@@ -1676,7 +1676,7 @@ func();
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_memoizefunc--resolver"></a>`_.memoize(func [, resolver])`
|
### <a id="_memoizefunc--resolver"></a>`_.memoize(func [, resolver])`
|
||||||
<a href="#_memoizefunc--resolver">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3367 "View in source") [Ⓣ][1]
|
<a href="#_memoizefunc--resolver">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3336 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates a function that memoizes the result of `func`. If `resolver` is passed, it will be used to determine the cache key for storing the result based on the arguments passed to the memoized function. By default, the first argument passed to the memoized function is used as the cache key.
|
Creates a function that memoizes the result of `func`. If `resolver` is passed, it will be used to determine the cache key for storing the result based on the arguments passed to the memoized function. By default, the first argument passed to the memoized function is used as the cache key.
|
||||||
|
|
||||||
@@ -1702,7 +1702,7 @@ var fibonacci = _.memoize(function(n) {
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_oncefunc"></a>`_.once(func)`
|
### <a id="_oncefunc"></a>`_.once(func)`
|
||||||
<a href="#_oncefunc">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3393 "View in source") [Ⓣ][1]
|
<a href="#_oncefunc">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3362 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates a function that is restricted to one execution. Repeat calls to the function will return the value of the first call.
|
Creates a function that is restricted to one execution. Repeat calls to the function will return the value of the first call.
|
||||||
|
|
||||||
@@ -1728,7 +1728,7 @@ initialize();
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_partialfunc--arg1-arg2-"></a>`_.partial(func [, arg1, arg2, ...])`
|
### <a id="_partialfunc--arg1-arg2-"></a>`_.partial(func [, arg1, arg2, ...])`
|
||||||
<a href="#_partialfunc--arg1-arg2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3428 "View in source") [Ⓣ][1]
|
<a href="#_partialfunc--arg1-arg2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3397 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates a function that, when called, invokes `func` with any additional `partial` arguments prepended to those passed to the new function. This method is similar to `bind`, except it does **not** alter the `this` binding.
|
Creates a function that, when called, invokes `func` with any additional `partial` arguments prepended to those passed to the new function. This method is similar to `bind`, except it does **not** alter the `this` binding.
|
||||||
|
|
||||||
@@ -1755,7 +1755,7 @@ hi('moe');
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_throttlefunc-wait"></a>`_.throttle(func, wait)`
|
### <a id="_throttlefunc-wait"></a>`_.throttle(func, wait)`
|
||||||
<a href="#_throttlefunc-wait">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3450 "View in source") [Ⓣ][1]
|
<a href="#_throttlefunc-wait">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3419 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates a function that, when executed, will only call the `func` function at most once per every `wait` milliseconds. If the throttled function is invoked more than once during the `wait` timeout, `func` will also be called on the trailing edge of the timeout. Subsequent calls to the throttled function will return the result of the last `func` call.
|
Creates a function that, when executed, will only call the `func` function at most once per every `wait` milliseconds. If the throttled function is invoked more than once during the `wait` timeout, `func` will also be called on the trailing edge of the timeout. Subsequent calls to the throttled function will return the result of the last `func` call.
|
||||||
|
|
||||||
@@ -1780,7 +1780,7 @@ jQuery(window).on('scroll', throttled);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_wrapvalue-wrapper"></a>`_.wrap(value, wrapper)`
|
### <a id="_wrapvalue-wrapper"></a>`_.wrap(value, wrapper)`
|
||||||
<a href="#_wrapvalue-wrapper">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3502 "View in source") [Ⓣ][1]
|
<a href="#_wrapvalue-wrapper">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3470 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates a function that passes `value` to the `wrapper` function as its first argument. Additional arguments passed to the new function are appended to those passed to the `wrapper` function.
|
Creates a function that passes `value` to the `wrapper` function as its first argument. Additional arguments passed to the new function are appended to those passed to the `wrapper` function.
|
||||||
|
|
||||||
@@ -1793,12 +1793,12 @@ Creates a function that passes `value` to the `wrapper` function as its first ar
|
|||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
```js
|
```js
|
||||||
var hello = function(name) { return 'hello: ' + name; };
|
var hello = function(name) { return 'hello ' + name; };
|
||||||
hello = _.wrap(hello, function(func) {
|
hello = _.wrap(hello, function(func) {
|
||||||
return 'before, ' + func('moe') + ', after';
|
return 'before, ' + func('moe') + ', after';
|
||||||
});
|
});
|
||||||
hello();
|
hello();
|
||||||
// => 'before, hello: moe, after'
|
// => 'before, hello moe, after'
|
||||||
```
|
```
|
||||||
|
|
||||||
* * *
|
* * *
|
||||||
@@ -1816,7 +1816,7 @@ hello();
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_clonevalue-deep"></a>`_.clone(value, deep)`
|
### <a id="_clonevalue-deep"></a>`_.clone(value, deep)`
|
||||||
<a href="#_clonevalue-deep">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1029 "View in source") [Ⓣ][1]
|
<a href="#_clonevalue-deep">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L873 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates a clone of `value`. If `deep` is `true`, all nested objects will also be cloned otherwise they will be assigned by reference. Functions, DOM nodes, `arguments` objects, and objects created by constructors other than `Object` are **not** cloned.
|
Creates a clone of `value`. If `deep` is `true`, all nested objects will also be cloned otherwise they will be assigned by reference. Functions, DOM nodes, `arguments` objects, and objects created by constructors other than `Object` are **not** cloned.
|
||||||
|
|
||||||
@@ -1855,7 +1855,7 @@ shallow[0] === stooges[0];
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_defaultsobject--default1-default2-"></a>`_.defaults(object [, default1, default2, ...])`
|
### <a id="_defaultsobject--default1-default2-"></a>`_.defaults(object [, default1, default2, ...])`
|
||||||
<a href="#_defaultsobject--default1-default2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1112 "View in source") [Ⓣ][1]
|
<a href="#_defaultsobject--default1-default2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L956 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Assigns enumerable properties of the default object(s) to the `destination` object for all `destination` properties that resolve to `null`/`undefined`. Once a property is set, additional defaults of the same property will be ignored.
|
Assigns enumerable properties of the default object(s) to the `destination` object for all `destination` properties that resolve to `null`/`undefined`. Once a property is set, additional defaults of the same property will be ignored.
|
||||||
|
|
||||||
@@ -1881,7 +1881,7 @@ _.defaults(iceCream, { 'flavor': 'vanilla', 'sprinkles': 'rainbow' });
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_extendobject--source1-source2-"></a>`_.extend(object [, source1, source2, ...])`
|
### <a id="_extendobject--source1-source2-"></a>`_.extend(object [, source1, source2, ...])`
|
||||||
<a href="#_extendobject--source1-source2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1132 "View in source") [Ⓣ][1]
|
<a href="#_extendobject--source1-source2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L976 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Assigns enumerable properties of the source object(s) to the `destination` object. Subsequent sources will overwrite propery assignments of previous sources.
|
Assigns enumerable properties of the source object(s) to the `destination` object. Subsequent sources will overwrite propery assignments of previous sources.
|
||||||
|
|
||||||
@@ -1906,7 +1906,7 @@ _.extend({ 'name': 'moe' }, { 'age': 40 });
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_forinobject-callback--thisarg"></a>`_.forIn(object, callback [, thisArg])`
|
### <a id="_forinobject-callback--thisarg"></a>`_.forIn(object, callback [, thisArg])`
|
||||||
<a href="#_forinobject-callback--thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1162 "View in source") [Ⓣ][1]
|
<a href="#_forinobject-callback--thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L731 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Iterates over `object`'s own and inherited enumerable properties, executing the `callback` for each property. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`.
|
Iterates over `object`'s own and inherited enumerable properties, executing the `callback` for each property. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`.
|
||||||
|
|
||||||
@@ -1942,7 +1942,7 @@ _.forIn(new Dog('Dagny'), function(value, key) {
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_forownobject-callback--thisarg"></a>`_.forOwn(object, callback [, thisArg])`
|
### <a id="_forownobject-callback--thisarg"></a>`_.forOwn(object, callback [, thisArg])`
|
||||||
<a href="#_forownobject-callback--thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1186 "View in source") [Ⓣ][1]
|
<a href="#_forownobject-callback--thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L755 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Iterates over `object`'s own enumerable properties, executing the `callback` for each property. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`.
|
Iterates over `object`'s own enumerable properties, executing the `callback` for each property. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`.
|
||||||
|
|
||||||
@@ -1970,7 +1970,7 @@ _.forOwn({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) {
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_functionsobject"></a>`_.functions(object)`
|
### <a id="_functionsobject"></a>`_.functions(object)`
|
||||||
<a href="#_functionsobject">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1203 "View in source") [Ⓣ][1]
|
<a href="#_functionsobject">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L993 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates a sorted array of all enumerable properties, own and inherited, of `object` that have function values.
|
Creates a sorted array of all enumerable properties, own and inherited, of `object` that have function values.
|
||||||
|
|
||||||
@@ -1997,7 +1997,7 @@ _.functions(_);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_hasobject-property"></a>`_.has(object, property)`
|
### <a id="_hasobject-property"></a>`_.has(object, property)`
|
||||||
<a href="#_hasobject-property">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1226 "View in source") [Ⓣ][1]
|
<a href="#_hasobject-property">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1018 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Checks if the specified object `property` exists and is a direct property, instead of an inherited property.
|
Checks if the specified object `property` exists and is a direct property, instead of an inherited property.
|
||||||
|
|
||||||
@@ -2022,7 +2022,7 @@ _.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b');
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_invertobject"></a>`_.invert(object)`
|
### <a id="_invertobject"></a>`_.invert(object)`
|
||||||
<a href="#_invertobject">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L804 "View in source") [Ⓣ][1]
|
<a href="#_invertobject">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1035 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates an object composed of the inverted keys and values of the given `object`.
|
Creates an object composed of the inverted keys and values of the given `object`.
|
||||||
|
|
||||||
@@ -2046,7 +2046,7 @@ _.invert({ 'first': 'Moe', 'second': 'Larry', 'third': 'Curly' });
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_isargumentsvalue"></a>`_.isArguments(value)`
|
### <a id="_isargumentsvalue"></a>`_.isArguments(value)`
|
||||||
<a href="#_isargumentsvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L826 "View in source") [Ⓣ][1]
|
<a href="#_isargumentsvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L693 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Checks if `value` is an `arguments` object.
|
Checks if `value` is an `arguments` object.
|
||||||
|
|
||||||
@@ -2073,7 +2073,7 @@ _.isArguments([1, 2, 3]);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_isarrayvalue"></a>`_.isArray(value)`
|
### <a id="_isarrayvalue"></a>`_.isArray(value)`
|
||||||
<a href="#_isarrayvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L852 "View in source") [Ⓣ][1]
|
<a href="#_isarrayvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1059 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Checks if `value` is an array.
|
Checks if `value` is an array.
|
||||||
|
|
||||||
@@ -2100,7 +2100,7 @@ _.isArray([1, 2, 3]);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_isbooleanvalue"></a>`_.isBoolean(value)`
|
### <a id="_isbooleanvalue"></a>`_.isBoolean(value)`
|
||||||
<a href="#_isbooleanvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1243 "View in source") [Ⓣ][1]
|
<a href="#_isbooleanvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1076 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Checks if `value` is a boolean *(`true` or `false`)* value.
|
Checks if `value` is a boolean *(`true` or `false`)* value.
|
||||||
|
|
||||||
@@ -2124,7 +2124,7 @@ _.isBoolean(null);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_isdatevalue"></a>`_.isDate(value)`
|
### <a id="_isdatevalue"></a>`_.isDate(value)`
|
||||||
<a href="#_isdatevalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1260 "View in source") [Ⓣ][1]
|
<a href="#_isdatevalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1093 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Checks if `value` is a date.
|
Checks if `value` is a date.
|
||||||
|
|
||||||
@@ -2148,7 +2148,7 @@ _.isDate(new Date);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_iselementvalue"></a>`_.isElement(value)`
|
### <a id="_iselementvalue"></a>`_.isElement(value)`
|
||||||
<a href="#_iselementvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1277 "View in source") [Ⓣ][1]
|
<a href="#_iselementvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1110 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Checks if `value` is a DOM element.
|
Checks if `value` is a DOM element.
|
||||||
|
|
||||||
@@ -2172,7 +2172,7 @@ _.isElement(document.body);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_isemptyvalue"></a>`_.isEmpty(value)`
|
### <a id="_isemptyvalue"></a>`_.isEmpty(value)`
|
||||||
<a href="#_isemptyvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1302 "View in source") [Ⓣ][1]
|
<a href="#_isemptyvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1135 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Checks if `value` is empty. Arrays, strings, or `arguments` objects with a length of `0` and objects with no own enumerable properties are considered "empty".
|
Checks if `value` is empty. Arrays, strings, or `arguments` objects with a length of `0` and objects with no own enumerable properties are considered "empty".
|
||||||
|
|
||||||
@@ -2202,7 +2202,7 @@ _.isEmpty('');
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_isequala-b"></a>`_.isEqual(a, b)`
|
### <a id="_isequala-b"></a>`_.isEqual(a, b)`
|
||||||
<a href="#_isequala-b">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1341 "View in source") [Ⓣ][1]
|
<a href="#_isequala-b">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1177 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Performs a deep comparison between two values to determine if they are equivalent to each other.
|
Performs a deep comparison between two values to determine if they are equivalent to each other.
|
||||||
|
|
||||||
@@ -2233,9 +2233,9 @@ _.isEqual(moe, clone);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_isfinitevalue"></a>`_.isFinite(value)`
|
### <a id="_isfinitevalue"></a>`_.isFinite(value)`
|
||||||
<a href="#_isfinitevalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1498 "View in source") [Ⓣ][1]
|
<a href="#_isfinitevalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1339 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Checks if `value` is a finite number. Note: This is not the same as native `isFinite`, which will return true for booleans and other values. See http://es5.github.com/#x15.1.2.5.
|
Checks if `value` is, or can be coerced to, a finite number. Note: This is not the same as native `isFinite`, which will return true for booleans and empty strings. See http://es5.github.com/#x15.1.2.5.
|
||||||
|
|
||||||
#### Arguments
|
#### Arguments
|
||||||
1. `value` *(Mixed)*: The value to check.
|
1. `value` *(Mixed)*: The value to check.
|
||||||
@@ -2249,6 +2249,12 @@ _.isFinite(-101);
|
|||||||
// => true
|
// => true
|
||||||
|
|
||||||
_.isFinite('10');
|
_.isFinite('10');
|
||||||
|
// => true
|
||||||
|
|
||||||
|
_.isFinite(true);
|
||||||
|
// => false
|
||||||
|
|
||||||
|
_.isFinite('');
|
||||||
// => false
|
// => false
|
||||||
|
|
||||||
_.isFinite(Infinity);
|
_.isFinite(Infinity);
|
||||||
@@ -2263,7 +2269,7 @@ _.isFinite(Infinity);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_isfunctionvalue"></a>`_.isFunction(value)`
|
### <a id="_isfunctionvalue"></a>`_.isFunction(value)`
|
||||||
<a href="#_isfunctionvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L869 "View in source") [Ⓣ][1]
|
<a href="#_isfunctionvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1356 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Checks if `value` is a function.
|
Checks if `value` is a function.
|
||||||
|
|
||||||
@@ -2287,7 +2293,7 @@ _.isFunction(_);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_isnanvalue"></a>`_.isNaN(value)`
|
### <a id="_isnanvalue"></a>`_.isNaN(value)`
|
||||||
<a href="#_isnanvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1556 "View in source") [Ⓣ][1]
|
<a href="#_isnanvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1420 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Checks if `value` is `NaN`. Note: This is not the same as native `isNaN`, which will return true for `undefined` and other values. See http://es5.github.com/#x15.1.2.4.
|
Checks if `value` is `NaN`. Note: This is not the same as native `isNaN`, which will return true for `undefined` and other values. See http://es5.github.com/#x15.1.2.4.
|
||||||
|
|
||||||
@@ -2320,7 +2326,7 @@ _.isNaN(undefined);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_isnullvalue"></a>`_.isNull(value)`
|
### <a id="_isnullvalue"></a>`_.isNull(value)`
|
||||||
<a href="#_isnullvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1579 "View in source") [Ⓣ][1]
|
<a href="#_isnullvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1443 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Checks if `value` is `null`.
|
Checks if `value` is `null`.
|
||||||
|
|
||||||
@@ -2347,7 +2353,7 @@ _.isNull(undefined);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_isnumbervalue"></a>`_.isNumber(value)`
|
### <a id="_isnumbervalue"></a>`_.isNumber(value)`
|
||||||
<a href="#_isnumbervalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1596 "View in source") [Ⓣ][1]
|
<a href="#_isnumbervalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1460 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Checks if `value` is a number.
|
Checks if `value` is a number.
|
||||||
|
|
||||||
@@ -2371,7 +2377,7 @@ _.isNumber(8.4 * 5);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_isobjectvalue"></a>`_.isObject(value)`
|
### <a id="_isobjectvalue"></a>`_.isObject(value)`
|
||||||
<a href="#_isobjectvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1522 "View in source") [Ⓣ][1]
|
<a href="#_isobjectvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1386 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Checks if `value` is the language type of Object. *(e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)*
|
Checks if `value` is the language type of Object. *(e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)*
|
||||||
|
|
||||||
@@ -2401,7 +2407,7 @@ _.isObject(1);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_isplainobjectvalue"></a>`_.isPlainObject(value)`
|
### <a id="_isplainobjectvalue"></a>`_.isPlainObject(value)`
|
||||||
<a href="#_isplainobjectvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L903 "View in source") [Ⓣ][1]
|
<a href="#_isplainobjectvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1488 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Checks if a given `value` is an object created by the `Object` constructor.
|
Checks if a given `value` is an object created by the `Object` constructor.
|
||||||
|
|
||||||
@@ -2419,10 +2425,10 @@ function Stooge(name, age) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_.isPlainObject(new Stooge('moe', 40));
|
_.isPlainObject(new Stooge('moe', 40));
|
||||||
// false
|
// => false
|
||||||
|
|
||||||
_.isPlainObject([1, 2, 3]);
|
_.isPlainObject([1, 2, 3]);
|
||||||
// false
|
// => false
|
||||||
|
|
||||||
_.isPlainObject({ 'name': 'moe', 'age': 40 });
|
_.isPlainObject({ 'name': 'moe', 'age': 40 });
|
||||||
// => true
|
// => true
|
||||||
@@ -2436,7 +2442,7 @@ _.isPlainObject({ 'name': 'moe', 'age': 40 });
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_isregexpvalue"></a>`_.isRegExp(value)`
|
### <a id="_isregexpvalue"></a>`_.isRegExp(value)`
|
||||||
<a href="#_isregexpvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1613 "View in source") [Ⓣ][1]
|
<a href="#_isregexpvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1513 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Checks if `value` is a regular expression.
|
Checks if `value` is a regular expression.
|
||||||
|
|
||||||
@@ -2460,7 +2466,7 @@ _.isRegExp(/moe/);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_isstringvalue"></a>`_.isString(value)`
|
### <a id="_isstringvalue"></a>`_.isString(value)`
|
||||||
<a href="#_isstringvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1630 "View in source") [Ⓣ][1]
|
<a href="#_isstringvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1530 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Checks if `value` is a string.
|
Checks if `value` is a string.
|
||||||
|
|
||||||
@@ -2484,7 +2490,7 @@ _.isString('moe');
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_isundefinedvalue"></a>`_.isUndefined(value)`
|
### <a id="_isundefinedvalue"></a>`_.isUndefined(value)`
|
||||||
<a href="#_isundefinedvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1648 "View in source") [Ⓣ][1]
|
<a href="#_isundefinedvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1548 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Checks if `value` is `undefined`.
|
Checks if `value` is `undefined`.
|
||||||
|
|
||||||
@@ -2508,7 +2514,7 @@ _.isUndefined(void 0);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_keysobject"></a>`_.keys(object)`
|
### <a id="_keysobject"></a>`_.keys(object)`
|
||||||
<a href="#_keysobject">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1665 "View in source") [Ⓣ][1]
|
<a href="#_keysobject">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1565 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates an array composed of the own enumerable property names of `object`.
|
Creates an array composed of the own enumerable property names of `object`.
|
||||||
|
|
||||||
@@ -2532,7 +2538,7 @@ _.keys({ 'one': 1, 'two': 2, 'three': 3 });
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_mergeobject--source1-source2-"></a>`_.merge(object [, source1, source2, ...])`
|
### <a id="_mergeobject--source1-source2-"></a>`_.merge(object [, source1, source2, ...])`
|
||||||
<a href="#_mergeobject--source1-source2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1708 "View in source") [Ⓣ][1]
|
<a href="#_mergeobject--source1-source2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1608 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Merges enumerable properties of the source object(s) into the `destination` object. Subsequent sources will overwrite propery assignments of previous sources.
|
Merges enumerable properties of the source object(s) into the `destination` object. Subsequent sources will overwrite propery assignments of previous sources.
|
||||||
|
|
||||||
@@ -2567,7 +2573,7 @@ _.merge(stooges, ages);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_omitobject-callback-prop1-prop2--thisarg"></a>`_.omit(object, callback|[prop1, prop2, ..., thisArg])`
|
### <a id="_omitobject-callback-prop1-prop2--thisarg"></a>`_.omit(object, callback|[prop1, prop2, ..., thisArg])`
|
||||||
<a href="#_omitobject-callback-prop1-prop2--thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1765 "View in source") [Ⓣ][1]
|
<a href="#_omitobject-callback-prop1-prop2--thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1678 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates a shallow clone of `object` excluding the specified properties. Property names may be specified as individual arguments or as arrays of property names. If `callback` is passed, it will be executed for each property in the `object`, omitting the properties `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*.
|
Creates a shallow clone of `object` excluding the specified properties. Property names may be specified as individual arguments or as arrays of property names. If `callback` is passed, it will be executed for each property in the `object`, omitting the properties `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*.
|
||||||
|
|
||||||
@@ -2598,7 +2604,7 @@ _.omit({ 'name': 'moe', '_hint': 'knucklehead', '_seed': '96c4eb' }, function(va
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_pairsobject"></a>`_.pairs(object)`
|
### <a id="_pairsobject"></a>`_.pairs(object)`
|
||||||
<a href="#_pairsobject">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1781 "View in source") [Ⓣ][1]
|
<a href="#_pairsobject">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1712 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates a two dimensional array of the given object's key-value pairs, i.e. `[[key1, value1], [key2, value2]]`.
|
Creates a two dimensional array of the given object's key-value pairs, i.e. `[[key1, value1], [key2, value2]]`.
|
||||||
|
|
||||||
@@ -2622,7 +2628,7 @@ _.pairs({ 'moe': 30, 'larry': 40, 'curly': 50 });
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_pickobject-callback-prop1-prop2--thisarg"></a>`_.pick(object, callback|[prop1, prop2, ..., thisArg])`
|
### <a id="_pickobject-callback-prop1-prop2--thisarg"></a>`_.pick(object, callback|[prop1, prop2, ..., thisArg])`
|
||||||
<a href="#_pickobject-callback-prop1-prop2--thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1812 "View in source") [Ⓣ][1]
|
<a href="#_pickobject-callback-prop1-prop2--thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1745 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates a shallow clone of `object` composed of the specified properties. Property names may be specified as individual arguments or as arrays of property names. If `callback` is passed, it will be executed for each property in the `object`, picking the properties `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*.
|
Creates a shallow clone of `object` composed of the specified properties. Property names may be specified as individual arguments or as arrays of property names. If `callback` is passed, it will be executed for each property in the `object`, picking the properties `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*.
|
||||||
|
|
||||||
@@ -2653,7 +2659,7 @@ _.pick({ 'name': 'moe', '_hint': 'knucklehead', '_seed': '96c4eb' }, function(va
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_valuesobject"></a>`_.values(object)`
|
### <a id="_valuesobject"></a>`_.values(object)`
|
||||||
<a href="#_valuesobject">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1842 "View in source") [Ⓣ][1]
|
<a href="#_valuesobject">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1782 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates an array composed of the own enumerable property values of `object`.
|
Creates an array composed of the own enumerable property values of `object`.
|
||||||
|
|
||||||
@@ -2684,7 +2690,7 @@ _.values({ 'one': 1, 'two': 2, 'three': 3 });
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_escapestring"></a>`_.escape(string)`
|
### <a id="_escapestring"></a>`_.escape(string)`
|
||||||
<a href="#_escapestring">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3528 "View in source") [Ⓣ][1]
|
<a href="#_escapestring">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3494 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Converts the characters `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding HTML entities.
|
Converts the characters `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding HTML entities.
|
||||||
|
|
||||||
@@ -2708,7 +2714,7 @@ _.escape('Moe, Larry & Curly');
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_identityvalue"></a>`_.identity(value)`
|
### <a id="_identityvalue"></a>`_.identity(value)`
|
||||||
<a href="#_identityvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3548 "View in source") [Ⓣ][1]
|
<a href="#_identityvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3514 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
This function returns the first argument passed to it. Note: It is used throughout Lo-Dash as a default callback.
|
This function returns the first argument passed to it. Note: It is used throughout Lo-Dash as a default callback.
|
||||||
|
|
||||||
@@ -2733,7 +2739,7 @@ moe === _.identity(moe);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_mixinobject"></a>`_.mixin(object)`
|
### <a id="_mixinobject"></a>`_.mixin(object)`
|
||||||
<a href="#_mixinobject">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3574 "View in source") [Ⓣ][1]
|
<a href="#_mixinobject">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3540 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Adds functions properties of `object` to the `lodash` function and chainable wrapper.
|
Adds functions properties of `object` to the `lodash` function and chainable wrapper.
|
||||||
|
|
||||||
@@ -2763,7 +2769,7 @@ _('curly').capitalize();
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_noconflict"></a>`_.noConflict()`
|
### <a id="_noconflict"></a>`_.noConflict()`
|
||||||
<a href="#_noconflict">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3605 "View in source") [Ⓣ][1]
|
<a href="#_noconflict">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3570 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Reverts the '_' variable to its previous value and returns a reference to the `lodash` function.
|
Reverts the '_' variable to its previous value and returns a reference to the `lodash` function.
|
||||||
|
|
||||||
@@ -2783,7 +2789,7 @@ var lodash = _.noConflict();
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_randommin0-max1"></a>`_.random([min=0, max=1])`
|
### <a id="_randommin0-max1"></a>`_.random([min=0, max=1])`
|
||||||
<a href="#_randommin0-max1">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3628 "View in source") [Ⓣ][1]
|
<a href="#_randommin0-max1">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3593 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Produces a random number between `min` and `max` *(inclusive)*. If only one argument is passed, a number between `0` and the given number will be returned.
|
Produces a random number between `min` and `max` *(inclusive)*. If only one argument is passed, a number between `0` and the given number will be returned.
|
||||||
|
|
||||||
@@ -2811,7 +2817,7 @@ _.random(5);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_resultobject-property"></a>`_.result(object, property)`
|
### <a id="_resultobject-property"></a>`_.result(object, property)`
|
||||||
<a href="#_resultobject-property">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3667 "View in source") [Ⓣ][1]
|
<a href="#_resultobject-property">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3632 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Resolves the value of `property` on `object`. If `property` is a function it will be invoked and its result returned, else the property value is returned. If `object` is falsey, then `null` is returned.
|
Resolves the value of `property` on `object`. If `property` is a function it will be invoked and its result returned, else the property value is returned. If `object` is falsey, then `null` is returned.
|
||||||
|
|
||||||
@@ -2846,14 +2852,14 @@ _.result(object, 'stuff');
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_templatetext-data-options"></a>`_.template(text, data, options)`
|
### <a id="_templatetext-data-options"></a>`_.template(text, data, options)`
|
||||||
<a href="#_templatetext-data-options">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3737 "View in source") [Ⓣ][1]
|
<a href="#_templatetext-data-options">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3713 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
A micro-templating method that handles arbitrary delimiters, preserves whitespace, and correctly escapes quotes within interpolated code. Note: In the development build `_.template` utilizes sourceURLs for easier debugging. See http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl Note: Lo-Dash may be used in Chrome extensions by either creating a `lodash csp` build and avoiding `_.template` use, or loading Lo-Dash in a sandboxed page. See http://developer.chrome.com/trunk/extensions/sandboxingEval.html
|
A micro-templating method that handles arbitrary delimiters, preserves whitespace, and correctly escapes quotes within interpolated code. Note: In the development build `_.template` utilizes sourceURLs for easier debugging. See http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl Note: Lo-Dash may be used in Chrome extensions by either creating a `lodash csp` build and avoiding `_.template` use, or loading Lo-Dash in a sandboxed page. See http://developer.chrome.com/trunk/extensions/sandboxingEval.html
|
||||||
|
|
||||||
#### Arguments
|
#### Arguments
|
||||||
1. `text` *(String)*: The template text.
|
1. `text` *(String)*: The template text.
|
||||||
2. `data` *(Obect)*: The data object used to populate the text.
|
2. `data` *(Obect)*: The data object used to populate the text.
|
||||||
3. `options` *(Object)*: The options object.
|
3. `options` *(Object)*: The options object. escape - The "escape" delimiter regexp. evaluate - The "evaluate" delimiter regexp. interpolate - The "interpolate" delimiter regexp. sourceURL - The sourceURL of the template's compiled source. variable - The data object variable name.
|
||||||
|
|
||||||
#### Returns
|
#### Returns
|
||||||
*(Function, String)*: Returns a compiled function when no `data` object is given, else it returns the interpolated text.
|
*(Function, String)*: Returns a compiled function when no `data` object is given, else it returns the interpolated text.
|
||||||
@@ -2861,9 +2867,9 @@ A micro-templating method that handles arbitrary delimiters, preserves whitespac
|
|||||||
#### Example
|
#### Example
|
||||||
```js
|
```js
|
||||||
// using a compiled template
|
// using a compiled template
|
||||||
var compiled = _.template('hello: <%= name %>');
|
var compiled = _.template('hello <%= name %>');
|
||||||
compiled({ 'name': 'moe' });
|
compiled({ 'name': 'moe' });
|
||||||
// => 'hello: moe'
|
// => 'hello moe'
|
||||||
|
|
||||||
var list = '<% _.forEach(people, function(name) { %><li><%= name %></li><% }); %>';
|
var list = '<% _.forEach(people, function(name) { %><li><%= name %></li><% }); %>';
|
||||||
_.template(list, { 'people': ['moe', 'larry', 'curly'] });
|
_.template(list, { 'people': ['moe', 'larry', 'curly'] });
|
||||||
@@ -2874,23 +2880,28 @@ _.template('<b><%- value %></b>', { 'value': '<script>' });
|
|||||||
// => '<b><script></b>'
|
// => '<b><script></b>'
|
||||||
|
|
||||||
// using the internal `print` function in "evaluate" delimiters
|
// using the internal `print` function in "evaluate" delimiters
|
||||||
_.template('<% print("Hello " + epithet); %>.', { 'epithet': 'stooge' });
|
_.template('<% print("hello " + epithet); %>!', { 'epithet': 'stooge' });
|
||||||
// => 'Hello stooge.'
|
// => 'hello stooge!'
|
||||||
|
|
||||||
// using custom template delimiter settings
|
// using custom template delimiters
|
||||||
_.templateSettings = {
|
_.templateSettings = {
|
||||||
'interpolate': /\{\{([\s\S]+?)\}\}/g
|
'interpolate': /\{\{([\s\S]+?)\}\}/g
|
||||||
};
|
};
|
||||||
|
|
||||||
_.template('Hello {{ name }}!', { 'name': 'Mustache' });
|
_.template('hello {{ name }}!', { 'name': 'mustache' });
|
||||||
// => 'Hello Mustache!'
|
// => 'hello mustache!'
|
||||||
|
|
||||||
|
// using the `sourceURL` option to specify a custom sourceURL for the template
|
||||||
|
var compiled = _.template('hello <%= name %>', null, { 'sourceURL': '/basic/greeting.jst' });
|
||||||
|
compiled(data);
|
||||||
|
// => find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector
|
||||||
|
|
||||||
// using the `variable` option to ensure a with-statement isn't used in the compiled template
|
// using the `variable` option to ensure a with-statement isn't used in the compiled template
|
||||||
var compiled = _.template('hello: <%= data.name %>', null, { 'variable': 'data' });
|
var compiled = _.template('hello <%= data.name %>!', null, { 'variable': 'data' });
|
||||||
compiled.source;
|
compiled.source;
|
||||||
// => function(data) {
|
// => function(data) {
|
||||||
var __t, __p = '', __e = _.escape;
|
var __t, __p = '', __e = _.escape;
|
||||||
__p += 'hello: ' + ((__t = ( data.name )) == null ? '' : __t);
|
__p += 'hello ' + ((__t = ( data.name )) == null ? '' : __t) + '!';
|
||||||
return __p;
|
return __p;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2911,7 +2922,7 @@ fs.writeFileSync(path.join(cwd, 'jst.js'), '\
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_timesn-callback--thisarg"></a>`_.times(n, callback [, thisArg])`
|
### <a id="_timesn-callback--thisarg"></a>`_.times(n, callback [, thisArg])`
|
||||||
<a href="#_timesn-callback--thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3856 "View in source") [Ⓣ][1]
|
<a href="#_timesn-callback--thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3832 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Executes the `callback` function `n` times, returning an array of the results of each `callback` execution. The `callback` is bound to `thisArg` and invoked with one argument; *(index)*.
|
Executes the `callback` function `n` times, returning an array of the results of each `callback` execution. The `callback` is bound to `thisArg` and invoked with one argument; *(index)*.
|
||||||
|
|
||||||
@@ -2943,9 +2954,9 @@ _.times(3, function(n) { this.cast(n); }, mage);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_unescapestring"></a>`_.unescape(string)`
|
### <a id="_unescapestring"></a>`_.unescape(string)`
|
||||||
<a href="#_unescapestring">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3881 "View in source") [Ⓣ][1]
|
<a href="#_unescapestring">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3858 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Converts the HTML entities `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding characters.
|
The opposite of `_.escape`, this method converts the HTML entities `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding characters.
|
||||||
|
|
||||||
#### Arguments
|
#### Arguments
|
||||||
1. `string` *(String)*: The string to unescape.
|
1. `string` *(String)*: The string to unescape.
|
||||||
@@ -2967,7 +2978,7 @@ _.unescape('Moe, Larry & Curly');
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_uniqueidprefix"></a>`_.uniqueId([prefix])`
|
### <a id="_uniqueidprefix"></a>`_.uniqueId([prefix])`
|
||||||
<a href="#_uniqueidprefix">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3899 "View in source") [Ⓣ][1]
|
<a href="#_uniqueidprefix">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3876 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Generates a unique id. If `prefix` is passed, the id will be appended to it.
|
Generates a unique id. If `prefix` is passed, the id will be appended to it.
|
||||||
|
|
||||||
@@ -2998,7 +3009,7 @@ _.uniqueId('contact_');
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_version"></a>`_.VERSION`
|
### <a id="_version"></a>`_.VERSION`
|
||||||
<a href="#_version">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4004 "View in source") [Ⓣ][1]
|
<a href="#_version">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3981 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
*(String)*: The semantic version number.
|
*(String)*: The semantic version number.
|
||||||
|
|
||||||
@@ -3010,7 +3021,7 @@ _.uniqueId('contact_');
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_templatesettings"></a>`_.templateSettings`
|
### <a id="_templatesettings"></a>`_.templateSettings`
|
||||||
<a href="#_templatesettings">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L264 "View in source") [Ⓣ][1]
|
<a href="#_templatesettings">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L252 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
*(Object)*: By default, the template delimiters used by Lo-Dash are similar to those in embedded Ruby *(ERB)*. Change the following template settings to use alternative delimiters.
|
*(Object)*: By default, the template delimiters used by Lo-Dash are similar to those in embedded Ruby *(ERB)*. Change the following template settings to use alternative delimiters.
|
||||||
|
|
||||||
@@ -3022,7 +3033,7 @@ _.uniqueId('contact_');
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_templatesettingsescape"></a>`_.templateSettings.escape`
|
### <a id="_templatesettingsescape"></a>`_.templateSettings.escape`
|
||||||
<a href="#_templatesettingsescape">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L273 "View in source") [Ⓣ][1]
|
<a href="#_templatesettingsescape">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L261 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
*(RegExp)*: Used to detect `data` property values to be HTML-escaped.
|
*(RegExp)*: Used to detect `data` property values to be HTML-escaped.
|
||||||
|
|
||||||
@@ -3034,7 +3045,7 @@ _.uniqueId('contact_');
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_templatesettingsevaluate"></a>`_.templateSettings.evaluate`
|
### <a id="_templatesettingsevaluate"></a>`_.templateSettings.evaluate`
|
||||||
<a href="#_templatesettingsevaluate">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L282 "View in source") [Ⓣ][1]
|
<a href="#_templatesettingsevaluate">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L270 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
*(RegExp)*: Used to detect code to be evaluated.
|
*(RegExp)*: Used to detect code to be evaluated.
|
||||||
|
|
||||||
@@ -3046,7 +3057,7 @@ _.uniqueId('contact_');
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_templatesettingsinterpolate"></a>`_.templateSettings.interpolate`
|
### <a id="_templatesettingsinterpolate"></a>`_.templateSettings.interpolate`
|
||||||
<a href="#_templatesettingsinterpolate">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L291 "View in source") [Ⓣ][1]
|
<a href="#_templatesettingsinterpolate">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L279 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
*(RegExp)*: Used to detect `data` property values to inject.
|
*(RegExp)*: Used to detect `data` property values to inject.
|
||||||
|
|
||||||
@@ -3058,7 +3069,7 @@ _.uniqueId('contact_');
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_templatesettingsvariable"></a>`_.templateSettings.variable`
|
### <a id="_templatesettingsvariable"></a>`_.templateSettings.variable`
|
||||||
<a href="#_templatesettingsvariable">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L300 "View in source") [Ⓣ][1]
|
<a href="#_templatesettingsvariable">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L288 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
*(String)*: Used to reference the data object in the template text.
|
*(String)*: Used to reference the data object in the template text.
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
// generate Markdown
|
// generate Markdown
|
||||||
$markdown = docdown(array(
|
$markdown = docdown(array(
|
||||||
'path' => '../' . $file,
|
'path' => '../' . $file,
|
||||||
'title' => 'Lo-Dash <sup>v0.8.2</sup>',
|
'title' => 'Lo-Dash <sup>v0.9.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'
|
||||||
));
|
));
|
||||||
|
|||||||
72
lodash.min.js
vendored
72
lodash.min.js
vendored
@@ -1,39 +1,39 @@
|
|||||||
/*!
|
/*!
|
||||||
Lo-Dash 0.8.2 lodash.com/license
|
Lo-Dash 0.9.0 lodash.com/license
|
||||||
Underscore.js 1.4.2 underscorejs.org/LICENSE
|
Underscore.js 1.4.2 underscorejs.org/LICENSE
|
||||||
*/
|
*/
|
||||||
;(function(e,t){function s(e){if(e&&e.__wrapped__)return e;if(!(this instanceof s))return new s(e);this.__wrapped__=e}function o(e,t,n){t||(t=0);var r=e.length,i=r-t>=(n||H),s=i?{}:e;if(i)for(n=t-1;++n<r;){var o=e[n]+"";(Z.call(s,o)?s[o]:s[o]=[]).push(e[n])}return function(e){if(i){var n=e+"";return Z.call(s,n)&&-1<T(s[n],e)}return-1<T(s,e,t)}}function u(e,n){var r=e.b,i=n.b,e=e.a,n=n.a;if(e!==n){if(e>n||e===t)return 1;if(e<n||n===t)return-1}return r<i?-1:1}function a(e,t,n){function r(){var u=arguments
|
;(function(e,t){function s(e){if(e&&e.__wrapped__)return e;if(!(this instanceof s))return new s(e);this.__wrapped__=e}function o(e,t,n){t||(t=0);var r=e.length,i=r-t>=(n||Q),s=i?{}:e;if(i)for(n=t-1;++n<r;){var o=e[n]+"";(dt.call(s,o)?s[o]:s[o]=[]).push(e[n])}return function(e){if(i){var n=e+"";return dt.call(s,n)&&-1<j(s[n],e)}return-1<j(s,e,t)}}function u(e,n){var r=e.b,i=n.b,e=e.a,n=n.a;if(e!==n){if(e>n||e===t)return 1;if(e<n||n===t)return-1}return r<i?-1:1}function a(e,t,n){function r(){var u=arguments
|
||||||
,a=s?this:t;return i||(e=t[o]),n.length&&(u=u.length?n.concat(nt.call(u)):n),this instanceof r?(p.prototype=e.prototype,a=new p,(u=e.apply(a,u))&&Ht[typeof u]?u:a):e.apply(a,u)}var i=m(e),s=!n,o=e;return s&&(n=t),r}function f(e,n){return e?"function"!=typeof e?function(t){return t[e]}:n!==t?function(t,r,i){return e.call(n,t,r,i)}:e:A}function l(){for(var e={e:"",g:Et,i:"",j:Mt,m:Tt,n:kt,o:J,p:"",q:n,r:_t,c:{d:""},l:{d:""}},t,i=-1;t=arguments[++i];)for(var s in t){var o=t[s];/d|h/.test(s)?("string"==typeof
|
,a=s?this:t;return i||(e=t[o]),n.length&&(u=u.length?n.concat(gt.call(u)):n),this instanceof r?(p.prototype=e.prototype,a=new p,(u=e.apply(a,u))&&Vt[typeof u]?u:a):e.apply(a,u)}var i=S(e),s=!n,o=e;return s&&(n=t),r}function f(e,n){return e?"function"!=typeof e?function(t){return t[e]}:n!==t?function(t,r,i){return e.call(n,t,r,i)}:e:U}function l(){for(var e={b:"",c:"",e:Pt,f:Wt,g:"",h:jt,i:qt,j:ft,k:"",l:n},t,r=0;t=arguments[r];r++)for(var i in t)e[i]=t[i];t=e.a,e.d=/^[^,]+/.exec(t)[0],r="var h,w,j="+
|
||||||
o&&(o={b:o,k:o}),e.c[s]=o.b,e.l[s]=o.k):e[s]=o}t=e.a;if("d"!=(e.f=/^[^,]+/.exec(t)[0])||!e.c.h)e.c=r;i="",e.r&&(i+="'use strict';"),i+="var i,A,j="+e.f+",t="+(e.i||e.f)+";if(!"+e.f+")return t;"+e.p+";",e.c&&(i+="var k=j.length;i=-1;",e.l&&(i+="if(k===+k){"),e.n&&(i+="if(y.call(j)==w){j=j.split('')}"),i+=e.c.d+";while(++i<k){A=j[i];"+e.c.h+"}",e.l&&(i+="}"));if(e.l){e.c?i+="else {":e.m&&(i+="var k=j.length;i=-1;if(k&&O(j)){while(++i<k){A=j[i+=''];"+e.l.h+"}}else {"),e.g||(i+="var u=typeof j=='function'&&q.call(j,'prototype');"
|
e.d+",r="+e.d+";if(!"+e.d+")return r;"+e.k+";",e.b?(r+="var k=j.length;h=-1;if(typeof k=='number'){",e.i&&(r+="if(v.call(j)==t){j=j.split('')}"),r+="while(++h<k){w=j[h];"+e.b+"}}else {"):e.h&&(r+="var k=j.length;h=-1;if(k&&i(j)){while(++h<k){w=j[h+=''];"+e.g+"}}else {"),e.e||(r+="var s=typeof j=='function'&&q.call(j,'prototype');");if(e.f&&e.l)r+="var o=-1,p=n[typeof j]?l(j):[],k=p.length;while(++o<k){h=p[o];",e.e||(r+="if(!(s&&h=='prototype')){"),r+="w=j[h];"+e.g+"",e.e||(r+="}");else{r+="for(h in j){"
|
||||||
);if(e.j&&e.q)i+="var n=-1,o=Y[typeof j]?l(j):[],k=o.length;"+e.l.d+";while(++n<k){i=o[n];",e.g||(i+="if(!(u&&i=='prototype')){"),i+="A=j[i];"+e.l.h+"",e.g||(i+="}");else{i+=e.l.d+";for(i in j){";if(!e.g||e.q)i+="if(",e.g||(i+="!(u&&i=='prototype')"),!e.g&&e.q&&(i+="&&"),e.q&&(i+="h.call(j,i)"),i+="){";i+="A=j[i];"+e.l.h+";";if(!e.g||e.q)i+="}"}i+="}";if(e.g){i+="var g=j.constructor;";for(s=0;7>s;s++)i+="i='"+e.o[s]+"';if(","constructor"==e.o[s]&&(i+="!(g&&g.prototype===j)&&"),i+="h.call(j,i)){A=j[i];"+
|
;if(!e.e||e.l)r+="if(",e.e||(r+="!(s&&h=='prototype')"),!e.e&&e.l&&(r+="&&"),e.l&&(r+="g.call(j,h)"),r+="){";r+="w=j[h];"+e.g+";";if(!e.e||e.l)r+="}"}r+="}";if(e.e){r+="var f=j.constructor;";for(i=0;7>i;i++)r+="h='"+e.j[i]+"';if(","constructor"==e.j[i]&&(r+="!(f&&f.prototype===j)&&"),r+="g.call(j,h)){w=j[h];"+e.g+"}"}if(e.b||e.h)r+="}";return r+=e.c+";return r",Function("e,g,i,n,l,q,t,v","return function("+t+"){"+r+"}")(f,dt,v,Vt,St,mt,Dt,yt)}function c(e){return"\\"+$t[e]}function h(e){return Zt
|
||||||
e.l.h+"}"}if(e.c||e.m)i+="}"}return i+=e.e+";return t",Function("D,E,F,I,e,f,J,h,M,O,Q,S,T,X,Y,l,q,v,w,y,z","var G=function("+t+"){"+i+"};return G")(Dt,_,L,u,Q,f,en,Z,T,v,$t,m,Jt,mt,Ht,ut,tt,nt,yt,rt)}function c(e){return"\\"+Bt[e]}function h(e){return Qt[e]}function p(){}function d(e){return Gt[e]}function v(e){return rt.call(e)==ct}function m(e){return"function"==typeof e}function g(e){var t=i;if(!e||"object"!=typeof e||v(e))return t;var n=e.constructor;return(!Lt||"function"==typeof e.toString||"string"!=typeof
|
[e]}function p(){}function d(e){return en[e]}function v(e){return yt.call(e)==Ct}function m(e){var t=i;if(!e||"object"!=typeof e||v(e))return t;var n=e.constructor;return(!Rt||"function"==typeof e.toString||"string"!=typeof (e+""))&&(!S(n)||n instanceof n)?Ht?(Gt(e,function(e,n,r){return t=!dt.call(r,n),i}),t===i):(Gt(e,function(e,n){t=n}),t===i||dt.call(e,t)):t}function g(e){var t=[];return Yt(e,function(e,n){t.push(n)}),t}function y(e,t,n,s,o){if(e==r)return e;n&&(t=i);if(n=Vt[typeof e]){var u=
|
||||||
(e+""))&&(!m(n)||n instanceof n)?xt?(en(e,function(e,n,r){return t=!Z.call(r,n),i}),t===i):(en(e,function(e,n){t=n}),t===i||Z.call(e,t)):t}function y(e,t,n,s,o){if(e==r)return e;n&&(t=i);if(n=Ht[typeof e]){var u=rt.call(e);if(!Pt[u]||Nt&&v(e))return e;var a=u==ht,n=a||(u==mt?Jt(e):n)}if(!n||!t)return n?a?nt.call(e):Zt({},e):e;n=e.constructor;switch(u){case pt:case dt:return new n(+e);case vt:case yt:return new n(e);case gt:return n(e.source,U.exec(e))}s||(s=[]),o||(o=[]);for(u=s.length;u--;)if(s[
|
yt.call(e);if(!Xt[u]||Ft&&v(e))return e;var a=u==kt,n=a||(u==Mt?sn(e):n)}if(!n||!t)return n?a?gt.call(e):nn({},e):e;n=e.constructor;switch(u){case Lt:case At:return new n(+e);case Ot:case Dt:return new n(e);case _t:return n(e.source,rt.exec(e))}s||(s=[]),o||(o=[]);for(u=s.length;u--;)if(s[u]==e)return o[u];var f=a?n(e.length):{};return s.push(e),o.push(f),(a?un:Yt)(e,function(e,n){f[n]=y(e,t,r,s,o)}),f}function b(e){var t=[];return Gt(e,function(e,n){S(e)&&t.push(n)}),t.sort()}function w(e){var t=
|
||||||
u]==e)return o[u];var f=a?n(e.length):{};return s.push(e),o.push(f),(a?mn:tn)(e,function(e,n){f[n]=y(e,t,r,s,o)}),f}function b(e,t,s,o){if(e==r||t==r)return e===t;if(e===t)return 0!==e||1/e==1/t;if(Ht[typeof e]||Ht[typeof t])e=e.__wrapped__||e,t=t.__wrapped__||t;var u=rt.call(e);if(u!=rt.call(t))return i;switch(u){case pt:case dt:return+e==+t;case vt:return e!=+e?t!=+t:0==e?1/e==1/t:e==+t;case gt:case yt:return e==t+""}var a=Dt[u];if(Nt&&!a&&(a=v(e))&&!v(t)||!a&&(u!=mt||Lt&&("function"!=typeof e.
|
{};return Yt(e,function(e,n){t[e]=n}),t}function E(e,t,s,o){if(e===t)return 0!==e||1/e==1/t;if(e==r||t==r)return e===t;var u=yt.call(e);if(u!=yt.call(t))return i;switch(u){case Lt:case At:return+e==+t;case Ot:return e!=+e?t!=+t:0==e?1/e==1/t:e==+t;case _t:case Dt:return e==t+""}var a=u==kt||u==Ct;if(Ft&&!a&&(a=v(e))&&!v(t))return i;if(!a){if(e.__wrapped__||t.__wrapped__)return E(e.__wrapped__||e,t.__wrapped__||t);if(u!=Mt||Rt&&("function"!=typeof e.toString&&"string"==typeof (e+"")||"function"!=typeof
|
||||||
toString&&"string"==typeof (e+"")||"function"!=typeof t.toString&&"string"==typeof (t+""))))return i;s||(s=[]),o||(o=[]);for(u=s.length;u--;)if(s[u]==e)return o[u]==t;var u=-1,f=n,l=0;s.push(e),o.push(t);if(a){l=e.length;if(f=l==t.length)for(;l--&&(f=b(e[l],t[l],s,o)););return f}a=e.constructor,f=t.constructor;if(a!=f&&(!m(a)||!(a instanceof a&&m(f)&&f instanceof f)))return i;for(var c in e)if(Z.call(e,c)&&(l++,!Z.call(t,c)||!b(e[c],t[c],s,o)))return i;for(c in t)if(Z.call(t,c)&&!(l--))return i;if(
|
t.toString&&"string"==typeof (t+"")))return i;var u=e.constructor,f=t.constructor;if(u!=f&&(!S(u)||!(u instanceof u&&S(f)&&f instanceof f)))return i}s||(s=[]),o||(o=[]);for(u=s.length;u--;)if(s[u]==e)return o[u]==t;var u=-1,f=n,l=0;s.push(e),o.push(t);if(a){l=e.length;if(f=l==t.length)for(;l--&&(f=E(e[l],t[l],s,o)););return f}for(var c in e)if(dt.call(e,c)&&(l++,!dt.call(t,c)||!E(e[c],t[c],s,o)))return i;for(c in t)if(dt.call(t,c)&&!(l--))return i;if(Pt)for(;7>++u;)if(c=ft[u],dt.call(e,c)&&(!dt.call
|
||||||
Et)for(;7>++u;)if(c=J[u],Z.call(e,c)&&(!Z.call(t,c)||!b(e[c],t[c],s,o)))return i;return n}function w(e,t,n){var r=-Infinity,i=-1,s=e?e.length:0,o=r;if(t||s!==+s)t=f(t,n),mn(e,function(e,n,i){n=t(e,n,i),n>r&&(r=n,o=e)});else for(;++i<s;)e[i]>o&&(o=e[i]);return o}function E(e,t,n,r){var s=e,o=e?e.length:0,u=3>arguments.length;if(o!==+o)var a=sn(e),o=a.length;else kt&&rt.call(e)==yt&&(s=e.split(""));return mn(e,function(e,f,l){f=a?a[--o]:--o,n=u?(u=i,s[f]):t.call(r,n,s[f],f,l)}),n}function S(e,t,n){
|
(t,c)||!E(e[c],t[c],s,o)))return i;return n}function S(e){return"function"==typeof e}function x(e,t,n){var i=arguments,s=0,o=2,u=i[3],a=i[4];n!==K&&(u=[],a=[],o=i.length);for(;++s<o;)Yt(i[s],function(t,n){var i,s,o;if(t&&((s=rn(t))||sn(t))){for(var f=u.length;f--;)if(i=u[f]==t)break;i?e[n]=a[f]:(u.push(t),a.push(o=(o=e[n],s)?rn(o)?o:[]:sn(o)?o:{}),e[n]=x(o,t,K,u,a))}else t!=r&&(e[n]=t)});return e}function T(e){var t=[];return Yt(e,function(e){t.push(e)}),t}function N(e,t){return"number"==typeof (
|
||||||
if(e)return t==r||n?e[0]:nt.call(e,0,t)}function x(e,t){for(var n=-1,r=e?e.length:0,i=[];++n<r;){var s=e[n];$t(s)?et.apply(i,t?s:x(s)):i.push(s)}return i}function T(e,t,n){var r=-1,i=e?e.length:0;if("number"==typeof n)r=(0>n?at(0,i+n):n||0)-1;else if(n)return r=C(e,t),e[r]===t?r:-1;for(;++r<i;)if(e[r]===t)return r;return-1}function N(e,t,n){return e?nt.call(e,t==r||n?1:t):[]}function C(e,t,n,r){var i=0,s=e?e.length:i;if(n){n=f(n,r);for(t=n(t);i<s;)r=i+s>>>1,n(e[r])<t?i=r+1:s=r}else for(;i<s;)r=i+
|
e?e.length:0)?-1<(yt.call(e)==Dt?e.indexOf(t):j(e,t)):P(e,function(e){return e===t})}function C(e,t,r){var i=n,t=f(t,r);return un(e,function(e,n,r){return i=t(e,n,r)}),!!i}function k(e,t,n){var r=[],t=f(t,n);return un(e,function(e,n,i){t(e,n,i)&&r.push(e)}),r}function L(e,t,r){var i,t=f(t,r);return P(e,function(e,r,s){return t(e,r,s)&&(i=e,n)}),i}function A(e,t,n){var r=-1,i=e?e.length:0,s=Array("number"==typeof i?i:0),t=f(t,n);if(rn(e))for(;++r<i;)s[r]=t(e[r],r,e);else un(e,function(e,n,i){s[++r
|
||||||
s>>>1,e[r]<t?i=r+1:s=r;return i}function k(e,t,n,r){var s=-1,o=e?e.length:0,u=[],a=[];"function"==typeof t&&(r=n,n=t,t=i);for(n=f(n,r);++s<o;)if(r=n(e[s],s,e),t?!s||a[a.length-1]!==r:0>T(a,r))a.push(r),u.push(e[s]);return u}function L(e,t){return Ot||it&&2<arguments.length?it.call.apply(it,arguments):a(e,t,nt.call(arguments,2))}function A(e){return e}function O(e){mn(nn(e),function(t){var r=s[t]=e[t];s.prototype[t]=function(){var e=[this.__wrapped__];return arguments.length&&et.apply(e,arguments)
|
]=t(e,n,i)});return s}function O(e,t,n){var r=-Infinity,i=-1,s=e?e.length:0,o=r;if(t||"number"!=typeof s)t=f(t,n),un(e,function(e,n,i){n=t(e,n,i),n>r&&(r=n,o=e)});else for(;++i<s;)e[i]>o&&(o=e[i]);return o}function M(e,t){var n=[];return un(e,function(e){n.push(e[t])}),n}function _(e,t,n,r){var s=3>arguments.length,t=f(t,r);return un(e,function(e,r,o){n=s?(s=i,e):t(n,e,r,o)}),n}function D(e,t,n,r){var s=e,o=e?e.length:0,u=3>arguments.length;if("number"!=typeof o)var a=on(e),o=a.length;else qt&&yt
|
||||||
,e=r.apply(s,e),this.__chain__&&(e=new s(e),e.__chain__=n),e}})}var n=!0,r=null,i=!1,M="object"==typeof exports&&exports&&("object"==typeof global&&global&&global==global.global&&(e=global),exports),_=Array.prototype,D=Object.prototype,P=0,H=30,B=e._,j=/[-?+=!~*%&^<>|{(\/]|\[\D|\b(?:delete|in|instanceof|new|typeof|void)\b/,F=/&(?:amp|lt|gt|quot|#x27);/g,I=/\b__p\+='';/g,q=/\b(__p\+=)''\+/g,R=/(__e\(.*?\)|\b__t\))\+'';/g,U=/\w*$/,z=/(?:__e|__t=)\(\s*(?![\d\s"']|this\.)/g,W=RegExp("^"+(D.valueOf+""
|
.call(e)==Dt&&(s=e.split(""));return un(e,function(e,f,l){f=a?a[--o]:--o,n=u?(u=i,s[f]):t.call(r,n,s[f],f,l)}),n}function P(e,t,n){var r,t=f(t,n);return un(e,function(e,n,i){return!(r=t(e,n,i))}),!!r}function H(e,t,n){if(e)return t==r||n?e[0]:gt.call(e,0,t)}function B(e,t){for(var n=-1,r=e?e.length:0,i=[];++n<r;){var s=e[n];rn(s)?vt.apply(i,t?s:B(s)):i.push(s)}return i}function j(e,t,n){var r=-1,i=e?e.length:0;if("number"==typeof n)r=(0>n?xt(0,i+n):n||0)-1;else if(n)return r=I(e,t),e[r]===t?r:-1;
|
||||||
).replace(/[.*+?^=!:${}()|[\]\/\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),X=/($^)/,V=/[&<>"']/g,$=/['\n\r\t\u2028\u2029\\]/g,J="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),K=Math.ceil,Q=_.concat,G=Math.floor,Y=W.test(Y=Object.getPrototypeOf)&&Y,Z=D.hasOwnProperty,et=_.push,tt=D.propertyIsEnumerable,nt=_.slice,rt=D.toString,it=W.test(it=nt.bind)&&it,st=W.test(st=Array.isArray)&&st,ot=e.isFinite,ut=W.test(ut=Object.keys)&&ut
|
for(;++r<i;)if(e[r]===t)return r;return-1}function F(e,t,n){return e?gt.call(e,t==r||n?1:t):[]}function I(e,t,n,r){for(var i=0,s=e?e.length:i,n=n?f(n,r):U,t=n(t);i<s;)r=i+s>>>1,n(e[r])<t?i=r+1:s=r;return i}function q(e,t,n,r){var s=-1,o=e?e.length:0,u=[],a=[];"function"==typeof t&&(r=n,n=t,t=i);for(n=f(n,r);++s<o;)if(r=n(e[s],s,e),t?!s||a[a.length-1]!==r:0>j(a,r))a.push(r),u.push(e[s]);return u}function R(e,t){return zt||bt&&2<arguments.length?bt.call.apply(bt,arguments):a(e,t,gt.call(arguments,2
|
||||||
,at=Math.max,ft=Math.min,lt=Math.random,ct="[object Arguments]",ht="[object Array]",pt="[object Boolean]",dt="[object Date]",vt="[object Number]",mt="[object Object]",gt="[object RegExp]",yt="[object String]",bt=e.clearTimeout,wt=e.setTimeout,Et,St,xt,Tt=n;(function(){function e(){this.x=1}var t={0:1,length:1},n=[];e.prototype={valueOf:1,y:1};for(var r in new e)n.push(r);for(r in arguments)Tt=!r;Et=4>(n+"").length,xt="x"!=n[0],St=(n.splice.call(t,0,1),t[0])})(1);var Nt=!v(arguments),Ct="x"!=nt.call("x"
|
))}function U(e){return e}function z(e){un(b(e),function(t){var r=s[t]=e[t];s.prototype[t]=function(){var e=[this.__wrapped__];return vt.apply(e,arguments),e=r.apply(s,e),this.__chain__&&(e=new s(e),e.__chain__=n),e}})}var n=!0,r=null,i=!1,W="object"==typeof exports&&exports,X="object"==typeof global&&global;X.global===X&&(e=X);var V=[],$={},J=0,K={},Q=30,G=e._,Y=/[-?+=!~*%&^<>|{(\/]|\[\D|\b(?:delete|in|instanceof|new|typeof|void)\b/,Z=/&(?:amp|lt|gt|quot|#x27);/g,et=/\b__p\+='';/g,tt=/\b(__p\+=)''\+/g
|
||||||
)[0],kt="xx"!="x"[0]+Object("x")[0];try{var Lt=("[object Object]",rt.call(e.document||0)==mt)}catch(At){}var Ot=it&&/\n|Opera/.test(it+rt.call(e.opera)),Mt=ut&&/^.+$|true/.test(ut+!!e.attachEvent),_t=!Ot,Dt={};Dt[pt]=Dt[dt]=Dt["[object Function]"]=Dt[vt]=Dt[mt]=Dt[gt]=i,Dt[ct]=Dt[ht]=Dt[yt]=n;var Pt={};Pt[ct]=Pt["[object Function]"]=i,Pt[ht]=Pt[pt]=Pt[dt]=Pt[vt]=Pt[mt]=Pt[gt]=Pt[yt]=n;var Ht={"boolean":i,"function":n,object:n,number:i,string:i,"undefined":i,unknown:n},Bt={"\\":"\\","'":"'","\n":"n"
|
,nt=/(__e\(.*?\)|\b__t\))\+'';/g,rt=/\w*$/,it=/(?:__e|__t=)\(\s*(?![\d\s"']|this\.)/g,st=RegExp("^"+($.valueOf+"").replace(/[.*+?^=!:${}()|[\]\/\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),ot=/($^)/,ut=/[&<>"']/g,at=/['\n\r\t\u2028\u2029\\]/g,ft="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),lt=Math.ceil,ct=V.concat,ht=Math.floor,pt=st.test(pt=Object.getPrototypeOf)&&pt,dt=$.hasOwnProperty,vt=V.push,mt=$.propertyIsEnumerable,gt=
|
||||||
,"\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"};s.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""};var jt={a:"d,c,x",p:"c=f(c,x)",h:"if(c(A,i,d)===false)return t"},Ft={i:"{}",p:"c=f(c,x)",h:"var p=c(A,i,d);(h.call(t,p)?t[p]++:t[p]=1)"},It={i:"true",h:"if(!c(A,i,d))return!t"},qt={q:i,r:i,a:"m",p:"for(var a=1,b=arguments.length;a<b;a++){if(j=arguments[a]){",h:"t[i]=A",e:"}}"},Rt={i:"[]",h:"c(A,i,d)&&t.push(A)"},Ut={p:"c=f(c,x)"}
|
V.slice,yt=$.toString,bt=st.test(bt=gt.bind)&&bt,wt=st.test(wt=Array.isArray)&&wt,Et=e.isFinite,St=st.test(St=Object.keys)&&St,xt=Math.max,Tt=Math.min,Nt=Math.random,Ct="[object Arguments]",kt="[object Array]",Lt="[object Boolean]",At="[object Date]",Ot="[object Number]",Mt="[object Object]",_t="[object RegExp]",Dt="[object String]",Pt,Ht,Bt=(Bt={0:1,length:1},V.splice.call(Bt,0,1),Bt[0]),jt=n;(function(){function e(){this.x=1}var t=[];e.prototype={valueOf:1,y:1};for(var n in new e)t.push(n);for(
|
||||||
,zt={h:{k:jt.h}},Wt={i:"d||[]",d:{b:"t=Array(k)",k:"t="+(Mt?"Array(k)":"[]")},h:{b:"t[i]=c(A,i,d)",k:"t"+(Mt?"[n]=":".push")+"(c(A,i,d))"}},Xt={q:i,a:"m,c,x",i:"{}",p:"var R=typeof c=='function';if(R)c=f(c,x);else var s=e.apply(E,arguments)",h:"if(R?!c(A,i,m):M(s,i)<0)t[i]=A"},Vt=l({a:"m",i:"{}",h:"t[A]=i"});Nt&&(v=function(e){return e?Z.call(e,"callee"):i});var $t=st||function(e){return rt.call(e)==ht};m(/x/)&&(m=function(e){return"[object Function]"==rt.call(e)});var Jt=Y?function(e){if(!e||"object"!=typeof
|
n in arguments)jt=!n;Pt=!/valueOf/.test(t),Ht="x"!=t[0]})(1);var Ft=!v(arguments),It="x"!=gt.call("x")[0],qt="xx"!="x"[0]+Object("x")[0];try{var Rt=("[object Object]",yt.call(e.document||0)==Mt)}catch(Ut){}var zt=bt&&/\n|Opera/.test(bt+yt.call(e.opera)),Wt=St&&/^.+$|true/.test(St+!!e.attachEvent),Xt={};Xt[Ct]=Xt["[object Function]"]=i,Xt[kt]=Xt[Lt]=Xt[At]=Xt[Ot]=Xt[Mt]=Xt[_t]=Xt[Dt]=n;var Vt={"boolean":i,"function":n,object:n,number:i,string:i,"undefined":i},$t={"\\":"\\","'":"'","\n":"n","\r":"r"
|
||||||
e)return i;var t=e.valueOf,n="function"==typeof t&&(n=Y(t))&&Y(n);return n?e==n||Y(e)==n&&!v(e):g(e)}:g,Kt=l({a:"m",i:"[]",h:"t.push(i)"}),Qt={"&":"&","<":"<",">":">",'"':""","'":"'"},Gt=Vt(Qt),Yt=l(qt,{h:"if(t[i]==null)"+qt.h}),Zt=l(qt),en=l(jt,Ut,zt,{q:i}),tn=l(jt,Ut,zt),nn=l({q:i,a:"m",i:"[]",h:"S(A)&&t.push(i)",e:"t.sort()"}),rn=l({a:"A",i:"true",p:"var H=y.call(A),k=A.length;if(D[H]"+(Nt?"||O(A)":"")+"||(H==X&&k===+k&&S(A.splice)))return!k",h:{k:"return false"}}),sn=ut?function(
|
," ":"t","\u2028":"u2028","\u2029":"u2029"};s.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""};var Jt={a:"d,c,u",k:"c=e(c,u)",b:"if(c(w,h,d)===false)return r",g:"if(c(w,h,d)===false)return r"},Kt={l:i,a:"m",k:"for(var a=1,b=arguments.length;a<b;a++){if(j=arguments[a]){",g:"r[h]=w",c:"}}"},Qt={b:r};Ft&&(v=function(e){return e?dt.call(e,"callee"):i});var Gt=l(Jt,Qt,{l:i}),Yt=l(Jt,Qt),Zt={"&":"&","<":"<",">":">",'"':"""
|
||||||
e){var t=typeof e;return"function"==t&&tt.call(e,"prototype")?Kt(e):e&&Ht[t]?ut(e):[]}:Kt,on=l(qt,{a:"m,dd,N",p:"var P,C=arguments,a=0;if(N==I){var b=2,ee=C[3],ff=C[4]}else var b=C.length,ee=[],ff=[];while(++a<b){if(j=C[a]){",h:"if((dd=A)&&((P=Q(dd))||T(dd))){var K=false,gg=ee.length;while(gg--)if(K=ee[gg]==dd)break;if(K){t[i]=ff[gg]}else {ee.push(dd);ff.push(A=(A=t[i],P)?(Q(A)?A:[]):(T(A)?A:{}));t[i]=G(A,dd,I,ee,ff)}}else if(dd!=null)t[i]=dd"}),un=l(Xt),an=l({a:"m",i:"[]",h:"t"+(Mt?"[n]=":".push"
|
,"'":"'"},en=w(Zt),tn=l(Kt,{g:"if(r[h]==null)"+Kt.g}),nn=l(Kt),rn=wt||function(e){return yt.call(e)==kt};S(/x/)&&(S=function(e){return"[object Function]"==yt.call(e)});var sn=pt?function(e){if(!e||"object"!=typeof e)return i;var t=e.valueOf,n="function"==typeof t&&(n=pt(t))&&pt(n);return n?e==n||pt(e)==n&&!v(e):m(e)}:m,on=St?function(e){var t=typeof e;return"function"==t&&mt.call(e,"prototype")?g(e):e&&Vt[t]?St(e):[]}:g,un=l(Jt);s.VERSION="0.9.0",s.after=function(e,t){return 1>e?t():function(
|
||||||
)+"([i,A])"}),fn=l(Xt,{p:"if(typeof c!='function'){var i=0,s=e.apply(E,arguments),k=s.length;while(++i<k){var p=s[i];if(p in m)t[p]=m[p]}}else {c=f(c,x)",h:"if(c(A,i,m))t[i]=A",e:"}"}),ln=l({a:"m",i:"[]",h:"t.push(A)"}),cn=l({a:"d,hh",i:"false",n:i,d:{b:"if(y.call(d)==w)return d.indexOf(hh)>-1"},h:"if(A===hh)return true"}),hn=l(jt,Ft),pn=l(jt,It),dn=l(jt,Rt),vn=l(jt,Ut,{i:"z",h:"if(c(A,i,d))return A"}),mn=l(jt,Ut),gn=l(jt,Ft,{h:"var p=c(A,i,d);(h.call(t,p)?t[p]:t[p]=[]).push(A)"}),yn=l(Wt,{a:"d,U"
|
){if(1>--e)return t.apply(this,arguments)}},s.bind=R,s.bindAll=function(e){for(var t=arguments,n=1<t.length?0:(t=b(e),-1),r=t.length;++n<r;){var i=t[n];e[i]=R(e[i],e)}return e},s.chain=function(e){return e=new s(e),e.__chain__=n,e},s.clone=y,s.compact=function(e){for(var t=-1,n=e?e.length:0,r=[];++t<n;){var i=e[t];i&&r.push(i)}return r},s.compose=function(){var e=arguments;return function(){for(var t=arguments,n=e.length;n--;)t=[e[n].apply(this,t)];return t[0]}},s.contains=N,s.countBy=function(e,
|
||||||
,p:"var C=v.call(arguments,2),R=typeof U=='function'",h:{b:"t[i]=(R?U:A[U]).apply(A,C)",k:"t"+(Mt?"[n]=":".push")+"((R?U:A[U]).apply(A,C))"}}),bn=l(jt,Wt),wn=l(Wt,{a:"d,bb",h:{b:"t[i]=A[bb]",k:"t"+(Mt?"[n]=":".push")+"(A[bb])"}}),En=l({a:"d,c,B,x",i:"B",p:"var V=arguments.length<3;c=f(c,x)",d:{b:"if(V)t=j[++i]"},h:{b:"t=c(t,A,i,d)",k:"t=V?(V=false,A):c(t,A,i,d)"}}),Sn=l(jt,Rt,{h:"!"+Rt.h}),xn=l(jt,It,{i:"false",h:It.h.replace("!","")}),Tn=l(jt,Ft,Wt,{h:{b:"t[i]={a:c(A,i,d),b:i,c:A}",k:"t"+(Mt?"[n]="
|
t,n){var r={},t=f(t,n);return un(e,function(e,n,i){n=t(e,n,i),dt.call(r,n)?r[n]++:r[n]=1}),r},s.debounce=function(e,t,n){function i(){a=r,n||(o=e.apply(u,s))}var s,o,u,a;return function(){var r=n&&!a;return s=arguments,u=this,clearTimeout(a),a=setTimeout(i,t),r&&(o=e.apply(u,s)),o}},s.defaults=tn,s.defer=function(e){var n=gt.call(arguments,1);return setTimeout(function(){e.apply(t,n)},1)},s.delay=function(e,n){var r=gt.call(arguments,2);return setTimeout(function(){e.apply(t,r)},n)},s.difference=
|
||||||
:".push")+"({a:c(A,i,d),b:i,c:A})"},e:"t.sort(I);k=t.length;while(k--)t[k]=t[k].c"}),Nn=l(Rt,{a:"d,aa",p:"var s=[];J(aa,function(A,p){s.push(p)});var cc=s.length",h:"for(var Z=true,r=0;r<cc;r++){var p=s[r];if(!(Z=A[p]===aa[p]))break}Z&&t.push(A)"}),Cn=l({q:i,r:i,a:"m",p:"var L=arguments,i=0,k=L.length;if(k>1){while(++i<k)t[L[i]]=F(t[L[i]],t);return t}",h:"if(S(A))t[i]=F(A,t)"});s.VERSION="0.8.2",s.after=function(e,t){return 1>e?t():function(){if(1>--e)return t.apply(this,arguments)}},s.bind=L,s.bindAll=
|
function(e){for(var t=-1,n=e?e.length:0,r=ct.apply(V,arguments),r=o(r,n),i=[];++t<n;){var s=e[t];r(s)||i.push(s)}return i},s.escape=function(e){return e==r?"":(e+"").replace(ut,h)},s.every=C,s.extend=nn,s.filter=k,s.find=L,s.first=H,s.flatten=B,s.forEach=un,s.forIn=Gt,s.forOwn=Yt,s.functions=b,s.groupBy=function(e,t,n){var r={},t=f(t,n);return un(e,function(e,n,i){n=t(e,n,i),(dt.call(r,n)?r[n]:r[n]=[]).push(e)}),r},s.has=function(e,t){return e?dt.call(e,t):i},s.identity=U,s.indexOf=j,s.initial=function(
|
||||||
Cn,s.chain=function(e){return e=new s(e),e.__chain__=n,e},s.clone=y,s.compact=function(e){for(var t=-1,n=e?e.length:0,r=[];++t<n;){var i=e[t];i&&r.push(i)}return r},s.compose=function(){var e=arguments;return function(){for(var t=arguments,n=e.length;n--;)t=[e[n].apply(this,t)];return t[0]}},s.contains=cn,s.countBy=hn,s.debounce=function(e,t,n){function i(){a=r,n||(o=e.apply(u,s))}var s,o,u,a;return function(){var r=n&&!a;return s=arguments,u=this,bt(a),a=wt(i,t),r&&(o=e.apply(u,s)),o}},s.defaults=
|
e,t,n){return e?gt.call(e,0,-(t==r||n?1:t)):[]},s.intersection=function(e){var t=arguments,n=t.length,r={},i=[];return un(e,function(e){if(0>j(i,e)){for(var s=n;--s;)if(!(r[s]||(r[s]=o(t[s])))(e))return;i.push(e)}}),i},s.invert=w,s.invoke=function(e,t){var n=gt.call(arguments,2),r="function"==typeof t,i=[];return un(e,function(e){i.push((r?t:e[t]).apply(e,n))}),i},s.isArguments=v,s.isArray=rn,s.isBoolean=function(e){return e===n||e===i||yt.call(e)==Lt},s.isDate=function(e){return yt.call(e)==At},
|
||||||
Yt,s.defer=function(e){var n=nt.call(arguments,1);return wt(function(){return e.apply(t,n)},1)},s.delay=function(e,n){var r=nt.call(arguments,2);return wt(function(){return e.apply(t,r)},n)},s.difference=function(e){var t=[];if(!e)return t;for(var n=-1,r=e.length,i=Q.apply(_,arguments),i=o(i,r);++n<r;){var s=e[n];i(s)||t.push(s)}return t},s.escape=function(e){return e==r?"":(e+"").replace(V,h)},s.every=pn,s.extend=Zt,s.filter=dn,s.find=vn,s.first=S,s.flatten=x,s.forEach=mn,s.forIn=en,s.forOwn=tn,
|
s.isElement=function(e){return e?1===e.nodeType:i},s.isEmpty=function(e){var t=n;if(!e)return t;var r=yt.call(e),s=e.length;return r==kt||r==Dt||r==Ct||Ft&&v(e)||r==Mt&&"number"==typeof s&&S(e.splice)?!s:(Yt(e,function(){return t=i}),t)},s.isEqual=E,s.isFinite=function(e){return Et(e?+e:parseFloat(e))},s.isFunction=S,s.isNaN=function(e){return yt.call(e)==Ot&&e!=+e},s.isNull=function(e){return e===r},s.isNumber=function(e){return yt.call(e)==Ot},s.isObject=function(e){return e?Vt[typeof e]:i},s.isPlainObject=
|
||||||
s.functions=nn,s.groupBy=gn,s.has=function(e,t){return e?Z.call(e,t):i},s.identity=A,s.indexOf=T,s.initial=function(e,t,n){return e?nt.call(e,0,-(t==r||n?1:t)):[]},s.intersection=function(e){var t=arguments.length,n=[],r=-1,i=e?e.length:0,s=[];e:for(;++r<i;){var u=e[r];if(0>T(s,u)){for(var a=1;a<t;a++)if(!(n[a]||(n[a]=o(arguments[a])))(u))continue e;s.push(u)}}return s},s.invert=Vt,s.invoke=yn,s.isArguments=v,s.isArray=$t,s.isBoolean=function(e){return e===n||e===i||rt.call(e)==pt},s.isDate=function(
|
sn,s.isRegExp=function(e){return yt.call(e)==_t},s.isString=function(e){return yt.call(e)==Dt},s.isUndefined=function(e){return e===t},s.keys=on,s.last=function(e,t,n){if(e){var i=e.length;return t==r||n?e[i-1]:gt.call(e,-t||i)}},s.lastIndexOf=function(e,t,n){var r=e?e.length:0;for("number"==typeof n&&(r=(0>n?xt(0,r+n):Tt(n,r-1))+1);r--;)if(e[r]===t)return r;return-1},s.lateBind=function(e,t){return a(t,e,gt.call(arguments,2))},s.map=A,s.max=O,s.memoize=function(e,t){var n={};return function(){var r=
|
||||||
e){return rt.call(e)==dt},s.isElement=function(e){return e?1===e.nodeType:i},s.isEmpty=rn,s.isEqual=b,s.isFinite=function(e){return ot(e)&&rt.call(e)==vt},s.isFunction=m,s.isNaN=function(e){return rt.call(e)==vt&&e!=+e},s.isNull=function(e){return e===r},s.isNumber=function(e){return rt.call(e)==vt},s.isObject=function(e){return e?Ht[typeof e]:i},s.isPlainObject=Jt,s.isRegExp=function(e){return rt.call(e)==gt},s.isString=function(e){return rt.call(e)==yt},s.isUndefined=function(e){return e===t},s
|
t?t.apply(this,arguments):arguments[0];return dt.call(n,r)?n[r]:n[r]=e.apply(this,arguments)}},s.merge=x,s.min=function(e,t,n){var r=Infinity,i=-1,s=e?e.length:0,o=r;if(t||"number"!=typeof s)t=f(t,n),un(e,function(e,n,i){n=t(e,n,i),n<r&&(r=n,o=e)});else for(;++i<s;)e[i]<o&&(o=e[i]);return o},s.mixin=z,s.noConflict=function(){return e._=G,this},s.object=function(e,t){for(var n=-1,r=e?e.length:0,i={};++n<r;){var s=e[n];t?i[s]=t[n]:i[s[0]]=s[1]}return i},s.omit=function(e,t,n){var r="function"==typeof
|
||||||
.keys=sn,s.last=function(e,t,n){if(e){var i=e.length;return t==r||n?e[i-1]:nt.call(e,-t||i)}},s.lastIndexOf=function(e,t,n){var r=e?e.length:0;for("number"==typeof n&&(r=(0>n?at(0,r+n):ft(n,r-1))+1);r--;)if(e[r]===t)return r;return-1},s.lateBind=function(e,t){return a(t,e,nt.call(arguments,2))},s.map=bn,s.max=w,s.memoize=function(e,t){var n={};return function(){var r=t?t.apply(this,arguments):arguments[0];return Z.call(n,r)?n[r]:n[r]=e.apply(this,arguments)}},s.merge=on,s.min=function(e,t,n){var r=
|
t,i={};if(r)t=f(t,n);else var s=ct.apply(V,arguments);return Gt(e,function(e,n,o){if(r?!t(e,n,o):0>j(s,n,1))i[n]=e}),i},s.once=function(e){var t,s=i;return function(){return s?t:(s=n,t=e.apply(this,arguments),e=r,t)}},s.pairs=function(e){var t=[];return Yt(e,function(e,n){t.push([n,e])}),t},s.partial=function(e){return a(e,gt.call(arguments,1))},s.pick=function(e,t,n){var r={};if("function"!=typeof t)for(var i=0,s=ct.apply(V,arguments),o=s.length;++i<o;){var u=s[i];u in e&&(r[u]=e[u])}else t=f(t,
|
||||||
Infinity,i=-1,s=e?e.length:0,o=r;if(t||s!==+s)t=f(t,n),mn(e,function(e,n,i){n=t(e,n,i),n<r&&(r=n,o=e)});else for(;++i<s;)e[i]<o&&(o=e[i]);return o},s.mixin=O,s.noConflict=function(){return e._=B,this},s.object=function(e,t){for(var n=-1,r=e?e.length:0,i={};++n<r;){var s=e[n];t?i[s]=t[n]:i[s[0]]=s[1]}return i},s.omit=un,s.once=function(e){var t,s=i;return function(){return s?t:(s=n,t=e.apply(this,arguments),e=r,t)}},s.pairs=an,s.partial=function(e){return a(e,nt.call(arguments,1))},s.pick=fn,s.pluck=
|
n),Gt(e,function(e,n,i){t(e,n,i)&&(r[n]=e)});return r},s.pluck=M,s.random=function(e,t){return e==r&&t==r&&(t=1),e=+e||0,t==r&&(t=e,e=0),e+ht(Nt()*((+t||0)-e+1))},s.range=function(e,t,n){e=+e||0,n=+n||1,t==r&&(t=e,e=0);for(var i=-1,t=xt(0,lt((t-e)/n)),s=Array(t);++i<t;)s[i]=e,e+=n;return s},s.reduce=_,s.reduceRight=D,s.reject=function(e,t,n){return t=f(t,n),k(e,function(e,n,r){return!t(e,n,r)})},s.rest=F,s.result=function(e,t){var n=e?e[t]:r;return S(n)?e[t]():n},s.shuffle=function(e){var t=-1,n=
|
||||||
wn,s.random=function(e,t){return e==r&&t==r&&(t=1),e=+e||0,t==r&&(t=e,e=0),e+G(lt()*((+t||0)-e+1))},s.range=function(e,t,n){e=+e||0,n=+n||1,t==r&&(t=e,e=0);for(var i=-1,t=at(0,K((t-e)/n)),s=Array(t);++i<t;)s[i]=e,e+=n;return s},s.reduce=En,s.reduceRight=E,s.reject=Sn,s.rest=N,s.result=function(e,t){var n=e?e[t]:r;return m(n)?e[t]():n},s.shuffle=function(e){var t=-1,n=Array(e?e.length:0);return mn(e,function(e){var r=G(lt()*(++t+1));n[t]=n[r],n[r]=e}),n},s.size=function(e){var t=e?e.length:0;return t===+
|
Array(e?e.length:0);return un(e,function(e){var r=ht(Nt()*(++t+1));n[t]=n[r],n[r]=e}),n},s.size=function(e){var t=e?e.length:0;return"number"==typeof t?t:on(e).length},s.some=P,s.sortBy=function(e,t,n){var r=[],t=f(t,n);un(e,function(e,n,i){r.push({a:t(e,n,i),b:n,c:e})}),e=r.length;for(r.sort(u);e--;)r[e]=r[e].c;return r},s.sortedIndex=I,s.tap=function(e,t){return t(e),e},s.template=function(e,t,n){e||(e=""),n||(n={});var r,i,o=0,u=s.templateSettings,a="__p += '",f=n.variable||u.variable,l=f;e.replace
|
||||||
t?t:sn(e).length},s.some=xn,s.sortBy=Tn,s.sortedIndex=C,s.tap=function(e,t){return t(e),e},s.template=function(e,t,n){e||(e=""),n||(n={});var r,i,o=0,u=s.templateSettings,a="__p += '",f=n.variable||u.variable,l=f;e.replace(RegExp((n.escape||u.escape||X).source+"|"+(n.interpolate||u.interpolate||X).source+"|"+(n.evaluate||u.evaluate||X).source+"|$","g"),function(t,n,i,s,u){a+=e.slice(o,u).replace($,c),a+=n?"'+__e("+n+")+'":s?"';"+s+";__p+='":i?"'+((__t=("+i+"))==null?'':__t)+'":"",r||(r=s||j.test(
|
(RegExp((n.escape||u.escape||ot).source+"|"+(n.interpolate||u.interpolate||ot).source+"|"+(n.evaluate||u.evaluate||ot).source+"|$","g"),function(t,n,i,s,u){a+=e.slice(o,u).replace(at,c),a+=n?"'+__e("+n+")+'":s?"';"+s+";__p+='":i?"'+((__t=("+i+"))==null?'':__t)+'":"",r||(r=s||Y.test(n||i)),o=u+t.length}),a+="';",l||(f="obj",r?a="with("+f+"){"+a+"}":(n=RegExp("(\\(\\s*)"+f+"\\."+f+"\\b","g"),a=a.replace(it,"$&"+f+".").replace(n,"$1__d"))),a=(r?a.replace(et,""):a).replace(tt,"$1").replace(nt,"$1;"),
|
||||||
n||i)),o=u+t.length}),a+="';",l||(f="obj",r?a="with("+f+"){"+a+"}":(n=RegExp("(\\(\\s*)"+f+"\\."+f+"\\b","g"),a=a.replace(z,"$&"+f+".").replace(n,"$1__d"))),a=(r?a.replace(I,""):a).replace(q,"$1").replace(R,"$1;"),a="function("+f+"){"+(l?"":f+"||("+f+"={});")+"var __t,__p='',__e=_.escape"+(r?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":(l?"":",__d="+f+"."+f+"||"+f)+";")+a+"return __p}";try{i=Function("_","return "+a)(s)}catch(h){throw h.source=a,h}return t?i(t):(i.source=
|
a="function("+f+"){"+(l?"":f+"||("+f+"={});")+"var __t,__p='',__e=_.escape"+(r?",__j=[].join;function print(){__p+=__j.call(arguments,'')}":(l?"":",__d="+f+"."+f+"||"+f)+";")+a+"return __p}";try{i=Function("_","return "+a)(s)}catch(h){throw h.source=a,h}return t?i(t):(i.source=a,i)},s.throttle=function(e,t){function n(){a=new Date,u=r,s=e.apply(o,i)}var i,s,o,u,a=0;return function(){var r=new Date,f=t-(r-a);return i=arguments,o=this,0>=f?(clearTimeout(u),a=r,s=e.apply(o,i)):u||(u=setTimeout
|
||||||
a,i)},s.throttle=function(e,t){function n(){a=new Date,u=r,s=e.apply(o,i)}var i,s,o,u,a=0;return function(){var r=new Date,f=t-(r-a);return i=arguments,o=this,0>=f?(bt(u),a=r,s=e.apply(o,i)):u||(u=wt(n,f)),s}},s.times=function(e,t,n){for(var e=+e||0,r=-1,i=Array(e);++r<e;)i[r]=t.call(n,r);return i},s.toArray=function(e){if(!e)return[];var t=e.length;return t===+t?(Ct?rt.call(e)==yt:"string"==typeof e)?e.split(""):nt.call(e):ln(e)},s.unescape=function(e){return e==r?"":(e+"").replace(F,d)},s.union=
|
(n,f)),s}},s.times=function(e,t,n){for(var e=+e||0,r=-1,i=Array(e);++r<e;)i[r]=t.call(n,r);return i},s.toArray=function(e){return e&&"number"==typeof e.length?(It?yt.call(e)==Dt:"string"==typeof e)?e.split(""):gt.call(e):T(e)},s.unescape=function(e){return e==r?"":(e+"").replace(Z,d)},s.union=function(){for(var e=-1,t=ct.apply(V,arguments),n=t.length,r=[];++e<n;){var i=t[e];0>j(r,i)&&r.push(i)}return r},s.uniq=q,s.uniqueId=function(e){var t=J++;return e?e+t:t},s.values=T,s.where=function(e,t){var n=
|
||||||
function(){for(var e=-1,t=Q.apply(_,arguments),n=t.length,r=[];++e<n;){var i=t[e];0>T(r,i)&&r.push(i)}return r},s.uniq=k,s.uniqueId=function(e){var t=P++;return e?e+t:t},s.values=ln,s.where=Nn,s.without=function(e){for(var t=-1,n=e?e.length:0,r=o(arguments,1,20),i=[];++t<n;){var s=e[t];r(s)||i.push(s)}return i},s.wrap=function(e,t){return function(){var n=[e];return arguments.length&&et.apply(n,arguments),t.apply(this,n)}},s.zip=function(e){for(var t=-1,n=e?w(wn(arguments,"length")):0,r=Array(n);++
|
[];return Gt(t,function(e,t){n.push(t)}),k(e,function(e){for(var r=n.length;r--;){var i=e[n[r]]===t[n[r]];if(!i)break}return!!i})},s.without=function(e){for(var t=-1,n=e?e.length:0,r=o(arguments,1,20),i=[];++t<n;){var s=e[t];r(s)||i.push(s)}return i},s.wrap=function(e,t){return function(){var n=[e];return vt.apply(n,arguments),t.apply(this,n)}},s.zip=function(e){for(var t=-1,n=e?O(M(arguments,"length")):0,r=Array(n);++t<n;)r[t]=M(arguments,t);return r},s.all=C,s.any=P,s.collect=A,s.detect=L,s.drop=
|
||||||
t<n;)r[t]=wn(arguments,t);return r},s.all=pn,s.any=xn,s.collect=bn,s.detect=vn,s.drop=N,s.each=mn,s.foldl=En,s.foldr=E,s.head=S,s.include=cn,s.inject=En,s.methods=nn,s.select=dn,s.tail=N,s.take=S,s.unique=k,O(s),s.prototype.chain=function(){return this.__chain__=n,this},s.prototype.value=function(){return this.__wrapped__},mn("pop push reverse shift sort splice unshift".split(" "),function(e){var t=_[e];s.prototype[e]=function(){var e=this.__wrapped__;return t.apply(e,arguments),St&&e.length===0&&delete
|
F,s.each=un,s.foldl=_,s.foldr=D,s.head=H,s.include=N,s.inject=_,s.methods=b,s.select=k,s.tail=F,s.take=H,s.unique=q,z(s),s.prototype.chain=function(){return this.__chain__=n,this},s.prototype.value=function(){return this.__wrapped__},un("pop push reverse shift sort splice unshift".split(" "),function(e){var t=V[e];s.prototype[e]=function(){var e=this.__wrapped__;return t.apply(e,arguments),Bt&&e.length===0&&delete e[0],this.__chain__&&(e=new s(e),e.__chain__=n),e}}),un(["concat","join","slice"],function(
|
||||||
e[0],this.__chain__&&(e=new s(e),e.__chain__=n),e}}),mn(["concat","join","slice"],function(e){var t=_[e];s.prototype[e]=function(){var e=t.apply(this.__wrapped__,arguments);return this.__chain__&&(e=new s(e),e.__chain__=n),e}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(e._=s,define(function(){return s})):M?"object"==typeof module&&module&&module.exports==M?(module.exports=s)._=s:M._=s:e._=s})(this);
|
e){var t=V[e];s.prototype[e]=function(){var e=t.apply(this.__wrapped__,arguments);return this.__chain__&&(e=new s(e),e.__chain__=n),e}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(e._=s,define(function(){return s})):W?"object"==typeof module&&module&&module.exports==W?(module.exports=s)._=s:W._=s:e._=s})(this);
|
||||||
61
lodash.underscore.min.js
vendored
61
lodash.underscore.min.js
vendored
@@ -1,36 +1,31 @@
|
|||||||
/*!
|
/*!
|
||||||
Lo-Dash 0.8.2 lodash.com/license
|
Lo-Dash 0.9.0 lodash.com/license
|
||||||
Underscore.js 1.4.2 underscorejs.org/LICENSE
|
Underscore.js 1.4.2 underscorejs.org/LICENSE
|
||||||
*/
|
*/
|
||||||
;(function(e,t){function s(e,t,r){var s;if(!e)return i;var t=x(t,r),o=e.length,r=-1;if(o===+o){for(;++r<o;)if(s=e[r],t(s,r,e))return n}else for(r in e)if(it.call(e,r)&&(s=e[r],t(s,r,e)))return n;return i}function o(e,t,n,r){var s,o,u=n;if(!e)return u;var a=3>arguments.length,t=x(t,r),f=e.length;s=-1;if(f===+f)for(a&&(u=e[++s]);++s<f;)o=e[s],u=t(u,o,s,e);else for(s in e)it.call(e,s)&&(o=e[s],u=a?(a=i,o):t(u,o,s,e));return u}function u(e,t){var n,r,i=e||[];if(!e)return i;var s=e.length;n=-1;if(s===+
|
;(function(e,t){function s(e,t,n){var r;if(!e)return e;var t=p(t,n),i=e.length,n=-1;if("number"==typeof i)for(;++n<i&&(r=e[n],t(r,n,e)!==J););else for(n in e)if(it.call(e,n)&&(r=e[n],t(r,n,e)===J))break;return e}function o(e){var t,n,r=e;if(!e)return e;for(var i=1,s=arguments.length;i<s;i++)if(r=arguments[i])for(t in r)n=r[t],e[t]=n;return e}function u(e){var t,n,i=e;if(!e)return e;for(var s=1,o=arguments.length;s<o;s++)if(i=arguments[s])for(t in i)n=i[t],e[t]==r&&(e[t]=n);return e}function a(e,t)
|
||||||
s)for(i=Array(s);++n<s;)r=e[n],i[n]=r[t];else for(n in i=[],e)it.call(e,n)&&(r=e[n],i.push(r[t]));return i}function a(e,t,n){var r,i=e||[];if(!e)return i;var t=x(t,n),s=e.length,n=-1;if(s===+s)for(i=Array(s);++n<s;)r=e[n],i[n]=t(r,n,e);else for(n in i=[],e)it.call(e,n)&&(r=e[n],i.push(t(r,n,e)));return i}function f(e,t,n){var r;if(!e)return e;var t=x(t,n),i=e.length,n=-1;if(i===+i)for(;++n<i;)r=e[n],t(r,n,e);else for(n in e)it.call(e,n)&&(r=e[n],t(r,n,e));return e}function l(e,n,r){var i,s=t;if(!
|
{var n,r;if(e)for(n in t=p(t),e)if(it.call(e,n)&&(r=e[n],t(r,n,e)===J))break}function f(e,t){var n,r;if(e)for(n in t=p(t),e)if(r=e[n],t(r,n,e)===J)break}function l(e){if(e&&e.__wrapped__)return e;if(!(this instanceof l))return new l(e);this.__wrapped__=e}function c(e,n){var r=e.b,i=n.b,e=e.a,n=n.a;if(e!==n){if(e>n||e===t)return 1;if(e<n||n===t)return-1}return r<i?-1:1}function h(e,t,n){function r(){var i=arguments,s=t;return n.length&&(i=i.length?n.concat(ot.call(i)):n),this instanceof r?(m.prototype=
|
||||||
e)return s;var n=x(n,r),o=e.length,r=-1;if(o===+o){for(;++r<o;)if(i=e[r],n(i,r,e))return i}else for(r in e)if(it.call(e,r)&&(i=e[r],n(i,r,e)))return i;return s}function c(e,t,n){var r,i=[];if(!e)return i;var t=x(t,n),s=e.length,n=-1;if(s===+s)for(;++n<s;)r=e[n],t(r,n,e)&&i.push(r);else for(n in e)it.call(e,n)&&(r=e[n],t(r,n,e)&&i.push(r));return i}function h(e,t,r){var s;if(!e)return n;var t=x(t,r),o=e.length,r=-1;if(o===+o){for(;++r<o;)if(s=e[r],!t(s,r,e))return i}else for(r in e)if(it.call(e,r)&&
|
e.prototype,s=new m,(i=e.apply(s,i))&&Tt[typeof i]?i:s):e.apply(s,i)}return r}function p(e,n){return e?"function"!=typeof e?function(t){return t[e]}:n!==t?function(t,r,i){return e.call(n,t,r,i)}:e:U}function d(e){return"\\"+Nt[e]}function v(e){return Ct[e]}function m(){}function g(e){return kt[e]}function y(e){var t=[];return a(e,function(e,n){t.push(n)}),t}function b(e){var t=[];return f(e,function(e,n){S(e)&&t.push(n)}),t.sort()}function w(e){var t={};return a(e,function(e,n){t[e]=n}),t}function E
|
||||||
(s=e[r],!t(s,r,e)))return i;return n}function p(e,t){var r,s;if(!e)return i;var o=e.length;r=-1;if(o===+o){if(ut.call(e)==wt)return-1<e.indexOf(t);for(;++r<o;)if(s=e[r],s===t)return n}else for(r in e)if(it.call(e,r)&&(s=e[r],s===t))return n;return i}function d(e){var t,n,r=[];if(!e)return r;for(t in e)it.call(e,t)&&(n=e[t],r.push(n));return r}function v(e){var t,n,r=[];if(!e)return r;for(t in e)n=e[t],L(n)&&r.push(t);return r.sort(),r}function m(e,t,n){var r;if(!e)return e;t=x(t,n);for(r in e)n=e
|
(e,t,s,o){if(e===t)return 0!==e||1/e==1/t;if(e==r||t==r)return e===t;var u=ut.call(e);if(u!=ut.call(t))return i;switch(u){case mt:case gt:return+e==+t;case yt:return e!=+e?t!=+t:0==e?1/e==1/t:e==+t;case wt:case Et:return e==t+""}var a=u==vt;if(!a){if(e.__wrapped__||t.__wrapped__)return E(e.__wrapped__||e,t.__wrapped__||t);if(u!=bt)return i;var u=e.constructor,f=t.constructor;if(u!=f&&(!S(u)||!(u instanceof u&&S(f)&&f instanceof f)))return i}s||(s=[]),o||(o=[]);for(u=s.length;u--;)if(s[u]==e)return o
|
||||||
[r],t(n,r,e);return e}function g(e){var t,n,r=e;if(!e)return e;for(var i=1,s=arguments.length;i<s;i++)if(r=arguments[i])for(t in r)n=r[t],e[t]=n;return e}function y(e){var t,n=[];if(!e)return n;for(t in e)it.call(e,t)&&n.push(t);return n}function b(e){var t,n,r={};if(!e)return r;for(t in e)it.call(e,t)&&(n=e[t],r[n]=t);return r}function w(e){if(e&&e.__wrapped__)return e;if(!(this instanceof w))return new w(e);this.__wrapped__=e}function E(e,n){var r=e.b,i=n.b,e=e.a,n=n.a;if(e!==n){if(e>n||e===t)return 1
|
[u]==t;u=n,f=0,s.push(e),o.push(t);if(a){f=e.length;if(u=f==t.length)for(;f--&&(u=E(e[f],t[f],s,o)););return u}for(var l in e)if(it.call(e,l)&&(f++,!it.call(t,l)||!E(e[l],t[l],s,o)))return i;for(l in t)if(it.call(t,l)&&!(f--))return i;return n}function S(e){return"function"==typeof e}function x(e){return ut.call(e)==Et}function T(e){var t=[];return a(e,function(e){t.push(e)}),t}function N(e,t){return"number"==typeof (e?e.length:0)?-1<j(e,t):P(e,function(e){return e===t})}function C(e,t,r){var i=n
|
||||||
;if(e<n||n===t)return-1}return r<i?-1:1}function S(e,t,n){function r(){var i=arguments,s=t;return n.length&&(i=i.length?n.concat(ot.call(i)):n),this instanceof r?(C.prototype=e.prototype,s=new C,(i=e.apply(s,i))&&Tt[typeof i]?i:s):e.apply(s,i)}return r}function x(e,n){return e?"function"!=typeof e?function(t){return t[e]}:n!==t?function(t,r,i){return e.call(n,t,r,i)}:e:q}function T(e){return"\\"+Nt[e]}function N(e){return kt[e]}function C(){}function k(e){return Lt[e]}function L(e){return"function"==typeof
|
,t=p(t,r);return s(e,function(e,n,r){return!(i=t(e,n,r))&&J}),!!i}function k(e,t,n){var r=[],t=p(t,n);return s(e,function(e,n,i){t(e,n,i)&&r.push(e)}),r}function L(e,t,r){var i,t=p(t,r);return P(e,function(e,r,s){return t(e,r,s)&&(i=e,n)}),i}function A(e,t,n){var r=-1,i=e?e.length:0,o=Array("number"==typeof i?i:0),t=p(t,n);if(Lt(e))for(;++r<i;)o[r]=t(e[r],r,e);else s(e,function(e,n,i){o[++r]=t(e,n,i)});return o}function O(e,t,n){var r=-Infinity,i=-1,o=e?e.length:0,u=r;if(t||"number"!=typeof o)t=p
|
||||||
e}function A(e){var t=i;if(!e||"object"!=typeof e||isArguments(e))return t;var n=e.constructor;return!L(n)||n instanceof n?(m(e,function(e,n){t=n}),t===i||it.call(e,t)):t}function O(e,t,s,o){if(e==r||t==r)return e===t;if(e===t)return 0!==e||1/e==1/t;if(Tt[typeof e]||Tt[typeof t])e=e.__wrapped__||e,t=t.__wrapped__||t;var u=ut.call(e);if(u!=ut.call(t))return i;switch(u){case vt:case mt:return+e==+t;case gt:return e!=+e?t!=+t:0==e?1/e==1/t:e==+t;case bt:case wt:return e==t+""}var a=Ct(e);if(!a&&u!=yt
|
(t,n),s(e,function(e,n,i){n=t(e,n,i),n>r&&(r=n,u=e)});else for(;++i<o;)e[i]>u&&(u=e[i]);return u}function M(e,t){var n=[];return s(e,function(e){n.push(e[t])}),n}function _(e,t,n,r){var o=3>arguments.length,t=p(t,r);return s(e,function(e,r,s){n=o?(o=i,e):t(n,e,r,s)}),n}function D(e,t,n,r){var o=e?e.length:0,u=3>arguments.length;if("number"!=typeof o)var a=At(e),o=a.length;return s(e,function(s,f,l){f=a?a[--o]:--o,n=u?(u=i,e[f]):t.call(r,n,e[f],f,l)}),n}function P(e,t,n){var r,t=p(t,n);return s(e,
|
||||||
)return i;s||(s=[]),o||(o=[]);for(u=s.length;u--;)if(s[u]==e)return o[u]==t;var f=n,u=0;s.push(e),o.push(t);if(a){u=e.length;if(f=u==t.length)for(;u--&&(f=O(e[u],t[u],s,o)););return f}a=e.constructor,f=t.constructor;if(a!=f&&(!L(a)||!(a instanceof a&&L(f)&&f instanceof f)))return i;for(var l in e)if(it.call(e,l)&&(u++,!it.call(t,l)||!O(e[l],t[l],s,o)))return i;for(l in t)if(it.call(t,l)&&!(u--))return i;return n}function M(e,t,n){var r=-Infinity,i=-1,s=e?e.length:0,o=r;if(t||s!==+s)t=x(t,n),f(e,function(
|
function(e,n,i){return(r=t(e,n,i))&&J}),!!r}function H(e,t,n){if(e)return t==r||n?e[0]:ot.call(e,0,t)}function B(e,t){for(var n=-1,r=e?e.length:0,i=[];++n<r;){var s=e[n];Lt(s)?st.apply(i,t?s:B(s)):i.push(s)}return i}function j(e,t,n){var r=-1,i=e?e.length:0;if("number"==typeof n)r=(0>n?ht(0,i+n):n||0)-1;else if(n)return r=I(e,t),e[r]===t?r:-1;for(;++r<i;)if(e[r]===t)return r;return-1}function F(e,t,n){return e?ot.call(e,t==r||n?1:t):[]}function I(e,t,n,r){for(var i=0,s=e?e.length:i,n=n?p(n,r):U,t=
|
||||||
e,n,i){n=t(e,n,i),n>r&&(r=n,o=e)});else for(;++i<s;)e[i]>o&&(o=e[i]);return o}function _(e,t,n,r){var s=e?e.length:0,o=3>arguments.length;if(s!==+s)var u=At(e),s=u.length;return f(e,function(a,f,l){f=u?u[--s]:--s,n=o?(o=i,e[f]):t.call(r,n,e[f],f,l)}),n}function D(e,t,n){if(e)return t==r||n?e[0]:ot.call(e,0,t)}function P(e,t){for(var n=-1,r=e?e.length:0,i=[];++n<r;){var s=e[n];Ct(s)?st.apply(i,t?s:P(s)):i.push(s)}return i}function H(e,t,n){var r=-1,i=e?e.length:0;if("number"==typeof n)r=(0>n?ht(0,
|
n(t);i<s;)r=i+s>>>1,n(e[r])<t?i=r+1:s=r;return i}function q(e,t,n,r){for(var i=-1,s=e?e.length:0,o=[],u=[],n=p(n,r);++i<s;)if(r=n(e[i],i,e),t?!i||u[u.length-1]!==r:0>j(u,r))u.push(r),o.push(e[i]);return o}function R(e,t){return xt||at&&2<arguments.length?at.call.apply(at,arguments):h(e,t,ot.call(arguments,2))}function U(e){return e}function z(e){s(b(e),function(t){var r=l[t]=e[t];l.prototype[t]=function(){var e=[this.__wrapped__];return st.apply(e,arguments),e=r.apply(l,e),this.__chain__&&(e=new
|
||||||
i+n):n||0)-1;else if(n)return r=j(e,t),e[r]===t?r:-1;for(;++r<i;)if(e[r]===t)return r;return-1}function B(e,t,n){return e?ot.call(e,t==r||n?1:t):[]}function j(e,t,n,r){var i=0,s=e?e.length:i;if(n){n=x(n,r);for(t=n(t);i<s;)r=i+s>>>1,n(e[r])<t?i=r+1:s=r}else for(;i<s;)r=i+s>>>1,e[r]<t?i=r+1:s=r;return i}function F(e,t,n,r){var s=-1,o=e?e.length:0,u=[],a=[];"function"==typeof t&&(r=n,n=t,t=i);for(n=x(n,r);++s<o;)if(r=n(e[s],s,e),t?!s||a[a.length-1]!==r:0>H(a,r))a.push(r),u.push(e[s]);return u}function I
|
l(e),e.__chain__=n),e}})}var n=!0,r=null,i=!1,W="object"==typeof exports&&exports,X="object"==typeof global&&global;X.global===X&&(e=X);var V=[],X={},$=0,J={},K=e._,Q=/&(?:amp|lt|gt|quot|#x27);/g,G=RegExp("^"+(X.valueOf+"").replace(/[.*+?^=!:${}()|[\]\/\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),Y=/($^)/,Z=/[&<>"']/g,et=/['\n\r\t\u2028\u2029\\]/g,tt=Math.ceil,nt=V.concat,rt=Math.floor,it=X.hasOwnProperty,st=V.push,ot=V.slice,ut=X.toString,at=G.test(at=ot.bind)&&at,ft=G.test(ft=Array.isArray
|
||||||
(e,t){return xt||at&&2<arguments.length?at.call.apply(at,arguments):S(e,t,ot.call(arguments,2))}function q(e){return e}function R(e){f(v(e),function(t){var r=w[t]=e[t];w.prototype[t]=function(){var e=[this.__wrapped__];return arguments.length&&st.apply(e,arguments),e=r.apply(w,e),this.__chain__&&(e=new w(e),e.__chain__=n),e}})}var n=!0,r=null,i=!1,U="object"==typeof exports&&exports&&("object"==typeof global&&global&&global==global.global&&(e=global),exports),z=Array.prototype,W=Object.prototype,
|
)&&ft,lt=e.isFinite,ct=G.test(ct=Object.keys)&&ct,ht=Math.max,pt=Math.min,dt=Math.random,vt="[object Array]",mt="[object Boolean]",gt="[object Date]",yt="[object Number]",bt="[object Object]",wt="[object RegExp]",Et="[object String]",St=(St={0:1,length:1},V.splice.call(St,0,1),St[0]),xt=at&&/\n|Opera/.test(at+ut.call(e.opera)),Tt={"boolean":i,"function":n,object:n,number:i,string:i,"undefined":i},Nt={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"};l.templateSettings=
|
||||||
X=0,V=e._,$=/[-?+=!~*%&^<>|{(\/]|\[\D|\b(?:delete|in|instanceof|new|typeof|void)\b/,J=/&(?:amp|lt|gt|quot|#x27);/g,K=/(?:__e|__t=)\(\s*(?![\d\s"']|this\.)/g,Q=RegExp("^"+(W.valueOf+"").replace(/[.*+?^=!:${}()|[\]\/\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),G=/($^)/,Y=/[&<>"']/g,Z=/['\n\r\t\u2028\u2029\\]/g,et=Math.ceil,tt=z.concat,nt=Math.floor,rt=Q.test(rt=Object.getPrototypeOf)&&rt,it=W.hasOwnProperty,st=z.push,ot=z.slice,ut=W.toString,at=Q.test(at=ot.bind)&&at,ft=Q.test(ft=Array.isArray
|
{escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},l.isArguments=function(e){return"[object Arguments]"==ut.call(e)},l.isArguments(arguments)||(l.isArguments=function(e){return e?it.call(e,"callee"):i});var Ct={"&":"&","<":"<",">":">",'"':""","'":"'"},kt=w(Ct),Lt=ft||function(e){return ut.call(e)==vt};S(/x/)&&(S=function(e){return"[object Function]"==ut.call(e)});var At=ct?function(e){return e&&Tt[typeof e]?ct(e):[]}:y;l.VERSION="0.9.0"
|
||||||
)&&ft,lt=e.isFinite,ct=Q.test(ct=Object.keys)&&ct,ht=Math.max,pt=Math.min,dt=Math.random,vt="[object Boolean]",mt="[object Date]",gt="[object Number]",yt="[object Object]",bt="[object RegExp]",wt="[object String]",Et=e.clearTimeout,St=e.setTimeout,xt=at&&/\n|Opera/.test(at+ut.call(e.opera)),Tt={"boolean":i,"function":n,object:n,number:i,string:i,"undefined":i,unknown:n},Nt={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"};w.templateSettings={escape:/<%-([\s\S]+?)%>/g
|
,l.after=function(e,t){return 1>e?t():function(){if(1>--e)return t.apply(this,arguments)}},l.bind=R,l.bindAll=function(e){for(var t=arguments,n=1<t.length?0:(t=b(e),-1),r=t.length;++n<r;){var i=t[n];e[i]=R(e[i],e)}return e},l.chain=function(e){return e=new l(e),e.__chain__=n,e},l.clone=function(e){return e&&Tt[typeof e]?Lt(e)?ot.call(e):o({},e):e},l.compact=function(e){for(var t=-1,n=e?e.length:0,r=[];++t<n;){var i=e[t];i&&r.push(i)}return r},l.compose=function(){var e=arguments;return function()
|
||||||
,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},w.isArguments=function(e){return"[object Arguments]"==ut.call(e)},w.isArguments(arguments)||(w.isArguments=function(e){return e?it.call(e,"callee"):i});var Ct=ft||function(e){return"[object Array]"==ut.call(e)};L(/x/)&&(L=function(e){return"[object Function]"==ut.call(e)});var W=rt?function(e){if(!e||"object"!=typeof e)return i;var t=e.valueOf,n="function"==typeof t&&(n=rt(t))&&rt(n);return n?e==n||rt(e)==n&&!isArguments(e):A
|
{for(var t=arguments,n=e.length;n--;)t=[e[n].apply(this,t)];return t[0]}},l.contains=N,l.countBy=function(e,t,n){var r={},t=p(t,n);return s(e,function(e,n,i){n=t(e,n,i),it.call(r,n)?r[n]++:r[n]=1}),r},l.debounce=function(e,t,n){function i(){a=r,n||(o=e.apply(u,s))}var s,o,u,a;return function(){var r=n&&!a;return s=arguments,u=this,clearTimeout(a),a=setTimeout(i,t),r&&(o=e.apply(u,s)),o}},l.defaults=u,l.defer=function(e){var n=ot.call(arguments,1);return setTimeout(function(){e.apply(t,n)},1)},l.delay=
|
||||||
(e)}:A,kt={"&":"&","<":"<",">":">",'"':""","'":"'"},Lt=b(kt),At=ct?function(e){return e&&Tt[typeof e]?ct(e):[]}:y;w.VERSION="0.8.2",w.after=function(e,t){return 1>e?t():function(){if(1>--e)return t.apply(this,arguments)}},w.bind=I,w.bindAll=function(e){var t,n,r=e,i=e;if(!e)return i;n=arguments,t=0;var s=n.length;if(1<s){for(;++t<s;)i[n[t]]=I(i[n[t]],i);return i}for(t in r)n=r[t],L(n)&&(i[t]=I(n,i));return i},w.chain=function(e){return e=new w(e),e.__chain__=n,e},w.clone=function(
|
function(e,n){var r=ot.call(arguments,2);return setTimeout(function(){e.apply(t,r)},n)},l.difference=function(e){for(var t=-1,n=e.length,r=nt.apply(V,arguments),i=[];++t<n;){var s=e[t];0>j(r,s,n)&&i.push(s)}return i},l.escape=function(e){return e==r?"":(e+"").replace(Z,v)},l.every=C,l.extend=o,l.filter=k,l.find=L,l.first=H,l.flatten=B,l.forEach=s,l.functions=b,l.groupBy=function(e,t,n){var r={},t=p(t,n);return s(e,function(e,n,i){n=t(e,n,i),(it.call(r,n)?r[n]:r[n]=[]).push(e)}),r},l.has=function(
|
||||||
e){return e&&Tt[typeof e]?Ct(e)?ot.call(e):g({},e):e},w.compact=function(e){for(var t=-1,n=e?e.length:0,r=[];++t<n;){var i=e[t];i&&r.push(i)}return r},w.compose=function(){var e=arguments;return function(){for(var t=arguments,n=e.length;n--;)t=[e[n].apply(this,t)];return t[0]}},w.contains=p,w.countBy=function(e,t,n){var r,i={};if(!e)return i;var t=x(t,n),s=e.length,n=-1;if(s===+s)for(;++n<s;)r=e[n],r=t(r,n,e),it.call(i,r)?i[r]++:i[r]=1;else for(n in e)it.call(e,n)&&(r=e[n],r=t(r,n,e),it.call(i,r)?
|
e,t){return e?it.call(e,t):i},l.identity=U,l.indexOf=j,l.initial=function(e,t,n){return e?ot.call(e,0,-(t==r||n?1:t)):[]},l.intersection=function(e){var t=arguments,n=t.length,r=[];return s(e,function(e){if(0>j(r,e)){for(var i=n;--i;)if(0>j(t[i],e))return;r.push(e)}}),r},l.invert=w,l.invoke=function(e,t){var n=ot.call(arguments,2),r="function"==typeof t,i=[];return s(e,function(e){i.push((r?t:e[t]).apply(e,n))}),i},l.isArray=Lt,l.isBoolean=function(e){return e===n||e===i||ut.call(e)==mt},l.isDate=
|
||||||
i[r]++:i[r]=1);return i},w.debounce=function(e,t,n){function i(){a=r,n||(o=e.apply(u,s))}var s,o,u,a;return function(){var r=n&&!a;return s=arguments,u=this,Et(a),a=St(i,t),r&&(o=e.apply(u,s)),o}},w.defaults=function(e){var t,n,i=e;if(!e)return e;for(var s=1,o=arguments.length;s<o;s++)if(i=arguments[s])for(t in i)n=i[t],e[t]==r&&(e[t]=n);return e},w.defer=function(e){var n=ot.call(arguments,1);return St(function(){return e.apply(t,n)},1)},w.delay=function(e,n){var r=ot.call(arguments,2);return St
|
function(e){return ut.call(e)==gt},l.isElement=function(e){return e?1===e.nodeType:i},l.isEmpty=function(e){if(!e)return n;if(Lt(e)||x(e))return!e.length;for(var t in e)if(it.call(e,t))return i;return n},l.isEqual=E,l.isFinite=function(e){return lt(e?+e:parseFloat(e))},l.isFunction=S,l.isNaN=function(e){return ut.call(e)==yt&&e!=+e},l.isNull=function(e){return e===r},l.isNumber=function(e){return ut.call(e)==yt},l.isObject=function(e){return e?Tt[typeof e]:i},l.isRegExp=function(e){return ut.call
|
||||||
(function(){return e.apply(t,r)},n)},w.difference=function(e){for(var t=-1,n=e.length,r=tt.apply(z,arguments),i=[];++t<n;){var s=e[t];0>H(r,s,n)&&i.push(s)}return i},w.escape=function(e){return e==r?"":(e+"").replace(Y,N)},w.every=h,w.extend=g,w.filter=c,w.find=l,w.first=D,w.flatten=P,w.forEach=f,w.forIn=m,w.forOwn=function(e,t,n){var r;if(!e)return e;t=x(t,n);for(r in e)it.call(e,r)&&(n=e[r],t(n,r,e));return e},w.functions=v,w.groupBy=function(e,t,n){var r,i={};if(!e)return i;var t=x(t,n),s=e.length
|
(e)==wt},l.isString=x,l.isUndefined=function(e){return e===t},l.keys=At,l.last=function(e,t,n){if(e){var i=e.length;return t==r||n?e[i-1]:ot.call(e,-t||i)}},l.lastIndexOf=function(e,t,n){var r=e?e.length:0;for("number"==typeof n&&(r=(0>n?ht(0,r+n):pt(n,r-1))+1);r--;)if(e[r]===t)return r;return-1},l.map=A,l.max=O,l.memoize=function(e,t){var n={};return function(){var r=t?t.apply(this,arguments):arguments[0];return it.call(n,r)?n[r]:n[r]=e.apply(this,arguments)}},l.min=function(e,t,n){var r=Infinity
|
||||||
,n=-1;if(s===+s)for(;++n<s;){r=e[n];var o=t(r,n,e);(it.call(i,o)?i[o]:i[o]=[]).push(r)}else for(n in e)it.call(e,n)&&(r=e[n],o=t(r,n,e),(it.call(i,o)?i[o]:i[o]=[]).push(r));return i},w.has=function(e,t){return e?it.call(e,t):i},w.identity=q,w.indexOf=H,w.initial=function(e,t,n){return e?ot.call(e,0,-(t==r||n?1:t)):[]},w.intersection=function(e){var t=arguments.length,n=-1,r=e.length,i=[];e:for(;++n<r;){var s=e[n];if(0>H(i,s)){for(var o=1;o<t;o++)if(0>H(arguments[o],s))continue e;i.push(s)}}return i
|
,i=-1,o=e?e.length:0,u=r;if(t||"number"!=typeof o)t=p(t,n),s(e,function(e,n,i){n=t(e,n,i),n<r&&(r=n,u=e)});else for(;++i<o;)e[i]<u&&(u=e[i]);return u},l.mixin=z,l.noConflict=function(){return e._=K,this},l.object=function(e,t){for(var n=-1,r=e?e.length:0,i={};++n<r;){var s=e[n];t?i[s]=t[n]:i[s[0]]=s[1]}return i},l.omit=function(e){var t=nt.apply(V,arguments),n={};return f(e,function(e,r){0>j(t,r,1)&&(n[r]=e)}),n},l.once=function(e){var t,s=i;return function(){return s?t:(s=n,t=e.apply(this,arguments
|
||||||
},w.invert=b,w.invoke=function(e,t){var n,r,i=e,s=e||[];if(!e)return s;var o=ot.call(arguments,2),u="function"==typeof t,a=i.length;n=-1;if(a===+a)for(s=Array(a);++n<a;)r=i[n],s[n]=(u?t:r[t]).apply(r,o);else for(n in s=[],i)it.call(i,n)&&(r=i[n],s.push((u?t:r[t]).apply(r,o)));return s},w.isArray=Ct,w.isBoolean=function(e){return e===n||e===i||ut.call(e)==vt},w.isDate=function(e){return ut.call(e)==mt},w.isElement=function(e){return e?1===e.nodeType:i},w.isEmpty=function(e){var t;if(!e)return n;var r=
|
),e=r,t)}},l.pairs=function(e){var t=[];return a(e,function(e,n){t.push([n,e])}),t},l.pick=function(e){for(var t=0,n=nt.apply(V,arguments),r=n.length,i={};++t<r;){var s=n[t];s in e&&(i[s]=e[s])}return i},l.pluck=M,l.random=function(e,t){return e==r&&t==r&&(t=1),e=+e||0,t==r&&(t=e,e=0),e+rt(dt()*((+t||0)-e+1))},l.range=function(e,t,n){e=+e||0,n=+n||1,t==r&&(t=e,e=0);for(var i=-1,t=ht(0,tt((t-e)/n)),s=Array(t);++i<t;)s[i]=e,e+=n;return s},l.reduce=_,l.reduceRight=D,l.reject=function(e,t,n){return t=
|
||||||
ut.call(e),s=e.length;if(Ct(e)||r==wt||r==yt&&s===+s&&L(e.splice))return!s;for(t in e)if(it.call(e,t))return i;return n},w.isEqual=O,w.isFinite=function(e){return lt(e)&&ut.call(e)==gt},w.isFunction=L,w.isNaN=function(e){return ut.call(e)==gt&&e!=+e},w.isNull=function(e){return e===r},w.isNumber=function(e){return ut.call(e)==gt},w.isObject=function(e){return e?Tt[typeof e]:i},w.isPlainObject=W,w.isRegExp=function(e){return ut.call(e)==bt},w.isString=function(e){return ut.call(e)==wt},w.isUndefined=
|
p(t,n),k(e,function(e,n,r){return!t(e,n,r)})},l.rest=F,l.result=function(e,t){var n=e?e[t]:r;return S(n)?e[t]():n},l.shuffle=function(e){var t=-1,n=Array(e?e.length:0);return s(e,function(e){var r=rt(dt()*(++t+1));n[t]=n[r],n[r]=e}),n},l.size=function(e){var t=e?e.length:0;return"number"==typeof t?t:At(e).length},l.some=P,l.sortBy=function(e,t,n){var r=[],t=p(t,n);s(e,function(e,n,i){r.push({a:t(e,n,i),b:n,c:e})}),e=r.length;for(r.sort(c);e--;)r[e]=r[e].c;return r},l.sortedIndex=I,l.tap=function(
|
||||||
function(e){return e===t},w.keys=At,w.last=function(e,t,n){if(e){var i=e.length;return t==r||n?e[i-1]:ot.call(e,-t||i)}},w.lastIndexOf=function(e,t,n){var r=e?e.length:0;for("number"==typeof n&&(r=(0>n?ht(0,r+n):pt(n,r-1))+1);r--;)if(e[r]===t)return r;return-1},w.map=a,w.max=M,w.memoize=function(e,t){var n={};return function(){var r=t?t.apply(this,arguments):arguments[0];return it.call(n,r)?n[r]:n[r]=e.apply(this,arguments)}},w.min=function(e,t,n){var r=Infinity,i=-1,s=e?e.length:0,o=r;if(t||s!==+
|
e,t){return t(e),e},l.template=function(e,t,n){e||(e="");var n=u({},n,l.templateSettings),r=0,i="__p += '",s=n.variable;e.replace(RegExp((n.escape||Y).source+"|"+(n.interpolate||Y).source+"|"+(n.evaluate||Y).source+"|$","g"),function(t,n,s,o,u){i+=e.slice(r,u).replace(et,d),i+=n?"'+_['escape']("+n+")+'":o?"';"+o+";__p+='":s?"'+((__t=("+s+"))==null?'':__t)+'":"",r=u+t.length}),i+="';",s||(s="obj",i="with("+s+"||{}){"+i+"}"),i="function("+s+"){var __t,__p='',__j=[].join;function print(){__p+=__j.call(arguments,'')}"+
|
||||||
s)t=x(t,n),f(e,function(e,n,i){n=t(e,n,i),n<r&&(r=n,o=e)});else for(;++i<s;)e[i]<o&&(o=e[i]);return o},w.mixin=R,w.noConflict=function(){return e._=V,this},w.object=function(e,t){for(var n=-1,r=e?e.length:0,i={};++n<r;){var s=e[n];t?i[s]=t[n]:i[s[0]]=s[1]}return i},w.omit=function(e,t,n){var r,i,s=e,o={};if(!e)return o;var u="function"==typeof t;if(u)t=x(t,n);else var a=tt.apply(z,arguments);for(r in s)if(i=s[r],u?!t(i,r,e):0>H(a,r))o[r]=i;return o},w.once=function(e){var t,s=i;return function(){
|
i+"return __p}";try{var o=Function("_","return "+i)(l)}catch(a){throw a.source=i,a}return t?o(t):(o.source=i,o)},l.throttle=function(e,t){function n(){a=new Date,u=r,s=e.apply(o,i)}var i,s,o,u,a=0;return function(){var r=new Date,f=t-(r-a);return i=arguments,o=this,0>=f?(clearTimeout(u),a=r,s=e.apply(o,i)):u||(u=setTimeout(n,f)),s}},l.times=function(e,t,n){for(var e=+e||0,r=-1,i=Array(e);++r<e;)i[r]=t.call(n,r);return i},l.toArray=function(e){return e&&"number"==typeof e.length?"string"==typeof e?
|
||||||
return s?t:(s=n,t=e.apply(this,arguments),e=r,t)}},w.pairs=function(e){var t,n,r=[];if(!e)return r;for(t in e)it.call(e,t)&&(n=e[t],r.push([t,n]));return r},w.pick=function(e,t,n){var r,i,s=e,o={};if(!e)return o;if("function"!=typeof t){r=0,i=tt.apply(z,arguments);for(s=i.length;++r<s;){var u=i[r];u in e&&(o[u]=e[u])}}else for(r in t=x(t,n),s)i=s[r],t(i,r,e)&&(o[r]=i);return o},w.pluck=u,w.random=function(e,t){return e==r&&t==r&&(t=1),e=+e||0,t==r&&(t=e,e=0),e+nt(dt()*((+t||0)-e+1))},w.range=function(
|
e.split(""):ot.call(e):T(e)},l.unescape=function(e){return e==r?"":(e+"").replace(Q,g)},l.union=function(){for(var e=-1,t=nt.apply(V,arguments),n=t.length,r=[];++e<n;){var i=t[e];0>j(r,i)&&r.push(i)}return r},l.uniq=q,l.uniqueId=function(e){var t=$++;return e?e+t:t},l.values=T,l.where=function(e,t){var n=[];return f(t,function(e,t){n.push(t)}),k(e,function(e){for(var r=n.length;r--;){var i=e[n[r]]===t[n[r]];if(!i)break}return!!i})},l.without=function(e){for(var t=-1,n=e.length,r=[];++t<n;){var i=
|
||||||
e,t,n){e=+e||0,n=+n||1,t==r&&(t=e,e=0);for(var i=-1,t=ht(0,et((t-e)/n)),s=Array(t);++i<t;)s[i]=e,e+=n;return s},w.reduce=o,w.reduceRight=_,w.reject=function(e,t,n){var r,i=[];if(!e)return i;var t=x(t,n),s=e.length,n=-1;if(s===+s)for(;++n<s;)r=e[n],!t(r,n,e)&&i.push(r);else for(n in e)it.call(e,n)&&(r=e[n],!t(r,n,e)&&i.push(r));return i},w.rest=B,w.result=function(e,t){var n=e?e[t]:r;return L(n)?e[t]():n},w.shuffle=function(e){var t=-1,n=Array(e?e.length:0);return f(e,function(e){var r=nt(dt()*(++
|
e[t];0>j(arguments,i,1)&&r.push(i)}return r},l.wrap=function(e,t){return function(){var n=[e];return st.apply(n,arguments),t.apply(this,n)}},l.zip=function(e){for(var t=-1,n=e?O(M(arguments,"length")):0,r=Array(n);++t<n;)r[t]=M(arguments,t);return r},l.all=C,l.any=P,l.collect=A,l.detect=L,l.drop=F,l.each=s,l.foldl=_,l.foldr=D,l.head=H,l.include=N,l.inject=_,l.methods=b,l.select=k,l.tail=F,l.take=H,l.unique=q,z(l),l.prototype.chain=function(){return this.__chain__=n,this},l.prototype.value=function(
|
||||||
t+1));n[t]=n[r],n[r]=e}),n},w.size=function(e){var t=e?e.length:0;return t===+t?t:At(e).length},w.some=s,w.sortBy=function(e,t,n){var r,i=e||[];if(!e)return i;var t=x(t,n),s=e.length,n=-1;if(s===+s)for(i=Array(s);++n<s;)r=e[n],i[n]={a:t(r,n,e),b:n,c:r};else for(n in i=[],e)it.call(e,n)&&(r=e[n],i.push({a:t(r,n,e),b:n,c:r}));i.sort(E);for(s=i.length;s--;)i[s]=i[s].c;return i},w.sortedIndex=j,w.tap=function(e,t){return t(e),e},w.template=function(e,t,n){e||(e=""),n||(n={});var r,i,s=0,o=w.templateSettings
|
){return this.__wrapped__},s("pop push reverse shift sort splice unshift".split(" "),function(e){var t=V[e];l.prototype[e]=function(){var e=this.__wrapped__;return t.apply(e,arguments),St&&e.length===0&&delete e[0],this.__chain__&&(e=new l(e),e.__chain__=n),e}}),s(["concat","join","slice"],function(e){var t=V[e];l.prototype[e]=function(){var e=t.apply(this.__wrapped__,arguments);return this.__chain__&&(e=new l(e),e.__chain__=n),e}}),W?"object"==typeof module&&module&&module.exports==W?(module.exports=
|
||||||
,u="__p += '",a=n.variable||o.variable,f=a;e.replace(RegExp((n.escape||o.escape||G).source+"|"+(n.interpolate||o.interpolate||G).source+"|"+(n.evaluate||o.evaluate||G).source+"|$","g"),function(t,n,i,o,a){u+=e.slice(s,a).replace(Z,T),u+=n?"'+__e("+n+")+'":o?"';"+o+";__p+='":i?"'+((__t=("+i+"))==null?'':__t)+'":"",r||(r=o||$.test(n||i)),s=a+t.length}),u+="';",f||(a="obj",r?u="with("+a+"){"+u+"}":(n=RegExp("(\\(\\s*)"+a+"\\."+a+"\\b","g"),u=u.replace(K,"$&"+a+".").replace(n,"$1__d"))),u="function("+
|
l)._=l:W._=l:e._=l})(this);
|
||||||
a+"){"+(f?"":a+"||("+a+"={});")+"var __t,__p='',__e=_.escape"+(r?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":(f?"":",__d="+a+"."+a+"||"+a)+";")+u+"return __p}";try{i=Function("_","return "+u)(w)}catch(l){throw l.source=u,l}return t?i(t):(i.source=u,i)},w.throttle=function(e,t){function n(){a=new Date,u=r,s=e.apply(o,i)}var i,s,o,u,a=0;return function(){var r=new Date,f=t-(r-a);return i=arguments,o=this,0>=f?(Et(u),a=r,s=e.apply(o,i)):u||(u=St(n,f)),s}},w.times=function(
|
|
||||||
e,t,n){for(var e=+e||0,r=-1,i=Array(e);++r<e;)i[r]=t.call(n,r);return i},w.toArray=function(e){if(!e)return[];var t=e.length;return t===+t?"string"==typeof e?e.split(""):ot.call(e):d(e)},w.unescape=function(e){return e==r?"":(e+"").replace(J,k)},w.union=function(){for(var e=-1,t=tt.apply(z,arguments),n=t.length,r=[];++e<n;){var i=t[e];0>H(r,i)&&r.push(i)}return r},w.uniq=F,w.uniqueId=function(e){var t=X++;return e?e+t:t},w.values=d,w.where=function(e,t){var r,i,s=[];if(!e)return s;var o=[];m(t,function(
|
|
||||||
e,t){o.push(t)});var u=o.length,a=e.length;r=-1;if(a===+a)for(;++r<a;){i=e[r];for(var f=n,l=0;l<u&&(f=o[l],f=i[f]===t[f]);l++);f&&s.push(i)}else for(r in e)if(it.call(e,r)){i=e[r],f=n;for(l=0;l<u&&(f=o[l],f=i[f]===t[f]);l++);f&&s.push(i)}return s},w.without=function(e){for(var t=-1,n=e.length,r=[];++t<n;){var i=e[t];0>H(arguments,i,1)&&r.push(i)}return r},w.wrap=function(e,t){return function(){var n=[e];return arguments.length&&st.apply(n,arguments),t.apply(this,n)}},w.zip=function(e){for(var t=-1
|
|
||||||
,n=e?M(u(arguments,"length")):0,r=Array(n);++t<n;)r[t]=u(arguments,t);return r},w.all=h,w.any=s,w.collect=a,w.detect=l,w.drop=B,w.each=f,w.foldl=o,w.foldr=_,w.head=D,w.include=p,w.inject=o,w.methods=v,w.select=c,w.tail=B,w.take=D,w.unique=F,R(w),w.prototype.chain=function(){return this.__chain__=n,this},w.prototype.value=function(){return this.__wrapped__},f("pop push reverse shift sort splice unshift".split(" "),function(e){var t=z[e];w.prototype[e]=function(){var e=this.__wrapped__;return t.apply
|
|
||||||
(e,arguments),this.__chain__&&(e=new w(e),e.__chain__=n),e}}),f(["concat","join","slice"],function(e){var t=z[e];w.prototype[e]=function(){var e=t.apply(this.__wrapped__,arguments);return this.__chain__&&(e=new w(e),e.__chain__=n),e}}),U?"object"==typeof module&&module&&module.exports==U?(module.exports=w)._=w:U._=w:e._=w})(this);
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "lodash",
|
"name": "lodash",
|
||||||
"version": "0.8.2",
|
"version": "0.9.0",
|
||||||
"description": "A drop-in replacement for Underscore.js delivering performance, bug fixes, and additional features.",
|
"description": "A drop-in replacement for Underscore.js delivering performance, bug fixes, and additional features.",
|
||||||
"homepage": "http://lodash.com",
|
"homepage": "http://lodash.com",
|
||||||
"main": "./lodash",
|
"main": "./lodash",
|
||||||
@@ -24,6 +24,9 @@
|
|||||||
"email": "john.david.dalton@gmail.com",
|
"email": "john.david.dalton@gmail.com",
|
||||||
"web": "http://allyoucanleet.com/"
|
"web": "http://allyoucanleet.com/"
|
||||||
},
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"tar": "~0.1.13"
|
||||||
|
},
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/bestiejs/lodash/issues"
|
"url": "https://github.com/bestiejs/lodash/issues"
|
||||||
},
|
},
|
||||||
@@ -47,6 +50,7 @@
|
|||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "node build",
|
"build": "node build",
|
||||||
"test": "node test/test && node test/test-build"
|
"test": "node test/test && node test/test-build",
|
||||||
|
"install": "node build/post-install"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,17 +13,34 @@
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
left: -9999em;
|
left: -9999em;
|
||||||
}
|
}
|
||||||
|
#FirebugUI {
|
||||||
|
top: 2em;
|
||||||
|
}
|
||||||
|
#perf-toolbar {
|
||||||
|
background-color: #EEE;
|
||||||
|
color: #5E740B;
|
||||||
|
font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial, sans-serif;
|
||||||
|
font-size: small;
|
||||||
|
padding: 0.5em 0 0.5em 2em;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script src="../lodash.min.js"></script>
|
<div id="perf-toolbar"></div>
|
||||||
<script>
|
|
||||||
var lodash = _.noConflict();
|
|
||||||
</script>
|
|
||||||
<script src="../vendor/underscore/underscore-min.js"></script>
|
|
||||||
<script src="../vendor/platform.js/platform.js"></script>
|
<script src="../vendor/platform.js/platform.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>
|
||||||
|
document.write('<script src="../' + ui.buildPath + '"><\/script>');
|
||||||
|
</script>
|
||||||
|
<script>
|
||||||
|
var lodash = _.noConflict();
|
||||||
|
</script>
|
||||||
|
<script>
|
||||||
|
document.write('<script src="../' + ui.otherPath + '"><\/script>');
|
||||||
|
</script>
|
||||||
<script src="perf.js"></script>
|
<script src="perf.js"></script>
|
||||||
<script>
|
<script>
|
||||||
(function() {
|
(function() {
|
||||||
@@ -39,7 +56,12 @@
|
|||||||
if (!fbCommandLine) {
|
if (!fbCommandLine) {
|
||||||
return setTimeout(init, 15);
|
return setTimeout(init, 15);
|
||||||
}
|
}
|
||||||
fbUI.style.height = fbDoc.body.style.height = fbDoc.documentElement.style.height = '100%';
|
fbUI.style.height = (
|
||||||
|
Math.max(document.documentElement.clientHeight, document.body.clientHeight) -
|
||||||
|
document.getElementById('perf-toolbar').clientHeight
|
||||||
|
) + 'px';
|
||||||
|
|
||||||
|
fbDoc.body.style.height = fbDoc.documentElement.style.height = '100%';
|
||||||
setTimeout(run, 15);
|
setTimeout(run, 15);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
130
perf/perf-ui.js
Normal file
130
perf/perf-ui.js
Normal file
@@ -0,0 +1,130 @@
|
|||||||
|
;(function(window) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
/** The Lo-Dash build to load */
|
||||||
|
var build = (/build=([^&]+)/.exec(location.search) || [])[1];
|
||||||
|
|
||||||
|
/** The other library to load */
|
||||||
|
var other = (/other=([^&]+)/.exec(location.search) || [])[1];
|
||||||
|
|
||||||
|
/** The `ui` object */
|
||||||
|
var ui = {};
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers an event listener on an element.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {Element} element The element.
|
||||||
|
* @param {String} eventName The name of the event.
|
||||||
|
* @param {Function} handler The event handler.
|
||||||
|
* @returns {Element} The element.
|
||||||
|
*/
|
||||||
|
function addListener(element, eventName, handler) {
|
||||||
|
if (typeof element.addEventListener != 'undefined') {
|
||||||
|
element.addEventListener(eventName, handler, false);
|
||||||
|
} else if (typeof element.attachEvent != 'undefined') {
|
||||||
|
element.attachEvent('on' + eventName, handler);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
// expose Lo-Dash build file path
|
||||||
|
ui.buildPath = (function() {
|
||||||
|
switch (build) {
|
||||||
|
case 'lodash-dev': return 'lodash.js';
|
||||||
|
case 'lodash-underscore': return 'lodash.underscore.min.js';
|
||||||
|
case 'lodash-custom': return 'lodash.custom.min.js';
|
||||||
|
}
|
||||||
|
return 'lodash.min.js';
|
||||||
|
}());
|
||||||
|
|
||||||
|
// expose other library file path
|
||||||
|
ui.otherPath = (function() {
|
||||||
|
switch (other) {
|
||||||
|
case 'lodash-dev': return 'lodash.js';
|
||||||
|
case 'lodash-prod': return 'lodash.min.js';
|
||||||
|
case 'lodash-underscore': return 'lodash.underscore.min.js';
|
||||||
|
case 'lodash-custom': return 'lodash.custom.min.js';
|
||||||
|
case 'underscore-dev': return 'vendor/underscore/underscore.js';
|
||||||
|
}
|
||||||
|
return 'vendor/underscore/underscore-min.js';
|
||||||
|
}());
|
||||||
|
|
||||||
|
// initialize controls
|
||||||
|
addListener(window, 'load', function() {
|
||||||
|
function eventHandler(event) {
|
||||||
|
var search = location.search.replace(/^\?|&?(?:build|other)=[^&]*&?/g, '');
|
||||||
|
if (event.stopPropagation) {
|
||||||
|
event.stopPropagation();
|
||||||
|
} else {
|
||||||
|
event.cancelBubble = true;
|
||||||
|
}
|
||||||
|
location.href =
|
||||||
|
location.href.split('?')[0] + '?' +
|
||||||
|
(search ? search + '&' : '') +
|
||||||
|
'build=' + buildList[buildList.selectedIndex].value + '&' +
|
||||||
|
'other=' + otherList[otherList.selectedIndex].value;
|
||||||
|
}
|
||||||
|
|
||||||
|
var span1 = document.createElement('span');
|
||||||
|
span1.style.cssText = 'float:right';
|
||||||
|
span1.innerHTML =
|
||||||
|
'<label for="perf-build">Build: </label>' +
|
||||||
|
'<select id="perf-build">' +
|
||||||
|
'<option value="lodash-dev">Lo-Dash</option>' +
|
||||||
|
'<option value="lodash-prod">Lo-Dash (minified)</option>' +
|
||||||
|
'<option value="lodash-underscore">Lo-Dash (underscore)</option>' +
|
||||||
|
'<option value="lodash-custom">Lo-Dash (custom)</option>' +
|
||||||
|
'</select>';
|
||||||
|
|
||||||
|
var span2 = document.createElement('span');
|
||||||
|
span2.style.cssText = 'float:right';
|
||||||
|
span2.innerHTML =
|
||||||
|
'<label for="perf-other">Other Library: </label>' +
|
||||||
|
'<select id="perf-other">' +
|
||||||
|
'<option value="underscore-dev">Underscore</option>' +
|
||||||
|
'<option value="underscore-prod">Underscore (minified)</option>' +
|
||||||
|
'<option value="lodash-dev">Lo-Dash</option>' +
|
||||||
|
'<option value="lodash-prod">Lo-Dash (minified)</option>' +
|
||||||
|
'<option value="lodash-underscore">Lo-Dash (underscore)</option>' +
|
||||||
|
'<option value="lodash-custom">Lo-Dash (custom)</option>' +
|
||||||
|
'</select>';
|
||||||
|
|
||||||
|
var buildList = span1.lastChild,
|
||||||
|
otherList = span2.lastChild,
|
||||||
|
toolbar = document.getElementById('perf-toolbar');
|
||||||
|
|
||||||
|
toolbar.appendChild(span2);
|
||||||
|
toolbar.appendChild(span1);
|
||||||
|
|
||||||
|
buildList.selectedIndex = (function() {
|
||||||
|
switch (build) {
|
||||||
|
case 'lodash-dev': return 0;
|
||||||
|
case 'lodash-underscore': return 2;
|
||||||
|
case 'lodash-custom': return 3;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}());
|
||||||
|
|
||||||
|
otherList.selectedIndex = (function() {
|
||||||
|
switch (other) {
|
||||||
|
case 'underscore-dev': return 0;
|
||||||
|
case 'lodash-dev': return 2;
|
||||||
|
case 'lodash-prod': return 3;
|
||||||
|
case 'lodash-underscore': return 4;
|
||||||
|
case 'lodash-custom': return 5;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}());
|
||||||
|
|
||||||
|
addListener(buildList, 'change', eventHandler);
|
||||||
|
addListener(otherList, 'change', eventHandler);
|
||||||
|
});
|
||||||
|
|
||||||
|
// expose `ui`
|
||||||
|
window.ui = ui;
|
||||||
|
|
||||||
|
}(this));
|
||||||
573
perf/perf.js
573
perf/perf.js
File diff suppressed because it is too large
Load Diff
@@ -3,14 +3,11 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>Backbone Test Suite</title>
|
<title>Backbone Test Suite</title>
|
||||||
<link rel="stylesheet" href="../vendor/backbone/test/vendor/qunit.css">
|
<link rel="stylesheet" href="../vendor/qunit/qunit/qunit.css">
|
||||||
<style>
|
<style>
|
||||||
body > #qunit-header {
|
body > #qunit-header {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
#jslitmus {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@@ -21,9 +18,8 @@
|
|||||||
<h1>Test</h1>
|
<h1>Test</h1>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script src="../vendor/backbone/test/vendor/json2.js"></script>
|
<script src="../vendor/json3/lib/json3.js"></script>
|
||||||
<script src="../vendor/backbone/test/vendor/jquery-1.7.1.js"></script>
|
<script src="../vendor/jquery/jquery.js"></script>
|
||||||
<script src="../vendor/backbone/test/vendor/jslitmus.js"></script>
|
|
||||||
<script src="../vendor/platform.js/platform.js"></script>
|
<script src="../vendor/platform.js/platform.js"></script>
|
||||||
<script>
|
<script>
|
||||||
// avoid syntax errors for `QUnit.throws` in older Firefoxes
|
// avoid syntax errors for `QUnit.throws` in older Firefoxes
|
||||||
@@ -34,7 +30,7 @@
|
|||||||
</script>
|
</script>
|
||||||
<script src="test-ui.js"></script>
|
<script src="test-ui.js"></script>
|
||||||
<script>
|
<script>
|
||||||
document.write('<script src="../' + QUnit.config.lodashFilename + '.js"><\/script>');
|
document.write('<script src="../' + ui.buildPath + '"><\/script>');
|
||||||
</script>
|
</script>
|
||||||
<script src="../vendor/backbone/backbone.js"></script>
|
<script src="../vendor/backbone/backbone.js"></script>
|
||||||
<script src="../vendor/backbone/test/environment.js"></script>
|
<script src="../vendor/backbone/test/environment.js"></script>
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
Object.keys = function() { return []; };
|
Object.keys = function() { return []; };
|
||||||
|
|
||||||
// load Lo-Dash and expose it to the bad `Object.keys` shim
|
// load Lo-Dash and expose it to the bad `Object.keys` shim
|
||||||
document.write('<script src="../' + QUnit.config.lodashFilename + '.js"><\/script>');
|
document.write('<script src="../' + ui.buildPath + '"><\/script>');
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
// store Lo-Dash to test for bad shim detection
|
// store Lo-Dash to test for bad shim detection
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
delete Object._keys;
|
delete Object._keys;
|
||||||
|
|
||||||
// load Lo-Dash again to overwrite the existing `_` value
|
// load Lo-Dash again to overwrite the existing `_` value
|
||||||
document.write('<script src="../' + QUnit.config.lodashFilename + '.js"><\/script>');
|
document.write('<script src="../' + ui.buildPath + '"><\/script>');
|
||||||
|
|
||||||
// load test.js if not using require.js
|
// load test.js if not using require.js
|
||||||
document.write(QUnit.urlParams.norequire
|
document.write(QUnit.urlParams.norequire
|
||||||
@@ -47,20 +47,24 @@
|
|||||||
shimmedModule,
|
shimmedModule,
|
||||||
underscoreModule;
|
underscoreModule;
|
||||||
|
|
||||||
window.require && require({
|
window.require && require(
|
||||||
'baseUrl': '../vendor/requirejs/',
|
(function() {
|
||||||
'urlArgs': 't=' + (+new Date),
|
var modulePath = ui.buildPath.replace(/\.js$/, '');
|
||||||
'paths': {
|
return {
|
||||||
'lodash': '../../' + QUnit.config.lodashFilename,
|
'baseUrl': '../vendor/requirejs/',
|
||||||
'shimmed': './../../' + QUnit.config.lodashFilename,
|
'urlArgs': 't=' + (+new Date),
|
||||||
'underscore': '../underscore/../../' + QUnit.config.lodashFilename
|
'paths': {
|
||||||
},
|
'lodash': '../../' + modulePath,
|
||||||
'shim': {
|
'shimmed': './../../' + modulePath,
|
||||||
'shimmed': {
|
'underscore': '../underscore/../../' + modulePath
|
||||||
'exports': '_'
|
},
|
||||||
|
'shim': {
|
||||||
|
'shimmed': {
|
||||||
|
'exports': '_'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
},
|
}()),
|
||||||
['lodash', 'shimmed', 'underscore'], function(lodash, shimmed, underscore) {
|
['lodash', 'shimmed', 'underscore'], function(lodash, shimmed, underscore) {
|
||||||
if (lodash && lodash.noConflict) {
|
if (lodash && lodash.noConflict) {
|
||||||
lodashModule = lodash.noConflict();
|
lodashModule = lodash.noConflict();
|
||||||
|
|||||||
@@ -483,6 +483,29 @@
|
|||||||
|
|
||||||
equal(templates.a(data.a).replace(/[\r\n]+/g, ''), '<ul><li>moe</li><li>larry</li><li>curly</li></ul>', basename);
|
equal(templates.a(data.a).replace(/[\r\n]+/g, ''), '<ul><li>moe</li><li>larry</li><li>curly</li></ul>', basename);
|
||||||
equal(templates.b(data.b), 'Hello stooge.', basename);
|
equal(templates.b(data.b), 'Hello stooge.', basename);
|
||||||
|
delete _.templates;
|
||||||
|
start();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
asyncTest('`lodash template=*.jst` exports=amd', function() {
|
||||||
|
var start = _.after(2, _.once(QUnit.start));
|
||||||
|
|
||||||
|
build(['-s', 'template=' + templatePath + '/*.jst', 'exports=amd'], function(source, filePath) {
|
||||||
|
var basename = path.basename(filePath, '.js'),
|
||||||
|
context = createContext(),
|
||||||
|
pass = false;
|
||||||
|
|
||||||
|
(context.define = function(requires, factory) {
|
||||||
|
factory(_);
|
||||||
|
var templates = _.templates;
|
||||||
|
pass = 'a' in templates && 'b' in templates;
|
||||||
|
})
|
||||||
|
.amd = {};
|
||||||
|
|
||||||
|
vm.runInContext(source, context);
|
||||||
|
ok(pass, basename);
|
||||||
|
delete _.templates;
|
||||||
start();
|
start();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -551,9 +574,9 @@
|
|||||||
QUnit.module('strict modifier');
|
QUnit.module('strict modifier');
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
var object = Object.create(Object.prototype, {
|
var object = Object.freeze({
|
||||||
'a': { 'value': _.identify },
|
'a': _.identity,
|
||||||
'b': { 'value': null }
|
'b': null
|
||||||
});
|
});
|
||||||
|
|
||||||
['non-strict', 'strict'].forEach(function(strictMode, index) {
|
['non-strict', 'strict'].forEach(function(strictMode, index) {
|
||||||
@@ -566,20 +589,26 @@
|
|||||||
}
|
}
|
||||||
build(commands, function(source, filePath) {
|
build(commands, function(source, filePath) {
|
||||||
var basename = path.basename(filePath, '.js'),
|
var basename = path.basename(filePath, '.js'),
|
||||||
context = createContext(),
|
context = createContext();
|
||||||
pass = !index;
|
|
||||||
|
|
||||||
vm.runInContext(source, context);
|
vm.runInContext(source, context);
|
||||||
var lodash = context._;
|
var lodash = context._;
|
||||||
|
|
||||||
try {
|
var actual = _.every([
|
||||||
lodash.bindAll(object);
|
function() { lodash.bindAll(object); },
|
||||||
lodash.extend(object, { 'a': 1 });
|
function() { lodash.extend(object, { 'a': 1 }); },
|
||||||
lodash.defaults(object, { 'b': 2 });
|
function() { lodash.defaults(object, { 'b': 2 }); }
|
||||||
} catch(e) {
|
], function(fn) {
|
||||||
pass = !!index;
|
var pass = !index;
|
||||||
}
|
try {
|
||||||
equal(pass, true, basename);
|
fn();
|
||||||
|
} catch(e) {
|
||||||
|
pass = !!index;
|
||||||
|
}
|
||||||
|
return pass;
|
||||||
|
});
|
||||||
|
|
||||||
|
equal(actual, true, basename);
|
||||||
start();
|
start();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -608,13 +637,50 @@
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
equal(last.value, 2, '_.each: ' + basename);
|
|
||||||
equal(lodash.isEmpty('moe'), false, '_.isEmpty: ' + basename);
|
|
||||||
|
|
||||||
var object = { 'fn': lodash.bind(function(x) { return this.x + x; }, { 'x': 1 }, 1) };
|
var object = { 'fn': lodash.bind(function(x) { return this.x + x; }, { 'x': 1 }, 1) };
|
||||||
equal(object.fn(), 2, '_.bind: ' + basename);
|
equal(object.fn(), 2, '_.bind: ' + basename);
|
||||||
|
|
||||||
ok(lodash.clone(array, true)[0] === array[0], '_.clone: ' + basename);
|
ok(lodash.clone(array, true)[0] === array[0], '_.clone: ' + basename);
|
||||||
|
equal(last.value, 2, '_.each: ' + basename);
|
||||||
|
equal(lodash.every([true, false, true]), false, '_.every: ' + basename);
|
||||||
|
|
||||||
|
object = { 'length': 0, 'splice': Array.prototype.splice };
|
||||||
|
equal(lodash.isEmpty(object), false, '_.isEmpty: ' + basename);
|
||||||
|
|
||||||
|
// avoid issues comparing objects with `deepEqual`
|
||||||
|
object = { 'a': 1, 'b': 2, 'c': 3 };
|
||||||
|
var actual = lodash.omit(object, function(value) { return value == 3; });
|
||||||
|
deepEqual(_.keys(actual).sort(), ['a', 'b', 'c'], '_.omit: ' + basename);
|
||||||
|
|
||||||
|
actual = lodash.pick(object, function(value) { return value != 3; });
|
||||||
|
deepEqual(_.keys(actual), [], '_.pick: ' + basename);
|
||||||
|
|
||||||
|
equal(lodash.some([false, true, false]), true, '_.some: ' + basename);
|
||||||
|
start();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
asyncTest('should not have any Lo-Dash-only methods', function() {
|
||||||
|
var start = _.after(2, _.once(QUnit.start));
|
||||||
|
|
||||||
|
build(['-s', 'underscore'], function(source, filePath) {
|
||||||
|
var basename = path.basename(filePath, '.js'),
|
||||||
|
context = createContext();
|
||||||
|
|
||||||
|
vm.runInContext(source, context);
|
||||||
|
var lodash = context._;
|
||||||
|
|
||||||
|
_.each([
|
||||||
|
'forIn',
|
||||||
|
'forOwn',
|
||||||
|
'isPlainObject',
|
||||||
|
'lateBind',
|
||||||
|
'merge',
|
||||||
|
'partial'
|
||||||
|
], function(methodName) {
|
||||||
|
equal(lodash[methodName], undefined, '_.' + methodName + ' exists: ' + basename);
|
||||||
|
});
|
||||||
|
|
||||||
start();
|
start();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -10,16 +10,20 @@
|
|||||||
/** A flag to determine if RequireJS should be loaded */
|
/** A flag to determine if RequireJS should be loaded */
|
||||||
var norequire = /[?&]norequire=true(?:&|$)/.test(location.search);
|
var norequire = /[?&]norequire=true(?:&|$)/.test(location.search);
|
||||||
|
|
||||||
|
/** The `ui` object */
|
||||||
|
var ui = {};
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
// assign `QUnit.config` properties
|
// expose Lo-Dash build file path
|
||||||
QUnit.config.lodashFilename = (function() {
|
ui.buildPath = (function() {
|
||||||
switch (build) {
|
switch (build) {
|
||||||
case 'prod': return 'lodash.min';
|
case 'lodash-prod': return 'lodash.min.js';
|
||||||
case 'custom': return 'lodash.custom.min';
|
case 'lodash-underscore': return 'lodash.underscore.min.js';
|
||||||
case 'custom-debug': return 'lodash.custom';
|
case 'lodash-custom': return 'lodash.custom.min.js';
|
||||||
|
case 'lodash-custom-debug': return 'lodash.custom.js';
|
||||||
}
|
}
|
||||||
return 'lodash';
|
return 'lodash.js';
|
||||||
}());
|
}());
|
||||||
|
|
||||||
// assign `QUnit.urlParams` properties
|
// assign `QUnit.urlParams` properties
|
||||||
@@ -28,7 +32,7 @@
|
|||||||
'norequire': norequire
|
'norequire': norequire
|
||||||
});
|
});
|
||||||
|
|
||||||
// initialize the build dropdown
|
// initialize controls
|
||||||
addEvent(window, 'load', function() {
|
addEvent(window, 'load', function() {
|
||||||
function eventHandler(event) {
|
function eventHandler(event) {
|
||||||
var search = location.search.replace(/^\?|&?(?:build|norequire)=[^&]*&?/g, '');
|
var search = location.search.replace(/^\?|&?(?:build|norequire)=[^&]*&?/g, '');
|
||||||
@@ -39,8 +43,8 @@
|
|||||||
}
|
}
|
||||||
location.href =
|
location.href =
|
||||||
location.href.split('?')[0] + '?' +
|
location.href.split('?')[0] + '?' +
|
||||||
(search ? search + '&' : '') + 'build=' +
|
(search ? search + '&' : '') +
|
||||||
dropdown[dropdown.selectedIndex].value +
|
'build=' + buildList[buildList.selectedIndex].value +
|
||||||
(checkbox.checked ? '&norequire=true' : '');
|
(checkbox.checked ? '&norequire=true' : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,18 +54,19 @@
|
|||||||
toolbar.appendChild(span1);
|
toolbar.appendChild(span1);
|
||||||
toolbar.appendChild(span2);
|
toolbar.appendChild(span2);
|
||||||
|
|
||||||
dropdown.selectedIndex = (function() {
|
buildList.selectedIndex = (function() {
|
||||||
switch (build) {
|
switch (build) {
|
||||||
case 'prod': return 1;
|
case 'lodash-prod': return 1;
|
||||||
case 'custom': return 2;
|
case 'lodash-underscore': return 2;
|
||||||
case 'custom-debug': return 3;
|
case 'lodash-custom': return 3;
|
||||||
|
case 'lodash-custom-debug': return 4;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}());
|
}());
|
||||||
|
|
||||||
checkbox.checked = norequire;
|
checkbox.checked = norequire;
|
||||||
addEvent(checkbox, 'click', eventHandler);
|
addEvent(checkbox, 'click', eventHandler);
|
||||||
addEvent(dropdown, 'change', eventHandler);
|
addEvent(buildList, 'change', eventHandler);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
setTimeout(init, 15);
|
setTimeout(init, 15);
|
||||||
@@ -78,16 +83,20 @@
|
|||||||
span2.innerHTML =
|
span2.innerHTML =
|
||||||
'<label for="qunit-build">Build: </label>' +
|
'<label for="qunit-build">Build: </label>' +
|
||||||
'<select id="qunit-build">' +
|
'<select id="qunit-build">' +
|
||||||
'<option value="dev">Developement</option>' +
|
'<option value="lodash-dev">Developement</option>' +
|
||||||
'<option value="prod">Production</option>' +
|
'<option value="lodash-prod">Production</option>' +
|
||||||
'<option value="custom">Custom</option>' +
|
'<option value="lodash-underscore">Underscore</option>' +
|
||||||
'<option value="custom-debug">Custom (debug)</option>' +
|
'<option value="lodash-custom">Custom</option>' +
|
||||||
|
'<option value="lodash-custom-debug">Custom (debug)</option>' +
|
||||||
'</select>';
|
'</select>';
|
||||||
|
|
||||||
var checkbox = span1.firstChild,
|
var checkbox = span1.firstChild,
|
||||||
dropdown = span2.lastChild;
|
buildList = span2.lastChild;
|
||||||
|
|
||||||
init();
|
init();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// expose `ui`
|
||||||
|
window.ui = ui;
|
||||||
|
|
||||||
}(this));
|
}(this));
|
||||||
|
|||||||
48
test/test.js
48
test/test.js
@@ -41,6 +41,14 @@
|
|||||||
/** Shortcut used to make object properties immutable */
|
/** Shortcut used to make object properties immutable */
|
||||||
var freeze = Object.freeze;
|
var freeze = Object.freeze;
|
||||||
|
|
||||||
|
/** Used to set property descriptors */
|
||||||
|
var setDescriptor = (function(fn) {
|
||||||
|
try {
|
||||||
|
var o = {};
|
||||||
|
return fn(o, o, o) && fn;
|
||||||
|
} catch(e) { }
|
||||||
|
}(Object.defineProperty));
|
||||||
|
|
||||||
/** Shortcut used to convert array-like objects to arrays */
|
/** Shortcut used to convert array-like objects to arrays */
|
||||||
var slice = [].slice;
|
var slice = [].slice;
|
||||||
|
|
||||||
@@ -105,16 +113,6 @@
|
|||||||
QUnit.module('lodash');
|
QUnit.module('lodash');
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
// ensure this test is executed before any other template tests to avoid false positives
|
|
||||||
test('should initialize `reEvaluateDelimiter` (test with production build)', function() {
|
|
||||||
var data = { 'a': [1, 2] },
|
|
||||||
settings = _.templateSettings;
|
|
||||||
|
|
||||||
_.templateSettings = { 'interpolate': /\{\{(.+?)\}\}/g };
|
|
||||||
equal(_.template('{{ a.join(",") }}', data), '1,2');
|
|
||||||
_.templateSettings = settings;
|
|
||||||
});
|
|
||||||
|
|
||||||
test('supports loading lodash.js as the "lodash" module', function() {
|
test('supports loading lodash.js as the "lodash" module', function() {
|
||||||
if (window.document && window.require) {
|
if (window.document && window.require) {
|
||||||
equal((lodashModule || {}).moduleName, 'lodash');
|
equal((lodashModule || {}).moduleName, 'lodash');
|
||||||
@@ -947,6 +945,29 @@
|
|||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
QUnit.module('lodash.map');
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
test('should return the correct result when iterating an object', function() {
|
||||||
|
var actual = _.map({ 'a': 1, 'b': 2, 'c': 3 }, function(value) {
|
||||||
|
return value;
|
||||||
|
});
|
||||||
|
deepEqual(actual, [1, 2, 3]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('should handle object arguments with non-numeric length properties', function() {
|
||||||
|
if (setDescriptor) {
|
||||||
|
var object = {};
|
||||||
|
setDescriptor(object, 'length', { 'value': 'x' });
|
||||||
|
deepEqual(_.map(object, _.identity), []);
|
||||||
|
} else {
|
||||||
|
skipTest();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}());
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
QUnit.module('lodash.max and lodash.min object iteration');
|
QUnit.module('lodash.max and lodash.min object iteration');
|
||||||
|
|
||||||
_.each(['max', 'min'], function(methodName) {
|
_.each(['max', 'min'], function(methodName) {
|
||||||
@@ -1739,6 +1760,10 @@
|
|||||||
|
|
||||||
deepEqual(_.where(collection, { 'a': 1 }), [{ 'a': 1 }, { 'a': 1, 'b': 2 }]);
|
deepEqual(_.where(collection, { 'a': 1 }), [{ 'a': 1 }, { 'a': 1, 'b': 2 }]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('should return an empty array when passed an empty `properties` object', function() {
|
||||||
|
deepEqual(_.where(array, {}), []);
|
||||||
|
});
|
||||||
}());
|
}());
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
@@ -1790,7 +1815,6 @@
|
|||||||
var funcs = _.without.apply(_, [_.functions(_)].concat([
|
var funcs = _.without.apply(_, [_.functions(_)].concat([
|
||||||
'_',
|
'_',
|
||||||
'_iteratorTemplate',
|
'_iteratorTemplate',
|
||||||
'_shimKeys',
|
|
||||||
'after',
|
'after',
|
||||||
'bind',
|
'bind',
|
||||||
'bindAll',
|
'bindAll',
|
||||||
@@ -1823,8 +1847,6 @@
|
|||||||
|
|
||||||
if (_.indexOf(returnArrays, methodName) > -1) {
|
if (_.indexOf(returnArrays, methodName) > -1) {
|
||||||
deepEqual(actual, expected, '_.' + methodName + ' returns an array');
|
deepEqual(actual, expected, '_.' + methodName + ' returns an array');
|
||||||
} else {
|
|
||||||
skipTest(falsey.length);
|
|
||||||
}
|
}
|
||||||
ok(pass, '_.' + methodName + ' allows falsey arguments');
|
ok(pass, '_.' + methodName + ' allows falsey arguments');
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>Underscore Test Suite</title>
|
<title>Underscore Test Suite</title>
|
||||||
<link rel="stylesheet" href="../vendor/underscore/test/vendor/qunit.css">
|
<link rel="stylesheet" href="../vendor/qunit/qunit/qunit.css">
|
||||||
<style>
|
<style>
|
||||||
#jslitmus, iframe {
|
iframe, img {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -17,10 +17,10 @@
|
|||||||
<div id="id1"></div>
|
<div id="id1"></div>
|
||||||
<div id="id2"></div>
|
<div id="id2"></div>
|
||||||
</div>
|
</div>
|
||||||
|
<img id="chart_image" src="data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==">
|
||||||
</div>
|
</div>
|
||||||
<script src="../vendor/backbone/test/vendor/json2.js"></script>
|
<script src="../vendor/json3/lib/json3.js"></script>
|
||||||
<script src="../vendor/underscore/test/vendor/jquery.js"></script>
|
<script src="../vendor/jquery/jquery.js"></script>
|
||||||
<script src="../vendor/underscore/test/vendor/jslitmus.js"></script>
|
|
||||||
<script src="../vendor/platform.js/platform.js"></script>
|
<script src="../vendor/platform.js/platform.js"></script>
|
||||||
<script>
|
<script>
|
||||||
// avoid syntax errors for `QUnit.throws` in older Firefoxes
|
// avoid syntax errors for `QUnit.throws` in older Firefoxes
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
</script>
|
</script>
|
||||||
<script src="test-ui.js"></script>
|
<script src="test-ui.js"></script>
|
||||||
<script>
|
<script>
|
||||||
document.write('<script src="../' + QUnit.config.lodashFilename + '.js"><\/script>');
|
document.write('<script src="../' + ui.buildPath + '"><\/script>');
|
||||||
</script>
|
</script>
|
||||||
<script src="../vendor/underscore/test/collections.js"></script>
|
<script src="../vendor/underscore/test/collections.js"></script>
|
||||||
<script src="../vendor/underscore/test/arrays.js"></script>
|
<script src="../vendor/underscore/test/arrays.js"></script>
|
||||||
|
|||||||
43
vendor/backbone/backbone.js
vendored
43
vendor/backbone/backbone.js
vendored
@@ -10,7 +10,7 @@
|
|||||||
// Initial Setup
|
// Initial Setup
|
||||||
// -------------
|
// -------------
|
||||||
|
|
||||||
// Save a reference to the global object (`window` in the browser, `global`
|
// Save a reference to the global object (`window` in the browser, `exports`
|
||||||
// on the server).
|
// on the server).
|
||||||
var root = this;
|
var root = this;
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@
|
|||||||
Backbone.emulateJSON = false;
|
Backbone.emulateJSON = false;
|
||||||
|
|
||||||
// Backbone.Events
|
// Backbone.Events
|
||||||
// -----------------
|
// ---------------
|
||||||
|
|
||||||
// Regular expression used to split event strings
|
// Regular expression used to split event strings
|
||||||
var eventSplitter = /\s+/;
|
var eventSplitter = /\s+/;
|
||||||
@@ -185,7 +185,7 @@
|
|||||||
var defaults;
|
var defaults;
|
||||||
var attrs = attributes || {};
|
var attrs = attributes || {};
|
||||||
if (options && options.collection) this.collection = options.collection;
|
if (options && options.collection) this.collection = options.collection;
|
||||||
if (options && options.parse) attributes = this.parse(attributes);
|
if (options && options.parse) attrs = this.parse(attrs);
|
||||||
if (defaults = _.result(this, 'defaults')) {
|
if (defaults = _.result(this, 'defaults')) {
|
||||||
attrs = _.extend({}, defaults, attrs);
|
attrs = _.extend({}, defaults, attrs);
|
||||||
}
|
}
|
||||||
@@ -892,7 +892,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Backbone.Router
|
// Backbone.Router
|
||||||
// -------------------
|
// ---------------
|
||||||
|
|
||||||
// Routers map faux-URLs to actions, and fire events when routes are
|
// Routers map faux-URLs to actions, and fire events when routes are
|
||||||
// matched. Creating a new one sets its `routes` hash, if not set statically.
|
// matched. Creating a new one sets its `routes` hash, if not set statically.
|
||||||
@@ -946,12 +946,10 @@
|
|||||||
// routes can be defined at the bottom of the route map.
|
// routes can be defined at the bottom of the route map.
|
||||||
_bindRoutes: function() {
|
_bindRoutes: function() {
|
||||||
if (!this.routes) return;
|
if (!this.routes) return;
|
||||||
var routes = [];
|
var route, routes = _.keys(this.routes);
|
||||||
for (var route in this.routes) {
|
while ((route = routes.pop()) != null) {
|
||||||
routes.unshift([route, this.routes[route]]);
|
var name = this.routes[route];
|
||||||
}
|
this.route(route, name, this[name]);
|
||||||
for (var i = 0, l = routes.length; i < l; i++) {
|
|
||||||
this.route(routes[i][0], routes[i][1], this[routes[i][1]]);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -1315,10 +1313,7 @@
|
|||||||
// attached directly to the view.
|
// attached directly to the view.
|
||||||
_configure: function(options) {
|
_configure: function(options) {
|
||||||
if (this.options) options = _.extend({}, this.options, options);
|
if (this.options) options = _.extend({}, this.options, options);
|
||||||
for (var i = 0, l = viewOptions.length; i < l; i++) {
|
_.extend(this, _.pick(options, viewOptions));
|
||||||
var attr = viewOptions[i];
|
|
||||||
if (options[attr]) this[attr] = options[attr];
|
|
||||||
}
|
|
||||||
this.options = options;
|
this.options = options;
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -1393,14 +1388,14 @@
|
|||||||
|
|
||||||
// For older servers, emulate HTTP by mimicking the HTTP method with `_method`
|
// For older servers, emulate HTTP by mimicking the HTTP method with `_method`
|
||||||
// And an `X-HTTP-Method-Override` header.
|
// And an `X-HTTP-Method-Override` header.
|
||||||
if (Backbone.emulateHTTP) {
|
if (Backbone.emulateHTTP && (type === 'PUT' || type === 'DELETE')) {
|
||||||
if (type === 'PUT' || type === 'DELETE') {
|
params.type = 'POST';
|
||||||
if (Backbone.emulateJSON) params.data._method = type;
|
if (Backbone.emulateJSON) params.data._method = type;
|
||||||
params.type = 'POST';
|
var beforeSend = options.beforeSend;
|
||||||
params.beforeSend = function(xhr) {
|
options.beforeSend = function(xhr) {
|
||||||
xhr.setRequestHeader('X-HTTP-Method-Override', type);
|
xhr.setRequestHeader('X-HTTP-Method-Override', type);
|
||||||
};
|
if (beforeSend) return beforeSend.apply(this, arguments);
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't process data on a non-GET request.
|
// Don't process data on a non-GET request.
|
||||||
@@ -1468,8 +1463,8 @@
|
|||||||
return child;
|
return child;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Set up inheritance for the model, collection, router, and view.
|
// Set up inheritance for the model, collection, router, view and history.
|
||||||
Model.extend = Collection.extend = Router.extend = View.extend = extend;
|
Model.extend = Collection.extend = Router.extend = View.extend = History.extend = extend;
|
||||||
|
|
||||||
// Throw an error when a URL is needed, and none is supplied.
|
// Throw an error when a URL is needed, and none is supplied.
|
||||||
var urlError = function() {
|
var urlError = function() {
|
||||||
|
|||||||
11
vendor/backbone/test/model.js
vendored
11
vendor/backbone/test/model.js
vendored
@@ -55,6 +55,17 @@ $(document).ready(function() {
|
|||||||
equal(model.get('value'), 2);
|
equal(model.get('value'), 2);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("parse can return null", 1, function() {
|
||||||
|
var Model = Backbone.Model.extend({
|
||||||
|
parse: function(obj) {
|
||||||
|
obj.value += 1;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
var model = new Model({value: 1}, {parse: true});
|
||||||
|
equal(JSON.stringify(model.toJSON()), "{}");
|
||||||
|
});
|
||||||
|
|
||||||
test("url", 3, function() {
|
test("url", 3, function() {
|
||||||
doc.urlRoot = null;
|
doc.urlRoot = null;
|
||||||
equal(doc.url(), '/collection/1-the-tempest');
|
equal(doc.url(), '/collection/1-the-tempest');
|
||||||
|
|||||||
11
vendor/backbone/test/router.js
vendored
11
vendor/backbone/test/router.js
vendored
@@ -481,4 +481,15 @@ $(document).ready(function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("#1746 - Router allows empty route.", 1, function() {
|
||||||
|
var Router = Backbone.Router.extend({
|
||||||
|
routes: {'': 'empty'},
|
||||||
|
empty: function(){},
|
||||||
|
route: function(route){
|
||||||
|
strictEqual(route, '');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
new Router;
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
24
vendor/backbone/test/sync.js
vendored
24
vendor/backbone/test/sync.js
vendored
@@ -17,6 +17,11 @@ $(document).ready(function() {
|
|||||||
Environment.prototype.setup.apply(this, arguments);
|
Environment.prototype.setup.apply(this, arguments);
|
||||||
library = new Library;
|
library = new Library;
|
||||||
library.create(attrs, {wait: false});
|
library.create(attrs, {wait: false});
|
||||||
|
},
|
||||||
|
|
||||||
|
teardown: function() {
|
||||||
|
Environment.prototype.teardown.apply(this, arguments);
|
||||||
|
Backbone.emulateHTTP = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}));
|
}));
|
||||||
@@ -157,4 +162,23 @@ $(document).ready(function() {
|
|||||||
this.ajaxSettings.error();
|
this.ajaxSettings.error();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("#1756 - Call user provided beforeSend function.", 4, function() {
|
||||||
|
Backbone.emulateHTTP = true;
|
||||||
|
var model = new Backbone.Model;
|
||||||
|
model.url = '/test';
|
||||||
|
var xhr = {
|
||||||
|
setRequestHeader: function(header, value) {
|
||||||
|
strictEqual(header, 'X-HTTP-Method-Override');
|
||||||
|
strictEqual(value, 'DELETE');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
model.sync('delete', model, {
|
||||||
|
beforeSend: function(_xhr) {
|
||||||
|
ok(_xhr === xhr);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
strictEqual(this.ajaxSettings.beforeSend(xhr), false);
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
9266
vendor/backbone/test/vendor/jquery-1.7.1.js
vendored
9266
vendor/backbone/test/vendor/jquery-1.7.1.js
vendored
File diff suppressed because it is too large
Load Diff
649
vendor/backbone/test/vendor/jslitmus.js
vendored
649
vendor/backbone/test/vendor/jslitmus.js
vendored
@@ -1,649 +0,0 @@
|
|||||||
// JSLitmus.js
|
|
||||||
//
|
|
||||||
// Copyright (c) 2010, Robert Kieffer, http://broofa.com
|
|
||||||
// Available under MIT license (http://en.wikipedia.org/wiki/MIT_License)
|
|
||||||
|
|
||||||
(function() {
|
|
||||||
// Private methods and state
|
|
||||||
|
|
||||||
// Get platform info but don't go crazy trying to recognize everything
|
|
||||||
// that's out there. This is just for the major platforms and OSes.
|
|
||||||
var platform = 'unknown platform', ua = navigator.userAgent;
|
|
||||||
|
|
||||||
// Detect OS
|
|
||||||
var oses = ['Windows','iPhone OS','(Intel |PPC )?Mac OS X','Linux'].join('|');
|
|
||||||
var pOS = new RegExp('((' + oses + ') [^ \);]*)').test(ua) ? RegExp.$1 : null;
|
|
||||||
if (!pOS) pOS = new RegExp('((' + oses + ')[^ \);]*)').test(ua) ? RegExp.$1 : null;
|
|
||||||
|
|
||||||
// Detect browser
|
|
||||||
var pName = /(Chrome|MSIE|Safari|Opera|Firefox)/.test(ua) ? RegExp.$1 : null;
|
|
||||||
|
|
||||||
// Detect version
|
|
||||||
var vre = new RegExp('(Version|' + pName + ')[ \/]([^ ;]*)');
|
|
||||||
var pVersion = (pName && vre.test(ua)) ? RegExp.$2 : null;
|
|
||||||
var platform = (pOS && pName && pVersion) ? pName + ' ' + pVersion + ' on ' + pOS : 'unknown platform';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A smattering of methods that are needed to implement the JSLitmus testbed.
|
|
||||||
*/
|
|
||||||
var jsl = {
|
|
||||||
/**
|
|
||||||
* Enhanced version of escape()
|
|
||||||
*/
|
|
||||||
escape: function(s) {
|
|
||||||
s = s.replace(/,/g, '\\,');
|
|
||||||
s = escape(s);
|
|
||||||
s = s.replace(/\+/g, '%2b');
|
|
||||||
s = s.replace(/ /g, '+');
|
|
||||||
return s;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get an element by ID.
|
|
||||||
*/
|
|
||||||
$: function(id) {
|
|
||||||
return document.getElementById(id);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Null function
|
|
||||||
*/
|
|
||||||
F: function() {},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the status shown in the UI
|
|
||||||
*/
|
|
||||||
status: function(msg) {
|
|
||||||
var el = jsl.$('jsl_status');
|
|
||||||
if (el) el.innerHTML = msg || '';
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert a number to an abbreviated string like, "15K" or "10M"
|
|
||||||
*/
|
|
||||||
toLabel: function(n) {
|
|
||||||
if (n == Infinity) {
|
|
||||||
return 'Infinity';
|
|
||||||
} else if (n > 1e9) {
|
|
||||||
n = Math.round(n/1e8);
|
|
||||||
return n/10 + 'B';
|
|
||||||
} else if (n > 1e6) {
|
|
||||||
n = Math.round(n/1e5);
|
|
||||||
return n/10 + 'M';
|
|
||||||
} else if (n > 1e3) {
|
|
||||||
n = Math.round(n/1e2);
|
|
||||||
return n/10 + 'K';
|
|
||||||
}
|
|
||||||
return n;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Copy properties from src to dst
|
|
||||||
*/
|
|
||||||
extend: function(dst, src) {
|
|
||||||
for (var k in src) dst[k] = src[k]; return dst;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Like Array.join(), but for the key-value pairs in an object
|
|
||||||
*/
|
|
||||||
join: function(o, delimit1, delimit2) {
|
|
||||||
if (o.join) return o.join(delimit1); // If it's an array
|
|
||||||
var pairs = [];
|
|
||||||
for (var k in o) pairs.push(k + delimit1 + o[k]);
|
|
||||||
return pairs.join(delimit2);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Array#indexOf isn't supported in IE, so we use this as a cross-browser solution
|
|
||||||
*/
|
|
||||||
indexOf: function(arr, o) {
|
|
||||||
if (arr.indexOf) return arr.indexOf(o);
|
|
||||||
for (var i = 0; i < this.length; i++) if (arr[i] === o) return i;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test manages a single test (created with
|
|
||||||
* JSLitmus.test())
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
var Test = function (name, f) {
|
|
||||||
if (!f) throw new Error('Undefined test function');
|
|
||||||
if (!/function[^\(]*\(([^,\)]*)/.test(f.toString())) {
|
|
||||||
throw new Error('"' + name + '" test: Test is not a valid Function object');
|
|
||||||
}
|
|
||||||
this.loopArg = RegExp.$1;
|
|
||||||
this.name = name;
|
|
||||||
this.f = f;
|
|
||||||
};
|
|
||||||
|
|
||||||
jsl.extend(Test, /** @lends Test */ {
|
|
||||||
/** Calibration tests for establishing iteration loop overhead */
|
|
||||||
CALIBRATIONS: [
|
|
||||||
new Test('calibrating loop', function(count) {while (count--);}),
|
|
||||||
new Test('calibrating function', jsl.F)
|
|
||||||
],
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Run calibration tests. Returns true if calibrations are not yet
|
|
||||||
* complete (in which case calling code should run the tests yet again).
|
|
||||||
* onCalibrated - Callback to invoke when calibrations have finished
|
|
||||||
*/
|
|
||||||
calibrate: function(onCalibrated) {
|
|
||||||
for (var i = 0; i < Test.CALIBRATIONS.length; i++) {
|
|
||||||
var cal = Test.CALIBRATIONS[i];
|
|
||||||
if (cal.running) return true;
|
|
||||||
if (!cal.count) {
|
|
||||||
cal.isCalibration = true;
|
|
||||||
cal.onStop = onCalibrated;
|
|
||||||
//cal.MIN_TIME = .1; // Do calibrations quickly
|
|
||||||
cal.run(2e4);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
jsl.extend(Test.prototype, {/** @lends Test.prototype */
|
|
||||||
/** Initial number of iterations */
|
|
||||||
INIT_COUNT: 10,
|
|
||||||
/** Max iterations allowed (i.e. used to detect bad looping functions) */
|
|
||||||
MAX_COUNT: 1e9,
|
|
||||||
/** Minimum time a test should take to get valid results (secs) */
|
|
||||||
MIN_TIME: .5,
|
|
||||||
|
|
||||||
/** Callback invoked when test state changes */
|
|
||||||
onChange: jsl.F,
|
|
||||||
|
|
||||||
/** Callback invoked when test is finished */
|
|
||||||
onStop: jsl.F,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reset test state
|
|
||||||
*/
|
|
||||||
reset: function() {
|
|
||||||
delete this.count;
|
|
||||||
delete this.time;
|
|
||||||
delete this.running;
|
|
||||||
delete this.error;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Run the test (in a timeout). We use a timeout to make sure the browser
|
|
||||||
* has a chance to finish rendering any UI changes we've made, like
|
|
||||||
* updating the status message.
|
|
||||||
*/
|
|
||||||
run: function(count) {
|
|
||||||
count = count || this.INIT_COUNT;
|
|
||||||
jsl.status(this.name + ' x ' + count);
|
|
||||||
this.running = true;
|
|
||||||
var me = this;
|
|
||||||
setTimeout(function() {me._run(count);}, 200);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The nuts and bolts code that actually runs a test
|
|
||||||
*/
|
|
||||||
_run: function(count) {
|
|
||||||
var me = this;
|
|
||||||
|
|
||||||
// Make sure calibration tests have run
|
|
||||||
if (!me.isCalibration && Test.calibrate(function() {me.run(count);})) return;
|
|
||||||
this.error = null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
var start, f = this.f, now, i = count;
|
|
||||||
|
|
||||||
// Start the timer
|
|
||||||
start = new Date();
|
|
||||||
|
|
||||||
// Now for the money shot. If this is a looping function ...
|
|
||||||
if (this.loopArg) {
|
|
||||||
// ... let it do the iteration itself
|
|
||||||
f(count);
|
|
||||||
} else {
|
|
||||||
// ... otherwise do the iteration for it
|
|
||||||
while (i--) f();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get time test took (in secs)
|
|
||||||
this.time = Math.max(1,new Date() - start)/1000;
|
|
||||||
|
|
||||||
// Store iteration count and per-operation time taken
|
|
||||||
this.count = count;
|
|
||||||
this.period = this.time/count;
|
|
||||||
|
|
||||||
// Do we need to do another run?
|
|
||||||
this.running = this.time <= this.MIN_TIME;
|
|
||||||
|
|
||||||
// ... if so, compute how many times we should iterate
|
|
||||||
if (this.running) {
|
|
||||||
// Bump the count to the nearest power of 2
|
|
||||||
var x = this.MIN_TIME/this.time;
|
|
||||||
var pow = Math.pow(2, Math.max(1, Math.ceil(Math.log(x)/Math.log(2))));
|
|
||||||
count *= pow;
|
|
||||||
if (count > this.MAX_COUNT) {
|
|
||||||
throw new Error('Max count exceeded. If this test uses a looping function, make sure the iteration loop is working properly.');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
// Exceptions are caught and displayed in the test UI
|
|
||||||
this.reset();
|
|
||||||
this.error = e;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Figure out what to do next
|
|
||||||
if (this.running) {
|
|
||||||
me.run(count);
|
|
||||||
} else {
|
|
||||||
jsl.status('');
|
|
||||||
me.onStop(me);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Finish up
|
|
||||||
this.onChange(this);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the number of operations per second for this test.
|
|
||||||
*
|
|
||||||
* @param normalize if true, iteration loop overhead taken into account
|
|
||||||
*/
|
|
||||||
getHz: function(/**Boolean*/ normalize) {
|
|
||||||
var p = this.period;
|
|
||||||
|
|
||||||
// Adjust period based on the calibration test time
|
|
||||||
if (normalize && !this.isCalibration) {
|
|
||||||
var cal = Test.CALIBRATIONS[this.loopArg ? 0 : 1];
|
|
||||||
|
|
||||||
// If the period is within 20% of the calibration time, then zero the
|
|
||||||
// it out
|
|
||||||
p = p < cal.period*1.2 ? 0 : p - cal.period;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Math.round(1/p);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a friendly string describing the test
|
|
||||||
*/
|
|
||||||
toString: function() {
|
|
||||||
return this.name + ' - ' + this.time/this.count + ' secs';
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// CSS we need for the UI
|
|
||||||
var STYLESHEET = '<style> \
|
|
||||||
#jslitmus {font-family:sans-serif; font-size: 12px;} \
|
|
||||||
#jslitmus a {text-decoration: none;} \
|
|
||||||
#jslitmus a:hover {text-decoration: underline;} \
|
|
||||||
#jsl_status { \
|
|
||||||
margin-top: 10px; \
|
|
||||||
font-size: 10px; \
|
|
||||||
color: #888; \
|
|
||||||
} \
|
|
||||||
A IMG {border:none} \
|
|
||||||
#test_results { \
|
|
||||||
margin-top: 10px; \
|
|
||||||
font-size: 12px; \
|
|
||||||
font-family: sans-serif; \
|
|
||||||
border-collapse: collapse; \
|
|
||||||
border-spacing: 0px; \
|
|
||||||
} \
|
|
||||||
#test_results th, #test_results td { \
|
|
||||||
border: solid 1px #ccc; \
|
|
||||||
vertical-align: top; \
|
|
||||||
padding: 3px; \
|
|
||||||
} \
|
|
||||||
#test_results th { \
|
|
||||||
vertical-align: bottom; \
|
|
||||||
background-color: #ccc; \
|
|
||||||
padding: 1px; \
|
|
||||||
font-size: 10px; \
|
|
||||||
} \
|
|
||||||
#test_results #test_platform { \
|
|
||||||
color: #444; \
|
|
||||||
text-align:center; \
|
|
||||||
} \
|
|
||||||
#test_results .test_row { \
|
|
||||||
color: #006; \
|
|
||||||
cursor: pointer; \
|
|
||||||
} \
|
|
||||||
#test_results .test_nonlooping { \
|
|
||||||
border-left-style: dotted; \
|
|
||||||
border-left-width: 2px; \
|
|
||||||
} \
|
|
||||||
#test_results .test_looping { \
|
|
||||||
border-left-style: solid; \
|
|
||||||
border-left-width: 2px; \
|
|
||||||
} \
|
|
||||||
#test_results .test_name {white-space: nowrap;} \
|
|
||||||
#test_results .test_pending { \
|
|
||||||
} \
|
|
||||||
#test_results .test_running { \
|
|
||||||
font-style: italic; \
|
|
||||||
} \
|
|
||||||
#test_results .test_done {} \
|
|
||||||
#test_results .test_done { \
|
|
||||||
text-align: right; \
|
|
||||||
font-family: monospace; \
|
|
||||||
} \
|
|
||||||
#test_results .test_error {color: #600;} \
|
|
||||||
#test_results .test_error .error_head {font-weight:bold;} \
|
|
||||||
#test_results .test_error .error_body {font-size:85%;} \
|
|
||||||
#test_results .test_row:hover td { \
|
|
||||||
background-color: #ffc; \
|
|
||||||
text-decoration: underline; \
|
|
||||||
} \
|
|
||||||
#chart { \
|
|
||||||
margin: 10px 0px; \
|
|
||||||
width: 250px; \
|
|
||||||
} \
|
|
||||||
#chart img { \
|
|
||||||
border: solid 1px #ccc; \
|
|
||||||
margin-bottom: 5px; \
|
|
||||||
} \
|
|
||||||
#chart #tiny_url { \
|
|
||||||
height: 40px; \
|
|
||||||
width: 250px; \
|
|
||||||
} \
|
|
||||||
#jslitmus_credit { \
|
|
||||||
font-size: 10px; \
|
|
||||||
color: #888; \
|
|
||||||
margin-top: 8px; \
|
|
||||||
} \
|
|
||||||
</style>';
|
|
||||||
|
|
||||||
// HTML markup for the UI
|
|
||||||
var MARKUP = '<div id="jslitmus"> \
|
|
||||||
<button onclick="JSLitmus.runAll(event)">Run Tests</button> \
|
|
||||||
<button id="stop_button" disabled="disabled" onclick="JSLitmus.stop()">Stop Tests</button> \
|
|
||||||
<br \> \
|
|
||||||
<br \> \
|
|
||||||
<input type="checkbox" style="vertical-align: middle" id="test_normalize" checked="checked" onchange="JSLitmus.renderAll()""> Normalize results \
|
|
||||||
<table id="test_results"> \
|
|
||||||
<colgroup> \
|
|
||||||
<col /> \
|
|
||||||
<col width="100" /> \
|
|
||||||
</colgroup> \
|
|
||||||
<tr><th id="test_platform" colspan="2">' + platform + '</th></tr> \
|
|
||||||
<tr><th>Test</th><th>Ops/sec</th></tr> \
|
|
||||||
<tr id="test_row_template" class="test_row" style="display:none"> \
|
|
||||||
<td class="test_name"></td> \
|
|
||||||
<td class="test_result">Ready</td> \
|
|
||||||
</tr> \
|
|
||||||
</table> \
|
|
||||||
<div id="jsl_status"></div> \
|
|
||||||
<div id="chart" style="display:none"> \
|
|
||||||
<a id="chart_link" target="_blank"><img id="chart_image"></a> \
|
|
||||||
TinyURL (for chart): \
|
|
||||||
<iframe id="tiny_url" frameBorder="0" scrolling="no" src=""></iframe> \
|
|
||||||
</div> \
|
|
||||||
<a id="jslitmus_credit" title="JSLitmus home page" href="http://code.google.com/p/jslitmus" target="_blank">Powered by JSLitmus</a> \
|
|
||||||
</div>';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The public API for creating and running tests
|
|
||||||
*/
|
|
||||||
window.JSLitmus = {
|
|
||||||
/** The list of all tests that have been registered with JSLitmus.test */
|
|
||||||
_tests: [],
|
|
||||||
/** The queue of tests that need to be run */
|
|
||||||
_queue: [],
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The parsed query parameters the current page URL. This is provided as a
|
|
||||||
* convenience for test functions - it's not used by JSLitmus proper
|
|
||||||
*/
|
|
||||||
params: {},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize
|
|
||||||
*/
|
|
||||||
_init: function() {
|
|
||||||
// Parse query params into JSLitmus.params[] hash
|
|
||||||
var match = (location + '').match(/([^?#]*)(#.*)?$/);
|
|
||||||
if (match) {
|
|
||||||
var pairs = match[1].split('&');
|
|
||||||
for (var i = 0; i < pairs.length; i++) {
|
|
||||||
var pair = pairs[i].split('=');
|
|
||||||
if (pair.length > 1) {
|
|
||||||
var key = pair.shift();
|
|
||||||
var value = pair.length > 1 ? pair.join('=') : pair[0];
|
|
||||||
this.params[key] = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Write out the stylesheet. We have to do this here because IE
|
|
||||||
// doesn't honor sheets written after the document has loaded.
|
|
||||||
document.write(STYLESHEET);
|
|
||||||
|
|
||||||
// Setup the rest of the UI once the document is loaded
|
|
||||||
if (window.addEventListener) {
|
|
||||||
window.addEventListener('load', this._setup, false);
|
|
||||||
} else if (document.addEventListener) {
|
|
||||||
document.addEventListener('load', this._setup, false);
|
|
||||||
} else if (window.attachEvent) {
|
|
||||||
window.attachEvent('onload', this._setup);
|
|
||||||
}
|
|
||||||
|
|
||||||
return this;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set up the UI
|
|
||||||
*/
|
|
||||||
_setup: function() {
|
|
||||||
var el = jsl.$('jslitmus_container');
|
|
||||||
if (!el) document.body.appendChild(el = document.createElement('div'));
|
|
||||||
|
|
||||||
el.innerHTML = MARKUP;
|
|
||||||
|
|
||||||
// Render the UI for all our tests
|
|
||||||
for (var i=0; i < JSLitmus._tests.length; i++)
|
|
||||||
JSLitmus.renderTest(JSLitmus._tests[i]);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* (Re)render all the test results
|
|
||||||
*/
|
|
||||||
renderAll: function() {
|
|
||||||
for (var i = 0; i < JSLitmus._tests.length; i++)
|
|
||||||
JSLitmus.renderTest(JSLitmus._tests[i]);
|
|
||||||
JSLitmus.renderChart();
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* (Re)render the chart graphics
|
|
||||||
*/
|
|
||||||
renderChart: function() {
|
|
||||||
var url = JSLitmus.chartUrl();
|
|
||||||
jsl.$('chart_link').href = url;
|
|
||||||
jsl.$('chart_image').src = url;
|
|
||||||
jsl.$('chart').style.display = '';
|
|
||||||
|
|
||||||
// Update the tiny URL
|
|
||||||
jsl.$('tiny_url').src = 'http://tinyurl.com/api-create.php?url='+escape(url);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* (Re)render the results for a specific test
|
|
||||||
*/
|
|
||||||
renderTest: function(test) {
|
|
||||||
// Make a new row if needed
|
|
||||||
if (!test._row) {
|
|
||||||
var trow = jsl.$('test_row_template');
|
|
||||||
if (!trow) return;
|
|
||||||
|
|
||||||
test._row = trow.cloneNode(true);
|
|
||||||
test._row.style.display = '';
|
|
||||||
test._row.id = '';
|
|
||||||
test._row.onclick = function() {JSLitmus._queueTest(test);};
|
|
||||||
test._row.title = 'Run ' + test.name + ' test';
|
|
||||||
trow.parentNode.appendChild(test._row);
|
|
||||||
test._row.cells[0].innerHTML = test.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
var cell = test._row.cells[1];
|
|
||||||
var cns = [test.loopArg ? 'test_looping' : 'test_nonlooping'];
|
|
||||||
|
|
||||||
if (test.error) {
|
|
||||||
cns.push('test_error');
|
|
||||||
cell.innerHTML =
|
|
||||||
'<div class="error_head">' + test.error + '</div>' +
|
|
||||||
'<ul class="error_body"><li>' +
|
|
||||||
jsl.join(test.error, ': ', '</li><li>') +
|
|
||||||
'</li></ul>';
|
|
||||||
} else {
|
|
||||||
if (test.running) {
|
|
||||||
cns.push('test_running');
|
|
||||||
cell.innerHTML = 'running';
|
|
||||||
} else if (jsl.indexOf(JSLitmus._queue, test) >= 0) {
|
|
||||||
cns.push('test_pending');
|
|
||||||
cell.innerHTML = 'pending';
|
|
||||||
} else if (test.count) {
|
|
||||||
cns.push('test_done');
|
|
||||||
var hz = test.getHz(jsl.$('test_normalize').checked);
|
|
||||||
cell.innerHTML = hz != Infinity ? hz : '∞';
|
|
||||||
cell.title = 'Looped ' + test.count + ' times in ' + test.time + ' seconds';
|
|
||||||
} else {
|
|
||||||
cell.innerHTML = 'ready';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
cell.className = cns.join(' ');
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new test
|
|
||||||
*/
|
|
||||||
test: function(name, f) {
|
|
||||||
// Create the Test object
|
|
||||||
var test = new Test(name, f);
|
|
||||||
JSLitmus._tests.push(test);
|
|
||||||
|
|
||||||
// Re-render if the test state changes
|
|
||||||
test.onChange = JSLitmus.renderTest;
|
|
||||||
|
|
||||||
// Run the next test if this one finished
|
|
||||||
test.onStop = function(test) {
|
|
||||||
if (JSLitmus.onTestFinish) JSLitmus.onTestFinish(test);
|
|
||||||
JSLitmus.currentTest = null;
|
|
||||||
JSLitmus._nextTest();
|
|
||||||
};
|
|
||||||
|
|
||||||
// Render the new test
|
|
||||||
this.renderTest(test);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add all tests to the run queue
|
|
||||||
*/
|
|
||||||
runAll: function(e) {
|
|
||||||
e = e || window.event;
|
|
||||||
var reverse = e && e.shiftKey, len = JSLitmus._tests.length;
|
|
||||||
for (var i = 0; i < len; i++) {
|
|
||||||
JSLitmus._queueTest(JSLitmus._tests[!reverse ? i : (len - i - 1)]);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove all tests from the run queue. The current test has to finish on
|
|
||||||
* it's own though
|
|
||||||
*/
|
|
||||||
stop: function() {
|
|
||||||
while (JSLitmus._queue.length) {
|
|
||||||
var test = JSLitmus._queue.shift();
|
|
||||||
JSLitmus.renderTest(test);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Run the next test in the run queue
|
|
||||||
*/
|
|
||||||
_nextTest: function() {
|
|
||||||
if (!JSLitmus.currentTest) {
|
|
||||||
var test = JSLitmus._queue.shift();
|
|
||||||
if (test) {
|
|
||||||
jsl.$('stop_button').disabled = false;
|
|
||||||
JSLitmus.currentTest = test;
|
|
||||||
test.run();
|
|
||||||
JSLitmus.renderTest(test);
|
|
||||||
if (JSLitmus.onTestStart) JSLitmus.onTestStart(test);
|
|
||||||
} else {
|
|
||||||
jsl.$('stop_button').disabled = true;
|
|
||||||
JSLitmus.renderChart();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a test to the run queue
|
|
||||||
*/
|
|
||||||
_queueTest: function(test) {
|
|
||||||
if (jsl.indexOf(JSLitmus._queue, test) >= 0) return;
|
|
||||||
JSLitmus._queue.push(test);
|
|
||||||
JSLitmus.renderTest(test);
|
|
||||||
JSLitmus._nextTest();
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Generate a Google Chart URL that shows the data for all tests
|
|
||||||
*/
|
|
||||||
chartUrl: function() {
|
|
||||||
var n = JSLitmus._tests.length, markers = [], data = [];
|
|
||||||
var d, min = 0, max = -1e10;
|
|
||||||
var normalize = jsl.$('test_normalize').checked;
|
|
||||||
|
|
||||||
// Gather test data
|
|
||||||
for (var i=0; i < JSLitmus._tests.length; i++) {
|
|
||||||
var test = JSLitmus._tests[i];
|
|
||||||
if (test.count) {
|
|
||||||
var hz = test.getHz(normalize);
|
|
||||||
var v = hz != Infinity ? hz : 0;
|
|
||||||
data.push(v);
|
|
||||||
markers.push('t' + jsl.escape(test.name + '(' + jsl.toLabel(hz)+ ')') + ',000000,0,' +
|
|
||||||
markers.length + ',10');
|
|
||||||
max = Math.max(v, max);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (markers.length <= 0) return null;
|
|
||||||
|
|
||||||
// Build chart title
|
|
||||||
var title = document.getElementsByTagName('title');
|
|
||||||
title = (title && title.length) ? title[0].innerHTML : null;
|
|
||||||
var chart_title = [];
|
|
||||||
if (title) chart_title.push(title);
|
|
||||||
chart_title.push('Ops/sec (' + platform + ')');
|
|
||||||
|
|
||||||
// Build labels
|
|
||||||
var labels = [jsl.toLabel(min), jsl.toLabel(max)];
|
|
||||||
|
|
||||||
var w = 250, bw = 15;
|
|
||||||
var bs = 5;
|
|
||||||
var h = markers.length*(bw + bs) + 30 + chart_title.length*20;
|
|
||||||
|
|
||||||
var params = {
|
|
||||||
chtt: escape(chart_title.join('|')),
|
|
||||||
chts: '000000,10',
|
|
||||||
cht: 'bhg', // chart type
|
|
||||||
chd: 't:' + data.join(','), // data set
|
|
||||||
chds: min + ',' + max, // max/min of data
|
|
||||||
chxt: 'x', // label axes
|
|
||||||
chxl: '0:|' + labels.join('|'), // labels
|
|
||||||
chsp: '0,1',
|
|
||||||
chm: markers.join('|'), // test names
|
|
||||||
chbh: [bw, 0, bs].join(','), // bar widths
|
|
||||||
// chf: 'bg,lg,0,eeeeee,0,eeeeee,.5,ffffff,1', // gradient
|
|
||||||
chs: w + 'x' + h
|
|
||||||
};
|
|
||||||
return 'http://chart.apis.google.com/chart?' + jsl.join(params, '=', '&');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
JSLitmus._init();
|
|
||||||
})();
|
|
||||||
481
vendor/backbone/test/vendor/json2.js
vendored
481
vendor/backbone/test/vendor/json2.js
vendored
@@ -1,481 +0,0 @@
|
|||||||
/*
|
|
||||||
http://www.JSON.org/json2.js
|
|
||||||
2009-09-29
|
|
||||||
|
|
||||||
Public Domain.
|
|
||||||
|
|
||||||
NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
|
|
||||||
|
|
||||||
See http://www.JSON.org/js.html
|
|
||||||
|
|
||||||
|
|
||||||
This code should be minified before deployment.
|
|
||||||
See http://javascript.crockford.com/jsmin.html
|
|
||||||
|
|
||||||
USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
|
|
||||||
NOT CONTROL.
|
|
||||||
|
|
||||||
|
|
||||||
This file creates a global JSON object containing two methods: stringify
|
|
||||||
and parse.
|
|
||||||
|
|
||||||
JSON.stringify(value, replacer, space)
|
|
||||||
value any JavaScript value, usually an object or array.
|
|
||||||
|
|
||||||
replacer an optional parameter that determines how object
|
|
||||||
values are stringified for objects. It can be a
|
|
||||||
function or an array of strings.
|
|
||||||
|
|
||||||
space an optional parameter that specifies the indentation
|
|
||||||
of nested structures. If it is omitted, the text will
|
|
||||||
be packed without extra whitespace. If it is a number,
|
|
||||||
it will specify the number of spaces to indent at each
|
|
||||||
level. If it is a string (such as '\t' or ' '),
|
|
||||||
it contains the characters used to indent at each level.
|
|
||||||
|
|
||||||
This method produces a JSON text from a JavaScript value.
|
|
||||||
|
|
||||||
When an object value is found, if the object contains a toJSON
|
|
||||||
method, its toJSON method will be called and the result will be
|
|
||||||
stringified. A toJSON method does not serialize: it returns the
|
|
||||||
value represented by the name/value pair that should be serialized,
|
|
||||||
or undefined if nothing should be serialized. The toJSON method
|
|
||||||
will be passed the key associated with the value, and this will be
|
|
||||||
bound to the value
|
|
||||||
|
|
||||||
For example, this would serialize Dates as ISO strings.
|
|
||||||
|
|
||||||
Date.prototype.toJSON = function (key) {
|
|
||||||
function f(n) {
|
|
||||||
// Format integers to have at least two digits.
|
|
||||||
return n < 10 ? '0' + n : n;
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.getUTCFullYear() + '-' +
|
|
||||||
f(this.getUTCMonth() + 1) + '-' +
|
|
||||||
f(this.getUTCDate()) + 'T' +
|
|
||||||
f(this.getUTCHours()) + ':' +
|
|
||||||
f(this.getUTCMinutes()) + ':' +
|
|
||||||
f(this.getUTCSeconds()) + 'Z';
|
|
||||||
};
|
|
||||||
|
|
||||||
You can provide an optional replacer method. It will be passed the
|
|
||||||
key and value of each member, with this bound to the containing
|
|
||||||
object. The value that is returned from your method will be
|
|
||||||
serialized. If your method returns undefined, then the member will
|
|
||||||
be excluded from the serialization.
|
|
||||||
|
|
||||||
If the replacer parameter is an array of strings, then it will be
|
|
||||||
used to select the members to be serialized. It filters the results
|
|
||||||
such that only members with keys listed in the replacer array are
|
|
||||||
stringified.
|
|
||||||
|
|
||||||
Values that do not have JSON representations, such as undefined or
|
|
||||||
functions, will not be serialized. Such values in objects will be
|
|
||||||
dropped; in arrays they will be replaced with null. You can use
|
|
||||||
a replacer function to replace those with JSON values.
|
|
||||||
JSON.stringify(undefined) returns undefined.
|
|
||||||
|
|
||||||
The optional space parameter produces a stringification of the
|
|
||||||
value that is filled with line breaks and indentation to make it
|
|
||||||
easier to read.
|
|
||||||
|
|
||||||
If the space parameter is a non-empty string, then that string will
|
|
||||||
be used for indentation. If the space parameter is a number, then
|
|
||||||
the indentation will be that many spaces.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
text = JSON.stringify(['e', {pluribus: 'unum'}]);
|
|
||||||
// text is '["e",{"pluribus":"unum"}]'
|
|
||||||
|
|
||||||
|
|
||||||
text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t');
|
|
||||||
// text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]'
|
|
||||||
|
|
||||||
text = JSON.stringify([new Date()], function (key, value) {
|
|
||||||
return this[key] instanceof Date ?
|
|
||||||
'Date(' + this[key] + ')' : value;
|
|
||||||
});
|
|
||||||
// text is '["Date(---current time---)"]'
|
|
||||||
|
|
||||||
|
|
||||||
JSON.parse(text, reviver)
|
|
||||||
This method parses a JSON text to produce an object or array.
|
|
||||||
It can throw a SyntaxError exception.
|
|
||||||
|
|
||||||
The optional reviver parameter is a function that can filter and
|
|
||||||
transform the results. It receives each of the keys and values,
|
|
||||||
and its return value is used instead of the original value.
|
|
||||||
If it returns what it received, then the structure is not modified.
|
|
||||||
If it returns undefined then the member is deleted.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
// Parse the text. Values that look like ISO date strings will
|
|
||||||
// be converted to Date objects.
|
|
||||||
|
|
||||||
myData = JSON.parse(text, function (key, value) {
|
|
||||||
var a;
|
|
||||||
if (typeof value === 'string') {
|
|
||||||
a =
|
|
||||||
/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
|
|
||||||
if (a) {
|
|
||||||
return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
|
|
||||||
+a[5], +a[6]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return value;
|
|
||||||
});
|
|
||||||
|
|
||||||
myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) {
|
|
||||||
var d;
|
|
||||||
if (typeof value === 'string' &&
|
|
||||||
value.slice(0, 5) === 'Date(' &&
|
|
||||||
value.slice(-1) === ')') {
|
|
||||||
d = new Date(value.slice(5, -1));
|
|
||||||
if (d) {
|
|
||||||
return d;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return value;
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
This is a reference implementation. You are free to copy, modify, or
|
|
||||||
redistribute.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*jslint evil: true, strict: false */
|
|
||||||
|
|
||||||
/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
|
|
||||||
call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
|
|
||||||
getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,
|
|
||||||
lastIndex, length, parse, prototype, push, replace, slice, stringify,
|
|
||||||
test, toJSON, toString, valueOf
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
// Create a JSON object only if one does not already exist. We create the
|
|
||||||
// methods in a closure to avoid creating global variables.
|
|
||||||
|
|
||||||
if (!this.JSON) {
|
|
||||||
this.JSON = {};
|
|
||||||
}
|
|
||||||
|
|
||||||
(function () {
|
|
||||||
|
|
||||||
function f(n) {
|
|
||||||
// Format integers to have at least two digits.
|
|
||||||
return n < 10 ? '0' + n : n;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof Date.prototype.toJSON !== 'function') {
|
|
||||||
|
|
||||||
Date.prototype.toJSON = function (key) {
|
|
||||||
|
|
||||||
return isFinite(this.valueOf()) ?
|
|
||||||
this.getUTCFullYear() + '-' +
|
|
||||||
f(this.getUTCMonth() + 1) + '-' +
|
|
||||||
f(this.getUTCDate()) + 'T' +
|
|
||||||
f(this.getUTCHours()) + ':' +
|
|
||||||
f(this.getUTCMinutes()) + ':' +
|
|
||||||
f(this.getUTCSeconds()) + 'Z' : null;
|
|
||||||
};
|
|
||||||
|
|
||||||
String.prototype.toJSON =
|
|
||||||
Number.prototype.toJSON =
|
|
||||||
Boolean.prototype.toJSON = function (key) {
|
|
||||||
return this.valueOf();
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
|
|
||||||
escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
|
|
||||||
gap,
|
|
||||||
indent,
|
|
||||||
meta = { // table of character substitutions
|
|
||||||
'\b': '\\b',
|
|
||||||
'\t': '\\t',
|
|
||||||
'\n': '\\n',
|
|
||||||
'\f': '\\f',
|
|
||||||
'\r': '\\r',
|
|
||||||
'"' : '\\"',
|
|
||||||
'\\': '\\\\'
|
|
||||||
},
|
|
||||||
rep;
|
|
||||||
|
|
||||||
|
|
||||||
function quote(string) {
|
|
||||||
|
|
||||||
// If the string contains no control characters, no quote characters, and no
|
|
||||||
// backslash characters, then we can safely slap some quotes around it.
|
|
||||||
// Otherwise we must also replace the offending characters with safe escape
|
|
||||||
// sequences.
|
|
||||||
|
|
||||||
escapable.lastIndex = 0;
|
|
||||||
return escapable.test(string) ?
|
|
||||||
'"' + string.replace(escapable, function (a) {
|
|
||||||
var c = meta[a];
|
|
||||||
return typeof c === 'string' ? c :
|
|
||||||
'\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
|
|
||||||
}) + '"' :
|
|
||||||
'"' + string + '"';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function str(key, holder) {
|
|
||||||
|
|
||||||
// Produce a string from holder[key].
|
|
||||||
|
|
||||||
var i, // The loop counter.
|
|
||||||
k, // The member key.
|
|
||||||
v, // The member value.
|
|
||||||
length,
|
|
||||||
mind = gap,
|
|
||||||
partial,
|
|
||||||
value = holder[key];
|
|
||||||
|
|
||||||
// If the value has a toJSON method, call it to obtain a replacement value.
|
|
||||||
|
|
||||||
if (value && typeof value === 'object' &&
|
|
||||||
typeof value.toJSON === 'function') {
|
|
||||||
value = value.toJSON(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we were called with a replacer function, then call the replacer to
|
|
||||||
// obtain a replacement value.
|
|
||||||
|
|
||||||
if (typeof rep === 'function') {
|
|
||||||
value = rep.call(holder, key, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
// What happens next depends on the value's type.
|
|
||||||
|
|
||||||
switch (typeof value) {
|
|
||||||
case 'string':
|
|
||||||
return quote(value);
|
|
||||||
|
|
||||||
case 'number':
|
|
||||||
|
|
||||||
// JSON numbers must be finite. Encode non-finite numbers as null.
|
|
||||||
|
|
||||||
return isFinite(value) ? String(value) : 'null';
|
|
||||||
|
|
||||||
case 'boolean':
|
|
||||||
case 'null':
|
|
||||||
|
|
||||||
// If the value is a boolean or null, convert it to a string. Note:
|
|
||||||
// typeof null does not produce 'null'. The case is included here in
|
|
||||||
// the remote chance that this gets fixed someday.
|
|
||||||
|
|
||||||
return String(value);
|
|
||||||
|
|
||||||
// If the type is 'object', we might be dealing with an object or an array or
|
|
||||||
// null.
|
|
||||||
|
|
||||||
case 'object':
|
|
||||||
|
|
||||||
// Due to a specification blunder in ECMAScript, typeof null is 'object',
|
|
||||||
// so watch out for that case.
|
|
||||||
|
|
||||||
if (!value) {
|
|
||||||
return 'null';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make an array to hold the partial results of stringifying this object value.
|
|
||||||
|
|
||||||
gap += indent;
|
|
||||||
partial = [];
|
|
||||||
|
|
||||||
// Is the value an array?
|
|
||||||
|
|
||||||
if (Object.prototype.toString.apply(value) === '[object Array]') {
|
|
||||||
|
|
||||||
// The value is an array. Stringify every element. Use null as a placeholder
|
|
||||||
// for non-JSON values.
|
|
||||||
|
|
||||||
length = value.length;
|
|
||||||
for (i = 0; i < length; i += 1) {
|
|
||||||
partial[i] = str(i, value) || 'null';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Join all of the elements together, separated with commas, and wrap them in
|
|
||||||
// brackets.
|
|
||||||
|
|
||||||
v = partial.length === 0 ? '[]' :
|
|
||||||
gap ? '[\n' + gap +
|
|
||||||
partial.join(',\n' + gap) + '\n' +
|
|
||||||
mind + ']' :
|
|
||||||
'[' + partial.join(',') + ']';
|
|
||||||
gap = mind;
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If the replacer is an array, use it to select the members to be stringified.
|
|
||||||
|
|
||||||
if (rep && typeof rep === 'object') {
|
|
||||||
length = rep.length;
|
|
||||||
for (i = 0; i < length; i += 1) {
|
|
||||||
k = rep[i];
|
|
||||||
if (typeof k === 'string') {
|
|
||||||
v = str(k, value);
|
|
||||||
if (v) {
|
|
||||||
partial.push(quote(k) + (gap ? ': ' : ':') + v);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
|
|
||||||
// Otherwise, iterate through all of the keys in the object.
|
|
||||||
|
|
||||||
for (k in value) {
|
|
||||||
if (Object.hasOwnProperty.call(value, k)) {
|
|
||||||
v = str(k, value);
|
|
||||||
if (v) {
|
|
||||||
partial.push(quote(k) + (gap ? ': ' : ':') + v);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Join all of the member texts together, separated with commas,
|
|
||||||
// and wrap them in braces.
|
|
||||||
|
|
||||||
v = partial.length === 0 ? '{}' :
|
|
||||||
gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' +
|
|
||||||
mind + '}' : '{' + partial.join(',') + '}';
|
|
||||||
gap = mind;
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If the JSON object does not yet have a stringify method, give it one.
|
|
||||||
|
|
||||||
if (typeof JSON.stringify !== 'function') {
|
|
||||||
JSON.stringify = function (value, replacer, space) {
|
|
||||||
|
|
||||||
// The stringify method takes a value and an optional replacer, and an optional
|
|
||||||
// space parameter, and returns a JSON text. The replacer can be a function
|
|
||||||
// that can replace values, or an array of strings that will select the keys.
|
|
||||||
// A default replacer method can be provided. Use of the space parameter can
|
|
||||||
// produce text that is more easily readable.
|
|
||||||
|
|
||||||
var i;
|
|
||||||
gap = '';
|
|
||||||
indent = '';
|
|
||||||
|
|
||||||
// If the space parameter is a number, make an indent string containing that
|
|
||||||
// many spaces.
|
|
||||||
|
|
||||||
if (typeof space === 'number') {
|
|
||||||
for (i = 0; i < space; i += 1) {
|
|
||||||
indent += ' ';
|
|
||||||
}
|
|
||||||
|
|
||||||
// If the space parameter is a string, it will be used as the indent string.
|
|
||||||
|
|
||||||
} else if (typeof space === 'string') {
|
|
||||||
indent = space;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If there is a replacer, it must be a function or an array.
|
|
||||||
// Otherwise, throw an error.
|
|
||||||
|
|
||||||
rep = replacer;
|
|
||||||
if (replacer && typeof replacer !== 'function' &&
|
|
||||||
(typeof replacer !== 'object' ||
|
|
||||||
typeof replacer.length !== 'number')) {
|
|
||||||
throw new Error('JSON.stringify');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make a fake root object containing our value under the key of ''.
|
|
||||||
// Return the result of stringifying the value.
|
|
||||||
|
|
||||||
return str('', {'': value});
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// If the JSON object does not yet have a parse method, give it one.
|
|
||||||
|
|
||||||
if (typeof JSON.parse !== 'function') {
|
|
||||||
JSON.parse = function (text, reviver) {
|
|
||||||
|
|
||||||
// The parse method takes a text and an optional reviver function, and returns
|
|
||||||
// a JavaScript value if the text is a valid JSON text.
|
|
||||||
|
|
||||||
var j;
|
|
||||||
|
|
||||||
function walk(holder, key) {
|
|
||||||
|
|
||||||
// The walk method is used to recursively walk the resulting structure so
|
|
||||||
// that modifications can be made.
|
|
||||||
|
|
||||||
var k, v, value = holder[key];
|
|
||||||
if (value && typeof value === 'object') {
|
|
||||||
for (k in value) {
|
|
||||||
if (Object.hasOwnProperty.call(value, k)) {
|
|
||||||
v = walk(value, k);
|
|
||||||
if (v !== undefined) {
|
|
||||||
value[k] = v;
|
|
||||||
} else {
|
|
||||||
delete value[k];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return reviver.call(holder, key, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Parsing happens in four stages. In the first stage, we replace certain
|
|
||||||
// Unicode characters with escape sequences. JavaScript handles many characters
|
|
||||||
// incorrectly, either silently deleting them, or treating them as line endings.
|
|
||||||
|
|
||||||
cx.lastIndex = 0;
|
|
||||||
if (cx.test(text)) {
|
|
||||||
text = text.replace(cx, function (a) {
|
|
||||||
return '\\u' +
|
|
||||||
('0000' + a.charCodeAt(0).toString(16)).slice(-4);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// In the second stage, we run the text against regular expressions that look
|
|
||||||
// for non-JSON patterns. We are especially concerned with '()' and 'new'
|
|
||||||
// because they can cause invocation, and '=' because it can cause mutation.
|
|
||||||
// But just to be safe, we want to reject all unexpected forms.
|
|
||||||
|
|
||||||
// We split the second stage into 4 regexp operations in order to work around
|
|
||||||
// crippling inefficiencies in IE's and Safari's regexp engines. First we
|
|
||||||
// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we
|
|
||||||
// replace all simple value tokens with ']' characters. Third, we delete all
|
|
||||||
// open brackets that follow a colon or comma or that begin the text. Finally,
|
|
||||||
// we look to see that the remaining characters are only whitespace or ']' or
|
|
||||||
// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
|
|
||||||
|
|
||||||
if (/^[\],:{}\s]*$/.
|
|
||||||
test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@').
|
|
||||||
replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').
|
|
||||||
replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
|
|
||||||
|
|
||||||
// In the third stage we use the eval function to compile the text into a
|
|
||||||
// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
|
|
||||||
// in JavaScript: it can begin a block or an object literal. We wrap the text
|
|
||||||
// in parens to eliminate the ambiguity.
|
|
||||||
|
|
||||||
j = eval('(' + text + ')');
|
|
||||||
|
|
||||||
// In the optional fourth stage, we recursively walk the new structure, passing
|
|
||||||
// each name/value pair to a reviver function for possible transformation.
|
|
||||||
|
|
||||||
return typeof reviver === 'function' ?
|
|
||||||
walk({'': j}, '') : j;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If the text is not JSON parseable, then a SyntaxError is thrown.
|
|
||||||
|
|
||||||
throw new SyntaxError('JSON.parse');
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}());
|
|
||||||
235
vendor/backbone/test/vendor/qunit.css
vendored
235
vendor/backbone/test/vendor/qunit.css
vendored
@@ -1,235 +0,0 @@
|
|||||||
/**
|
|
||||||
* QUnit v1.10.0 - A JavaScript Unit Testing Framework
|
|
||||||
*
|
|
||||||
* http://qunitjs.com
|
|
||||||
*
|
|
||||||
* Copyright 2012 jQuery Foundation and other contributors
|
|
||||||
* Released under the MIT license.
|
|
||||||
* http://jquery.org/license
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** Font Family and Sizes */
|
|
||||||
|
|
||||||
#qunit-tests, #qunit-header, #qunit-banner, #qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult {
|
|
||||||
font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial, sans-serif;
|
|
||||||
}
|
|
||||||
|
|
||||||
#qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult, #qunit-tests li { font-size: small; }
|
|
||||||
#qunit-tests { font-size: smaller; }
|
|
||||||
|
|
||||||
|
|
||||||
/** Resets */
|
|
||||||
|
|
||||||
#qunit-tests, #qunit-tests ol, #qunit-header, #qunit-banner, #qunit-userAgent, #qunit-testresult, #qunit-modulefilter {
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/** Header */
|
|
||||||
|
|
||||||
#qunit-header {
|
|
||||||
padding: 0.5em 0 0.5em 1em;
|
|
||||||
|
|
||||||
color: #8699a4;
|
|
||||||
background-color: #0d3349;
|
|
||||||
|
|
||||||
font-size: 1.5em;
|
|
||||||
line-height: 1em;
|
|
||||||
font-weight: normal;
|
|
||||||
|
|
||||||
border-radius: 5px 5px 0 0;
|
|
||||||
-moz-border-radius: 5px 5px 0 0;
|
|
||||||
-webkit-border-top-right-radius: 5px;
|
|
||||||
-webkit-border-top-left-radius: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#qunit-header a {
|
|
||||||
text-decoration: none;
|
|
||||||
color: #c2ccd1;
|
|
||||||
}
|
|
||||||
|
|
||||||
#qunit-header a:hover,
|
|
||||||
#qunit-header a:focus {
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
#qunit-testrunner-toolbar label {
|
|
||||||
display: inline-block;
|
|
||||||
padding: 0 .5em 0 .1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
#qunit-banner {
|
|
||||||
height: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#qunit-testrunner-toolbar {
|
|
||||||
padding: 0.5em 0 0.5em 2em;
|
|
||||||
color: #5E740B;
|
|
||||||
background-color: #eee;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
#qunit-userAgent {
|
|
||||||
padding: 0.5em 0 0.5em 2.5em;
|
|
||||||
background-color: #2b81af;
|
|
||||||
color: #fff;
|
|
||||||
text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#qunit-modulefilter-container {
|
|
||||||
float: right;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Tests: Pass/Fail */
|
|
||||||
|
|
||||||
#qunit-tests {
|
|
||||||
list-style-position: inside;
|
|
||||||
}
|
|
||||||
|
|
||||||
#qunit-tests li {
|
|
||||||
padding: 0.4em 0.5em 0.4em 2.5em;
|
|
||||||
border-bottom: 1px solid #fff;
|
|
||||||
list-style-position: inside;
|
|
||||||
}
|
|
||||||
|
|
||||||
#qunit-tests.hidepass li.pass, #qunit-tests.hidepass li.running {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
#qunit-tests li strong {
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
#qunit-tests li a {
|
|
||||||
padding: 0.5em;
|
|
||||||
color: #c2ccd1;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
#qunit-tests li a:hover,
|
|
||||||
#qunit-tests li a:focus {
|
|
||||||
color: #000;
|
|
||||||
}
|
|
||||||
|
|
||||||
#qunit-tests ol {
|
|
||||||
margin-top: 0.5em;
|
|
||||||
padding: 0.5em;
|
|
||||||
|
|
||||||
background-color: #fff;
|
|
||||||
|
|
||||||
border-radius: 5px;
|
|
||||||
-moz-border-radius: 5px;
|
|
||||||
-webkit-border-radius: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#qunit-tests table {
|
|
||||||
border-collapse: collapse;
|
|
||||||
margin-top: .2em;
|
|
||||||
}
|
|
||||||
|
|
||||||
#qunit-tests th {
|
|
||||||
text-align: right;
|
|
||||||
vertical-align: top;
|
|
||||||
padding: 0 .5em 0 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#qunit-tests td {
|
|
||||||
vertical-align: top;
|
|
||||||
}
|
|
||||||
|
|
||||||
#qunit-tests pre {
|
|
||||||
margin: 0;
|
|
||||||
white-space: pre-wrap;
|
|
||||||
word-wrap: break-word;
|
|
||||||
}
|
|
||||||
|
|
||||||
#qunit-tests del {
|
|
||||||
background-color: #e0f2be;
|
|
||||||
color: #374e0c;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
#qunit-tests ins {
|
|
||||||
background-color: #ffcaca;
|
|
||||||
color: #500;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*** Test Counts */
|
|
||||||
|
|
||||||
#qunit-tests b.counts { color: black; }
|
|
||||||
#qunit-tests b.passed { color: #5E740B; }
|
|
||||||
#qunit-tests b.failed { color: #710909; }
|
|
||||||
|
|
||||||
#qunit-tests li li {
|
|
||||||
padding: 5px;
|
|
||||||
background-color: #fff;
|
|
||||||
border-bottom: none;
|
|
||||||
list-style-position: inside;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*** Passing Styles */
|
|
||||||
|
|
||||||
#qunit-tests li li.pass {
|
|
||||||
color: #3c510c;
|
|
||||||
background-color: #fff;
|
|
||||||
border-left: 10px solid #C6E746;
|
|
||||||
}
|
|
||||||
|
|
||||||
#qunit-tests .pass { color: #528CE0; background-color: #D2E0E6; }
|
|
||||||
#qunit-tests .pass .test-name { color: #366097; }
|
|
||||||
|
|
||||||
#qunit-tests .pass .test-actual,
|
|
||||||
#qunit-tests .pass .test-expected { color: #999999; }
|
|
||||||
|
|
||||||
#qunit-banner.qunit-pass { background-color: #C6E746; }
|
|
||||||
|
|
||||||
/*** Failing Styles */
|
|
||||||
|
|
||||||
#qunit-tests li li.fail {
|
|
||||||
color: #710909;
|
|
||||||
background-color: #fff;
|
|
||||||
border-left: 10px solid #EE5757;
|
|
||||||
white-space: pre;
|
|
||||||
}
|
|
||||||
|
|
||||||
#qunit-tests > li:last-child {
|
|
||||||
border-radius: 0 0 5px 5px;
|
|
||||||
-moz-border-radius: 0 0 5px 5px;
|
|
||||||
-webkit-border-bottom-right-radius: 5px;
|
|
||||||
-webkit-border-bottom-left-radius: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#qunit-tests .fail { color: #000000; background-color: #EE5757; }
|
|
||||||
#qunit-tests .fail .test-name,
|
|
||||||
#qunit-tests .fail .module-name { color: #000000; }
|
|
||||||
|
|
||||||
#qunit-tests .fail .test-actual { color: #EE5757; }
|
|
||||||
#qunit-tests .fail .test-expected { color: green; }
|
|
||||||
|
|
||||||
#qunit-banner.qunit-fail { background-color: #EE5757; }
|
|
||||||
|
|
||||||
|
|
||||||
/** Result */
|
|
||||||
|
|
||||||
#qunit-testresult {
|
|
||||||
padding: 0.5em 0.5em 0.5em 2.5em;
|
|
||||||
|
|
||||||
color: #2b81af;
|
|
||||||
background-color: #D2E0E6;
|
|
||||||
|
|
||||||
border-bottom: 1px solid white;
|
|
||||||
}
|
|
||||||
#qunit-testresult .module-name {
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Fixture */
|
|
||||||
|
|
||||||
#qunit-fixture {
|
|
||||||
position: absolute;
|
|
||||||
top: -10000px;
|
|
||||||
left: -10000px;
|
|
||||||
width: 1000px;
|
|
||||||
height: 1000px;
|
|
||||||
}
|
|
||||||
1977
vendor/backbone/test/vendor/qunit.js
vendored
1977
vendor/backbone/test/vendor/qunit.js
vendored
File diff suppressed because it is too large
Load Diff
7
vendor/backbone/test/view.js
vendored
7
vendor/backbone/test/view.js
vendored
@@ -7,17 +7,20 @@ $(document).ready(function() {
|
|||||||
setup: function() {
|
setup: function() {
|
||||||
view = new Backbone.View({
|
view = new Backbone.View({
|
||||||
id : 'test-view',
|
id : 'test-view',
|
||||||
className : 'test-view'
|
className : 'test-view',
|
||||||
|
other : 'non-special-option'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test("constructor", 4, function() {
|
test("constructor", 6, function() {
|
||||||
equal(view.el.id, 'test-view');
|
equal(view.el.id, 'test-view');
|
||||||
equal(view.el.className, 'test-view');
|
equal(view.el.className, 'test-view');
|
||||||
|
equal(view.el.other, void 0);
|
||||||
equal(view.options.id, 'test-view');
|
equal(view.options.id, 'test-view');
|
||||||
equal(view.options.className, 'test-view');
|
equal(view.options.className, 'test-view');
|
||||||
|
equal(view.options.other, 'non-special-option');
|
||||||
});
|
});
|
||||||
|
|
||||||
test("jQuery", 1, function() {
|
test("jQuery", 1, function() {
|
||||||
|
|||||||
41
vendor/benchmark.js/benchmark.js
vendored
41
vendor/benchmark.js/benchmark.js
vendored
@@ -320,6 +320,7 @@
|
|||||||
/** Math shortcuts */
|
/** Math shortcuts */
|
||||||
var abs = Math.abs,
|
var abs = Math.abs,
|
||||||
floor = Math.floor,
|
floor = Math.floor,
|
||||||
|
log = Math.log,
|
||||||
max = Math.max,
|
max = Math.max,
|
||||||
min = Math.min,
|
min = Math.min,
|
||||||
pow = Math.pow,
|
pow = Math.pow,
|
||||||
@@ -945,6 +946,20 @@
|
|||||||
(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(fn) || 0)[1]) || '';
|
(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(fn) || 0)[1]) || '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Computes the geometric mean (log-average) of a sample.
|
||||||
|
* See http://en.wikipedia.org/wiki/Geometric_mean#Relationship_with_arithmetic_mean_of_logarithms.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {Array} sample The sample.
|
||||||
|
* @returns {Number} The geometric mean.
|
||||||
|
*/
|
||||||
|
function getGeometricMean(sample) {
|
||||||
|
return pow(Math.E, reduce(sample, function(sum, x) {
|
||||||
|
return sum + log(x);
|
||||||
|
}) / sample.length) || 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Computes the arithmetic mean of a sample.
|
* Computes the arithmetic mean of a sample.
|
||||||
*
|
*
|
||||||
@@ -953,9 +968,9 @@
|
|||||||
* @returns {Number} The mean.
|
* @returns {Number} The mean.
|
||||||
*/
|
*/
|
||||||
function getMean(sample) {
|
function getMean(sample) {
|
||||||
return reduce(sample, function(sum, x) {
|
return (reduce(sample, function(sum, x) {
|
||||||
return sum + x;
|
return sum + x;
|
||||||
}) / sample.length || 0;
|
}) / sample.length) || 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2076,6 +2091,10 @@
|
|||||||
event.aborted = me.aborted;
|
event.aborted = me.aborted;
|
||||||
},
|
},
|
||||||
'onComplete': function(event) {
|
'onComplete': function(event) {
|
||||||
|
me.score = getGeometricMean(map(me, function(bench) {
|
||||||
|
return bench.reference / (bench.times.period * 1e6);
|
||||||
|
})) || 0;
|
||||||
|
|
||||||
me.running = false;
|
me.running = false;
|
||||||
me.emit(event);
|
me.emit(event);
|
||||||
}
|
}
|
||||||
@@ -3169,7 +3188,15 @@
|
|||||||
* @memberOf Benchmark.options
|
* @memberOf Benchmark.options
|
||||||
* @type Function
|
* @type Function
|
||||||
*/
|
*/
|
||||||
'onStart': undefined
|
'onStart': undefined,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The reference time taken to execute the test once (usecs).
|
||||||
|
*
|
||||||
|
* @memberOf Benchmark.options
|
||||||
|
* @type Number
|
||||||
|
*/
|
||||||
|
'reference': 0
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -3726,6 +3753,14 @@
|
|||||||
*/
|
*/
|
||||||
'length': 0,
|
'length': 0,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A score computed using the normalized result of each benchmark in the suite.
|
||||||
|
*
|
||||||
|
* @memberOf Benchmark.Suite
|
||||||
|
* @type Number
|
||||||
|
*/
|
||||||
|
'score': 0,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A flag to indicate if the suite is aborted.
|
* A flag to indicate if the suite is aborted.
|
||||||
*
|
*
|
||||||
|
|||||||
21
vendor/jquery/MIT-LICENSE.txt
vendored
Normal file
21
vendor/jquery/MIT-LICENSE.txt
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
Copyright 2012 jQuery Foundation and other contributors
|
||||||
|
http://jquery.com/
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
417
vendor/jquery/README.md
vendored
Normal file
417
vendor/jquery/README.md
vendored
Normal file
@@ -0,0 +1,417 @@
|
|||||||
|
[jQuery](http://jquery.com/) - New Wave JavaScript
|
||||||
|
==================================================
|
||||||
|
|
||||||
|
Contribution Guides
|
||||||
|
--------------------------------------
|
||||||
|
|
||||||
|
In the spirit of open source software development, jQuery always encourages community code contribution. To help you get started and before you jump into writing code, be sure to read these important contribution guidelines thoroughly:
|
||||||
|
|
||||||
|
1. [Getting Involved](http://docs.jquery.com/Getting_Involved)
|
||||||
|
2. [Core Style Guide](http://docs.jquery.com/JQuery_Core_Style_Guidelines)
|
||||||
|
3. [Tips For Bug Patching](http://docs.jquery.com/Tips_for_jQuery_Bug_Patching)
|
||||||
|
|
||||||
|
|
||||||
|
What you need to build your own jQuery
|
||||||
|
--------------------------------------
|
||||||
|
|
||||||
|
In order to build jQuery, you need to have GNU make 3.8 or later, Node.js/npm latest, and git 1.7 or later.
|
||||||
|
(Earlier versions might work OK, but are not tested.)
|
||||||
|
|
||||||
|
Windows users have two options:
|
||||||
|
|
||||||
|
1. Install [msysgit](https://code.google.com/p/msysgit/) (Full installer for official Git),
|
||||||
|
[GNU make for Windows](http://gnuwin32.sourceforge.net/packages/make.htm), and a
|
||||||
|
[binary version of Node.js](http://node-js.prcn.co.cc/). Make sure all three packages are installed to the same
|
||||||
|
location (by default, this is C:\Program Files\Git).
|
||||||
|
2. Install [Cygwin](http://cygwin.com/) (make sure you install the git, make, and which packages), then either follow
|
||||||
|
the [Node.js build instructions](https://github.com/ry/node/wiki/Building-node.js-on-Cygwin-%28Windows%29) or install
|
||||||
|
the [binary version of Node.js](http://node-js.prcn.co.cc/).
|
||||||
|
|
||||||
|
Mac OS users should install Xcode (comes on your Mac OS install DVD, or downloadable from
|
||||||
|
[Apple's Xcode site](http://developer.apple.com/technologies/xcode.html)) and
|
||||||
|
[Homebrew](http://mxcl.github.com/homebrew/). Once Homebrew is installed, run `brew install git` to install git,
|
||||||
|
and `brew install node` to install Node.js.
|
||||||
|
|
||||||
|
Linux/BSD users should use their appropriate package managers to install make, git, and node, or build from source
|
||||||
|
if you swing that way. Easy-peasy.
|
||||||
|
|
||||||
|
|
||||||
|
How to build your own jQuery
|
||||||
|
----------------------------
|
||||||
|
|
||||||
|
First, clone a copy of the main jQuery git repo by running:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone git://github.com/jquery/jquery.git
|
||||||
|
```
|
||||||
|
|
||||||
|
Enter the directory and install the Node dependencies:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd jquery && npm install
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
Make sure you have `grunt` installed by testing:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
grunt -version
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Then, to get a complete, minified (w/ Uglify.js), linted (w/ JSHint) version of jQuery, type the following:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
grunt
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
The built version of jQuery will be put in the `dist/` subdirectory.
|
||||||
|
|
||||||
|
|
||||||
|
### Modules (new in 1.8)
|
||||||
|
|
||||||
|
Starting in jQuery 1.8, special builds can now be created that optionally exclude or include any of the following modules:
|
||||||
|
|
||||||
|
- ajax
|
||||||
|
- css
|
||||||
|
- dimensions
|
||||||
|
- effects
|
||||||
|
- offset
|
||||||
|
|
||||||
|
|
||||||
|
Before creating a custom build for use in production, be sure to check out the latest stable version:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git pull; git checkout $(git describe --abbrev=0 --tags)
|
||||||
|
```
|
||||||
|
|
||||||
|
Then, make sure all Node dependencies are installed and all Git submodules are checked out:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm install && grunt
|
||||||
|
```
|
||||||
|
|
||||||
|
To create a custom build, use the following special `grunt` commands:
|
||||||
|
|
||||||
|
Exclude **ajax**:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
grunt custom:-ajax
|
||||||
|
```
|
||||||
|
|
||||||
|
Exclude **css**:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
grunt custom:-css
|
||||||
|
```
|
||||||
|
|
||||||
|
Exclude **deprecated**:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
grunt custom:-deprecated
|
||||||
|
```
|
||||||
|
|
||||||
|
Exclude **dimensions**:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
grunt custom:-dimensions
|
||||||
|
```
|
||||||
|
|
||||||
|
Exclude **effects**:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
grunt custom:-effects
|
||||||
|
```
|
||||||
|
|
||||||
|
Exclude **offset**:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
grunt custom:-offset
|
||||||
|
```
|
||||||
|
|
||||||
|
Exclude **all** optional modules:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
grunt custom:-ajax,-css,-deprecated,-dimensions,-effects,-offset
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
Note: dependencies will be handled internally, by the build process.
|
||||||
|
|
||||||
|
|
||||||
|
Running the Unit Tests
|
||||||
|
--------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
Start grunt to auto-build jQuery as you work:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd jquery && grunt watch
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
Run the unit tests with a local server that supports PHP. No database is required. Pre-configured php local servers are available for Windows and Mac. Here are some options:
|
||||||
|
|
||||||
|
- Windows: [WAMP download](http://www.wampserver.com/en/)
|
||||||
|
- Mac: [MAMP download](http://www.mamp.info/en/index.html)
|
||||||
|
- Linux: [Setting up LAMP](https://www.linux.com/learn/tutorials/288158-easy-lamp-server-installation)
|
||||||
|
- [Mongoose (most platforms)](http://code.google.com/p/mongoose/)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Building to a different directory
|
||||||
|
---------------------------------
|
||||||
|
|
||||||
|
If you want to build jQuery to a directory that is different from the default location:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
grunt && grunt dist:/path/to/special/location/
|
||||||
|
```
|
||||||
|
With this example, the output files would be:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
/path/to/special/location/jquery.js
|
||||||
|
/path/to/special/location/jquery.min.js
|
||||||
|
```
|
||||||
|
|
||||||
|
If you want to add a permanent copy destination, create a file in `dist/` called ".destination.json". Inside the file, paste and customize the following:
|
||||||
|
|
||||||
|
```json
|
||||||
|
|
||||||
|
{
|
||||||
|
"/Absolute/path/to/other/destination": true
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
Additionally, both methods can be combined.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Updating Submodules
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
Update the submodules to what is probably the latest upstream code.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
grunt update_submodules
|
||||||
|
```
|
||||||
|
|
||||||
|
Note: This task will also be run any time the default `grunt` command is used.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Git for dummies
|
||||||
|
---------------
|
||||||
|
|
||||||
|
As the source code is handled by the version control system Git, it's useful to know some features used.
|
||||||
|
|
||||||
|
### Submodules ###
|
||||||
|
|
||||||
|
The repository uses submodules, which normally are handled directly by the Makefile, but sometimes you want to
|
||||||
|
be able to work with them manually.
|
||||||
|
|
||||||
|
Following are the steps to manually get the submodules:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/jquery/jquery.git
|
||||||
|
cd jquery
|
||||||
|
git submodule init
|
||||||
|
git submodule update
|
||||||
|
```
|
||||||
|
|
||||||
|
Or:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/jquery/jquery.git
|
||||||
|
cd jquery
|
||||||
|
git submodule update --init
|
||||||
|
```
|
||||||
|
|
||||||
|
Or:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone --recursive https://github.com/jquery/jquery.git
|
||||||
|
cd jquery
|
||||||
|
```
|
||||||
|
|
||||||
|
If you want to work inside a submodule, it is possible, but first you need to checkout a branch:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd src/sizzle
|
||||||
|
git checkout master
|
||||||
|
```
|
||||||
|
|
||||||
|
After you've committed your changes to the submodule, you'll update the jquery project to point to the new commit,
|
||||||
|
but remember to push the submodule changes before pushing the new jquery commit:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd src/sizzle
|
||||||
|
git push origin master
|
||||||
|
cd ..
|
||||||
|
git add src/sizzle
|
||||||
|
git commit
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### cleaning ###
|
||||||
|
|
||||||
|
If you want to purge your working directory back to the status of upstream, following commands can be used (remember everything you've worked on is gone after these):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git reset --hard upstream/master
|
||||||
|
git clean -fdx
|
||||||
|
```
|
||||||
|
|
||||||
|
### rebasing ###
|
||||||
|
|
||||||
|
For feature/topic branches, you should always used the `--rebase` flag to `git pull`, or if you are usually handling many temporary "to be in a github pull request" branches, run following to automate this:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git config branch.autosetuprebase local
|
||||||
|
```
|
||||||
|
(see `man git-config` for more information)
|
||||||
|
|
||||||
|
### handling merge conflicts ###
|
||||||
|
|
||||||
|
If you're getting merge conflicts when merging, instead of editing the conflicted files manually, you can use the feature
|
||||||
|
`git mergetool`. Even though the default tool `xxdiff` looks awful/old, it's rather useful.
|
||||||
|
|
||||||
|
Following are some commands that can be used there:
|
||||||
|
|
||||||
|
* `Ctrl + Alt + M` - automerge as much as possible
|
||||||
|
* `b` - jump to next merge conflict
|
||||||
|
* `s` - change the order of the conflicted lines
|
||||||
|
* `u` - undo an merge
|
||||||
|
* `left mouse button` - mark a block to be the winner
|
||||||
|
* `middle mouse button` - mark a line to be the winner
|
||||||
|
* `Ctrl + S` - save
|
||||||
|
* `Ctrl + Q` - quit
|
||||||
|
|
||||||
|
[QUnit](http://docs.jquery.com/QUnit) Reference
|
||||||
|
-----------------
|
||||||
|
|
||||||
|
### Test methods ###
|
||||||
|
|
||||||
|
```js
|
||||||
|
expect( numAssertions );
|
||||||
|
stop();
|
||||||
|
start();
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
note: QUnit's eventual addition of an argument to stop/start is ignored in this test suite so that start and stop can be passed as callbacks without worrying about their parameters
|
||||||
|
|
||||||
|
### Test assertions ###
|
||||||
|
|
||||||
|
|
||||||
|
```js
|
||||||
|
ok( value, [message] );
|
||||||
|
equal( actual, expected, [message] );
|
||||||
|
notEqual( actual, expected, [message] );
|
||||||
|
deepEqual( actual, expected, [message] );
|
||||||
|
notDeepEqual( actual, expected, [message] );
|
||||||
|
strictEqual( actual, expected, [message] );
|
||||||
|
notStrictEqual( actual, expected, [message] );
|
||||||
|
raises( block, [expected], [message] );
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
Test Suite Convenience Methods Reference (See [test/data/testinit.js](https://github.com/jquery/jquery/blob/master/test/data/testinit.js))
|
||||||
|
------------------------------
|
||||||
|
|
||||||
|
### Returns an array of elements with the given IDs ###
|
||||||
|
|
||||||
|
```js
|
||||||
|
q( ... );
|
||||||
|
```
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```js
|
||||||
|
q("main", "foo", "bar");
|
||||||
|
|
||||||
|
=> [ div#main, span#foo, input#bar ]
|
||||||
|
```
|
||||||
|
|
||||||
|
### Asserts that a selection matches the given IDs ###
|
||||||
|
|
||||||
|
```js
|
||||||
|
t( testName, selector, [ "array", "of", "ids" ] );
|
||||||
|
```
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```js
|
||||||
|
t("Check for something", "//[a]", ["foo", "baar"]);
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Fires a native DOM event without going through jQuery ###
|
||||||
|
|
||||||
|
```js
|
||||||
|
fireNative( node, eventType )
|
||||||
|
```
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```js
|
||||||
|
fireNative( jQuery("#elem")[0], "click" );
|
||||||
|
```
|
||||||
|
|
||||||
|
### Add random number to url to stop caching ###
|
||||||
|
|
||||||
|
```js
|
||||||
|
url( "some/url.php" );
|
||||||
|
```
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```js
|
||||||
|
url("data/test.html");
|
||||||
|
|
||||||
|
=> "data/test.html?10538358428943"
|
||||||
|
|
||||||
|
|
||||||
|
url("data/test.php?foo=bar");
|
||||||
|
|
||||||
|
=> "data/test.php?foo=bar&10538358345554"
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### Load tests in an iframe ###
|
||||||
|
|
||||||
|
Loads a given page constructing a url with fileName: `"./data/" + fileName + ".html"`
|
||||||
|
and fires the given callback on jQuery ready (using the jQuery loading from that page)
|
||||||
|
and passes the iFrame's jQuery to the callback.
|
||||||
|
|
||||||
|
```js
|
||||||
|
testIframe( fileName, testName, callback );
|
||||||
|
```
|
||||||
|
|
||||||
|
Callback arguments:
|
||||||
|
|
||||||
|
```js
|
||||||
|
callback( jQueryFromIFrame, iFrameWindow, iFrameDocument );
|
||||||
|
```
|
||||||
|
|
||||||
|
### Load tests in an iframe (window.iframeCallback) ###
|
||||||
|
|
||||||
|
Loads a given page constructing a url with fileName: `"./data/" + fileName + ".html"`
|
||||||
|
The given callback is fired when window.iframeCallback is called by the page
|
||||||
|
The arguments passed to the callback are the same as the
|
||||||
|
arguments passed to window.iframeCallback, whatever that may be
|
||||||
|
|
||||||
|
```js
|
||||||
|
testIframeWithCallback( testName, fileName, callback );
|
||||||
|
```
|
||||||
|
|
||||||
|
Questions?
|
||||||
|
----------
|
||||||
|
|
||||||
|
If you have any questions, please feel free to ask on the
|
||||||
|
[Developing jQuery Core forum](http://forum.jquery.com/developing-jquery-core) or in #jquery on irc.freenode.net.
|
||||||
File diff suppressed because it is too large
Load Diff
20
vendor/json3/LICENSE
vendored
Normal file
20
vendor/json3/LICENSE
vendored
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
Copyright (c) 2012 Kit Cambridge.
|
||||||
|
http://kitcambridge.github.com
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
the Software without restriction, including without limitation the rights to
|
||||||
|
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||||
|
of the Software, and to permit persons to whom the Software is furnished to do
|
||||||
|
so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
124
vendor/json3/README.md
vendored
Normal file
124
vendor/json3/README.md
vendored
Normal file
@@ -0,0 +1,124 @@
|
|||||||
|
# JSON 3 #
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
**JSON 3** is a modern JSON implementation compatible with a variety of JavaScript platforms, including Internet Explorer 6, Opera 7, Safari 2, and Netscape 6. The current version is **3.2.4**.
|
||||||
|
|
||||||
|
- [Development Version](http://bestiejs.github.com/json3/lib/json3.js) *(36.5 KB; uncompressed with comments)*
|
||||||
|
- [Production Version](http://bestiejs.github.com/json3/lib/json3.min.js) *(3.0 KB; compressed and `gzip`-ped)*
|
||||||
|
|
||||||
|
[JSON](http://json.org/) is a language-independent data interchange format based on a loose subset of the JavaScript grammar. Originally popularized by [Douglas Crockford](http://www.crockford.com/), the format was standardized in the [fifth edition](http://es5.github.com/) of the ECMAScript specification. The 5.1 edition, ratified in June 2011, incorporates several modifications to the grammar pertaining to the serialization of dates.
|
||||||
|
|
||||||
|
JSON 3 exposes two functions: `stringify()` for [serializing](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/JSON/stringify) a JavaScript value to JSON, and `parse()` for [producing](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/JSON/parse) a JavaScript value from a JSON source string. It is a **drop-in replacement** for [JSON 2](http://json.org/js). The functions behave exactly as described in the ECMAScript spec, **except** for the date serialization discrepancy noted below.
|
||||||
|
|
||||||
|
The JSON 3 parser does **not** use `eval` or regular expressions. This provides security and performance benefits in obsolete and mobile environments, where the margin is particularly significant. The complete [benchmark suite](http://jsperf.com/json3) is available on [jsPerf](http://jsperf.com/).
|
||||||
|
|
||||||
|
The project is [hosted on GitHub](http://git.io/json3), along with the [unit tests](http://bestiejs.github.com/json3/test/test_browser.html). It is part of the [BestieJS](https://github.com/bestiejs) family, a collection of best-in-class JavaScript libraries that promote cross-platform support, specification precedents, unit testing, and plenty of documentation.
|
||||||
|
|
||||||
|
# Changes from JSON 2 #
|
||||||
|
|
||||||
|
JSON 3...
|
||||||
|
|
||||||
|
* Correctly serializes primitive wrapper objects.
|
||||||
|
* Throws a `TypeError` when serializing cyclic structures (JSON 2 recurses until the call stack overflows).
|
||||||
|
* Utilizes **feature tests** to detect broken or incomplete *native* JSON implementations (JSON 2 only checks for the presence of the native functions). The tests are only executed once at runtime, so there is no additional performance cost when parsing or serializing values.
|
||||||
|
|
||||||
|
**As of v3.2.3**, JSON 3 is compatible with [Prototype](http://prototypejs.org) 1.6.1 and older.
|
||||||
|
|
||||||
|
In contrast to JSON 2, JSON 3 **does not**...
|
||||||
|
|
||||||
|
* Add `toJSON()` methods to the `Boolean`, `Number`, and `String` prototypes. These are not part of any standard, and are made redundant by the design of the `stringify()` implementation.
|
||||||
|
* Add `toJSON()` or `toISOString()` methods to `Date.prototype`. See the note about date serialization below.
|
||||||
|
|
||||||
|
## Date Serialization
|
||||||
|
|
||||||
|
**JSON 3 deviates from the specification in one important way**: it does not define `Date#toISOString()` or `Date#toJSON()`. This preserves CommonJS compatibility and avoids polluting native prototypes. Instead, date serialization is performed internally by the `stringify()` implementation: if a date object does not define a custom `toJSON()` method, it is serialized as a [simplified ISO 8601 date-time string](http://es5.github.com/#x15.9.1.15).
|
||||||
|
|
||||||
|
**Several native `Date#toJSON()` implementations produce date time strings that do *not* conform to the grammar outlined in the spec**. For instance, all versions of Safari 4, as well as JSON 2, fail to serialize extended years correctly. Furthermore, JSON 2 and older implementations omit the milliseconds from the date-time string (optional in ES 5, but required in 5.1). Finally, in all versions of Safari 4 and 5, serializing an invalid date will produce the string `"Invalid Date"`, rather than `null`. Because these environments exhibit other serialization bugs, however, JSON 3 will override the native `stringify()` implementation.
|
||||||
|
|
||||||
|
Portions of the date serialization code are adapted from the [`date-shim`](https://github.com/Yaffle/date-shim) project.
|
||||||
|
|
||||||
|
# Usage #
|
||||||
|
|
||||||
|
## Web Browsers
|
||||||
|
|
||||||
|
<script src="http://bestiejs.github.com/json3/lib/json3.min.js"></script>
|
||||||
|
<script>
|
||||||
|
JSON.stringify({"Hello": 123});
|
||||||
|
// => '{"Hello":123}'
|
||||||
|
JSON.parse("[[1, 2, 3], 1, 2, 3, 4]", function (key, value) {
|
||||||
|
if (typeof value == "number") {
|
||||||
|
value = value % 2 ? "Odd" : "Even";
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
});
|
||||||
|
// => [["Odd", "Even", "Odd"], "Odd", "Even", "Odd", "Even"]
|
||||||
|
</script>
|
||||||
|
|
||||||
|
## CommonJS Environments
|
||||||
|
|
||||||
|
var JSON3 = require("./path/to/json3");
|
||||||
|
JSON3.parse("[1, 2, 3]");
|
||||||
|
// => [1, 2, 3]
|
||||||
|
|
||||||
|
## JavaScript Engines
|
||||||
|
|
||||||
|
load("path/to/json3.js");
|
||||||
|
JSON.stringify({"Hello": 123, "Good-bye": 456}, ["Hello"], "\t");
|
||||||
|
// => '{\n\t"Hello": 123\n}'
|
||||||
|
|
||||||
|
# Compatibility #
|
||||||
|
|
||||||
|
JSON 3 has been **tested** with the following web browsers, CommonJS environments, and JavaScript engines.
|
||||||
|
|
||||||
|
## Web Browsers
|
||||||
|
|
||||||
|
- Windows [Internet Explorer](http://www.microsoft.com/windows/internet-explorer), version 6.0 and higher
|
||||||
|
- Mozilla [Firefox](http://www.mozilla.com/firefox), version 1.0 and higher
|
||||||
|
- Apple [Safari](http://www.apple.com/safari), version 2.0 and higher
|
||||||
|
- [Opera](http://www.opera.com) 7.02 and higher
|
||||||
|
- [Mozilla](http://sillydog.org/narchive/gecko.php) 1.0, [Netscape](http://sillydog.org/narchive/) 6.2.3, and [SeaMonkey](http://www.seamonkey-project.org/) 1.0 and higher
|
||||||
|
|
||||||
|
## CommonJS Environments
|
||||||
|
|
||||||
|
- [Node](http://nodejs.org/) 0.2.6 and higher
|
||||||
|
- [RingoJS](http://ringojs.org/) 0.4 and higher
|
||||||
|
- [Narwhal](http://narwhaljs.org/) 0.3.2 and higher
|
||||||
|
|
||||||
|
## JavaScript Engines
|
||||||
|
|
||||||
|
- Mozilla [Rhino](http://www.mozilla.org/rhino) 1.5R5 and higher
|
||||||
|
- WebKit [JSC](https://trac.webkit.org/wiki/JSC)
|
||||||
|
- Google [V8](http://code.google.com/p/v8)
|
||||||
|
|
||||||
|
## Known Incompatibilities
|
||||||
|
|
||||||
|
* Attempting to serialize the `arguments` object may produce inconsistent results across environments due to specification version differences. As a workaround, please convert the `arguments` object to an array first: `JSON.stringify([].slice.call(arguments, 0))`.
|
||||||
|
|
||||||
|
## Required Native Methods
|
||||||
|
|
||||||
|
JSON 3 assumes that the following methods exist and function as described in the ECMAScript specification:
|
||||||
|
|
||||||
|
- The `Number`, `String`, `Array`, `Object`, `Date`, `SyntaxError`, and `TypeError` constructors.
|
||||||
|
- `String.fromCharCode`
|
||||||
|
- `Object#toString`
|
||||||
|
- `Function#call`
|
||||||
|
- `Math.floor`
|
||||||
|
- `Number#toString`
|
||||||
|
- `Date#valueOf`
|
||||||
|
- `String.prototype`: `indexOf`, `charCodeAt`, `charAt`, `slice`.
|
||||||
|
- `Array.prototype`: `push`, `pop`, `join`.
|
||||||
|
|
||||||
|
# Contribute #
|
||||||
|
|
||||||
|
Check out a working copy of the JSON 3 source code with [Git](http://git-scm.com/):
|
||||||
|
|
||||||
|
$ git clone git://github.com/bestiejs/json3.git
|
||||||
|
$ cd json3
|
||||||
|
$ git submodule update --init
|
||||||
|
|
||||||
|
If you'd like to contribute a feature or bug fix, you can [fork](http://help.github.com/fork-a-repo/) JSON 3, commit your changes, and [send a pull request](http://help.github.com/send-pull-requests/). Please make sure to update the unit tests in the `test` directory as well.
|
||||||
|
|
||||||
|
Alternatively, you can use the [GitHub issue tracker](https://github.com/bestiejs/json3/issues) to submit bug reports, feature requests, and questions, or send tweets to [@kitcambridge](http://twitter.com/kitcambridge).
|
||||||
|
|
||||||
|
JSON 3 is released under the [MIT License](http://kit.mit-license.org/).
|
||||||
783
vendor/json3/lib/json3.js
vendored
Normal file
783
vendor/json3/lib/json3.js
vendored
Normal file
@@ -0,0 +1,783 @@
|
|||||||
|
/*! JSON v3.2.4 | http://bestiejs.github.com/json3 | Copyright 2012, Kit Cambridge | http://kit.mit-license.org */
|
||||||
|
;(function () {
|
||||||
|
// Convenience aliases.
|
||||||
|
var getClass = {}.toString, isProperty, forEach, undef;
|
||||||
|
|
||||||
|
// Detect the `define` function exposed by asynchronous module loaders. The
|
||||||
|
// strict `define` check is necessary for compatibility with `r.js`.
|
||||||
|
var isLoader = typeof define === "function" && define.amd, JSON3 = !isLoader && typeof exports == "object" && exports;
|
||||||
|
|
||||||
|
if (JSON3 || isLoader) {
|
||||||
|
if (typeof JSON == "object" && JSON) {
|
||||||
|
// Delegate to the native `stringify` and `parse` implementations in
|
||||||
|
// asynchronous module loaders and CommonJS environments.
|
||||||
|
if (isLoader) {
|
||||||
|
JSON3 = JSON;
|
||||||
|
} else {
|
||||||
|
JSON3.stringify = JSON.stringify;
|
||||||
|
JSON3.parse = JSON.parse;
|
||||||
|
}
|
||||||
|
} else if (isLoader) {
|
||||||
|
JSON3 = this.JSON = {};
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Export for web browsers and JavaScript engines.
|
||||||
|
JSON3 = this.JSON || (this.JSON = {});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Local variables.
|
||||||
|
var Escapes, toPaddedString, quote, serialize;
|
||||||
|
var fromCharCode, Unescapes, abort, lex, get, walk, update, Index, Source;
|
||||||
|
|
||||||
|
// Test the `Date#getUTC*` methods. Based on work by @Yaffle.
|
||||||
|
var isExtended = new Date(-3509827334573292), floor, Months, getDay;
|
||||||
|
|
||||||
|
try {
|
||||||
|
// The `getUTCFullYear`, `Month`, and `Date` methods return nonsensical
|
||||||
|
// results for certain dates in Opera >= 10.53.
|
||||||
|
isExtended = isExtended.getUTCFullYear() == -109252 && isExtended.getUTCMonth() === 0 && isExtended.getUTCDate() == 1 &&
|
||||||
|
// Safari < 2.0.2 stores the internal millisecond time value correctly,
|
||||||
|
// but clips the values returned by the date methods to the range of
|
||||||
|
// signed 32-bit integers ([-2 ** 31, 2 ** 31 - 1]).
|
||||||
|
isExtended.getUTCHours() == 10 && isExtended.getUTCMinutes() == 37 && isExtended.getUTCSeconds() == 6 && isExtended.getUTCMilliseconds() == 708;
|
||||||
|
} catch (exception) {}
|
||||||
|
|
||||||
|
// Internal: Determines whether the native `JSON.stringify` and `parse`
|
||||||
|
// implementations are spec-compliant. Based on work by Ken Snyder.
|
||||||
|
function has(name) {
|
||||||
|
var stringifySupported, parseSupported, value, serialized = '{"A":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}', all = name == "json";
|
||||||
|
if (all || name == "json-stringify" || name == "json-parse") {
|
||||||
|
// Test `JSON.stringify`.
|
||||||
|
if (name == "json-stringify" || all) {
|
||||||
|
if ((stringifySupported = typeof JSON3.stringify == "function" && isExtended)) {
|
||||||
|
// A test function object with a custom `toJSON` method.
|
||||||
|
(value = function () {
|
||||||
|
return 1;
|
||||||
|
}).toJSON = value;
|
||||||
|
try {
|
||||||
|
stringifySupported =
|
||||||
|
// Firefox 3.1b1 and b2 serialize string, number, and boolean
|
||||||
|
// primitives as object literals.
|
||||||
|
JSON3.stringify(0) === "0" &&
|
||||||
|
// FF 3.1b1, b2, and JSON 2 serialize wrapped primitives as object
|
||||||
|
// literals.
|
||||||
|
JSON3.stringify(new Number()) === "0" &&
|
||||||
|
JSON3.stringify(new String()) == '""' &&
|
||||||
|
// FF 3.1b1, 2 throw an error if the value is `null`, `undefined`, or
|
||||||
|
// does not define a canonical JSON representation (this applies to
|
||||||
|
// objects with `toJSON` properties as well, *unless* they are nested
|
||||||
|
// within an object or array).
|
||||||
|
JSON3.stringify(getClass) === undef &&
|
||||||
|
// IE 8 serializes `undefined` as `"undefined"`. Safari <= 5.1.7 and
|
||||||
|
// FF 3.1b3 pass this test.
|
||||||
|
JSON3.stringify(undef) === undef &&
|
||||||
|
// Safari <= 5.1.7 and FF 3.1b3 throw `Error`s and `TypeError`s,
|
||||||
|
// respectively, if the value is omitted entirely.
|
||||||
|
JSON3.stringify() === undef &&
|
||||||
|
// FF 3.1b1, 2 throw an error if the given value is not a number,
|
||||||
|
// string, array, object, Boolean, or `null` literal. This applies to
|
||||||
|
// objects with custom `toJSON` methods as well, unless they are nested
|
||||||
|
// inside object or array literals. YUI 3.0.0b1 ignores custom `toJSON`
|
||||||
|
// methods entirely.
|
||||||
|
JSON3.stringify(value) === "1" &&
|
||||||
|
JSON3.stringify([value]) == "[1]" &&
|
||||||
|
// Prototype <= 1.6.1 serializes `[undefined]` as `"[]"` instead of
|
||||||
|
// `"[null]"`.
|
||||||
|
JSON3.stringify([undef]) == "[null]" &&
|
||||||
|
// YUI 3.0.0b1 fails to serialize `null` literals.
|
||||||
|
JSON3.stringify(null) == "null" &&
|
||||||
|
// FF 3.1b1, 2 halts serialization if an array contains a function:
|
||||||
|
// `[1, true, getClass, 1]` serializes as "[1,true,],". These versions
|
||||||
|
// of Firefox also allow trailing commas in JSON objects and arrays.
|
||||||
|
// FF 3.1b3 elides non-JSON values from objects and arrays, unless they
|
||||||
|
// define custom `toJSON` methods.
|
||||||
|
JSON3.stringify([undef, getClass, null]) == "[null,null,null]" &&
|
||||||
|
// Simple serialization test. FF 3.1b1 uses Unicode escape sequences
|
||||||
|
// where character escape codes are expected (e.g., `\b` => `\u0008`).
|
||||||
|
JSON3.stringify({ "A": [value, true, false, null, "\0\b\n\f\r\t"] }) == serialized &&
|
||||||
|
// FF 3.1b1 and b2 ignore the `filter` and `width` arguments.
|
||||||
|
JSON3.stringify(null, value) === "1" &&
|
||||||
|
JSON3.stringify([1, 2], null, 1) == "[\n 1,\n 2\n]" &&
|
||||||
|
// JSON 2, Prototype <= 1.7, and older WebKit builds incorrectly
|
||||||
|
// serialize extended years.
|
||||||
|
JSON3.stringify(new Date(-8.64e15)) == '"-271821-04-20T00:00:00.000Z"' &&
|
||||||
|
// The milliseconds are optional in ES 5, but required in 5.1.
|
||||||
|
JSON3.stringify(new Date(8.64e15)) == '"+275760-09-13T00:00:00.000Z"' &&
|
||||||
|
// Firefox <= 11.0 incorrectly serializes years prior to 0 as negative
|
||||||
|
// four-digit years instead of six-digit years. Credits: @Yaffle.
|
||||||
|
JSON3.stringify(new Date(-621987552e5)) == '"-000001-01-01T00:00:00.000Z"' &&
|
||||||
|
// Safari <= 5.1.5 and Opera >= 10.53 incorrectly serialize millisecond
|
||||||
|
// values less than 1000. Credits: @Yaffle.
|
||||||
|
JSON3.stringify(new Date(-1)) == '"1969-12-31T23:59:59.999Z"';
|
||||||
|
} catch (exception) {
|
||||||
|
stringifySupported = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!all) {
|
||||||
|
return stringifySupported;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Test `JSON.parse`.
|
||||||
|
if (name == "json-parse" || all) {
|
||||||
|
if (typeof JSON3.parse == "function") {
|
||||||
|
try {
|
||||||
|
// FF 3.1b1, b2 will throw an exception if a bare literal is provided.
|
||||||
|
// Conforming implementations should also coerce the initial argument to
|
||||||
|
// a string prior to parsing.
|
||||||
|
if (JSON3.parse("0") === 0 && !JSON3.parse(false)) {
|
||||||
|
// Simple parsing test.
|
||||||
|
value = JSON3.parse(serialized);
|
||||||
|
if ((parseSupported = value.A.length == 5 && value.A[0] == 1)) {
|
||||||
|
try {
|
||||||
|
// Safari <= 5.1.2 and FF 3.1b1 allow unescaped tabs in strings.
|
||||||
|
parseSupported = !JSON3.parse('"\t"');
|
||||||
|
} catch (exception) {}
|
||||||
|
if (parseSupported) {
|
||||||
|
try {
|
||||||
|
// FF 4.0 and 4.0.1 allow leading `+` signs, and leading and
|
||||||
|
// trailing decimal points. FF 4.0, 4.0.1, and IE 9-10 also
|
||||||
|
// allow certain octal literals.
|
||||||
|
parseSupported = JSON3.parse("01") != 1;
|
||||||
|
} catch (exception) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (exception) {
|
||||||
|
parseSupported = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!all) {
|
||||||
|
return parseSupported;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return stringifySupported && parseSupported;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!has("json")) {
|
||||||
|
// Define additional utility methods if the `Date` methods are buggy.
|
||||||
|
if (!isExtended) {
|
||||||
|
floor = Math.floor;
|
||||||
|
// A mapping between the months of the year and the number of days between
|
||||||
|
// January 1st and the first of the respective month.
|
||||||
|
Months = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334];
|
||||||
|
// Internal: Calculates the number of days between the Unix epoch and the
|
||||||
|
// first day of the given month.
|
||||||
|
getDay = function (year, month) {
|
||||||
|
return Months[month] + 365 * (year - 1970) + floor((year - 1969 + (month = +(month > 1))) / 4) - floor((year - 1901 + month) / 100) + floor((year - 1601 + month) / 400);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Internal: Determines if a property is a direct property of the given
|
||||||
|
// object. Delegates to the native `Object#hasOwnProperty` method.
|
||||||
|
if (!(isProperty = {}.hasOwnProperty)) {
|
||||||
|
isProperty = function (property) {
|
||||||
|
var members = {}, constructor;
|
||||||
|
if ((members.__proto__ = null, members.__proto__ = {
|
||||||
|
// The *proto* property cannot be set multiple times in recent
|
||||||
|
// versions of Firefox and SeaMonkey.
|
||||||
|
"toString": 1
|
||||||
|
}, members).toString != getClass) {
|
||||||
|
// Safari <= 2.0.3 doesn't implement `Object#hasOwnProperty`, but
|
||||||
|
// supports the mutable *proto* property.
|
||||||
|
isProperty = function (property) {
|
||||||
|
// Capture and break the object's prototype chain (see section 8.6.2
|
||||||
|
// of the ES 5.1 spec). The parenthesized expression prevents an
|
||||||
|
// unsafe transformation by the Closure Compiler.
|
||||||
|
var original = this.__proto__, result = property in (this.__proto__ = null, this);
|
||||||
|
// Restore the original prototype chain.
|
||||||
|
this.__proto__ = original;
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
// Capture a reference to the top-level `Object` constructor.
|
||||||
|
constructor = members.constructor;
|
||||||
|
// Use the `constructor` property to simulate `Object#hasOwnProperty` in
|
||||||
|
// other environments.
|
||||||
|
isProperty = function (property) {
|
||||||
|
var parent = (this.constructor || constructor).prototype;
|
||||||
|
return property in this && !(property in parent && this[property] === parent[property]);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
members = null;
|
||||||
|
return isProperty.call(this, property);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Internal: Normalizes the `for...in` iteration algorithm across
|
||||||
|
// environments. Each enumerated key is yielded to a `callback` function.
|
||||||
|
forEach = function (object, callback) {
|
||||||
|
var size = 0, Properties, members, property, forEach;
|
||||||
|
|
||||||
|
// Tests for bugs in the current environment's `for...in` algorithm. The
|
||||||
|
// `valueOf` property inherits the non-enumerable flag from
|
||||||
|
// `Object.prototype` in older versions of IE, Netscape, and Mozilla.
|
||||||
|
(Properties = function () {
|
||||||
|
this.valueOf = 0;
|
||||||
|
}).prototype.valueOf = 0;
|
||||||
|
|
||||||
|
// Iterate over a new instance of the `Properties` class.
|
||||||
|
members = new Properties();
|
||||||
|
for (property in members) {
|
||||||
|
// Ignore all properties inherited from `Object.prototype`.
|
||||||
|
if (isProperty.call(members, property)) {
|
||||||
|
size++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Properties = members = null;
|
||||||
|
|
||||||
|
// Normalize the iteration algorithm.
|
||||||
|
if (!size) {
|
||||||
|
// A list of non-enumerable properties inherited from `Object.prototype`.
|
||||||
|
members = ["valueOf", "toString", "toLocaleString", "propertyIsEnumerable", "isPrototypeOf", "hasOwnProperty", "constructor"];
|
||||||
|
// IE <= 8, Mozilla 1.0, and Netscape 6.2 ignore shadowed non-enumerable
|
||||||
|
// properties.
|
||||||
|
forEach = function (object, callback) {
|
||||||
|
var isFunction = getClass.call(object) == "[object Function]", property, length;
|
||||||
|
for (property in object) {
|
||||||
|
// Gecko <= 1.0 enumerates the `prototype` property of functions under
|
||||||
|
// certain conditions; IE does not.
|
||||||
|
if (!(isFunction && property == "prototype") && isProperty.call(object, property)) {
|
||||||
|
callback(property);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Manually invoke the callback for each non-enumerable property.
|
||||||
|
for (length = members.length; property = members[--length]; isProperty.call(object, property) && callback(property));
|
||||||
|
};
|
||||||
|
} else if (size == 2) {
|
||||||
|
// Safari <= 2.0.4 enumerates shadowed properties twice.
|
||||||
|
forEach = function (object, callback) {
|
||||||
|
// Create a set of iterated properties.
|
||||||
|
var members = {}, isFunction = getClass.call(object) == "[object Function]", property;
|
||||||
|
for (property in object) {
|
||||||
|
// Store each property name to prevent double enumeration. The
|
||||||
|
// `prototype` property of functions is not enumerated due to cross-
|
||||||
|
// environment inconsistencies.
|
||||||
|
if (!(isFunction && property == "prototype") && !isProperty.call(members, property) && (members[property] = 1) && isProperty.call(object, property)) {
|
||||||
|
callback(property);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
// No bugs detected; use the standard `for...in` algorithm.
|
||||||
|
forEach = function (object, callback) {
|
||||||
|
var isFunction = getClass.call(object) == "[object Function]", property, isConstructor;
|
||||||
|
for (property in object) {
|
||||||
|
if (!(isFunction && property == "prototype") && isProperty.call(object, property) && !(isConstructor = property === "constructor")) {
|
||||||
|
callback(property);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Manually invoke the callback for the `constructor` property due to
|
||||||
|
// cross-environment inconsistencies.
|
||||||
|
if (isConstructor || isProperty.call(object, (property = "constructor"))) {
|
||||||
|
callback(property);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return forEach(object, callback);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Public: Serializes a JavaScript `value` as a JSON string. The optional
|
||||||
|
// `filter` argument may specify either a function that alters how object and
|
||||||
|
// array members are serialized, or an array of strings and numbers that
|
||||||
|
// indicates which properties should be serialized. The optional `width`
|
||||||
|
// argument may be either a string or number that specifies the indentation
|
||||||
|
// level of the output.
|
||||||
|
if (!has("json-stringify")) {
|
||||||
|
// Internal: A map of control characters and their escaped equivalents.
|
||||||
|
Escapes = {
|
||||||
|
"\\": "\\\\",
|
||||||
|
'"': '\\"',
|
||||||
|
"\b": "\\b",
|
||||||
|
"\f": "\\f",
|
||||||
|
"\n": "\\n",
|
||||||
|
"\r": "\\r",
|
||||||
|
"\t": "\\t"
|
||||||
|
};
|
||||||
|
|
||||||
|
// Internal: Converts `value` into a zero-padded string such that its
|
||||||
|
// length is at least equal to `width`. The `width` must be <= 6.
|
||||||
|
toPaddedString = function (width, value) {
|
||||||
|
// The `|| 0` expression is necessary to work around a bug in
|
||||||
|
// Opera <= 7.54u2 where `0 == -0`, but `String(-0) !== "0"`.
|
||||||
|
return ("000000" + (value || 0)).slice(-width);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Internal: Double-quotes a string `value`, replacing all ASCII control
|
||||||
|
// characters (characters with code unit values between 0 and 31) with
|
||||||
|
// their escaped equivalents. This is an implementation of the
|
||||||
|
// `Quote(value)` operation defined in ES 5.1 section 15.12.3.
|
||||||
|
quote = function (value) {
|
||||||
|
var result = '"', index = 0, symbol;
|
||||||
|
for (; symbol = value.charAt(index); index++) {
|
||||||
|
// Escape the reverse solidus, double quote, backspace, form feed, line
|
||||||
|
// feed, carriage return, and tab characters.
|
||||||
|
result += '\\"\b\f\n\r\t'.indexOf(symbol) > -1 ? Escapes[symbol] :
|
||||||
|
// If the character is a control character, append its Unicode escape
|
||||||
|
// sequence; otherwise, append the character as-is.
|
||||||
|
(Escapes[symbol] = symbol < " " ? "\\u00" + toPaddedString(2, symbol.charCodeAt(0).toString(16)) : symbol);
|
||||||
|
}
|
||||||
|
return result + '"';
|
||||||
|
};
|
||||||
|
|
||||||
|
// Internal: Recursively serializes an object. Implements the
|
||||||
|
// `Str(key, holder)`, `JO(value)`, and `JA(value)` operations.
|
||||||
|
serialize = function (property, object, callback, properties, whitespace, indentation, stack) {
|
||||||
|
var value = object[property], className, year, month, date, time, hours, minutes, seconds, milliseconds, results, element, index, length, prefix, any, result;
|
||||||
|
if (typeof value == "object" && value) {
|
||||||
|
className = getClass.call(value);
|
||||||
|
if (className == "[object Date]" && !isProperty.call(value, "toJSON")) {
|
||||||
|
if (value > -1 / 0 && value < 1 / 0) {
|
||||||
|
// Dates are serialized according to the `Date#toJSON` method
|
||||||
|
// specified in ES 5.1 section 15.9.5.44. See section 15.9.1.15
|
||||||
|
// for the ISO 8601 date time string format.
|
||||||
|
if (getDay) {
|
||||||
|
// Manually compute the year, month, date, hours, minutes,
|
||||||
|
// seconds, and milliseconds if the `getUTC*` methods are
|
||||||
|
// buggy. Adapted from @Yaffle's `date-shim` project.
|
||||||
|
date = floor(value / 864e5);
|
||||||
|
for (year = floor(date / 365.2425) + 1970 - 1; getDay(year + 1, 0) <= date; year++);
|
||||||
|
for (month = floor((date - getDay(year, 0)) / 30.42); getDay(year, month + 1) <= date; month++);
|
||||||
|
date = 1 + date - getDay(year, month);
|
||||||
|
// The `time` value specifies the time within the day (see ES
|
||||||
|
// 5.1 section 15.9.1.2). The formula `(A % B + B) % B` is used
|
||||||
|
// to compute `A modulo B`, as the `%` operator does not
|
||||||
|
// correspond to the `modulo` operation for negative numbers.
|
||||||
|
time = (value % 864e5 + 864e5) % 864e5;
|
||||||
|
// The hours, minutes, seconds, and milliseconds are obtained by
|
||||||
|
// decomposing the time within the day. See section 15.9.1.10.
|
||||||
|
hours = floor(time / 36e5) % 24;
|
||||||
|
minutes = floor(time / 6e4) % 60;
|
||||||
|
seconds = floor(time / 1e3) % 60;
|
||||||
|
milliseconds = time % 1e3;
|
||||||
|
} else {
|
||||||
|
year = value.getUTCFullYear();
|
||||||
|
month = value.getUTCMonth();
|
||||||
|
date = value.getUTCDate();
|
||||||
|
hours = value.getUTCHours();
|
||||||
|
minutes = value.getUTCMinutes();
|
||||||
|
seconds = value.getUTCSeconds();
|
||||||
|
milliseconds = value.getUTCMilliseconds();
|
||||||
|
}
|
||||||
|
// Serialize extended years correctly.
|
||||||
|
value = (year <= 0 || year >= 1e4 ? (year < 0 ? "-" : "+") + toPaddedString(6, year < 0 ? -year : year) : toPaddedString(4, year)) +
|
||||||
|
"-" + toPaddedString(2, month + 1) + "-" + toPaddedString(2, date) +
|
||||||
|
// Months, dates, hours, minutes, and seconds should have two
|
||||||
|
// digits; milliseconds should have three.
|
||||||
|
"T" + toPaddedString(2, hours) + ":" + toPaddedString(2, minutes) + ":" + toPaddedString(2, seconds) +
|
||||||
|
// Milliseconds are optional in ES 5.0, but required in 5.1.
|
||||||
|
"." + toPaddedString(3, milliseconds) + "Z";
|
||||||
|
} else {
|
||||||
|
value = null;
|
||||||
|
}
|
||||||
|
} else if (typeof value.toJSON == "function" && ((className != "[object Number]" && className != "[object String]" && className != "[object Array]") || isProperty.call(value, "toJSON"))) {
|
||||||
|
// Prototype <= 1.6.1 adds non-standard `toJSON` methods to the
|
||||||
|
// `Number`, `String`, `Date`, and `Array` prototypes. JSON 3
|
||||||
|
// ignores all `toJSON` methods on these objects unless they are
|
||||||
|
// defined directly on an instance.
|
||||||
|
value = value.toJSON(property);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (callback) {
|
||||||
|
// If a replacement function was provided, call it to obtain the value
|
||||||
|
// for serialization.
|
||||||
|
value = callback.call(object, property, value);
|
||||||
|
}
|
||||||
|
if (value === null) {
|
||||||
|
return "null";
|
||||||
|
}
|
||||||
|
className = getClass.call(value);
|
||||||
|
if (className == "[object Boolean]") {
|
||||||
|
// Booleans are represented literally.
|
||||||
|
return "" + value;
|
||||||
|
} else if (className == "[object Number]") {
|
||||||
|
// JSON numbers must be finite. `Infinity` and `NaN` are serialized as
|
||||||
|
// `"null"`.
|
||||||
|
return value > -1 / 0 && value < 1 / 0 ? "" + value : "null";
|
||||||
|
} else if (className == "[object String]") {
|
||||||
|
// Strings are double-quoted and escaped.
|
||||||
|
return quote(value);
|
||||||
|
}
|
||||||
|
// Recursively serialize objects and arrays.
|
||||||
|
if (typeof value == "object") {
|
||||||
|
// Check for cyclic structures. This is a linear search; performance
|
||||||
|
// is inversely proportional to the number of unique nested objects.
|
||||||
|
for (length = stack.length; length--;) {
|
||||||
|
if (stack[length] === value) {
|
||||||
|
// Cyclic structures cannot be serialized by `JSON.stringify`.
|
||||||
|
throw TypeError();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Add the object to the stack of traversed objects.
|
||||||
|
stack.push(value);
|
||||||
|
results = [];
|
||||||
|
// Save the current indentation level and indent one additional level.
|
||||||
|
prefix = indentation;
|
||||||
|
indentation += whitespace;
|
||||||
|
if (className == "[object Array]") {
|
||||||
|
// Recursively serialize array elements.
|
||||||
|
for (index = 0, length = value.length; index < length; any || (any = true), index++) {
|
||||||
|
element = serialize(index, value, callback, properties, whitespace, indentation, stack);
|
||||||
|
results.push(element === undef ? "null" : element);
|
||||||
|
}
|
||||||
|
result = any ? (whitespace ? "[\n" + indentation + results.join(",\n" + indentation) + "\n" + prefix + "]" : ("[" + results.join(",") + "]")) : "[]";
|
||||||
|
} else {
|
||||||
|
// Recursively serialize object members. Members are selected from
|
||||||
|
// either a user-specified list of property names, or the object
|
||||||
|
// itself.
|
||||||
|
forEach(properties || value, function (property) {
|
||||||
|
var element = serialize(property, value, callback, properties, whitespace, indentation, stack);
|
||||||
|
if (element !== undef) {
|
||||||
|
// According to ES 5.1 section 15.12.3: "If `gap` {whitespace}
|
||||||
|
// is not the empty string, let `member` {quote(property) + ":"}
|
||||||
|
// be the concatenation of `member` and the `space` character."
|
||||||
|
// The "`space` character" refers to the literal space
|
||||||
|
// character, not the `space` {width} argument provided to
|
||||||
|
// `JSON.stringify`.
|
||||||
|
results.push(quote(property) + ":" + (whitespace ? " " : "") + element);
|
||||||
|
}
|
||||||
|
any || (any = true);
|
||||||
|
});
|
||||||
|
result = any ? (whitespace ? "{\n" + indentation + results.join(",\n" + indentation) + "\n" + prefix + "}" : ("{" + results.join(",") + "}")) : "{}";
|
||||||
|
}
|
||||||
|
// Remove the object from the traversed object stack.
|
||||||
|
stack.pop();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Public: `JSON.stringify`. See ES 5.1 section 15.12.3.
|
||||||
|
JSON3.stringify = function (source, filter, width) {
|
||||||
|
var whitespace, callback, properties, index, length, value;
|
||||||
|
if (typeof filter == "function" || typeof filter == "object" && filter) {
|
||||||
|
if (getClass.call(filter) == "[object Function]") {
|
||||||
|
callback = filter;
|
||||||
|
} else if (getClass.call(filter) == "[object Array]") {
|
||||||
|
// Convert the property names array into a makeshift set.
|
||||||
|
properties = {};
|
||||||
|
for (index = 0, length = filter.length; index < length; value = filter[index++], ((getClass.call(value) == "[object String]" || getClass.call(value) == "[object Number]") && (properties[value] = 1)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (width) {
|
||||||
|
if (getClass.call(width) == "[object Number]") {
|
||||||
|
// Convert the `width` to an integer and create a string containing
|
||||||
|
// `width` number of space characters.
|
||||||
|
if ((width -= width % 1) > 0) {
|
||||||
|
for (whitespace = "", width > 10 && (width = 10); whitespace.length < width; whitespace += " ");
|
||||||
|
}
|
||||||
|
} else if (getClass.call(width) == "[object String]") {
|
||||||
|
whitespace = width.length <= 10 ? width : width.slice(0, 10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Opera <= 7.54u2 discards the values associated with empty string keys
|
||||||
|
// (`""`) only if they are used directly within an object member list
|
||||||
|
// (e.g., `!("" in { "": 1})`).
|
||||||
|
return serialize("", (value = {}, value[""] = source, value), callback, properties, whitespace, "", []);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Public: Parses a JSON source string.
|
||||||
|
if (!has("json-parse")) {
|
||||||
|
fromCharCode = String.fromCharCode;
|
||||||
|
// Internal: A map of escaped control characters and their unescaped
|
||||||
|
// equivalents.
|
||||||
|
Unescapes = {
|
||||||
|
"\\": "\\",
|
||||||
|
'"': '"',
|
||||||
|
"/": "/",
|
||||||
|
"b": "\b",
|
||||||
|
"t": "\t",
|
||||||
|
"n": "\n",
|
||||||
|
"f": "\f",
|
||||||
|
"r": "\r"
|
||||||
|
};
|
||||||
|
|
||||||
|
// Internal: Resets the parser state and throws a `SyntaxError`.
|
||||||
|
abort = function() {
|
||||||
|
Index = Source = null;
|
||||||
|
throw SyntaxError();
|
||||||
|
};
|
||||||
|
|
||||||
|
// Internal: Returns the next token, or `"$"` if the parser has reached
|
||||||
|
// the end of the source string. A token may be a string, number, `null`
|
||||||
|
// literal, or Boolean literal.
|
||||||
|
lex = function () {
|
||||||
|
var source = Source, length = source.length, symbol, value, begin, position, sign;
|
||||||
|
while (Index < length) {
|
||||||
|
symbol = source.charAt(Index);
|
||||||
|
if ("\t\r\n ".indexOf(symbol) > -1) {
|
||||||
|
// Skip whitespace tokens, including tabs, carriage returns, line
|
||||||
|
// feeds, and space characters.
|
||||||
|
Index++;
|
||||||
|
} else if ("{}[]:,".indexOf(symbol) > -1) {
|
||||||
|
// Parse a punctuator token at the current position.
|
||||||
|
Index++;
|
||||||
|
return symbol;
|
||||||
|
} else if (symbol == '"') {
|
||||||
|
// Advance to the next character and parse a JSON string at the
|
||||||
|
// current position. String tokens are prefixed with the sentinel
|
||||||
|
// `@` character to distinguish them from punctuators.
|
||||||
|
for (value = "@", Index++; Index < length;) {
|
||||||
|
symbol = source.charAt(Index);
|
||||||
|
if (symbol < " ") {
|
||||||
|
// Unescaped ASCII control characters are not permitted.
|
||||||
|
abort();
|
||||||
|
} else if (symbol == "\\") {
|
||||||
|
// Parse escaped JSON control characters, `"`, `\`, `/`, and
|
||||||
|
// Unicode escape sequences.
|
||||||
|
symbol = source.charAt(++Index);
|
||||||
|
if ('\\"/btnfr'.indexOf(symbol) > -1) {
|
||||||
|
// Revive escaped control characters.
|
||||||
|
value += Unescapes[symbol];
|
||||||
|
Index++;
|
||||||
|
} else if (symbol == "u") {
|
||||||
|
// Advance to the first character of the escape sequence.
|
||||||
|
begin = ++Index;
|
||||||
|
// Validate the Unicode escape sequence.
|
||||||
|
for (position = Index + 4; Index < position; Index++) {
|
||||||
|
symbol = source.charAt(Index);
|
||||||
|
// A valid sequence comprises four hexdigits that form a
|
||||||
|
// single hexadecimal value.
|
||||||
|
if (!(symbol >= "0" && symbol <= "9" || symbol >= "a" && symbol <= "f" || symbol >= "A" && symbol <= "F")) {
|
||||||
|
// Invalid Unicode escape sequence.
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Revive the escaped character.
|
||||||
|
value += fromCharCode("0x" + source.slice(begin, Index));
|
||||||
|
} else {
|
||||||
|
// Invalid escape sequence.
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (symbol == '"') {
|
||||||
|
// An unescaped double-quote character marks the end of the
|
||||||
|
// string.
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// Append the original character as-is.
|
||||||
|
value += symbol;
|
||||||
|
Index++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (source.charAt(Index) == '"') {
|
||||||
|
Index++;
|
||||||
|
// Return the revived string.
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
// Unterminated string.
|
||||||
|
abort();
|
||||||
|
} else {
|
||||||
|
// Parse numbers and literals.
|
||||||
|
begin = Index;
|
||||||
|
// Advance the scanner's position past the sign, if one is
|
||||||
|
// specified.
|
||||||
|
if (symbol == "-") {
|
||||||
|
sign = true;
|
||||||
|
symbol = source.charAt(++Index);
|
||||||
|
}
|
||||||
|
// Parse an integer or floating-point value.
|
||||||
|
if (symbol >= "0" && symbol <= "9") {
|
||||||
|
// Leading zeroes are interpreted as octal literals.
|
||||||
|
if (symbol == "0" && (symbol = source.charAt(Index + 1), symbol >= "0" && symbol <= "9")) {
|
||||||
|
// Illegal octal literal.
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
sign = false;
|
||||||
|
// Parse the integer component.
|
||||||
|
for (; Index < length && (symbol = source.charAt(Index), symbol >= "0" && symbol <= "9"); Index++);
|
||||||
|
// Floats cannot contain a leading decimal point; however, this
|
||||||
|
// case is already accounted for by the parser.
|
||||||
|
if (source.charAt(Index) == ".") {
|
||||||
|
position = ++Index;
|
||||||
|
// Parse the decimal component.
|
||||||
|
for (; position < length && (symbol = source.charAt(position), symbol >= "0" && symbol <= "9"); position++);
|
||||||
|
if (position == Index) {
|
||||||
|
// Illegal trailing decimal.
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
Index = position;
|
||||||
|
}
|
||||||
|
// Parse exponents.
|
||||||
|
symbol = source.charAt(Index);
|
||||||
|
if (symbol == "e" || symbol == "E") {
|
||||||
|
// Skip past the sign following the exponent, if one is
|
||||||
|
// specified.
|
||||||
|
symbol = source.charAt(++Index);
|
||||||
|
if (symbol == "+" || symbol == "-") {
|
||||||
|
Index++;
|
||||||
|
}
|
||||||
|
// Parse the exponential component.
|
||||||
|
for (position = Index; position < length && (symbol = source.charAt(position), symbol >= "0" && symbol <= "9"); position++);
|
||||||
|
if (position == Index) {
|
||||||
|
// Illegal empty exponent.
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
Index = position;
|
||||||
|
}
|
||||||
|
// Coerce the parsed value to a JavaScript number.
|
||||||
|
return +source.slice(begin, Index);
|
||||||
|
}
|
||||||
|
// A negative sign may only precede numbers.
|
||||||
|
if (sign) {
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
// `true`, `false`, and `null` literals.
|
||||||
|
if (source.slice(Index, Index + 4) == "true") {
|
||||||
|
Index += 4;
|
||||||
|
return true;
|
||||||
|
} else if (source.slice(Index, Index + 5) == "false") {
|
||||||
|
Index += 5;
|
||||||
|
return false;
|
||||||
|
} else if (source.slice(Index, Index + 4) == "null") {
|
||||||
|
Index += 4;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
// Unrecognized token.
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Return the sentinel `$` character if the parser has reached the end
|
||||||
|
// of the source string.
|
||||||
|
return "$";
|
||||||
|
};
|
||||||
|
|
||||||
|
// Internal: Parses a JSON `value` token.
|
||||||
|
get = function (value) {
|
||||||
|
var results, any, key;
|
||||||
|
if (value == "$") {
|
||||||
|
// Unexpected end of input.
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
if (typeof value == "string") {
|
||||||
|
if (value.charAt(0) == "@") {
|
||||||
|
// Remove the sentinel `@` character.
|
||||||
|
return value.slice(1);
|
||||||
|
}
|
||||||
|
// Parse object and array literals.
|
||||||
|
if (value == "[") {
|
||||||
|
// Parses a JSON array, returning a new JavaScript array.
|
||||||
|
results = [];
|
||||||
|
for (;; any || (any = true)) {
|
||||||
|
value = lex();
|
||||||
|
// A closing square bracket marks the end of the array literal.
|
||||||
|
if (value == "]") {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// If the array literal contains elements, the current token
|
||||||
|
// should be a comma separating the previous element from the
|
||||||
|
// next.
|
||||||
|
if (any) {
|
||||||
|
if (value == ",") {
|
||||||
|
value = lex();
|
||||||
|
if (value == "]") {
|
||||||
|
// Unexpected trailing `,` in array literal.
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// A `,` must separate each array element.
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Elisions and leading commas are not permitted.
|
||||||
|
if (value == ",") {
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
results.push(get(value));
|
||||||
|
}
|
||||||
|
return results;
|
||||||
|
} else if (value == "{") {
|
||||||
|
// Parses a JSON object, returning a new JavaScript object.
|
||||||
|
results = {};
|
||||||
|
for (;; any || (any = true)) {
|
||||||
|
value = lex();
|
||||||
|
// A closing curly brace marks the end of the object literal.
|
||||||
|
if (value == "}") {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// If the object literal contains members, the current token
|
||||||
|
// should be a comma separator.
|
||||||
|
if (any) {
|
||||||
|
if (value == ",") {
|
||||||
|
value = lex();
|
||||||
|
if (value == "}") {
|
||||||
|
// Unexpected trailing `,` in object literal.
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// A `,` must separate each object member.
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Leading commas are not permitted, object property names must be
|
||||||
|
// double-quoted strings, and a `:` must separate each property
|
||||||
|
// name and value.
|
||||||
|
if (value == "," || typeof value != "string" || value.charAt(0) != "@" || lex() != ":") {
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
results[value.slice(1)] = get(lex());
|
||||||
|
}
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
// Unexpected token encountered.
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Internal: Updates a traversed object member.
|
||||||
|
update = function(source, property, callback) {
|
||||||
|
var element = walk(source, property, callback);
|
||||||
|
if (element === undef) {
|
||||||
|
delete source[property];
|
||||||
|
} else {
|
||||||
|
source[property] = element;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Internal: Recursively traverses a parsed JSON object, invoking the
|
||||||
|
// `callback` function for each value. This is an implementation of the
|
||||||
|
// `Walk(holder, name)` operation defined in ES 5.1 section 15.12.2.
|
||||||
|
walk = function (source, property, callback) {
|
||||||
|
var value = source[property], length;
|
||||||
|
if (typeof value == "object" && value) {
|
||||||
|
if (getClass.call(value) == "[object Array]") {
|
||||||
|
for (length = value.length; length--;) {
|
||||||
|
update(value, length, callback);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// `forEach` can't be used to traverse an array in Opera <= 8.54,
|
||||||
|
// as `Object#hasOwnProperty` returns `false` for array indices
|
||||||
|
// (e.g., `![1, 2, 3].hasOwnProperty("0")`).
|
||||||
|
forEach(value, function (property) {
|
||||||
|
update(value, property, callback);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return callback.call(source, property, value);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Public: `JSON.parse`. See ES 5.1 section 15.12.2.
|
||||||
|
JSON3.parse = function (source, callback) {
|
||||||
|
var result, value;
|
||||||
|
Index = 0;
|
||||||
|
Source = source;
|
||||||
|
result = get(lex());
|
||||||
|
// If a JSON string contains multiple tokens, it is invalid.
|
||||||
|
if (lex() != "$") {
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
// Reset the parser state.
|
||||||
|
Index = Source = null;
|
||||||
|
return callback && getClass.call(callback) == "[object Function]" ? walk((value = {}, value[""] = result, value), "", callback) : result;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Export for asynchronous module loaders.
|
||||||
|
if (isLoader) {
|
||||||
|
define(function () {
|
||||||
|
return JSON3;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}).call(this);
|
||||||
17
vendor/json3/lib/json3.min.js
vendored
Normal file
17
vendor/json3/lib/json3.min.js
vendored
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
/*! JSON v3.2.4 | http://bestiejs.github.com/json3 | Copyright 2012, Kit Cambridge | http://kit.mit-license.org */
|
||||||
|
;(function(){var e=void 0,i=!0,k=null,l={}.toString,m,n,p="function"===typeof define&&define.c,q=!p&&"object"==typeof exports&&exports;q||p?"object"==typeof JSON&&JSON?p?q=JSON:(q.stringify=JSON.stringify,q.parse=JSON.parse):p&&(q=this.JSON={}):q=this.JSON||(this.JSON={});var r,t,u,x,z,B,C,D,E,F,G,H,I,J=new Date(-3509827334573292),K,O,P;try{J=-109252==J.getUTCFullYear()&&0===J.getUTCMonth()&&1==J.getUTCDate()&&10==J.getUTCHours()&&37==J.getUTCMinutes()&&6==J.getUTCSeconds()&&708==J.getUTCMilliseconds()}catch(Q){}
|
||||||
|
function R(b){var c,a,d,j=b=="json";if(j||b=="json-stringify"||b=="json-parse"){if(b=="json-stringify"||j){if(c=typeof q.stringify=="function"&&J){(d=function(){return 1}).toJSON=d;try{c=q.stringify(0)==="0"&&q.stringify(new Number)==="0"&&q.stringify(new String)=='""'&&q.stringify(l)===e&&q.stringify(e)===e&&q.stringify()===e&&q.stringify(d)==="1"&&q.stringify([d])=="[1]"&&q.stringify([e])=="[null]"&&q.stringify(k)=="null"&&q.stringify([e,l,k])=="[null,null,null]"&&q.stringify({A:[d,i,false,k,"\x00\u0008\n\u000c\r\t"]})==
|
||||||
|
'{"A":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}'&&q.stringify(k,d)==="1"&&q.stringify([1,2],k,1)=="[\n 1,\n 2\n]"&&q.stringify(new Date(-864E13))=='"-271821-04-20T00:00:00.000Z"'&&q.stringify(new Date(864E13))=='"+275760-09-13T00:00:00.000Z"'&&q.stringify(new Date(-621987552E5))=='"-000001-01-01T00:00:00.000Z"'&&q.stringify(new Date(-1))=='"1969-12-31T23:59:59.999Z"'}catch(f){c=false}}if(!j)return c}if(b=="json-parse"||j){if(typeof q.parse=="function")try{if(q.parse("0")===0&&!q.parse(false)){d=
|
||||||
|
q.parse('{"A":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}');if(a=d.a.length==5&&d.a[0]==1){try{a=!q.parse('"\t"')}catch(o){}if(a)try{a=q.parse("01")!=1}catch(g){}}}}catch(h){a=false}if(!j)return a}return c&&a}}
|
||||||
|
if(!R("json")){J||(K=Math.floor,O=[0,31,59,90,120,151,181,212,243,273,304,334],P=function(b,c){return O[c]+365*(b-1970)+K((b-1969+(c=+(c>1)))/4)-K((b-1901+c)/100)+K((b-1601+c)/400)});if(!(m={}.hasOwnProperty))m=function(b){var c={},a;if((c.__proto__=k,c.__proto__={toString:1},c).toString!=l)m=function(a){var b=this.__proto__,a=a in(this.__proto__=k,this);this.__proto__=b;return a};else{a=c.constructor;m=function(b){var c=(this.constructor||a).prototype;return b in this&&!(b in c&&this[b]===c[b])}}c=
|
||||||
|
k;return m.call(this,b)};n=function(b,c){var a=0,d,j,f;(d=function(){this.valueOf=0}).prototype.valueOf=0;j=new d;for(f in j)m.call(j,f)&&a++;d=j=k;if(a)a=a==2?function(a,b){var c={},d=l.call(a)=="[object Function]",f;for(f in a)!(d&&f=="prototype")&&!m.call(c,f)&&(c[f]=1)&&m.call(a,f)&&b(f)}:function(a,b){var c=l.call(a)=="[object Function]",d,f;for(d in a)!(c&&d=="prototype")&&m.call(a,d)&&!(f=d==="constructor")&&b(d);(f||m.call(a,d="constructor"))&&b(d)};else{j=["valueOf","toString","toLocaleString",
|
||||||
|
"propertyIsEnumerable","isPrototypeOf","hasOwnProperty","constructor"];a=function(a,b){var c=l.call(a)=="[object Function]",d;for(d in a)!(c&&d=="prototype")&&m.call(a,d)&&b(d);for(c=j.length;d=j[--c];m.call(a,d)&&b(d));}}a(b,c)};R("json-stringify")||(r={"\\":"\\\\",'"':'\\"',"\u0008":"\\b","\u000c":"\\f","\n":"\\n","\r":"\\r","\t":"\\t"},t=function(b,c){return("000000"+(c||0)).slice(-b)},u=function(b){for(var c='"',a=0,d;d=b.charAt(a);a++)c=c+('\\"\u0008\u000c\n\r\t'.indexOf(d)>-1?r[d]:r[d]=d<" "?
|
||||||
|
"\\u00"+t(2,d.charCodeAt(0).toString(16)):d);return c+'"'},x=function(b,c,a,d,j,f,o){var g=c[b],h,s,v,w,L,M,N,y,A;if(typeof g=="object"&&g){h=l.call(g);if(h=="[object Date]"&&!m.call(g,"toJSON"))if(g>-1/0&&g<1/0){if(P){v=K(g/864E5);for(h=K(v/365.2425)+1970-1;P(h+1,0)<=v;h++);for(s=K((v-P(h,0))/30.42);P(h,s+1)<=v;s++);v=1+v-P(h,s);w=(g%864E5+864E5)%864E5;L=K(w/36E5)%24;M=K(w/6E4)%60;N=K(w/1E3)%60;w=w%1E3}else{h=g.getUTCFullYear();s=g.getUTCMonth();v=g.getUTCDate();L=g.getUTCHours();M=g.getUTCMinutes();
|
||||||
|
N=g.getUTCSeconds();w=g.getUTCMilliseconds()}g=(h<=0||h>=1E4?(h<0?"-":"+")+t(6,h<0?-h:h):t(4,h))+"-"+t(2,s+1)+"-"+t(2,v)+"T"+t(2,L)+":"+t(2,M)+":"+t(2,N)+"."+t(3,w)+"Z"}else g=k;else if(typeof g.toJSON=="function"&&(h!="[object Number]"&&h!="[object String]"&&h!="[object Array]"||m.call(g,"toJSON")))g=g.toJSON(b)}a&&(g=a.call(c,b,g));if(g===k)return"null";h=l.call(g);if(h=="[object Boolean]")return""+g;if(h=="[object Number]")return g>-1/0&&g<1/0?""+g:"null";if(h=="[object String]")return u(g);if(typeof g==
|
||||||
|
"object"){for(b=o.length;b--;)if(o[b]===g)throw TypeError();o.push(g);y=[];c=f;f=f+j;if(h=="[object Array]"){s=0;for(b=g.length;s<b;A||(A=i),s++){h=x(s,g,a,d,j,f,o);y.push(h===e?"null":h)}b=A?j?"[\n"+f+y.join(",\n"+f)+"\n"+c+"]":"["+y.join(",")+"]":"[]"}else{n(d||g,function(b){var c=x(b,g,a,d,j,f,o);c!==e&&y.push(u(b)+":"+(j?" ":"")+c);A||(A=i)});b=A?j?"{\n"+f+y.join(",\n"+f)+"\n"+c+"}":"{"+y.join(",")+"}":"{}"}o.pop();return b}},q.stringify=function(b,c,a){var d,j,f,o,g,h;if(typeof c=="function"||
|
||||||
|
typeof c=="object"&&c)if(l.call(c)=="[object Function]")j=c;else if(l.call(c)=="[object Array]"){f={};o=0;for(g=c.length;o<g;h=c[o++],(l.call(h)=="[object String]"||l.call(h)=="[object Number]")&&(f[h]=1));}if(a)if(l.call(a)=="[object Number]"){if((a=a-a%1)>0){d="";for(a>10&&(a=10);d.length<a;d=d+" ");}}else l.call(a)=="[object String]"&&(d=a.length<=10?a:a.slice(0,10));return x("",(h={},h[""]=b,h),j,f,d,"",[])});R("json-parse")||(z=String.fromCharCode,B={"\\":"\\",'"':'"',"/":"/",b:"\u0008",t:"\t",
|
||||||
|
n:"\n",f:"\u000c",r:"\r"},C=function(){H=I=k;throw SyntaxError();},D=function(){for(var b=I,c=b.length,a,d,j,f,o;H<c;){a=b.charAt(H);if("\t\r\n ".indexOf(a)>-1)H++;else{if("{}[]:,".indexOf(a)>-1){H++;return a}if(a=='"'){d="@";for(H++;H<c;){a=b.charAt(H);if(a<" ")C();else if(a=="\\"){a=b.charAt(++H);if('\\"/btnfr'.indexOf(a)>-1){d=d+B[a];H++}else if(a=="u"){j=++H;for(f=H+4;H<f;H++){a=b.charAt(H);a>="0"&&a<="9"||a>="a"&&a<="f"||a>="A"&&a<="F"||C()}d=d+z("0x"+b.slice(j,H))}else C()}else{if(a=='"')break;
|
||||||
|
d=d+a;H++}}if(b.charAt(H)=='"'){H++;return d}}else{j=H;if(a=="-"){o=i;a=b.charAt(++H)}if(a>="0"&&a<="9"){for(a=="0"&&(a=b.charAt(H+1),a>="0"&&a<="9")&&C();H<c&&(a=b.charAt(H),a>="0"&&a<="9");H++);if(b.charAt(H)=="."){for(f=++H;f<c&&(a=b.charAt(f),a>="0"&&a<="9");f++);f==H&&C();H=f}a=b.charAt(H);if(a=="e"||a=="E"){a=b.charAt(++H);(a=="+"||a=="-")&&H++;for(f=H;f<c&&(a=b.charAt(f),a>="0"&&a<="9");f++);f==H&&C();H=f}return+b.slice(j,H)}o&&C();if(b.slice(H,H+4)=="true"){H=H+4;return i}if(b.slice(H,H+5)==
|
||||||
|
"false"){H=H+5;return false}if(b.slice(H,H+4)=="null"){H=H+4;return k}}C()}}return"$"},E=function(b){var c,a;b=="$"&&C();if(typeof b=="string"){if(b.charAt(0)=="@")return b.slice(1);if(b=="["){for(c=[];;a||(a=i)){b=D();if(b=="]")break;if(a)if(b==","){b=D();b=="]"&&C()}else C();b==","&&C();c.push(E(b))}return c}if(b=="{"){for(c={};;a||(a=i)){b=D();if(b=="}")break;if(a)if(b==","){b=D();b=="}"&&C()}else C();(b==","||typeof b!="string"||b.charAt(0)!="@"||D()!=":")&&C();c[b.slice(1)]=E(D())}return c}C()}return b},
|
||||||
|
G=function(b,c,a){a=F(b,c,a);a===e?delete b[c]:b[c]=a},F=function(b,c,a){var d=b[c],j;if(typeof d=="object"&&d)if(l.call(d)=="[object Array]")for(j=d.length;j--;)G(d,j,a);else n(d,function(b){G(d,b,a)});return a.call(b,c,d)},q.parse=function(b,c){var a,d;H=0;I=b;a=E(D());D()!="$"&&C();H=I=k;return c&&l.call(c)=="[object Function]"?F((d={},d[""]=a,d),"",c):a})}p&&define(function(){return q});
|
||||||
|
}());
|
||||||
14
vendor/qunit/README.md
vendored
14
vendor/qunit/README.md
vendored
@@ -1,4 +1,4 @@
|
|||||||
[QUnit](http://docs.jquery.com/QUnit) - A JavaScript Unit Testing framework.
|
[QUnit](http://qunitjs.com) - A JavaScript Unit Testing framework.
|
||||||
================================
|
================================
|
||||||
|
|
||||||
QUnit is a powerful, easy-to-use, JavaScript test suite. It's used by the jQuery
|
QUnit is a powerful, easy-to-use, JavaScript test suite. It's used by the jQuery
|
||||||
@@ -35,7 +35,8 @@ the change, run `grunt` to lint and test it, then commit, push and create a pull
|
|||||||
Include some background for the change in the commit message and `Fixes #nnn`, referring
|
Include some background for the change in the commit message and `Fixes #nnn`, referring
|
||||||
to the issue number you're addressing.
|
to the issue number you're addressing.
|
||||||
|
|
||||||
To run `grunt`, you need `node` and `npm`, then `npm install grunt -g`.
|
To run `grunt`, you need `node` and `npm`, then `npm install grunt -g`. That gives you a global
|
||||||
|
grunt binary. For additional grunt tasks, also run `npm install`.
|
||||||
|
|
||||||
Releases
|
Releases
|
||||||
--------
|
--------
|
||||||
@@ -47,3 +48,12 @@ tag, update them again to the next version, commit and push commits and tags
|
|||||||
|
|
||||||
Put the 'v' in front of the tag, e.g. `v1.8.0`. Clean up the changelog, removing merge commits
|
Put the 'v' in front of the tag, e.g. `v1.8.0`. Clean up the changelog, removing merge commits
|
||||||
or whitespace cleanups.
|
or whitespace cleanups.
|
||||||
|
|
||||||
|
To upload to code.jquery.com (replace $version accordingly):
|
||||||
|
|
||||||
|
scp -q qunit/qunit.js jqadmin@code.origin.jquery.com:/var/www/html/code.jquery.com/qunit/qunit-$version.js
|
||||||
|
scp -q qunit/qunit.css jqadmin@code.origin.jquery.com:/var/www/html/code.jquery.com/qunit/qunit-$version.css
|
||||||
|
|
||||||
|
Then update /var/www/html/code.jquery.com/index.html and purge it with:
|
||||||
|
|
||||||
|
curl -s http://code.origin.jquery.com/?reload
|
||||||
16
vendor/qunit/qunit/qunit.css
vendored
16
vendor/qunit/qunit/qunit.css
vendored
@@ -1,11 +1,11 @@
|
|||||||
/**
|
/**
|
||||||
* QUnit v1.9.0 - A JavaScript Unit Testing Framework
|
* QUnit v1.10.0 - A JavaScript Unit Testing Framework
|
||||||
*
|
*
|
||||||
* http://docs.jquery.com/QUnit
|
* http://qunitjs.com
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012 John Resig, Jörn Zaefferer
|
* Copyright 2012 jQuery Foundation and other contributors
|
||||||
* Dual licensed under the MIT (MIT-LICENSE.txt)
|
* Released under the MIT license.
|
||||||
* or GPL (GPL-LICENSE.txt) licenses.
|
* http://jquery.org/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** Font Family and Sizes */
|
/** Font Family and Sizes */
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
/** Resets */
|
/** Resets */
|
||||||
|
|
||||||
#qunit-tests, #qunit-tests ol, #qunit-header, #qunit-banner, #qunit-userAgent, #qunit-testresult {
|
#qunit-tests, #qunit-tests ol, #qunit-header, #qunit-banner, #qunit-userAgent, #qunit-testresult, #qunit-modulefilter {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
@@ -67,6 +67,7 @@
|
|||||||
padding: 0.5em 0 0.5em 2em;
|
padding: 0.5em 0 0.5em 2em;
|
||||||
color: #5E740B;
|
color: #5E740B;
|
||||||
background-color: #eee;
|
background-color: #eee;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
#qunit-userAgent {
|
#qunit-userAgent {
|
||||||
@@ -76,6 +77,9 @@
|
|||||||
text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px;
|
text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#qunit-modulefilter-container {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
/** Tests: Pass/Fail */
|
/** Tests: Pass/Fail */
|
||||||
|
|
||||||
|
|||||||
89
vendor/qunit/qunit/qunit.js
vendored
89
vendor/qunit/qunit/qunit.js
vendored
@@ -1,11 +1,11 @@
|
|||||||
/**
|
/**
|
||||||
* QUnit v1.9.0 - A JavaScript Unit Testing Framework
|
* QUnit v1.10.0 - A JavaScript Unit Testing Framework
|
||||||
*
|
*
|
||||||
* http://docs.jquery.com/QUnit
|
* http://qunitjs.com
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012 John Resig, Jörn Zaefferer
|
* Copyright 2012 jQuery Foundation and other contributors
|
||||||
* Dual licensed under the MIT (MIT-LICENSE.txt)
|
* Released under the MIT license.
|
||||||
* or GPL (GPL-LICENSE.txt) licenses.
|
* http://jquery.org/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
(function( window ) {
|
(function( window ) {
|
||||||
@@ -17,6 +17,8 @@ var QUnit,
|
|||||||
fileName = (sourceFromStacktrace( 0 ) || "" ).replace(/(:\d+)+\)?/, "").replace(/.+\//, ""),
|
fileName = (sourceFromStacktrace( 0 ) || "" ).replace(/(:\d+)+\)?/, "").replace(/.+\//, ""),
|
||||||
toString = Object.prototype.toString,
|
toString = Object.prototype.toString,
|
||||||
hasOwn = Object.prototype.hasOwnProperty,
|
hasOwn = Object.prototype.hasOwnProperty,
|
||||||
|
// Keep a local reference to Date (GH-283)
|
||||||
|
Date = window.Date,
|
||||||
defined = {
|
defined = {
|
||||||
setTimeout: typeof window.setTimeout !== "undefined",
|
setTimeout: typeof window.setTimeout !== "undefined",
|
||||||
sessionStorage: (function() {
|
sessionStorage: (function() {
|
||||||
@@ -304,7 +306,8 @@ QUnit = {
|
|||||||
// call on start of module test to prepend name to all tests
|
// call on start of module test to prepend name to all tests
|
||||||
module: function( name, testEnvironment ) {
|
module: function( name, testEnvironment ) {
|
||||||
config.currentModule = name;
|
config.currentModule = name;
|
||||||
config.currentModuleTestEnviroment = testEnvironment;
|
config.currentModuleTestEnvironment = testEnvironment;
|
||||||
|
config.modules[name] = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
asyncTest: function( testName, expected, callback ) {
|
asyncTest: function( testName, expected, callback ) {
|
||||||
@@ -336,7 +339,7 @@ QUnit = {
|
|||||||
async: async,
|
async: async,
|
||||||
callback: callback,
|
callback: callback,
|
||||||
module: config.currentModule,
|
module: config.currentModule,
|
||||||
moduleTestEnvironment: config.currentModuleTestEnviroment,
|
moduleTestEnvironment: config.currentModuleTestEnvironment,
|
||||||
stack: sourceFromStacktrace( 2 )
|
stack: sourceFromStacktrace( 2 )
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -349,7 +352,11 @@ QUnit = {
|
|||||||
|
|
||||||
// Specify the number of expected assertions to gurantee that failed test (no assertions are run at all) don't slip through.
|
// Specify the number of expected assertions to gurantee that failed test (no assertions are run at all) don't slip through.
|
||||||
expect: function( asserts ) {
|
expect: function( asserts ) {
|
||||||
config.current.expected = asserts;
|
if (arguments.length === 1) {
|
||||||
|
config.current.expected = asserts;
|
||||||
|
} else {
|
||||||
|
return config.current.expected;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
start: function( count ) {
|
start: function( count ) {
|
||||||
@@ -415,6 +422,8 @@ QUnit.assert = {
|
|||||||
|
|
||||||
var source,
|
var source,
|
||||||
details = {
|
details = {
|
||||||
|
module: config.current.module,
|
||||||
|
name: config.current.testName,
|
||||||
result: result,
|
result: result,
|
||||||
message: msg
|
message: msg
|
||||||
};
|
};
|
||||||
@@ -600,6 +609,9 @@ config = {
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
|
// Set of all modules.
|
||||||
|
modules: {},
|
||||||
|
|
||||||
// logging callback queues
|
// logging callback queues
|
||||||
begin: [],
|
begin: [],
|
||||||
done: [],
|
done: [],
|
||||||
@@ -710,17 +722,10 @@ extend( QUnit, {
|
|||||||
},
|
},
|
||||||
|
|
||||||
// Resets the test setup. Useful for tests that modify the DOM.
|
// Resets the test setup. Useful for tests that modify the DOM.
|
||||||
// If jQuery is available, uses jQuery's html(), otherwise just innerHTML.
|
|
||||||
reset: function() {
|
reset: function() {
|
||||||
var fixture;
|
var fixture = id( "qunit-fixture" );
|
||||||
|
if ( fixture ) {
|
||||||
if ( window.jQuery ) {
|
fixture.innerHTML = config.fixture;
|
||||||
jQuery( "#qunit-fixture" ).html( config.fixture );
|
|
||||||
} else {
|
|
||||||
fixture = id( "qunit-fixture" );
|
|
||||||
if ( fixture ) {
|
|
||||||
fixture.innerHTML = config.fixture;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -781,6 +786,8 @@ extend( QUnit, {
|
|||||||
|
|
||||||
var output, source,
|
var output, source,
|
||||||
details = {
|
details = {
|
||||||
|
module: config.current.module,
|
||||||
|
name: config.current.testName,
|
||||||
result: result,
|
result: result,
|
||||||
message: message,
|
message: message,
|
||||||
actual: actual,
|
actual: actual,
|
||||||
@@ -826,6 +833,8 @@ extend( QUnit, {
|
|||||||
|
|
||||||
var output,
|
var output,
|
||||||
details = {
|
details = {
|
||||||
|
module: config.current.module,
|
||||||
|
name: config.current.testName,
|
||||||
result: false,
|
result: false,
|
||||||
message: message
|
message: message
|
||||||
};
|
};
|
||||||
@@ -916,7 +925,9 @@ QUnit.load = function() {
|
|||||||
runLoggingCallbacks( "begin", QUnit, {} );
|
runLoggingCallbacks( "begin", QUnit, {} );
|
||||||
|
|
||||||
// Initialize the config, saving the execution queue
|
// Initialize the config, saving the execution queue
|
||||||
var banner, filter, i, label, len, main, ol, toolbar, userAgent, val, urlConfigCheckboxes,
|
var banner, filter, i, label, len, main, ol, toolbar, userAgent, val, urlConfigCheckboxes, moduleFilter,
|
||||||
|
numModules = 0,
|
||||||
|
moduleFilterHtml = "",
|
||||||
urlConfigHtml = "",
|
urlConfigHtml = "",
|
||||||
oldconfig = extend( {}, config );
|
oldconfig = extend( {}, config );
|
||||||
|
|
||||||
@@ -940,6 +951,15 @@ QUnit.load = function() {
|
|||||||
urlConfigHtml += "<input id='qunit-urlconfig-" + val.id + "' name='" + val.id + "' type='checkbox'" + ( config[ val.id ] ? " checked='checked'" : "" ) + " title='" + val.tooltip + "'><label for='qunit-urlconfig-" + val.id + "' title='" + val.tooltip + "'>" + val.label + "</label>";
|
urlConfigHtml += "<input id='qunit-urlconfig-" + val.id + "' name='" + val.id + "' type='checkbox'" + ( config[ val.id ] ? " checked='checked'" : "" ) + " title='" + val.tooltip + "'><label for='qunit-urlconfig-" + val.id + "' title='" + val.tooltip + "'>" + val.label + "</label>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
moduleFilterHtml += "<label for='qunit-modulefilter'>Module: </label><select id='qunit-modulefilter' name='modulefilter'><option value='' " + ( config.module === undefined ? "selected" : "" ) + ">< All Modules ></option>";
|
||||||
|
for ( i in config.modules ) {
|
||||||
|
if ( config.modules.hasOwnProperty( i ) ) {
|
||||||
|
numModules += 1;
|
||||||
|
moduleFilterHtml += "<option value='" + encodeURIComponent(i) + "' " + ( config.module === i ? "selected" : "" ) + ">" + i + "</option>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
moduleFilterHtml += "</select>";
|
||||||
|
|
||||||
// `userAgent` initialized at top of scope
|
// `userAgent` initialized at top of scope
|
||||||
userAgent = id( "qunit-userAgent" );
|
userAgent = id( "qunit-userAgent" );
|
||||||
if ( userAgent ) {
|
if ( userAgent ) {
|
||||||
@@ -1002,6 +1022,19 @@ QUnit.load = function() {
|
|||||||
window.location = QUnit.url( params );
|
window.location = QUnit.url( params );
|
||||||
});
|
});
|
||||||
toolbar.appendChild( urlConfigCheckboxes );
|
toolbar.appendChild( urlConfigCheckboxes );
|
||||||
|
|
||||||
|
if (numModules > 1) {
|
||||||
|
moduleFilter = document.createElement( 'span' );
|
||||||
|
moduleFilter.setAttribute( 'id', 'qunit-modulefilter-container' );
|
||||||
|
moduleFilter.innerHTML = moduleFilterHtml;
|
||||||
|
addEvent( moduleFilter, "change", function() {
|
||||||
|
var selectBox = moduleFilter.getElementsByTagName("select")[0],
|
||||||
|
selectedModule = decodeURIComponent(selectBox.options[selectBox.selectedIndex].value);
|
||||||
|
|
||||||
|
window.location = QUnit.url( { module: ( selectedModule === "" ) ? undefined : selectedModule } );
|
||||||
|
});
|
||||||
|
toolbar.appendChild(moduleFilter);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// `main` initialized at top of scope
|
// `main` initialized at top of scope
|
||||||
@@ -1039,9 +1072,9 @@ window.onerror = function ( error, filePath, linerNr ) {
|
|||||||
}
|
}
|
||||||
QUnit.pushFailure( error, filePath + ":" + linerNr );
|
QUnit.pushFailure( error, filePath + ":" + linerNr );
|
||||||
} else {
|
} else {
|
||||||
QUnit.test( "global failure", function() {
|
QUnit.test( "global failure", extend( function() {
|
||||||
QUnit.pushFailure( error, filePath + ":" + linerNr );
|
QUnit.pushFailure( error, filePath + ":" + linerNr );
|
||||||
});
|
}, { validTest: validTest } ) );
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1108,6 +1141,11 @@ function done() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// scroll back to top to show results
|
||||||
|
if ( window.scrollTo ) {
|
||||||
|
window.scrollTo(0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
runLoggingCallbacks( "done", QUnit, {
|
runLoggingCallbacks( "done", QUnit, {
|
||||||
failed: config.stats.bad,
|
failed: config.stats.bad,
|
||||||
passed: passed,
|
passed: passed,
|
||||||
@@ -1123,6 +1161,12 @@ function validTest( test ) {
|
|||||||
module = config.module && config.module.toLowerCase(),
|
module = config.module && config.module.toLowerCase(),
|
||||||
fullName = (test.module + ": " + test.testName).toLowerCase();
|
fullName = (test.module + ": " + test.testName).toLowerCase();
|
||||||
|
|
||||||
|
// Internally-generated tests are always valid
|
||||||
|
if ( test.callback && test.callback.validTest === validTest ) {
|
||||||
|
delete test.callback.validTest;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if ( config.testNumber ) {
|
if ( config.testNumber ) {
|
||||||
return test.testNumber === config.testNumber;
|
return test.testNumber === config.testNumber;
|
||||||
}
|
}
|
||||||
@@ -1404,7 +1448,8 @@ QUnit.equiv = (function() {
|
|||||||
a.global === b.global &&
|
a.global === b.global &&
|
||||||
// (gmi) ...
|
// (gmi) ...
|
||||||
a.ignoreCase === b.ignoreCase &&
|
a.ignoreCase === b.ignoreCase &&
|
||||||
a.multiline === b.multiline;
|
a.multiline === b.multiline &&
|
||||||
|
a.sticky === b.sticky;
|
||||||
},
|
},
|
||||||
|
|
||||||
// - skip when the property is a method of an instance (OOP)
|
// - skip when the property is a method of an instance (OOP)
|
||||||
|
|||||||
91
vendor/requirejs/require.js
vendored
91
vendor/requirejs/require.js
vendored
@@ -1,5 +1,5 @@
|
|||||||
/** vim: et:ts=4:sw=4:sts=4
|
/** vim: et:ts=4:sw=4:sts=4
|
||||||
* @license RequireJS 2.1.0 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
|
* @license RequireJS 2.1.1 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.0',
|
version = '2.1.1',
|
||||||
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$/,
|
||||||
@@ -100,9 +100,6 @@ var requirejs, require, define;
|
|||||||
/**
|
/**
|
||||||
* Simple function to mix in properties from source into target,
|
* Simple function to mix in properties from source into target,
|
||||||
* but only if target does not already have a property of the same name.
|
* but only if target does not already have a property of the same name.
|
||||||
* This is not robust in IE for transferring methods that match
|
|
||||||
* Object.prototype names, but the uses of mixin here seem unlikely to
|
|
||||||
* trigger a problem related to that.
|
|
||||||
*/
|
*/
|
||||||
function mixin(target, source, force, deepStringMixin) {
|
function mixin(target, source, force, deepStringMixin) {
|
||||||
if (source) {
|
if (source) {
|
||||||
@@ -195,7 +192,9 @@ var requirejs, require, define;
|
|||||||
baseUrl: './',
|
baseUrl: './',
|
||||||
paths: {},
|
paths: {},
|
||||||
pkgs: {},
|
pkgs: {},
|
||||||
shim: {}
|
shim: {},
|
||||||
|
map: {},
|
||||||
|
config: {}
|
||||||
},
|
},
|
||||||
registry = {},
|
registry = {},
|
||||||
undefEvents = {},
|
undefEvents = {},
|
||||||
@@ -1167,6 +1166,25 @@ var requirejs, require, define;
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function intakeDefines() {
|
||||||
|
var args;
|
||||||
|
|
||||||
|
//Any defined modules in the global queue, intake them now.
|
||||||
|
takeGlobalQueue();
|
||||||
|
|
||||||
|
//Make sure any remaining defQueue items get properly processed.
|
||||||
|
while (defQueue.length) {
|
||||||
|
args = defQueue.shift();
|
||||||
|
if (args[0] === null) {
|
||||||
|
return onError(makeError('mismatch', 'Mismatched anonymous define() module: ' + args[args.length - 1]));
|
||||||
|
} else {
|
||||||
|
//args are id, deps, factory. Should be normalized by the
|
||||||
|
//define() function.
|
||||||
|
callGetModule(args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
context = {
|
context = {
|
||||||
config: config,
|
config: config,
|
||||||
contextName: contextName,
|
contextName: contextName,
|
||||||
@@ -1194,20 +1212,23 @@ var requirejs, require, define;
|
|||||||
//they are additive.
|
//they are additive.
|
||||||
var pkgs = config.pkgs,
|
var pkgs = config.pkgs,
|
||||||
shim = config.shim,
|
shim = config.shim,
|
||||||
paths = config.paths,
|
objs = {
|
||||||
map = config.map;
|
paths: true,
|
||||||
|
config: true,
|
||||||
|
map: true
|
||||||
|
};
|
||||||
|
|
||||||
//Mix in the config values, favoring the new values over
|
eachProp(cfg, function (value, prop) {
|
||||||
//existing ones in context.config.
|
if (objs[prop]) {
|
||||||
mixin(config, cfg, true);
|
if (prop === 'map') {
|
||||||
|
mixin(config[prop], value, true, true);
|
||||||
//Merge paths.
|
} else {
|
||||||
config.paths = mixin(paths, cfg.paths, true);
|
mixin(config[prop], value, true);
|
||||||
|
}
|
||||||
//Merge map
|
} else {
|
||||||
if (cfg.map) {
|
config[prop] = value;
|
||||||
config.map = mixin(map || {}, cfg.map, true, true);
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
//Merge shim
|
//Merge shim
|
||||||
if (cfg.shim) {
|
if (cfg.shim) {
|
||||||
@@ -1288,8 +1309,8 @@ var requirejs, require, define;
|
|||||||
makeRequire: function (relMap, options) {
|
makeRequire: function (relMap, options) {
|
||||||
options = options || {};
|
options = options || {};
|
||||||
|
|
||||||
function require(deps, callback, errback) {
|
function localRequire(deps, callback, errback) {
|
||||||
var id, map, requireMod, args;
|
var id, map, requireMod;
|
||||||
|
|
||||||
if (options.enableBuildCallback && callback && isFunction(callback)) {
|
if (options.enableBuildCallback && callback && isFunction(callback)) {
|
||||||
callback.__requireJsBuild = true;
|
callback.__requireJsBuild = true;
|
||||||
@@ -1328,23 +1349,15 @@ var requirejs, require, define;
|
|||||||
return defined[id];
|
return defined[id];
|
||||||
}
|
}
|
||||||
|
|
||||||
//Any defined modules in the global queue, intake them now.
|
//Grab defines waiting in the global queue.
|
||||||
takeGlobalQueue();
|
intakeDefines();
|
||||||
|
|
||||||
//Make sure any remaining defQueue items get properly processed.
|
|
||||||
while (defQueue.length) {
|
|
||||||
args = defQueue.shift();
|
|
||||||
if (args[0] === null) {
|
|
||||||
return onError(makeError('mismatch', 'Mismatched anonymous define() module: ' + args[args.length - 1]));
|
|
||||||
} else {
|
|
||||||
//args are id, deps, factory. Should be normalized by the
|
|
||||||
//define() function.
|
|
||||||
callGetModule(args);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Mark all the dependencies as needing to be loaded.
|
//Mark all the dependencies as needing to be loaded.
|
||||||
context.nextTick(function () {
|
context.nextTick(function () {
|
||||||
|
//Some defines could have been added since the
|
||||||
|
//require call, collect them.
|
||||||
|
intakeDefines();
|
||||||
|
|
||||||
requireMod = getModule(makeModuleMap(null, relMap));
|
requireMod = getModule(makeModuleMap(null, relMap));
|
||||||
|
|
||||||
//Store if map config should be applied to this require
|
//Store if map config should be applied to this require
|
||||||
@@ -1358,10 +1371,10 @@ var requirejs, require, define;
|
|||||||
checkLoaded();
|
checkLoaded();
|
||||||
});
|
});
|
||||||
|
|
||||||
return require;
|
return localRequire;
|
||||||
}
|
}
|
||||||
|
|
||||||
mixin(require, {
|
mixin(localRequire, {
|
||||||
isBrowser: isBrowser,
|
isBrowser: isBrowser,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1394,7 +1407,7 @@ var requirejs, require, define;
|
|||||||
|
|
||||||
//Only allow undef on top level require calls
|
//Only allow undef on top level require calls
|
||||||
if (!relMap) {
|
if (!relMap) {
|
||||||
require.undef = function (id) {
|
localRequire.undef = function (id) {
|
||||||
//Bind any waiting define() calls to this context,
|
//Bind any waiting define() calls to this context,
|
||||||
//fix for #408
|
//fix for #408
|
||||||
takeGlobalQueue();
|
takeGlobalQueue();
|
||||||
@@ -1419,7 +1432,7 @@ var requirejs, require, define;
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
return require;
|
return localRequire;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
8
vendor/underscore/test/collections.js
vendored
8
vendor/underscore/test/collections.js
vendored
@@ -171,6 +171,14 @@ $(document).ready(function() {
|
|||||||
test('reject', function() {
|
test('reject', function() {
|
||||||
var odds = _.reject([1, 2, 3, 4, 5, 6], function(num){ return num % 2 == 0; });
|
var odds = _.reject([1, 2, 3, 4, 5, 6], function(num){ return num % 2 == 0; });
|
||||||
equal(odds.join(', '), '1, 3, 5', 'rejected each even number');
|
equal(odds.join(', '), '1, 3, 5', 'rejected each even number');
|
||||||
|
|
||||||
|
var context = "obj";
|
||||||
|
|
||||||
|
var evens = _.reject([1, 2, 3, 4, 5, 6], function(num){
|
||||||
|
equal(context, "obj");
|
||||||
|
return num % 2 != 0;
|
||||||
|
}, context);
|
||||||
|
equal(evens.join(', '), '2, 4, 6', 'rejected each odd number');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('all', function() {
|
test('all', function() {
|
||||||
|
|||||||
4
vendor/underscore/test/objects.js
vendored
4
vendor/underscore/test/objects.js
vendored
@@ -485,7 +485,9 @@ $(document).ready(function() {
|
|||||||
ok(!_.isFinite(NaN), 'NaN is not Finite');
|
ok(!_.isFinite(NaN), 'NaN is not Finite');
|
||||||
ok(!_.isFinite(Infinity), 'Infinity is not Finite');
|
ok(!_.isFinite(Infinity), 'Infinity is not Finite');
|
||||||
ok(!_.isFinite(-Infinity), '-Infinity is not Finite');
|
ok(!_.isFinite(-Infinity), '-Infinity is not Finite');
|
||||||
ok(!_.isFinite('12'), 'Strings are not numbers');
|
ok(_.isFinite('12'), 'Numeric strings are numbers');
|
||||||
|
ok(!_.isFinite('1a'), 'Non numeric strings are not numbers');
|
||||||
|
ok(!_.isFinite(''), 'Empty strings are not numbers');
|
||||||
var obj = new Number(5);
|
var obj = new Number(5);
|
||||||
ok(_.isFinite(obj), 'Number instances can be finite');
|
ok(_.isFinite(obj), 'Number instances can be finite');
|
||||||
ok(_.isFinite(0), '0 is Finite');
|
ok(_.isFinite(0), '0 is Finite');
|
||||||
|
|||||||
670
vendor/underscore/test/vendor/jslitmus.js
vendored
670
vendor/underscore/test/vendor/jslitmus.js
vendored
@@ -1,670 +0,0 @@
|
|||||||
// JSLitmus.js
|
|
||||||
//
|
|
||||||
// History:
|
|
||||||
// 2008-10-27: Initial release
|
|
||||||
// 2008-11-09: Account for iteration loop overhead
|
|
||||||
// 2008-11-13: Added OS detection
|
|
||||||
// 2009-02-25: Create tinyURL automatically, shift-click runs tests in reverse
|
|
||||||
//
|
|
||||||
// Copyright (c) 2008-2009, Robert Kieffer
|
|
||||||
// All Rights Reserved
|
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
// of this software and associated documentation files (the
|
|
||||||
// Software), to deal in the Software without restriction, including
|
|
||||||
// without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
||||||
// persons to whom the Software is furnished to do so, subject to the
|
|
||||||
// following conditions:
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
||||||
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
||||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
||||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
||||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
|
|
||||||
(function() {
|
|
||||||
// Private methods and state
|
|
||||||
|
|
||||||
// Get platform info but don't go crazy trying to recognize everything
|
|
||||||
// that's out there. This is just for the major platforms and OSes.
|
|
||||||
var platform = 'unknown platform', ua = navigator.userAgent;
|
|
||||||
|
|
||||||
// Detect OS
|
|
||||||
var oses = ['Windows','iPhone OS','(Intel |PPC )?Mac OS X','Linux'].join('|');
|
|
||||||
var pOS = new RegExp('((' + oses + ') [^ \);]*)').test(ua) ? RegExp.$1 : null;
|
|
||||||
if (!pOS) pOS = new RegExp('((' + oses + ')[^ \);]*)').test(ua) ? RegExp.$1 : null;
|
|
||||||
|
|
||||||
// Detect browser
|
|
||||||
var pName = /(Chrome|MSIE|Safari|Opera|Firefox)/.test(ua) ? RegExp.$1 : null;
|
|
||||||
|
|
||||||
// Detect version
|
|
||||||
var vre = new RegExp('(Version|' + pName + ')[ \/]([^ ;]*)');
|
|
||||||
var pVersion = (pName && vre.test(ua)) ? RegExp.$2 : null;
|
|
||||||
var platform = (pOS && pName && pVersion) ? pName + ' ' + pVersion + ' on ' + pOS : 'unknown platform';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A smattering of methods that are needed to implement the JSLitmus testbed.
|
|
||||||
*/
|
|
||||||
var jsl = {
|
|
||||||
/**
|
|
||||||
* Enhanced version of escape()
|
|
||||||
*/
|
|
||||||
escape: function(s) {
|
|
||||||
s = s.replace(/,/g, '\\,');
|
|
||||||
s = escape(s);
|
|
||||||
s = s.replace(/\+/g, '%2b');
|
|
||||||
s = s.replace(/ /g, '+');
|
|
||||||
return s;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get an element by ID.
|
|
||||||
*/
|
|
||||||
$: function(id) {
|
|
||||||
return document.getElementById(id);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Null function
|
|
||||||
*/
|
|
||||||
F: function() {},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the status shown in the UI
|
|
||||||
*/
|
|
||||||
status: function(msg) {
|
|
||||||
var el = jsl.$('jsl_status');
|
|
||||||
if (el) el.innerHTML = msg || '';
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert a number to an abbreviated string like, "15K" or "10M"
|
|
||||||
*/
|
|
||||||
toLabel: function(n) {
|
|
||||||
if (n == Infinity) {
|
|
||||||
return 'Infinity';
|
|
||||||
} else if (n > 1e9) {
|
|
||||||
n = Math.round(n/1e8);
|
|
||||||
return n/10 + 'B';
|
|
||||||
} else if (n > 1e6) {
|
|
||||||
n = Math.round(n/1e5);
|
|
||||||
return n/10 + 'M';
|
|
||||||
} else if (n > 1e3) {
|
|
||||||
n = Math.round(n/1e2);
|
|
||||||
return n/10 + 'K';
|
|
||||||
}
|
|
||||||
return n;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Copy properties from src to dst
|
|
||||||
*/
|
|
||||||
extend: function(dst, src) {
|
|
||||||
for (var k in src) dst[k] = src[k]; return dst;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Like Array.join(), but for the key-value pairs in an object
|
|
||||||
*/
|
|
||||||
join: function(o, delimit1, delimit2) {
|
|
||||||
if (o.join) return o.join(delimit1); // If it's an array
|
|
||||||
var pairs = [];
|
|
||||||
for (var k in o) pairs.push(k + delimit1 + o[k]);
|
|
||||||
return pairs.join(delimit2);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Array#indexOf isn't supported in IE, so we use this as a cross-browser solution
|
|
||||||
*/
|
|
||||||
indexOf: function(arr, o) {
|
|
||||||
if (arr.indexOf) return arr.indexOf(o);
|
|
||||||
for (var i = 0; i < this.length; i++) if (arr[i] === o) return i;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test manages a single test (created with
|
|
||||||
* JSLitmus.test())
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
var Test = function (name, f) {
|
|
||||||
if (!f) throw new Error('Undefined test function');
|
|
||||||
if (!(/function[^\(]*\(([^,\)]*)/).test(f.toString())) {
|
|
||||||
throw new Error('"' + name + '" test: Test is not a valid Function object');
|
|
||||||
}
|
|
||||||
this.loopArg = RegExp.$1;
|
|
||||||
this.name = name;
|
|
||||||
this.f = f;
|
|
||||||
};
|
|
||||||
|
|
||||||
jsl.extend(Test, /** @lends Test */ {
|
|
||||||
/** Calibration tests for establishing iteration loop overhead */
|
|
||||||
CALIBRATIONS: [
|
|
||||||
new Test('calibrating loop', function(count) {while (count--);}),
|
|
||||||
new Test('calibrating function', jsl.F)
|
|
||||||
],
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Run calibration tests. Returns true if calibrations are not yet
|
|
||||||
* complete (in which case calling code should run the tests yet again).
|
|
||||||
* onCalibrated - Callback to invoke when calibrations have finished
|
|
||||||
*/
|
|
||||||
calibrate: function(onCalibrated) {
|
|
||||||
for (var i = 0; i < Test.CALIBRATIONS.length; i++) {
|
|
||||||
var cal = Test.CALIBRATIONS[i];
|
|
||||||
if (cal.running) return true;
|
|
||||||
if (!cal.count) {
|
|
||||||
cal.isCalibration = true;
|
|
||||||
cal.onStop = onCalibrated;
|
|
||||||
//cal.MIN_TIME = .1; // Do calibrations quickly
|
|
||||||
cal.run(2e4);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
jsl.extend(Test.prototype, {/** @lends Test.prototype */
|
|
||||||
/** Initial number of iterations */
|
|
||||||
INIT_COUNT: 10,
|
|
||||||
/** Max iterations allowed (i.e. used to detect bad looping functions) */
|
|
||||||
MAX_COUNT: 1e9,
|
|
||||||
/** Minimum time a test should take to get valid results (secs) */
|
|
||||||
MIN_TIME: .5,
|
|
||||||
|
|
||||||
/** Callback invoked when test state changes */
|
|
||||||
onChange: jsl.F,
|
|
||||||
|
|
||||||
/** Callback invoked when test is finished */
|
|
||||||
onStop: jsl.F,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reset test state
|
|
||||||
*/
|
|
||||||
reset: function() {
|
|
||||||
delete this.count;
|
|
||||||
delete this.time;
|
|
||||||
delete this.running;
|
|
||||||
delete this.error;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Run the test (in a timeout). We use a timeout to make sure the browser
|
|
||||||
* has a chance to finish rendering any UI changes we've made, like
|
|
||||||
* updating the status message.
|
|
||||||
*/
|
|
||||||
run: function(count) {
|
|
||||||
count = count || this.INIT_COUNT;
|
|
||||||
jsl.status(this.name + ' x ' + count);
|
|
||||||
this.running = true;
|
|
||||||
var me = this;
|
|
||||||
setTimeout(function() {me._run(count);}, 200);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The nuts and bolts code that actually runs a test
|
|
||||||
*/
|
|
||||||
_run: function(count) {
|
|
||||||
var me = this;
|
|
||||||
|
|
||||||
// Make sure calibration tests have run
|
|
||||||
if (!me.isCalibration && Test.calibrate(function() {me.run(count);})) return;
|
|
||||||
this.error = null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
var start, f = this.f, now, i = count;
|
|
||||||
|
|
||||||
// Start the timer
|
|
||||||
start = new Date();
|
|
||||||
|
|
||||||
// Now for the money shot. If this is a looping function ...
|
|
||||||
if (this.loopArg) {
|
|
||||||
// ... let it do the iteration itself
|
|
||||||
f(count);
|
|
||||||
} else {
|
|
||||||
// ... otherwise do the iteration for it
|
|
||||||
while (i--) f();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get time test took (in secs)
|
|
||||||
this.time = Math.max(1,new Date() - start)/1000;
|
|
||||||
|
|
||||||
// Store iteration count and per-operation time taken
|
|
||||||
this.count = count;
|
|
||||||
this.period = this.time/count;
|
|
||||||
|
|
||||||
// Do we need to do another run?
|
|
||||||
this.running = this.time <= this.MIN_TIME;
|
|
||||||
|
|
||||||
// ... if so, compute how many times we should iterate
|
|
||||||
if (this.running) {
|
|
||||||
// Bump the count to the nearest power of 2
|
|
||||||
var x = this.MIN_TIME/this.time;
|
|
||||||
var pow = Math.pow(2, Math.max(1, Math.ceil(Math.log(x)/Math.log(2))));
|
|
||||||
count *= pow;
|
|
||||||
if (count > this.MAX_COUNT) {
|
|
||||||
throw new Error('Max count exceeded. If this test uses a looping function, make sure the iteration loop is working properly.');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
// Exceptions are caught and displayed in the test UI
|
|
||||||
this.reset();
|
|
||||||
this.error = e;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Figure out what to do next
|
|
||||||
if (this.running) {
|
|
||||||
me.run(count);
|
|
||||||
} else {
|
|
||||||
jsl.status('');
|
|
||||||
me.onStop(me);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Finish up
|
|
||||||
this.onChange(this);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the number of operations per second for this test.
|
|
||||||
*
|
|
||||||
* @param normalize if true, iteration loop overhead taken into account
|
|
||||||
*/
|
|
||||||
getHz: function(/**Boolean*/ normalize) {
|
|
||||||
var p = this.period;
|
|
||||||
|
|
||||||
// Adjust period based on the calibration test time
|
|
||||||
if (normalize && !this.isCalibration) {
|
|
||||||
var cal = Test.CALIBRATIONS[this.loopArg ? 0 : 1];
|
|
||||||
|
|
||||||
// If the period is within 20% of the calibration time, then zero the
|
|
||||||
// it out
|
|
||||||
p = p < cal.period*1.2 ? 0 : p - cal.period;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Math.round(1/p);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a friendly string describing the test
|
|
||||||
*/
|
|
||||||
toString: function() {
|
|
||||||
return this.name + ' - ' + this.time/this.count + ' secs';
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// CSS we need for the UI
|
|
||||||
var STYLESHEET = '<style> \
|
|
||||||
#jslitmus {font-family:sans-serif; font-size: 12px;} \
|
|
||||||
#jslitmus a {text-decoration: none;} \
|
|
||||||
#jslitmus a:hover {text-decoration: underline;} \
|
|
||||||
#jsl_status { \
|
|
||||||
margin-top: 10px; \
|
|
||||||
font-size: 10px; \
|
|
||||||
color: #888; \
|
|
||||||
} \
|
|
||||||
A IMG {border:none} \
|
|
||||||
#test_results { \
|
|
||||||
margin-top: 10px; \
|
|
||||||
font-size: 12px; \
|
|
||||||
font-family: sans-serif; \
|
|
||||||
border-collapse: collapse; \
|
|
||||||
border-spacing: 0px; \
|
|
||||||
} \
|
|
||||||
#test_results th, #test_results td { \
|
|
||||||
border: solid 1px #ccc; \
|
|
||||||
vertical-align: top; \
|
|
||||||
padding: 3px; \
|
|
||||||
} \
|
|
||||||
#test_results th { \
|
|
||||||
vertical-align: bottom; \
|
|
||||||
background-color: #ccc; \
|
|
||||||
padding: 1px; \
|
|
||||||
font-size: 10px; \
|
|
||||||
} \
|
|
||||||
#test_results #test_platform { \
|
|
||||||
color: #444; \
|
|
||||||
text-align:center; \
|
|
||||||
} \
|
|
||||||
#test_results .test_row { \
|
|
||||||
color: #006; \
|
|
||||||
cursor: pointer; \
|
|
||||||
} \
|
|
||||||
#test_results .test_nonlooping { \
|
|
||||||
border-left-style: dotted; \
|
|
||||||
border-left-width: 2px; \
|
|
||||||
} \
|
|
||||||
#test_results .test_looping { \
|
|
||||||
border-left-style: solid; \
|
|
||||||
border-left-width: 2px; \
|
|
||||||
} \
|
|
||||||
#test_results .test_name {white-space: nowrap;} \
|
|
||||||
#test_results .test_pending { \
|
|
||||||
} \
|
|
||||||
#test_results .test_running { \
|
|
||||||
font-style: italic; \
|
|
||||||
} \
|
|
||||||
#test_results .test_done {} \
|
|
||||||
#test_results .test_done { \
|
|
||||||
text-align: right; \
|
|
||||||
font-family: monospace; \
|
|
||||||
} \
|
|
||||||
#test_results .test_error {color: #600;} \
|
|
||||||
#test_results .test_error .error_head {font-weight:bold;} \
|
|
||||||
#test_results .test_error .error_body {font-size:85%;} \
|
|
||||||
#test_results .test_row:hover td { \
|
|
||||||
background-color: #ffc; \
|
|
||||||
text-decoration: underline; \
|
|
||||||
} \
|
|
||||||
#chart { \
|
|
||||||
margin: 10px 0px; \
|
|
||||||
width: 250px; \
|
|
||||||
} \
|
|
||||||
#chart img { \
|
|
||||||
border: solid 1px #ccc; \
|
|
||||||
margin-bottom: 5px; \
|
|
||||||
} \
|
|
||||||
#chart #tiny_url { \
|
|
||||||
height: 40px; \
|
|
||||||
width: 250px; \
|
|
||||||
} \
|
|
||||||
#jslitmus_credit { \
|
|
||||||
font-size: 10px; \
|
|
||||||
color: #888; \
|
|
||||||
margin-top: 8px; \
|
|
||||||
} \
|
|
||||||
</style>';
|
|
||||||
|
|
||||||
// HTML markup for the UI
|
|
||||||
var MARKUP = '<div id="jslitmus"> \
|
|
||||||
<button onclick="JSLitmus.runAll(event)">Run Tests</button> \
|
|
||||||
<button id="stop_button" disabled="disabled" onclick="JSLitmus.stop()">Stop Tests</button> \
|
|
||||||
<br \> \
|
|
||||||
<br \> \
|
|
||||||
<input type="checkbox" style="vertical-align: middle" id="test_normalize" checked="checked" onchange="JSLitmus.renderAll()""> Normalize results \
|
|
||||||
<table id="test_results"> \
|
|
||||||
<colgroup> \
|
|
||||||
<col /> \
|
|
||||||
<col width="100" /> \
|
|
||||||
</colgroup> \
|
|
||||||
<tr><th id="test_platform" colspan="2">' + platform + '</th></tr> \
|
|
||||||
<tr><th>Test</th><th>Ops/sec</th></tr> \
|
|
||||||
<tr id="test_row_template" class="test_row" style="display:none"> \
|
|
||||||
<td class="test_name"></td> \
|
|
||||||
<td class="test_result">Ready</td> \
|
|
||||||
</tr> \
|
|
||||||
</table> \
|
|
||||||
<div id="jsl_status"></div> \
|
|
||||||
<div id="chart" style="display:none"> \
|
|
||||||
<a id="chart_link" target="_blank"><img id="chart_image"></a> \
|
|
||||||
TinyURL (for chart): \
|
|
||||||
<iframe id="tiny_url" frameBorder="0" scrolling="no" src=""></iframe> \
|
|
||||||
</div> \
|
|
||||||
<a id="jslitmus_credit" title="JSLitmus home page" href="http://code.google.com/p/jslitmus" target="_blank">Powered by JSLitmus</a> \
|
|
||||||
</div>';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The public API for creating and running tests
|
|
||||||
*/
|
|
||||||
window.JSLitmus = {
|
|
||||||
/** The list of all tests that have been registered with JSLitmus.test */
|
|
||||||
_tests: [],
|
|
||||||
/** The queue of tests that need to be run */
|
|
||||||
_queue: [],
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The parsed query parameters the current page URL. This is provided as a
|
|
||||||
* convenience for test functions - it's not used by JSLitmus proper
|
|
||||||
*/
|
|
||||||
params: {},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize
|
|
||||||
*/
|
|
||||||
_init: function() {
|
|
||||||
// Parse query params into JSLitmus.params[] hash
|
|
||||||
var match = (location + '').match(/([^?#]*)(#.*)?$/);
|
|
||||||
if (match) {
|
|
||||||
var pairs = match[1].split('&');
|
|
||||||
for (var i = 0; i < pairs.length; i++) {
|
|
||||||
var pair = pairs[i].split('=');
|
|
||||||
if (pair.length > 1) {
|
|
||||||
var key = pair.shift();
|
|
||||||
var value = pair.length > 1 ? pair.join('=') : pair[0];
|
|
||||||
this.params[key] = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Write out the stylesheet. We have to do this here because IE
|
|
||||||
// doesn't honor sheets written after the document has loaded.
|
|
||||||
document.write(STYLESHEET);
|
|
||||||
|
|
||||||
// Setup the rest of the UI once the document is loaded
|
|
||||||
if (window.addEventListener) {
|
|
||||||
window.addEventListener('load', this._setup, false);
|
|
||||||
} else if (document.addEventListener) {
|
|
||||||
document.addEventListener('load', this._setup, false);
|
|
||||||
} else if (window.attachEvent) {
|
|
||||||
window.attachEvent('onload', this._setup);
|
|
||||||
}
|
|
||||||
|
|
||||||
return this;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set up the UI
|
|
||||||
*/
|
|
||||||
_setup: function() {
|
|
||||||
var el = jsl.$('jslitmus_container');
|
|
||||||
if (!el) document.body.appendChild(el = document.createElement('div'));
|
|
||||||
|
|
||||||
el.innerHTML = MARKUP;
|
|
||||||
|
|
||||||
// Render the UI for all our tests
|
|
||||||
for (var i=0; i < JSLitmus._tests.length; i++)
|
|
||||||
JSLitmus.renderTest(JSLitmus._tests[i]);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* (Re)render all the test results
|
|
||||||
*/
|
|
||||||
renderAll: function() {
|
|
||||||
for (var i = 0; i < JSLitmus._tests.length; i++)
|
|
||||||
JSLitmus.renderTest(JSLitmus._tests[i]);
|
|
||||||
JSLitmus.renderChart();
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* (Re)render the chart graphics
|
|
||||||
*/
|
|
||||||
renderChart: function() {
|
|
||||||
var url = JSLitmus.chartUrl();
|
|
||||||
jsl.$('chart_link').href = url;
|
|
||||||
jsl.$('chart_image').src = url;
|
|
||||||
jsl.$('chart').style.display = '';
|
|
||||||
|
|
||||||
// Update the tiny URL
|
|
||||||
jsl.$('tiny_url').src = 'http://tinyurl.com/api-create.php?url='+escape(url);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* (Re)render the results for a specific test
|
|
||||||
*/
|
|
||||||
renderTest: function(test) {
|
|
||||||
// Make a new row if needed
|
|
||||||
if (!test._row) {
|
|
||||||
var trow = jsl.$('test_row_template');
|
|
||||||
if (!trow) return;
|
|
||||||
|
|
||||||
test._row = trow.cloneNode(true);
|
|
||||||
test._row.style.display = '';
|
|
||||||
test._row.id = '';
|
|
||||||
test._row.onclick = function() {JSLitmus._queueTest(test);};
|
|
||||||
test._row.title = 'Run ' + test.name + ' test';
|
|
||||||
trow.parentNode.appendChild(test._row);
|
|
||||||
test._row.cells[0].innerHTML = test.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
var cell = test._row.cells[1];
|
|
||||||
var cns = [test.loopArg ? 'test_looping' : 'test_nonlooping'];
|
|
||||||
|
|
||||||
if (test.error) {
|
|
||||||
cns.push('test_error');
|
|
||||||
cell.innerHTML =
|
|
||||||
'<div class="error_head">' + test.error + '</div>' +
|
|
||||||
'<ul class="error_body"><li>' +
|
|
||||||
jsl.join(test.error, ': ', '</li><li>') +
|
|
||||||
'</li></ul>';
|
|
||||||
} else {
|
|
||||||
if (test.running) {
|
|
||||||
cns.push('test_running');
|
|
||||||
cell.innerHTML = 'running';
|
|
||||||
} else if (jsl.indexOf(JSLitmus._queue, test) >= 0) {
|
|
||||||
cns.push('test_pending');
|
|
||||||
cell.innerHTML = 'pending';
|
|
||||||
} else if (test.count) {
|
|
||||||
cns.push('test_done');
|
|
||||||
var hz = test.getHz(jsl.$('test_normalize').checked);
|
|
||||||
cell.innerHTML = hz != Infinity ? hz : '∞';
|
|
||||||
} else {
|
|
||||||
cell.innerHTML = 'ready';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
cell.className = cns.join(' ');
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new test
|
|
||||||
*/
|
|
||||||
test: function(name, f) {
|
|
||||||
// Create the Test object
|
|
||||||
var test = new Test(name, f);
|
|
||||||
JSLitmus._tests.push(test);
|
|
||||||
|
|
||||||
// Re-render if the test state changes
|
|
||||||
test.onChange = JSLitmus.renderTest;
|
|
||||||
|
|
||||||
// Run the next test if this one finished
|
|
||||||
test.onStop = function(test) {
|
|
||||||
if (JSLitmus.onTestFinish) JSLitmus.onTestFinish(test);
|
|
||||||
JSLitmus.currentTest = null;
|
|
||||||
JSLitmus._nextTest();
|
|
||||||
};
|
|
||||||
|
|
||||||
// Render the new test
|
|
||||||
this.renderTest(test);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add all tests to the run queue
|
|
||||||
*/
|
|
||||||
runAll: function(e) {
|
|
||||||
e = e || window.event;
|
|
||||||
var reverse = e && e.shiftKey, len = JSLitmus._tests.length;
|
|
||||||
for (var i = 0; i < len; i++) {
|
|
||||||
JSLitmus._queueTest(JSLitmus._tests[!reverse ? i : (len - i - 1)]);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove all tests from the run queue. The current test has to finish on
|
|
||||||
* it's own though
|
|
||||||
*/
|
|
||||||
stop: function() {
|
|
||||||
while (JSLitmus._queue.length) {
|
|
||||||
var test = JSLitmus._queue.shift();
|
|
||||||
JSLitmus.renderTest(test);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Run the next test in the run queue
|
|
||||||
*/
|
|
||||||
_nextTest: function() {
|
|
||||||
if (!JSLitmus.currentTest) {
|
|
||||||
var test = JSLitmus._queue.shift();
|
|
||||||
if (test) {
|
|
||||||
jsl.$('stop_button').disabled = false;
|
|
||||||
JSLitmus.currentTest = test;
|
|
||||||
test.run();
|
|
||||||
JSLitmus.renderTest(test);
|
|
||||||
if (JSLitmus.onTestStart) JSLitmus.onTestStart(test);
|
|
||||||
} else {
|
|
||||||
jsl.$('stop_button').disabled = true;
|
|
||||||
JSLitmus.renderChart();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a test to the run queue
|
|
||||||
*/
|
|
||||||
_queueTest: function(test) {
|
|
||||||
if (jsl.indexOf(JSLitmus._queue, test) >= 0) return;
|
|
||||||
JSLitmus._queue.push(test);
|
|
||||||
JSLitmus.renderTest(test);
|
|
||||||
JSLitmus._nextTest();
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Generate a Google Chart URL that shows the data for all tests
|
|
||||||
*/
|
|
||||||
chartUrl: function() {
|
|
||||||
var n = JSLitmus._tests.length, markers = [], data = [];
|
|
||||||
var d, min = 0, max = -1e10;
|
|
||||||
var normalize = jsl.$('test_normalize').checked;
|
|
||||||
|
|
||||||
// Gather test data
|
|
||||||
for (var i=0; i < JSLitmus._tests.length; i++) {
|
|
||||||
var test = JSLitmus._tests[i];
|
|
||||||
if (test.count) {
|
|
||||||
var hz = test.getHz(normalize);
|
|
||||||
var v = hz != Infinity ? hz : 0;
|
|
||||||
data.push(v);
|
|
||||||
markers.push('t' + jsl.escape(test.name + '(' + jsl.toLabel(hz)+ ')') + ',000000,0,' +
|
|
||||||
markers.length + ',10');
|
|
||||||
max = Math.max(v, max);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (markers.length <= 0) return null;
|
|
||||||
|
|
||||||
// Build chart title
|
|
||||||
var title = document.getElementsByTagName('title');
|
|
||||||
title = (title && title.length) ? title[0].innerHTML : null;
|
|
||||||
var chart_title = [];
|
|
||||||
if (title) chart_title.push(title);
|
|
||||||
chart_title.push('Ops/sec (' + platform + ')');
|
|
||||||
|
|
||||||
// Build labels
|
|
||||||
var labels = [jsl.toLabel(min), jsl.toLabel(max)];
|
|
||||||
|
|
||||||
var w = 250, bw = 15;
|
|
||||||
var bs = 5;
|
|
||||||
var h = markers.length*(bw + bs) + 30 + chart_title.length*20;
|
|
||||||
|
|
||||||
var params = {
|
|
||||||
chtt: escape(chart_title.join('|')),
|
|
||||||
chts: '000000,10',
|
|
||||||
cht: 'bhg', // chart type
|
|
||||||
chd: 't:' + data.join(','), // data set
|
|
||||||
chds: min + ',' + max, // max/min of data
|
|
||||||
chxt: 'x', // label axes
|
|
||||||
chxl: '0:|' + labels.join('|'), // labels
|
|
||||||
chsp: '0,1',
|
|
||||||
chm: markers.join('|'), // test names
|
|
||||||
chbh: [bw, 0, bs].join(','), // bar widths
|
|
||||||
// chf: 'bg,lg,0,eeeeee,0,eeeeee,.5,ffffff,1', // gradient
|
|
||||||
chs: w + 'x' + h
|
|
||||||
};
|
|
||||||
return 'http://chart.apis.google.com/chart?' + jsl.join(params, '=', '&');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
JSLitmus._init();
|
|
||||||
})();
|
|
||||||
235
vendor/underscore/test/vendor/qunit.css
vendored
235
vendor/underscore/test/vendor/qunit.css
vendored
@@ -1,235 +0,0 @@
|
|||||||
/**
|
|
||||||
* QUnit v1.10.0 - A JavaScript Unit Testing Framework
|
|
||||||
*
|
|
||||||
* http://qunitjs.com
|
|
||||||
*
|
|
||||||
* Copyright 2012 jQuery Foundation and other contributors
|
|
||||||
* Released under the MIT license.
|
|
||||||
* http://jquery.org/license
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** Font Family and Sizes */
|
|
||||||
|
|
||||||
#qunit-tests, #qunit-header, #qunit-banner, #qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult {
|
|
||||||
font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial, sans-serif;
|
|
||||||
}
|
|
||||||
|
|
||||||
#qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult, #qunit-tests li { font-size: small; }
|
|
||||||
#qunit-tests { font-size: smaller; }
|
|
||||||
|
|
||||||
|
|
||||||
/** Resets */
|
|
||||||
|
|
||||||
#qunit-tests, #qunit-tests ol, #qunit-header, #qunit-banner, #qunit-userAgent, #qunit-testresult, #qunit-modulefilter {
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/** Header */
|
|
||||||
|
|
||||||
#qunit-header {
|
|
||||||
padding: 0.5em 0 0.5em 1em;
|
|
||||||
|
|
||||||
color: #8699a4;
|
|
||||||
background-color: #0d3349;
|
|
||||||
|
|
||||||
font-size: 1.5em;
|
|
||||||
line-height: 1em;
|
|
||||||
font-weight: normal;
|
|
||||||
|
|
||||||
border-radius: 5px 5px 0 0;
|
|
||||||
-moz-border-radius: 5px 5px 0 0;
|
|
||||||
-webkit-border-top-right-radius: 5px;
|
|
||||||
-webkit-border-top-left-radius: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#qunit-header a {
|
|
||||||
text-decoration: none;
|
|
||||||
color: #c2ccd1;
|
|
||||||
}
|
|
||||||
|
|
||||||
#qunit-header a:hover,
|
|
||||||
#qunit-header a:focus {
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
#qunit-testrunner-toolbar label {
|
|
||||||
display: inline-block;
|
|
||||||
padding: 0 .5em 0 .1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
#qunit-banner {
|
|
||||||
height: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#qunit-testrunner-toolbar {
|
|
||||||
padding: 0.5em 0 0.5em 2em;
|
|
||||||
color: #5E740B;
|
|
||||||
background-color: #eee;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
#qunit-userAgent {
|
|
||||||
padding: 0.5em 0 0.5em 2.5em;
|
|
||||||
background-color: #2b81af;
|
|
||||||
color: #fff;
|
|
||||||
text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#qunit-modulefilter-container {
|
|
||||||
float: right;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Tests: Pass/Fail */
|
|
||||||
|
|
||||||
#qunit-tests {
|
|
||||||
list-style-position: inside;
|
|
||||||
}
|
|
||||||
|
|
||||||
#qunit-tests li {
|
|
||||||
padding: 0.4em 0.5em 0.4em 2.5em;
|
|
||||||
border-bottom: 1px solid #fff;
|
|
||||||
list-style-position: inside;
|
|
||||||
}
|
|
||||||
|
|
||||||
#qunit-tests.hidepass li.pass, #qunit-tests.hidepass li.running {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
#qunit-tests li strong {
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
#qunit-tests li a {
|
|
||||||
padding: 0.5em;
|
|
||||||
color: #c2ccd1;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
#qunit-tests li a:hover,
|
|
||||||
#qunit-tests li a:focus {
|
|
||||||
color: #000;
|
|
||||||
}
|
|
||||||
|
|
||||||
#qunit-tests ol {
|
|
||||||
margin-top: 0.5em;
|
|
||||||
padding: 0.5em;
|
|
||||||
|
|
||||||
background-color: #fff;
|
|
||||||
|
|
||||||
border-radius: 5px;
|
|
||||||
-moz-border-radius: 5px;
|
|
||||||
-webkit-border-radius: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#qunit-tests table {
|
|
||||||
border-collapse: collapse;
|
|
||||||
margin-top: .2em;
|
|
||||||
}
|
|
||||||
|
|
||||||
#qunit-tests th {
|
|
||||||
text-align: right;
|
|
||||||
vertical-align: top;
|
|
||||||
padding: 0 .5em 0 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#qunit-tests td {
|
|
||||||
vertical-align: top;
|
|
||||||
}
|
|
||||||
|
|
||||||
#qunit-tests pre {
|
|
||||||
margin: 0;
|
|
||||||
white-space: pre-wrap;
|
|
||||||
word-wrap: break-word;
|
|
||||||
}
|
|
||||||
|
|
||||||
#qunit-tests del {
|
|
||||||
background-color: #e0f2be;
|
|
||||||
color: #374e0c;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
#qunit-tests ins {
|
|
||||||
background-color: #ffcaca;
|
|
||||||
color: #500;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*** Test Counts */
|
|
||||||
|
|
||||||
#qunit-tests b.counts { color: black; }
|
|
||||||
#qunit-tests b.passed { color: #5E740B; }
|
|
||||||
#qunit-tests b.failed { color: #710909; }
|
|
||||||
|
|
||||||
#qunit-tests li li {
|
|
||||||
padding: 5px;
|
|
||||||
background-color: #fff;
|
|
||||||
border-bottom: none;
|
|
||||||
list-style-position: inside;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*** Passing Styles */
|
|
||||||
|
|
||||||
#qunit-tests li li.pass {
|
|
||||||
color: #3c510c;
|
|
||||||
background-color: #fff;
|
|
||||||
border-left: 10px solid #C6E746;
|
|
||||||
}
|
|
||||||
|
|
||||||
#qunit-tests .pass { color: #528CE0; background-color: #D2E0E6; }
|
|
||||||
#qunit-tests .pass .test-name { color: #366097; }
|
|
||||||
|
|
||||||
#qunit-tests .pass .test-actual,
|
|
||||||
#qunit-tests .pass .test-expected { color: #999999; }
|
|
||||||
|
|
||||||
#qunit-banner.qunit-pass { background-color: #C6E746; }
|
|
||||||
|
|
||||||
/*** Failing Styles */
|
|
||||||
|
|
||||||
#qunit-tests li li.fail {
|
|
||||||
color: #710909;
|
|
||||||
background-color: #fff;
|
|
||||||
border-left: 10px solid #EE5757;
|
|
||||||
white-space: pre;
|
|
||||||
}
|
|
||||||
|
|
||||||
#qunit-tests > li:last-child {
|
|
||||||
border-radius: 0 0 5px 5px;
|
|
||||||
-moz-border-radius: 0 0 5px 5px;
|
|
||||||
-webkit-border-bottom-right-radius: 5px;
|
|
||||||
-webkit-border-bottom-left-radius: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#qunit-tests .fail { color: #000000; background-color: #EE5757; }
|
|
||||||
#qunit-tests .fail .test-name,
|
|
||||||
#qunit-tests .fail .module-name { color: #000000; }
|
|
||||||
|
|
||||||
#qunit-tests .fail .test-actual { color: #EE5757; }
|
|
||||||
#qunit-tests .fail .test-expected { color: green; }
|
|
||||||
|
|
||||||
#qunit-banner.qunit-fail { background-color: #EE5757; }
|
|
||||||
|
|
||||||
|
|
||||||
/** Result */
|
|
||||||
|
|
||||||
#qunit-testresult {
|
|
||||||
padding: 0.5em 0.5em 0.5em 2.5em;
|
|
||||||
|
|
||||||
color: #2b81af;
|
|
||||||
background-color: #D2E0E6;
|
|
||||||
|
|
||||||
border-bottom: 1px solid white;
|
|
||||||
}
|
|
||||||
#qunit-testresult .module-name {
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Fixture */
|
|
||||||
|
|
||||||
#qunit-fixture {
|
|
||||||
position: absolute;
|
|
||||||
top: -10000px;
|
|
||||||
left: -10000px;
|
|
||||||
width: 1000px;
|
|
||||||
height: 1000px;
|
|
||||||
}
|
|
||||||
1977
vendor/underscore/test/vendor/qunit.js
vendored
1977
vendor/underscore/test/vendor/qunit.js
vendored
File diff suppressed because it is too large
Load Diff
2
vendor/underscore/underscore-min.js
vendored
2
vendor/underscore/underscore-min.js
vendored
File diff suppressed because one or more lines are too long
11
vendor/underscore/underscore.js
vendored
11
vendor/underscore/underscore.js
vendored
@@ -177,12 +177,9 @@
|
|||||||
|
|
||||||
// Return all the elements for which a truth test fails.
|
// Return all the elements for which a truth test fails.
|
||||||
_.reject = function(obj, iterator, context) {
|
_.reject = function(obj, iterator, context) {
|
||||||
var results = [];
|
return _.filter(obj, function(value, index, list) {
|
||||||
if (obj == null) return results;
|
return !iterator.call(context, value, index, list);
|
||||||
each(obj, function(value, index, list) {
|
}, context);
|
||||||
if (!iterator.call(context, value, index, list)) results[results.length] = value;
|
|
||||||
});
|
|
||||||
return results;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Determine whether all of the elements match a truth test.
|
// Determine whether all of the elements match a truth test.
|
||||||
@@ -954,7 +951,7 @@
|
|||||||
|
|
||||||
// Is a given object a finite number?
|
// Is a given object a finite number?
|
||||||
_.isFinite = function(obj) {
|
_.isFinite = function(obj) {
|
||||||
return _.isNumber(obj) && isFinite(obj);
|
return isFinite( obj ) && !isNaN( parseFloat(obj) );
|
||||||
};
|
};
|
||||||
|
|
||||||
// Is the given value `NaN`? (NaN is the only number which does not equal itself).
|
// Is the given value `NaN`? (NaN is the only number which does not equal itself).
|
||||||
|
|||||||
Reference in New Issue
Block a user