mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-04 08:57:49 +00:00
Compare commits
95 Commits
0.9.2
...
1.0.0-rc.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
54b862bd79 | ||
|
|
e37e1c109a | ||
|
|
939123785b | ||
|
|
221b347bd9 | ||
|
|
af9bf3e852 | ||
|
|
ed8746df77 | ||
|
|
bb187db49d | ||
|
|
081e72b3ea | ||
|
|
6188c38053 | ||
|
|
12b0186f5a | ||
|
|
9bccc9c53c | ||
|
|
351b2b320e | ||
|
|
94258feb09 | ||
|
|
8b0f033a78 | ||
|
|
f58f255fc8 | ||
|
|
e3eabcf648 | ||
|
|
9aa506cbd7 | ||
|
|
d8cff7b90f | ||
|
|
07e7bca9eb | ||
|
|
e1f442be90 | ||
|
|
c5d579e0e3 | ||
|
|
5271c2e08f | ||
|
|
9010a7ddbc | ||
|
|
bb95fb7d07 | ||
|
|
2edb11376d | ||
|
|
e7f5ebf912 | ||
|
|
da9758c2f3 | ||
|
|
3e11d58d73 | ||
|
|
6b35c097d6 | ||
|
|
619ba13265 | ||
|
|
529c5b8abf | ||
|
|
3a5ed6e800 | ||
|
|
52cddc015b | ||
|
|
4a01f4f65f | ||
|
|
f9768cb5a3 | ||
|
|
221e0e550c | ||
|
|
d2d1d42d0f | ||
|
|
faf018a097 | ||
|
|
a2a71a107e | ||
|
|
fc9c937e67 | ||
|
|
b4f2e9b442 | ||
|
|
1672645e73 | ||
|
|
4a42c44101 | ||
|
|
383b1a5769 | ||
|
|
77bac4cf9e | ||
|
|
e2b8e530c9 | ||
|
|
e9f752bd67 | ||
|
|
4b31921eb4 | ||
|
|
3df9fc6225 | ||
|
|
b57fe466ce | ||
|
|
bd4bff3b6b | ||
|
|
9d4618a223 | ||
|
|
93636180df | ||
|
|
fcceaa168f | ||
|
|
2639cc6138 | ||
|
|
4a99c2e928 | ||
|
|
7d5af3df05 | ||
|
|
c88b80d2a0 | ||
|
|
819d4abaa2 | ||
|
|
20630aeb47 | ||
|
|
0c0db3babb | ||
|
|
e7761f7e57 | ||
|
|
064fd497ae | ||
|
|
49c60b6b75 | ||
|
|
ca7f36506c | ||
|
|
155f0a9736 | ||
|
|
25e1eb3ce9 | ||
|
|
f2f980928b | ||
|
|
1d121a97a7 | ||
|
|
211d13da09 | ||
|
|
11343d469e | ||
|
|
d7c8041aa1 | ||
|
|
9587e30af8 | ||
|
|
76fa7affaf | ||
|
|
2971dd8672 | ||
|
|
2a33fe3564 | ||
|
|
46cdf5da70 | ||
|
|
28c801bfd4 | ||
|
|
c22cd40293 | ||
|
|
56bd430983 | ||
|
|
d873890e46 | ||
|
|
d29b8eca3c | ||
|
|
6f258000fe | ||
|
|
255211cd07 | ||
|
|
f6d28a90e3 | ||
|
|
ed66ff88a1 | ||
|
|
82e58f2bf9 | ||
|
|
797a87ca26 | ||
|
|
ec6a709393 | ||
|
|
07cbfdb424 | ||
|
|
3b9bd944fb | ||
|
|
934e585cb3 | ||
|
|
3a68f4cf54 | ||
|
|
bd00fcb875 | ||
|
|
905dd5a70f |
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
* text=auto
|
||||||
@@ -3,5 +3,5 @@ node_js:
|
|||||||
- 0.6
|
- 0.6
|
||||||
- 0.8
|
- 0.8
|
||||||
before_script:
|
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/a2787b470c577cee2404d186c562dd9835f779f5 | 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"
|
- "curl -H 'Accept: application/vnd.github.v3.raw' https://api.github.com/repos/bestiejs/lodash/git/blobs/3390b259e04829538e4d3635d12b317dd6103eca | tar xvz -C vendor"
|
||||||
|
|||||||
94
README.md
94
README.md
@@ -1,17 +1,25 @@
|
|||||||
# Lo-Dash <sup>v0.9.2</sup>
|
# Lo-Dash <sup>v1.0.0-rc.2</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 utility library, usable as a drop-in replacement for Underscore, delivering [performance](http://lodash.com/benchmarks), [bug fixes](https://github.com/bestiejs/lodash#resolved-underscorejs-issues), and [additional features](http://lodash.com/#features).
|
||||||
|
|
||||||
Lo-Dash’s performance is gained by avoiding slower native methods, instead opting for simplified non-ES5 compliant methods optimized for common usage, and by leveraging function compilation to reduce the number of overall function calls.
|
|
||||||
|
|
||||||
## Download
|
## Download
|
||||||
|
|
||||||
* [Development build](https://raw.github.com/bestiejs/lodash/v0.9.2/lodash.js)
|
* Lo-Dash builds:<br>
|
||||||
* [Production build](https://raw.github.com/bestiejs/lodash/v0.9.2/lodash.min.js)
|
[Development](https://raw.github.com/bestiejs/lodash/v1.0.0-rc.2/lodash.js) and
|
||||||
* [Underscore build](https://raw.github.com/bestiejs/lodash/v0.9.2/lodash.underscore.min.js) tailored for projects already using Underscore
|
[Production](https://raw.github.com/bestiejs/lodash/v1.0.0-rc.2/lodash.min.js)
|
||||||
* CDN copies of ≤ v0.9.2’s [Production](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/0.9.2/lodash.min.js), [Underscore](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/0.9.2/lodash.underscore.min.js), and [Development](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/0.9.2/lodash.js) builds 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
|
* Underscore builds:<br>
|
||||||
|
[Development](https://raw.github.com/bestiejs/lodash/v1.0.0-rc.2/lodash.underscore.js) and
|
||||||
|
[Production](https://raw.github.com/bestiejs/lodash/v1.0.0-rc.2/lodash.underscore.min.js)
|
||||||
|
|
||||||
|
* CDN copies of ≤ v1.0.0-rc.2’s builds are available on [cdnjs](http://cdnjs.com/) thanks to [CloudFlare](http://www.cloudflare.com/):<br>
|
||||||
|
[Lo-Dash development](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.0.0-rc.2/lodash.js),
|
||||||
|
[Lo-Dash production](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.0.0-rc.2/lodash.min.js),
|
||||||
|
[Underscore development](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.0.0-rc.2/lodash.underscore.js), and
|
||||||
|
[Underscore production](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.0.0-rc.2/lodash.underscore.min.js)
|
||||||
|
|
||||||
|
* For optimal file size, [create a custom build](https://github.com/bestiejs/lodash#custom-builds) with only the features you need
|
||||||
|
|
||||||
## Dive in
|
## Dive in
|
||||||
|
|
||||||
@@ -30,27 +38,29 @@ For more information check out these screencasts over Lo-Dash:
|
|||||||
* [Lo-Dash’s origin and why it’s a better utility belt](https://vimeo.com/44154600)
|
* [Lo-Dash’s origin and why it’s a better utility belt](https://vimeo.com/44154600)
|
||||||
* [Unit testing in Lo-Dash](https://vimeo.com/45865290)
|
* [Unit testing in Lo-Dash](https://vimeo.com/45865290)
|
||||||
* [Lo-Dash’s approach to native method use](https://vimeo.com/48576012)
|
* [Lo-Dash’s approach to native method use](https://vimeo.com/48576012)
|
||||||
|
* [CascadiaJS: Lo-Dash for a better utility belt](http://www.youtube.com/watch?v=dpPy4f_SeEk)
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
* AMD loader support ([RequireJS](http://requirejs.org/), [curl.js](https://github.com/cujojs/curl), etc.)
|
* AMD loader support ([RequireJS](http://requirejs.org/), [curl.js](https://github.com/cujojs/curl), etc.)
|
||||||
|
* [_(…)](http://lodash.com/docs#_) supports intuitive chaining without calling [_(…).chain](http://lodash.com/docs#prototype_chain)
|
||||||
|
* [_.bindKey](http://lodash.com/docs#bindKey) for binding [*“lazy”* defined](http://michaux.ca/articles/lazy-function-definition-pattern) methods
|
||||||
* [_.clone](http://lodash.com/docs#clone) supports *“deep”* cloning
|
* [_.clone](http://lodash.com/docs#clone) supports *“deep”* cloning
|
||||||
* [_.contains](http://lodash.com/docs#contains) accepts a `fromIndex` argument
|
* [_.contains](http://lodash.com/docs#contains) accepts a `fromIndex` argument
|
||||||
* [_.forEach](http://lodash.com/docs#forEach) is chainable and supports exiting iteration early
|
* [_.forEach](http://lodash.com/docs#forEach) is chainable and supports exiting iteration early
|
||||||
* [_.forIn](http://lodash.com/docs#forIn) for iterating over an object’s own and inherited properties
|
* [_.forIn](http://lodash.com/docs#forIn) for iterating over an object’s own and inherited properties
|
||||||
* [_.forOwn](http://lodash.com/docs#forOwn) for iterating over an object’s own properties
|
* [_.forOwn](http://lodash.com/docs#forOwn) for iterating over an object’s own properties
|
||||||
* [_.isPlainObject](http://lodash.com/docs#isPlainObject) checks if values are created by the `Object` constructor
|
* [_.isPlainObject](http://lodash.com/docs#isPlainObject) checks if values are created by the `Object` constructor
|
||||||
* [_.lateBind](http://lodash.com/docs#lateBind) for late binding
|
|
||||||
* [_.merge](http://lodash.com/docs#merge) for a *“deep”* [_.extend](http://lodash.com/docs#extend)
|
* [_.merge](http://lodash.com/docs#merge) for a *“deep”* [_.extend](http://lodash.com/docs#extend)
|
||||||
* [_.partial](http://lodash.com/docs#partial) for partial application without `this` binding
|
* [_.partial](http://lodash.com/docs#partial) for partial application without `this` binding
|
||||||
* [_.pick](http://lodash.com/docs#pick) and [_.omit](http://lodash.com/docs#omit) accepts `callback` and `thisArg` arguments
|
* [_.pick](http://lodash.com/docs#pick) and [_.omit](http://lodash.com/docs#omit) accepts `callback` and `thisArg` arguments
|
||||||
* [_.template](http://lodash.com/docs#template) supports [ES6 delimiters](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-7.8.6) and utilizes [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) for easier debugging
|
* [_.template](http://lodash.com/docs#template) supports [ES6 template delimiters](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-7.8.6) and utilizes [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) for easier debugging
|
||||||
* [_.contains](http://lodash.com/docs#contains), [_.size](http://lodash.com/docs#size), [_.toArray](http://lodash.com/docs#toArray),
|
* [_.contains](http://lodash.com/docs#contains), [_.size](http://lodash.com/docs#size), [_.toArray](http://lodash.com/docs#toArray),
|
||||||
[and more…](http://lodash.com/docs "_.countBy, _.every, _.filter, _.find, _.forEach, _.groupBy, _.invoke, _.map, _.max, _.min, _.pluck, _.reduce, _.reduceRight, _.reject, _.shuffle, _.some, _.sortBy, _.where") accept strings
|
[and more…](http://lodash.com/docs "_.countBy, _.every, _.filter, _.find, _.forEach, _.groupBy, _.invoke, _.map, _.max, _.min, _.pluck, _.reduce, _.reduceRight, _.reject, _.shuffle, _.some, _.sortBy, _.where") accept strings
|
||||||
|
|
||||||
## Support
|
## Support
|
||||||
|
|
||||||
Lo-Dash has been tested in at least Chrome 5~23, Firefox 1~16, IE 6-10, Opera 9.25-12, Safari 3-6, Node.js 0.4.8-0.8.14, Narwhal 0.3.2, RingoJS 0.8, and Rhino 1.7RC5.
|
Lo-Dash has been tested in at least Chrome 5~23, Firefox 1~16, IE 6-10, Opera 9.25-12, Safari 3-6, Node.js 0.4.8-0.8.15, Narwhal 0.3.2, RingoJS 0.8, and Rhino 1.7RC5.
|
||||||
|
|
||||||
## Custom builds
|
## Custom builds
|
||||||
|
|
||||||
@@ -62,7 +72,8 @@ To top it off, we handle all method dependency and alias mapping for you.
|
|||||||
lodash backbone
|
lodash backbone
|
||||||
```
|
```
|
||||||
|
|
||||||
* CSP builds, supporting default Content Security Policy restrictions, may be created using the `csp` modifier argument.
|
* CSP builds, supporting default [Content Security Policy](http://dvcs.w3.org/hg/content-security-policy/raw-file/tip/csp-specification.dev.html) restrictions, may be created using the `csp` modifier argument.
|
||||||
|
The `csp` modifier is an alais of the `mobile` modifier. Chrome extensions will require [sandboxing](http://developer.chrome.com/trunk/extensions/sandboxingEval.html) or the use of either the `csp`, `mobile`, or `underscore` build.
|
||||||
```bash
|
```bash
|
||||||
lodash csp
|
lodash csp
|
||||||
```
|
```
|
||||||
@@ -164,7 +175,7 @@ In browsers:
|
|||||||
<script src="lodash.js"></script>
|
<script src="lodash.js"></script>
|
||||||
```
|
```
|
||||||
|
|
||||||
Using [npm](http://npmjs.org/):
|
Using [`npm`](http://npmjs.org/):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm install lodash
|
npm install lodash
|
||||||
@@ -173,13 +184,22 @@ npm install -g lodash
|
|||||||
npm link lodash
|
npm link lodash
|
||||||
```
|
```
|
||||||
|
|
||||||
|
To avoid potential issues, update `npm` before installing Lo-Dash:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm install npm -g
|
||||||
|
```
|
||||||
|
|
||||||
In [Node.js](http://nodejs.org/) and [RingoJS v0.8.0+](http://ringojs.org/):
|
In [Node.js](http://nodejs.org/) and [RingoJS v0.8.0+](http://ringojs.org/):
|
||||||
|
|
||||||
```js
|
```js
|
||||||
var _ = require('lodash');
|
var _ = require('lodash');
|
||||||
|
|
||||||
|
// or as a drop-in replacement for Underscore
|
||||||
|
var _ = require('lodash/lodash.underscore');
|
||||||
```
|
```
|
||||||
|
|
||||||
**Note:** If Lo-Dash is installed globally, [run `npm link lodash`](http://blog.nodejs.org/2011/03/23/npm-1-0-global-vs-local-installation/) in your project’s root directory before requiring it.
|
**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/):
|
||||||
|
|
||||||
@@ -208,25 +228,39 @@ require({
|
|||||||
|
|
||||||
## Resolved Underscore.js issues
|
## Resolved Underscore.js issues
|
||||||
|
|
||||||
* Allow iteration of objects with a `length` property [[#799](https://github.com/documentcloud/underscore/pull/799), [test](https://github.com/bestiejs/lodash/blob/v0.9.2/test/test.js#L545-551)]
|
* Allow iteration of objects with a `length` property [[#799](https://github.com/documentcloud/underscore/pull/799), [test](https://github.com/bestiejs/lodash/blob/v1.0.0-rc.2/test/test.js#L605-L611)]
|
||||||
* Fix cross-browser object iteration bugs [[#60](https://github.com/documentcloud/underscore/issues/60), [#376](https://github.com/documentcloud/underscore/issues/376), [test](https://github.com/bestiejs/lodash/blob/v0.9.2/test/test.js#L558-582)]
|
* Fix cross-browser object iteration bugs [[#60](https://github.com/documentcloud/underscore/issues/60), [#376](https://github.com/documentcloud/underscore/issues/376), [test](https://github.com/bestiejs/lodash/blob/v1.0.0-rc.2/test/test.js#L618-L642)]
|
||||||
* Methods should work on pages with incorrectly shimmed native methods [[#7](https://github.com/documentcloud/underscore/issues/7), [#742](https://github.com/documentcloud/underscore/issues/742), [test](https://github.com/bestiejs/lodash/blob/v0.9.2/test/test.js#L140-146)]
|
* Methods should work on pages with incorrectly shimmed native methods [[#7](https://github.com/documentcloud/underscore/issues/7), [#742](https://github.com/documentcloud/underscore/issues/742), [test](https://github.com/bestiejs/lodash/blob/v1.0.0-rc.2/test/test.js#L140-L146)]
|
||||||
* `_.isEmpty` should support jQuery/MooTools DOM query collections [[#690](https://github.com/documentcloud/underscore/pull/690), [test](https://github.com/bestiejs/lodash/blob/v0.9.2/test/test.js#L747-752)]
|
* `_.isEmpty` should support jQuery/MooTools DOM query collections [[#690](https://github.com/documentcloud/underscore/pull/690), [test](https://github.com/bestiejs/lodash/blob/v1.0.0-rc.2/test/test.js#L807-L812)]
|
||||||
* `_.isObject` should avoid V8 bug [#2291](http://code.google.com/p/v8/issues/detail?id=2291) [[#605](https://github.com/documentcloud/underscore/issues/605), [test](https://github.com/bestiejs/lodash/blob/v0.9.2/test/test.js#L828-840)]
|
* `_.isObject` should avoid V8 bug [#2291](http://code.google.com/p/v8/issues/detail?id=2291) [[#605](https://github.com/documentcloud/underscore/issues/605), [test](https://github.com/bestiejs/lodash/blob/v1.0.0-rc.2/test/test.js#L888-L900)]
|
||||||
* `_.keys` should work with `arguments` objects cross-browser [[#396](https://github.com/documentcloud/underscore/issues/396), [test](https://github.com/bestiejs/lodash/blob/v0.9.2/test/test.js#L921-923)]
|
* `_.keys` should work with `arguments` objects cross-browser [[#396](https://github.com/documentcloud/underscore/issues/396), [test](https://github.com/bestiejs/lodash/blob/v1.0.0-rc.2/test/test.js#L981-L983)]
|
||||||
* `_.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.2/test/test.js#L1337-1340)]
|
* `_.range` should coerce arguments to numbers [[#634](https://github.com/documentcloud/underscore/issues/634), [#683](https://github.com/documentcloud/underscore/issues/683), [test](https://github.com/bestiejs/lodash/blob/v1.0.0-rc.2/test/test.js#L1382-L1385)]
|
||||||
|
|
||||||
## Release Notes
|
## Release Notes
|
||||||
|
|
||||||
### <sup>v0.9.2</sup>
|
### <sup>v1.0.0-rc.2</sup> ###
|
||||||
|
|
||||||
* Added `fromIndex` argument to `_.contains`
|
* Specified more method chaining behaviors
|
||||||
* Added `moduleId` build option
|
* Updated `underscore` build compatibility to v1.4.3
|
||||||
* Added Closure Compiler *“simple”* optimizations to the build process
|
|
||||||
* Added support for strings in `_.max` and `_.min`
|
### <sup>v1.0.0-rc.1</sup> ###
|
||||||
* Added support for ES6 template delimiters to `_.template`
|
|
||||||
* Ensured re-minification of Lo-Dash by third parties avoids Closure Compiler bugs
|
#### Compatibility Warnings ####
|
||||||
* Optimized `_.every`, `_.find`, `_.some`, and `_.uniq`
|
|
||||||
|
* Made `_(…)` chain automatically without needing to call `_#chain`
|
||||||
|
* Made `_.isEqual` equate `arguments` objects to similar `Object` objects
|
||||||
|
* Made `_.clone` copy the enumerable properties of `arguments` objects and objects<br>
|
||||||
|
created by constructors other than `Object` are cloned to plain `Object` objects
|
||||||
|
|
||||||
|
#### Changes ####
|
||||||
|
|
||||||
|
* Ensure Lo-Dash runs in the JS engine embedded in Adobe products
|
||||||
|
* Ensured `_.reduce` and `_.reduceRight` pass the correct number of `callback` arguments
|
||||||
|
* Ensured `_.throttle` nulls the `timeoutId`
|
||||||
|
* Made deep `_.clone` more closely follow the structured clone algorithm and copy array properties assigned by `RegExp#exec`
|
||||||
|
* Optimized compiled templates in Firefox
|
||||||
|
* Optimized `_.forEach`, `_.forOwn`, `_.isNumber`, and `_.isString`
|
||||||
|
* Simplified `iteratorTemplate`
|
||||||
|
|
||||||
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).
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
'lodash':
|
'lodash':
|
||||||
'/*!\n' +
|
'/*!\n' +
|
||||||
' Lo-Dash @VERSION lodash.com/license\n' +
|
' Lo-Dash @VERSION lodash.com/license\n' +
|
||||||
' Underscore.js 1.4.2 underscorejs.org/LICENSE\n' +
|
' Underscore.js 1.4.3 underscorejs.org/LICENSE\n' +
|
||||||
'*/',
|
'*/',
|
||||||
'underscore':
|
'underscore':
|
||||||
'/*! Underscore.js @VERSION underscorejs.org/LICENSE */'
|
'/*! Underscore.js @VERSION underscorejs.org/LICENSE */'
|
||||||
@@ -49,7 +49,7 @@
|
|||||||
if (!snippet) {
|
if (!snippet) {
|
||||||
return source;
|
return source;
|
||||||
}
|
}
|
||||||
// add license
|
// add copyright/license header
|
||||||
return licenseTemplate[/call\(this\);?$/.test(source) ? 'underscore' : 'lodash']
|
return licenseTemplate[/call\(this\);?$/.test(source) ? 'underscore' : 'lodash']
|
||||||
.replace('@VERSION', snippet[2]) + '\n;' + source;
|
.replace('@VERSION', snippet[2]) + '\n;' + source;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
;(function () {
|
;(function() {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
/** Load Node modules */
|
/** Load Node modules */
|
||||||
@@ -17,10 +17,27 @@
|
|||||||
var vendorPath = path.join(basePath, 'vendor');
|
var vendorPath = path.join(basePath, 'vendor');
|
||||||
|
|
||||||
/** The Git object ID of `closure-compiler.tar.gz` */
|
/** The Git object ID of `closure-compiler.tar.gz` */
|
||||||
var closureId = 'aa29a2ecf6f51d4da5a2a418c0d4ea0e368ee80d';
|
var closureId = 'a2787b470c577cee2404d186c562dd9835f779f5';
|
||||||
|
|
||||||
/** The Git object ID of `uglifyjs.tar.gz` */
|
/** The Git object ID of `uglifyjs.tar.gz` */
|
||||||
var uglifyId = '9869c4443fb22598235d1019fcc8245be41e8889';
|
var uglifyId = '3390b259e04829538e4d3635d12b317dd6103eca';
|
||||||
|
|
||||||
|
/** The media type for raw blob data */
|
||||||
|
var mediaType = 'application/vnd.github.v3.raw';
|
||||||
|
|
||||||
|
/** Used to reference parts of the blob href */
|
||||||
|
var location = (function() {
|
||||||
|
var host = 'api.github.com',
|
||||||
|
origin = 'https://api.github.com',
|
||||||
|
pathname = '/repos/bestiejs/lodash/git/blobs';
|
||||||
|
|
||||||
|
return {
|
||||||
|
'host': host,
|
||||||
|
'href': host + origin + pathname,
|
||||||
|
'origin': origin,
|
||||||
|
'pathname': pathname
|
||||||
|
};
|
||||||
|
}());
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
@@ -31,7 +48,6 @@
|
|||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {Object} options The options object.
|
* @param {Object} options The options object.
|
||||||
*
|
|
||||||
* id - The Git object ID of the `.tar.gz` file.
|
* id - The Git object ID of the `.tar.gz` file.
|
||||||
* onComplete - The function, invoked with one argument (exception),
|
* onComplete - The function, invoked with one argument (exception),
|
||||||
* called once the extraction has finished.
|
* called once the extraction has finished.
|
||||||
@@ -41,12 +57,18 @@
|
|||||||
function getDependency(options) {
|
function getDependency(options) {
|
||||||
options || (options = {});
|
options || (options = {});
|
||||||
|
|
||||||
var onComplete = options.onComplete,
|
var id = options.id,
|
||||||
|
onComplete = options.onComplete,
|
||||||
|
path = options.path,
|
||||||
title = options.title;
|
title = options.title;
|
||||||
|
|
||||||
function callback(exception) {
|
function callback(exception) {
|
||||||
if (exception) {
|
if (exception) {
|
||||||
console.error('There was a problem downloading ' + title + '.');
|
console.error([
|
||||||
|
'There was a problem installing ' + title + '. To manually install, run:',
|
||||||
|
'',
|
||||||
|
"curl -H 'Accept: " + mediaType + "' " + location.href + '/' + id + " | tar xvz -C '" + path + "'"
|
||||||
|
].join('\n'));
|
||||||
}
|
}
|
||||||
onComplete(exception);
|
onComplete(exception);
|
||||||
}
|
}
|
||||||
@@ -54,22 +76,22 @@
|
|||||||
console.log('Downloading ' + title + '...');
|
console.log('Downloading ' + title + '...');
|
||||||
|
|
||||||
https.get({
|
https.get({
|
||||||
'host': 'api.github.com',
|
'host': location.host,
|
||||||
'path': '/repos/bestiejs/lodash/git/blobs/' + options.id,
|
'path': location.pathname + '/' + id,
|
||||||
'headers': {
|
'headers': {
|
||||||
// By default, all GitHub blob API endpoints return a JSON document
|
// By default, all GitHub blob API endpoints return a JSON document
|
||||||
// containing Base64-encoded blob data. Overriding the `Accept` header
|
// containing Base64-encoded blob data. Overriding the `Accept` header
|
||||||
// with the GitHub raw media type returns the blob data directly.
|
// with the GitHub raw media type returns the blob data directly.
|
||||||
'Accept': 'application/vnd.github.v3.raw'
|
// See http://developer.github.com/v3/media/.
|
||||||
|
'Accept': mediaType
|
||||||
}
|
}
|
||||||
}, function(response) {
|
}, function(response) {
|
||||||
var parser = new tar.Extract({
|
var decompressor = zlib.createUnzip(),
|
||||||
'path': options.path
|
parser = new tar.Extract({ 'path': path });
|
||||||
})
|
|
||||||
.on('end', callback)
|
|
||||||
.on('error', callback);
|
|
||||||
|
|
||||||
response.pipe(zlib.createUnzip()).pipe(parser);
|
decompressor.on('error', callback)
|
||||||
|
parser.on('end', callback).on('error', callback);
|
||||||
|
response.pipe(decompressor).pipe(parser);
|
||||||
})
|
})
|
||||||
.on('error', callback);
|
.on('error', callback);
|
||||||
}
|
}
|
||||||
@@ -77,12 +99,28 @@
|
|||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
exec('npm -g root', function(exception, stdout) {
|
exec('npm -g root', function(exception, stdout) {
|
||||||
if (exception) {
|
if (!exception) {
|
||||||
console.error('There was a problem loading the npm registry.');
|
try {
|
||||||
process.exit(1);
|
var isGlobal = path.resolve(basePath, '..') == fs.realpathSync(stdout.trim());
|
||||||
|
} catch(e) {
|
||||||
|
exception = e;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// exit early if not a global install
|
if (exception) {
|
||||||
if (path.resolve(basePath, '..') != stdout.trim()) {
|
console.error([
|
||||||
|
'Oops! There was a problem detecting the install mode. If you’re installing the',
|
||||||
|
'Lo-Dash command-line executable (via `npm install -g lodash`), you’ll need to',
|
||||||
|
'manually install UglifyJS and the Closure Compiler by running:',
|
||||||
|
'',
|
||||||
|
"curl -H 'Accept: " + mediaType + "' " + location.href + '/' + closureId + " | tar xvz -C '" + vendorPath + "'",
|
||||||
|
"curl -H 'Accept: " + mediaType + "' " + location.href + '/' + uglifyId + " | tar xvz -C '" + vendorPath + "'",
|
||||||
|
'',
|
||||||
|
'Please submit an issue on the GitHub issue tracker: ' + process.env.npm_package_bugs_url
|
||||||
|
].join('\n'));
|
||||||
|
|
||||||
|
console.error(exception);
|
||||||
|
}
|
||||||
|
if (!isGlobal) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// download the Closure Compiler
|
// download the Closure Compiler
|
||||||
@@ -90,14 +128,14 @@
|
|||||||
'title': 'the Closure Compiler',
|
'title': 'the Closure Compiler',
|
||||||
'id': closureId,
|
'id': closureId,
|
||||||
'path': vendorPath,
|
'path': vendorPath,
|
||||||
'onComplete':function(exceptionA) {
|
'onComplete': function() {
|
||||||
// download UglifyJS
|
// download UglifyJS
|
||||||
getDependency({
|
getDependency({
|
||||||
'title': 'UglifyJS',
|
'title': 'UglifyJS',
|
||||||
'id': uglifyId,
|
'id': uglifyId,
|
||||||
'path': vendorPath,
|
'path': vendorPath,
|
||||||
'onComplete': function(exceptionB) {
|
'onComplete': function() {
|
||||||
process.exit(exceptionA || exceptionB ? 1 : 0);
|
process.exit();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
'collection',
|
'collection',
|
||||||
'createCallback',
|
'createCallback',
|
||||||
'ctor',
|
'ctor',
|
||||||
|
'guard',
|
||||||
'hasOwnProperty',
|
'hasOwnProperty',
|
||||||
'index',
|
'index',
|
||||||
'isArguments',
|
'isArguments',
|
||||||
@@ -27,8 +28,8 @@
|
|||||||
'propertyIsEnumerable',
|
'propertyIsEnumerable',
|
||||||
'result',
|
'result',
|
||||||
'skipProto',
|
'skipProto',
|
||||||
'thisArg',
|
'source',
|
||||||
'value'
|
'thisArg'
|
||||||
];
|
];
|
||||||
|
|
||||||
/** Used to minify `compileIterator` option properties */
|
/** Used to minify `compileIterator` option properties */
|
||||||
@@ -57,15 +58,16 @@
|
|||||||
/** Used to protect the specified properties from getting minified */
|
/** Used to protect the specified properties from getting minified */
|
||||||
var propWhitelist = [
|
var propWhitelist = [
|
||||||
'_',
|
'_',
|
||||||
'__chain__',
|
|
||||||
'__wrapped__',
|
'__wrapped__',
|
||||||
'after',
|
'after',
|
||||||
'all',
|
'all',
|
||||||
'amd',
|
'amd',
|
||||||
'any',
|
'any',
|
||||||
|
'assign',
|
||||||
'attachEvent',
|
'attachEvent',
|
||||||
'bind',
|
'bind',
|
||||||
'bindAll',
|
'bindAll',
|
||||||
|
'bindKey',
|
||||||
'chain',
|
'chain',
|
||||||
'clone',
|
'clone',
|
||||||
'collect',
|
'collect',
|
||||||
@@ -134,7 +136,6 @@
|
|||||||
'keys',
|
'keys',
|
||||||
'last',
|
'last',
|
||||||
'lastIndexOf',
|
'lastIndexOf',
|
||||||
'lateBind',
|
|
||||||
'map',
|
'map',
|
||||||
'max',
|
'max',
|
||||||
'memoize',
|
'memoize',
|
||||||
@@ -187,6 +188,9 @@
|
|||||||
'wrap',
|
'wrap',
|
||||||
'zip',
|
'zip',
|
||||||
|
|
||||||
|
// property used by the `lodash underscore` build
|
||||||
|
'__chain__',
|
||||||
|
|
||||||
// properties used by underscore.js
|
// properties used by underscore.js
|
||||||
'_chain',
|
'_chain',
|
||||||
'_wrapped'
|
'_wrapped'
|
||||||
@@ -211,13 +215,14 @@
|
|||||||
if (options.isTemplate) {
|
if (options.isTemplate) {
|
||||||
return source;
|
return source;
|
||||||
}
|
}
|
||||||
|
// remove copyright/license header 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 the Closure Compiler won't mung them
|
// 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'), function(match, prop) {
|
||||||
|
return "['" + prop.replace(/['\n\r\t]/g, '\\$&') + "']";
|
||||||
|
});
|
||||||
|
|
||||||
// remove brackets from `_.escape()` in `_.template`
|
// remove brackets from `_.escape()` in `_.template`
|
||||||
source = source.replace(/__e *= *_\['escape']/g, '__e=_.escape');
|
source = source.replace(/__e *= *_\['escape']/g, '__e=_.escape');
|
||||||
@@ -232,16 +237,25 @@
|
|||||||
source = source.replace("result[length]['value']", 'result[length].value');
|
source = source.replace("result[length]['value']", 'result[length].value');
|
||||||
|
|
||||||
// remove whitespace from string literals
|
// remove whitespace from string literals
|
||||||
source = source.replace(/'(?:(?=(\\?))\1.)*?'/g, function(string) {
|
source = source.replace(/^([ "'\w]+:)? *"(?:(?=(\\?))\2.)*?"|'(?:(?=(\\?))\3.)*?'/gm, function(string, captured) {
|
||||||
|
// remove object literal property name
|
||||||
|
if (/:$/.test(captured)) {
|
||||||
|
string = string.slice(captured.length);
|
||||||
|
}
|
||||||
// avoids removing the '\n' of the `stringEscapes` object
|
// avoids removing the '\n' of the `stringEscapes` object
|
||||||
return string.replace(/\[object |delete |else |function | in |return\s+[\w']|throw |typeof |use strict|var |@ |'\\n'|\\\\n|\\n|\s+/g, function(match) {
|
string = string.replace(/\[object |delete |else |function | in |return\s+[\w"']|throw |typeof |use strict|var |@ |(["'])\\n\1|\\\\n|\\n|\s+/g, function(match) {
|
||||||
return match == false || match == '\\n' ? '' : match;
|
return match == false || match == '\\n' ? '' : match;
|
||||||
});
|
});
|
||||||
|
// prepend object literal property name
|
||||||
|
return (captured || '') + string;
|
||||||
});
|
});
|
||||||
|
|
||||||
// add newline to `+"__p+='"` in underscore.js `_.template`
|
// add newline to `+"__p+='"` in underscore.js `_.template`
|
||||||
source = source.replace(/\+"__p\+='"/g, '+"\\n__p+=\'"');
|
source = source.replace(/\+"__p\+='"/g, '+"\\n__p+=\'"');
|
||||||
|
|
||||||
|
// add newline to `body + '}'` in `createFunction`
|
||||||
|
source = source.replace(/body *\+ *'}'/, 'body+"\\n}"');
|
||||||
|
|
||||||
// remove whitespace from `_.template` related regexes
|
// remove whitespace from `_.template` related regexes
|
||||||
source = source.replace(/(?:reEmptyString\w+|reInsertVariable) *=.+/g, function(match) {
|
source = source.replace(/(?:reEmptyString\w+|reInsertVariable) *=.+/g, function(match) {
|
||||||
return match.replace(/ |\\n/g, '');
|
return match.replace(/ |\\n/g, '');
|
||||||
@@ -249,11 +263,8 @@
|
|||||||
|
|
||||||
// remove newline from double-quoted strings in `_.template`
|
// remove newline from double-quoted strings in `_.template`
|
||||||
source = source
|
source = source
|
||||||
.replace('"\';\\n__with ("', '"\';__with("')
|
.replace('"__p += \'"', '"__p+=\'"')
|
||||||
.replace('"\\n}__\\n__p += \'"', '"}____p+=\'"')
|
.replace('"\';\n"', '"\';"')
|
||||||
.replace('"__p = \'"', '"__p=\'"')
|
|
||||||
.replace('"\';\\n"', '"\';"')
|
|
||||||
.replace("') {\\n'", "'){'")
|
|
||||||
|
|
||||||
// remove `useSourceURL` variable
|
// remove `useSourceURL` variable
|
||||||
source = source.replace(/(?:\n +\/\*[^*]*\*+(?:[^\/][^*]*\*+)*\/)?\n *try *\{(?:\s*\/\/.*)*\n *var useSourceURL[\s\S]+?catch[^}]+}\n/, '');
|
source = source.replace(/(?:\n +\/\*[^*]*\*+(?:[^\/][^*]*\*+)*\/)?\n *try *\{(?:\s*\/\/.*)*\n *var useSourceURL[\s\S]+?catch[^}]+}\n/, '');
|
||||||
@@ -313,8 +324,10 @@
|
|||||||
isIteratorTemplate = /var iteratorTemplate\b/.test(snippet),
|
isIteratorTemplate = /var iteratorTemplate\b/.test(snippet),
|
||||||
modified = snippet;
|
modified = snippet;
|
||||||
|
|
||||||
// add brackets to whitelisted properties so the Closure Compiler won't mung them
|
// add brackets to iterator option 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'), function(match, prop) {
|
||||||
|
return "['" + prop.replace(/['\n\r\t]/g, '\\$&') + "']";
|
||||||
|
});
|
||||||
|
|
||||||
if (isCreateIterator) {
|
if (isCreateIterator) {
|
||||||
// replace with modified snippet early and clip snippet to the `factory`
|
// replace with modified snippet early and clip snippet to the `factory`
|
||||||
@@ -328,9 +341,9 @@
|
|||||||
// ensure properties in compiled strings aren't minified
|
// ensure properties in compiled strings aren't minified
|
||||||
modified = modified.replace(RegExp('([^.]\\b)' + variable + '\\b(?!\' *[\\]:])', 'g'), '$1' + minNames[index]);
|
modified = modified.replace(RegExp('([^.]\\b)' + variable + '\\b(?!\' *[\\]:])', 'g'), '$1' + minNames[index]);
|
||||||
|
|
||||||
// correct `typeof x == 'object'`
|
// correct `typeof` values
|
||||||
if (variable == 'object') {
|
if (/^(?:boolean|function|object|number|string|undefined)$/.test(variable)) {
|
||||||
modified = modified.replace(RegExp("(typeof [^']+')" + minNames[index] + "'", 'g'), "$1object'");
|
modified = modified.replace(RegExp("(typeof [^']+')" + minNames[index] + "'", 'g'), '$1' + variable + "'");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
475
doc/README.md
475
doc/README.md
File diff suppressed because it is too large
Load Diff
@@ -21,7 +21,7 @@
|
|||||||
// generate Markdown
|
// generate Markdown
|
||||||
$markdown = docdown(array(
|
$markdown = docdown(array(
|
||||||
'path' => '../' . $file,
|
'path' => '../' . $file,
|
||||||
'title' => 'Lo-Dash <sup>v0.9.2</sup>',
|
'title' => 'Lo-Dash <sup>v1.0.0-rc.2</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'
|
||||||
));
|
));
|
||||||
|
|||||||
77
lodash.min.js
vendored
77
lodash.min.js
vendored
@@ -1,40 +1,41 @@
|
|||||||
/*!
|
/*!
|
||||||
Lo-Dash 0.9.2 lodash.com/license
|
Lo-Dash 1.0.0-rc.2 lodash.com/license
|
||||||
Underscore.js 1.4.2 underscorejs.org/LICENSE
|
Underscore.js 1.4.3 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||Y);if(i)for(var s={},n=t-1;++n<r;){var o=e[n]+"";(yt.call(s,o)?s[o]:s[o]=[]).push(e[n])}return function(n){if(i){var r=n+"";return yt.call(s,r)&&-1<q(s[r],n)}return-1<q(e,n,t)}}function u(e){return e.charCodeAt(0)}function a(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 f
|
;(function(e,t){function s(e){if(e&&"object"==typeof e&&e.__wrapped__)return e;if(!(this instanceof s))return new s(e);this.__wrapped__=e}function o(t,n){return e.eval("(function("+t+"){"+n+"})")}function u(e,t,n){t||(t=0);var r=e.length,i=r-t>=(n||it);if(i)for(var s={},n=t-1;++n<r;){var o=e[n]+"";(Tt.call(s,o)?s[o]:s[o]=[]).push(e[n])}return function(n){if(i){var r=n+"";return Tt.call(s,r)&&-1<W(s[r],n)}return-1<W(e,n,t)}}function a(e){return e.charCodeAt(0)}function f(e,t){var n=e.b,r=t.b,e=e.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(Et.call(u)):n),this instanceof r?(d.prototype=e.prototype,a=new d,u=e.apply(a,u),T(u)?u:a):e.apply(a,u)}var i=x(e),s=!n,o=e;return s&&(n=t),r}function l(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:X}function c(){for(var e={b:"",c:"",e:It,f:Kt,g:"",h:Ut,i:Xt,j:pt,k:"",l:n},t,r=0;t=arguments[r];r++)for(var i in t)e[i]=t[i];t=e.a,e.d=/^[^,]+/
|
t=t.a;if(e!==t){if(e>t||"undefined"==typeof e)return 1;if(e<t||"undefined"==typeof t)return-1}return n<r?-1:1}function l(e,t,n){function i(){var a=arguments,f=o?this:t;return s||(e=t[u]),n.length&&(a=a.length?n.concat(g(a)):n),this instanceof i?(m.prototype=e.prototype,f=new m,m.prototype=r,a=e.apply(f,a),k(a)?a:f):e.apply(f,a)}var s=C(e),o=!n,u=t;return o&&(n=t),s||(t=e),i}function c(e,t){return e?"function"!=typeof e?function(t){return t[e]}:"undefined"!=typeof t?function(n,r,i){return e.call(t
|
||||||
.exec(t)[0],r="var h,v,k="+e.d+",s="+e.d+";if(!"+e.d+")return s;"+e.k+";",e.b?(r+="var l=k.length;h=-1;if(typeof l=='number'){",e.i&&(r+="if(j(k)){k=k.split('')}"),r+="while(++h<l){v=k[h];"+e.b+"}}else {"):e.h&&(r+="var l=k.length;h=-1;if(l&&i(k)){while(++h<l){v=k[h+=''];"+e.g+"}}else {"),e.e||(r+="var t=typeof k=='function'&&r.call(k,'prototype');");if(e.f&&e.l)r+="var p=-1,q=o[typeof k]?m(k):[],l=q.length;while(++p<l){h=q[p];",e.e||(r+="if(!(t&&h=='prototype')){"),r+="v=k[h];"+e.g+"",e.e||(r+="}"
|
,n,r,i)}:e:K}function h(){for(var e={b:"",c:"",e:Kt,f:Jt,g:"",h:Yt,i:en,j:bt,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 i,l="+e.d+",t="+e.d+";if(!"+e.d+")return t;"+e.k+";",e.b?(r+="var m=l.length;i=-1;if(typeof m=='number'){",e.i&&(r+="if(k(l)){l=l.split('')}"),r+="while(++i<m){"+e.b+"}}else {"):e.h&&(r+="var m=l.length;i=-1;if(m&&j(l)){while(++i<m){i+='';"+e.g+"}}else {"),e.e||(r+="var u=typeof l=='function'&&s.call(l,'prototype');");if(e.f&&
|
||||||
);else{r+="for(h in k){";if(!e.e||e.l)r+="if(",e.e||(r+="!(t&&h=='prototype')"),!e.e&&e.l&&(r+="&&"),e.l&&(r+="g.call(k,h)"),r+="){";r+="v=k[h];"+e.g+";";if(!e.e||e.l)r+="}"}r+="}";if(e.e){r+="var f=k.constructor;";for(i=0;7>i;i++)r+="h='"+e.j[i]+"';if(","constructor"==e.j[i]&&(r+="!(f&&f.prototype===k)&&"),r+="g.call(k,h)){v=k[h];"+e.g+"}"}if(e.b||e.h)r+="}";return r+=e.c+";return s",Function("e,g,i,j,o,m,r","return function("+t+"){"+r+"}")(l,yt,m,N,Gt,kt,wt)}function h(e){return"\\"+Yt[e]}function p
|
e.l)r+="var q=-1,r=p[typeof l]?n(l):[],m=r.length;while(++q<m){i=r[q];",e.e||(r+="if(!(u&&i=='prototype')){"),r+=e.g+"",e.e||(r+="}");else{r+="for(i in l){";if(!e.e||e.l)r+="if(",e.e||(r+="!(u&&i=='prototype')"),!e.e&&e.l&&(r+="&&"),e.l&&(r+="h.call(l,i)"),r+="){";r+=e.g+";";if(!e.e||e.l)r+="}"}r+="}";if(e.e){r+="var f=l.constructor;";for(i=0;7>i;i++)r+="i='"+e.j[i]+"';if(","constructor"==e.j[i]&&(r+="!(f&&f.prototype===l)&&"),r+="h.call(l,i)){"+e.g+"}"}if(e.b||e.h)r+="}";return r+=e.c+";return t"
|
||||||
(e){return sn[e]}function d(){}function v(e){return on[e]}function m(e){return St.call(e)==Mt}function g(e){var t=i;if(!e||"object"!=typeof e||m(e))return t;var n=e.constructor;return(!Vt||"function"==typeof e.toString||"string"!=typeof (e+""))&&(!x(n)||n instanceof n)?qt?(nn(e,function(e,n,r){return t=!yt.call(r,n),i}),t===i):(nn(e,function(e,n){t=n}),t===i||yt.call(e,t)):t}function y(e){var t=[];return rn(e,function(e,n){t.push(n)}),t}function b(e,t,n,s,o){if(e==r)return e;n&&(t=i);if(n=T(e)){var u=
|
,o("e,h,j,k,p,n,s","return function("+t+"){"+r+"}")(c,Tt,b,A,on,_t,Ct)}function p(e){return"\\"+un[e]}function d(e){return dn[e]}function v(e){return"function"!=typeof e.toString&&"string"==typeof (e+"")}function m(){}function g(e,t,n){t||(t=0),"undefined"==typeof n&&(n=e?e.length:0);for(var r=-1,n=n-t||0,i=Array(0>n?0:n);++r<n;)i[r]=e[t+r];return i}function y(e){return vn[e]}function b(e){return kt.call(e)==Bt}function w(e){var t=i;if(!e||"object"!=typeof e||b(e))return t;var n=e.constructor;return!
|
||||||
St.call(e);if(!Qt[u]||zt&&m(e))return e;var a=u==_t,n=a||(u==Bt?ln(e):n)}if(!n||!t)return n?a?Et.call(e):an({},e):e;n=e.constructor;switch(u){case Dt:case Pt:return new n(+e);case Ht:case Ft:return new n(e);case jt:return n(e.source,st.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?hn:rn)(e,function(e,n){f[n]=b(e,t,r,s,o)}),f}function w(e){var t=[];return nn(e,function(e,n){x(e)&&t.push(n)}),t.sort()}function E(e){var t=
|
C(n)&&(!tn||!v(e))||n instanceof n?Qt?(hn(e,function(e,n,r){return t=!Tt.call(r,n),i}),t===i):(hn(e,function(e,n){t=n}),t===i||Tt.call(e,t)):t}function E(e){var t=[];return pn(e,function(e,n){t.push(n)}),t}function S(e,t,n,s,o){if(e==r)return e;n&&(t=i);if(n=k(e)){var u=kt.call(e);if(!rn[u]||tn&&v(e))return e;var a=gn(e)}if(!n||!t)return n?a?g(e):cn({},e):e;n=sn[u];switch(u){case Ft:case It:return new n(+e);case qt:case zt:return new n(e);case Ut:return n(e.source,ct.exec(e))}s||(s=[]),o||(o=[]);
|
||||||
{};return rn(e,function(e,n){t[e]=n}),t}function S(e,t,s,o){if(e===t)return 0!==e||1/e==1/t;if(e==r||t==r)return e===t;var u=St.call(e);if(u!=St.call(t))return i;switch(u){case Dt:case Pt:return+e==+t;case Ht:return e!=+e?t!=+t:0==e?1/e==1/t:e==+t;case jt:case Ft:return e==t+""}var a=u==_t||u==Mt;if(zt&&!a&&(a=m(e))&&!m(t))return i;if(!a){if(e.__wrapped__||t.__wrapped__)return S(e.__wrapped__||e,t.__wrapped__||t);if(u!=Bt||Vt&&("function"!=typeof e.toString&&"string"==typeof (e+"")||"function"!=typeof
|
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?wn:pn)(e,function(e,n){f[n]=S(e,t,r,s,o)}),a&&(Tt.call(e,"index")&&(f.index=e.index),Tt.call(e,"input")&&(f.input=e.input)),f}function x(e){var t=[];return hn(e,function(e,n){C(e)&&t.push(n)}),t.sort()}function T(e){var t={};return pn(e,function(e,n){t[e]=n}),t}function N(e,t,s,o){if(e===t)return 0!==e||1/e==1/t;if(e==r||t==r)return e===t;var u=kt.call(e),a=kt.call(t);u==Bt&&(u=Rt),a==Bt&&(a=Rt);if(u!=
|
||||||
t.toString&&"string"==typeof (t+"")))return i;var u=e.constructor,f=t.constructor;if(u!=f&&(!x(u)||!(u instanceof u&&x(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=S(e[l],t[l],s,o)););return f}for(var c in e)if(yt.call(e,c)&&(l++,!yt.call(t,c)||!S(e[c],t[c],s,o)))return i;for(c in t)if(yt.call(t,c)&&!(l--))return i;if(It)for(;7>++u;)if(c=pt[u],yt.call(e,c)&&(!yt.call
|
a)return i;switch(u){case Ft:case It:return+e==+t;case qt:return e!=+e?t!=+t:0==e?1/e==1/t:e==+t;case Ut:case zt:return e==t+""}a=u==jt;if(!a){if(e.__wrapped__||t.__wrapped__)return N(e.__wrapped__||e,t.__wrapped__||t);if(u!=Rt||tn&&(v(e)||v(t)))return i;var u=Zt&&b(e)?Object:e.constructor,f=Zt&&b(t)?Object:t.constructor;if(u!=f&&(!C(u)||!(u instanceof u&&C(f)&&f instanceof f)))return i}s||(s=[]),o||(o=[]);for(u=s.length;u--;)if(s[u]==e)return o[u]==t;var l=n,c=0;s.push(e),o.push(t);if(a){c=e.length
|
||||||
(t,c)||!S(e[c],t[c],s,o)))return i;return n}function x(e){return"function"==typeof e}function T(e){return e?Gt[typeof e]:i}function N(e){return St.call(e)==Ft}function C(e,t,n){var i=arguments,s=0,o=2,u=i[3],a=i[4];n!==Q&&(u=[],a=[],o=i.length);for(;++s<o;)rn(i[s],function(t,n){var i,s,o;if(t&&((s=fn(t))||ln(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)?fn(o)?o:[]:ln(o)?o:{}),e[n]=C(o,t,Q,u,a))}else t!=r&&(e[n]=t)});return e}function k(e){var t=[];return rn
|
;if(l=c==t.length)for(;c--&&(l=N(e[c],t[c],s,o)););return l}return hn(e,function(e,n,r){if(Tt.call(r,n))return c++,l=Tt.call(t,n)&&N(e,t[n],s,o)}),l&&hn(t,function(e,t,n){if(Tt.call(n,t))return l=-1<--c}),l}function C(e){return"function"==typeof e}function k(e){return e?on[typeof e]:i}function L(e){return"number"==typeof e||kt.call(e)==qt}function A(e){return"string"==typeof e||kt.call(e)==zt}function O(e,t,n){var i=arguments,s=0,o=2,u=i[3],a=i[4];n!==rt&&(u=[],a=[],"number"!=typeof n&&(o=i.length
|
||||||
(e,function(e){t.push(e)}),t}function L(e,t,n){var r=-1,i=e?e.length:0,n=(0>n?Lt(0,i+n):n)||0;return"number"==typeof i?-1<(N(e)?e.indexOf(t,n):q(e,t,n)):j(e,function(e){return++r>=n&&e===t})}function A(e,t,r){var i=n,t=l(t,r);if(fn(e))for(var r=-1,s=e.length;++r<s&&(i=!!t(e[r],r,e)););else hn(e,function(e,n,r){return i=!!t(e,n,r)});return i}function O(e,t,n){var r=[],t=l(t,n);return hn(e,function(e,n,i){t(e,n,i)&&r.push(e)}),r}function M(e,t,n){var r,t=l(t,n);return hn(e,function(e,n,s){if(t(e,n,
|
));for(;++s<o;)pn(i[s],function(t,n){var i,s,o;if(t&&((s=gn(t))||yn(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)?gn(o)?o:[]:yn(o)?o:{}),e[n]=O(o,t,rt,u,a))}else t!=r&&(e[n]=t)});return e}function M(e){var t=[];return pn(e,function(e){t.push(e)}),t}function _(e,t,n){var r=-1,s=e?e.length:0,o=i,n=(0>n?Dt(0,s+n):n)||0;return"number"==typeof s?o=-1<(A(e)?e.indexOf(t,n):W(e,t,n)):wn(e,function(e){if(++r>=n)return!(o=e===t)}),o}function D(e,t,r){var i=n,t=c
|
||||||
s))return r=e,i}),r}function _(e,t,n){var r=-1,i=e?e.length:0,s=Array("number"==typeof i?i:0),t=l(t,n);if(fn(e))for(;++r<i;)s[r]=t(e[r],r,e);else hn(e,function(e,n,i){s[++r]=t(e,n,i)});return s}function D(e,t,n){var r=-Infinity,i=-1,s=e?e.length:0,o=r;if(t||!fn(e))t=!t&&N(e)?u:l(t,n),hn(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 P(e,t){var n=[];return hn(e,function(e){n.push(e[t])}),n}function H(e,t,n,r){var s=3>arguments.length,t=l(t,r);return hn
|
(t,r);if(gn(e))for(var r=-1,s=e.length;++r<s&&(i=!!t(e[r],r,e)););else wn(e,function(e,n,r){return i=!!t(e,n,r)});return i}function P(e,t,n){var r=[],t=c(t,n);if(gn(e))for(var n=-1,i=e.length;++n<i;){var s=e[n];t(s,n,e)&&r.push(s)}else wn(e,function(e,n,i){t(e,n,i)&&r.push(e)});return r}function H(e,t,n){var r,t=c(t,n);return wn(e,function(e,n,s){if(t(e,n,s))return r=e,i}),r}function B(e,t,n){var r=-1,i=e?e.length:0,s=Array("number"==typeof i?i:0),t=c(t,n);if(gn(e))for(;++r<i;)s[r]=t(e[r],r,e);else wn
|
||||||
(e,function(e,r,o){n=s?(s=i,e):t(n,e,r,o)}),n}function B(e,t,n,r){var s=e,o=e?e.length:0,u=3>arguments.length;if("number"!=typeof o)var a=cn(e),o=a.length;else Xt&&N(e)&&(s=e.split(""));return hn(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 j(e,t,n){var r,t=l(t,n);if(fn(e))for(var n=-1,i=e.length;++n<i&&!(r=t(e[n],n,e)););else hn(e,function(e,n,i){return!(r=t(e,n,i))});return!!r}function F(e,t,n){if(e)return t==r||n?e[0]:Et.call(e,0,t)}function I(e,t){for(var n=-1
|
(e,function(e,n,i){s[++r]=t(e,n,i)});return s}function j(e,t,n){var r=-Infinity,i=-1,s=e?e.length:0,o=r;if(t||!gn(e))t=!t&&A(e)?a:c(t,n),wn(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 F(e,t){return B(e,t+"")}function I(e,t,n,r){var s=3>arguments.length;return t||(t=K),wn(e,function(e,o,u){n=s?(s=i,e):t.call(r,n,e,o,u)}),n}function q(e,t,n,r){var s=e,o=e?e.length:0,u=3>arguments.length;if("number"!=typeof o)var a=bn(e),o=a.length;else en&&A(e)&&
|
||||||
,r=e?e.length:0,i=[];++n<r;){var s=e[n];fn(s)?bt.apply(i,t?s:I(s)):i.push(s)}return i}function q(e,t,n){var r=-1,i=e?e.length:0;if("number"==typeof n)r=(0>n?Lt(0,i+n):n||0)-1;else if(n)return r=U(e,t),e[r]===t?r:-1;for(;++r<i;)if(e[r]===t)return r;return-1}function R(e,t,n){return e?Et.call(e,t==r||n?1:t):[]}function U(e,t,n,r){for(var i=0,s=e?e.length:i,n=n?l(n,r):X,t=n(t);i<s;)r=i+s>>>1,n(e[r])<t?i=r+1:s=r;return i}function z(e,t,n,r){var s=-1,o=e?e.length:0,u=[],a=u;"function"==typeof t&&(r=n,
|
(s=e.split(""));return t||(t=K),wn(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 R(e,t,n){var r,t=c(t,n);if(gn(e))for(var n=-1,i=e.length;++n<i&&!(r=t(e[n],n,e)););else wn(e,function(e,n,i){return!(r=t(e,n,i))});return!!r}function U(e,t,n){if(e){var i=e.length;return t==r||n?e[0]:g(e,0,Pt(Dt(0,t),i))}}function z(e,t){for(var n=-1,r=e?e.length:0,i=[];++n<r;){var s=e[n];gn(s)?Nt.apply(i,t?s:z(s)):i.push(s)}return i}function W(e,t,n){var r=-1,i=e?e.length:0;if("number"==typeof
|
||||||
n=t,t=i);var f=!t&&74<o;if(f)var c={};n&&(a=[],n=l(n,r));for(;++s<o;){var r=e[s],h=n?n(r,s,e):r;f&&(a=yt.call(c,h+"")?c[h]:c[h]=[]);if(t?!s||a[a.length-1]!==h:0>q(a,h))(n||f)&&a.push(h),u.push(r)}return u}function W(e,t){return Jt||xt&&2<arguments.length?xt.call.apply(xt,arguments):f(e,t,Et.call(arguments,2))}function X(e){return e}function V(e){hn(w(e),function(t){var r=s[t]=e[t];s.prototype[t]=function(){var e=[this.__wrapped__];return bt.apply(e,arguments),e=r.apply(s,e),this.__chain__&&(e=new
|
n)r=(0>n?Dt(0,i+n):n||0)-1;else if(n)return r=V(e,t),e[r]===t?r:-1;for(;++r<i;)if(e[r]===t)return r;return-1}function X(e,t,n){return g(e,t==r||n?1:Dt(0,t))}function V(e,t,n,r){for(var i=0,s=e?e.length:i,n=n?c(n,r):K,t=n(t);i<s;)r=i+s>>>1,n(e[r])<t?i=r+1:s=r;return i}function $(e,t,n,r){var s=-1,o=e?e.length:0,u=[],a=u;"function"==typeof t&&(r=n,n=t,t=i);var f=!t&&74<o;if(f)var l={};n&&(a=[],n=c(n,r));for(;++s<o;){var r=e[s],h=n?n(r,s,e):r;f&&(a=Tt.call(l,h+"")?l[h]:l[h]=[]);if(t?!s||a[a.length-1
|
||||||
s(e),e.__chain__=n),e}})}var n=!0,r=null,i=!1,$="object"==typeof exports&&exports,J="object"==typeof global&&global;J.global===J&&(e=J);var K=[],Q=new function(){},G=0,Y=30,Z=e._,et=/[-?+=!~*%&^<>|{(\/]|\[\D|\b(?:delete|in|instanceof|new|typeof|void)\b/,tt=/&(?:amp|lt|gt|quot|#x27);/g,nt=/\b__p\+='';/g,rt=/\b(__p\+=)''\+/g,it=/(__e\(.*?\)|\b__t\))\+'';/g,st=/\w*$/,ot=/(?:__e|__t=)\(\s*(?![\d\s"']|this\.)/g,ut=RegExp("^"+(Q.valueOf+"").replace(/[.*+?^=!:${}()|[\]\/\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g
|
]!==h:0>W(a,h))(n||f)&&a.push(h),u.push(r)}return u}function J(e,t){return $t||Lt&&2<arguments.length?Lt.call.apply(Lt,arguments):l(e,t,g(arguments,2))}function K(e){return e}function Q(e){wn(x(e),function(t){var n=s[t]=e[t];s.prototype[t]=function(){var e=[this.__wrapped__];return Nt.apply(e,arguments),e=n.apply(s,e),new s(e)}})}function G(){return this.__wrapped__}var n=!0,r=null,i=!1,Y="object"==typeof exports&&exports,Z="object"==typeof global&&global;Z.global===Z&&(e=Z);var et=[],tt=new function(
|
||||||
,".+?")+"$"),at=/\$\{((?:(?=\\?)\\?[\s\S])*?)}/g,ft=/<%=([\s\S]+?)%>/g,lt=/($^)/,ct=/[&<>"']/g,ht=/['\n\r\t\u2028\u2029\\]/g,pt="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),dt=Math.ceil,vt=K.concat,mt=Math.floor,gt=ut.test(gt=Object.getPrototypeOf)&>,yt=Q.hasOwnProperty,bt=K.push,wt=Q.propertyIsEnumerable,Et=K.slice,St=Q.toString,xt=ut.test(xt=Et.bind)&&xt,Tt=ut.test(Tt=Array.isArray)&&Tt,Nt=e.isFinite,Ct=e.isNaN,kt=ut.test(kt=Object
|
){},nt=0,rt=tt,it=30,st=e._,ot=/[-?+=!~*%&^<>|{(\/]|\[\D|\b(?:delete|in|instanceof|new|typeof|void)\b/,ut=/&(?:amp|lt|gt|quot|#x27);/g,at=/\b__p\+='';/g,ft=/\b(__p\+=)''\+/g,lt=/(__e\(.*?\)|\b__t\))\+'';/g,ct=/\w*$/,ht=/(?:__e|__t=)\(\s*(?![\d\s"']|this\.)/g,pt=RegExp("^"+(tt.valueOf+"").replace(/[.*+?^=!:${}()|[\]\/\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),dt=/\$\{((?:(?=\\?)\\?[\s\S])*?)}/g,vt=/<%=([\s\S]+?)%>/g,mt=/($^)/,gt=/[&<>"']/g,yt=/['\n\r\t\u2028\u2029\\]/g,bt="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf"
|
||||||
.keys)&&kt,Lt=Math.max,At=Math.min,Ot=Math.random,Mt="[object Arguments]",_t="[object Array]",Dt="[object Boolean]",Pt="[object Date]",Ht="[object Number]",Bt="[object Object]",jt="[object RegExp]",Ft="[object String]",It,qt,Rt=(Rt={0:1,length:1},K.splice.call(Rt,0,1),Rt[0]),Ut=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(n in arguments)Ut=!n;It=!/valueOf/.test(t),qt="x"!=t[0]})(1);var zt=!m(arguments),Wt="x"!=Et.call("x")[0],Xt="xx"!="x"
|
.split(" "),wt=Math.ceil,Et=et.concat,St=Math.floor,xt=pt.test(xt=Object.getPrototypeOf)&&xt,Tt=tt.hasOwnProperty,Nt=et.push,Ct=tt.propertyIsEnumerable,kt=tt.toString,Lt=pt.test(Lt=g.bind)&&Lt,At=pt.test(At=Array.isArray)&&At,Ot=e.isFinite,Mt=e.isNaN,_t=pt.test(_t=Object.keys)&&_t,Dt=Math.max,Pt=Math.min,Ht=Math.random,Bt="[object Arguments]",jt="[object Array]",Ft="[object Boolean]",It="[object Date]",qt="[object Number]",Rt="[object Object]",Ut="[object RegExp]",zt="[object String]",Wt=!/1/.test
|
||||||
[0]+Object("x")[0];try{var Vt=("[object Object]",St.call(e.document||0)==Bt)}catch($t){}var Jt=xt&&/\n|Opera/.test(xt+St.call(e.opera)),Kt=kt&&/^.+$|true/.test(kt+!!e.attachEvent),Qt={};Qt[Mt]=Qt["[object Function]"]=i,Qt[_t]=Qt[Dt]=Qt[Pt]=Qt[Ht]=Qt[Bt]=Qt[jt]=Qt[Ft]=n;var Gt={"boolean":i,"function":n,object:n,number:i,string:i,"undefined":i},Yt={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"};s.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,
|
(Function("1")),Xt=!!e.attachEvent,Vt=Lt&&!/\n|true/.test(Lt+Xt),$t=Lt&&!Vt,Jt=_t&&(Xt||Vt),Kt,Qt,Gt=(Gt={0:1,length:1},et.splice.call(Gt,0,1),Gt[0]),Yt=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(n in arguments)Yt=!n;Kt=!/valueOf/.test(t),Qt="x"!=t[0]})(1);var Zt=!b(arguments),en="xx"!="x"[0]+Object("x")[0];try{var tn=("[object Object]",kt.call(document)==Rt)}catch(nn){}var rn={"[object Function]":i};rn[Bt]=rn[jt]=rn[Ft]=rn[It]=rn[qt]=
|
||||||
interpolate:ft,variable:""};var Zt={a:"d,c,u",k:"c=e(c,u)",b:"if(c(v,h,d)===false)return s",g:"if(c(v,h,d)===false)return s"},en={l:i,a:"n",k:"for(var a=1,b=arguments.length;a<b;a++){if(k=arguments[a]){",g:"s[h]=v",c:"}}"},tn={b:r};zt&&(m=function(e){return e?yt.call(e,"callee"):i});var nn=c(Zt,tn,{l:i}),rn=c(Zt,tn),sn={"&":"&","<":"<",">":">",'"':""","'":"'"},on=E(sn),un=c(en,{g:"if(s[h]==null)"+en.g}),an=c(en),fn=Tt||function(e){return St.call(e)==_t};x(/x/)&&(x=function(e){
|
rn[Rt]=rn[Ut]=rn[zt]=n;var sn={};sn[jt]=Array,sn[Ft]=Boolean,sn[It]=Date,sn[Rt]=Object,sn[qt]=Number,sn[Ut]=RegExp,sn[zt]=String;var on={"boolean":i,"function":n,object:n,number:i,string:i,"undefined":i},un={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"};s.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:vt,variable:""};if(Xt||Vt||!Wt)o=Function;var an={a:"o,v,g",k:"for(var a=1,b=typeof g=='number'?2:arguments.length;a<b;a++){if((l=arguments[a])){"
|
||||||
return"[object Function]"==St.call(e)});var ln=gt?function(e){if(!e||"object"!=typeof e)return i;var t=e.valueOf,n="function"==typeof t&&(n=gt(t))&>(n);return n?e==n||gt(e)==n&&!m(e):g(e)}:g,cn=kt?function(e){return"function"==typeof e&&wt.call(e,"prototype")?y(e):T(e)?kt(e):[]}:y,hn=c(Zt);s.VERSION="0.9.2",s.after=function(e,t){return 1>e?t():function(){if(1>--e)return t.apply(this,arguments)}},s.bind=W,s.bindAll=function(e){for(var t=arguments,n=1<t.length?0:(t=w(e),-1),r=t.length;++n<r;){var i=
|
,g:"t[i]=l[i]",c:"}}"},fn={a:"d,c,w",k:"c=c&&typeof w=='undefined'?c:e(c,w)",b:"if(c(l[i],i,d)===false)return t",g:"if(c(l[i],i,d)===false)return t"},ln={b:r},cn=h(an);Zt&&(b=function(e){return e?Tt.call(e,"callee"):i});var hn=h(fn,ln,{l:i}),pn=h(fn,ln),dn={"&":"&","<":"<",">":">",'"':""","'":"'"},vn=T(dn),mn=h(an,{g:"if(t[i]==null)"+an.g}),gn=At||function(e){return kt.call(e)==jt};C(/x/)&&(C=function(e){return"[object Function]"==kt.call(e)});var yn=xt?function(e){if(!e||"object"!=typeof
|
||||||
t[n];e[i]=W(e[i],e)}return e},s.chain=function(e){return e=new s(e),e.__chain__=n,e},s.clone=b,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=L,s.countBy=function(e,t,n){var r={},t=l(t,n);return hn(e,function(e,n,i){n=t(e,n,i),yt.call(r,n)?r[n]++:r[n]=1}),r},s.debounce=function(e,t,n){function i(){a=r,n||(o=e.apply
|
e)return i;var t=e.valueOf,n="function"==typeof t&&(n=xt(t))&&xt(n);return n?e==n||xt(e)==n&&!b(e):w(e)}:w,bn=_t?function(e){return"function"==typeof e&&Ct.call(e,"prototype")?E(e):k(e)?_t(e):[]}:E,wn=h(fn);s.assign=cn,s.bindAll=function(e){for(var t=arguments,n=1<t.length?0:(t=x(e),-1),r=t.length;++n<r;){var i=t[n];e[i]=J(e[i],e)}return e},s.chain=function(e){return new s(e)},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.countBy=function(e,t,n
|
||||||
(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=un,s.defer=function(e){var n=Et.call(arguments,1);return setTimeout(function(){e.apply(t,n)},1)},s.delay=function(e,n){var r=Et.call(arguments,2);return setTimeout(function(){e.apply(t,r)},n)},s.difference=function(e){for(var t=-1,n=e?e.length:0,r=vt.apply(K,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==
|
){var r={},t=c(t,n);return wn(e,function(e,n,i){n=t(e,n,i),Tt.call(r,n)?r[n]++:r[n]=1}),r},s.defaults=mn,s.difference=function(e){for(var t=-1,n=e?e.length:0,r=Et.apply(et,arguments),r=u(r,n),i=[];++t<n;){var s=e[t];r(s)||i.push(s)}return i},s.filter=P,s.flatten=z,s.forEach=wn,s.forIn=hn,s.forOwn=pn,s.functions=x,s.groupBy=function(e,t,n){var r={},t=c(t,n);return wn(e,function(e,n,i){n=t(e,n,i),(Tt.call(r,n)?r[n]:r[n]=[]).push(e)}),r},s.initial=function(e,t,n){if(!e)return[];var i=e.length;return g
|
||||||
r?"":(e+"").replace(ct,p)},s.every=A,s.extend=an,s.filter=O,s.find=M,s.first=F,s.flatten=I,s.forEach=hn,s.forIn=nn,s.forOwn=rn,s.functions=w,s.groupBy=function(e,t,n){var r={},t=l(t,n);return hn(e,function(e,n,i){n=t(e,n,i),(yt.call(r,n)?r[n]:r[n]=[]).push(e)}),r},s.has=function(e,t){return e?yt.call(e,t):i},s.identity=X,s.indexOf=q,s.initial=function(e,t,n){return e?Et.call(e,0,-(t==r||n?1:t)):[]},s.intersection=function(e){var t=arguments,n=t.length,r={},i=[];return hn(e,function(e){if(0>q(i,e)
|
(e,0,Pt(Dt(0,i-(t==r||n?1:t||0)),i))},s.intersection=function(e){var t=arguments,n=t.length,r={},i=[];return wn(e,function(e){if(0>W(i,e)){for(var s=n;--s;)if(!(r[s]||(r[s]=u(t[s])))(e))return;i.push(e)}}),i},s.invert=T,s.invoke=function(e,t){var n=g(arguments,2),r="function"==typeof t,i=[];return wn(e,function(e){i.push((r?t:e[t]).apply(e,n))}),i},s.keys=bn,s.map=B,s.max=j,s.merge=O,s.min=function(e,t,n){var r=Infinity,i=-1,s=e?e.length:0,o=r;if(t||!gn(e))t=!t&&A(e)?a:c(t,n),wn(e,function(e,n,i)
|
||||||
){for(var s=n;--s;)if(!(r[s]||(r[s]=o(t[s])))(e))return;i.push(e)}}),i},s.invert=E,s.invoke=function(e,t){var n=Et.call(arguments,2),r="function"==typeof t,i=[];return hn(e,function(e){i.push((r?t:e[t]).apply(e,n))}),i},s.isArguments=m,s.isArray=fn,s.isBoolean=function(e){return e===n||e===i||St.call(e)==Dt},s.isDate=function(e){return St.call(e)==Pt},s.isElement=function(e){return e?1===e.nodeType:i},s.isEmpty=function(e){var t=n;if(!e)return t;var r=St.call(e),s=e.length;return r==_t||r==Ft||r==
|
{n=t(e,n,i),n<r&&(r=n,o=e)});else for(;++i<s;)e[i]<o&&(o=e[i]);return o},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 t,i={};if(r)t=c(t,n);else var s=Et.apply(et,arguments);return hn(e,function(e,n,o){if(r?!t(e,n,o):0>W(s,n,1))i[n]=e}),i},s.pairs=function(e){var t=[];return pn(e,function(e,n){t.push([n,e])}),t},s.pick=function(e,t,n){var r={};if("function"!=typeof t)for(var i=0,s=Et.apply
|
||||||
Mt||zt&&m(e)||r==Bt&&"number"==typeof s&&x(e.splice)?!s:(rn(e,function(){return t=i}),t)},s.isEqual=S,s.isFinite=function(e){return Nt(e)&&!Ct(parseFloat(e))},s.isFunction=x,s.isNaN=function(e){return St.call(e)==Ht&&e!=+e},s.isNull=function(e){return e===r},s.isNumber=function(e){return St.call(e)==Ht},s.isObject=T,s.isPlainObject=ln,s.isRegExp=function(e){return St.call(e)==jt},s.isString=N,s.isUndefined=function(e){return e===t},s.keys=cn,s.last=function(e,t,n){if(e){var i=e.length;return t==r||
|
(et,arguments),o=s.length;++i<o;){var u=s[i];u in e&&(r[u]=e[u])}else t=c(t,n),hn(e,function(e,n,i){t(e,n,i)&&(r[n]=e)});return r},s.pluck=F,s.range=function(e,t,n){e=+e||0,n=+n||1,t==r&&(t=e,e=0);for(var i=-1,t=Dt(0,wt((t-e)/n)),s=Array(t);++i<t;)s[i]=e,e+=n;return s},s.reject=function(e,t,n){return t=c(t,n),P(e,function(e,n,r){return!t(e,n,r)})},s.rest=X,s.shuffle=function(e){var t=-1,n=Array(e?e.length:0);return wn(e,function(e){var r=St(Ht()*(++t+1));n[t]=n[r],n[r]=e}),n},s.sortBy=function(e,
|
||||||
n?e[i-1]:Et.call(e,-t||i)}},s.lastIndexOf=function(e,t,n){var r=e?e.length:0;for("number"==typeof n&&(r=(0>n?Lt(0,r+n):At(n,r-1))+1);r--;)if(e[r]===t)return r;return-1},s.lateBind=function(e,t){return f(t,e,Et.call(arguments,2))},s.map=_,s.max=D,s.memoize=function(e,t){var n={};return function(){var r=t?t.apply(this,arguments):arguments[0];return yt.call(n,r)?n[r]:n[r]=e.apply(this,arguments)}},s.merge=C,s.min=function(e,t,n){var r=Infinity,i=-1,s=e?e.length:0,o=r;if(t||!fn(e))t=!t&&N(e)?u:l(t,n)
|
t,n){var r=[],t=c(t,n);wn(e,function(e,n,i){r.push({a:t(e,n,i),b:n,c:e})}),e=r.length;for(r.sort(f);e--;)r[e]=r[e].c;return r},s.tap=function(e,t){return t(e),e},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"number"==typeof (e?e.length:0)?en&&A(e)?e.split(""):g(e):M(e)},s.union=function(){return $(Et.apply(et,arguments))},s.uniq=$,s.values=M,s.where=function(e,t){var n=bn(t);return P(e,function(e){for(var r=n.length;r--;){var i=
|
||||||
,hn(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=V,s.noConflict=function(){return e._=Z,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 t,i={};if(r)t=l(t,n);else var s=vt.apply(K,arguments);return nn(e,function(e,n,o){if(r?!t(e,n,o):0>q(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
|
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=u(arguments,1,20),i=[];++t<n;){var s=e[t];r(s)||i.push(s)}return i},s.zip=function(e){for(var t=-1,n=e?j(F(arguments,"length")):0,r=Array(n);++t<n;)r[t]=F(arguments,t);return r},s.collect=B,s.drop=X,s.each=wn,s.extend=cn,s.methods=x,s.select=P,s.tail=X,s.unique=$,Q(s),s.after=function(e,t){return 1>e?t():function(){if(1>--e)return t.apply(this,arguments)}},s.bind=J,s.bindKey=function(e,t){return l(e,t,g
|
||||||
,arguments),e=r,t)}},s.pairs=function(e){var t=[];return rn(e,function(e,n){t.push([n,e])}),t},s.partial=function(e){return f(e,Et.call(arguments,1))},s.pick=function(e,t,n){var r={};if("function"!=typeof t)for(var i=0,s=vt.apply(K,arguments),o=s.length;++i<o;){var u=s[i];u in e&&(r[u]=e[u])}else t=l(t,n),nn(e,function(e,n,i){t(e,n,i)&&(r[n]=e)});return r},s.pluck=P,s.random=function(e,t){return e==r&&t==r&&(t=1),e=+e||0,t==r&&(t=e,e=0),e+mt(Ot()*((+t||0)-e+1))},s.range=function(e,t,n){e=+e||0,n=+
|
(arguments,2))},s.clone=S,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=_,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.defer=function(e){var n=g(arguments,1);return setTimeout(function(){e.apply(t,n)},1)},s.delay=function(e,n){var r=g(arguments,2);return setTimeout
|
||||||
n||1,t==r&&(t=e,e=0);for(var i=-1,t=Lt(0,dt((t-e)/n)),s=Array(t);++i<t;)s[i]=e,e+=n;return s},s.reduce=H,s.reduceRight=B,s.reject=function(e,t,n){return t=l(t,n),O(e,function(e,n,r){return!t(e,n,r)})},s.rest=R,s.result=function(e,t){var n=e?e[t]:r;return x(n)?e[t]():n},s.shuffle=function(e){var t=-1,n=Array(e?e.length:0);return hn(e,function(e){var r=mt(Ot()*(++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:cn(e).length},s.some=j,s.sortBy=function(e,t
|
(function(){e.apply(t,r)},n)},s.escape=function(e){return e==r?"":(e+"").replace(gt,d)},s.every=D,s.find=H,s.has=function(e,t){return e?Tt.call(e,t):i},s.identity=K,s.indexOf=W,s.isArguments=b,s.isArray=gn,s.isBoolean=function(e){return e===n||e===i||kt.call(e)==Ft},s.isDate=function(e){return kt.call(e)==It},s.isElement=function(e){return e?1===e.nodeType:i},s.isEmpty=function(e){var t=n;if(!e)return t;var r=kt.call(e),s=e.length;return r==jt||r==zt||r==Bt||Zt&&b(e)||r==Rt&&"number"==typeof s&&C
|
||||||
,n){var r=[],t=l(t,n);hn(e,function(e,n,i){r.push({a:t(e,n,i),b:n,c:e})}),e=r.length;for(r.sort(a);e--;)r[e]=r[e].c;return r},s.sortedIndex=U,s.tap=function(e,t){return t(e),e},s.template=function(e,t,n){e||(e=""),n||(n={});var r,i,o=s.templateSettings,u=0,a=n.interpolate||o.interpolate||lt,f="__p += '",l=n.variable||o.variable,c=l;e.replace(RegExp((n.escape||o.escape||lt).source+"|"+a.source+"|"+(a===ft?at:lt).source+"|"+(n.evaluate||o.evaluate||lt).source+"|$","g"),function(t,n,i,s,o,a){i||(i=s
|
(e.splice)?!s:(pn(e,function(){return t=i}),t)},s.isEqual=N,s.isFinite=function(e){return Ot(e)&&!Mt(parseFloat(e))},s.isFunction=C,s.isNaN=function(e){return L(e)&&e!=+e},s.isNull=function(e){return e===r},s.isNumber=L,s.isObject=k,s.isPlainObject=yn,s.isRegExp=function(e){return kt.call(e)==Ut},s.isString=A,s.isUndefined=function(e){return"undefined"==typeof e},s.lastIndexOf=function(e,t,n){var r=e?e.length:0;for("number"==typeof n&&(r=(0>n?Dt(0,r+n):Pt(n,r-1))+1);r--;)if(e[r]===t)return r;return-1
|
||||||
),f+=e.slice(u,a).replace(ht,h),f+=n?"'+__e("+n+")+'":o?"';"+o+";__p+='":i?"'+((__t=("+i+"))==null?'':__t)+'":"",r||(r=o||et.test(n||i)),u=a+t.length}),f+="';",c||(l="obj",r?f="with("+l+"){"+f+"}":(n=RegExp("(\\(\\s*)"+l+"\\."+l+"\\b","g"),f=f.replace(ot,"$&"+l+".").replace(n,"$1__d"))),f=(r?f.replace(nt,""):f).replace(rt,"$1").replace(it,"$1;"),f="function("+l+"){"+(c?"":l+"||("+l+"={});")+"var __t,__p='',__e=_.escape"+(r?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":
|
},s.memoize=function(e,t){var n={};return function(){var r=t?t.apply(this,arguments):arguments[0];return Tt.call(n,r)?n[r]:n[r]=e.apply(this,arguments)}},s.mixin=Q,s.noConflict=function(){return e._=st,this},s.once=function(e){var t,s=i;return function(){return s?t:(s=n,t=e.apply(this,arguments),e=r,t)}},s.partial=function(e){return l(e,g(arguments,1))},s.random=function(e,t){return e==r&&t==r&&(t=1),e=+e||0,t==r&&(t=e,e=0),e+St(Ht()*((+t||0)-e+1))},s.reduce=I,s.reduceRight=q,s.result=function(e,
|
||||||
(c?"":",__d="+l+"."+l+"||"+l)+";")+f+"return __p}";try{i=Function("_","return "+f)(s)}catch(p){throw p.source=f,p}return t?i(t):(i.source=f,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(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
|
t){var n=e?e[t]:r;return C(n)?e[t]():n},s.size=function(e){var t=e?e.length:0;return"number"==typeof t?t:bn(e).length},s.some=R,s.sortedIndex=V,s.template=function(e,t,n){e||(e=""),n||(n={});var r,i,u=s.templateSettings,a=0,f=n.interpolate||u.interpolate||mt,l="__p+='",c=n.variable||u.variable,h=c;e.replace(RegExp((n.escape||u.escape||mt).source+"|"+f.source+"|"+(f===vt?dt:mt).source+"|"+(n.evaluate||u.evaluate||mt).source+"|$","g"),function(t,n,i,s,o,u){return i||(i=s),l+=e.slice(a,u).replace(yt
|
||||||
e.length?(Wt?N(e):"string"==typeof e)?e.split(""):Et.call(e):k(e)},s.unescape=function(e){return e==r?"":(e+"").replace(tt,v)},s.union=function(){return z(vt.apply(K,arguments))},s.uniq=z,s.uniqueId=function(e){var t=G++;return e?e+t:t},s.values=k,s.where=function(e,t){var n=[];return nn(t,function(e,t){n.push(t)}),O(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];
|
,p),n&&(l+="'+__e("+n+")+'"),o&&(l+="';"+o+";__p+='"),i&&(l+="'+((__t=("+i+"))==null?'':__t)+'"),r||(r=o||ot.test(n||i)),a=u+t.length,t}),l+="';\n",h||(c="obj",r?l="with("+c+"){"+l+"}":(n=RegExp("(\\(\\s*)"+c+"\\."+c+"\\b","g"),l=l.replace(ht,"$&"+c+".").replace(n,"$1__d"))),l=(r?l.replace(at,""):l).replace(ft,"$1").replace(lt,"$1;"),l="function("+c+"){"+(h?"":c+"||("+c+"={});")+"var __t,__p='',__e=_.escape"+(r?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":(h?"":",__d="+
|
||||||
r(s)||i.push(s)}return i},s.wrap=function(e,t){return function(){var n=[e];return bt.apply(n,arguments),t.apply(this,n)}},s.zip=function(e){for(var t=-1,n=e?D(P(arguments,"length")):0,r=Array(n);++t<n;)r[t]=P(arguments,t);return r},s.all=A,s.any=j,s.collect=_,s.detect=M,s.drop=R,s.each=hn,s.foldl=H,s.foldr=B,s.head=F,s.include=L,s.inject=H,s.methods=w,s.select=O,s.tail=R,s.take=F,s.unique=z,V(s),s.prototype.chain=function(){return this.__chain__=n,this},s.prototype.value=function(){return this.__wrapped__
|
c+"."+c+"||"+c)+";")+l+"return __p}";try{i=o("_","return "+l)(s)}catch(d){throw d.source=l,d}return t?i(t):(i.source=l,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 f=new Date,l=t-(f-a);return i=arguments,o=this,0>=l?(clearTimeout(u),u=r,a=f,s=e.apply(o,i)):u||(u=setTimeout(n,l)),s}},s.unescape=function(e){return e==r?"":(e+"").replace(ut,y)},s.uniqueId=function(e){return(e==r?"":e+"")+ ++nt},s.wrap=function(e,t){return function(){var n=
|
||||||
},hn("pop push reverse shift sort splice unshift".split(" "),function(e){var t=K[e];s.prototype[e]=function(){var e=this.__wrapped__;return t.apply(e,arguments),Rt&&e.length===0&&delete e[0],this.__chain__&&(e=new s(e),e.__chain__=n),e}}),hn(["concat","join","slice"],function(e){var t=K[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(
|
[e];return Nt.apply(n,arguments),t.apply(this,n)}},s.all=D,s.any=R,s.detect=H,s.foldl=I,s.foldr=q,s.include=_,s.inject=I,pn(s,function(e,t){s.prototype[t]||(s.prototype[t]=function(){var t=[this.__wrapped__];return Nt.apply(t,arguments),e.apply(s,t)})}),s.first=U,s.last=function(e,t,n){if(e){var i=e.length;return t==r||n?e[i-1]:g(e,Dt(0,i-t))}},s.take=U,s.head=U,pn(s,function(e,t){s.prototype[t]||(s.prototype[t]=function(t,n){var i=e(this.__wrapped__,t,n);return t==r||n?i:new s(i)})}),s.VERSION="1.0.0-rc.2"
|
||||||
){return s})):$?"object"==typeof module&&module&&module.exports==$?(module.exports=s)._=s:$._=s:e._=s})(this);
|
,s.prototype.chain=function(){return this},s.prototype.toString=function(){return""+this.__wrapped__},s.prototype.value=G,s.prototype.valueOf=G,wn("pop push reverse shift sort splice unshift".split(" "),function(e){var t=et[e];s.prototype[e]=function(){var e=this.__wrapped__;return t.apply(e,arguments),Gt&&e.length===0&&delete e[0],this}}),wn(["concat","join","slice"],function(e){var t=et[e];s.prototype[e]=function(){var e=t.apply(this.__wrapped__,arguments);return new s(e)}}),typeof define=="function"&&typeof
|
||||||
|
define.amd=="object"&&define.amd?(e._=s,define(function(){return s})):Y?"object"==typeof module&&module&&module.exports==Y?(module.exports=s)._=s:Y._=s:e._=s})(this);
|
||||||
3798
lodash.underscore.js
Normal file
3798
lodash.underscore.js
Normal file
File diff suppressed because it is too large
Load Diff
60
lodash.underscore.min.js
vendored
60
lodash.underscore.min.js
vendored
@@ -1,31 +1,33 @@
|
|||||||
/*!
|
/*!
|
||||||
Lo-Dash 0.9.2 lodash.com/license
|
Lo-Dash 1.0.0-rc.2 (Custom Build) lodash.com/license
|
||||||
Underscore.js 1.4.2 underscorejs.org/LICENSE
|
Build: `lodash underscore -m -o ./lodash.underscore.min.js`
|
||||||
|
Underscore.js 1.4.3 underscorejs.org/LICENSE
|
||||||
*/
|
*/
|
||||||
;(function(e,t){function n(e){if(e&&e.__wrapped__)return e;if(!(this instanceof n))return new n(e);this.__wrapped__=e}function r(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 i(e,t,n){function r(){var i=arguments,s=t;return n.length&&(i=i.length?n.concat(Z.call(i)):n),this instanceof r?(a.prototype=e.prototype,s=new a,i=e.apply(s,i),v(i)?i:s):e.apply(s,i)}return r}function s(e,n){return e?"function"!=typeof e?function(t){return t[
|
;(function(e,t){function n(e){if(e&&"object"==typeof e&&e.__wrapped__)return e;if(!(this instanceof n))return new n(e);this.__wrapped__=e}function r(e,t){var n=e.b,r=t.b,e=e.a,t=t.a;if(e!==t){if(e>t||"undefined"==typeof e)return 1;if(e<t||"undefined"==typeof t)return-1}return n<r?-1:1}function i(e,t,n){function r(){var i=arguments,s=t;return n.length&&(i=i.length?n.concat(f(i)):n),this instanceof r?(a.prototype=e.prototype,s=new a,a.prototype=null,i=e.apply(s,i),y(i)?i:s):e.apply(s,i)}return r}function s
|
||||||
e]}:n!==t?function(t,r,i){return e.call(n,t,r,i)}:e:H}function o(e){return"\\"+yt[e]}function u(e){return Et[e]}function a(){}function f(e){return St[e]}function l(e){var t=[];return wt(e,function(e,n){t.push(n)}),t}function c(e){var t=[];return bt(e,function(e,n){d(e)&&t.push(n)}),t.sort()}function h(e){var t={};return wt(e,function(e,n){t[e]=n}),t}function p(e,t,n,r){if(e===t)return 0!==e||1/e==1/t;if(null==e||null==t)return e===t;var i=et.call(e);if(i!=et.call(t))return!1;switch(i){case ft:case lt
|
(e,t){return e?"function"!=typeof e?function(t){return t[e]}:"undefined"!=typeof t?function(n,r,i){return e.call(t,n,r,i)}:e:I}function o(e){return"\\"+St[e]}function u(e){return Nt[e]}function a(){}function f(e,t,n){t||(t=0),"undefined"==typeof n&&(n=e?e.length:0);for(var r=-1,n=n-t||0,i=Array(0>n?0:n);++r<n;)i[r]=e[t+r];return i}function l(e){return Ct[e]}function c(e){if(!e)return e;for(var t=1,n=arguments.length;t<n;t++){var r=arguments[t];if(r)for(var i in r)e[i]=r[i]}return e}function h(e){
|
||||||
:return+e==+t;case ct:return e!=+e?t!=+t:0==e?1/e==1/t:e==+t;case pt:case dt:return e==t+""}var s=i==at;if(!s){if(e.__wrapped__||t.__wrapped__)return p(e.__wrapped__||e,t.__wrapped__||t);if(i!=ht)return!1;var i=e.constructor,o=t.constructor;if(i!=o&&(!d(i)||!(i instanceof i&&d(o)&&o instanceof o)))return!1}n||(n=[]),r||(r=[]);for(i=n.length;i--;)if(n[i]==e)return r[i]==t;i=!0,o=0,n.push(e),r.push(t);if(s){o=e.length;if(i=o==t.length)for(;o--&&(i=p(e[o],t[o],n,r)););return i}for(var u in e)if(G.call
|
var t=[];return Tt(e,function(e,n){t.push(n)}),t}function p(e){if(!e)return e;for(var t=1,n=arguments.length;t<n;t++){var r=arguments[t];if(r)for(var i in r)null==e[i]&&(e[i]=r[i])}return e}function d(e){var t=[];return xt(e,function(e,n){g(e)&&t.push(n)}),t.sort()}function v(e){var t={};return Tt(e,function(e,n){t[e]=n}),t}function m(e,t,n,r){if(e===t)return 0!==e||1/e==1/t;if(null==e||null==t)return e===t;var i=rt.call(e),s=rt.call(t);if(i!=s)return!1;switch(i){case pt:case dt:return+e==+t;case vt
|
||||||
(e,u)&&(o++,!G.call(t,u)||!p(e[u],t[u],n,r)))return!1;for(u in t)if(G.call(t,u)&&!(o--))return!1;return!0}function d(e){return"function"==typeof e}function v(e){return e?gt[typeof e]:!1}function m(e){return et.call(e)==dt}function g(e){var t=[];return wt(e,function(e){t.push(e)}),t}function y(e,t){return"number"==typeof (e?e.length:0)?-1<O(e,t):k(e,function(e){return e===t})}function b(e,t,n){var r=!0,t=s(t,n);if(Nt(e))for(var n=-1,i=e.length;++n<i&&(r=!!t(e[n],n,e)););else kt(e,function(e,n,i){return!
|
:return e!=+e?t!=+t:0==e?1/e==1/t:e==+t;case gt:case yt:return e==t+""}s=i==ht;if(!s){if(e.__wrapped__||t.__wrapped__)return m(e.__wrapped__||e,t.__wrapped__||t);if(i!=mt)return!1;var i=e.constructor,o=t.constructor;if(i!=o&&(!g(i)||!(i instanceof i&&g(o)&&o instanceof o)))return!1}n||(n=[]),r||(r=[]);for(i=n.length;i--;)if(n[i]==e)return r[i]==t;var u=!0,a=0;n.push(e),r.push(t);if(s){a=e.length;if(u=a==t.length)for(;a--&&(u=m(e[a],t[a],n,r)););return u}return xt(e,function(e,i,s){if(tt.call(s,i)
|
||||||
(r=!!t(e,n,i))&&R});return r}function w(e,t,n){var r=[],t=s(t,n);return kt(e,function(e,n,i){t(e,n,i)&&r.push(e)}),r}function E(e,t,n){var r,t=s(t,n);return kt(e,function(e,n,i){if(t(e,n,i))return r=e,!1}),r}function S(e,t,n){var r=-1,i=e?e.length:0,o=Array("number"==typeof i?i:0),t=s(t,n);if(Nt(e))for(;++r<i;)o[r]=t(e[r],r,e);else kt(e,function(e,n,i){o[++r]=t(e,n,i)});return o}function x(e,t,n){var r=-Infinity,i=-1,o=e?e.length:0,u=r;if(t||!Nt(e))t=s(t,n),kt(e,function(e,n,i){n=t(e,n,i),n>r&&(r=
|
)return a++,!(u=tt.call(t,i)&&m(e,t[i],n,r))&&X}),u&&xt(t,function(e,t,n){if(tt.call(n,t))return!(u=-1<--a)&&X}),u}function g(e){return"function"==typeof e}function y(e){return e?Et[typeof e]:!1}function b(e){return"number"==typeof e||rt.call(e)==vt}function w(e){return"string"==typeof e||rt.call(e)==yt}function E(e){var t=[];return Tt(e,function(e){t.push(e)}),t}function S(e,t){var n=!1;return"number"==typeof (e?e.length:0)?n=-1<P(e,t):At(e,function(e){return(n=e===t)&&X}),n}function x(e,t,n){var r=!0
|
||||||
n,u=e)});else for(;++i<o;)e[i]>u&&(u=e[i]);return u}function T(e,t){var n=[];return kt(e,function(e){n.push(e[t])}),n}function N(e,t,n,r){var i=3>arguments.length,t=s(t,r);return kt(e,function(e,r,s){n=i?(i=!1,e):t(n,e,r,s)}),n}function C(e,t,n,r){var i=e?e.length:0,s=3>arguments.length;if("number"!=typeof i)var o=Ct(e),i=o.length;return kt(e,function(u,a,f){a=o?o[--i]:--i,n=s?(s=!1,e[a]):t.call(r,n,e[a],a,f)}),n}function k(e,t,n){var r,t=s(t,n);if(Nt(e))for(var n=-1,i=e.length;++n<i&&!(r=t(e[n],
|
,t=s(t,n);if(kt(e))for(var n=-1,i=e.length;++n<i&&(r=!!t(e[n],n,e)););else At(e,function(e,n,i){return!(r=!!t(e,n,i))&&X});return r}function T(e,t,n){var r=[],t=s(t,n);if(kt(e))for(var n=-1,i=e.length;++n<i;){var o=e[n];t(o,n,e)&&r.push(o)}else At(e,function(e,n,i){t(e,n,i)&&r.push(e)});return r}function N(e,t,n){var r,t=s(t,n);return At(e,function(e,n,i){if(t(e,n,i))return r=e,X}),r}function C(e,t,n){var r=-1,i=e?e.length:0,o=Array("number"==typeof i?i:0),t=s(t,n);if(kt(e))for(;++r<i;)o[r]=t(e[r
|
||||||
n,e)););else kt(e,function(e,n,i){return(r=t(e,n,i))&&R});return!!r}function L(e,t,n){if(e)return null==t||n?e[0]:Z.call(e,0,t)}function A(e,t){for(var n=-1,r=e?e.length:0,i=[];++n<r;){var s=e[n];Nt(s)?Y.apply(i,t?s:A(s)):i.push(s)}return i}function O(e,t,n){var r=-1,i=e?e.length:0;if("number"==typeof n)r=(0>n?st(0,i+n):n||0)-1;else if(n)return r=_(e,t),e[r]===t?r:-1;for(;++r<i;)if(e[r]===t)return r;return-1}function M(e,t,n){return e?Z.call(e,null==t||n?1:t):[]}function _(e,t,n,r){for(var i=0,o=
|
],r,e);else At(e,function(e,n,i){o[++r]=t(e,n,i)});return o}function k(e,t,n){var r=-Infinity,i=-1,o=e?e.length:0,u=r;if(t||!kt(e))t=s(t,n),At(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 L(e,t){return C(e,t+"")}function A(e,t,n,r){var i=3>arguments.length;return t||(t=I),At(e,function(e,s,o){n=i?(i=!1,e):t.call(r,n,e,s,o)}),n}function O(e,t,n,r){var i=e?e.length:0,s=3>arguments.length;if("number"!=typeof i)var o=Lt(e),i=o.length;return t||(t=I
|
||||||
e?e.length:i,n=n?s(n,r):H,t=n(t);i<o;)r=i+o>>>1,n(e[r])<t?i=r+1:o=r;return i}function D(e,t,n,r){var i=-1,o=e?e.length:0,u=[],a=u;n&&(a=[],n=s(n,r));for(;++i<o;){var r=e[i],f=n?n(r,i,e):r;if(t?!i||a[a.length-1]!==f:0>O(a,f))n&&a.push(f),u.push(r)}return u}function P(e,t){return mt||tt&&2<arguments.length?tt.call.apply(tt,arguments):i(e,t,Z.call(arguments,2))}function H(e){return e}function B(e){kt(c(e),function(t){var r=n[t]=e[t];n.prototype[t]=function(){var e=[this.__wrapped__];return Y.apply(e
|
),At(e,function(u,a,f){a=o?o[--i]:--i,n=s?(s=!1,e[a]):t.call(r,n,e[a],a,f)}),n}function M(e,t,n){var r,t=s(t,n);if(kt(e))for(var n=-1,i=e.length;++n<i&&!(r=t(e[n],n,e)););else At(e,function(e,n,i){return(r=t(e,n,i))&&X});return!!r}function _(e,t,n){if(e){var r=e.length;return null==t||n?e[0]:f(e,0,lt(ft(0,t),r))}}function D(e,t){for(var n=-1,r=e?e.length:0,i=[];++n<r;){var s=e[n];kt(s)?nt.apply(i,t?s:D(s)):i.push(s)}return i}function P(e,t,n){var r=-1,i=e?e.length:0;if("number"==typeof n)r=(0>n?ft
|
||||||
,arguments),e=r.apply(n,e),this.__chain__&&(e=new n(e),e.__chain__=!0),e}})}var j="object"==typeof exports&&exports,F="object"==typeof global&&global;F.global===F&&(e=F);var I=[],F=new function(){},q=0,R=F,U=e._,z=/&(?:amp|lt|gt|quot|#x27);/g,W=RegExp("^"+(F.valueOf+"").replace(/[.*+?^=!:${}()|[\]\/\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),X=/($^)/,V=/[&<>"']/g,$=/['\n\r\t\u2028\u2029\\]/g,J=Math.ceil,K=I.concat,Q=Math.floor,G=F.hasOwnProperty,Y=I.push,Z=I.slice,et=F.toString,tt=W.test
|
(0,i+n):n||0)-1;else if(n)return r=B(e,t),e[r]===t?r:-1;for(;++r<i;)if(e[r]===t)return r;return-1}function H(e,t,n){return f(e,null==t||n?1:ft(0,t))}function B(e,t,n,r){for(var i=0,o=e?e.length:i,n=n?s(n,r):I,t=n(t);i<o;)r=i+o>>>1,n(e[r])<t?i=r+1:o=r;return i}function j(e,t,n,r){var i=-1,o=e?e.length:0,u=[],a=u;"function"==typeof t&&(r=n,n=t,t=!1),n&&(a=[],n=s(n,r));for(;++i<o;){var r=e[i],f=n?n(r,i,e):r;if(t?!i||a[a.length-1]!==f:0>P(a,f))n&&a.push(f),u.push(r)}return u}function F(e,t){return bt||
|
||||||
(tt=Z.bind)&&tt,nt=W.test(nt=Array.isArray)&&nt,rt=e.isFinite,it=W.test(it=Object.keys)&&it,st=Math.max,ot=Math.min,ut=Math.random,at="[object Array]",ft="[object Boolean]",lt="[object Date]",ct="[object Number]",ht="[object Object]",pt="[object RegExp]",dt="[object String]",vt=(vt={0:1,length:1},I.splice.call(vt,0,1),vt[0]),mt=tt&&/\n|Opera/.test(tt+et.call(e.opera)),gt={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,"undefined":!1},yt={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028"
|
it&&2<arguments.length?it.call.apply(it,arguments):i(e,t,f(arguments,2))}function I(e){return e}function q(e){At(d(e),function(t){var r=n[t]=e[t];n.prototype[t]=function(){var e=[this.__wrapped__];return nt.apply(e,arguments),e=r.apply(n,e),this.__chain__&&(e=new n(e),e.__chain__=!0),e}})}var R="object"==typeof exports&&exports,U="object"==typeof global&&global;U.global===U&&(e=U);var z=[],U=new function(){},W=0,X=U,V=e._,$=/&(?:amp|lt|gt|quot|#x27);/g,J=RegExp("^"+(U.valueOf+"").replace(/[.*+?^=!:${}()|[\]\/\\]/g
|
||||||
:"u2028","\u2029":"u2029"};n.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},n.isArguments=function(e){return"[object Arguments]"==et.call(e)},n.isArguments(arguments)||(n.isArguments=function(e){return e?G.call(e,"callee"):!1});var bt=function(e,t){var n,r;if(!e)return e;t=s(t);for(n in e)if(r=e[n],t(r,n,e)===R)break;return e},wt=function(e,t){var n,r;if(!e)return e;t=s(t);for(n in e)if(G.call(e,n)&&(r=e[n],t(r,n,e)===R))break;return e
|
,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),K=/($^)/,Q=/[&<>"']/g,G=/['\n\r\t\u2028\u2029\\]/g,Y=Math.ceil,Z=z.concat,et=Math.floor,tt=U.hasOwnProperty,nt=z.push,rt=U.toString,it=J.test(it=f.bind)&&it,st=J.test(st=Array.isArray)&&st,ot=e.isFinite,ut=e.isNaN,at=J.test(at=Object.keys)&&at,ft=Math.max,lt=Math.min,ct=Math.random,ht="[object Array]",pt="[object Boolean]",dt="[object Date]",vt="[object Number]",mt="[object Object]",gt="[object RegExp]",yt="[object String]",U=!!e.attachEvent,U=it&&!/\n|true/
|
||||||
},Et={"&":"&","<":"<",">":">",'"':""","'":"'"},St=h(Et),xt=function(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],null==e[t]&&(e[t]=n);return e},Tt=function(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},Nt=nt||function(e){return et.call(e)==at};d(/x/)&&(d=function(e){return"[object Function]"==et.call(e)});var Ct=it?function(e){return v(e)?it(e
|
.test(it+U),bt=it&&!U,wt=(wt={0:1,length:1},z.splice.call(wt,0,1),wt[0]),Et={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,"undefined":!1},St={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"};n.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},n.isArguments=function(e){return"[object Arguments]"==rt.call(e)},n.isArguments(arguments)||(n.isArguments=function(e){return e?tt.call(e,"callee"):!1}
|
||||||
):[]}:l,kt=function(e,t,n){var r;if(!e)return e;var t=s(t,n),i=e.length,n=-1;if("number"==typeof i){for(;++n<i;)if(r=e[n],t(r,n,e)===R)return e}else for(n in e)if(G.call(e,n)&&(r=e[n],t(r,n,e)===R))return e};n.VERSION="0.9.2",n.after=function(e,t){return 1>e?t():function(){if(1>--e)return t.apply(this,arguments)}},n.bind=P,n.bindAll=function(e){for(var t=arguments,n=1<t.length?0:(t=c(e),-1),r=t.length;++n<r;){var i=t[n];e[i]=P(e[i],e)}return e},n.chain=function(e){return e=new n(e),e.__chain__=!0
|
);var xt=function(e,t){var n;if(!e)return e;t||(t=I);for(n in e)if(t(e[n],n,e)===X)break;return e},Tt=function(e,t){var n;if(!e)return e;t||(t=I);for(n in e)if(tt.call(e,n)&&t(e[n],n,e)===X)break;return e},Nt={"&":"&","<":"<",">":">",'"':""","'":"'"},Ct=v(Nt),kt=st||function(e){return rt.call(e)==ht};g(/x/)&&(g=function(e){return"[object Function]"==rt.call(e)});var Lt=at?function(e){return y(e)?at(e):[]}:h,At=function(e,t,n){if(!e)return e;var t=t&&"undefined"==typeof n?t:s(t
|
||||||
,e},n.clone=function(e){return e&>[typeof e]?Nt(e)?Z.call(e):Tt({},e):e},n.compact=function(e){for(var t=-1,n=e?e.length:0,r=[];++t<n;){var i=e[t];i&&r.push(i)}return r},n.compose=function(){var e=arguments;return function(){for(var t=arguments,n=e.length;n--;)t=[e[n].apply(this,t)];return t[0]}},n.contains=y,n.countBy=function(e,t,n){var r={},t=s(t,n);return kt(e,function(e,n,i){n=t(e,n,i),G.call(r,n)?r[n]++:r[n]=1}),r},n.debounce=function(e,t,n){function r(){u=null,n||(s=e.apply(o,i))}var i,s
|
,n),r=e.length,n=-1;if("number"==typeof r){for(;++n<r;)if(t(e[n],n,e)===X)return e}else for(n in e)if(tt.call(e,n)&&t(e[n],n,e)===X)return e};n.bindAll=function(e){for(var t=arguments,n=1<t.length?0:(t=d(e),-1),r=t.length;++n<r;){var i=t[n];e[i]=F(e[i],e)}return e},n.chain=function(e){return e=new n(e),e.__chain__=!0,e},n.compact=function(e){for(var t=-1,n=e?e.length:0,r=[];++t<n;){var i=e[t];i&&r.push(i)}return r},n.countBy=function(e,t,n){var r={},t=s(t,n);return At(e,function(e,n,i){n=t(e,n,i)
|
||||||
,o,u;return function(){var a=n&&!u;return i=arguments,o=this,clearTimeout(u),u=setTimeout(r,t),a&&(s=e.apply(o,i)),s}},n.defaults=xt,n.defer=function(e){var n=Z.call(arguments,1);return setTimeout(function(){e.apply(t,n)},1)},n.delay=function(e,n){var r=Z.call(arguments,2);return setTimeout(function(){e.apply(t,r)},n)},n.difference=function(e){for(var t=-1,n=e.length,r=K.apply(I,arguments),i=[];++t<n;){var s=e[t];0>O(r,s,n)&&i.push(s)}return i},n.escape=function(e){return null==e?"":(e+"").replace
|
,tt.call(r,n)?r[n]++:r[n]=1}),r},n.defaults=p,n.difference=function(e){for(var t=-1,n=e.length,r=Z.apply(z,arguments),i=[];++t<n;){var s=e[t];0>P(r,s,n)&&i.push(s)}return i},n.filter=T,n.flatten=D,n.forEach=At,n.functions=d,n.groupBy=function(e,t,n){var r={},t=s(t,n);return At(e,function(e,n,i){n=t(e,n,i),(tt.call(r,n)?r[n]:r[n]=[]).push(e)}),r},n.initial=function(e,t,n){if(!e)return[];var r=e.length;return f(e,0,lt(ft(0,r-(null==t||n?1:t||0)),r))},n.intersection=function(e){var t=arguments,n=t.length
|
||||||
(V,u)},n.every=b,n.extend=Tt,n.filter=w,n.find=E,n.first=L,n.flatten=A,n.forEach=kt,n.functions=c,n.groupBy=function(e,t,n){var r={},t=s(t,n);return kt(e,function(e,n,i){n=t(e,n,i),(G.call(r,n)?r[n]:r[n]=[]).push(e)}),r},n.has=function(e,t){return e?G.call(e,t):!1},n.identity=H,n.indexOf=O,n.initial=function(e,t,n){return e?Z.call(e,0,-(null==t||n?1:t)):[]},n.intersection=function(e){var t=arguments,n=t.length,r=[];return kt(e,function(e){if(0>O(r,e)){for(var i=n;--i;)if(0>O(t[i],e))return;r.push
|
,r=[];return At(e,function(e){if(0>P(r,e)){for(var i=n;--i;)if(0>P(t[i],e))return;r.push(e)}}),r},n.invert=v,n.invoke=function(e,t){var n=f(arguments,2),r="function"==typeof t,i=[];return At(e,function(e){i.push((r?t:e[t]).apply(e,n))}),i},n.keys=Lt,n.map=C,n.max=k,n.min=function(e,t,n){var r=Infinity,i=-1,o=e?e.length:0,u=r;if(t||!kt(e))t=s(t,n),At(e,function(e,n,i){n=t(e,n,i),n<r&&(r=n,u=e)});else for(;++i<o;)e[i]<u&&(u=e[i]);return u},n.object=function(e,t){for(var n=-1,r=e?e.length:0,i={};++n<
|
||||||
(e)}}),r},n.invert=h,n.invoke=function(e,t){var n=Z.call(arguments,2),r="function"==typeof t,i=[];return kt(e,function(e){i.push((r?t:e[t]).apply(e,n))}),i},n.isArray=Nt,n.isBoolean=function(e){return!0===e||!1===e||et.call(e)==ft},n.isDate=function(e){return et.call(e)==lt},n.isElement=function(e){return e?1===e.nodeType:!1},n.isEmpty=function(e){if(!e)return!0;if(Nt(e)||m(e))return!e.length;for(var t in e)if(G.call(e,t))return!1;return!0},n.isEqual=p,n.isFinite=function(e){return rt(e)&&et.call
|
r;){var s=e[n];t?i[s]=t[n]:i[s[0]]=s[1]}return i},n.omit=function(e){var t=Z.apply(z,arguments),n={};return xt(e,function(e,r){0>P(t,r,1)&&(n[r]=e)}),n},n.pairs=function(e){var t=[];return Tt(e,function(e,n){t.push([n,e])}),t},n.pick=function(e){for(var t=0,n=Z.apply(z,arguments),r=n.length,i={};++t<r;){var s=n[t];s in e&&(i[s]=e[s])}return i},n.pluck=L,n.range=function(e,t,n){e=+e||0,n=+n||1,null==t&&(t=e,e=0);for(var r=-1,t=ft(0,Y((t-e)/n)),i=Array(t);++r<t;)i[r]=e,e+=n;return i},n.reject=function(
|
||||||
(e)==ct},n.isFunction=d,n.isNaN=function(e){return et.call(e)==ct&&e!=+e},n.isNull=function(e){return null===e},n.isNumber=function(e){return et.call(e)==ct},n.isObject=v,n.isRegExp=function(e){return et.call(e)==pt},n.isString=m,n.isUndefined=function(e){return e===t},n.keys=Ct,n.last=function(e,t,n){if(e){var r=e.length;return null==t||n?e[r-1]:Z.call(e,-t||r)}},n.lastIndexOf=function(e,t,n){var r=e?e.length:0;for("number"==typeof n&&(r=(0>n?st(0,r+n):ot(n,r-1))+1);r--;)if(e[r]===t)return r;return-1
|
e,t,n){return t=s(t,n),T(e,function(e,n,r){return!t(e,n,r)})},n.rest=H,n.shuffle=function(e){var t=-1,n=Array(e?e.length:0);return At(e,function(e){var r=et(ct()*(++t+1));n[t]=n[r],n[r]=e}),n},n.sortBy=function(e,t,n){var i=[],t=s(t,n);At(e,function(e,n,r){i.push({a:t(e,n,r),b:n,c:e})}),e=i.length;for(i.sort(r);e--;)i[e]=i[e].c;return i},n.tap=function(e,t){return t(e),e},n.times=function(e,t,n){for(var e=+e||0,r=-1,i=Array(e);++r<e;)i[r]=t.call(n,r);return i},n.toArray=function(e){return"number"==typeof
|
||||||
},n.map=S,n.max=x,n.memoize=function(e,t){var n={};return function(){var r=t?t.apply(this,arguments):arguments[0];return G.call(n,r)?n[r]:n[r]=e.apply(this,arguments)}},n.min=function(e,t,n){var r=Infinity,i=-1,o=e?e.length:0,u=r;if(t||!Nt(e))t=s(t,n),kt(e,function(e,n,i){n=t(e,n,i),n<r&&(r=n,u=e)});else for(;++i<o;)e[i]<u&&(u=e[i]);return u},n.mixin=B,n.noConflict=function(){return e._=U,this},n.object=function(e,t){for(var n=-1,r=e?e.length:0,i={};++n<r;){var s=e[n];t?i[s]=t[n]:i[s[0]]=s[1]}return i
|
(e?e.length:0)?f(e):E(e)},n.union=function(){return j(Z.apply(z,arguments))},n.uniq=j,n.values=E,n.where=function(e,t){var n=Lt(t);return T(e,function(e){for(var r=n.length;r--;){var i=e[n[r]]===t[n[r]];if(!i)break}return!!i})},n.without=function(e){for(var t=-1,n=e.length,r=[];++t<n;){var i=e[t];0>P(arguments,i,1)&&r.push(i)}return r},n.zip=function(e){for(var t=-1,n=e?k(L(arguments,"length")):0,r=Array(n);++t<n;)r[t]=L(arguments,t);return r},n.collect=C,n.drop=H,n.each=At,n.extend=c,n.methods=d
|
||||||
},n.omit=function(e){var t=K.apply(I,arguments),n={};return bt(e,function(e,r){0>O(t,r,1)&&(n[r]=e)}),n},n.once=function(e){var t,n=!1;return function(){return n?t:(n=!0,t=e.apply(this,arguments),e=null,t)}},n.pairs=function(e){var t=[];return wt(e,function(e,n){t.push([n,e])}),t},n.pick=function(e){for(var t=0,n=K.apply(I,arguments),r=n.length,i={};++t<r;){var s=n[t];s in e&&(i[s]=e[s])}return i},n.pluck=T,n.random=function(e,t){return null==e&&null==t&&(t=1),e=+e||0,null==t&&(t=e,e=0),e+Q(ut()*
|
,n.select=T,n.tail=H,n.unique=j,n.after=function(e,t){return 1>e?t():function(){if(1>--e)return t.apply(this,arguments)}},n.bind=F,n.clone=function(e){return e&&Et[typeof e]?kt(e)?f(e):c({},e):e},n.compose=function(){var e=arguments;return function(){for(var t=arguments,n=e.length;n--;)t=[e[n].apply(this,t)];return t[0]}},n.contains=S,n.debounce=function(e,t,n){function r(){u=null,n||(s=e.apply(o,i))}var i,s,o,u;return function(){var a=n&&!u;return i=arguments,o=this,clearTimeout(u),u=setTimeout(
|
||||||
((+t||0)-e+1))},n.range=function(e,t,n){e=+e||0,n=+n||1,null==t&&(t=e,e=0);for(var r=-1,t=st(0,J((t-e)/n)),i=Array(t);++r<t;)i[r]=e,e+=n;return i},n.reduce=N,n.reduceRight=C,n.reject=function(e,t,n){return t=s(t,n),w(e,function(e,n,r){return!t(e,n,r)})},n.rest=M,n.result=function(e,t){var n=e?e[t]:null;return d(n)?e[t]():n},n.shuffle=function(e){var t=-1,n=Array(e?e.length:0);return kt(e,function(e){var r=Q(ut()*(++t+1));n[t]=n[r],n[r]=e}),n},n.size=function(e){var t=e?e.length:0;return"number"==typeof
|
r,t),a&&(s=e.apply(o,i)),s}},n.defer=function(e){var n=f(arguments,1);return setTimeout(function(){e.apply(t,n)},1)},n.delay=function(e,n){var r=f(arguments,2);return setTimeout(function(){e.apply(t,r)},n)},n.escape=function(e){return null==e?"":(e+"").replace(Q,u)},n.every=x,n.find=N,n.has=function(e,t){return e?tt.call(e,t):!1},n.identity=I,n.indexOf=P,n.isArray=kt,n.isBoolean=function(e){return!0===e||!1===e||rt.call(e)==pt},n.isDate=function(e){return rt.call(e)==dt},n.isElement=function(e){return e?1===
|
||||||
t?t:Ct(e).length},n.some=k,n.sortBy=function(e,t,n){var i=[],t=s(t,n);kt(e,function(e,n,r){i.push({a:t(e,n,r),b:n,c:e})}),e=i.length;for(i.sort(r);e--;)i[e]=i[e].c;return i},n.sortedIndex=_,n.tap=function(e,t){return t(e),e},n.template=function(e,t,r){e||(e="");var r=xt({},r,n.templateSettings),i=0,s="__p += '",u=r.variable;e.replace(RegExp((r.escape||X).source+"|"+(r.interpolate||X).source+"|"+(r.evaluate||X).source+"|$","g"),function(t,n,r,u,a){s+=e.slice(i,a).replace($,o),s+=n?"'+_['escape']("+
|
e.nodeType:!1},n.isEmpty=function(e){if(!e)return!0;if(kt(e)||w(e))return!e.length;for(var t in e)if(tt.call(e,t))return!1;return!0},n.isEqual=m,n.isFinite=function(e){return ot(e)&&!ut(parseFloat(e))},n.isFunction=g,n.isNaN=function(e){return b(e)&&e!=+e},n.isNull=function(e){return null===e},n.isNumber=b,n.isObject=y,n.isRegExp=function(e){return rt.call(e)==gt},n.isString=w,n.isUndefined=function(e){return"undefined"==typeof e},n.lastIndexOf=function(e,t,n){var r=e?e.length:0;for("number"==typeof
|
||||||
n+")+'":u?"';"+u+";__p+='":r?"'+((__t=("+r+"))==null?'':__t)+'":"",i=a+t.length}),s+="';",u||(u="obj",s="with("+u+"||{}){"+s+"}"),s="function("+u+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+s+"return __p}";try{var a=Function("_","return "+s)(n)}catch(f){throw f.source=s,f}return t?a(t):(a.source=s,a)},n.throttle=function(e,t){function n(){u=new Date,o=null,i=e.apply(s,r)}var r,i,s,o,u=0;return function(){var a=new Date,f=t-(a-u);return r=arguments,s=this
|
n&&(r=(0>n?ft(0,r+n):lt(n,r-1))+1);r--;)if(e[r]===t)return r;return-1},n.memoize=function(e,t){var n={};return function(){var r=t?t.apply(this,arguments):arguments[0];return tt.call(n,r)?n[r]:n[r]=e.apply(this,arguments)}},n.mixin=q,n.noConflict=function(){return e._=V,this},n.once=function(e){var t,n=!1;return function(){return n?t:(n=!0,t=e.apply(this,arguments),e=null,t)}},n.random=function(e,t){return null==e&&null==t&&(t=1),e=+e||0,null==t&&(t=e,e=0),e+et(ct()*((+t||0)-e+1))},n.reduce=A,n.reduceRight=
|
||||||
,0>=f?(clearTimeout(o),u=a,i=e.apply(s,r)):o||(o=setTimeout(n,f)),i}},n.times=function(e,t,n){for(var e=+e||0,r=-1,i=Array(e);++r<e;)i[r]=t.call(n,r);return i},n.toArray=function(e){return e&&"number"==typeof e.length?"string"==typeof e?e.split(""):Z.call(e):g(e)},n.unescape=function(e){return null==e?"":(e+"").replace(z,f)},n.union=function(){return D(K.apply(I,arguments))},n.uniq=D,n.uniqueId=function(e){var t=q++;return e?e+t:t},n.values=g,n.where=function(e,t){var n=[];return bt(t,function(e,
|
O,n.result=function(e,t){var n=e?e[t]:null;return g(n)?e[t]():n},n.size=function(e){var t=e?e.length:0;return"number"==typeof t?t:Lt(e).length},n.some=M,n.sortedIndex=B,n.template=function(e,t,r){e||(e="");var r=p({},r,n.templateSettings),i=0,s="__p+='",u=r.variable;e.replace(RegExp((r.escape||K).source+"|"+(r.interpolate||K).source+"|"+(r.evaluate||K).source+"|$","g"),function(t,n,r,u,a){s+=e.slice(i,a).replace(G,o),s+=n?"'+_['escape']("+n+")+'":u?"';"+u+";__p+='":r?"'+((__t=("+r+"))==null?'':__t)+'"
|
||||||
t){n.push(t)}),w(e,function(e){for(var r=n.length;r--;){var i=e[n[r]]===t[n[r]];if(!i)break}return!!i})},n.without=function(e){for(var t=-1,n=e.length,r=[];++t<n;){var i=e[t];0>O(arguments,i,1)&&r.push(i)}return r},n.wrap=function(e,t){return function(){var n=[e];return Y.apply(n,arguments),t.apply(this,n)}},n.zip=function(e){for(var t=-1,n=e?x(T(arguments,"length")):0,r=Array(n);++t<n;)r[t]=T(arguments,t);return r},n.all=b,n.any=k,n.collect=S,n.detect=E,n.drop=M,n.each=kt,n.foldl=N,n.foldr=C,n.head=
|
:"",i=a+t.length}),s+="';\n",u||(u="obj",s="with("+u+"||{}){"+s+"}"),s="function("+u+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+s+"return __p}";try{var a=Function("_","return "+s)(n)}catch(f){throw f.source=s,f}return t?a(t):(a.source=s,a)},n.throttle=function(e,t){function n(){u=new Date,o=null,i=e.apply(s,r)}var r,i,s,o,u=0;return function(){var a=new Date,f=t-(a-u);return r=arguments,s=this,0>=f?(clearTimeout(o),o=null,u=a,i=e.apply(s,r)):o||(o=setTimeout
|
||||||
L,n.include=y,n.inject=N,n.methods=c,n.select=w,n.tail=M,n.take=L,n.unique=D,B(n),n.prototype.chain=function(){return this.__chain__=!0,this},n.prototype.value=function(){return this.__wrapped__},kt("pop push reverse shift sort splice unshift".split(" "),function(e){var t=I[e];n.prototype[e]=function(){var e=this.__wrapped__;return t.apply(e,arguments),vt&&e.length===0&&delete e[0],this.__chain__&&(e=new n(e),e.__chain__=!0),e}}),kt(["concat","join","slice"],function(e){var t=I[e];n.prototype[e]=
|
(n,f)),i}},n.unescape=function(e){return null==e?"":(e+"").replace($,l)},n.uniqueId=function(e){var t=++W+"";return e?e+t:t},n.wrap=function(e,t){return function(){var n=[e];return nt.apply(n,arguments),t.apply(this,n)}},n.all=x,n.any=M,n.detect=N,n.foldl=A,n.foldr=O,n.include=S,n.inject=A,n.first=_,n.last=function(e,t,n){if(e){var r=e.length;return null==t||n?e[r-1]:f(e,ft(0,r-t))}},n.take=_,n.head=_,n.VERSION="1.0.0-rc.2",q(n),n.prototype.chain=function(){return this.__chain__=!0,this},n.prototype
|
||||||
function(){var e=t.apply(this.__wrapped__,arguments);return this.__chain__&&(e=new n(e),e.__chain__=!0),e}}),j?"object"==typeof module&&module&&module.exports==j?(module.exports=n)._=n:j._=n:e._=n})(this);
|
.value=function(){return this.__wrapped__},At("pop push reverse shift sort splice unshift".split(" "),function(e){var t=z[e];n.prototype[e]=function(){var e=this.__wrapped__;return t.apply(e,arguments),wt&&e.length===0&&delete e[0],this}}),At(["concat","join","slice"],function(e){var t=z[e];n.prototype[e]=function(){var e=t.apply(this.__wrapped__,arguments);return this.__chain__&&(e=new n(e),e.__chain__=!0),e}}),R?"object"==typeof module&&module&&module.exports==R?(module.exports=n)._=n:R._=n:e._=
|
||||||
|
n})(this);
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "lodash",
|
"name": "lodash",
|
||||||
"version": "0.9.2",
|
"version": "1.0.0-rc.2",
|
||||||
"description": "A drop-in replacement for Underscore.js delivering performance, bug fixes, and additional features.",
|
"description": "A utility library, usable as a drop-in replacement for Underscore, delivering performance, bug fixes, and additional features.",
|
||||||
"homepage": "http://lodash.com",
|
"homepage": "http://lodash.com",
|
||||||
"main": "./lodash",
|
"main": "./lodash",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
|||||||
@@ -1600,7 +1600,7 @@
|
|||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
suites.push(
|
suites.push(
|
||||||
Benchmark.Suite('`_.toArray` with an array')
|
Benchmark.Suite('`_.toArray` with an array (edge case)')
|
||||||
.add(buildName, '\
|
.add(buildName, '\
|
||||||
lodash.toArray(numbers)'
|
lodash.toArray(numbers)'
|
||||||
)
|
)
|
||||||
|
|||||||
1
test/template/c.jst
Normal file
1
test/template/c.jst
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Hello ${ name }!
|
||||||
@@ -22,6 +22,7 @@
|
|||||||
'detect': 'find',
|
'detect': 'find',
|
||||||
'drop': 'rest',
|
'drop': 'rest',
|
||||||
'each': 'forEach',
|
'each': 'forEach',
|
||||||
|
'extend': 'assign',
|
||||||
'foldl': 'reduce',
|
'foldl': 'reduce',
|
||||||
'foldr': 'reduceRight',
|
'foldr': 'reduceRight',
|
||||||
'head': 'first',
|
'head': 'first',
|
||||||
@@ -36,6 +37,7 @@
|
|||||||
|
|
||||||
/** Used to associate real names with their aliases */
|
/** Used to associate real names with their aliases */
|
||||||
var realToAliasMap = {
|
var realToAliasMap = {
|
||||||
|
'assign': ['extend'],
|
||||||
'contains': ['include'],
|
'contains': ['include'],
|
||||||
'every': ['all'],
|
'every': ['all'],
|
||||||
'filter': ['select'],
|
'filter': ['select'],
|
||||||
@@ -130,11 +132,11 @@
|
|||||||
'after',
|
'after',
|
||||||
'bind',
|
'bind',
|
||||||
'bindAll',
|
'bindAll',
|
||||||
|
'bindKey',
|
||||||
'compose',
|
'compose',
|
||||||
'debounce',
|
'debounce',
|
||||||
'defer',
|
'defer',
|
||||||
'delay',
|
'delay',
|
||||||
'lateBind',
|
|
||||||
'memoize',
|
'memoize',
|
||||||
'once',
|
'once',
|
||||||
'partial',
|
'partial',
|
||||||
@@ -144,6 +146,7 @@
|
|||||||
|
|
||||||
/** List of "Objects" category methods */
|
/** List of "Objects" category methods */
|
||||||
var objectsMethods = [
|
var objectsMethods = [
|
||||||
|
'assign',
|
||||||
'clone',
|
'clone',
|
||||||
'defaults',
|
'defaults',
|
||||||
'extend',
|
'extend',
|
||||||
@@ -195,8 +198,11 @@
|
|||||||
var backboneDependencies = [
|
var backboneDependencies = [
|
||||||
'bind',
|
'bind',
|
||||||
'bindAll',
|
'bindAll',
|
||||||
|
'chain',
|
||||||
'clone',
|
'clone',
|
||||||
'contains',
|
'contains',
|
||||||
|
'countBy',
|
||||||
|
'defaults',
|
||||||
'escape',
|
'escape',
|
||||||
'every',
|
'every',
|
||||||
'extend',
|
'extend',
|
||||||
@@ -215,6 +221,7 @@
|
|||||||
'isFunction',
|
'isFunction',
|
||||||
'isObject',
|
'isObject',
|
||||||
'isRegExp',
|
'isRegExp',
|
||||||
|
'isString',
|
||||||
'keys',
|
'keys',
|
||||||
'last',
|
'last',
|
||||||
'lastIndexOf',
|
'lastIndexOf',
|
||||||
@@ -222,6 +229,7 @@
|
|||||||
'max',
|
'max',
|
||||||
'min',
|
'min',
|
||||||
'mixin',
|
'mixin',
|
||||||
|
'pick',
|
||||||
'reduce',
|
'reduce',
|
||||||
'reduceRight',
|
'reduceRight',
|
||||||
'reject',
|
'reject',
|
||||||
@@ -234,15 +242,16 @@
|
|||||||
'sortedIndex',
|
'sortedIndex',
|
||||||
'toArray',
|
'toArray',
|
||||||
'uniqueId',
|
'uniqueId',
|
||||||
|
'value',
|
||||||
'without'
|
'without'
|
||||||
];
|
];
|
||||||
|
|
||||||
/** List of methods used by Underscore */
|
/** List of methods used by Underscore */
|
||||||
var underscoreMethods = _.without.apply(_, [allMethods].concat([
|
var underscoreMethods = _.without.apply(_, [allMethods].concat([
|
||||||
|
'bindKey',
|
||||||
'forIn',
|
'forIn',
|
||||||
'forOwn',
|
'forOwn',
|
||||||
'isPlainObject',
|
'isPlainObject',
|
||||||
'lateBind',
|
|
||||||
'merge',
|
'merge',
|
||||||
'partial'
|
'partial'
|
||||||
]));
|
]));
|
||||||
@@ -393,7 +402,7 @@
|
|||||||
func(1, noop);
|
func(1, noop);
|
||||||
} else if (methodName == 'bindAll') {
|
} else if (methodName == 'bindAll') {
|
||||||
func({ 'noop': noop });
|
func({ 'noop': noop });
|
||||||
} else if (methodName == 'lateBind') {
|
} else if (methodName == 'bindKey') {
|
||||||
func(lodash, 'identity', array, string);
|
func(lodash, 'identity', array, string);
|
||||||
} else if (/^(?:bind|partial)$/.test(methodName)) {
|
} else if (/^(?:bind|partial)$/.test(methodName)) {
|
||||||
func(noop, object, array, string);
|
func(noop, object, array, string);
|
||||||
@@ -474,7 +483,8 @@
|
|||||||
|
|
||||||
var data = {
|
var data = {
|
||||||
'a': { 'people': ['moe', 'larry', 'curly'] },
|
'a': { 'people': ['moe', 'larry', 'curly'] },
|
||||||
'b': { 'epithet': 'stooge' }
|
'b': { 'epithet': 'stooge' },
|
||||||
|
'c': { 'name': 'ES6' }
|
||||||
};
|
};
|
||||||
|
|
||||||
context._ = _;
|
context._ = _;
|
||||||
@@ -483,6 +493,7 @@
|
|||||||
|
|
||||||
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);
|
||||||
|
equal(templates.c(data.c), 'Hello ES6!', basename);
|
||||||
delete _.templates;
|
delete _.templates;
|
||||||
start();
|
start();
|
||||||
});
|
});
|
||||||
@@ -524,14 +535,14 @@
|
|||||||
context = createContext();
|
context = createContext();
|
||||||
|
|
||||||
var data = {
|
var data = {
|
||||||
'c': { 'name': 'Mustache' }
|
'd': { 'name': 'Mustache' }
|
||||||
};
|
};
|
||||||
|
|
||||||
context._ = _;
|
context._ = _;
|
||||||
vm.runInContext(source, context);
|
vm.runInContext(source, context);
|
||||||
var templates = context._.templates;
|
var templates = context._.templates;
|
||||||
|
|
||||||
equal(templates.c(data.c), 'Hello Mustache!', basename);
|
equal(templates.d(data.d), 'Hello Mustache!', basename);
|
||||||
start();
|
start();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -550,7 +561,7 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
asyncTest('debug custom', function () {
|
asyncTest('debug custom', function() {
|
||||||
var start = _.once(QUnit.start);
|
var start = _.once(QUnit.start);
|
||||||
build(['-d', '-s', 'backbone'], function(source, filePath) {
|
build(['-d', '-s', 'backbone'], function(source, filePath) {
|
||||||
equal(path.basename(filePath, '.js'), 'lodash.custom');
|
equal(path.basename(filePath, '.js'), 'lodash.custom');
|
||||||
@@ -566,7 +577,7 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
asyncTest('minified custom', function () {
|
asyncTest('minified custom', function() {
|
||||||
var start = _.once(QUnit.start);
|
var start = _.once(QUnit.start);
|
||||||
build(['-m', '-s', 'backbone'], function(source, filePath) {
|
build(['-m', '-s', 'backbone'], function(source, filePath) {
|
||||||
equal(path.basename(filePath, '.js'), 'lodash.custom.min');
|
equal(path.basename(filePath, '.js'), 'lodash.custom.min');
|
||||||
@@ -631,7 +642,7 @@
|
|||||||
|
|
||||||
build(['-s', 'underscore'], function(source, filePath) {
|
build(['-s', 'underscore'], function(source, filePath) {
|
||||||
var last,
|
var last,
|
||||||
array = [{ 'value': 1 }, { 'value': 2 }],
|
array = [{ 'a': 1, 'b': 2 }, { 'a': 2, 'b': 2 }],
|
||||||
basename = path.basename(filePath, '.js'),
|
basename = path.basename(filePath, '.js'),
|
||||||
context = createContext();
|
context = createContext();
|
||||||
|
|
||||||
@@ -642,21 +653,36 @@
|
|||||||
equal(object.fn(), 2, '_.bind: ' + basename);
|
equal(object.fn(), 2, '_.bind: ' + basename);
|
||||||
|
|
||||||
ok(lodash.clone(array, true)[0] === array[0], '_.clone should be shallow: ' + basename);
|
ok(lodash.clone(array, true)[0] === array[0], '_.clone should be shallow: ' + basename);
|
||||||
|
equal(lodash.contains({ 'a': 1, 'b': 2 }, 1), true, '_.contains should work with objects: ' + basename);
|
||||||
equal(lodash.contains([1, 2, 3], 1, 2), true, '_.contains should ignore `fromIndex`: ' + basename);
|
equal(lodash.contains([1, 2, 3], 1, 2), true, '_.contains should ignore `fromIndex`: ' + basename);
|
||||||
equal(lodash.every([true, false, true]), false, '_.every: ' + basename);
|
equal(lodash.every([true, false, true]), false, '_.every: ' + basename);
|
||||||
|
|
||||||
var actual = lodash.forEach(array, function(value) {
|
function Foo() {}
|
||||||
|
Foo.prototype = { 'a': 1 };
|
||||||
|
|
||||||
|
deepEqual(lodash.defaults({}, new Foo), Foo.prototype, '_.defaults should assign inherited `source` properties: ' + basename);
|
||||||
|
deepEqual(lodash.extend({}, new Foo), Foo.prototype, '_.extend should assign inherited `source` properties: ' + basename);
|
||||||
|
|
||||||
|
actual = lodash.find(array, function(value) {
|
||||||
|
return 'a' in value;
|
||||||
|
});
|
||||||
|
|
||||||
|
equal(actual, _.first(array), '_.find: ' + basename);
|
||||||
|
|
||||||
|
actual = lodash.forEach(array, function(value) {
|
||||||
last = value;
|
last = value;
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
equal(last.value, 2, '_.forEach should not exit early: ' + basename);
|
equal(last, _.last(array), '_.forEach should not exit early: ' + basename);
|
||||||
equal(actual, undefined, '_.forEach should return `undefined`: ' + basename);
|
equal(actual, undefined, '_.forEach should return `undefined`: ' + basename);
|
||||||
|
|
||||||
object = { 'length': 0, 'splice': Array.prototype.splice };
|
object = { 'length': 0, 'splice': Array.prototype.splice };
|
||||||
equal(lodash.isEmpty(object), false, '_.isEmpty should return `false` for jQuery/MooTools DOM query collections: ' + basename);
|
equal(lodash.isEmpty(object), false, '_.isEmpty should return `false` for jQuery/MooTools DOM query collections: ' + basename);
|
||||||
|
|
||||||
equal(lodash.isFinite('2'), false, '_.isFinite should return `false` for numeric string values: ' + basename);
|
object = { 'a': 1, 'b': 2, 'c': 3 };
|
||||||
|
equal(lodash.isEqual(object, { 'a': 1, 'b': 0, 'c': 3 }), false, '_.isEqual: ' + basename);
|
||||||
|
|
||||||
equal(lodash.max('abc'), -Infinity, '_.max should return `-Infinity` for strings: ' + basename);
|
equal(lodash.max('abc'), -Infinity, '_.max should return `-Infinity` for strings: ' + basename);
|
||||||
equal(lodash.min('abc'), Infinity, '_.min should return `Infinity` for strings: ' + basename);
|
equal(lodash.min('abc'), Infinity, '_.min should return `Infinity` for strings: ' + basename);
|
||||||
|
|
||||||
@@ -670,6 +696,16 @@
|
|||||||
|
|
||||||
equal(lodash.some([false, true, false]), true, '_.some: ' + basename);
|
equal(lodash.some([false, true, false]), true, '_.some: ' + basename);
|
||||||
equal(lodash.template('${a}', object), '${a}', '_.template should ignore ES6 delimiters: ' + basename);
|
equal(lodash.template('${a}', object), '${a}', '_.template should ignore ES6 delimiters: ' + basename);
|
||||||
|
equal(lodash.uniqueId(0), '1', '_.uniqueId should ignore a prefix of `0`: ' + basename);
|
||||||
|
|
||||||
|
var wrapped = lodash(1);
|
||||||
|
equal(wrapped.clone() instanceof lodash, false, '_(...) wrapped values are not chainable by default: ' + basename);
|
||||||
|
equal(String(wrapped) === '1', false, '_#toString should not be implemented: ' + basename);
|
||||||
|
equal(Number(wrapped) === 1 , false, '_#valueOf should not be implemented: ' + basename);
|
||||||
|
|
||||||
|
wrapped.chain();
|
||||||
|
equal(wrapped.has('x') instanceof lodash, true, '_#has returns wrapped values when chaining: ' + basename);
|
||||||
|
|
||||||
start();
|
start();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -685,14 +721,15 @@
|
|||||||
var lodash = context._;
|
var lodash = context._;
|
||||||
|
|
||||||
_.each([
|
_.each([
|
||||||
|
'assign',
|
||||||
|
'bindKey',
|
||||||
'forIn',
|
'forIn',
|
||||||
'forOwn',
|
'forOwn',
|
||||||
'isPlainObject',
|
'isPlainObject',
|
||||||
'lateBind',
|
|
||||||
'merge',
|
'merge',
|
||||||
'partial'
|
'partial'
|
||||||
], function(methodName) {
|
], function(methodName) {
|
||||||
equal(lodash[methodName], undefined, '_.' + methodName + ' exists: ' + basename);
|
equal(lodash[methodName], undefined, '_.' + methodName + ' should not exist: ' + basename);
|
||||||
});
|
});
|
||||||
|
|
||||||
start();
|
start();
|
||||||
@@ -984,7 +1021,9 @@
|
|||||||
build(['--silent'].concat(command.split(' ')), function(source, filePath) {
|
build(['--silent'].concat(command.split(' ')), function(source, filePath) {
|
||||||
var methodNames,
|
var methodNames,
|
||||||
basename = path.basename(filePath, '.js'),
|
basename = path.basename(filePath, '.js'),
|
||||||
context = createContext();
|
context = createContext(),
|
||||||
|
isUnderscore = /underscore/.test(command),
|
||||||
|
exposeAssign = !isUnderscore;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
vm.runInContext(source, context);
|
vm.runInContext(source, context);
|
||||||
@@ -999,8 +1038,12 @@
|
|||||||
if (/backbone/.test(command) && !methodNames) {
|
if (/backbone/.test(command) && !methodNames) {
|
||||||
methodNames = backboneDependencies.slice();
|
methodNames = backboneDependencies.slice();
|
||||||
}
|
}
|
||||||
if (/underscore/.test(command) && !methodNames) {
|
if (isUnderscore) {
|
||||||
methodNames = underscoreMethods.slice();
|
if (methodNames) {
|
||||||
|
exposeAssign = methodNames.indexOf('assign') > -1;
|
||||||
|
} else {
|
||||||
|
methodNames = underscoreMethods.slice();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// add method names explicitly by category
|
// add method names explicitly by category
|
||||||
if (/category/.test(command)) {
|
if (/category/.test(command)) {
|
||||||
@@ -1034,6 +1077,9 @@
|
|||||||
// remove nonexistent and duplicate method names
|
// remove nonexistent and duplicate method names
|
||||||
methodNames = _.uniq(_.intersection(allMethods, expandMethodNames(methodNames)));
|
methodNames = _.uniq(_.intersection(allMethods, expandMethodNames(methodNames)));
|
||||||
|
|
||||||
|
if (!exposeAssign) {
|
||||||
|
methodNames = _.without(methodNames, 'assign');
|
||||||
|
}
|
||||||
var lodash = context._ || {};
|
var lodash = context._ || {};
|
||||||
methodNames.forEach(function(methodName) {
|
methodNames.forEach(function(methodName) {
|
||||||
testMethod(lodash, methodName, basename);
|
testMethod(lodash, methodName, basename);
|
||||||
|
|||||||
370
test/test.js
370
test/test.js
@@ -163,6 +163,42 @@
|
|||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
QUnit.module('lodash.assign');
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
test('should not error on `null` or `undefined` sources (test in IE < 9)', function() {
|
||||||
|
try {
|
||||||
|
deepEqual(_.assign({}, null, undefined, { 'a': 1 }), { 'a': 1 });
|
||||||
|
} catch(e) {
|
||||||
|
ok(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('skips the prototype property of functions (test in Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1)', function() {
|
||||||
|
function Foo() {}
|
||||||
|
Foo.prototype.c = 3;
|
||||||
|
|
||||||
|
Foo.a = 1;
|
||||||
|
Foo.b = 2;
|
||||||
|
|
||||||
|
var expected = { 'a': 1, 'b': 2 };
|
||||||
|
deepEqual(_.assign({}, Foo), expected);
|
||||||
|
|
||||||
|
Foo.prototype = { 'c': 3 };
|
||||||
|
deepEqual(_.assign({}, Foo), expected);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('should work with `_.reduce`', function() {
|
||||||
|
var actual = { 'a': 1},
|
||||||
|
array = [{ 'b': 2 }, { 'c': 3 }];
|
||||||
|
|
||||||
|
_.reduce(array, _.assign, actual);
|
||||||
|
deepEqual(actual, { 'a': 1, 'b': 2, 'c': 3});
|
||||||
|
});
|
||||||
|
}());
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
QUnit.module('lodash.bind');
|
QUnit.module('lodash.bind');
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
@@ -173,6 +209,36 @@
|
|||||||
bound(['b'], 'c');
|
bound(['b'], 'c');
|
||||||
deepEqual(args, ['a', ['b'], 'c']);
|
deepEqual(args, ['a', ['b'], 'c']);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('ensure `new bound` is an instance of `func`', function() {
|
||||||
|
var func = function() {},
|
||||||
|
bound = _.bind(func, {});
|
||||||
|
|
||||||
|
ok(new bound instanceof func);
|
||||||
|
});
|
||||||
|
}());
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
QUnit.module('lodash.bindKey');
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
test('should work when the target function is overwritten', function() {
|
||||||
|
var object = {
|
||||||
|
'name': 'moe',
|
||||||
|
'greet': function(greeting) {
|
||||||
|
return greeting + ': ' + this.name;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var func = _.bindKey(object, 'greet', 'hi');
|
||||||
|
equal(func(), 'hi: moe');
|
||||||
|
|
||||||
|
object.greet = function(greeting) {
|
||||||
|
return greeting + ' ' + this.name + '!';
|
||||||
|
};
|
||||||
|
equal(func(), 'hi moe!');
|
||||||
|
});
|
||||||
}());
|
}());
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
@@ -184,17 +250,17 @@
|
|||||||
Klass.prototype = { 'b': 1 };
|
Klass.prototype = { 'b': 1 };
|
||||||
|
|
||||||
var nonCloneable = {
|
var nonCloneable = {
|
||||||
'an arguments object': arguments,
|
|
||||||
'an element': window.document && document.body,
|
'an element': window.document && document.body,
|
||||||
'a function': Klass,
|
'a function': Klass
|
||||||
'a Klass instance': new Klass
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var objects = {
|
var objects = {
|
||||||
|
'an arguments object': arguments,
|
||||||
'an array': ['a', 'b', 'c', ''],
|
'an array': ['a', 'b', 'c', ''],
|
||||||
'an array-like-object': { '0': 'a', '1': 'b', '2': 'c', '3': '', 'length': 5 },
|
'an array-like-object': { '0': 'a', '1': 'b', '2': 'c', '3': '', 'length': 5 },
|
||||||
'boolean': false,
|
'boolean': false,
|
||||||
'boolean object': Object(false),
|
'boolean object': Object(false),
|
||||||
|
'a Klass instance': new Klass,
|
||||||
'an object': { 'a': 0, 'b': 1, 'c': 3 },
|
'an object': { 'a': 0, 'b': 1, 'c': 3 },
|
||||||
'an object with object values': { 'a': /a/, 'b': ['B'], 'c': { 'C': 1 } },
|
'an object with object values': { 'a': /a/, 'b': ['B'], 'c': { 'C': 1 } },
|
||||||
'an object from another document': _._object || {},
|
'an object from another document': _._object || {},
|
||||||
@@ -236,6 +302,14 @@
|
|||||||
ok(actual != expected && actual.a == expected.a && actual.b == expected.b);
|
ok(actual != expected && actual.a == expected.a && actual.b == expected.b);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('should deep clone `index` and `input` array properties', function() {
|
||||||
|
var array = /x/.exec('x'),
|
||||||
|
actual = _.clone(array, true);
|
||||||
|
|
||||||
|
equal(actual.index, 0);
|
||||||
|
equal(actual.input, 'x');
|
||||||
|
});
|
||||||
|
|
||||||
test('should deep clone objects with circular references', function() {
|
test('should deep clone objects with circular references', function() {
|
||||||
var object = {
|
var object = {
|
||||||
'foo': { 'b': { 'foo': { 'c': { } } } },
|
'foo': { 'b': { 'foo': { 'c': { } } } },
|
||||||
@@ -385,37 +459,23 @@
|
|||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
QUnit.module('lodash.extend');
|
QUnit.module('source property checks');
|
||||||
|
|
||||||
(function() {
|
_.each(['assign', 'defaults'], function(methodName) {
|
||||||
test('should not error on `null` or `undefined` sources (test in IE < 9)', function() {
|
var func = _[methodName];
|
||||||
try {
|
|
||||||
deepEqual(_.extend({}, null, undefined, { 'a': 1 }), { 'a': 1 });
|
|
||||||
} catch(e) {
|
|
||||||
ok(false);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
test('skips the prototype property of functions (test in Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1)', function() {
|
test('lodash.' + methodName + ' should not assign inherited `source` properties', function() {
|
||||||
function Foo() {}
|
function Foo() {}
|
||||||
Foo.prototype.c = 3;
|
Foo.prototype = { 'a': 1 };
|
||||||
|
deepEqual(func({}, new Foo), {});
|
||||||
Foo.a = 1;
|
|
||||||
Foo.b = 2;
|
|
||||||
|
|
||||||
var expected = { 'a': 1, 'b': 2 };
|
|
||||||
deepEqual(_.extend({}, Foo), expected);
|
|
||||||
|
|
||||||
Foo.prototype = { 'c': 3 };
|
|
||||||
deepEqual(_.extend({}, Foo), expected);
|
|
||||||
});
|
});
|
||||||
}());
|
});
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
QUnit.module('strict mode checks');
|
QUnit.module('strict mode checks');
|
||||||
|
|
||||||
_.each(['bindAll', 'defaults', 'extend'], function(methodName) {
|
_.each(['assign', 'bindAll', 'defaults'], function(methodName) {
|
||||||
var func = _[methodName];
|
var func = _[methodName];
|
||||||
|
|
||||||
test('lodash.' + methodName + ' should not throw strict mode errors', function() {
|
test('lodash.' + methodName + ' should not throw strict mode errors', function() {
|
||||||
@@ -485,10 +545,10 @@
|
|||||||
expected.push(undefined, undefined, undefined);
|
expected.push(undefined, undefined, undefined);
|
||||||
|
|
||||||
deepEqual(actual1, expected);
|
deepEqual(actual1, expected);
|
||||||
ok('4' in actual1);
|
ok(4 in actual1);
|
||||||
|
|
||||||
deepEqual(actual2, expected);
|
deepEqual(actual2, expected);
|
||||||
ok('4' in actual2);
|
ok(4 in actual2);
|
||||||
});
|
});
|
||||||
}());
|
}());
|
||||||
|
|
||||||
@@ -677,9 +737,9 @@
|
|||||||
QUnit.module('lodash.initial');
|
QUnit.module('lodash.initial');
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
test('returns an empty collection for `n` of `0`', function() {
|
test('returns a full collection for `n` of `0`', function() {
|
||||||
var array = [1, 2, 3];
|
var array = [1, 2, 3];
|
||||||
deepEqual(_.initial(array, 0), []);
|
deepEqual(_.initial(array, 0), [1, 2, 3]);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should allow a falsey `array` argument', function() {
|
test('should allow a falsey `array` argument', function() {
|
||||||
@@ -980,29 +1040,6 @@
|
|||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
QUnit.module('lodash.lateBind');
|
|
||||||
|
|
||||||
(function() {
|
|
||||||
test('should work when the target function is overwritten', function() {
|
|
||||||
var object = {
|
|
||||||
'name': 'moe',
|
|
||||||
'greet': function(greeting) {
|
|
||||||
return greeting + ': ' + this.name;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
var func = _.lateBind(object, 'greet', 'hi');
|
|
||||||
equal(func(), 'hi: moe');
|
|
||||||
|
|
||||||
object.greet = function(greeting) {
|
|
||||||
return greeting + ' ' + this.name + '!';
|
|
||||||
};
|
|
||||||
equal(func(), 'hi moe!');
|
|
||||||
});
|
|
||||||
}());
|
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
QUnit.module('lodash.map');
|
QUnit.module('lodash.map');
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
@@ -1135,6 +1172,14 @@
|
|||||||
var expected = { 'a': 4 };
|
var expected = { 'a': 4 };
|
||||||
deepEqual(_.merge({ 'a': 1 }, { 'a': 2 }, { 'a': 3 }, expected), expected);
|
deepEqual(_.merge({ 'a': 1 }, { 'a': 2 }, { 'a': 3 }, expected), expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('should work with `_.reduce`', function() {
|
||||||
|
var actual = { 'a': 1},
|
||||||
|
array = [{ 'b': 2 }, { 'c': 3 }];
|
||||||
|
|
||||||
|
_.reduce(array, _.merge, actual);
|
||||||
|
deepEqual(actual, { 'a': 1, 'b': 2, 'c': 3});
|
||||||
|
});
|
||||||
}(1, 2, 3));
|
}(1, 2, 3));
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
@@ -1345,6 +1390,17 @@
|
|||||||
QUnit.module('lodash.reduce');
|
QUnit.module('lodash.reduce');
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
test('should pass the correct `callback` arguments', function() {
|
||||||
|
var args,
|
||||||
|
array = [1, 2, 3];
|
||||||
|
|
||||||
|
_.reduce(array, function() {
|
||||||
|
args || (args = slice.call(arguments));
|
||||||
|
});
|
||||||
|
|
||||||
|
deepEqual(args, [1, 2, 1, array]);
|
||||||
|
});
|
||||||
|
|
||||||
_.each({
|
_.each({
|
||||||
'literal': 'abc',
|
'literal': 'abc',
|
||||||
'object': Object('abc')
|
'object': Object('abc')
|
||||||
@@ -1369,6 +1425,17 @@
|
|||||||
QUnit.module('lodash.reduceRight');
|
QUnit.module('lodash.reduceRight');
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
test('should pass the correct `callback` arguments when iterating an array', function() {
|
||||||
|
var args,
|
||||||
|
array = [1, 2, 3];
|
||||||
|
|
||||||
|
_.reduceRight(array, function() {
|
||||||
|
args || (args = slice.call(arguments));
|
||||||
|
});
|
||||||
|
|
||||||
|
deepEqual(args, [3, 2, 1, array]);
|
||||||
|
});
|
||||||
|
|
||||||
test('should pass the correct `callback` arguments when iterating an object', function() {
|
test('should pass the correct `callback` arguments when iterating an object', function() {
|
||||||
var args,
|
var args,
|
||||||
object = { 'a': 1, 'b': 2 },
|
object = { 'a': 1, 'b': 2 },
|
||||||
@@ -1573,7 +1640,7 @@
|
|||||||
} catch(e) {
|
} catch(e) {
|
||||||
var source = e.source;
|
var source = e.source;
|
||||||
}
|
}
|
||||||
ok((source + '').indexOf('__p') > -1);
|
ok(/__p/.test(source));
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should work with complex "interpolate" delimiters', function() {
|
test('should work with complex "interpolate" delimiters', function() {
|
||||||
@@ -1674,24 +1741,12 @@
|
|||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
test('subsequent calls should return the result of the first call', function() {
|
test('subsequent calls should return the result of the first call', function() {
|
||||||
var throttled = _.throttle(function(value) { return value; }, 90),
|
var throttled = _.throttle(function(value) { return value; }, 32),
|
||||||
result = [throttled('x'), throttled('y')];
|
result = [throttled('x'), throttled('y')];
|
||||||
|
|
||||||
deepEqual(result, ['x', 'x']);
|
deepEqual(result, ['x', 'x']);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('supports calls in a loop', function() {
|
|
||||||
var counter = 0,
|
|
||||||
throttled = _.throttle(function() { counter++; }, 90),
|
|
||||||
start = new Date,
|
|
||||||
limit = 180;
|
|
||||||
|
|
||||||
while ((new Date - start) < limit) {
|
|
||||||
throttled();
|
|
||||||
}
|
|
||||||
ok(counter > 1);
|
|
||||||
});
|
|
||||||
|
|
||||||
asyncTest('supports recursive calls', function() {
|
asyncTest('supports recursive calls', function() {
|
||||||
var counter = 0;
|
var counter = 0;
|
||||||
var throttled = _.throttle(function() {
|
var throttled = _.throttle(function() {
|
||||||
@@ -1733,6 +1788,43 @@
|
|||||||
QUnit.start();
|
QUnit.start();
|
||||||
}, 260);
|
}, 260);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
asyncTest('should not trigger a trailing call when invoked once', function() {
|
||||||
|
var counter = 0,
|
||||||
|
throttled = _.throttle(function() { counter++; }, 32);
|
||||||
|
|
||||||
|
throttled();
|
||||||
|
equal(counter, 1);
|
||||||
|
|
||||||
|
setTimeout(function() {
|
||||||
|
equal(counter, 1);
|
||||||
|
QUnit.start();
|
||||||
|
}, 64);
|
||||||
|
});
|
||||||
|
|
||||||
|
asyncTest('should trigger trailing call when invoked repeatedly', function() {
|
||||||
|
var actual,
|
||||||
|
counter = 0,
|
||||||
|
limit = 80,
|
||||||
|
throttled = _.throttle(function() { counter++; }, 32),
|
||||||
|
start = new Date;
|
||||||
|
|
||||||
|
while ((new Date - start) < limit) {
|
||||||
|
throttled();
|
||||||
|
}
|
||||||
|
setTimeout(function() {
|
||||||
|
actual = counter + 2;
|
||||||
|
throttled();
|
||||||
|
throttled();
|
||||||
|
}, 64);
|
||||||
|
|
||||||
|
setTimeout(function() {
|
||||||
|
equal(counter, actual);
|
||||||
|
QUnit.start();
|
||||||
|
}, 128);
|
||||||
|
|
||||||
|
ok(counter > 1);
|
||||||
|
});
|
||||||
}());
|
}());
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
@@ -1742,6 +1834,17 @@
|
|||||||
(function() {
|
(function() {
|
||||||
var args = arguments;
|
var args = arguments;
|
||||||
|
|
||||||
|
test('should return a dense array', function() {
|
||||||
|
var array = Array(3);
|
||||||
|
array[1] = 2;
|
||||||
|
|
||||||
|
var actual = _.toArray(array);
|
||||||
|
|
||||||
|
ok(0 in actual);
|
||||||
|
ok(2 in actual);
|
||||||
|
deepEqual(actual, array);
|
||||||
|
});
|
||||||
|
|
||||||
test('should treat array-like objects like arrays', function() {
|
test('should treat array-like objects like arrays', function() {
|
||||||
var object = { '0': 'a', '1': 'b', '2': 'c', 'length': 3 };
|
var object = { '0': 'a', '1': 'b', '2': 'c', 'length': 3 };
|
||||||
deepEqual(_.toArray(object), ['a', 'b', 'c']);
|
deepEqual(_.toArray(object), ['a', 'b', 'c']);
|
||||||
@@ -1752,6 +1855,19 @@
|
|||||||
deepEqual(_.toArray('abc'), ['a', 'b', 'c']);
|
deepEqual(_.toArray('abc'), ['a', 'b', 'c']);
|
||||||
deepEqual(_.toArray(Object('abc')), ['a', 'b', 'c']);
|
deepEqual(_.toArray(Object('abc')), ['a', 'b', 'c']);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('should work with a node list for `collection` (test in IE < 9)', function() {
|
||||||
|
if (window.document) {
|
||||||
|
try {
|
||||||
|
var nodeList = document.getElementsByTagName('body'),
|
||||||
|
body = nodeList[0],
|
||||||
|
actual = _.toArray(nodeList);
|
||||||
|
} catch(e) { }
|
||||||
|
deepEqual(actual, [body]);
|
||||||
|
} else {
|
||||||
|
skipTest();
|
||||||
|
}
|
||||||
|
});
|
||||||
}(1, 2, 3));
|
}(1, 2, 3));
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
@@ -1813,6 +1929,21 @@
|
|||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
QUnit.module('lodash.uniqueId');
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
test('should return a string value when not passing a prefix argument', function() {
|
||||||
|
equal(typeof _.uniqueId(), 'string');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('should coerce the prefix argument to a string', function() {
|
||||||
|
var actual = [_.uniqueId(3), _.uniqueId(2), _.uniqueId(1)];
|
||||||
|
equal(/3\d+,2\d+,1\d+/.test(actual), true);
|
||||||
|
});
|
||||||
|
}());
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
QUnit.module('lodash.where');
|
QUnit.module('lodash.where');
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
@@ -1833,14 +1964,13 @@
|
|||||||
deepEqual(_.where(array, { 'a': 1, 'b': 2 }), [{ 'a': 1, 'b': 2 }]);
|
deepEqual(_.where(array, { 'a': 1, 'b': 2 }), [{ 'a': 1, 'b': 2 }]);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should filter by inherited properties', function() {
|
test('should not filter by inherited properties', function() {
|
||||||
function Foo() {}
|
function Foo() {}
|
||||||
Foo.prototype = { 'b': 2 };
|
Foo.prototype = { 'a': 2 };
|
||||||
|
|
||||||
var properties = new Foo;
|
var properties = new Foo;
|
||||||
properties.a = 1;
|
properties.b = 2;
|
||||||
|
deepEqual(_.where(array, properties), [{ 'a': 1, 'b': 2 }, { 'a': 2, 'b': 2 }]);
|
||||||
deepEqual(_.where(array, properties), [{ 'a': 1, 'b': 2 }]);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should filter by problem JScript properties (test in IE < 9)', function() {
|
test('should filter by problem JScript properties (test in IE < 9)', function() {
|
||||||
@@ -1872,7 +2002,7 @@
|
|||||||
var wrapped = _({ '0': 1, 'length': 1 });
|
var wrapped = _({ '0': 1, 'length': 1 });
|
||||||
wrapped.shift();
|
wrapped.shift();
|
||||||
|
|
||||||
deepEqual(wrapped.keys(), ['length']);
|
deepEqual(wrapped.keys().value(), ['length']);
|
||||||
equal(wrapped.first(), undefined);
|
equal(wrapped.first(), undefined);
|
||||||
});
|
});
|
||||||
}());
|
}());
|
||||||
@@ -1886,13 +2016,107 @@
|
|||||||
var wrapped = _({ '0': 1, 'length': 1 });
|
var wrapped = _({ '0': 1, 'length': 1 });
|
||||||
wrapped.splice(0, 1);
|
wrapped.splice(0, 1);
|
||||||
|
|
||||||
deepEqual(wrapped.keys(), ['length']);
|
deepEqual(wrapped.keys().value(), ['length']);
|
||||||
equal(wrapped.first(), undefined);
|
equal(wrapped.first(), undefined);
|
||||||
});
|
});
|
||||||
}());
|
}());
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
QUnit.module('lodash(...).toString');
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
test('should return the `toString` result of the wrapped value', function() {
|
||||||
|
var wrapped = _([1, 2, 3]);
|
||||||
|
equal(String(wrapped), '1,2,3');
|
||||||
|
});
|
||||||
|
}());
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
QUnit.module('lodash(...).valueOf');
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
test('should return the `valueOf` result of the wrapped value', function() {
|
||||||
|
var wrapped = _(123);
|
||||||
|
equal(Number(wrapped), 123);
|
||||||
|
});
|
||||||
|
}());
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
QUnit.module('lodash(...) methods capable of returning wrapped and unwrapped values');
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
var array = [1, 2, 3],
|
||||||
|
wrapped = _(array);
|
||||||
|
|
||||||
|
var funcs = [
|
||||||
|
'first',
|
||||||
|
'last'
|
||||||
|
];
|
||||||
|
|
||||||
|
_.each(funcs, function(methodName) {
|
||||||
|
test('_.' + methodName + ' should return an unwrapped value', function() {
|
||||||
|
equal(typeof wrapped[methodName](), 'number');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('_.' + methodName + ' should return a wrapped value', function() {
|
||||||
|
ok(wrapped[methodName](1) instanceof _);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}());
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
QUnit.module('lodash(...) methods that return unwrapped values');
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
var array = [1, 2, 3],
|
||||||
|
wrapped = _(array);
|
||||||
|
|
||||||
|
var funcs = [
|
||||||
|
'contains',
|
||||||
|
'every',
|
||||||
|
'find',
|
||||||
|
'first',
|
||||||
|
'has',
|
||||||
|
'isArguments',
|
||||||
|
'isArray',
|
||||||
|
'isBoolean',
|
||||||
|
'isDate',
|
||||||
|
'isElement',
|
||||||
|
'isEmpty',
|
||||||
|
'isEqual',
|
||||||
|
'isFinite',
|
||||||
|
'isFunction',
|
||||||
|
'isNaN',
|
||||||
|
'isNull',
|
||||||
|
'isNumber',
|
||||||
|
'isObject',
|
||||||
|
'isPlainObject',
|
||||||
|
'isRegExp',
|
||||||
|
'isString',
|
||||||
|
'isUndefined',
|
||||||
|
'last',
|
||||||
|
'reduce',
|
||||||
|
'reduceRight',
|
||||||
|
'some'
|
||||||
|
];
|
||||||
|
|
||||||
|
_.each(funcs, function(methodName) {
|
||||||
|
test('_.' + methodName + ' should return unwrapped values', function() {
|
||||||
|
var result = methodName == 'reduceRight'
|
||||||
|
? wrapped[methodName](_.identity)
|
||||||
|
: wrapped[methodName];
|
||||||
|
|
||||||
|
notEqual(typeof result, 'object', '_.' + methodName + ' returns unwrapped values');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}());
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
QUnit.module('lodash methods');
|
QUnit.module('lodash methods');
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
|||||||
@@ -19,7 +19,6 @@
|
|||||||
</div>
|
</div>
|
||||||
<img id="chart_image" src="data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==">
|
<img id="chart_image" src="data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==">
|
||||||
</div>
|
</div>
|
||||||
<script src="../vendor/json3/lib/json3.js"></script>
|
|
||||||
<script src="../vendor/jquery/jquery.js"></script>
|
<script src="../vendor/jquery/jquery.js"></script>
|
||||||
<script src="../vendor/platform.js/platform.js"></script>
|
<script src="../vendor/platform.js/platform.js"></script>
|
||||||
<script>
|
<script>
|
||||||
|
|||||||
188
vendor/backbone/backbone.js
vendored
188
vendor/backbone/backbone.js
vendored
@@ -184,22 +184,20 @@
|
|||||||
var Model = Backbone.Model = function(attributes, options) {
|
var Model = Backbone.Model = function(attributes, options) {
|
||||||
var defaults;
|
var defaults;
|
||||||
var attrs = attributes || {};
|
var attrs = attributes || {};
|
||||||
if (options && options.collection) this.collection = options.collection;
|
|
||||||
this.attributes = {};
|
|
||||||
this._escapedAttributes = {};
|
|
||||||
this.cid = _.uniqueId('c');
|
this.cid = _.uniqueId('c');
|
||||||
this.changed = {};
|
this.changed = {};
|
||||||
this._changes = {};
|
this.attributes = {};
|
||||||
this._pending = {};
|
this._escapedAttributes = {};
|
||||||
|
this._modelState = [];
|
||||||
|
if (options && options.collection) this.collection = options.collection;
|
||||||
if (options && options.parse) attrs = this.parse(attrs);
|
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);
|
||||||
}
|
}
|
||||||
this.set(attrs, {silent: true});
|
this.set(attrs, {silent: true});
|
||||||
// Reset change tracking.
|
this._cleanChange = true;
|
||||||
this.changed = {};
|
this._modelState = [];
|
||||||
this._changes = {};
|
this._currentState = _.clone(this.attributes);
|
||||||
this._pending = {};
|
|
||||||
this._previousAttributes = _.clone(this.attributes);
|
this._previousAttributes = _.clone(this.attributes);
|
||||||
this.initialize.apply(this, arguments);
|
this.initialize.apply(this, arguments);
|
||||||
};
|
};
|
||||||
@@ -210,17 +208,26 @@
|
|||||||
// A hash of attributes whose current and previous value differ.
|
// A hash of attributes whose current and previous value differ.
|
||||||
changed: null,
|
changed: null,
|
||||||
|
|
||||||
// A hash of attributes that have changed since the last time `change`
|
// Whether there is a pending request to fire in the final `change` loop.
|
||||||
// was called.
|
_pending: false,
|
||||||
_changes: null,
|
|
||||||
|
|
||||||
// A hash of attributes that have changed since the last `change` event
|
// Whether the model is in the midst of a change cycle.
|
||||||
// began.
|
_changing: false,
|
||||||
_pending: null,
|
|
||||||
|
|
||||||
// A hash of attributes with the current model state to determine if
|
// Whether there has been a `set` call since the last
|
||||||
// a `change` should be recorded within a nested `change` block.
|
// calculation of the changed hash, for efficiency.
|
||||||
_changing : null,
|
_cleanChange: true,
|
||||||
|
|
||||||
|
// The model state used for comparison in determining if a
|
||||||
|
// change should be fired.
|
||||||
|
_currentState: null,
|
||||||
|
|
||||||
|
// An array queue of all changes attributed to a model
|
||||||
|
// on the next non-silent change event.
|
||||||
|
_modelState: null,
|
||||||
|
|
||||||
|
// A hash of the model's attributes when the last `change` occured.
|
||||||
|
_previousAttributes: null,
|
||||||
|
|
||||||
// The default name for the JSON `id` attribute is `"id"`. MongoDB and
|
// The default name for the JSON `id` attribute is `"id"`. MongoDB and
|
||||||
// CouchDB users may want to set this to `"_id"`.
|
// CouchDB users may want to set this to `"_id"`.
|
||||||
@@ -276,6 +283,7 @@
|
|||||||
// Extract attributes and options.
|
// Extract attributes and options.
|
||||||
var silent = options && options.silent;
|
var silent = options && options.silent;
|
||||||
var unset = options && options.unset;
|
var unset = options && options.unset;
|
||||||
|
|
||||||
if (attrs instanceof Model) attrs = attrs.attributes;
|
if (attrs instanceof Model) attrs = attrs.attributes;
|
||||||
if (unset) for (attr in attrs) attrs[attr] = void 0;
|
if (unset) for (attr in attrs) attrs[attr] = void 0;
|
||||||
|
|
||||||
@@ -285,38 +293,26 @@
|
|||||||
// Check for changes of `id`.
|
// Check for changes of `id`.
|
||||||
if (this.idAttribute in attrs) this.id = attrs[this.idAttribute];
|
if (this.idAttribute in attrs) this.id = attrs[this.idAttribute];
|
||||||
|
|
||||||
var changing = this._changing;
|
|
||||||
var now = this.attributes;
|
var now = this.attributes;
|
||||||
var escaped = this._escapedAttributes;
|
var esc = this._escapedAttributes;
|
||||||
var prev = this._previousAttributes || {};
|
|
||||||
|
|
||||||
// For each `set` attribute...
|
// For each `set` attribute...
|
||||||
for (attr in attrs) {
|
for (attr in attrs) {
|
||||||
val = attrs[attr];
|
val = attrs[attr];
|
||||||
|
|
||||||
// If the new and current value differ, record the change.
|
// If an escaped attr exists, and the new and current value differ, remove the escaped attr.
|
||||||
if (!_.isEqual(now[attr], val) || (unset && _.has(now, attr))) {
|
if (esc[attr] && !_.isEqual(now[attr], val) || (unset && _.has(now, attr))) delete esc[attr];
|
||||||
delete escaped[attr];
|
|
||||||
this._changes[attr] = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update or delete the current value.
|
// Update or delete the current value.
|
||||||
unset ? delete now[attr] : now[attr] = val;
|
unset ? delete now[attr] : now[attr] = val;
|
||||||
|
|
||||||
// If the new and previous value differ, record the change. If not,
|
// Track any action on the attribute.
|
||||||
// then remove changes for this attribute.
|
this._modelState.push(attr, val, unset);
|
||||||
if (!_.isEqual(prev[attr], val) || (_.has(now, attr) !== _.has(prev, attr))) {
|
|
||||||
this.changed[attr] = val;
|
|
||||||
if (!silent) this._pending[attr] = true;
|
|
||||||
} else {
|
|
||||||
delete this.changed[attr];
|
|
||||||
delete this._pending[attr];
|
|
||||||
if (!changing) delete this._changes[attr];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (changing && _.isEqual(now[attr], changing[attr])) delete this._changes[attr];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Signal that the model's state has potentially changed.
|
||||||
|
this._cleanChange = false;
|
||||||
|
|
||||||
// Fire the `"change"` events.
|
// Fire the `"change"` events.
|
||||||
if (!silent) this.change(options);
|
if (!silent) this.change(options);
|
||||||
return this;
|
return this;
|
||||||
@@ -341,6 +337,7 @@
|
|||||||
// triggering a `"change"` event.
|
// triggering a `"change"` event.
|
||||||
fetch: function(options) {
|
fetch: function(options) {
|
||||||
options = options ? _.clone(options) : {};
|
options = options ? _.clone(options) : {};
|
||||||
|
if (options.parse === void 0) options.parse = true;
|
||||||
var model = this;
|
var model = this;
|
||||||
var success = options.success;
|
var success = options.success;
|
||||||
options.success = function(resp, status, xhr) {
|
options.success = function(resp, status, xhr) {
|
||||||
@@ -367,7 +364,7 @@
|
|||||||
|
|
||||||
// If we're "wait"-ing to set changed attributes, validate early.
|
// If we're "wait"-ing to set changed attributes, validate early.
|
||||||
if (options.wait) {
|
if (options.wait) {
|
||||||
if (!this._validate(attrs, options)) return false;
|
if (attrs && !this._validate(attrs, options)) return false;
|
||||||
current = _.clone(this.attributes);
|
current = _.clone(this.attributes);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -461,37 +458,23 @@
|
|||||||
// a `"change:attribute"` event for each changed attribute.
|
// a `"change:attribute"` event for each changed attribute.
|
||||||
// Calling this will cause all objects observing the model to update.
|
// Calling this will cause all objects observing the model to update.
|
||||||
change: function(options) {
|
change: function(options) {
|
||||||
var changing = this._changing;
|
var i, changing = this._changing;
|
||||||
var current = this._changing = {};
|
this._changing = true;
|
||||||
|
|
||||||
// Silent changes become pending changes.
|
// Generate the changes to be triggered on the model.
|
||||||
for (var attr in this._changes) this._pending[attr] = true;
|
var triggers = this._changeCenter(true);
|
||||||
|
this._pending = triggers.length;
|
||||||
|
|
||||||
// Trigger 'change:attr' for any new or silent changes.
|
for (i = triggers.length - 2; i >= 0; i -= 2) {
|
||||||
var changes = this._changes;
|
this.trigger('change:' + triggers[i], this, triggers[i + 1], options);
|
||||||
this._changes = {};
|
|
||||||
|
|
||||||
// Set the correct state for this._changing values
|
|
||||||
var triggers = [];
|
|
||||||
for (var attr in changes) {
|
|
||||||
current[attr] = this.get(attr);
|
|
||||||
triggers.push(attr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var i=0, l=triggers.length; i < l; i++) {
|
|
||||||
this.trigger('change:' + triggers[i], this, current[triggers[i]], options);
|
|
||||||
}
|
|
||||||
if (changing) return this;
|
if (changing) return this;
|
||||||
|
|
||||||
// Continue firing `"change"` events while there are pending changes.
|
// Trigger a `change` while there have been changes.
|
||||||
while (!_.isEmpty(this._pending)) {
|
while (this._pending) {
|
||||||
this._pending = {};
|
this._pending = false;
|
||||||
this.trigger('change', this, options);
|
this.trigger('change', this, options);
|
||||||
// Pending and silent changes still remain.
|
|
||||||
for (var attr in this.changed) {
|
|
||||||
if (this._pending[attr] || this._changes[attr]) continue;
|
|
||||||
delete this.changed[attr];
|
|
||||||
}
|
|
||||||
this._previousAttributes = _.clone(this.attributes);
|
this._previousAttributes = _.clone(this.attributes);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -502,6 +485,7 @@
|
|||||||
// Determine if the model has changed since the last `"change"` event.
|
// Determine if the model has changed since the last `"change"` event.
|
||||||
// If you specify an attribute name, determine if that attribute has changed.
|
// If you specify an attribute name, determine if that attribute has changed.
|
||||||
hasChanged: function(attr) {
|
hasChanged: function(attr) {
|
||||||
|
if (!this._cleanChange) this._changeCenter();
|
||||||
if (attr == null) return !_.isEmpty(this.changed);
|
if (attr == null) return !_.isEmpty(this.changed);
|
||||||
return _.has(this.changed, attr);
|
return _.has(this.changed, attr);
|
||||||
},
|
},
|
||||||
@@ -522,6 +506,42 @@
|
|||||||
return changed;
|
return changed;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Calculates and handles any changes in `this._modelState`,
|
||||||
|
// checking against `this._currentState` to determine current changes.
|
||||||
|
_changeCenter: function (change) {
|
||||||
|
this.changed = {};
|
||||||
|
var local = {};
|
||||||
|
var triggers = [];
|
||||||
|
var modelState = this._modelState;
|
||||||
|
var currentState = this._currentState;
|
||||||
|
|
||||||
|
// Loop through the current queue of potential model changes.
|
||||||
|
for (var i = modelState.length - 3; i >= 0; i -= 3) {
|
||||||
|
var key = modelState[i], val = modelState[i + 1], unset = modelState[i + 2];
|
||||||
|
|
||||||
|
// If the item hasn't been set locally this round, proceed.
|
||||||
|
if (!local[key]) {
|
||||||
|
local[key] = val;
|
||||||
|
|
||||||
|
// Check if the attribute has been modified since the last change,
|
||||||
|
// and update `this.changed` accordingly.
|
||||||
|
if (currentState[key] !== val || (_.has(currentState, key) && unset)) {
|
||||||
|
this.changed[key] = val;
|
||||||
|
|
||||||
|
// Triggers & modifications are only created inside a `change` call.
|
||||||
|
if (!change) continue;
|
||||||
|
triggers.push(key, val);
|
||||||
|
(!unset) ? currentState[key] = val : delete currentState[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
modelState.splice(i,3);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Signals `this.changed` is current to prevent duplicate calls from `this.hasChanged`.
|
||||||
|
this._cleanChange = true;
|
||||||
|
return triggers;
|
||||||
|
},
|
||||||
|
|
||||||
// Get the previous value of an attribute, recorded at the time the last
|
// Get the previous value of an attribute, recorded at the time the last
|
||||||
// `"change"` event was fired.
|
// `"change"` event was fired.
|
||||||
previous: function(attr) {
|
previous: function(attr) {
|
||||||
@@ -599,26 +619,27 @@
|
|||||||
// Add a model, or list of models to the set. Pass **silent** to avoid
|
// Add a model, or list of models to the set. Pass **silent** to avoid
|
||||||
// firing the `add` event for every new model.
|
// firing the `add` event for every new model.
|
||||||
add: function(models, options) {
|
add: function(models, options) {
|
||||||
var i, args, length, model, existing;
|
var i, args, length, model, existing, sort;
|
||||||
var at = options && options.at;
|
var at = options && options.at;
|
||||||
models = _.isArray(models) ? models.slice() : [models];
|
models = _.isArray(models) ? models.slice() : [models];
|
||||||
|
|
||||||
// Begin by turning bare objects into model references, and preventing
|
// Turn bare objects into model references, and prevent invalid models
|
||||||
// invalid models from being added.
|
// from being added.
|
||||||
for (i = 0, length = models.length; i < length; i++) {
|
|
||||||
if (models[i] = this._prepareModel(models[i], options)) continue;
|
|
||||||
throw new Error("Can't add an invalid model to a collection");
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = models.length - 1; i >= 0; i--) {
|
for (i = models.length - 1; i >= 0; i--) {
|
||||||
model = models[i];
|
if(!(model = this._prepareModel(models[i], options))) {
|
||||||
existing = model.id != null && this._byId[model.id];
|
this.trigger("error", this, models[i], options);
|
||||||
|
models.splice(i, 1);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
models[i] = model;
|
||||||
|
|
||||||
// If a duplicate is found, splice it out and optionally merge it into
|
existing = model.id != null && this._byId[model.id];
|
||||||
// the existing model.
|
// If a duplicate is found, prevent it from being added and
|
||||||
|
// optionally merge it into the existing model.
|
||||||
if (existing || this._byCid[model.cid]) {
|
if (existing || this._byCid[model.cid]) {
|
||||||
if (options && options.merge && existing) {
|
if (options && options.merge && existing) {
|
||||||
existing.set(model, options);
|
existing.set(model, options);
|
||||||
|
sort = true;
|
||||||
}
|
}
|
||||||
models.splice(i, 1);
|
models.splice(i, 1);
|
||||||
continue;
|
continue;
|
||||||
@@ -631,14 +652,15 @@
|
|||||||
if (model.id != null) this._byId[model.id] = model;
|
if (model.id != null) this._byId[model.id] = model;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update `length` and splice in new models.
|
// See if sorting is needed, update `length` and splice in new models.
|
||||||
|
if (models.length) sort = true;
|
||||||
this.length += models.length;
|
this.length += models.length;
|
||||||
args = [at != null ? at : this.models.length, 0];
|
args = [at != null ? at : this.models.length, 0];
|
||||||
push.apply(args, models);
|
push.apply(args, models);
|
||||||
splice.apply(this.models, args);
|
splice.apply(this.models, args);
|
||||||
|
|
||||||
// Sort the collection if appropriate.
|
// Sort the collection if appropriate.
|
||||||
if (this.comparator && at == null) this.sort({silent: true});
|
if (sort && this.comparator && at == null) this.sort({silent: true});
|
||||||
|
|
||||||
if (options && options.silent) return this;
|
if (options && options.silent) return this;
|
||||||
|
|
||||||
@@ -821,7 +843,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
// Reset all internal state. Called when the collection is reset.
|
// Reset all internal state. Called when the collection is reset.
|
||||||
_reset: function(options) {
|
_reset: function() {
|
||||||
this.length = 0;
|
this.length = 0;
|
||||||
this.models = [];
|
this.models = [];
|
||||||
this._byId = {};
|
this._byId = {};
|
||||||
@@ -988,8 +1010,8 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Cached regex for cleaning leading hashes and slashes.
|
// Cached regex for stripping a leading hash/slash and trailing space.
|
||||||
var routeStripper = /^[#\/]|\s+$/;
|
var routeStripper = /^[#\/]|\s+$/g;
|
||||||
|
|
||||||
// Cached regex for stripping leading and trailing slashes.
|
// Cached regex for stripping leading and trailing slashes.
|
||||||
var rootStripper = /^\/+|\/+$/g;
|
var rootStripper = /^\/+|\/+$/g;
|
||||||
@@ -1204,7 +1226,7 @@
|
|||||||
var delegateEventSplitter = /^(\S+)\s*(.*)$/;
|
var delegateEventSplitter = /^(\S+)\s*(.*)$/;
|
||||||
|
|
||||||
// List of view options to be merged as properties.
|
// List of view options to be merged as properties.
|
||||||
var viewOptions = ['model', 'collection', 'el', 'id', 'attributes', 'className', 'tagName'];
|
var viewOptions = ['model', 'collection', 'el', 'id', 'attributes', 'className', 'tagName', 'events'];
|
||||||
|
|
||||||
// Set up all inheritable **Backbone.View** properties and methods.
|
// Set up all inheritable **Backbone.View** properties and methods.
|
||||||
_.extend(View.prototype, Events, {
|
_.extend(View.prototype, Events, {
|
||||||
@@ -1313,7 +1335,7 @@
|
|||||||
// Keys with special meaning *(model, collection, id, className)*, are
|
// Keys with special meaning *(model, collection, id, className)*, are
|
||||||
// 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({}, _.result(this, 'options'), options);
|
||||||
_.extend(this, _.pick(options, viewOptions));
|
_.extend(this, _.pick(options, viewOptions));
|
||||||
this.options = options;
|
this.options = options;
|
||||||
},
|
},
|
||||||
@@ -1381,7 +1403,7 @@
|
|||||||
// Ensure that we have the appropriate request data.
|
// Ensure that we have the appropriate request data.
|
||||||
if (!options.data && model && (method === 'create' || method === 'update')) {
|
if (!options.data && model && (method === 'create' || method === 'update')) {
|
||||||
params.contentType = 'application/json';
|
params.contentType = 'application/json';
|
||||||
params.data = JSON.stringify(model);
|
params.data = JSON.stringify(model.toJSON(options));
|
||||||
}
|
}
|
||||||
|
|
||||||
// For older servers, emulate JSON by encoding the request into an HTML-form.
|
// For older servers, emulate JSON by encoding the request into an HTML-form.
|
||||||
|
|||||||
42
vendor/backbone/test/collection.js
vendored
42
vendor/backbone/test/collection.js
vendored
@@ -542,8 +542,7 @@ $(document).ready(function() {
|
|||||||
equal(col.length, 0);
|
equal(col.length, 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("#861, adding models to a collection which do not pass validation", 1, function() {
|
test("#861, adding models to a collection which do not pass validation", 2, function() {
|
||||||
raises(function() {
|
|
||||||
var Model = Backbone.Model.extend({
|
var Model = Backbone.Model.extend({
|
||||||
validate: function(attrs) {
|
validate: function(attrs) {
|
||||||
if (attrs.id == 3) return "id can't be 3";
|
if (attrs.id == 3) return "id can't be 3";
|
||||||
@@ -554,26 +553,26 @@ $(document).ready(function() {
|
|||||||
model: Model
|
model: Model
|
||||||
});
|
});
|
||||||
|
|
||||||
var col = new Collection;
|
var collection = new Collection;
|
||||||
|
collection.on("error", function() { ok(true); });
|
||||||
|
|
||||||
col.add([{id: 1}, {id: 2}, {id: 3}, {id: 4}, {id: 5}, {id: 6}]);
|
collection.add([{id: 1}, {id: 2}, {id: 3}, {id: 4}, {id: 5}, {id: 6}]);
|
||||||
}, function(e) {
|
deepEqual(collection.pluck('id'), [1, 2, 4, 5, 6]);
|
||||||
return e.message === "Can't add an invalid model to a collection";
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test("throwing during add leaves consistent state", 4, function() {
|
test("Invalid models are discarded.", 5, function() {
|
||||||
var col = new Backbone.Collection();
|
var collection = new Backbone.Collection;
|
||||||
col.on('test', function() { ok(false); });
|
collection.on('test', function() { ok(true); });
|
||||||
col.model = Backbone.Model.extend({
|
collection.model = Backbone.Model.extend({
|
||||||
validate: function(attrs){ if (!attrs.valid) return 'invalid'; }
|
validate: function(attrs){ if (!attrs.valid) return 'invalid'; }
|
||||||
});
|
});
|
||||||
var model = new col.model({id: 1, valid: true});
|
var model = new collection.model({id: 1, valid: true});
|
||||||
raises(function() { col.add([model, {id: 2}]); });
|
collection.add([model, {id: 2}]);;
|
||||||
model.trigger('test');
|
model.trigger('test');
|
||||||
ok(!col.getByCid(model.cid));
|
ok(collection.getByCid(model.cid));
|
||||||
ok(!col.get(1));
|
ok(collection.get(1));
|
||||||
equal(col.length, 0);
|
ok(!collection.get(2));
|
||||||
|
equal(collection.length, 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("multiple copies of the same model", 3, function() {
|
test("multiple copies of the same model", 3, function() {
|
||||||
@@ -716,4 +715,15 @@ $(document).ready(function() {
|
|||||||
this.ajaxSettings.success([model]);
|
this.ajaxSettings.success([model]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("`sort` shouldn't always fire on `add`", 1, function() {
|
||||||
|
var c = new Backbone.Collection([{id: 1}, {id: 2}, {id: 3}], {
|
||||||
|
comparator: 'id'
|
||||||
|
});
|
||||||
|
c.sort = function(){ ok(true); };
|
||||||
|
c.add([]);
|
||||||
|
c.add({id: 1});
|
||||||
|
c.add([{id: 2}, {id: 3}]);
|
||||||
|
c.add({id: 4});
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
22
vendor/backbone/test/model.js
vendored
22
vendor/backbone/test/model.js
vendored
@@ -99,7 +99,7 @@ $(document).ready(function() {
|
|||||||
equal(model.url(), '/nested/1/collection/2');
|
equal(model.url(), '/nested/1/collection/2');
|
||||||
});
|
});
|
||||||
|
|
||||||
test("clone", 8, function() {
|
test("clone", 10, function() {
|
||||||
var a = new Backbone.Model({ 'foo': 1, 'bar': 2, 'baz': 3});
|
var a = new Backbone.Model({ 'foo': 1, 'bar': 2, 'baz': 3});
|
||||||
var b = a.clone();
|
var b = a.clone();
|
||||||
equal(a.get('foo'), 1);
|
equal(a.get('foo'), 1);
|
||||||
@@ -111,6 +111,12 @@ $(document).ready(function() {
|
|||||||
a.set({foo : 100});
|
a.set({foo : 100});
|
||||||
equal(a.get('foo'), 100);
|
equal(a.get('foo'), 100);
|
||||||
equal(b.get('foo'), 1, "Changing a parent attribute does not change the clone.");
|
equal(b.get('foo'), 1, "Changing a parent attribute does not change the clone.");
|
||||||
|
|
||||||
|
var foo = new Backbone.Model({p: 1});
|
||||||
|
var bar = new Backbone.Model({p: 2});
|
||||||
|
bar.set(foo.clone(), {unset: true});
|
||||||
|
equal(foo.get('p'), 1);
|
||||||
|
equal(bar.get('p'), undefined);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("isNew", 6, function() {
|
test("isNew", 6, function() {
|
||||||
@@ -897,4 +903,18 @@ $(document).ready(function() {
|
|||||||
expect(0);
|
expect(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("silent changes in last `change` event back to original does not trigger change", 2, function() {
|
||||||
|
var changes = [];
|
||||||
|
var model = new Backbone.Model();
|
||||||
|
model.on('change:a change:b change:c', function(model, val) { changes.push(val); });
|
||||||
|
model.on('change', function() {
|
||||||
|
model.set({a:'c'}, {silent:true});
|
||||||
|
});
|
||||||
|
model.set({a:'a'});
|
||||||
|
deepEqual(changes, ['a']);
|
||||||
|
model.set({a:'a'}, {silent:true});
|
||||||
|
model.change();
|
||||||
|
deepEqual(changes, ['a']);
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
5
vendor/backbone/test/router.js
vendored
5
vendor/backbone/test/router.js
vendored
@@ -497,4 +497,9 @@ $(document).ready(function() {
|
|||||||
strictEqual(history.getFragment('fragment '), 'fragment');
|
strictEqual(history.getFragment('fragment '), 'fragment');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("#1820 - Leading slash and trailing space.", 1, function() {
|
||||||
|
var history = new Backbone.History;
|
||||||
|
strictEqual(history.getFragment('/fragment '), 'fragment');
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
48
vendor/backbone/test/view.js
vendored
48
vendor/backbone/test/view.js
vendored
@@ -165,6 +165,30 @@ $(document).ready(function() {
|
|||||||
strictEqual(new View().el.id, 'id');
|
strictEqual(new View().el.id, 'id');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("with options function", 3, function() {
|
||||||
|
var View1 = Backbone.View.extend({
|
||||||
|
options: function() {
|
||||||
|
return {
|
||||||
|
title: 'title1',
|
||||||
|
acceptText: 'confirm'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var View2 = View1.extend({
|
||||||
|
options: function() {
|
||||||
|
return _.extend(View1.prototype.options.call(this), {
|
||||||
|
title: 'title2',
|
||||||
|
fixed: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
strictEqual(new View2().options.title, 'title2');
|
||||||
|
strictEqual(new View2().options.acceptText, 'confirm');
|
||||||
|
strictEqual(new View2().options.fixed, true);
|
||||||
|
});
|
||||||
|
|
||||||
test("with attributes", 2, function() {
|
test("with attributes", 2, function() {
|
||||||
var View = Backbone.View.extend({
|
var View = Backbone.View.extend({
|
||||||
attributes: {
|
attributes: {
|
||||||
@@ -331,4 +355,28 @@ $(document).ready(function() {
|
|||||||
ok(view.$el.is('p:has(a)'));
|
ok(view.$el.is('p:has(a)'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("events passed in options", 2, function() {
|
||||||
|
var counter = 0;
|
||||||
|
|
||||||
|
var View = Backbone.View.extend({
|
||||||
|
el: '<p><a id="test"></a></p>',
|
||||||
|
increment: function() {
|
||||||
|
counter++;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var view = new View({events:{'click #test':'increment'}});
|
||||||
|
var view2 = new View({events:function(){
|
||||||
|
return {'click #test':'increment'};
|
||||||
|
}});
|
||||||
|
|
||||||
|
view.$('#test').trigger('click');
|
||||||
|
view2.$('#test').trigger('click');
|
||||||
|
equal(counter, 2);
|
||||||
|
|
||||||
|
view.$('#test').trigger('click');
|
||||||
|
view2.$('#test').trigger('click');
|
||||||
|
equal(counter, 4);
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
82
vendor/requirejs/require.js
vendored
82
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.1 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
|
* @license RequireJS 2.1.2 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.1',
|
version = '2.1.2',
|
||||||
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$/,
|
||||||
@@ -81,6 +81,10 @@ var requirejs, require, define;
|
|||||||
return hasOwn.call(obj, prop);
|
return hasOwn.call(obj, prop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getOwn(obj, prop) {
|
||||||
|
return hasProp(obj, prop) && obj[prop];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cycles over properties in an object and calls a function for each
|
* Cycles over properties in an object and calls a function for each
|
||||||
* property value. If the function returns a truthy value, then the
|
* property value. If the function returns a truthy value, then the
|
||||||
@@ -89,7 +93,7 @@ var requirejs, require, define;
|
|||||||
function eachProp(obj, func) {
|
function eachProp(obj, func) {
|
||||||
var prop;
|
var prop;
|
||||||
for (prop in obj) {
|
for (prop in obj) {
|
||||||
if (obj.hasOwnProperty(prop)) {
|
if (hasProp(obj, prop)) {
|
||||||
if (func(obj[prop], prop)) {
|
if (func(obj[prop], prop)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -261,7 +265,7 @@ var requirejs, require, define;
|
|||||||
//otherwise, assume it is a top-level require that will
|
//otherwise, assume it is a top-level require that will
|
||||||
//be relative to baseUrl in the end.
|
//be relative to baseUrl in the end.
|
||||||
if (baseName) {
|
if (baseName) {
|
||||||
if (config.pkgs[baseName]) {
|
if (getOwn(config.pkgs, baseName)) {
|
||||||
//If the baseName is a package name, then just treat it as one
|
//If the baseName is a package name, then just treat it as one
|
||||||
//name to concat the name with.
|
//name to concat the name with.
|
||||||
normalizedBaseParts = baseParts = [baseName];
|
normalizedBaseParts = baseParts = [baseName];
|
||||||
@@ -279,7 +283,7 @@ var requirejs, require, define;
|
|||||||
|
|
||||||
//Some use of packages may use a . path to reference the
|
//Some use of packages may use a . path to reference the
|
||||||
//'main' module name, so normalize for that.
|
//'main' module name, so normalize for that.
|
||||||
pkgConfig = config.pkgs[(pkgName = name[0])];
|
pkgConfig = getOwn(config.pkgs, (pkgName = name[0]));
|
||||||
name = name.join('/');
|
name = name.join('/');
|
||||||
if (pkgConfig && name === pkgName + '/' + pkgConfig.main) {
|
if (pkgConfig && name === pkgName + '/' + pkgConfig.main) {
|
||||||
name = pkgName;
|
name = pkgName;
|
||||||
@@ -302,12 +306,12 @@ var requirejs, require, define;
|
|||||||
//Find the longest baseName segment match in the config.
|
//Find the longest baseName segment match in the config.
|
||||||
//So, do joins on the biggest to smallest lengths of baseParts.
|
//So, do joins on the biggest to smallest lengths of baseParts.
|
||||||
for (j = baseParts.length; j > 0; j -= 1) {
|
for (j = baseParts.length; j > 0; j -= 1) {
|
||||||
mapValue = map[baseParts.slice(0, j).join('/')];
|
mapValue = getOwn(map, baseParts.slice(0, j).join('/'));
|
||||||
|
|
||||||
//baseName segment has config, find if it has one for
|
//baseName segment has config, find if it has one for
|
||||||
//this name.
|
//this name.
|
||||||
if (mapValue) {
|
if (mapValue) {
|
||||||
mapValue = mapValue[nameSegment];
|
mapValue = getOwn(mapValue, nameSegment);
|
||||||
if (mapValue) {
|
if (mapValue) {
|
||||||
//Match, update name to the new value.
|
//Match, update name to the new value.
|
||||||
foundMap = mapValue;
|
foundMap = mapValue;
|
||||||
@@ -325,8 +329,8 @@ var requirejs, require, define;
|
|||||||
//Check for a star map match, but just hold on to it,
|
//Check for a star map match, but just hold on to it,
|
||||||
//if there is a shorter segment match later in a matching
|
//if there is a shorter segment match later in a matching
|
||||||
//config, then favor over this star map.
|
//config, then favor over this star map.
|
||||||
if (!foundStarMap && starMap && starMap[nameSegment]) {
|
if (!foundStarMap && starMap && getOwn(starMap, nameSegment)) {
|
||||||
foundStarMap = starMap[nameSegment];
|
foundStarMap = getOwn(starMap, nameSegment);
|
||||||
starI = i;
|
starI = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -358,7 +362,7 @@ var requirejs, require, define;
|
|||||||
}
|
}
|
||||||
|
|
||||||
function hasPathFallback(id) {
|
function hasPathFallback(id) {
|
||||||
var pathConfig = config.paths[id];
|
var pathConfig = getOwn(config.paths, id);
|
||||||
if (pathConfig && isArray(pathConfig) && pathConfig.length > 1) {
|
if (pathConfig && isArray(pathConfig) && pathConfig.length > 1) {
|
||||||
removeScript(id);
|
removeScript(id);
|
||||||
//Pop off the first array value, since it failed, and
|
//Pop off the first array value, since it failed, and
|
||||||
@@ -419,7 +423,7 @@ var requirejs, require, define;
|
|||||||
|
|
||||||
if (prefix) {
|
if (prefix) {
|
||||||
prefix = normalize(prefix, parentName, applyMap);
|
prefix = normalize(prefix, parentName, applyMap);
|
||||||
pluginModule = defined[prefix];
|
pluginModule = getOwn(defined, prefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Account for relative paths if there is a base name.
|
//Account for relative paths if there is a base name.
|
||||||
@@ -472,7 +476,7 @@ var requirejs, require, define;
|
|||||||
|
|
||||||
function getModule(depMap) {
|
function getModule(depMap) {
|
||||||
var id = depMap.id,
|
var id = depMap.id,
|
||||||
mod = registry[id];
|
mod = getOwn(registry, id);
|
||||||
|
|
||||||
if (!mod) {
|
if (!mod) {
|
||||||
mod = registry[id] = new context.Module(depMap);
|
mod = registry[id] = new context.Module(depMap);
|
||||||
@@ -483,7 +487,7 @@ var requirejs, require, define;
|
|||||||
|
|
||||||
function on(depMap, name, fn) {
|
function on(depMap, name, fn) {
|
||||||
var id = depMap.id,
|
var id = depMap.id,
|
||||||
mod = registry[id];
|
mod = getOwn(registry, id);
|
||||||
|
|
||||||
if (hasProp(defined, id) &&
|
if (hasProp(defined, id) &&
|
||||||
(!mod || mod.defineEmitComplete)) {
|
(!mod || mod.defineEmitComplete)) {
|
||||||
@@ -503,7 +507,7 @@ var requirejs, require, define;
|
|||||||
errback(err);
|
errback(err);
|
||||||
} else {
|
} else {
|
||||||
each(ids, function (id) {
|
each(ids, function (id) {
|
||||||
var mod = registry[id];
|
var mod = getOwn(registry, id);
|
||||||
if (mod) {
|
if (mod) {
|
||||||
//Set error on module, so it skips timeout checks.
|
//Set error on module, so it skips timeout checks.
|
||||||
mod.error = err;
|
mod.error = err;
|
||||||
@@ -562,7 +566,7 @@ var requirejs, require, define;
|
|||||||
id: mod.map.id,
|
id: mod.map.id,
|
||||||
uri: mod.map.url,
|
uri: mod.map.url,
|
||||||
config: function () {
|
config: function () {
|
||||||
return (config.config && config.config[mod.map.id]) || {};
|
return (config.config && getOwn(config.config, mod.map.id)) || {};
|
||||||
},
|
},
|
||||||
exports: defined[mod.map.id]
|
exports: defined[mod.map.id]
|
||||||
});
|
});
|
||||||
@@ -584,14 +588,14 @@ var requirejs, require, define;
|
|||||||
traced[id] = true;
|
traced[id] = true;
|
||||||
each(mod.depMaps, function (depMap, i) {
|
each(mod.depMaps, function (depMap, i) {
|
||||||
var depId = depMap.id,
|
var depId = depMap.id,
|
||||||
dep = registry[depId];
|
dep = getOwn(registry, depId);
|
||||||
|
|
||||||
//Only force things that have not completed
|
//Only force things that have not completed
|
||||||
//being defined, so still in the registry,
|
//being defined, so still in the registry,
|
||||||
//and only if it has not been matched up
|
//and only if it has not been matched up
|
||||||
//in the module already.
|
//in the module already.
|
||||||
if (dep && !mod.depMatched[i] && !processed[depId]) {
|
if (dep && !mod.depMatched[i] && !processed[depId]) {
|
||||||
if (traced[depId]) {
|
if (getOwn(traced, depId)) {
|
||||||
mod.defineDep(i, defined[depId]);
|
mod.defineDep(i, defined[depId]);
|
||||||
mod.check(); //pass false?
|
mod.check(); //pass false?
|
||||||
} else {
|
} else {
|
||||||
@@ -691,9 +695,9 @@ var requirejs, require, define;
|
|||||||
}
|
}
|
||||||
|
|
||||||
Module = function (map) {
|
Module = function (map) {
|
||||||
this.events = undefEvents[map.id] || {};
|
this.events = getOwn(undefEvents, map.id) || {};
|
||||||
this.map = map;
|
this.map = map;
|
||||||
this.shim = config.shim[map.id];
|
this.shim = getOwn(config.shim, map.id);
|
||||||
this.depExports = [];
|
this.depExports = [];
|
||||||
this.depMaps = [];
|
this.depMaps = [];
|
||||||
this.depMatched = [];
|
this.depMatched = [];
|
||||||
@@ -940,7 +944,7 @@ var requirejs, require, define;
|
|||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
normalizedMod = registry[normalizedMap.id];
|
normalizedMod = getOwn(registry, normalizedMap.id);
|
||||||
if (normalizedMod) {
|
if (normalizedMod) {
|
||||||
//Mark this as a dependency for this plugin, so it
|
//Mark this as a dependency for this plugin, so it
|
||||||
//can be traced for cycles.
|
//can be traced for cycles.
|
||||||
@@ -1005,6 +1009,11 @@ var requirejs, require, define;
|
|||||||
//it.
|
//it.
|
||||||
getModule(moduleMap);
|
getModule(moduleMap);
|
||||||
|
|
||||||
|
//Transfer any config to this other module.
|
||||||
|
if (hasProp(config.config, id)) {
|
||||||
|
config.config[moduleName] = config.config[id];
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
req.exec(text);
|
req.exec(text);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -1060,7 +1069,7 @@ var requirejs, require, define;
|
|||||||
!this.skipMap);
|
!this.skipMap);
|
||||||
this.depMaps[i] = depMap;
|
this.depMaps[i] = depMap;
|
||||||
|
|
||||||
handler = handlers[depMap.id];
|
handler = getOwn(handlers, depMap.id);
|
||||||
|
|
||||||
if (handler) {
|
if (handler) {
|
||||||
this.depExports[i] = handler(this);
|
this.depExports[i] = handler(this);
|
||||||
@@ -1085,7 +1094,7 @@ var requirejs, require, define;
|
|||||||
//Skip special modules like 'require', 'exports', 'module'
|
//Skip special modules like 'require', 'exports', 'module'
|
||||||
//Also, don't call enable if it is already enabled,
|
//Also, don't call enable if it is already enabled,
|
||||||
//important in circular dependency cases.
|
//important in circular dependency cases.
|
||||||
if (!handlers[id] && mod && !mod.enabled) {
|
if (!hasProp(handlers, id) && mod && !mod.enabled) {
|
||||||
context.enable(depMap, this);
|
context.enable(depMap, this);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
@@ -1093,7 +1102,7 @@ var requirejs, require, define;
|
|||||||
//Enable each plugin that is used in
|
//Enable each plugin that is used in
|
||||||
//a dependency
|
//a dependency
|
||||||
eachProp(this.pluginMaps, bind(this, function (pluginMap) {
|
eachProp(this.pluginMaps, bind(this, function (pluginMap) {
|
||||||
var mod = registry[pluginMap.id];
|
var mod = getOwn(registry, pluginMap.id);
|
||||||
if (mod && !mod.enabled) {
|
if (mod && !mod.enabled) {
|
||||||
context.enable(pluginMap, this);
|
context.enable(pluginMap, this);
|
||||||
}
|
}
|
||||||
@@ -1126,7 +1135,10 @@ var requirejs, require, define;
|
|||||||
};
|
};
|
||||||
|
|
||||||
function callGetModule(args) {
|
function callGetModule(args) {
|
||||||
getModule(makeModuleMap(args[0], null, true)).init(args[1], args[2]);
|
//Skip modules already defined.
|
||||||
|
if (!hasProp(defined, args[0])) {
|
||||||
|
getModule(makeModuleMap(args[0], null, true)).init(args[1], args[2]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeListener(node, func, name, ieName) {
|
function removeListener(node, func, name, ieName) {
|
||||||
@@ -1239,7 +1251,7 @@ var requirejs, require, define;
|
|||||||
deps: value
|
deps: value
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (value.exports && !value.exportsFn) {
|
if ((value.exports || value.init) && !value.exportsFn) {
|
||||||
value.exportsFn = context.makeShimExports(value);
|
value.exportsFn = context.makeShimExports(value);
|
||||||
}
|
}
|
||||||
shim[id] = value;
|
shim[id] = value;
|
||||||
@@ -1301,7 +1313,7 @@ var requirejs, require, define;
|
|||||||
if (value.init) {
|
if (value.init) {
|
||||||
ret = value.init.apply(global, arguments);
|
ret = value.init.apply(global, arguments);
|
||||||
}
|
}
|
||||||
return ret || getGlobal(value.exports);
|
return ret || (value.exports && getGlobal(value.exports));
|
||||||
}
|
}
|
||||||
return fn;
|
return fn;
|
||||||
},
|
},
|
||||||
@@ -1325,7 +1337,7 @@ var requirejs, require, define;
|
|||||||
//If require|exports|module are requested, get the
|
//If require|exports|module are requested, get the
|
||||||
//value for them from the special handlers. Caveat:
|
//value for them from the special handlers. Caveat:
|
||||||
//this only works while module is being defined.
|
//this only works while module is being defined.
|
||||||
if (relMap && handlers[deps]) {
|
if (relMap && hasProp(handlers, deps)) {
|
||||||
return handlers[deps](registry[relMap.id]);
|
return handlers[deps](registry[relMap.id]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1413,7 +1425,7 @@ var requirejs, require, define;
|
|||||||
takeGlobalQueue();
|
takeGlobalQueue();
|
||||||
|
|
||||||
var map = makeModuleMap(id, relMap, true),
|
var map = makeModuleMap(id, relMap, true),
|
||||||
mod = registry[id];
|
mod = getOwn(registry, id);
|
||||||
|
|
||||||
delete defined[id];
|
delete defined[id];
|
||||||
delete urlFetched[map.url];
|
delete urlFetched[map.url];
|
||||||
@@ -1441,7 +1453,7 @@ var requirejs, require, define;
|
|||||||
* used by the optimizer.
|
* used by the optimizer.
|
||||||
*/
|
*/
|
||||||
enable: function (depMap, parent) {
|
enable: function (depMap, parent) {
|
||||||
var mod = registry[depMap.id];
|
var mod = getOwn(registry, depMap.id);
|
||||||
if (mod) {
|
if (mod) {
|
||||||
getModule(depMap).enable();
|
getModule(depMap).enable();
|
||||||
}
|
}
|
||||||
@@ -1455,7 +1467,7 @@ var requirejs, require, define;
|
|||||||
*/
|
*/
|
||||||
completeLoad: function (moduleName) {
|
completeLoad: function (moduleName) {
|
||||||
var found, args, mod,
|
var found, args, mod,
|
||||||
shim = config.shim[moduleName] || {},
|
shim = getOwn(config.shim, moduleName) || {},
|
||||||
shExports = shim.exports;
|
shExports = shim.exports;
|
||||||
|
|
||||||
takeGlobalQueue();
|
takeGlobalQueue();
|
||||||
@@ -1481,9 +1493,9 @@ var requirejs, require, define;
|
|||||||
|
|
||||||
//Do this after the cycle of callGetModule in case the result
|
//Do this after the cycle of callGetModule in case the result
|
||||||
//of those calls/init calls changes the registry.
|
//of those calls/init calls changes the registry.
|
||||||
mod = registry[moduleName];
|
mod = getOwn(registry, moduleName);
|
||||||
|
|
||||||
if (!found && !defined[moduleName] && mod && !mod.inited) {
|
if (!found && !hasProp(defined, moduleName) && mod && !mod.inited) {
|
||||||
if (config.enforceDefine && (!shExports || !getGlobal(shExports))) {
|
if (config.enforceDefine && (!shExports || !getGlobal(shExports))) {
|
||||||
if (hasPathFallback(moduleName)) {
|
if (hasPathFallback(moduleName)) {
|
||||||
return;
|
return;
|
||||||
@@ -1534,8 +1546,8 @@ var requirejs, require, define;
|
|||||||
//and work up from it.
|
//and work up from it.
|
||||||
for (i = syms.length; i > 0; i -= 1) {
|
for (i = syms.length; i > 0; i -= 1) {
|
||||||
parentModule = syms.slice(0, i).join('/');
|
parentModule = syms.slice(0, i).join('/');
|
||||||
pkg = pkgs[parentModule];
|
pkg = getOwn(pkgs, parentModule);
|
||||||
parentPath = paths[parentModule];
|
parentPath = getOwn(paths, parentModule);
|
||||||
if (parentPath) {
|
if (parentPath) {
|
||||||
//If an array, it means there are a few choices,
|
//If an array, it means there are a few choices,
|
||||||
//Choose the one that is desired
|
//Choose the one that is desired
|
||||||
@@ -1660,7 +1672,7 @@ var requirejs, require, define;
|
|||||||
contextName = config.context;
|
contextName = config.context;
|
||||||
}
|
}
|
||||||
|
|
||||||
context = contexts[contextName];
|
context = getOwn(contexts, contextName);
|
||||||
if (!context) {
|
if (!context) {
|
||||||
context = contexts[contextName] = req.s.newContext(contextName);
|
context = contexts[contextName] = req.s.newContext(contextName);
|
||||||
}
|
}
|
||||||
|
|||||||
14
vendor/underscore/test/arrays.js
vendored
14
vendor/underscore/test/arrays.js
vendored
@@ -55,18 +55,16 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
test("compact", function() {
|
test("compact", function() {
|
||||||
equal(_.compact([0, 1, false, 2, false, 3]).length, 3, 'can trim out all falsy values');
|
equal(_.compact([0, 1, false, 2, false, 3]).length, 3, 'can trim out all falsy values');
|
||||||
var result = (function(){ return _(arguments).compact().length; })(0, 1, false, 2, false, 3);
|
var result = (function(){ return _.compact(arguments).length; })(0, 1, false, 2, false, 3);
|
||||||
equal(result, 3, 'works on an arguments object');
|
equal(result, 3, 'works on an arguments object');
|
||||||
});
|
});
|
||||||
|
|
||||||
test("flatten", function() {
|
test("flatten", function() {
|
||||||
if (window.JSON) {
|
var list = [1, [2], [3, [[[4]]]]];
|
||||||
var list = [1, [2], [3, [[[4]]]]];
|
deepEqual(_.flatten(list), [1,2,3,4], 'can flatten nested arrays');
|
||||||
equal(JSON.stringify(_.flatten(list)), '[1,2,3,4]', 'can flatten nested arrays');
|
deepEqual(_.flatten(list, true), [1,2,3,[[[4]]]], 'can shallowly flatten nested arrays');
|
||||||
equal(JSON.stringify(_.flatten(list, true)), '[1,2,3,[[[4]]]]', 'can shallowly flatten nested arrays');
|
var result = (function(){ return _.flatten(arguments); })(1, [2], [3, [[[4]]]]);
|
||||||
var result = (function(){ return _.flatten(arguments); })(1, [2], [3, [[[4]]]]);
|
deepEqual(result, [1,2,3,4], 'works on an arguments object');
|
||||||
equal(JSON.stringify(result), '[1,2,3,4]', 'works on an arguments object');
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test("without", function() {
|
test("without", function() {
|
||||||
|
|||||||
19
vendor/underscore/test/collections.js
vendored
19
vendor/underscore/test/collections.js
vendored
@@ -268,6 +268,7 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
equal(-Infinity, _.max({}), 'Maximum value of an empty object');
|
equal(-Infinity, _.max({}), 'Maximum value of an empty object');
|
||||||
equal(-Infinity, _.max([]), 'Maximum value of an empty array');
|
equal(-Infinity, _.max([]), 'Maximum value of an empty array');
|
||||||
|
equal(_.max({'a': 'a'}), -Infinity, 'Maximum value of a non-numeric collection');
|
||||||
|
|
||||||
equal(299999, _.max(_.range(1,300000)), "Maximum value of a too-big array");
|
equal(299999, _.max(_.range(1,300000)), "Maximum value of a too-big array");
|
||||||
});
|
});
|
||||||
@@ -280,6 +281,7 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
equal(Infinity, _.min({}), 'Minimum value of an empty object');
|
equal(Infinity, _.min({}), 'Minimum value of an empty object');
|
||||||
equal(Infinity, _.min([]), 'Minimum value of an empty array');
|
equal(Infinity, _.min([]), 'Minimum value of an empty array');
|
||||||
|
equal(_.min({'a': 'a'}), Infinity, 'Minimum value of a non-numeric collection');
|
||||||
|
|
||||||
var now = new Date(9999999999);
|
var now = new Date(9999999999);
|
||||||
var then = new Date(0);
|
var then = new Date(0);
|
||||||
@@ -346,6 +348,11 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
var array = [{}];
|
var array = [{}];
|
||||||
_.groupBy(array, function(value, index, obj){ ok(obj === array); });
|
_.groupBy(array, function(value, index, obj){ ok(obj === array); });
|
||||||
|
|
||||||
|
var array = [1, 2, 1, 2, 3];
|
||||||
|
var grouped = _.groupBy(array);
|
||||||
|
equal(grouped['1'].length, 2);
|
||||||
|
equal(grouped['3'].length, 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('countBy', function() {
|
test('countBy', function() {
|
||||||
@@ -370,6 +377,11 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
var array = [{}];
|
var array = [{}];
|
||||||
_.countBy(array, function(value, index, obj){ ok(obj === array); });
|
_.countBy(array, function(value, index, obj){ ok(obj === array); });
|
||||||
|
|
||||||
|
var array = [1, 2, 1, 2, 3];
|
||||||
|
var grouped = _.countBy(array);
|
||||||
|
equal(grouped['1'], 2);
|
||||||
|
equal(grouped['3'], 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('sortedIndex', function() {
|
test('sortedIndex', function() {
|
||||||
@@ -406,6 +418,13 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
var numbers = _.toArray({one : 1, two : 2, three : 3});
|
var numbers = _.toArray({one : 1, two : 2, three : 3});
|
||||||
equal(numbers.join(', '), '1, 2, 3', 'object flattened into array');
|
equal(numbers.join(', '), '1, 2, 3', 'object flattened into array');
|
||||||
|
|
||||||
|
// test in IE < 9
|
||||||
|
try {
|
||||||
|
var actual = _.toArray(document.childNodes);
|
||||||
|
} catch(ex) { }
|
||||||
|
|
||||||
|
ok(_.isArray(actual), 'should not throw converting a node list');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('size', function() {
|
test('size', function() {
|
||||||
|
|||||||
29
vendor/underscore/test/functions.js
vendored
29
vendor/underscore/test/functions.js
vendored
@@ -34,8 +34,10 @@ $(document).ready(function() {
|
|||||||
// To test this with a modern browser, set underscore's nativeBind to undefined
|
// To test this with a modern browser, set underscore's nativeBind to undefined
|
||||||
var F = function () { return this; };
|
var F = function () { return this; };
|
||||||
var Boundf = _.bind(F, {hello: "moe curly"});
|
var Boundf = _.bind(F, {hello: "moe curly"});
|
||||||
equal(new Boundf().hello, undefined, "function should not be bound to the context, to comply with ECMAScript 5");
|
var newBoundf = new Boundf();
|
||||||
|
equal(newBoundf.hello, undefined, "function should not be bound to the context, to comply with ECMAScript 5");
|
||||||
equal(Boundf().hello, "moe curly", "When called without the new operator, it's OK to be bound to the context");
|
equal(Boundf().hello, "moe curly", "When called without the new operator, it's OK to be bound to the context");
|
||||||
|
ok(newBoundf instanceof F, "a bound instance is an instance of the original function");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("bindAll", function() {
|
test("bindAll", function() {
|
||||||
@@ -163,6 +165,31 @@ $(document).ready(function() {
|
|||||||
}, 400);
|
}, 400);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
asyncTest("throttle triggers trailing call after repeatedly invoked", 2, function() {
|
||||||
|
var actual;
|
||||||
|
var counter = 0;
|
||||||
|
var limit = 80;
|
||||||
|
var incr = function(){ counter++; };
|
||||||
|
var throttledIncr = _.throttle(incr, 32);
|
||||||
|
|
||||||
|
var stamp = new Date;
|
||||||
|
while ((new Date - stamp) < limit) {
|
||||||
|
throttledIncr();
|
||||||
|
}
|
||||||
|
_.delay(function() {
|
||||||
|
actual = counter + 2;
|
||||||
|
throttledIncr();
|
||||||
|
throttledIncr();
|
||||||
|
}, 64);
|
||||||
|
|
||||||
|
_.delay(function() {
|
||||||
|
equal(counter, actual);
|
||||||
|
start();
|
||||||
|
}, 128);
|
||||||
|
|
||||||
|
ok(counter > 1);
|
||||||
|
});
|
||||||
|
|
||||||
asyncTest("debounce", 1, function() {
|
asyncTest("debounce", 1, function() {
|
||||||
var counter = 0;
|
var counter = 0;
|
||||||
var incr = function(){ counter++; };
|
var incr = function(){ counter++; };
|
||||||
|
|||||||
26
vendor/underscore/test/objects.js
vendored
26
vendor/underscore/test/objects.js
vendored
@@ -53,6 +53,13 @@ $(document).ready(function() {
|
|||||||
ok(_.isEqual(result, {x:2, a:'b'}), 'extending from multiple source objects last property trumps');
|
ok(_.isEqual(result, {x:2, a:'b'}), 'extending from multiple source objects last property trumps');
|
||||||
result = _.extend({}, {a: void 0, b: null});
|
result = _.extend({}, {a: void 0, b: null});
|
||||||
equal(_.keys(result).join(''), 'ab', 'extend does not copy undefined values');
|
equal(_.keys(result).join(''), 'ab', 'extend does not copy undefined values');
|
||||||
|
|
||||||
|
try {
|
||||||
|
result = {};
|
||||||
|
_.extend(result, null, undefined, {a:1});
|
||||||
|
} catch(ex) {}
|
||||||
|
|
||||||
|
equal(result.a, 1, 'should not error on `null` or `undefined` sources');
|
||||||
});
|
});
|
||||||
|
|
||||||
test("pick", function() {
|
test("pick", function() {
|
||||||
@@ -96,6 +103,13 @@ $(document).ready(function() {
|
|||||||
equal(options.empty, "", 'value exists');
|
equal(options.empty, "", 'value exists');
|
||||||
ok(_.isNaN(options.nan), "NaN isn't overridden");
|
ok(_.isNaN(options.nan), "NaN isn't overridden");
|
||||||
equal(options.word, "word", 'new value is added, first one wins');
|
equal(options.word, "word", 'new value is added, first one wins');
|
||||||
|
|
||||||
|
try {
|
||||||
|
options = {};
|
||||||
|
_.defaults(options, null, undefined, {a:1});
|
||||||
|
} catch(ex) {}
|
||||||
|
|
||||||
|
equal(options.a, 1, 'should not error on `null` or `undefined` sources');
|
||||||
});
|
});
|
||||||
|
|
||||||
test("clone", function() {
|
test("clone", function() {
|
||||||
@@ -337,16 +351,10 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
// Chaining.
|
// Chaining.
|
||||||
ok(!_.isEqual(_({x: 1, y: undefined}).chain(), _({x: 1, z: 2}).chain()), 'Chained objects containing different values are not equal');
|
ok(!_.isEqual(_({x: 1, y: undefined}).chain(), _({x: 1, z: 2}).chain()), 'Chained objects containing different values are not equal');
|
||||||
equal(_({x: 1, y: 2}).chain().isEqual(_({x: 1, y: 2}).chain()).value(), true, '`isEqual` can be chained');
|
|
||||||
|
|
||||||
// Custom `isEqual` methods.
|
a = _({x: 1, y: 2}).chain();
|
||||||
var isEqualObj = {isEqual: function (o) { return o.isEqual == this.isEqual; }, unique: {}};
|
b = _({x: 1, y: 2}).chain();
|
||||||
var isEqualObjClone = {isEqual: isEqualObj.isEqual, unique: {}};
|
equal(_.isEqual(a.isEqual(b), _(true)), true, '`isEqual` can be chained');
|
||||||
|
|
||||||
ok(_.isEqual(isEqualObj, isEqualObjClone), 'Both objects implement identical `isEqual` methods');
|
|
||||||
ok(_.isEqual(isEqualObjClone, isEqualObj), 'Commutative equality is implemented for objects with custom `isEqual` methods');
|
|
||||||
ok(!_.isEqual(isEqualObj, {}), 'Objects that do not implement equivalent `isEqual` methods are not equal');
|
|
||||||
ok(!_.isEqual({}, isEqualObj), 'Commutative equality is implemented for objects with different `isEqual` methods');
|
|
||||||
|
|
||||||
// Objects from another frame.
|
// Objects from another frame.
|
||||||
ok(_.isEqual({}, iObject));
|
ok(_.isEqual({}, iObject));
|
||||||
|
|||||||
11
vendor/underscore/test/utility.js
vendored
11
vendor/underscore/test/utility.js
vendored
@@ -37,8 +37,10 @@ $(document).ready(function() {
|
|||||||
ok(_.isEqual(vals, [0,1,2]), "is 0 indexed");
|
ok(_.isEqual(vals, [0,1,2]), "is 0 indexed");
|
||||||
//
|
//
|
||||||
vals = [];
|
vals = [];
|
||||||
_(3).times(function (i) { vals.push(i); });
|
_(3).times(function(i) { vals.push(i); });
|
||||||
ok(_.isEqual(vals, [0,1,2]), "works as a wrapper");
|
ok(_.isEqual(vals, [0,1,2]), "works as a wrapper");
|
||||||
|
// collects return values
|
||||||
|
ok(_.isEqual([0, 1, 2], _.times(3, function(i) { return i; })), "collects return values");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("mixin", function() {
|
test("mixin", function() {
|
||||||
@@ -173,10 +175,11 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
test('_.template provides the generated function source, when a SyntaxError occurs', function() {
|
test('_.template provides the generated function source, when a SyntaxError occurs', function() {
|
||||||
try {
|
try {
|
||||||
_.template('<b><%= if %></b>');
|
_.template('<b><%= if x %></b>');
|
||||||
} catch (e) {
|
} catch (ex) {
|
||||||
ok(e.source.indexOf('( if )') > 0);
|
var source = ex.source;
|
||||||
}
|
}
|
||||||
|
ok(/__p/.test(source));
|
||||||
});
|
});
|
||||||
|
|
||||||
test('_.template handles \\u2028 & \\u2029', function() {
|
test('_.template handles \\u2028 & \\u2029', function() {
|
||||||
|
|||||||
4
vendor/underscore/underscore-min.js
vendored
4
vendor/underscore/underscore-min.js
vendored
File diff suppressed because one or more lines are too long
69
vendor/underscore/underscore.js
vendored
69
vendor/underscore/underscore.js
vendored
@@ -1,4 +1,4 @@
|
|||||||
// Underscore.js 1.4.2
|
// Underscore.js 1.4.3
|
||||||
// http://underscorejs.org
|
// http://underscorejs.org
|
||||||
// (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc.
|
// (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc.
|
||||||
// Underscore may be freely distributed under the MIT license.
|
// Underscore may be freely distributed under the MIT license.
|
||||||
@@ -24,7 +24,6 @@
|
|||||||
var push = ArrayProto.push,
|
var push = ArrayProto.push,
|
||||||
slice = ArrayProto.slice,
|
slice = ArrayProto.slice,
|
||||||
concat = ArrayProto.concat,
|
concat = ArrayProto.concat,
|
||||||
unshift = ArrayProto.unshift,
|
|
||||||
toString = ObjProto.toString,
|
toString = ObjProto.toString,
|
||||||
hasOwnProperty = ObjProto.hasOwnProperty;
|
hasOwnProperty = ObjProto.hasOwnProperty;
|
||||||
|
|
||||||
@@ -61,11 +60,11 @@
|
|||||||
}
|
}
|
||||||
exports._ = _;
|
exports._ = _;
|
||||||
} else {
|
} else {
|
||||||
root['_'] = _;
|
root._ = _;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Current version.
|
// Current version.
|
||||||
_.VERSION = '1.4.2';
|
_.VERSION = '1.4.3';
|
||||||
|
|
||||||
// Collection Functions
|
// Collection Functions
|
||||||
// --------------------
|
// --------------------
|
||||||
@@ -102,6 +101,8 @@
|
|||||||
return results;
|
return results;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var reduceError = 'Reduce of empty array with no initial value';
|
||||||
|
|
||||||
// **Reduce** builds up a single result from a list of values, aka `inject`,
|
// **Reduce** builds up a single result from a list of values, aka `inject`,
|
||||||
// or `foldl`. Delegates to **ECMAScript 5**'s native `reduce` if available.
|
// or `foldl`. Delegates to **ECMAScript 5**'s native `reduce` if available.
|
||||||
_.reduce = _.foldl = _.inject = function(obj, iterator, memo, context) {
|
_.reduce = _.foldl = _.inject = function(obj, iterator, memo, context) {
|
||||||
@@ -119,7 +120,7 @@
|
|||||||
memo = iterator.call(context, memo, value, index, list);
|
memo = iterator.call(context, memo, value, index, list);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (!initial) throw new TypeError('Reduce of empty array with no initial value');
|
if (!initial) throw new TypeError(reduceError);
|
||||||
return memo;
|
return memo;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -130,7 +131,7 @@
|
|||||||
if (obj == null) obj = [];
|
if (obj == null) obj = [];
|
||||||
if (nativeReduceRight && obj.reduceRight === nativeReduceRight) {
|
if (nativeReduceRight && obj.reduceRight === nativeReduceRight) {
|
||||||
if (context) iterator = _.bind(iterator, context);
|
if (context) iterator = _.bind(iterator, context);
|
||||||
return arguments.length > 2 ? obj.reduceRight(iterator, memo) : obj.reduceRight(iterator);
|
return initial ? obj.reduceRight(iterator, memo) : obj.reduceRight(iterator);
|
||||||
}
|
}
|
||||||
var length = obj.length;
|
var length = obj.length;
|
||||||
if (length !== +length) {
|
if (length !== +length) {
|
||||||
@@ -146,7 +147,7 @@
|
|||||||
memo = iterator.call(context, memo, obj[index], index, list);
|
memo = iterator.call(context, memo, obj[index], index, list);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (!initial) throw new TypeError('Reduce of empty array with no initial value');
|
if (!initial) throw new TypeError(reduceError);
|
||||||
return memo;
|
return memo;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -253,7 +254,7 @@
|
|||||||
return Math.max.apply(Math, obj);
|
return Math.max.apply(Math, obj);
|
||||||
}
|
}
|
||||||
if (!iterator && _.isEmpty(obj)) return -Infinity;
|
if (!iterator && _.isEmpty(obj)) return -Infinity;
|
||||||
var result = {computed : -Infinity};
|
var result = {computed : -Infinity, value: -Infinity};
|
||||||
each(obj, function(value, index, list) {
|
each(obj, function(value, index, list) {
|
||||||
var computed = iterator ? iterator.call(context, value, index, list) : value;
|
var computed = iterator ? iterator.call(context, value, index, list) : value;
|
||||||
computed >= result.computed && (result = {value : value, computed : computed});
|
computed >= result.computed && (result = {value : value, computed : computed});
|
||||||
@@ -267,7 +268,7 @@
|
|||||||
return Math.min.apply(Math, obj);
|
return Math.min.apply(Math, obj);
|
||||||
}
|
}
|
||||||
if (!iterator && _.isEmpty(obj)) return Infinity;
|
if (!iterator && _.isEmpty(obj)) return Infinity;
|
||||||
var result = {computed : Infinity};
|
var result = {computed : Infinity, value: Infinity};
|
||||||
each(obj, function(value, index, list) {
|
each(obj, function(value, index, list) {
|
||||||
var computed = iterator ? iterator.call(context, value, index, list) : value;
|
var computed = iterator ? iterator.call(context, value, index, list) : value;
|
||||||
computed < result.computed && (result = {value : value, computed : computed});
|
computed < result.computed && (result = {value : value, computed : computed});
|
||||||
@@ -316,7 +317,7 @@
|
|||||||
// An internal function used for aggregate "group by" operations.
|
// An internal function used for aggregate "group by" operations.
|
||||||
var group = function(obj, value, context, behavior) {
|
var group = function(obj, value, context, behavior) {
|
||||||
var result = {};
|
var result = {};
|
||||||
var iterator = lookupIterator(value);
|
var iterator = lookupIterator(value || _.identity);
|
||||||
each(obj, function(value, index) {
|
each(obj, function(value, index) {
|
||||||
var key = iterator.call(context, value, index, obj);
|
var key = iterator.call(context, value, index, obj);
|
||||||
behavior(result, key, value);
|
behavior(result, key, value);
|
||||||
@@ -336,7 +337,7 @@
|
|||||||
// either a string attribute to count by, or a function that returns the
|
// either a string attribute to count by, or a function that returns the
|
||||||
// criterion.
|
// criterion.
|
||||||
_.countBy = function(obj, value, context) {
|
_.countBy = function(obj, value, context) {
|
||||||
return group(obj, value, context, function(result, key, value) {
|
return group(obj, value, context, function(result, key) {
|
||||||
if (!_.has(result, key)) result[key] = 0;
|
if (!_.has(result, key)) result[key] = 0;
|
||||||
result[key]++;
|
result[key]++;
|
||||||
});
|
});
|
||||||
@@ -358,7 +359,8 @@
|
|||||||
// Safely convert anything iterable into a real, live array.
|
// Safely convert anything iterable into a real, live array.
|
||||||
_.toArray = function(obj) {
|
_.toArray = function(obj) {
|
||||||
if (!obj) return [];
|
if (!obj) return [];
|
||||||
if (obj.length === +obj.length) return slice.call(obj);
|
if (_.isArray(obj)) return slice.call(obj);
|
||||||
|
if (obj.length === +obj.length) return _.map(obj, _.identity);
|
||||||
return _.values(obj);
|
return _.values(obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -408,7 +410,7 @@
|
|||||||
|
|
||||||
// Trim out all falsy values from an array.
|
// Trim out all falsy values from an array.
|
||||||
_.compact = function(array) {
|
_.compact = function(array) {
|
||||||
return _.filter(array, function(value){ return !!value; });
|
return _.filter(array, _.identity);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Internal implementation of a recursive `flatten` function.
|
// Internal implementation of a recursive `flatten` function.
|
||||||
@@ -572,8 +574,8 @@
|
|||||||
// optionally). Binding with arguments is also known as `curry`.
|
// optionally). Binding with arguments is also known as `curry`.
|
||||||
// Delegates to **ECMAScript 5**'s native `Function.bind` if available.
|
// Delegates to **ECMAScript 5**'s native `Function.bind` if available.
|
||||||
// We check for `func.bind` first, to fail fast when `func` is undefined.
|
// We check for `func.bind` first, to fail fast when `func` is undefined.
|
||||||
_.bind = function bind(func, context) {
|
_.bind = function(func, context) {
|
||||||
var bound, args;
|
var args, bound;
|
||||||
if (func.bind === nativeBind && nativeBind) return nativeBind.apply(func, slice.call(arguments, 1));
|
if (func.bind === nativeBind && nativeBind) return nativeBind.apply(func, slice.call(arguments, 1));
|
||||||
if (!_.isFunction(func)) throw new TypeError;
|
if (!_.isFunction(func)) throw new TypeError;
|
||||||
args = slice.call(arguments, 2);
|
args = slice.call(arguments, 2);
|
||||||
@@ -581,6 +583,7 @@
|
|||||||
if (!(this instanceof bound)) return func.apply(context, args.concat(slice.call(arguments)));
|
if (!(this instanceof bound)) return func.apply(context, args.concat(slice.call(arguments)));
|
||||||
ctor.prototype = func.prototype;
|
ctor.prototype = func.prototype;
|
||||||
var self = new ctor;
|
var self = new ctor;
|
||||||
|
ctor.prototype = null;
|
||||||
var result = func.apply(self, args.concat(slice.call(arguments)));
|
var result = func.apply(self, args.concat(slice.call(arguments)));
|
||||||
if (Object(result) === result) return result;
|
if (Object(result) === result) return result;
|
||||||
return self;
|
return self;
|
||||||
@@ -636,6 +639,7 @@
|
|||||||
args = arguments;
|
args = arguments;
|
||||||
if (remaining <= 0) {
|
if (remaining <= 0) {
|
||||||
clearTimeout(timeout);
|
clearTimeout(timeout);
|
||||||
|
timeout = null;
|
||||||
previous = now;
|
previous = now;
|
||||||
result = func.apply(context, args);
|
result = func.apply(context, args);
|
||||||
} else if (!timeout) {
|
} else if (!timeout) {
|
||||||
@@ -758,8 +762,10 @@
|
|||||||
// Extend a given object with all the properties in passed-in object(s).
|
// Extend a given object with all the properties in passed-in object(s).
|
||||||
_.extend = function(obj) {
|
_.extend = function(obj) {
|
||||||
each(slice.call(arguments, 1), function(source) {
|
each(slice.call(arguments, 1), function(source) {
|
||||||
for (var prop in source) {
|
if (source) {
|
||||||
obj[prop] = source[prop];
|
for (var prop in source) {
|
||||||
|
obj[prop] = source[prop];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return obj;
|
return obj;
|
||||||
@@ -788,8 +794,10 @@
|
|||||||
// Fill in a given object with default properties.
|
// Fill in a given object with default properties.
|
||||||
_.defaults = function(obj) {
|
_.defaults = function(obj) {
|
||||||
each(slice.call(arguments, 1), function(source) {
|
each(slice.call(arguments, 1), function(source) {
|
||||||
for (var prop in source) {
|
if (source) {
|
||||||
if (obj[prop] == null) obj[prop] = source[prop];
|
for (var prop in source) {
|
||||||
|
if (obj[prop] == null) obj[prop] = source[prop];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return obj;
|
return obj;
|
||||||
@@ -954,7 +962,7 @@
|
|||||||
|
|
||||||
// Is a given object a finite number?
|
// Is a given object a finite number?
|
||||||
_.isFinite = function(obj) {
|
_.isFinite = function(obj) {
|
||||||
return isFinite( obj ) && !isNaN( parseFloat(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).
|
||||||
@@ -1000,7 +1008,9 @@
|
|||||||
|
|
||||||
// Run a function **n** times.
|
// Run a function **n** times.
|
||||||
_.times = function(n, iterator, context) {
|
_.times = function(n, iterator, context) {
|
||||||
for (var i = 0; i < n; i++) iterator.call(context, i);
|
var accum = Array(n);
|
||||||
|
for (var i = 0; i < n; i++) accum[i] = iterator.call(context, i);
|
||||||
|
return accum;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Return a random integer between min and max (inclusive).
|
// Return a random integer between min and max (inclusive).
|
||||||
@@ -1065,7 +1075,7 @@
|
|||||||
// Useful for temporary DOM ids.
|
// Useful for temporary DOM ids.
|
||||||
var idCounter = 0;
|
var idCounter = 0;
|
||||||
_.uniqueId = function(prefix) {
|
_.uniqueId = function(prefix) {
|
||||||
var id = idCounter++;
|
var id = '' + ++idCounter;
|
||||||
return prefix ? prefix + id : id;
|
return prefix ? prefix + id : id;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1115,11 +1125,18 @@
|
|||||||
text.replace(matcher, function(match, escape, interpolate, evaluate, offset) {
|
text.replace(matcher, function(match, escape, interpolate, evaluate, offset) {
|
||||||
source += text.slice(index, offset)
|
source += text.slice(index, offset)
|
||||||
.replace(escaper, function(match) { return '\\' + escapes[match]; });
|
.replace(escaper, function(match) { return '\\' + escapes[match]; });
|
||||||
source +=
|
|
||||||
escape ? "'+\n((__t=(" + escape + "))==null?'':_.escape(__t))+\n'" :
|
if (escape) {
|
||||||
interpolate ? "'+\n((__t=(" + interpolate + "))==null?'':__t)+\n'" :
|
source += "'+\n((__t=(" + escape + "))==null?'':_.escape(__t))+\n'";
|
||||||
evaluate ? "';\n" + evaluate + "\n__p+='" : '';
|
}
|
||||||
|
if (interpolate) {
|
||||||
|
source += "'+\n((__t=(" + interpolate + "))==null?'':__t)+\n'";
|
||||||
|
}
|
||||||
|
if (evaluate) {
|
||||||
|
source += "';\n" + evaluate + "\n__p+='";
|
||||||
|
}
|
||||||
index = offset + match.length;
|
index = offset + match.length;
|
||||||
|
return match;
|
||||||
});
|
});
|
||||||
source += "';\n";
|
source += "';\n";
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user