mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-30 06:57:49 +00:00
Compare commits
43 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cf075df7d1 | ||
|
|
11cd9905c4 | ||
|
|
cf462542e9 | ||
|
|
b63f25a1ae | ||
|
|
7de69a21c5 | ||
|
|
21783e4ea0 | ||
|
|
53e5a756d7 | ||
|
|
8c911a2fd0 | ||
|
|
ce440e9f43 | ||
|
|
6465f8d8e6 | ||
|
|
4bdf28059a | ||
|
|
21010c6540 | ||
|
|
a5a6cabac6 | ||
|
|
f460c77f2c | ||
|
|
1c69d9213e | ||
|
|
c02c2d3b2c | ||
|
|
7adf5e763b | ||
|
|
0e4afefc7f | ||
|
|
c7f290f42e | ||
|
|
bb553b8a6a | ||
|
|
21eda2a1a3 | ||
|
|
48c13c990f | ||
|
|
a2665529f6 | ||
|
|
8d35d78eff | ||
|
|
a82a364c22 | ||
|
|
cc150ff9d2 | ||
|
|
feeb38293d | ||
|
|
5b9271ccfe | ||
|
|
e60bbc2fb7 | ||
|
|
387cc184e6 | ||
|
|
a830ddcb43 | ||
|
|
35fea30191 | ||
|
|
24b672b968 | ||
|
|
de6a3c5ab1 | ||
|
|
260ff6de3e | ||
|
|
7cb37411c9 | ||
|
|
e4e41e5ef8 | ||
|
|
985f4aafca | ||
|
|
0c25dd44b3 | ||
|
|
285f0bc6dd | ||
|
|
07a370fd24 | ||
|
|
95f07ea38a | ||
|
|
2890b92b21 |
119
README.md
119
README.md
@@ -1,14 +1,14 @@
|
||||
# Lo-Dash <sup>v0.5.1</sup>
|
||||
# Lo-Dash <sup>v0.6.0</sup>
|
||||
|
||||
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-20), and [additional features](https://github.com/bestiejs/lodash#features).
|
||||
A drop-in replacement<sup>[*](https://github.com/bestiejs/lodash/wiki/Drop-in-Disclaimer)</sup> for Underscore.js, from the devs behind [jsPerf.com](http://jsperf.com), delivering [performance](http://lodash.com/benchmarks), [bug fixes](https://github.com/bestiejs/lodash#resolved-underscorejs-issues-30), and [additional features](https://github.com/bestiejs/lodash#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
|
||||
|
||||
* [Development source](https://raw.github.com/bestiejs/lodash/v0.5.1/lodash.js)
|
||||
* [Production source](https://raw.github.com/bestiejs/lodash/v0.5.1/lodash.min.js)
|
||||
* CDN copies of ≤ [v0.5.0](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/0.5.0/lodash.min.js) are available on [cdnjs](http://cdnjs.com/) thanks to [CloudFlare](http://www.cloudflare.com/)
|
||||
* [Development source](https://raw.github.com/bestiejs/lodash/v0.6.0/lodash.js)
|
||||
* [Production source](https://raw.github.com/bestiejs/lodash/v0.6.0/lodash.min.js)
|
||||
* CDN copies of ≤ [v0.6.0](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/0.6.0/lodash.min.js) are available on [cdnjs](http://cdnjs.com/) thanks to [CloudFlare](http://www.cloudflare.com/)
|
||||
* For optimal performance, [create a custom build](https://github.com/bestiejs/lodash#custom-builds) with only the features you need
|
||||
|
||||
## Dive in
|
||||
@@ -31,9 +31,9 @@ For more information check out these screencasts over Lo-Dash:
|
||||
## Features
|
||||
|
||||
* AMD loader support ([RequireJS](http://requirejs.org/), [curl.js](https://github.com/cujojs/curl), etc.)
|
||||
* [_.bind](http://lodash.com/docs#bind) supports *"lazy"* binding
|
||||
* [_.clone](http://lodash.com/docs#clone) supports *"deep"* cloning
|
||||
* [_.countBy](http://lodash.com/docs#countBy) as a compainion function for [_.groupBy](http://lodash.com/docs#groupBy) and [_.sortBy](http://lodash.com/docs#sortBy)
|
||||
* [_.bind](http://lodash.com/docs#bind) supports *“lazy”* binding
|
||||
* [_.clone](http://lodash.com/docs#clone) supports *“deep”* cloning
|
||||
* [_.countBy](http://lodash.com/docs#countBy) as a companion function for [_.groupBy](http://lodash.com/docs#groupBy) and [_.sortBy](http://lodash.com/docs#sortBy)
|
||||
* [_.debounce](http://lodash.com/docs#debounce)’ed functions match [_.throttle](http://lodash.com/docs#throttle)’ed functions’ return value behavior
|
||||
* [_.drop](http://lodash.com/docs#drop) for the inverse functionality of [_.pick](http://lodash.com/docs#pick)
|
||||
* [_.forEach](http://lodash.com/docs#forEach) is chainable and supports exiting iteration early
|
||||
@@ -41,9 +41,12 @@ For more information check out these screencasts over Lo-Dash:
|
||||
* [_.forOwn](http://lodash.com/docs#forOwn) for iterating over an object’s own properties
|
||||
* [_.groupBy](http://lodash.com/docs#groupBy), [_.sortedIndex](http://lodash.com/docs#sortedIndex), and [_.uniq](http://lodash.com/docs#uniq) accept a `thisArg` argument
|
||||
* [_.indexOf](http://lodash.com/docs#indexOf) and [_.lastIndexOf](http://lodash.com/docs#lastIndexOf) accept a `fromIndex` argument
|
||||
* [_.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
|
||||
* [_.pick](http://lodash.com/docs#pick) and [_.drop](http://lodash.com/docs#drop) accept `callback` and `thisArg` arguments
|
||||
* [_.sortBy](http://lodash.com/docs#sortBy) performs a [stable](http://en.wikipedia.org/wiki/Sorting_algorithm#Stability) sort
|
||||
* [_.template](http://lodash.com/docs#template) utilizes [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) for easier debugging
|
||||
* [_.unescape](http://lodash.com/docs#unescape) to unescape strings escaped by [_.escape](http://lodash.com/docs#escape)
|
||||
* [_.where](http://lodash.com/docs#where) for filtering collections by contained properties
|
||||
* [_.zipObject](http://lodash.com/docs#zipObject) for composing objects
|
||||
* [_.contains](http://lodash.com/docs#contains), [_.size](http://lodash.com/docs#size), [_.toArray](http://lodash.com/docs#toArray),
|
||||
@@ -51,7 +54,7 @@ For more information check out these screencasts over Lo-Dash:
|
||||
|
||||
## Support
|
||||
|
||||
Lo-Dash has been tested in at least Chrome 5-21, Firefox 1.5-13, IE 6-9, Opera 9.25-12.01, Safari 3-6, Node.js 0.4.8-0.8.7, Narwhal 0.3.2, RingoJS 0.8, and Rhino 1.7RC5.
|
||||
Lo-Dash has been tested in at least Chrome 5-21, Firefox 1-14, IE 6-9, Opera 9.25-12, Safari 3-6, Node.js 0.4.8-0.8.8, Narwhal 0.3.2, RingoJS 0.8, and Rhino 1.7RC5.
|
||||
|
||||
## Custom builds
|
||||
|
||||
@@ -91,7 +94,7 @@ lodash underscore
|
||||
Custom builds may be created in three ways:
|
||||
|
||||
1. Use the `category` argument to pass the categories of methods to include in the build.<br>
|
||||
Valid categories are *"arrays"*, *"chaining"*, *"collections"*, *"functions"*, *"objects"*, and *"utilities"*.
|
||||
Valid categories are *“arrays”*, *“chaining”*, *“collections”*, *“functions”*, *“objects”*, and *“utilities”*.
|
||||
```bash
|
||||
lodash category=collections,functions
|
||||
lodash category="collections, functions"
|
||||
@@ -166,39 +169,40 @@ require({
|
||||
});
|
||||
```
|
||||
|
||||
## Resolved Underscore.js issues <sup>(20+)</sup>
|
||||
## Resolved Underscore.js issues <sup>(30+)</sup>
|
||||
|
||||
* Allow iteration of objects with a `length` property [[#148](https://github.com/documentcloud/underscore/issues/148), [#154](https://github.com/documentcloud/underscore/issues/154), [#252](https://github.com/documentcloud/underscore/issues/252), [#448](https://github.com/documentcloud/underscore/issues/448), [#659](https://github.com/documentcloud/underscore/issues/659), [test](https://github.com/bestiejs/lodash/blob/v0.5.1/test/test.js#L552-558)]
|
||||
* Ensure array-like objects with invalid `length` properties are treated like regular objects [[test](https://github.com/bestiejs/lodash/blob/v0.5.1/test/test.js#L499-509)]
|
||||
* Ensure *"Arrays"* methods allow falsey `array` arguments [[test](https://github.com/bestiejs/lodash/blob/v0.5.1/test/test.js#L1495-1533)]
|
||||
* Ensure *"Collections"* methods allow string `collection` arguments [[#247](https://github.com/documentcloud/underscore/issues/247), [#276](https://github.com/documentcloud/underscore/issues/276), [#561](https://github.com/documentcloud/underscore/pull/561), [test](https://github.com/bestiejs/lodash/blob/v0.5.1/test/test.js#L511-529)]
|
||||
* Ensure templates compiled with errors are inspectable [[#666](https://github.com/documentcloud/underscore/issues/666), [test](https://github.com/bestiejs/lodash/blob/v0.5.1/test/test.js#L1240-1243)]
|
||||
* 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.5.1/test/test.js#L563-588)]
|
||||
* Allow iteration of objects with a `length` property [[#148](https://github.com/documentcloud/underscore/issues/148), [#154](https://github.com/documentcloud/underscore/issues/154), [#252](https://github.com/documentcloud/underscore/issues/252), [#448](https://github.com/documentcloud/underscore/issues/448), [#659](https://github.com/documentcloud/underscore/issues/659), [test](https://github.com/bestiejs/lodash/blob/v0.6.0/test/test.js#L578-584)]
|
||||
* Ensure array-like objects with invalid `length` properties are treated like regular objects [[test](https://github.com/bestiejs/lodash/blob/v0.6.0/test/test.js#L526-536)]
|
||||
* Ensure *“Arrays”*, “Collections”, and “Objects” methods don’t error when passed falsey arguments [[#650](https://github.com/documentcloud/underscore/pull/650), [test](https://github.com/bestiejs/lodash/blob/v0.6.0/test/test.js#L1668-1703)]
|
||||
* Ensure *“Collections”* methods allow string `collection` arguments [[#247](https://github.com/documentcloud/underscore/issues/247), [#276](https://github.com/documentcloud/underscore/issues/276), [#561](https://github.com/documentcloud/underscore/pull/561), [test](https://github.com/bestiejs/lodash/blob/v0.6.0/test/test.js#L538-555)]
|
||||
* Ensure templates compiled with errors are inspectable [[#666](https://github.com/documentcloud/underscore/issues/666), [test](https://github.com/bestiejs/lodash/blob/v0.6.0/test/test.js#L1383-1386)]
|
||||
* 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.6.0/test/test.js#L589-614)]
|
||||
* Handle arrays with `undefined` values correctly in IE < 9 [[#601](https://github.com/documentcloud/underscore/issues/601)]
|
||||
* Methods should work on pages with incorrectly shimmed native methods [[#7](https://github.com/documentcloud/underscore/issues/7), [test](https://github.com/bestiejs/lodash/blob/v0.5.1/test/test.js#L117-123)]
|
||||
* Register as an AMD module, but still export to global [[#431](https://github.com/documentcloud/underscore/pull/431), [test](https://github.com/bestiejs/lodash/blob/v0.5.1/test/test.js#L101-115)]
|
||||
* `_(…)` should return passed wrapper instances [[test](https://github.com/bestiejs/lodash/blob/v0.5.1/test/test.js#L135-138)]
|
||||
* `_.clone` should allow `deep` cloning [[#595](https://github.com/documentcloud/underscore/pull/595), [test](https://github.com/bestiejs/lodash/blob/v0.5.1/test/test.js#L205-220)]
|
||||
* `_.contains` should work with strings [[#667](https://github.com/documentcloud/underscore/pull/667), [test](https://github.com/bestiejs/lodash/blob/v0.5.1/test/test.js#L275-284)]
|
||||
* `_.escape` should return an empty string when passed `null` or `undefined` [[#427](https://github.com/documentcloud/underscore/issues/427), [test](https://github.com/bestiejs/lodash/blob/v0.5.1/test/test.js#L375-378)]
|
||||
* `_.extend` should recursively extend objects [[#379](https://github.com/documentcloud/underscore/pull/379), [test](https://github.com/bestiejs/lodash/blob/v0.5.1/test/test.js#L892-914)]
|
||||
* `_.forEach` should be chainable [[#142](https://github.com/documentcloud/underscore/issues/142), [test](https://github.com/bestiejs/lodash/blob/v0.5.1/test/test.js#L494-497)]
|
||||
* `_.forEach` should allow exiting iteration early [[#211](https://github.com/documentcloud/underscore/issues/211), [test](https://github.com/bestiejs/lodash/blob/v0.5.1/test/test.js#L590-609)]
|
||||
* `_.groupBy` should add values to own, not inherited, properties [[test](https://github.com/bestiejs/lodash/blob/v0.5.1/test/test.js#L624-631)]
|
||||
* `_.isEmpty` and `_.size` should support jQuery/MooTools DOM query collections [[#690](https://github.com/documentcloud/underscore/pull/690), [test](https://github.com/bestiejs/lodash/blob/v0.5.1/test/test.js#L724-729)]
|
||||
* `_.isEqual` should return `true` for like-objects from different documents [[test](https://github.com/bestiejs/lodash/blob/v0.5.1/test/test.js#L765-785)]
|
||||
* `_.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.5.1/test/test.js#L793-805)]
|
||||
* `_.isNaN(new Number(NaN))` should return `true` [[test](https://github.com/bestiejs/lodash/blob/v0.5.1/test/test.js#L813-815)]
|
||||
* `_.keys` and `_.size` should work with `arguments` objects cross-browser [[#396](https://github.com/documentcloud/underscore/issues/396), [#653](https://github.com/documentcloud/underscore/issues/653), [test](https://github.com/bestiejs/lodash/blob/v0.5.1/test/test.js#L825-827)]
|
||||
* Methods should work on pages with incorrectly shimmed native methods [[#7](https://github.com/documentcloud/underscore/issues/7), [test](https://github.com/bestiejs/lodash/blob/v0.6.0/test/test.js#L117-123)]
|
||||
* Register as an AMD module, but still export to global [[#431](https://github.com/documentcloud/underscore/pull/431), [test](https://github.com/bestiejs/lodash/blob/v0.6.0/test/test.js#L101-115)]
|
||||
* `_(…)` should return passed wrapper instances [[test](https://github.com/bestiejs/lodash/blob/v0.6.0/test/test.js#L135-138)]
|
||||
* `_.clone` should allow `deep` cloning [[#595](https://github.com/documentcloud/underscore/pull/595), [test](https://github.com/bestiejs/lodash/blob/v0.6.0/test/test.js#L205-220)]
|
||||
* `_.contains` should work with strings [[#667](https://github.com/documentcloud/underscore/pull/667), [test](https://github.com/bestiejs/lodash/blob/v0.6.0/test/test.js#L275-284)]
|
||||
* `_.countBy` and `_.groupBy` should only add values to own, not inherited, properties [[test](https://github.com/bestiejs/lodash/blob/v0.6.0/test/test.js#L292-299)]
|
||||
* `_.escape` should return an empty string when passed `null` or `undefined` [[#427](https://github.com/documentcloud/underscore/issues/427), [test](https://github.com/bestiejs/lodash/blob/v0.6.0/test/test.js#L402-405)]
|
||||
* `_.extend` should recursively extend objects [[#379](https://github.com/documentcloud/underscore/pull/379), [#718](https://github.com/documentcloud/underscore/issues/718), [test](https://github.com/bestiejs/lodash/blob/v0.6.0/test/test.js#L979-1001)]
|
||||
* `_.forEach` should be chainable [[#142](https://github.com/documentcloud/underscore/issues/142), [test](https://github.com/bestiejs/lodash/blob/v0.6.0/test/test.js#L521-524)]
|
||||
* `_.forEach` should allow exiting iteration early [[#211](https://github.com/documentcloud/underscore/issues/211), [test](https://github.com/bestiejs/lodash/blob/v0.6.0/test/test.js#L616-635)]
|
||||
* `_.isElement` should use strict equality for its duck type check [[test](https://github.com/bestiejs/lodash/blob/v0.6.0/test/test.js#L731-740)]
|
||||
* `_.isEmpty` and `_.size` should support jQuery/MooTools DOM query collections [[#690](https://github.com/documentcloud/underscore/pull/690), [test](https://github.com/bestiejs/lodash/blob/v0.6.0/test/test.js#L767-772)]
|
||||
* `_.isEqual` should return `true` for like-objects from different documents [[test](https://github.com/bestiejs/lodash/blob/v0.6.0/test/test.js#L808-828)]
|
||||
* `_.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.6.0/test/test.js#L836-848)]
|
||||
* `_.isNaN(new Number(NaN))` should return `true` [[test](https://github.com/bestiejs/lodash/blob/v0.6.0/test/test.js#L856-858)]
|
||||
* `_.keys` and `_.size` should work with `arguments` objects cross-browser [[#396](https://github.com/documentcloud/underscore/issues/396), [#653](https://github.com/documentcloud/underscore/issues/653), [test](https://github.com/bestiejs/lodash/blob/v0.6.0/test/test.js#L912-914)]
|
||||
* `_.once` should free the given function for garbage collection [[#693](https://github.com/documentcloud/underscore/pull/693)]
|
||||
* `_.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.5.1/test/test.js#L1050-1053)]
|
||||
* `_.reduceRight` should pass correct callback arguments when iterating objects [[test](https://github.com/bestiejs/lodash/blob/v0.5.1/test/test.js#L1061-1075)]
|
||||
* `_.size` should return the `length` of string values [[test](https://github.com/bestiejs/lodash/blob/v0.5.1/test/test.js#L1120-1122)]
|
||||
* `_.size` shouldn’t error on falsey values [[#650](https://github.com/documentcloud/underscore/pull/650), [test](https://github.com/bestiejs/lodash/blob/v0.5.1/test/test.js#L1124-1131)]
|
||||
* `_.sortedIndex` should support arrays with high `length` values [[test](https://github.com/bestiejs/lodash/blob/v0.5.1/test/test.js#L1210-1219)]
|
||||
* `_.template` should not augment the `options` object [[test](https://github.com/bestiejs/lodash/blob/v0.5.1/test/test.js#L1234-1238)]
|
||||
* `_.throttle` should work when called in a loop [[#502](https://github.com/documentcloud/underscore/issues/502), [test](https://github.com/bestiejs/lodash/blob/v0.5.1/test/test.js#L1330-1340)]
|
||||
* `_.zipObject` should accept less than two arguments [[test](https://github.com/bestiejs/lodash/blob/v0.5.1/test/test.js#L1457-1459)]
|
||||
* `_.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.6.0/test/test.js#L1170-1173)]
|
||||
* `_.reduceRight` should pass correct callback arguments when iterating objects [[test](https://github.com/bestiejs/lodash/blob/v0.6.0/test/test.js#L1205-1219)]
|
||||
* `_.size` should return the `length` of string values [[test](https://github.com/bestiejs/lodash/blob/v0.6.0/test/test.js#L1263-1265)]
|
||||
* `_.sortedIndex` should support arrays with high `length` values [[test](https://github.com/bestiejs/lodash/blob/v0.6.0/test/test.js#L1353-1362)]
|
||||
* `_.template` should not augment the `options` object [[test](https://github.com/bestiejs/lodash/blob/v0.6.0/test/test.js#L1377-1381)]
|
||||
* `_.throttle` should work when called in a loop [[#502](https://github.com/documentcloud/underscore/issues/502), [test](https://github.com/bestiejs/lodash/blob/v0.6.0/test/test.js#L1473-1483)]
|
||||
* `_.toArray` uses custom `toArray` methods of arrays and strings [[test](https://github.com/bestiejs/lodash/blob/v0.6.0/test/test.js#L1510-1518)]
|
||||
* `_.zipObject` should accept less than two arguments [[test](https://github.com/bestiejs/lodash/blob/v0.6.0/test/test.js#L1630-1632)]
|
||||
|
||||
## Optimized methods <sup>(50+)</sup>
|
||||
|
||||
@@ -210,6 +214,7 @@ require({
|
||||
* `_.defaults`
|
||||
* `_.defer`
|
||||
* `_.difference`
|
||||
* `_.drop`, `_.omit`
|
||||
* `_.each`
|
||||
* `_.escape`
|
||||
* `_.every`, `_.all`
|
||||
@@ -262,34 +267,22 @@ require({
|
||||
|
||||
## Release Notes
|
||||
|
||||
### <sup>v0.5.1</sup>
|
||||
### <sup>v0.6.0</sup>
|
||||
|
||||
* Ensured `_.bind` correctly appends array arguments to partially applied arguments in older browsers
|
||||
|
||||
### <sup>v0.5.0</sup>
|
||||
|
||||
* Added [_.countBy](http://lodash.com/docs#countBy), [_.drop](http://lodash.com/docs#drop), [_.merge](http://lodash.com/docs#merge), and [_.where](http://lodash.com/docs#where)
|
||||
* Added `csp` *(Content Security Policy)* and `underscore` build options
|
||||
* Added `deep` cloning support to `_.clone`
|
||||
* Added [Jam](http://jamjs.org/) package support
|
||||
* Added support for exiting `_.forEach`, `_.forIn`, and `_.forOwn` early by returning `false` in the `callback`
|
||||
* Added support for jQuery/MooTools DOM query collections to `_.isEmpty` and `_.size`
|
||||
* Ensured development build works with IE conditional compilation enabled
|
||||
* Ensured `_.clone` doesn't clone functions, DOM nodes, `arguments` objects, and objects created by constructors other than `Object`
|
||||
* Ensured `_.filter`’s `callback` can't modify result values
|
||||
* Ensured `_.isEmpty`, `_.isEquals`, and `_.size` support `arguments` objects
|
||||
* Ensured `_.isEqual` doesn't inspect DOM nodes, works with objects from other documents, and calls custom `isEqual` methods before checking strict equality
|
||||
* Ensured `_.once` frees the given function for garbage collection
|
||||
* Ensured `_.sortBy` performs a stable sort
|
||||
* Ensured `reEvaluateDelimiter` is assigned when `_.templateSettings.evaluate` is undefined
|
||||
* Made `_.range` coerce arguments to numbers
|
||||
* Optimized `_.isFunction`
|
||||
* Added `callback` and `thisArg` arguments to `_.drop` and `_.pick`
|
||||
* Added `hasObjectSpliceBug` test to avoid `delete` operator use
|
||||
* Added `_.omit` alias for `_.drop`
|
||||
* Added [_.unescape](http://lodash.com/docs#unescape)
|
||||
* Ensured `_.reduce` works with string objects in IE < 9
|
||||
* Made compiled methods take advantage of engines with strict mode optimizations
|
||||
* Optimized `_.intersection` and removed its dependency on `_.every`
|
||||
* Reduced the file size of the `underscore` build
|
||||
|
||||
The full changelog is available [here](https://github.com/bestiejs/lodash/wiki/Changelog).
|
||||
|
||||
## BestieJS
|
||||
|
||||
Lo-Dash is part of the BestieJS *"Best in Class"* module collection. This means we promote solid browser/environment support, ES5 precedents, unit testing, and plenty of documentation.
|
||||
Lo-Dash is part of the BestieJS *“Best in Class”* module collection. This means we promote solid browser/environment support, ES5 precedents, unit testing, and plenty of documentation.
|
||||
|
||||
## Author
|
||||
|
||||
|
||||
134
build.js
134
build.js
@@ -2,6 +2,9 @@
|
||||
;(function() {
|
||||
'use strict';
|
||||
|
||||
/** The debug version of `source` */
|
||||
var debugSource;
|
||||
|
||||
/** Load modules */
|
||||
var fs = require('fs'),
|
||||
path = require('path'),
|
||||
@@ -20,8 +23,11 @@
|
||||
/** Flag used to specify a legacy build */
|
||||
var isLegacy = process.argv.indexOf('legacy') > -1;
|
||||
|
||||
/** Flag used to specify an Underscore build */
|
||||
var isUnderscore = process.argv.indexOf('underscore') > -1;
|
||||
|
||||
/** Flag used to specify a mobile build */
|
||||
var isMobile = !isLegacy && (isCSP || process.argv.indexOf('mobile') > -1);
|
||||
var isMobile = !isLegacy && (isCSP || isUnderscore || process.argv.indexOf('mobile') > -1);
|
||||
|
||||
/**
|
||||
* Flag used to specify `_.bindAll`, `_.extend`, and `_.defaults` are
|
||||
@@ -29,9 +35,6 @@
|
||||
*/
|
||||
var isStrict = process.argv.indexOf('strict') > -1;
|
||||
|
||||
/** Flag used to specify an Underscore build */
|
||||
var isUnderscore = process.argv.indexOf('underscore') > -1;
|
||||
|
||||
/** Flag used to specify if the build should include the "use strict" directive */
|
||||
var useStrict = isStrict || !(isLegacy || isMobile);
|
||||
|
||||
@@ -47,19 +50,25 @@
|
||||
|
||||
if (isStrict) {
|
||||
source = setUseStrictOption(source, true);
|
||||
}
|
||||
else if (!useStrict) {
|
||||
} else {
|
||||
source = removeUseStrictDirective(source);
|
||||
source = setUseStrictOption(source, false);
|
||||
if (!useStrict) {
|
||||
source = setUseStrictOption(source, false);
|
||||
}
|
||||
}
|
||||
|
||||
if (isLegacy) {
|
||||
source = replaceVar(source, 'noArgsClass', 'true');
|
||||
['isBindFast', 'isKeysFast', 'nativeBind', 'nativeIsArray', 'nativeKeys'].forEach(function(varName) {
|
||||
['isBindFast', 'isKeysFast', 'isStrictFast', 'nativeBind', 'nativeIsArray', 'nativeKeys'].forEach(function(varName) {
|
||||
source = replaceVar(source, varName, 'false');
|
||||
});
|
||||
}
|
||||
else if (isMobile) {
|
||||
else if (isUnderscore) {
|
||||
// remove `prototype` [[Enumerable]] fix from `iteratorTemplate`
|
||||
source = source
|
||||
.replace(/(?: *\/\/.*\n)*\s*' *(?:<% *)?if *\(!hasDontEnumBug *(?:&&|\))[\s\S]+?<% *} *(?:%>|').+/g, '')
|
||||
.replace(/!hasDontEnumBug *\|\|/g, '');
|
||||
}
|
||||
if (isMobile) {
|
||||
source = replaceVar(source, 'isKeysFast', 'false');
|
||||
}
|
||||
vm.runInNewContext(source, sandbox);
|
||||
@@ -79,6 +88,7 @@
|
||||
'include': 'contains',
|
||||
'inject': 'reduce',
|
||||
'methods': 'functions',
|
||||
'omit': 'drop',
|
||||
'select': 'filter',
|
||||
'tail': 'rest',
|
||||
'take': 'first',
|
||||
@@ -88,6 +98,7 @@
|
||||
/** Used to associate real names with their aliases */
|
||||
var realToAliasMap = {
|
||||
'contains': ['include'],
|
||||
'drop': ['omit'],
|
||||
'every': ['all'],
|
||||
'filter': ['select'],
|
||||
'find': ['detect'],
|
||||
@@ -150,45 +161,45 @@
|
||||
/** Used to track function dependencies */
|
||||
var dependencyMap = {
|
||||
'after': [],
|
||||
'bind': [],
|
||||
'bindAll': ['bind', 'functions'],
|
||||
'bind': ['isFunction'],
|
||||
'bindAll': ['bind', 'isFunction'],
|
||||
'chain': ['mixin'],
|
||||
'clone': ['extend', 'forIn', 'forOwn', 'isArguments'],
|
||||
'clone': ['extend', 'forIn', 'forOwn', 'isArguments', 'isFunction'],
|
||||
'compact': [],
|
||||
'compose': [],
|
||||
'contains': [],
|
||||
'countBy': [],
|
||||
'debounce': [],
|
||||
'defaults': [],
|
||||
'defaults': ['isArguments'],
|
||||
'defer': [],
|
||||
'delay': [],
|
||||
'difference': ['indexOf'],
|
||||
'drop': ['indexOf'],
|
||||
'drop': ['indexOf', 'isArguments'],
|
||||
'escape': [],
|
||||
'every': ['identity'],
|
||||
'extend': [],
|
||||
'extend': ['isArguments'],
|
||||
'filter': ['identity'],
|
||||
'find': [],
|
||||
'first': [],
|
||||
'flatten': ['isArray'],
|
||||
'forEach': [],
|
||||
'forIn': [],
|
||||
'forOwn': [],
|
||||
'functions': [],
|
||||
'forIn': ['isArguments'],
|
||||
'forOwn': ['isArguments'],
|
||||
'functions': ['isArguments', 'isFunction'],
|
||||
'groupBy': [],
|
||||
'has': [],
|
||||
'identity': [],
|
||||
'indexOf': ['sortedIndex'],
|
||||
'initial': [],
|
||||
'intersection': ['every', 'indexOf'],
|
||||
'intersection': ['indexOf'],
|
||||
'invoke': [],
|
||||
'isArguments': [],
|
||||
'isArray': [],
|
||||
'isBoolean': [],
|
||||
'isDate': [],
|
||||
'isElement': [],
|
||||
'isEmpty': ['isArguments'],
|
||||
'isEqual': ['isArguments'],
|
||||
'isEmpty': ['isArguments', 'isFunction'],
|
||||
'isEqual': ['isArguments', 'isFunction'],
|
||||
'isFinite': [],
|
||||
'isFunction': [],
|
||||
'isNaN': [],
|
||||
@@ -198,13 +209,13 @@
|
||||
'isRegExp': [],
|
||||
'isString': [],
|
||||
'isUndefined': [],
|
||||
'keys': [],
|
||||
'keys': ['isArguments'],
|
||||
'last': [],
|
||||
'lastIndexOf': [],
|
||||
'map': ['identity'],
|
||||
'max': [],
|
||||
'memoize': [],
|
||||
'merge': ['isArray', 'forIn'],
|
||||
'merge': ['isArguments', 'isArray', 'forIn'],
|
||||
'min': [],
|
||||
'mixin': ['forEach', 'functions'],
|
||||
'noConflict': [],
|
||||
@@ -217,9 +228,9 @@
|
||||
'reduceRight': ['keys'],
|
||||
'reject': ['identity'],
|
||||
'rest': [],
|
||||
'result': [],
|
||||
'result': ['isFunction'],
|
||||
'shuffle': [],
|
||||
'size': ['isArguments', 'keys'],
|
||||
'size': ['isArguments', 'isFunction', 'keys'],
|
||||
'some': ['identity'],
|
||||
'sortBy': [],
|
||||
'sortedIndex': ['bind'],
|
||||
@@ -227,11 +238,12 @@
|
||||
'template': ['escape'],
|
||||
'throttle': [],
|
||||
'times': [],
|
||||
'toArray': ['values'],
|
||||
'toArray': ['isFunction', 'values'],
|
||||
'unescape': [],
|
||||
'union': ['indexOf'],
|
||||
'uniq': ['identity', 'indexOf'],
|
||||
'uniqueId': [],
|
||||
'values': [],
|
||||
'values': ['isArguments'],
|
||||
'where': ['forIn'],
|
||||
'without': ['indexOf'],
|
||||
'wrap': [],
|
||||
@@ -274,6 +286,7 @@
|
||||
'forOwn',
|
||||
'merge',
|
||||
'partial',
|
||||
'unescape',
|
||||
'where',
|
||||
'zipObject'
|
||||
]));
|
||||
@@ -542,6 +555,17 @@
|
||||
return source.replace(getIsArgumentsFallback(source), '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the `_.isFunction` fallback from `source`.
|
||||
*
|
||||
* @private
|
||||
* @param {String} source The source to process.
|
||||
* @returns {String} Returns the source with the `isFunction` fallback removed.
|
||||
*/
|
||||
function removeIsFunctionFallback(source) {
|
||||
return source.replace(/(?:\s*\/\/.*)*\s*if *\(isFunction\(\/x\/[\s\S]+?};\s*}/, '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the `Object.keys` object iteration optimization from `source`.
|
||||
*
|
||||
@@ -672,11 +696,14 @@
|
||||
* @returns {String} Returns the modified source.
|
||||
*/
|
||||
function setUseStrictOption(source, value) {
|
||||
return source
|
||||
// remove `isStrictFast` assignment
|
||||
return removeVar(source, 'isStrictFast')
|
||||
// replace `useStrict` branch in `value` with hard-coded option
|
||||
.replace(/(?: *\/\/.*\n)*(\s*)' *<% *if *\(useStrict\).+/, value ? "$1'\\'use strict\\';\\n' +" : '')
|
||||
// remove `useStrict` from iterator options
|
||||
.replace(/ *'useStrict': *false,\n/g, '')
|
||||
// remove `useStrict` variable assignment in `createIterator`
|
||||
.replace(/,\s*useStrict *=[^;]+/, '')
|
||||
// remove `useStrict` data object property assignment in `createIterator`
|
||||
.replace(/\s*.+?\.useStrict *=.+/, '');
|
||||
}
|
||||
@@ -694,7 +721,7 @@
|
||||
source = source.replace(/prototype\s*=\s*{\s*valueOf\s*:\s*1\s*}/, 'prototype={valueOf:1,y:1}');
|
||||
|
||||
// re-remove "use strict" added by the minifier
|
||||
if (!useStrict) {
|
||||
if (!isStrict) {
|
||||
source = removeUseStrictDirective(source);
|
||||
}
|
||||
fs.writeFileSync(path.join(cwd, filename), source);
|
||||
@@ -957,7 +984,7 @@
|
||||
return match.replace(/\bcallee\b/g, 'merge');
|
||||
});
|
||||
|
||||
// remove `hasDontEnumBug`, `iteratesOwnLast`, `noArgsEnum` assignment
|
||||
// remove `hasDontEnumBug`, `hasObjectSpliceBug`, `iteratesOwnLast`, `noArgsEnum` assignment
|
||||
source = source.replace(/(?:\n +\/\*[^*]*\*+(?:[^\/][^*]*\*+)*\/)?\n *var hasDontEnumBug\b[\s\S]+?}\(1\)\);\n/, '');
|
||||
|
||||
// remove `iteratesOwnLast` from `isPlainObject`
|
||||
@@ -966,8 +993,8 @@
|
||||
// remove JScript [[DontEnum]] fix from `_.isEqual`
|
||||
source = source.replace(/(?:\s*\/\/.*)*\n( +)if *\(hasDontEnumBug[\s\S]+?\n\1}/, '');
|
||||
|
||||
// remove IE `shift` and `splice` fix from mutator Array functions mixin
|
||||
source = source.replace(/(?:\s*\/\/.*)*\n( +)if *\(value.length *=== *0[\s\S]+?\n\1}/, '');
|
||||
// remove `hasObjectSpliceBug` fix from the mutator Array functions mixin
|
||||
source = source.replace(/(?:\s*\/\/.*)*\n( +)if *\(hasObjectSpliceBug[\s\S]+?\n\1}/, '');
|
||||
|
||||
// remove `noArraySliceOnStrings` from `_.toArray`
|
||||
source = source.replace(/noArraySliceOnStrings *\?[^:]+: *([^)]+)/g, '$1');
|
||||
@@ -1022,16 +1049,12 @@
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
// remove associated functions, variables, and code snippets that the minifier may miss
|
||||
if (isRemoved(source, 'bind')) {
|
||||
source = removeVar(source, 'nativeBind');
|
||||
source = removeVar(source, 'isBindFast');
|
||||
// modify/remove references to removed methods/variables
|
||||
if (isRemoved(source, 'isArguments')) {
|
||||
source = replaceVar(source, 'noArgsClass', 'false');
|
||||
}
|
||||
if (isRemoved(source, 'isArray')) {
|
||||
source = removeVar(source, 'nativeIsArray');
|
||||
}
|
||||
if (isRemoved(source, 'keys')) {
|
||||
source = removeFunction(source, 'shimKeys');
|
||||
if (isRemoved(source, 'isFunction')) {
|
||||
source = removeIsFunctionFallback(source);
|
||||
}
|
||||
if (isRemoved(source, 'mixin')) {
|
||||
// remove `LoDash` constructor
|
||||
@@ -1040,6 +1063,20 @@
|
||||
source = source.replace(/(?:new +LoDash(?!\()|(?:new +)?LoDash\([^)]*\));?/g, '');
|
||||
// remove `LoDash.prototype` additions
|
||||
source = source.replace(/(?:\s*\/\/.*)*\s*LoDash.prototype *=[\s\S]+?\/\*-+\*\//, '');
|
||||
// remove `hasObjectSpliceBug` assignment
|
||||
source = source.replace(/(?:\n +\/\*[^*]*\*+(?:[^\/][^*]*\*+)*\/)?\n *var hasObjectSpliceBug;|.+?hasObjectSpliceBug *=.+/g, '');
|
||||
}
|
||||
|
||||
// assign debug source before further modifications that rely on the minifier
|
||||
// to remove unused variables and other dead code
|
||||
debugSource = source;
|
||||
|
||||
// remove associated functions, variables, and code snippets that the minifier may miss
|
||||
if (isRemoved(source, 'isArray')) {
|
||||
source = removeVar(source, 'nativeIsArray');
|
||||
}
|
||||
if (isRemoved(source, 'keys')) {
|
||||
source = removeFunction(source, 'shimKeys');
|
||||
}
|
||||
if (isRemoved(source, 'template')) {
|
||||
// remove `templateSettings` assignment
|
||||
@@ -1061,6 +1098,11 @@
|
||||
source = removeFunction(source, 'createIterator');
|
||||
source = source.replace(/(?:\n +\/\*[^*]*\*+(?:[^\/][^*]*\*+)*\/)?\n *var noArgsEnum;|.+?noArgsEnum *=.+/g, '');
|
||||
}
|
||||
if (isRemoved(source, 'createIterator', 'bind')) {
|
||||
source = removeVar(source, 'isBindFast');
|
||||
source = removeVar(source, 'isStrictFast');
|
||||
source = removeVar(source, 'nativeBind');
|
||||
}
|
||||
if (isRemoved(source, 'createIterator', 'bind', 'isArray', 'keys')) {
|
||||
source = removeVar(source, 'reNative');
|
||||
}
|
||||
@@ -1073,9 +1115,9 @@
|
||||
if (isRemoved(source, 'createIterator', 'keys')) {
|
||||
source = removeVar(source, 'nativeKeys');
|
||||
}
|
||||
if (!source.match(/var (?:hasDontEnumBug|iteratesOwnLast|noArgsEnum)\b/g)) {
|
||||
// remove `hasDontEnumBug`, `iteratesOwnLast`, `noArgsEnum` assignment
|
||||
source = source.replace(/ *\(function\(\) *{\s*var props\b[\s\S]+?}\(1\)\);/, '');
|
||||
if (!source.match(/var (?:hasDontEnumBug|hasObjectSpliceBug|iteratesOwnLast|noArgsEnum)\b/g)) {
|
||||
// remove `hasDontEnumBug`, `hasObjectSpliceBug`, `iteratesOwnLast`, and `noArgsEnum` assignment
|
||||
source = source.replace(/ *\(function\(\) *{[\s\S]+?}\(1\)\);/, '');
|
||||
}
|
||||
|
||||
// remove pseudo private properties
|
||||
@@ -1091,7 +1133,7 @@
|
||||
|
||||
// begin the minification process
|
||||
if (filterType || isBackbone || isLegacy || isMobile || isStrict || isUnderscore) {
|
||||
writeFile(source, 'lodash.custom.js');
|
||||
writeFile(debugSource, 'lodash.custom.js');
|
||||
|
||||
minify(source, 'lodash.custom.min', function(result) {
|
||||
writeFile(result, 'lodash.custom.min.js');
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
/** Used to minify variables embedded in compiled strings */
|
||||
var compiledVars = [
|
||||
'argsIndex',
|
||||
'argsLength',
|
||||
'callback',
|
||||
'collection',
|
||||
'concat',
|
||||
@@ -36,8 +38,6 @@
|
||||
// lesser used variables
|
||||
'accumulator',
|
||||
'args',
|
||||
'argsIndex',
|
||||
'argsLength',
|
||||
'arrayLikeClasses',
|
||||
'ArrayProto',
|
||||
'bind',
|
||||
@@ -132,7 +132,6 @@
|
||||
'each',
|
||||
'environment',
|
||||
'escape',
|
||||
'escape',
|
||||
'evaluate',
|
||||
'every',
|
||||
'extend',
|
||||
@@ -187,6 +186,7 @@
|
||||
'min',
|
||||
'mixin',
|
||||
'noConflict',
|
||||
'omit',
|
||||
'once',
|
||||
'opera',
|
||||
'partial',
|
||||
@@ -214,6 +214,7 @@
|
||||
'throttle',
|
||||
'times',
|
||||
'toArray',
|
||||
'unescape',
|
||||
'union',
|
||||
'uniq',
|
||||
'unique',
|
||||
@@ -264,11 +265,8 @@
|
||||
// http://code.google.com/closure/compiler/docs/api-tutorial3.html#export
|
||||
source = source.replace(RegExp('\\.(' + propWhitelist.join('|') + ')\\b', 'g'), "['$1']");
|
||||
|
||||
// remove brackets from `_.escape()` in `tokenizeEscape`
|
||||
source = source.replace(/_\['escape']\("/, '_.escape("');
|
||||
|
||||
// remove brackets from `_.escape()` in `_.template`
|
||||
source = source.replace(/__e *= *_\['escape']/, '__e=_.escape');
|
||||
source = source.replace(/__e *= *_\['escape']/g, '__e=_.escape');
|
||||
|
||||
// remove brackets from `collection.indexOf` in `_.contains`
|
||||
source = source.replace("collection['indexOf'](target)", 'collection.indexOf(target)');
|
||||
@@ -279,7 +277,7 @@
|
||||
// remove whitespace from string literals
|
||||
source = source.replace(/'(?:(?=(\\?))\1.)*?'/g, function(string) {
|
||||
// avoids removing the '\n' of the `stringEscapes` object
|
||||
return string.replace(/\[object |else if|function | in |return\s+[\w']|throw |typeof |use strict|var |@ |'\\n'|\\\\n|\\n|\s+/g, function(match) {
|
||||
return string.replace(/\[object |delete |else if|function | in |return\s+[\w']|throw |typeof |use strict|var |@ |'\\n'|\\\\n|\\n|\s+/g, function(match) {
|
||||
return match == false || match == '\\n' ? '' : match;
|
||||
});
|
||||
});
|
||||
|
||||
368
doc/README.md
368
doc/README.md
File diff suppressed because it is too large
Load Diff
@@ -21,7 +21,7 @@
|
||||
// generate Markdown
|
||||
$markdown = docdown(array(
|
||||
'path' => '../' . $file,
|
||||
'title' => 'Lo-Dash <sup>v0.5.1</sup>',
|
||||
'title' => 'Lo-Dash <sup>v0.6.0</sup>',
|
||||
'url' => 'https://github.com/bestiejs/lodash/blob/master/lodash.js'
|
||||
));
|
||||
|
||||
|
||||
535
lodash.js
535
lodash.js
@@ -1,5 +1,5 @@
|
||||
/*!
|
||||
* Lo-Dash v0.5.1 <http://lodash.com>
|
||||
* Lo-Dash v0.6.0 <http://lodash.com>
|
||||
* Copyright 2012 John-David Dalton <http://allyoucanleet.com/>
|
||||
* Based on Underscore.js 1.3.3, copyright 2009-2012 Jeremy Ashkenas, DocumentCloud Inc.
|
||||
* <http://documentcloud.github.com/underscore>
|
||||
@@ -47,12 +47,18 @@
|
||||
/** Used to generate unique IDs */
|
||||
var idCounter = 0;
|
||||
|
||||
/** Used by `cachedContains` as the default size when optimizations are enabled for large arrays */
|
||||
var largeArraySize = 30;
|
||||
|
||||
/** Used to restore the original `_` reference in `noConflict` */
|
||||
var oldDash = window._;
|
||||
|
||||
/** Used to detect delimiter values that should be processed by `tokenizeEvaluate` */
|
||||
var reComplexDelimiter = /[-+=!~*%&^<>|{(\/]|\[\D|\b(?:delete|in|instanceof|new|typeof|void)\b/;
|
||||
|
||||
/** Used to match HTML entities */
|
||||
var reEscapedHtml = /&(?:amp|lt|gt|quot|#x27);/g;
|
||||
|
||||
/** Used to match empty string literals in compiled template source */
|
||||
var reEmptyStringLeading = /\b__p \+= '';/g,
|
||||
reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
|
||||
@@ -71,11 +77,11 @@
|
||||
.replace(/valueOf|for [^\]]+/g, '.+?') + '$'
|
||||
);
|
||||
|
||||
/** Used to match tokens in template text */
|
||||
/** Used to match internally used tokens in template text */
|
||||
var reToken = /__token__(\d+)/g;
|
||||
|
||||
/** Used to match unescaped characters in strings for inclusion in HTML */
|
||||
var reUnescapedHtml = /[&<"']/g;
|
||||
/** Used to match HTML characters */
|
||||
var reUnescapedHtml = /[&<>"']/g;
|
||||
|
||||
/** Used to match unescaped characters in compiled string literals */
|
||||
var reUnescapedString = /['\n\r\t\u2028\u2029\\]/g;
|
||||
@@ -126,11 +132,24 @@
|
||||
|
||||
/**
|
||||
* Detect the JScript [[DontEnum]] bug:
|
||||
*
|
||||
* In IE < 9 an objects own properties, shadowing non-enumerable ones, are
|
||||
* made non-enumerable as well.
|
||||
*/
|
||||
var hasDontEnumBug;
|
||||
|
||||
/**
|
||||
* Detect if `Array#shift` and `Array#splice` augment array-like objects
|
||||
* incorrectly:
|
||||
*
|
||||
* Firefox < 10, IE compatibility mode, and IE < 9 have buggy Array `shift()`
|
||||
* and `splice()` functions that fail to remove the last element, `value[0]`,
|
||||
* of array-like objects even though the `length` property is set to `0`.
|
||||
* The `shift()` method is buggy in IE 8 compatibility mode, while `splice()`
|
||||
* is buggy regardless of mode in IE < 9 and buggy in compatibility mode in IE 9.
|
||||
*/
|
||||
var hasObjectSpliceBug;
|
||||
|
||||
/** Detect if own properties are iterated after inherited properties (IE < 9) */
|
||||
var iteratesOwnLast;
|
||||
|
||||
@@ -138,13 +157,17 @@
|
||||
var noArgsEnum = true;
|
||||
|
||||
(function() {
|
||||
var props = [];
|
||||
var object = { '0': 1, 'length': 1 },
|
||||
props = [];
|
||||
|
||||
function ctor() { this.x = 1; }
|
||||
ctor.prototype = { 'valueOf': 1, 'y': 1 };
|
||||
for (var prop in new ctor) { props.push(prop); }
|
||||
for (prop in arguments) { noArgsEnum = !prop; }
|
||||
|
||||
hasDontEnumBug = (props + '').length < 4;
|
||||
iteratesOwnLast = props[0] != 'x';
|
||||
hasObjectSpliceBug = (props.splice.call(object, 0, 1), object[0]);
|
||||
}(1));
|
||||
|
||||
/** Detect if an `arguments` object's [[Class]] is unresolvable (Firefox < 4, IE < 9) */
|
||||
@@ -155,6 +178,7 @@
|
||||
|
||||
/**
|
||||
* Detect lack of support for accessing string characters by index:
|
||||
*
|
||||
* IE < 8 can't access characters by index and IE 8 can only access
|
||||
* characters by index on string literals.
|
||||
*/
|
||||
@@ -175,16 +199,25 @@
|
||||
/* Detect if `Object.keys` exists and is inferred to be fast (IE, Opera, V8) */
|
||||
var isKeysFast = nativeKeys && /^.+$|true/.test(nativeKeys + !!window.attachEvent);
|
||||
|
||||
/** Detect if sourceURL syntax is usable without erroring */
|
||||
/* Detect if strict mode, "use strict", is inferred to be fast (V8) */
|
||||
var isStrictFast = !isBindFast;
|
||||
|
||||
/**
|
||||
* Detect if sourceURL syntax is usable without erroring:
|
||||
*
|
||||
* The JS engine in Adobe products, like InDesign, will throw a syntax error
|
||||
* when it encounters a single line comment beginning with the `@` symbol.
|
||||
*
|
||||
* The JS engine in Narwhal will generate the function `function anonymous(){//}`
|
||||
* and throw a syntax error.
|
||||
*
|
||||
* In IE, `@` symbols are part of its non-standard conditional compilation support.
|
||||
* The `@cc_on` statement activates its support while the trailing ` !` induces
|
||||
* a syntax error to exlude it. Compatibility modes in IE > 8 require a space
|
||||
* before the `!` to induce a syntax error.
|
||||
* See http://msdn.microsoft.com/en-us/library/121hztk3(v=vs.94).aspx
|
||||
*/
|
||||
try {
|
||||
// The JS engine in Adobe products, like InDesign, will throw a syntax error
|
||||
// when it encounters a single line comment beginning with the `@` symbol.
|
||||
// The JS engine in Narwhal will generate the function `function anonymous(){//}`
|
||||
// and throw a syntax error. In IE, `@` symbols are part of its non-standard
|
||||
// conditional compilation support. The `@cc_on` statement activates its support
|
||||
// while the trailing ` !` induces a syntax error to exlude it. Compatibility
|
||||
// modes in IE > 8 require a space before the `!` to induce a syntax error.
|
||||
// See http://msdn.microsoft.com/en-us/library/121hztk3(v=vs.94).aspx
|
||||
var useSourceURL = (Function('//@cc_on !')(), true);
|
||||
} catch(e){ }
|
||||
|
||||
@@ -202,18 +235,30 @@
|
||||
cloneableClasses[stringClass] = true;
|
||||
|
||||
/**
|
||||
* Used to escape characters for inclusion in HTML.
|
||||
* The `>` and `/` characters don't require escaping in HTML and have no
|
||||
* special meaning unless they're part of a tag or an unquoted attribute value
|
||||
* http://mathiasbynens.be/notes/ambiguous-ampersands (semi-related fun fact)
|
||||
* Used to convert characters to HTML entities:
|
||||
*
|
||||
* Though the `>` character is escaped for symmetry, characters like `>` and `/`
|
||||
* don't require escaping in HTML and have no special meaning unless they're part
|
||||
* of a tag or an unquoted attribute value.
|
||||
* http://mathiasbynens.be/notes/ambiguous-ampersands (under "semi-related fun fact")
|
||||
*/
|
||||
var htmlEscapes = {
|
||||
'&': '&',
|
||||
'<': '<',
|
||||
'>': '>',
|
||||
'"': '"',
|
||||
"'": '''
|
||||
};
|
||||
|
||||
/** Used to convert HTML entities to characters */
|
||||
var htmlUnescapes = {
|
||||
'&': '&',
|
||||
'<': '<',
|
||||
'>': '>',
|
||||
'"': '"',
|
||||
''': "'"
|
||||
};
|
||||
|
||||
/** Used to determine if values are of the language type Object */
|
||||
var objectTypes = {
|
||||
'boolean': false,
|
||||
@@ -311,7 +356,7 @@
|
||||
* @memberOf _.templateSettings
|
||||
* @type String
|
||||
*/
|
||||
'variable': 'obj'
|
||||
'variable': ''
|
||||
};
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
@@ -371,6 +416,12 @@
|
||||
' } else {' +
|
||||
' <% } %>' +
|
||||
|
||||
// Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1
|
||||
// (if the prototype or a property on the prototype has been set)
|
||||
// incorrectly sets a function's `prototype` property [[Enumerable]]
|
||||
// value to `true`. Because of this Lo-Dash standardizes on skipping
|
||||
// the the `prototype` property of functions regardless of its
|
||||
// [[Enumerable]] value.
|
||||
' <% if (!hasDontEnumBug) { %>\n' +
|
||||
' var skipProto = typeof iteratee == \'function\' && \n' +
|
||||
' propertyIsEnumerable.call(iteratee, \'prototype\');\n' +
|
||||
@@ -379,40 +430,30 @@
|
||||
// iterate own properties using `Object.keys` if it's fast
|
||||
' <% if (isKeysFast && useHas) { %>\n' +
|
||||
' var ownIndex = -1,\n' +
|
||||
' ownProps = nativeKeys(iteratee),\n' +
|
||||
' ownProps = objectTypes[typeof iteratee] ? nativeKeys(iteratee) : [],\n' +
|
||||
' length = ownProps.length;\n\n' +
|
||||
' <%= objectBranch.beforeLoop %>;\n' +
|
||||
' while (++ownIndex < length) {\n' +
|
||||
' index = ownProps[ownIndex];\n' +
|
||||
' if (!(skipProto && index == \'prototype\')) {\n' +
|
||||
' value = iteratee[index];\n' +
|
||||
' <%= objectBranch.inLoop %>\n' +
|
||||
' }\n' +
|
||||
' <% if (!hasDontEnumBug) { %>if (!(skipProto && index == \'prototype\')) {\n <% } %>' +
|
||||
' value = iteratee[index];\n' +
|
||||
' <%= objectBranch.inLoop %>\n' +
|
||||
' <% if (!hasDontEnumBug) { %>}\n<% } %>' +
|
||||
' }' +
|
||||
|
||||
// else using a for-in loop
|
||||
' <% } else { %>\n' +
|
||||
' <%= objectBranch.beforeLoop %>;\n' +
|
||||
' for (index in iteratee) {' +
|
||||
' <% if (hasDontEnumBug) { %>\n' +
|
||||
' <% if (useHas) { %>if (hasOwnProperty.call(iteratee, index)) {\n <% } %>' +
|
||||
' <% if (!hasDontEnumBug || useHas) { %>\n if (<%' +
|
||||
' if (!hasDontEnumBug) { %>!(skipProto && index == \'prototype\')<% }' +
|
||||
' if (!hasDontEnumBug && useHas) { %> && <% }' +
|
||||
' if (useHas) { %>hasOwnProperty.call(iteratee, index)<% }' +
|
||||
' %>) {' +
|
||||
' <% } %>\n' +
|
||||
' value = iteratee[index];\n' +
|
||||
' <%= objectBranch.inLoop %>;\n' +
|
||||
' <% if (useHas) { %>}<% } %>' +
|
||||
' <% } else { %>\n' +
|
||||
|
||||
// Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1
|
||||
// (if the prototype or a property on the prototype has been set)
|
||||
// incorrectly sets a function's `prototype` property [[Enumerable]]
|
||||
// value to `true`. Because of this Lo-Dash standardizes on skipping
|
||||
// the the `prototype` property of functions regardless of its
|
||||
// [[Enumerable]] value.
|
||||
' if (!(skipProto && index == \'prototype\')<% if (useHas) { %> &&\n' +
|
||||
' hasOwnProperty.call(iteratee, index)<% } %>) {\n' +
|
||||
' value = iteratee[index];\n' +
|
||||
' <%= objectBranch.inLoop %>\n' +
|
||||
' }' +
|
||||
' <% } %>\n' +
|
||||
' <% if (!hasDontEnumBug || useHas) { %>}\n<% } %>' +
|
||||
' }' +
|
||||
' <% } %>' +
|
||||
|
||||
@@ -477,6 +518,25 @@
|
||||
'(hasOwnProperty.call(result, prop) ? result[prop]++ : result[prop] = 1)'
|
||||
};
|
||||
|
||||
/** Reusable iterator options for `drop` and `pick` */
|
||||
var dropIteratorOptions = {
|
||||
'useHas': false,
|
||||
'args': 'object, callback, thisArg',
|
||||
'init': '{}',
|
||||
'top':
|
||||
'var isFunc = typeof callback == \'function\';\n' +
|
||||
'if (!isFunc) {\n' +
|
||||
' var props = concat.apply(ArrayProto, arguments)\n' +
|
||||
'} else if (thisArg) {\n' +
|
||||
' callback = iteratorBind(callback, thisArg)\n' +
|
||||
'}',
|
||||
'inLoop':
|
||||
'if (isFunc\n' +
|
||||
' ? !callback(value, index, object)\n' +
|
||||
' : indexOf(props, index) < 0\n' +
|
||||
') result[index] = value'
|
||||
};
|
||||
|
||||
/** Reusable iterator options for `every` and `some` */
|
||||
var everyIteratorOptions = {
|
||||
'init': 'true',
|
||||
@@ -545,7 +605,7 @@
|
||||
fromIndex || (fromIndex = 0);
|
||||
|
||||
var length = array.length,
|
||||
isLarge = (length - fromIndex) >= (largeSize || 30),
|
||||
isLarge = (length - fromIndex) >= (largeSize || largeArraySize),
|
||||
cache = isLarge ? {} : array;
|
||||
|
||||
if (isLarge) {
|
||||
@@ -631,8 +691,8 @@
|
||||
if (typeof value == 'string') {
|
||||
value = { 'array': value, 'object': value };
|
||||
}
|
||||
data.arrayBranch[prop] = value.array;
|
||||
data.objectBranch[prop] = value.object;
|
||||
data.arrayBranch[prop] = value.array || '';
|
||||
data.objectBranch[prop] = value.object || '';
|
||||
} else {
|
||||
data[prop] = value;
|
||||
}
|
||||
@@ -640,7 +700,8 @@
|
||||
}
|
||||
// set additional template `data` values
|
||||
var args = data.args,
|
||||
firstArg = /^[^,]+/.exec(args)[0];
|
||||
firstArg = /^[^,]+/.exec(args)[0],
|
||||
useStrict = data.useStrict;
|
||||
|
||||
data.firstArg = firstArg;
|
||||
data.hasDontEnumBug = hasDontEnumBug;
|
||||
@@ -648,9 +709,9 @@
|
||||
data.noArgsEnum = noArgsEnum;
|
||||
data.shadowed = shadowed;
|
||||
data.useHas = data.useHas !== false;
|
||||
data.useStrict = data.useStrict !== false;
|
||||
data.useStrict = useStrict == null ? isStrictFast : useStrict;
|
||||
|
||||
if (!('noCharByIndex' in data)) {
|
||||
if (data.noCharByIndex == null) {
|
||||
data.noCharByIndex = noCharByIndex;
|
||||
}
|
||||
if (!data.exit) {
|
||||
@@ -678,8 +739,8 @@
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by `sortBy` to compare transformed `collection` values, sorting them
|
||||
* stabily in ascending order.
|
||||
* Used by `sortBy` to compare transformed `collection` values, stable sorting
|
||||
* them in ascending order.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} a The object to compare to `b`.
|
||||
@@ -729,7 +790,7 @@
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by `escape` to escape characters for inclusion in HTML.
|
||||
* Used by `escape` to convert characters to HTML entities.
|
||||
*
|
||||
* @private
|
||||
* @param {String} match The matched character to escape.
|
||||
@@ -817,7 +878,7 @@
|
||||
* @returns {String} Returns a token.
|
||||
*/
|
||||
function tokenizeEscape(match, value) {
|
||||
if (reComplexDelimiter.test(value)) {
|
||||
if (match && reComplexDelimiter.test(value)) {
|
||||
return '<e%-' + value + '%>';
|
||||
}
|
||||
var index = tokenized.length;
|
||||
@@ -837,15 +898,14 @@
|
||||
* @returns {String} Returns a token.
|
||||
*/
|
||||
function tokenizeEvaluate(match, escapeValue, interpolateValue, evaluateValue) {
|
||||
var index = tokenized.length;
|
||||
if (escapeValue) {
|
||||
tokenized[index] = "' +\n__e(" + escapeValue + ") +\n'";
|
||||
} else if (evaluateValue) {
|
||||
if (evaluateValue) {
|
||||
var index = tokenized.length;
|
||||
tokenized[index] = "';\n" + evaluateValue + ";\n__p += '";
|
||||
} else if (interpolateValue) {
|
||||
tokenized[index] = "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
|
||||
return token + index;
|
||||
}
|
||||
return token + index;
|
||||
return escapeValue
|
||||
? tokenizeEscape(null, escapeValue)
|
||||
: tokenizeInterpolate(null, interpolateValue);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -857,7 +917,7 @@
|
||||
* @returns {String} Returns a token.
|
||||
*/
|
||||
function tokenizeInterpolate(match, value) {
|
||||
if (reComplexDelimiter.test(value)) {
|
||||
if (match && reComplexDelimiter.test(value)) {
|
||||
return '<e%=' + value + '%>';
|
||||
}
|
||||
var index = tokenized.length;
|
||||
@@ -865,6 +925,17 @@
|
||||
return token + index;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by `unescape` to convert HTML entities to characters.
|
||||
*
|
||||
* @private
|
||||
* @param {String} match The matched character to unescape.
|
||||
* @returns {String} Returns the unescaped character.
|
||||
*/
|
||||
function unescapeHtmlChar(match) {
|
||||
return htmlUnescapes[match];
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
@@ -946,7 +1017,6 @@
|
||||
*/
|
||||
var shimKeys = createIterator({
|
||||
'args': 'object',
|
||||
'exit': 'if (!(object && objectTypes[typeof object])) throw TypeError()',
|
||||
'init': '[]',
|
||||
'inLoop': 'result.push(index)'
|
||||
});
|
||||
@@ -1099,26 +1169,30 @@
|
||||
/**
|
||||
* Creates a shallow clone of `object` excluding the specified properties.
|
||||
* Property names may be specified as individual arguments or as arrays of
|
||||
* property names.
|
||||
* property names. If `callback` is passed, it will be executed for each property
|
||||
* in the `object`, dropping the properties `callback` returns truthy for. The
|
||||
* `callback` is bound to `thisArg` and invoked with 3 arguments; (value, key, object).
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @alias omit
|
||||
* @category Objects
|
||||
* @param {Object} object The source object.
|
||||
* @param {Object} [prop1, prop2, ...] The properties to drop.
|
||||
* @param {Function|String} callback|[prop1, prop2, ...] The properties to drop
|
||||
* or the function called per iteration.
|
||||
* @param {Mixed} [thisArg] The `this` binding for the callback.
|
||||
* @returns {Object} Returns an object without the dropped properties.
|
||||
* @example
|
||||
*
|
||||
* _.drop({ 'name': 'moe', 'age': 40, 'userid': 'moe1' }, 'userid');
|
||||
* // => { 'name': 'moe', 'age': 40 }
|
||||
*
|
||||
* _.drop({ 'name': 'moe', '_hint': 'knucklehead', '_seed': '96c4eb' }, function(value, key) {
|
||||
* return key.charAt(0) == '_';
|
||||
* });
|
||||
* // => { 'name': 'moe' }
|
||||
*/
|
||||
var drop = createIterator({
|
||||
'useHas': false,
|
||||
'args': 'object',
|
||||
'init': '{}',
|
||||
'top': 'var props = concat.apply(ArrayProto, arguments)',
|
||||
'inLoop': 'if (indexOf(props, index) < 0) result[index] = value'
|
||||
});
|
||||
var drop = createIterator(dropIteratorOptions);
|
||||
|
||||
/**
|
||||
* Assigns enumerable properties of the source object(s) to the `destination`
|
||||
@@ -1231,7 +1305,7 @@
|
||||
* // => true
|
||||
*/
|
||||
function has(object, property) {
|
||||
return hasOwnProperty.call(object, property);
|
||||
return object ? hasOwnProperty.call(object, property) : false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1282,7 +1356,7 @@
|
||||
* // => true
|
||||
*/
|
||||
function isElement(value) {
|
||||
return !!(value && value.nodeType == 1);
|
||||
return value ? value.nodeType === 1 : false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1547,7 +1621,7 @@
|
||||
// http://es5.github.com/#x8
|
||||
// and avoid a V8 bug
|
||||
// http://code.google.com/p/v8/issues/detail?id=2291
|
||||
return value && objectTypes[typeof value];
|
||||
return value ? objectTypes[typeof value] : false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1686,51 +1760,121 @@
|
||||
* // => ['one', 'two', 'three'] (order is not guaranteed)
|
||||
*/
|
||||
var keys = !nativeKeys ? shimKeys : function(object) {
|
||||
var type = typeof object;
|
||||
|
||||
// avoid iterating over the `prototype` property
|
||||
return typeof object == 'function' && propertyIsEnumerable.call(object, 'prototype')
|
||||
? shimKeys(object)
|
||||
: nativeKeys(object);
|
||||
if (type == 'function' && propertyIsEnumerable.call(object, 'prototype')) {
|
||||
return shimKeys(object);
|
||||
}
|
||||
return object && objectTypes[type]
|
||||
? nativeKeys(object)
|
||||
: [];
|
||||
};
|
||||
|
||||
/**
|
||||
* Merges enumerable properties of the source object(s) into the `destination`
|
||||
* object. Subsequent sources will overwrite propery assignments of previous
|
||||
* sources.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Objects
|
||||
* @param {Object} object The destination object.
|
||||
* @param {Object} [source1, source2, ...] The source objects.
|
||||
* @param {Object} [indicator] Internally used to indicate that the `stack`
|
||||
* argument is an array of traversed objects instead of another source object.
|
||||
* @param {Array} [stack=[]] Internally used to keep track of traversed objects
|
||||
* to avoid circular references.
|
||||
* @returns {Object} Returns the destination object.
|
||||
* @example
|
||||
*
|
||||
* var stooges = [
|
||||
* { 'name': 'moe' },
|
||||
* { 'name': 'larry' }
|
||||
* ];
|
||||
*
|
||||
* var ages = [
|
||||
* { 'age': 40 },
|
||||
* { 'age': 50 }
|
||||
* ];
|
||||
*
|
||||
* _.merge(stooges, ages);
|
||||
* // => [{ 'name': 'moe', 'age': 40 }, { 'name': 'larry', 'age': 50 }]
|
||||
*/
|
||||
var merge = createIterator(extendIteratorOptions, {
|
||||
'args': 'object, source, indicator, stack',
|
||||
'top':
|
||||
'var destValue, found, isArr, stackLength, recursive = indicator == isPlainObject;\n' +
|
||||
'if (!recursive) stack = [];\n' +
|
||||
'for (var argsIndex = 1, argsLength = recursive ? 2 : arguments.length; argsIndex < argsLength; argsIndex++) {\n' +
|
||||
' if (iteratee = arguments[argsIndex]) {',
|
||||
'inLoop':
|
||||
'if (value && ((isArr = isArray(value)) || isPlainObject(value))) {\n' +
|
||||
' found = false; stackLength = stack.length;\n' +
|
||||
' while (stackLength--) {\n' +
|
||||
' if (found = stack[stackLength].source == value) break\n' +
|
||||
' }\n' +
|
||||
' if (found) {\n' +
|
||||
' result[index] = stack[stackLength].value\n' +
|
||||
' } else {\n' +
|
||||
' destValue = (destValue = result[index]) && isArr\n' +
|
||||
' ? (isArray(destValue) ? destValue : [])\n' +
|
||||
' : (isPlainObject(destValue) ? destValue : {});\n' +
|
||||
' stack.push({ value: destValue, source: value });\n' +
|
||||
' result[index] = callee(destValue, value, isPlainObject, stack)\n' +
|
||||
' }\n' +
|
||||
'} else if (value != null) {\n' +
|
||||
' result[index] = value\n' +
|
||||
'}'
|
||||
});
|
||||
|
||||
/**
|
||||
* Creates a shallow clone of `object` composed of the specified properties.
|
||||
* Property names may be specified as individual arguments or as arrays of
|
||||
* property names.
|
||||
* property names. If `callback` is passed, it will be executed for each property
|
||||
* in the `object`, picking the properties `callback` returns truthy for. The
|
||||
* `callback` is bound to `thisArg` and invoked with 3 arguments; (value, key, object).
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Objects
|
||||
* @param {Object} object The source object.
|
||||
* @param {Object} [prop1, prop2, ...] The properties to pick.
|
||||
* @param {Function|String} callback|[prop1, prop2, ...] The properties to pick
|
||||
* or the function called per iteration.
|
||||
* @param {Mixed} [thisArg] The `this` binding for the callback.
|
||||
* @returns {Object} Returns an object composed of the picked properties.
|
||||
* @example
|
||||
*
|
||||
* _.pick({ 'name': 'moe', 'age': 40, 'userid': 'moe1' }, 'name', 'age');
|
||||
* // => { 'name': 'moe', 'age': 40 }
|
||||
*
|
||||
* _.pick({ 'name': 'moe', '_hint': 'knucklehead', '_seed': '96c4eb' }, function(value, key) {
|
||||
* return key.charAt(0) != '_';
|
||||
* });
|
||||
* // => { 'name': 'moe' }
|
||||
*/
|
||||
function pick(object) {
|
||||
var prop,
|
||||
index = 0,
|
||||
props = concat.apply(ArrayProto, arguments),
|
||||
length = props.length,
|
||||
result = {};
|
||||
|
||||
// start `index` at `1` to skip `object`
|
||||
while (++index < length) {
|
||||
prop = props[index];
|
||||
if (prop in object) {
|
||||
result[prop] = object[prop];
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
var pick = createIterator(dropIteratorOptions, {
|
||||
'top':
|
||||
'if (typeof callback != \'function\') {\n' +
|
||||
' var prop,\n' +
|
||||
' props = concat.apply(ArrayProto, arguments),\n' +
|
||||
' length = props.length;\n' +
|
||||
' for (index = 1; index < length; index++) {\n' +
|
||||
' prop = props[index];\n' +
|
||||
' if (prop in object) result[prop] = object[prop]\n' +
|
||||
' }\n' +
|
||||
'} else {\n' +
|
||||
' if (thisArg) callback = iteratorBind(callback, thisArg)',
|
||||
'inLoop':
|
||||
'if (callback(value, index, object)) result[index] = value',
|
||||
'bottom': '}'
|
||||
});
|
||||
|
||||
/**
|
||||
* Gets the size of `value` by returning `value.length` if `value` is an
|
||||
* array, string, or `arguments` object. If `value` is an object, size is
|
||||
* determined by returning the number of own enumerable properties it has.
|
||||
*
|
||||
* @deprecated
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Objects
|
||||
@@ -1813,7 +1957,7 @@
|
||||
'init': 'false',
|
||||
'noCharByIndex': false,
|
||||
'beforeLoop': {
|
||||
'array': 'if (toString.call(iteratee) == stringClass) return collection.indexOf(target) > -1'
|
||||
'array': 'if (toString.call(collection) == stringClass) return collection.indexOf(target) > -1'
|
||||
},
|
||||
'inLoop': 'if (value === target) return true'
|
||||
});
|
||||
@@ -1829,8 +1973,8 @@
|
||||
* @memberOf _
|
||||
* @category Collections
|
||||
* @param {Array|Object|String} collection The collection to iterate over.
|
||||
* @param {Function|String} callback The function called per iteration or
|
||||
* property name to count by.
|
||||
* @param {Function|String} callback|property The function called per iteration
|
||||
* or property name to count by.
|
||||
* @param {Mixed} [thisArg] The `this` binding for the callback.
|
||||
* @returns {Object} Returns the composed aggregate object.
|
||||
* @example
|
||||
@@ -1945,8 +2089,8 @@
|
||||
* @memberOf _
|
||||
* @category Collections
|
||||
* @param {Array|Object|String} collection The collection to iterate over.
|
||||
* @param {Function|String} callback The function called per iteration or
|
||||
* property name to group by.
|
||||
* @param {Function|String} callback|property The function called per iteration
|
||||
* or property name to group by.
|
||||
* @param {Mixed} [thisArg] The `this` binding for the callback.
|
||||
* @returns {Object} Returns the composed aggregate object.
|
||||
* @example
|
||||
@@ -2025,63 +2169,6 @@
|
||||
*/
|
||||
var map = createIterator(baseIteratorOptions, mapIteratorOptions);
|
||||
|
||||
/**
|
||||
* Merges enumerable properties of the source object(s) into the `destination`
|
||||
* object. Subsequent sources will overwrite propery assignments of previous
|
||||
* sources.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Objects
|
||||
* @param {Object} object The destination object.
|
||||
* @param {Object} [source1, source2, ...] The source objects.
|
||||
* @param {Object} [indicator] Internally used to indicate that the `stack`
|
||||
* argument is an array of traversed objects instead of another source object.
|
||||
* @param {Array} [stack=[]] Internally used to keep track of traversed objects
|
||||
* to avoid circular references.
|
||||
* @returns {Object} Returns the destination object.
|
||||
* @example
|
||||
*
|
||||
* var stooges = [
|
||||
* { 'name': 'moe' },
|
||||
* { 'name': 'larry' }
|
||||
* ];
|
||||
*
|
||||
* var ages = [
|
||||
* { 'age': 40 },
|
||||
* { 'age': 50 }
|
||||
* ];
|
||||
*
|
||||
* _.merge(stooges, ages);
|
||||
* // => [{ 'name': 'moe', 'age': 40 }, { 'name': 'larry', 'age': 50 }]
|
||||
*/
|
||||
var merge = createIterator(extendIteratorOptions, {
|
||||
'args': 'object, source, indicator, stack',
|
||||
'top':
|
||||
'var destValue, found, isArr, stackLength, recursive = indicator == isPlainObject;\n' +
|
||||
'if (!recursive) stack = [];\n' +
|
||||
'for (var argsIndex = 1, argsLength = recursive ? 2 : arguments.length; argsIndex < argsLength; argsIndex++) {\n' +
|
||||
' if (iteratee = arguments[argsIndex]) {',
|
||||
'inLoop':
|
||||
'if (value && ((isArr = isArray(value)) || isPlainObject(value))) {\n' +
|
||||
' found = false; stackLength = stack.length;\n' +
|
||||
' while (stackLength--) {\n' +
|
||||
' if (found = stack[stackLength].source == value) break\n' +
|
||||
' }\n' +
|
||||
' if (found) {\n' +
|
||||
' result[index] = stack[stackLength].value\n' +
|
||||
' } else {\n' +
|
||||
' destValue = (destValue = result[index]) && isArr\n' +
|
||||
' ? (isArray(destValue) ? destValue : [])\n' +
|
||||
' : (isPlainObject(destValue) ? destValue : {});\n' +
|
||||
' stack.push({ value: destValue, source: value });\n' +
|
||||
' result[index] = callee(destValue, value, isPlainObject, stack)\n' +
|
||||
' }\n' +
|
||||
'} else if (value != null) {\n' +
|
||||
' result[index] = value\n' +
|
||||
'}'
|
||||
});
|
||||
|
||||
/**
|
||||
* Retrieves the value of a specified property from all elements in
|
||||
* the `collection`.
|
||||
@@ -2138,7 +2225,7 @@
|
||||
'var noaccum = arguments.length < 3;\n' +
|
||||
'if (thisArg) callback = iteratorBind(callback, thisArg)',
|
||||
'beforeLoop': {
|
||||
'array': 'if (noaccum) result = collection[++index]'
|
||||
'array': 'if (noaccum) result = iteratee[++index]'
|
||||
},
|
||||
'inLoop': {
|
||||
'array':
|
||||
@@ -2253,17 +2340,17 @@
|
||||
});
|
||||
|
||||
/**
|
||||
* Creates a new sorted array, sorted in ascending order by the results of
|
||||
* running each element of `collection` through a `callback`. The `callback` is
|
||||
* bound to `thisArg` and invoked with 3 arguments; (value, index|key, collection).
|
||||
* Creates a new array, stable sorted in ascending order by the results of
|
||||
* running each element of `collection` through a `callback`. The `callback`
|
||||
* is bound to `thisArg` and invoked with 3 arguments; (value, index|key, collection).
|
||||
* The `callback` argument may also be the name of a property to sort by (e.g. 'length').
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Collections
|
||||
* @param {Array|Object|String} collection The collection to iterate over.
|
||||
* @param {Function|String} callback The function called per iteration or
|
||||
* property name to sort by.
|
||||
* @param {Function|String} callback|property The function called per iteration
|
||||
* or property name to sort by.
|
||||
* @param {Mixed} [thisArg] The `this` binding for the callback.
|
||||
* @returns {Array} Returns a new array of sorted elements.
|
||||
* @example
|
||||
@@ -2301,7 +2388,7 @@
|
||||
});
|
||||
|
||||
/**
|
||||
* Converts the `collection`, into an array. Useful for converting the
|
||||
* Converts the `collection`, to an array. Useful for converting the
|
||||
* `arguments` object.
|
||||
*
|
||||
* @static
|
||||
@@ -2354,15 +2441,15 @@
|
||||
var where = createIterator(filterIteratorOptions, {
|
||||
'args': 'collection, properties',
|
||||
'top':
|
||||
'var pass, prop, propIndex, props = [];\n' +
|
||||
'var props = [];\n' +
|
||||
'forIn(properties, function(value, prop) { props.push(prop) });\n' +
|
||||
'var propsLength = props.length',
|
||||
'inLoop':
|
||||
'for (pass = true, propIndex = 0; propIndex < propsLength; propIndex++) {\n' +
|
||||
'for (var prop, pass = true, propIndex = 0; propIndex < propsLength; propIndex++) {\n' +
|
||||
' prop = props[propIndex];\n' +
|
||||
' if (!(pass = value[prop] === properties[prop])) break\n' +
|
||||
'}\n' +
|
||||
'if (pass) result.push(value)'
|
||||
'pass && result.push(value)'
|
||||
});
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
@@ -2586,17 +2673,19 @@
|
||||
return result;
|
||||
}
|
||||
var value,
|
||||
argsLength = arguments.length,
|
||||
cache = [],
|
||||
index = -1,
|
||||
length = array.length,
|
||||
others = slice.call(arguments, 1),
|
||||
cache = [];
|
||||
length = array.length;
|
||||
|
||||
while (++index < length) {
|
||||
array: while (++index < length) {
|
||||
value = array[index];
|
||||
if (indexOf(result, value) < 0 &&
|
||||
every(others, function(other, index) {
|
||||
return (cache[index] || (cache[index] = cachedContains(other)))(value);
|
||||
})) {
|
||||
if (indexOf(result, value) < 0) {
|
||||
for (var argsIndex = 1; argsIndex < argsLength; argsIndex++) {
|
||||
if (!(cache[argsIndex] || (cache[argsIndex] = cachedContains(arguments[argsIndex])))(value)) {
|
||||
continue array;
|
||||
}
|
||||
}
|
||||
result.push(value);
|
||||
}
|
||||
}
|
||||
@@ -3586,8 +3675,8 @@
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Escapes a string for inclusion in HTML, replacing `&`, `<`, `"`, and `'`
|
||||
* characters.
|
||||
* Converts the characters `&`, `<`, `>`, `"`, and `'` in `string` to their
|
||||
* corresponding HTML entities.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
@@ -3722,8 +3811,12 @@
|
||||
* A micro-templating method that handles arbitrary delimiters, preserves
|
||||
* whitespace, and correctly escapes quotes within interpolated code.
|
||||
*
|
||||
* Note: For Chrome extensions use the `lodash csp` build and see
|
||||
* http://code.google.com/chrome/extensions/trunk/sandboxingEval.html
|
||||
* Note: In the development build `_.template` utilizes sourceURLs for easier
|
||||
* debugging. See http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl
|
||||
*
|
||||
* Note: Lo-Dash may be used in Chrome extensions by either creating a `lodash csp`
|
||||
* build and avoiding `_.template` use, or loading Lo-Dash in a sandboxed page.
|
||||
* See http://developer.chrome.com/trunk/extensions/sandboxingEval.html
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
@@ -3735,7 +3828,7 @@
|
||||
* is given, else it returns the interpolated text.
|
||||
* @example
|
||||
*
|
||||
* // using compiled template
|
||||
* // using a compiled template
|
||||
* var compiled = _.template('hello: <%= name %>');
|
||||
* compiled({ 'name': 'moe' });
|
||||
* // => 'hello: moe'
|
||||
@@ -3744,32 +3837,38 @@
|
||||
* _.template(list, { 'people': ['moe', 'larry', 'curly'] });
|
||||
* // => '<li>moe</li><li>larry</li><li>curly</li>'
|
||||
*
|
||||
* var template = _.template('<b><%- value %></b>');
|
||||
* template({ 'value': '<script>' });
|
||||
* // using the "escape" delimiter to escape HTML in data property values
|
||||
* _.template('<b><%- value %></b>', { 'value': '<script>' });
|
||||
* // => '<b><script></b>'
|
||||
*
|
||||
* // using `print`
|
||||
* var compiled = _.template('<% print("Hello " + epithet); %>');
|
||||
* compiled({ 'epithet': 'stooge' });
|
||||
* // using the internal `print` function in "evaluate" delimiters
|
||||
* _.template('<% print("Hello " + epithet); %>', { 'epithet': 'stooge' });
|
||||
* // => 'Hello stooge.'
|
||||
*
|
||||
* // using custom template settings
|
||||
* // using custom template delimiter settings
|
||||
* _.templateSettings = {
|
||||
* 'interpolate': /\{\{(.+?)\}\}/g
|
||||
* };
|
||||
*
|
||||
* var template = _.template('Hello {{ name }}!');
|
||||
* template({ 'name': 'Mustache' });
|
||||
* _.template('Hello {{ name }}!', { 'name': 'Mustache' });
|
||||
* // => 'Hello Mustache!'
|
||||
*
|
||||
* // specify the `variable` option to avoid using a with-statement during compilation
|
||||
* _.template('Using a with-statement: <%= data.answer %>', { 'answer': 'no' }, { 'variable': 'data' });
|
||||
* // => 'Using a with-statement: no'
|
||||
* // using the `variable` option to ensure a with-statement isn't used in the compiled template
|
||||
* var compiled = _.template('hello: <%= data.name %>', null, { 'variable': 'data' });
|
||||
* compiled.source;
|
||||
* // => function(data) {
|
||||
* var __t, __p = '', __e = _.escape;
|
||||
* __p += 'hello: ' + ((__t = ( data.name )) == null ? '' : __t);
|
||||
* return __p;
|
||||
* }
|
||||
*
|
||||
* // using the `source` property
|
||||
* <script>
|
||||
* JST.project = <%= _.template(jstText).source %>;
|
||||
* </script>
|
||||
* // using the `source` property to inline compiled templates for meaningful
|
||||
* // line numbers in error messages and a stack trace
|
||||
* fs.writeFileSync(path.join(cwd, 'jst.js'), '\
|
||||
* var JST = {\
|
||||
* "main": ' + _.template(mainText).source + '\
|
||||
* };\
|
||||
* ');
|
||||
*/
|
||||
function template(text, data, options) {
|
||||
// based on John Resig's `tmpl` implementation
|
||||
@@ -3777,6 +3876,7 @@
|
||||
// and Laura Doktorova's doT.js
|
||||
// https://github.com/olado/doT
|
||||
options || (options = {});
|
||||
text += '';
|
||||
|
||||
var isEvaluating,
|
||||
result,
|
||||
@@ -3784,7 +3884,8 @@
|
||||
evaluateDelimiter = options.evaluate,
|
||||
interpolateDelimiter = options.interpolate,
|
||||
settings = lodash.templateSettings,
|
||||
variable = options.variable;
|
||||
variable = options.variable || settings.variable,
|
||||
hasVariable = variable;
|
||||
|
||||
// use default settings if no options object is provided
|
||||
if (escapeDelimiter == null) {
|
||||
@@ -3828,11 +3929,11 @@
|
||||
// clear stored code snippets
|
||||
tokenized.length = 0;
|
||||
|
||||
// if `options.variable` is not specified and the template contains "evaluate"
|
||||
// if `variable` is not specified and the template contains "evaluate"
|
||||
// delimiters, wrap a with-statement around the generated code to add the
|
||||
// data object to the top of the scope chain
|
||||
if (!variable) {
|
||||
variable = settings.variable || lastVariable || 'obj';
|
||||
if (!hasVariable) {
|
||||
variable = lastVariable || 'obj';
|
||||
|
||||
if (isEvaluating) {
|
||||
text = 'with (' + variable + ') {\n' + text + '\n}\n';
|
||||
@@ -3858,12 +3959,12 @@
|
||||
|
||||
// frame code as the function body
|
||||
text = 'function(' + variable + ') {\n' +
|
||||
variable + ' || (' + variable + ' = {});\n' +
|
||||
(hasVariable ? '' : variable + ' || (' + variable + ' = {});\n') +
|
||||
'var __t, __p = \'\', __e = _.escape' +
|
||||
(isEvaluating
|
||||
? ', __j = Array.prototype.join;\n' +
|
||||
'function print() { __p += __j.call(arguments, \'\') }\n'
|
||||
: ', __d = ' + variable + '.' + variable + ' || ' + variable + ';\n'
|
||||
: (hasVariable ? '' : ', __d = ' + variable + '.' + variable + ' || ' + variable) + ';\n'
|
||||
) +
|
||||
text +
|
||||
'return __p\n}';
|
||||
@@ -3888,7 +3989,7 @@
|
||||
}
|
||||
// provide the compiled function's source via its `toString` method, in
|
||||
// supported environments, or the `source` property as a convenience for
|
||||
// build time precompilation
|
||||
// inlining compiled templates during the build process
|
||||
result.source = text;
|
||||
return result;
|
||||
}
|
||||
@@ -3924,6 +4025,24 @@
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the HTML entities `&`, `<`, `>`, `"`, and `'`
|
||||
* in `string` to their corresponding characters.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Utilities
|
||||
* @param {String} string The string to unescape.
|
||||
* @returns {String} Returns the unescaped string.
|
||||
* @example
|
||||
*
|
||||
* _.unescape('Moe, Larry & Curly');
|
||||
* // => "Moe, Larry & Curly"
|
||||
*/
|
||||
function unescape(string) {
|
||||
return string == null ? '' : (string + '').replace(reEscapedHtml, unescapeHtmlChar);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a unique id. If `prefix` is passed, the id will be appended to it.
|
||||
*
|
||||
@@ -4043,7 +4162,7 @@
|
||||
* @memberOf _
|
||||
* @type String
|
||||
*/
|
||||
lodash.VERSION = '0.5.1';
|
||||
lodash.VERSION = '0.6.0';
|
||||
|
||||
// assign static methods
|
||||
lodash.after = after;
|
||||
@@ -4125,6 +4244,7 @@
|
||||
lodash.throttle = throttle;
|
||||
lodash.times = times;
|
||||
lodash.toArray = toArray;
|
||||
lodash.unescape = unescape;
|
||||
lodash.union = union;
|
||||
lodash.uniq = uniq;
|
||||
lodash.uniqueId = uniqueId;
|
||||
@@ -4147,6 +4267,7 @@
|
||||
lodash.include = contains;
|
||||
lodash.inject = reduce;
|
||||
lodash.methods = functions;
|
||||
lodash.omit = drop;
|
||||
lodash.select = filter;
|
||||
lodash.tail = rest;
|
||||
lodash.take = first;
|
||||
@@ -4177,13 +4298,9 @@
|
||||
var value = this._wrapped;
|
||||
func.apply(value, arguments);
|
||||
|
||||
// Firefox < 10, IE compatibility mode, and IE < 9 have buggy Array
|
||||
// `shift()` and `splice()` functions that fail to remove the last element,
|
||||
// `value[0]`, of array-like objects even though the `length` property is
|
||||
// set to `0`. The `shift()` method is buggy in IE 8 compatibility mode,
|
||||
// while `splice()` is buggy regardless of mode in IE < 9 and buggy in
|
||||
// compatibility mode in IE 9.
|
||||
if (value.length === 0) {
|
||||
// avoid array-like object bugs with `Array#shift` and `Array#splice` in
|
||||
// Firefox < 10 and IE < 9
|
||||
if (hasObjectSpliceBug && value.length === 0) {
|
||||
delete value[0];
|
||||
}
|
||||
if (this._chain) {
|
||||
|
||||
75
lodash.min.js
vendored
75
lodash.min.js
vendored
@@ -1,40 +1,41 @@
|
||||
/*!
|
||||
Lo-Dash 0.5.1 lodash.com/license
|
||||
Lo-Dash 0.6.0 lodash.com/license
|
||||
Underscore.js 1.3.3 github.com/documentcloud/underscore/blob/master/LICENSE
|
||||
*/
|
||||
;(function(e,t){"use strict";function s(e){return new o(e)}function o(e){if(e&&e._wrapped)return e;this._wrapped=e}function u(e,t,n){t||(t=0);var r=e.length,i=r-t>=(n||30),s=i?{}:e;if(i)for(var o=t-1;++o<r;)n=e[o]+"",(ot.call(s,n)?s[n]:s[n]=[]).push(e[o]);return function(e){if(i){var n=e+"";return ot.call(s,n)&&-1<C(s[n],e)}return-1<C(s,e,t)}}function a(){for(var e,t,n,s=-1,o=arguments.length,u={e:"",f:"",j:"",q:"",c:{d:""},m:{d:""}};++s<o;)for(t in e=arguments[s],e)n=(n=e[t])==r?"":n,/d|i/.test(t
|
||||
)?("string"==typeof n&&(n={b:n,l:n}),u.c[t]=n.b,u.m[t]=n.l):u[t]=n;e=u.a,t=/^[^,]+/.exec(e)[0],u.g=t,u.h=Nt,u.k=Pt,u.n=kt,u.p=nt,u.r=u.r!==i,u.s=u.s!==i,"o"in u||(u.o=Ot),u.f||(u.f="if(!"+t+")return s");if("b"!=t||!u.c.i)u.c=r;t="",u.s&&(t+="'use strict';"),t+="var g,y,h="+u.g+",s",u.j&&(t+="="+u.j),t+=";"+u.f+";"+u.q+";",u.c&&(t+="var j=h.length;g=-1;",u.m&&(t+="if(j>-1&&j===j>>>0){"),u.o&&(t+="if(x.call(h)==v){h=h.split('')}"),t+=u.c.d+";while(++g<j){y=h[g];"+u.c.i+"}",u.m&&(t+="}"));if(u.m){u.
|
||||
c?t+="else{":u.n&&(t+="var j=h.length;g=-1;if(j&&P(h)){while(++g<j){y=h[g+=''];"+u.m.i+"}}else{"),u.h||(t+="var t=typeof h=='function'&&p.call(h,'prototype');"),u.k&&u.r?t+="var m=-1,n=k(h),j=n.length;"+u.m.d+";while(++m<j){g=n[m];if(!(t&&g=='prototype')){y=h[g];"+u.m.i+"}}":(t+=u.m.d+";for(g in h){",u.h?(u.r&&(t+="if(e.call(h,g)){"),t+="y=h[g];"+u.m.i+";",u.r&&(t+="}")):(t+="if(!(t&&g=='prototype')",u.r&&(t+="&&e.call(h,g)"),t+="){y=h[g];"+u.m.i+"}"),t+="}");if(u.h){t+="var d=h.constructor;";for(
|
||||
n=0;7>n;n++)t+="g='"+u.p[n]+"';if(","constructor"==u.p[n]&&(t+="!(d&&d.prototype===h)&&"),t+="e.call(h,g)){y=h[g];"+u.m.i+"}"}if(u.c||u.n)t+="}"}return t+=u.e+";return s",Function("D,E,F,I,c,K,e,f,N,P,R,T,U,i,X,Y,k,p,u,v,x","var G=function("+e+"){"+t+"};return G")(Ht,I,M,f,st,Zt,ot,_,C,b,Jt,w,p,d,wt,Ft,dt,at,ft,St,lt)}function f(e,n){var r=e.b,i=n.b,e=e.a,n=n.a;return e===t?1:n===t?-1:e<n?-1:e>n?1:r<i?-1:1}function l(e,t){return it[t]}function c(e){return"\\"+It[e]}function h(e){return jt[e]}function p
|
||||
(e,t){var n=i;if(!e||"object"!=typeof e||!t&&b(e))return n;var r=e.constructor;return(!Mt||"function"==typeof e.toString||"string"!=typeof (e+""))&&(!w(r)||r instanceof r)?Ct?(Zt(e,function(t,r){return n=!ot.call(e,r),i}),n===i):(Zt(e,function(e,t){n=t}),n===i||ot.call(e,n)):n}function d(e,t){return function(n,r,i){return e.call(t,n,r,i)}}function v(){}function m(e,t){if(V.test(t))return"<e%-"+t+"%>";var n=it.length;return it[n]="'+__e("+t+")+'",rt+n}function g(e,t,n,r){return e=it.length,t?it[e]="'+__e("+
|
||||
t+")+'":r?it[e]="';"+r+";__p+='":n&&(it[e]="'+((__t=("+n+"))==null?'':__t)+'"),rt+e}function y(e,t){if(V.test(t))return"<e%="+t+"%>";var n=it.length;return it[n]="'+((__t=("+t+"))==null?'':__t)+'",rt+n}function b(e){return lt.call(e)==vt}function w(e){return"function"==typeof e}function E(e,t,s,o,u){if(e==r)return e;s&&(t=i),u||(u={d:r}),u.d==r&&(u.d=!(!q.clone&&!U.clone&&!z.clone));if(((s=Ft[typeof e])||u.d)&&e.clone&&w(e.clone))return u.d=r,e.clone(t);if(s){var a=lt.call(e);if(!Bt[a]||Lt&&b(e))
|
||||
return e;var f=a==mt,s=f||(a==wt?p(e,n):s)}if(!s||!t)return s?f?ft.call(e):Yt({},e):e;s=e.constructor;switch(a){case gt:return new s(e==n);case yt:return new s(+e);case bt:case St:return new s(e);case Et:return s(e.source,Q.exec(e))}o||(o=[]);for(a=o.length;a--;)if(o[a].c==e)return o[a].d;var a=e.length,l=f?s(a):{};o.push({d:l,c:e});if(f)for(f=-1;++f<a;)l[f]=E(e[f],t,r,o,u);else en(e,function(e,n){l[n]=E(e,t,r,o,u)});return l}function S(e,t,s,o){if(e==r||t==r)return e===t;o||(o={value:r}),o.value==
|
||||
r&&(o.value=!(!q.isEqual&&!U.isEqual&&!z.isEqual));if(Ft[typeof e]||Ft[typeof t]||o.value){e._chain&&(e=e._wrapped),t._chain&&(t=t._wrapped);if(e.isEqual&&w(e.isEqual))return o.value=r,e.isEqual(t);if(t.isEqual&&w(t.isEqual))return o.value=r,t.isEqual(e)}if(e===t)return 0!==e||1/e==1/t;var u=lt.call(e);if(u!=lt.call(t))return i;switch(u){case gt:case yt:return+e==+t;case bt:return e!=+e?t!=+t:0==e?1/e==1/t:e==+t;case Et:case St:return e==t+""}var a=Ht[u];if(Lt&&!a&&(a=b(e))&&!b(t)||!a&&(u!=wt||Mt&&
|
||||
("function"!=typeof e.toString&&"string"==typeof (e+"")||"function"!=typeof t.toString&&"string"==typeof (t+""))))return i;s||(s=[]);for(u=s.length;u--;)if(s[u]==e)return n;var u=-1,f=n,l=0;s.push(e);if(a){l=e.length;if(f=l==t.length)for(;l--&&(f=S(e[l],t[l],s,o)););return f}a=e.constructor,f=t.constructor;if(a!=f&&(!w(a)||!(a instanceof a&&w(f)&&f instanceof f)))return i;for(var c in e)if(ot.call(e,c)&&(l++,!ot.call(t,c)||!S(e[c],t[c],s,o)))return i;for(c in t)if(ot.call(t,c)&&!(l--))return i;if(
|
||||
Nt)for(;7>++u;)if(c=nt[u],ot.call(e,c)&&(!ot.call(t,c)||!S(e[c],t[c],s,o)))return i;return n}function x(e,t,n,r){if(!e)return n;var i=e.length,s=3>arguments.length;r&&(t=d(t,r));if(-1<i&&i===i>>>0){var o=Ot&<.call(e)==St?e.split(""):e;for(i&&s&&(n=o[--i]);i--;)n=t(n,o[i],i,e);return n}o=rn(e);for((i=o.length)&&s&&(n=e[o[--i]]);i--;)s=o[i],n=t(n,e[s],s,e);return n}function T(e,t,n){if(e)return t==r||n?e[0]:ft.call(e,0,t)}function N(e,t){var n=[];if(!e)return n;for(var r,i=-1,s=e.length;++i<s;)r=
|
||||
e[i],Jt(r)?ut.apply(n,t?r:N(r)):n.push(r);return n}function C(e,t,n){if(!e)return-1;var r=-1,i=e.length;if(n){if("number"!=typeof n)return r=A(e,t),e[r]===t?r:-1;r=(0>n?Math.max(0,i+n):n)-1}for(;++r<i;)if(e[r]===t)return r;return-1}function k(e,t,n){var r=-Infinity,i=r;if(!e)return i;var s=-1,o=e.length;if(!t){for(;++s<o;)e[s]>i&&(i=e[s]);return i}for(n&&(t=d(t,n));++s<o;)n=t(e[s],s,e),n>r&&(r=n,i=e[s]);return i}function L(e,t,n){return e?ft.call(e,t==r||n?1:t):[]}function A(e,t,n,r){if(!e)return 0
|
||||
;var i=0,s=e.length;if(n){r&&(n=M(n,r));for(t=n(t);i<s;)r=i+s>>>1,n(e[r])<t?i=r+1:s=r}else for(;i<s;)r=i+s>>>1,e[r]<t?i=r+1:s=r;return i}function O(e,t,n,r){var s=[];if(!e)return s;var o=-1,u=e.length,a=[];"function"==typeof t&&(r=n,n=t,t=i);for(n?r&&(n=d(n,r)):n=_;++o<u;)if(r=n(e[o],o,e),t?!o||a[a.length-1]!==r:0>C(a,r))a.push(r),s.push(e[o]);return s}function M(e,t){function n(){var o=arguments,u=t;return i||(e=t[r]),s.length&&(o=o.length?s.concat(ft.call(o)):s),this instanceof n?(v.prototype=e
|
||||
.prototype,u=new v,(o=e.apply(u,o))&&Ft[typeof o]?o:u):e.apply(u,o)}var r,i=w(e);if(i){if(Dt||ct&&2<arguments.length)return ct.call.apply(ct,arguments)}else r=t,t=e;var s=ft.call(arguments,2);return n}function _(e){return e}function D(e){cn(tn(e),function(t){var r=s[t]=e[t];o.prototype[t]=function(){var e=[this._wrapped];return arguments.length&&ut.apply(e,arguments),e=r.apply(s,e),this._chain&&(e=new o(e),e._chain=n),e}})}var n=!0,r=null,i=!1,P,H,B,j,F="object"==typeof exports&&exports&&("object"==typeof
|
||||
global&&global&&global==global.global&&(e=global),exports),I=Array.prototype,q=Boolean.prototype,R=Object.prototype,U=Number.prototype,z=String.prototype,W=0,X=e._,V=/[-+=!~*%&^<>|{(\/]|\[\D|\b(?:delete|in|instanceof|new|typeof|void)\b/,$=/\b__p\+='';/g,J=/\b(__p\+=)''\+/g,K=/(__e\(.*?\)|\b__t\))\+'';/g,Q=/\w*$/,G=/(?:__e|__t=)\(\s*(?![\d\s"']|this\.)/g,Y=RegExp("^"+(R.valueOf+"").replace(/[.*+?^=!:${}()|[\]\/\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),Z=/__token__(\d+)/g,et=/[&<"']/g
|
||||
,tt=/['\n\r\t\u2028\u2029\\]/g,nt="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),rt="__token__",it=[],st=I.concat,ot=R.hasOwnProperty,ut=I.push,at=R.propertyIsEnumerable,ft=I.slice,lt=R.toString,ct=Y.test(ct=ft.bind)&&ct,ht=Y.test(ht=Array.isArray)&&ht,pt=e.isFinite,dt=Y.test(dt=Object.keys)&&dt,vt="[object Arguments]",mt="[object Array]",gt="[object Boolean]",yt="[object Date]",bt="[object Number]",wt="[object Object]",Et="[object RegExp]"
|
||||
,St="[object String]",xt=e.clearTimeout,Tt=e.setTimeout,Nt,Ct,kt=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)kt=!n;Nt=4>(t+"").length,Ct="x"!=t[0]})(1);var Lt=!b(arguments),At="x"!=ft.call("x")[0],Ot="xx"!="x"[0]+Object("x")[0];try{var Mt=("[object Object]",lt.call(e.document||0)==wt)}catch(_t){}var Dt=ct&&/\n|Opera/.test(ct+lt.call(e.opera)),Pt=dt&&/^.+$|true/.test(dt+!!e.attachEvent),Ht={"[object Arguments]":n,"[object Array]"
|
||||
:n,"[object Boolean]":i,"[object Date]":i,"[object Function]":i,"[object Number]":i,"[object Object]":i,"[object RegExp]":i,"[object String]":n},Bt={"[object Arguments]":i,"[object Array]":n,"[object Boolean]":n,"[object Date]":n,"[object Function]":i,"[object Number]":n,"[object Object]":n,"[object RegExp]":n,"[object String]":n},jt={"&":"&","<":"<",'"':""","'":"'"},Ft={"boolean":i,"function":n,object:n,number:i,string:i,"undefined":i,unknown:n},It={"\\":"\\","'":"'","\n":"n","\r"
|
||||
:"r"," ":"t","\u2028":"u2028","\u2029":"u2029"};s.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:"obj"};var qt={a:"b,a,w",j:"b",q:"if(!a)a=f;else if(w)a=i(a,w)",i:"if(a(y,g,b)===false)return s"},Rt={j:"{}",q:"var o;if(typeof a!='function'){var ii=a;a=function(y){return y[ii]}}else if(w)a=i(a,w)",i:"o=a(y,g,b);(e.call(s,o)?s[o]++:s[o]=1)"},Ut={j:"true",i:"if(!a(y,g,b))return!s"},zt={r:i,s:i,a:"l",j:"l",q:"for(var B=1,C=arguments.length;B<C;B++){if(h=arguments[B]){"
|
||||
,i:"s[g]=y",e:"}}"},Wt={j:"[]",i:"a(y,g,b)&&s.push(y)"},Xt={q:"if(w)a=i(a,w)"},Vt={i:{l:qt.i}},$t={j:"",f:"if(!b)return[]",d:{b:"s=Array(j)",l:"s="+(Pt?"Array(j)":"[]")},i:{b:"s[g]=a(y,g,b)",l:"s"+(Pt?"[m]=":".push")+"(a(y,g,b))"}};Lt&&(b=function(e){return!!e&&!!ot.call(e,"callee")});var Jt=ht||function(e){return lt.call(e)==mt};w(/x/)&&(w=function(e){return"[object Function]"==lt.call(e)});var Kt=a({a:"l",f:"if(!(l&&Y[typeof l]))throw TypeError()",j:"[]",i:"s.push(g)"}),Qt=a(zt,{i:"if(s[g]==null)"+
|
||||
zt.i}),Gt=a({r:i,a:"l",j:"{}",q:"var r=c.apply(E,arguments)",i:"if(N(r,g)<0)s[g]=y"}),Yt=a(zt),Zt=a(qt,Xt,Vt,{r:i}),en=a(qt,Xt,Vt),tn=a({r:i,a:"l",j:"[]",i:"if(T(y))s.push(g)",e:"s.sort()"}),nn=a({a:"y",j:"true",q:"var H=x.call(y),j=y.length;if(D[H]"+(Lt?"||P(y)":"")+"||(H==X&&j>-1&&j===j>>>0&&T(y.splice)))return!j",i:{l:"return false"}}),rn=dt?function(e){return"function"==typeof e&&at.call(e,"prototype")?Kt(e):dt(e)}:Kt,sn=a({a:"l",j:"[]",i:"s.push(y)"}),on=a({a:"b,hh",j:"false",o:i,d:{b:"if(x.call(h)==v)return b.indexOf(hh)>-1"
|
||||
},i:"if(y===hh)return true"}),un=a(qt,Rt),an=a(qt,Ut),fn=a(qt,Wt),ln=a(qt,Xt,{j:"",i:"if(a(y,g,b))return y"}),cn=a(qt,Xt),hn=a(qt,Rt,{i:"o=a(y,g,b);(e.call(s,o)?s[o]:s[o]=[]).push(y)"}),pn=a($t,{a:"b,V",q:"var A=u.call(arguments,2),S=typeof V=='function'",i:{b:"s[g]=(S?V:y[V]).apply(y,A)",l:"s"+(Pt?"[m]=":".push")+"((S?V:y[V]).apply(y,A))"}}),dn=a(qt,$t),vn=a(zt,{a:"l,ee,O,ff",q:"var J,L,Q,gg,dd=O==U;if(!dd)ff=[];for(var B=1,C=dd?2:arguments.length;B<C;B++){if(h=arguments[B]){",i:"if(y&&((Q=R(y))||U(y))){L=false;gg=ff.length;while(gg--)if(L=ff[gg].c==y)break;if(L){s[g]=ff[gg].d}else{J=(J=s[g])&&Q?(R(J)?J:[]):(U(J)?J:{});ff.push({d:J,c:y});s[g]=G(J,y,U,ff)}}else if(y!=null)s[g]=y"
|
||||
}),mn=a($t,{a:"b,bb",i:{b:"s[g]=y[bb]",l:"s"+(Pt?"[m]=":".push")+"(y[bb])"}}),gn=a({a:"b,a,z,w",j:"z",q:"var W=arguments.length<3;if(w)a=i(a,w)",d:{b:"if(W)s=b[++g]"},i:{b:"s=a(s,y,g,b)",l:"s=W?(W=false,y):a(s,y,g,b)"}}),yn=a(qt,Wt,{i:"!"+Wt.i}),bn=a(qt,Ut,{j:"false",i:Ut.i.replace("!","")}),wn=a(qt,Rt,$t,{i:{b:"s[g]={a:a(y,g,b),b:g,d:y}",l:"s"+(Pt?"[m]=":".push")+"({a:a(y,g,b),b:g,d:y})"},e:"s.sort(I);j=s.length;while(j--)s[j]=s[j].d"}),En=a(Wt,{a:"b,aa",q:"var Z,o,q,r=[];K(aa,function(y,o){r.push(o)});var cc=r.length"
|
||||
,i:"for(Z=true,q=0;q<cc;q++){o=r[q];if(!(Z=y[o]===aa[o]))break}if(Z)s.push(y)"}),Sn=a({r:i,s:i,a:"l",j:"l",q:"var M=arguments,j=M.length;if(j>1){for(var g=1;g<j;g++)s[M[g]]=F(s[M[g]],s);return s}",i:"if(T(s[g]))s[g]=F(s[g],s)"});s.VERSION="0.5.1",s.after=function(e,t){return 1>e?t():function(){if(1>--e)return t.apply(this,arguments)}},s.bind=M,s.bindAll=Sn,s.chain=function(e){return e=new o(e),e._chain=n,e},s.clone=E,s.compact=function(e){var t=[];if(!e)return t;for(var n=-1,r=e.length;++n<r;)e[n
|
||||
]&&t.push(e[n]);return t},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=on,s.countBy=un,s.debounce=function(e,t,n){function i(){a=r,n||e.apply(u,s)}var s,o,u,a;return function(){var r=n&&!a;return s=arguments,u=this,xt(a),a=Tt(i,t),r&&(o=e.apply(u,s)),o}},s.defaults=Qt,s.defer=function(e){var n=ft.call(arguments,1);return Tt(function(){return e.apply(t,n)},1)},s.delay=function(e,n){var r=ft.call(arguments
|
||||
,2);return Tt(function(){return e.apply(t,r)},n)},s.difference=function(e){var t=[];if(!e)return t;for(var n=-1,r=e.length,i=st.apply(t,arguments),i=u(i,r);++n<r;)i(e[n])||t.push(e[n]);return t},s.drop=Gt,s.escape=function(e){return e==r?"":(e+"").replace(et,h)},s.every=an,s.extend=Yt,s.filter=fn,s.find=ln,s.first=T,s.flatten=N,s.forEach=cn,s.forIn=Zt,s.forOwn=en,s.functions=tn,s.groupBy=hn,s.has=function(e,t){return ot.call(e,t)},s.identity=_,s.indexOf=C,s.initial=function(e,t,n){return e?ft.call
|
||||
(e,0,-(t==r||n?1:t)):[]},s.intersection=function(e){var t=[];if(!e)return t;for(var n,r=-1,i=e.length,s=ft.call(arguments,1),o=[];++r<i;)n=e[r],0>C(t,n)&&an(s,function(e,t){return(o[t]||(o[t]=u(e)))(n)})&&t.push(n);return t},s.invoke=pn,s.isArguments=b,s.isArray=Jt,s.isBoolean=function(e){return e===n||e===i||lt.call(e)==gt},s.isElement=function(e){return!!e&&1==e.nodeType},s.isEmpty=nn,s.isEqual=S,s.isFinite=function(e){return pt(e)&<.call(e)==bt},s.isFunction=w,s.isNaN=function(e){return lt.call
|
||||
(e)==bt&&e!=+e},s.isNull=function(e){return e===r},s.isObject=function(e){return e&&Ft[typeof e]},s.isUndefined=function(e){return e===t},s.keys=rn,s.last=function(e,t,n){if(e){var i=e.length;return t==r||n?e[i-1]:ft.call(e,-t||i)}},s.lastIndexOf=function(e,t,n){if(!e)return-1;var r=e.length;for(n&&"number"==typeof n&&(r=(0>n?Math.max(0,r+n):Math.min(n,r-1))+1);r--;)if(e[r]===t)return r;return-1},s.map=dn,s.max=k,s.memoize=function(e,t){var n={};return function(){var r=t?t.apply(this,arguments):arguments
|
||||
[0];return ot.call(n,r)?n[r]:n[r]=e.apply(this,arguments)}},s.merge=vn,s.min=function(e,t,n){var r=Infinity,i=r;if(!e)return i;var s=-1,o=e.length;if(!t){for(;++s<o;)e[s]<i&&(i=e[s]);return i}for(n&&(t=d(t,n));++s<o;)n=t(e[s],s,e),n<r&&(r=n,i=e[s]);return i},s.mixin=D,s.noConflict=function(){return e._=X,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){var t=ft.call(arguments,1),n=t.length;return function(){var r;return r=
|
||||
arguments,r.length&&(t.length=n,ut.apply(t,r)),r=1==t.length?e.call(this,t[0]):e.apply(this,t),t.length=n,r}},s.pick=function(e){for(var t,n=0,r=st.apply(I,arguments),i=r.length,s={};++n<i;)t=r[n],t in e&&(s[t]=e[t]);return s},s.pluck=mn,s.range=function(e,t,n){e=+e||0,n=+n||1,t==r&&(t=e,e=0);for(var i=-1,t=Math.max(0,Math.ceil((t-e)/n)),s=Array(t);++i<t;)s[i]=e,e+=n;return s},s.reduce=gn,s.reduceRight=x,s.reject=yn,s.rest=L,s.result=function(e,t){if(!e)return r;var n=e[t];return w(n)?e[t]():n},s
|
||||
.shuffle=function(e){if(!e)return[];for(var t,n=-1,r=e.length,i=Array(r);++n<r;)t=Math.floor(Math.random()*(n+1)),i[n]=i[t],i[t]=e[n];return i},s.size=function(e){if(!e)return 0;var t=lt.call(e),n=e.length;return Ht[t]||Lt&&b(e)||t==wt&&-1<n&&n===n>>>0&&w(e.splice)?n:rn(e).length},s.some=bn,s.sortBy=wn,s.sortedIndex=A,s.tap=function(e,t){return t(e),e},s.template=function(e,t,n){n||(n={});var o,u;o=n.escape;var a=n.evaluate,f=n.interpolate,h=s.templateSettings,n=n.variable;o==r&&(o=h.escape),a==r&&
|
||||
(a=h.evaluate||i),f==r&&(f=h.interpolate),o&&(e=e.replace(o,m)),f&&(e=e.replace(f,y)),a!=P&&(P=a,j=RegExp("<e%-([\\s\\S]+?)%>|<e%=([\\s\\S]+?)%>"+(a?"|"+a.source:""),"g")),o=it.length,e=e.replace(j,g),o=o!=it.length,e="__p += '"+e.replace(tt,c).replace(Z,l)+"';",it.length=0,n||(n=h.variable||H||"obj",o?e="with("+n+"){"+e+"}":(n!=H&&(H=n,B=RegExp("(\\(\\s*)"+n+"\\."+n+"\\b","g")),e=e.replace(G,"$&"+n+".").replace(B,"$1__d"))),e=(o?e.replace($,""):e).replace(J,"$1").replace(K,"$1;"),e="function("+n+"){"+
|
||||
n+"||("+n+"={});var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":",__d="+n+"."+n+"||"+n+";")+e+"return __p}";try{u=Function("_","return "+e)(s)}catch(p){u=function(){throw p}}return t?u(t):(u.source=e,u)},s.throttle=function(e,t){function n(){a=new Date,u=r,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?(a=r,s=e.apply(o,i)):u||(u=Tt(n,f)),s}},s.times=function(e,t,n){var r=-1;if(n)for(;++
|
||||
r<e;)t.call(n,r);else for(;++r<e;)t(r)},s.toArray=function(e){if(!e)return[];if(e.toArray&&w(e.toArray))return e.toArray();var t=e.length;return-1<t&&t===t>>>0?(At?lt.call(e)==St:"string"==typeof e)?e.split(""):ft.call(e):sn(e)},s.union=function(){for(var e=-1,t=[],n=st.apply(t,arguments),r=n.length;++e<r;)0>C(t,n[e])&&t.push(n[e]);return t},s.uniq=O,s.uniqueId=function(e){var t=W++;return e?e+t:t},s.values=sn,s.where=En,s.without=function(e){var t=[];if(!e)return t;for(var n=-1,r=e.length,i=u(arguments
|
||||
,1,20);++n<r;)i(e[n])||t.push(e[n]);return t},s.wrap=function(e,t){return function(){var n=[e];return arguments.length&&ut.apply(n,arguments),t.apply(this,n)}},s.zip=function(e){if(!e)return[];for(var t=-1,n=k(mn(arguments,"length")),r=Array(n);++t<n;)r[t]=mn(arguments,t);return r},s.zipObject=function(e,t){if(!e)return{};var n=-1,r=e.length,i={};for(t||(t=[]);++n<r;)i[e[n]]=t[n];return i},s.all=an,s.any=bn,s.collect=dn,s.detect=ln,s.each=cn,s.foldl=gn,s.foldr=x,s.head=T,s.include=on,s.inject=gn,
|
||||
s.methods=tn,s.select=fn,s.tail=L,s.take=T,s.unique=O,cn({Date:yt,Number:bt,RegExp:Et,String:St},function(e,t){s["is"+t]=function(t){return lt.call(t)==e}}),o.prototype=s.prototype,D(s),o.prototype.chain=function(){return this._chain=n,this},o.prototype.value=function(){return this._wrapped},cn("pop push reverse shift sort splice unshift".split(" "),function(e){var t=I[e];o.prototype[e]=function(){var e=this._wrapped;return t.apply(e,arguments),e.length===0&&delete e[0],this._chain&&(e=new o(e),e
|
||||
._chain=n),e}}),cn(["concat","join","slice"],function(e){var t=I[e];o.prototype[e]=function(){var e=t.apply(this._wrapped,arguments);return this._chain&&(e=new o(e),e._chain=n),e}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(e._=s,define(function(){return s})):F?"object"==typeof module&&module&&module.t==F?(module.t=s)._=s:F._=s:e._=s})(this);
|
||||
;(function(e,t){function s(e){return new o(e)}function o(e){if(e&&e._wrapped)return e;this._wrapped=e}function u(e,t,n){t||(t=0);var r=e.length,i=r-t>=(n||V),s=i?{}:e;if(i)for(var o=t-1;++o<r;)n=e[o]+"",(ft.call(s,n)?s[n]:s[n]=[]).push(e[o]);return function(e){if(i){var n=e+"";return ft.call(s,n)&&-1<k(s[n],e)}return-1<k(s,e,t)}}function a(){for(var e,t,n,s=-1,o=arguments.length,u={e:"",f:"",j:"",q:"",c:{d:""},m:{d:""}};++s<o;)for(t in e=arguments[s],e)n=(n=e[t])==r?"":n,/d|i/.test(t)?
|
||||
("string"==typeof n&&(n={b:n,l:n}),u.c[t]=n.b||"",u.m[t]=n.l||""):u[t]=n;e=u.a,t=/^[^,]+/.exec(e)[0],n=u.s,u.g=t,u.h=Lt,u.k=Ft,u.n=Mt,u.p=st,u.r=u.r!==i,u.s=n==r?It:n,u.o==r&&(u.o=Pt),u.f||(u.f="if(!"+t+")return u");if("d"!=t||!u.c.i)u.c=r;t="",u.s&&(t+="'use strict';"),t+="var i,A,j="+u.g+",u",u.j&&(t+="="+u.j),t+=";"+u.f+";"+u.q+";",u.c&&(t+="var l=j.length;i=-1;",u.m&&(t+="if(l>-1&&l===l>>>0){"),u.o&&(t+="if(z.call(j)==x){j=j.split('')}"),t+=u.c.d+";while(++i<l){A=j[i];"+u.c.i+"}",u.m&&(t+="}"
|
||||
));if(u.m){u.c?t+="else{":u.n&&(t+="var l=j.length;i=-1;if(l&&P(j)){while(++i<l){A=j[i+=''];"+u.m.i+"}}else{"),u.h||(t+="var v=typeof j=='function'&&r.call(j,'prototype');");if(u.k&&u.r)t+="var o=-1,p=Y[typeof j]?m(j):[],l=p.length;"+u.m.d+";while(++o<l){i=p[o];",u.h||(t+="if(!(v&&i=='prototype')){"),t+="A=j[i];"+u.m.i+"",u.h||(t+="}");else{t+=u.m.d+";for(i in j){";if(!u.h||u.r)t+="if(",u.h||(t+="!(v&&i=='prototype')"),!u.h&&u.r&&(t+="&&"),u.r&&(t+="g.call(j,i)"),t+="){";t+="A=j[i];"+u.m.i+";";if(!
|
||||
u.h||u.r)t+="}"}t+="}";if(u.h){t+="var f=j.constructor;";for(n=0;7>n;n++)t+="i='"+u.p[n]+"';if(","constructor"==u.p[n]&&(t+="!(f&&f.prototype===j)&&"),t+="g.call(j,i)){A=j[i];"+u.m.i+"}"}if(u.c||u.n)t+="}"}return t+=u.e+";return u",Function("D,E,F,I,e,K,g,h,N,P,R,T,U,k,X,Y,m,r,w,x,z","var G=function("+e+"){"+t+"};return G")(qt,q,_,f,at,un,ft,D,k,w,tn,E,p,d,xt,Wt,gt,ct,ht,Nt,pt)}function f(e,n){var r=e.b,i=n.b,e=e.a,n=n.a;return e===t?1:n===t?-1:e<n?-1:e>n?1:r<i?-1:1}function l(e,t){return ut[t]}function c
|
||||
(e){return"\\"+Xt[e]}function h(e){return Ut[e]}function p(e,t){var n=i;if(!e||"object"!=typeof e||!t&&w(e))return n;var r=e.constructor;return(!Ht||"function"==typeof e.toString||"string"!=typeof (e+""))&&(!E(r)||r instanceof r)?Ot?(un(e,function(t,r){return n=!ft.call(e,r),i}),n===i):(un(e,function(e,t){n=t}),n===i||ft.call(e,n)):n}function d(e,t){return function(n,r,i){return e.call(t,n,r,i)}}function v(){}function m(e,t){if(e&&J.test(t))return"<e%-"+t+"%>";var n=ut.length;return ut[n]="'+__e("+
|
||||
t+")+'",ot+n}function g(e,t,n,i){return i?(e=ut.length,ut[e]="';"+i+";__p+='",ot+e):t?m(r,t):y(r,n)}function y(e,t){if(e&&J.test(t))return"<e%="+t+"%>";var n=ut.length;return ut[n]="'+((__t=("+t+"))==null?'':__t)+'",ot+n}function b(e){return zt[e]}function w(e){return pt.call(e)==yt}function E(e){return"function"==typeof e}function S(e,t,s,o,u){if(e==r)return e;s&&(t=i),u||(u={d:r}),u.d==r&&(u.d=!(!R.clone&&!z.clone&&!W.clone));if(((s=Wt[typeof e])||u.d)&&e.clone&&E(e.clone))return u.d=r,e.clone(
|
||||
t);if(s){var a=pt.call(e);if(!Rt[a]||_t&&w(e))return e;var f=a==bt,s=f||(a==xt?p(e,n):s)}if(!s||!t)return s?f?ht.call(e):on({},e):e;s=e.constructor;switch(a){case wt:return new s(e==n);case Et:return new s(+e);case St:case Nt:return new s(e);case Tt:return s(e.source,Z.exec(e))}o||(o=[]);for(a=o.length;a--;)if(o[a].c==e)return o[a].d;var a=e.length,l=f?s(a):{};o.push({d:l,c:e});if(f)for(f=-1;++f<a;)l[f]=S(e[f],t,r,o,u);else an(e,function(e,n){l[n]=S(e,t,r,o,u)});return l}function x(e,t,s,o){if(e==
|
||||
r||t==r)return e===t;o||(o={value:r}),o.value==r&&(o.value=!(!R.isEqual&&!z.isEqual&&!W.isEqual));if(Wt[typeof e]||Wt[typeof t]||o.value){e._chain&&(e=e._wrapped),t._chain&&(t=t._wrapped);if(e.isEqual&&E(e.isEqual))return o.value=r,e.isEqual(t);if(t.isEqual&&E(t.isEqual))return o.value=r,t.isEqual(e)}if(e===t)return 0!==e||1/e==1/t;var u=pt.call(e);if(u!=pt.call(t))return i;switch(u){case wt:case Et:return+e==+t;case St:return e!=+e?t!=+t:0==e?1/e==1/t:e==+t;case Tt:case Nt:return e==t+""}var a=qt
|
||||
[u];if(_t&&!a&&(a=w(e))&&!w(t)||!a&&(u!=xt||Ht&&("function"!=typeof e.toString&&"string"==typeof (e+"")||"function"!=typeof t.toString&&"string"==typeof (t+""))))return i;s||(s=[]);for(u=s.length;u--;)if(s[u]==e)return n;var u=-1,f=n,l=0;s.push(e);if(a){l=e.length;if(f=l==t.length)for(;l--&&(f=x(e[l],t[l],s,o)););return f}a=e.constructor,f=t.constructor;if(a!=f&&(!E(a)||!(a instanceof a&&E(f)&&f instanceof f)))return i;for(var c in e)if(ft.call(e,c)&&(l++,!ft.call(t,c)||!x(e[c],t[c],s,o)))return i
|
||||
;for(c in t)if(ft.call(t,c)&&!(l--))return i;if(Lt)for(;7>++u;)if(c=st[u],ft.call(e,c)&&(!ft.call(t,c)||!x(e[c],t[c],s,o)))return i;return n}function T(e,t,n,r){if(!e)return n;var i=e.length,s=3>arguments.length;r&&(t=d(t,r));if(-1<i&&i===i>>>0){var o=Pt&&pt.call(e)==Nt?e.split(""):e;for(i&&s&&(n=o[--i]);i--;)n=t(n,o[i],i,e);return n}o=cn(e);for((i=o.length)&&s&&(n=e[o[--i]]);i--;)s=o[i],n=t(n,e[s],s,e);return n}function N(e,t,n){if(e)return t==r||n?e[0]:ht.call(e,0,t)}function C(e,t){var n=[];if(!
|
||||
e)return n;for(var r,i=-1,s=e.length;++i<s;)r=e[i],tn(r)?lt.apply(n,t?r:C(r)):n.push(r);return n}function k(e,t,n){if(!e)return-1;var r=-1,i=e.length;if(n){if("number"!=typeof n)return r=O(e,t),e[r]===t?r:-1;r=(0>n?Math.max(0,i+n):n)-1}for(;++r<i;)if(e[r]===t)return r;return-1}function L(e,t,n){var r=-Infinity,i=r;if(!e)return i;var s=-1,o=e.length;if(!t){for(;++s<o;)e[s]>i&&(i=e[s]);return i}for(n&&(t=d(t,n));++s<o;)n=t(e[s],s,e),n>r&&(r=n,i=e[s]);return i}function A(e,t,n){return e?ht.call(e,t==
|
||||
r||n?1:t):[]}function O(e,t,n,r){if(!e)return 0;var i=0,s=e.length;if(n){r&&(n=_(n,r));for(t=n(t);i<s;)r=i+s>>>1,n(e[r])<t?i=r+1:s=r}else for(;i<s;)r=i+s>>>1,e[r]<t?i=r+1:s=r;return i}function M(e,t,n,r){var s=[];if(!e)return s;var o=-1,u=e.length,a=[];"function"==typeof t&&(r=n,n=t,t=i);for(n?r&&(n=d(n,r)):n=D;++o<u;)if(r=n(e[o],o,e),t?!o||a[a.length-1]!==r:0>k(a,r))a.push(r),s.push(e[o]);return s}function _(e,t){function n(){var o=arguments,u=t;return i||(e=t[r]),s.length&&(o=o.length?s.concat(
|
||||
ht.call(o)):s),this instanceof n?(v.prototype=e.prototype,u=new v,(o=e.apply(u,o))&&Wt[typeof o]?o:u):e.apply(u,o)}var r,i=E(e);if(i){if(jt||dt&&2<arguments.length)return dt.call.apply(dt,arguments)}else r=t,t=e;var s=ht.call(arguments,2);return n}function D(e){return e}function P(e){wn(fn(e),function(t){var r=s[t]=e[t];o.prototype[t]=function(){var e=[this._wrapped];return arguments.length&<.apply(e,arguments),e=r.apply(s,e),this._chain&&(e=new o(e),e._chain=n),e}})}var n=!0,r=null,i=!1,H,B,j,
|
||||
F,I="object"==typeof exports&&exports&&("object"==typeof global&&global&&global==global.global&&(e=global),exports),q=Array.prototype,R=Boolean.prototype,U=Object.prototype,z=Number.prototype,W=String.prototype,X=0,V=30,$=e._,J=/[-+=!~*%&^<>|{(\/]|\[\D|\b(?:delete|in|instanceof|new|typeof|void)\b/,K=/&(?:amp|lt|gt|quot|#x27);/g,Q=/\b__p\+='';/g,G=/\b(__p\+=)''\+/g,Y=/(__e\(.*?\)|\b__t\))\+'';/g,Z=/\w*$/,et=/(?:__e|__t=)\(\s*(?![\d\s"']|this\.)/g,tt=RegExp("^"+(U.valueOf+"").replace(/[.*+?^=!:${}()|[\]\/\\]/g
|
||||
,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),nt=/__token__(\d+)/g,rt=/[&<>"']/g,it=/['\n\r\t\u2028\u2029\\]/g,st="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),ot="__token__",ut=[],at=q.concat,ft=U.hasOwnProperty,lt=q.push,ct=U.propertyIsEnumerable,ht=q.slice,pt=U.toString,dt=tt.test(dt=ht.bind)&&dt,vt=tt.test(vt=Array.isArray)&&vt,mt=e.isFinite,gt=tt.test(gt=Object.keys)&>,yt="[object Arguments]",bt="[object Array]",wt="[object Boolean]"
|
||||
,Et="[object Date]",St="[object Number]",xt="[object Object]",Tt="[object RegExp]",Nt="[object String]",Ct=e.clearTimeout,kt=e.setTimeout,Lt,At,Ot,Mt=n;(function(){function e(){this.x=1}var t={0:1,length:1},n=[];e.prototype={valueOf:1,y:1};for(var r in new e)n.push(r);for(r in arguments)Mt=!r;Lt=4>(n+"").length,Ot="x"!=n[0],At=(n.splice.call(t,0,1),t[0])})(1);var _t=!w(arguments),Dt="x"!=ht.call("x")[0],Pt="xx"!="x"[0]+Object("x")[0];try{var Ht=("[object Object]",pt.call(e.document||0)==xt)}catch(Bt)
|
||||
{}var jt=dt&&/\n|Opera/.test(dt+pt.call(e.opera)),Ft=gt&&/^.+$|true/.test(gt+!!e.attachEvent),It=!jt,qt={"[object Arguments]":n,"[object Array]":n,"[object Boolean]":i,"[object Date]":i,"[object Function]":i,"[object Number]":i,"[object Object]":i,"[object RegExp]":i,"[object String]":n},Rt={"[object Arguments]":i,"[object Array]":n,"[object Boolean]":n,"[object Date]":n,"[object Function]":i,"[object Number]":n,"[object Object]":n,"[object RegExp]":n,"[object String]":n},Ut={"&":"&","<":"<"
|
||||
,">":">",'"':""","'":"'"},zt={"&":"&","<":"<",">":">",""":'"',"'":"'"},Wt={"boolean":i,"function":n,object:n,number:i,string:i,"undefined":i,unknown:n},Xt={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"};s.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""};var Vt={a:"d,c,y",j:"d",q:"if(!c)c=h;else if(y)c=k(c,y)",i:"if(c(A,i,d)===false)return u"},$t={j:"{}",q:"var q;if(typeof c!='function'){var ii=c;c=function(A){return A[ii]}}else if(y)c=k(c,y)"
|
||||
,i:"q=c(A,i,d);(g.call(u,q)?u[q]++:u[q]=1)"},Jt={r:i,a:"n,c,y",j:"{}",q:"var S=typeof c=='function';if(!S){var t=e.apply(E,arguments)}else if(y)c=k(c,y)",i:"if(S?!c(A,i,n):N(t,i)<0)u[i]=A"},Kt={j:"true",i:"if(!c(A,i,d))return!u"},Qt={r:i,s:i,a:"n",j:"n",q:"for(var a=1,b=arguments.length;a<b;a++){if(j=arguments[a]){",i:"u[i]=A",e:"}}"},Gt={j:"[]",i:"c(A,i,d)&&u.push(A)"},Yt={q:"if(y)c=k(c,y)"},Zt={i:{l:Vt.i}},en={j:"",f:"if(!d)return[]",d:{b:"u=Array(l)",l:"u="+(Ft?"Array(l)":"[]")},i:{b:"u[i]=c(A,i,d)"
|
||||
,l:"u"+(Ft?"[o]=":".push")+"(c(A,i,d))"}};_t&&(w=function(e){return!!e&&!!ft.call(e,"callee")});var tn=vt||function(e){return pt.call(e)==bt};E(/x/)&&(E=function(e){return"[object Function]"==pt.call(e)});var nn=a({a:"n",j:"[]",i:"u.push(i)"}),rn=a(Qt,{i:"if(u[i]==null)"+Qt.i}),sn=a(Jt),on=a(Qt),un=a(Vt,Yt,Zt,{r:i}),an=a(Vt,Yt,Zt),fn=a({r:i,a:"n",j:"[]",i:"if(T(A))u.push(i)",e:"u.sort()"}),ln=a({a:"A",j:"true",q:"var H=z.call(A),l=A.length;if(D[H]"+(_t?"||P(A)":"")+"||(H==X&&l>-1&&l===l>>>0&&T(A.splice)))return!l"
|
||||
,i:{l:"return false"}}),cn=gt?function(e){var t=typeof e;return"function"==t&&ct.call(e,"prototype")?nn(e):e&&Wt[t]?gt(e):[]}:nn,hn=a(Qt,{a:"n,ee,O,ff",q:"var J,L,Q,gg,dd=O==U;if(!dd)ff=[];for(var a=1,b=dd?2:arguments.length;a<b;a++){if(j=arguments[a]){",i:"if(A&&((Q=R(A))||U(A))){L=false;gg=ff.length;while(gg--)if(L=ff[gg].c==A)break;if(L){u[i]=ff[gg].d}else{J=(J=u[i])&&Q?(R(J)?J:[]):(U(J)?J:{});ff.push({d:J,c:A});u[i]=G(J,A,U,ff)}}else if(A!=null)u[i]=A"}),pn=a(Jt,{q:"if(typeof c!='function'){var q,t=e.apply(E,arguments),l=t.length;for(i=1;i<l;i++){q=t[i];if(q in n)u[q]=n[q]}}else{if(y)c=k(c,y)"
|
||||
,i:"if(c(A,i,n))u[i]=A",e:"}"}),dn=a({a:"n",j:"[]",i:"u.push(A)"}),vn=a({a:"d,hh",j:"false",o:i,d:{b:"if(z.call(d)==x)return d.indexOf(hh)>-1"},i:"if(A===hh)return true"}),mn=a(Vt,$t),gn=a(Vt,Kt),yn=a(Vt,Gt),bn=a(Vt,Yt,{j:"",i:"if(c(A,i,d))return A"}),wn=a(Vt,Yt),En=a(Vt,$t,{i:"q=c(A,i,d);(g.call(u,q)?u[q]:u[q]=[]).push(A)"}),Sn=a(en,{a:"d,V",q:"var C=w.call(arguments,2),S=typeof V=='function'",i:{b:"u[i]=(S?V:A[V]).apply(A,C)",l:"u"+(Ft?"[o]=":".push")+"((S?V:A[V]).apply(A,C))"}}),xn=a(Vt,en),Tn=
|
||||
a(en,{a:"d,bb",i:{b:"u[i]=A[bb]",l:"u"+(Ft?"[o]=":".push")+"(A[bb])"}}),Nn=a({a:"d,c,B,y",j:"B",q:"var W=arguments.length<3;if(y)c=k(c,y)",d:{b:"if(W)u=j[++i]"},i:{b:"u=c(u,A,i,d)",l:"u=W?(W=false,A):c(u,A,i,d)"}}),Cn=a(Vt,Gt,{i:"!"+Gt.i}),kn=a(Vt,Kt,{j:"false",i:Kt.i.replace("!","")}),Ln=a(Vt,$t,en,{i:{b:"u[i]={a:c(A,i,d),b:i,d:A}",l:"u"+(Ft?"[o]=":".push")+"({a:c(A,i,d),b:i,d:A})"},e:"u.sort(I);l=u.length;while(l--)u[l]=u[l].d"}),An=a(Gt,{a:"d,aa",q:"var t=[];K(aa,function(A,q){t.push(q)});var cc=t.length"
|
||||
,i:"for(var q,Z=true,s=0;s<cc;s++){q=t[s];if(!(Z=A[q]===aa[q]))break}Z&&u.push(A)"}),On=a({r:i,s:i,a:"n",j:"n",q:"var M=arguments,l=M.length;if(l>1){for(var i=1;i<l;i++)u[M[i]]=F(u[M[i]],u);return u}",i:"if(T(u[i]))u[i]=F(u[i],u)"});s.VERSION="0.6.0",s.after=function(e,t){return 1>e?t():function(){if(1>--e)return t.apply(this,arguments)}},s.bind=_,s.bindAll=On,s.chain=function(e){return e=new o(e),e._chain=n,e},s.clone=S,s.compact=function(e){var t=[];if(!e)return t;for(var n=-1,r=e.length;++n<r;
|
||||
)e[n]&&t.push(e[n]);return t},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=vn,s.countBy=mn,s.debounce=function(e,t,n){function i(){a=r,n||e.apply(u,s)}var s,o,u,a;return function(){var r=n&&!a;return s=arguments,u=this,Ct(a),a=kt(i,t),r&&(o=e.apply(u,s)),o}},s.defaults=rn,s.defer=function(e){var n=ht.call(arguments,1);return kt(function(){return e.apply(t,n)},1)},s.delay=function(e,n){var r=ht.call(arguments
|
||||
,2);return kt(function(){return e.apply(t,r)},n)},s.difference=function(e){var t=[];if(!e)return t;for(var n=-1,r=e.length,i=at.apply(t,arguments),i=u(i,r);++n<r;)i(e[n])||t.push(e[n]);return t},s.drop=sn,s.escape=function(e){return e==r?"":(e+"").replace(rt,h)},s.every=gn,s.extend=on,s.filter=yn,s.find=bn,s.first=N,s.flatten=C,s.forEach=wn,s.forIn=un,s.forOwn=an,s.functions=fn,s.groupBy=En,s.has=function(e,t){return e?ft.call(e,t):i},s.identity=D,s.indexOf=k,s.initial=function(e,t,n){return e?ht
|
||||
.call(e,0,-(t==r||n?1:t)):[]},s.intersection=function(e){var t=[];if(!e)return t;var n,r=arguments.length,i=[],s=-1,o=e.length;e:for(;++s<o;)if(n=e[s],0>k(t,n)){for(var a=1;a<r;a++)if(!(i[a]||(i[a]=u(arguments[a])))(n))continue e;t.push(n)}return t},s.invoke=Sn,s.isArguments=w,s.isArray=tn,s.isBoolean=function(e){return e===n||e===i||pt.call(e)==wt},s.isElement=function(e){return e?1===e.nodeType:i},s.isEmpty=ln,s.isEqual=x,s.isFinite=function(e){return mt(e)&&pt.call(e)==St},s.isFunction=E,s.isNaN=
|
||||
function(e){return pt.call(e)==St&&e!=+e},s.isNull=function(e){return e===r},s.isObject=function(e){return e?Wt[typeof e]:i},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||n?e[i-1]:ht.call(e,-t||i)}},s.lastIndexOf=function(e,t,n){if(!e)return-1;var r=e.length;for(n&&"number"==typeof n&&(r=(0>n?Math.max(0,r+n):Math.min(n,r-1))+1);r--;)if(e[r]===t)return r;return-1},s.map=xn,s.max=L,s.memoize=function(e,t){var n={};return function(){var r=
|
||||
t?t.apply(this,arguments):arguments[0];return ft.call(n,r)?n[r]:n[r]=e.apply(this,arguments)}},s.merge=hn,s.min=function(e,t,n){var r=Infinity,i=r;if(!e)return i;var s=-1,o=e.length;if(!t){for(;++s<o;)e[s]<i&&(i=e[s]);return i}for(n&&(t=d(t,n));++s<o;)n=t(e[s],s,e),n<r&&(r=n,i=e[s]);return i},s.mixin=P,s.noConflict=function(){return e._=$,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){var t=ht.call(arguments,1),n=t.length
|
||||
;return function(){var r;return r=arguments,r.length&&(t.length=n,lt.apply(t,r)),r=1==t.length?e.call(this,t[0]):e.apply(this,t),t.length=n,r}},s.pick=pn,s.pluck=Tn,s.range=function(e,t,n){e=+e||0,n=+n||1,t==r&&(t=e,e=0);for(var i=-1,t=Math.max(0,Math.ceil((t-e)/n)),s=Array(t);++i<t;)s[i]=e,e+=n;return s},s.reduce=Nn,s.reduceRight=T,s.reject=Cn,s.rest=A,s.result=function(e,t){if(!e)return r;var n=e[t];return E(n)?e[t]():n},s.shuffle=function(e){if(!e)return[];for(var t,n=-1,r=e.length,i=Array(r);++
|
||||
n<r;)t=Math.floor(Math.random()*(n+1)),i[n]=i[t],i[t]=e[n];return i},s.size=function(e){if(!e)return 0;var t=pt.call(e),n=e.length;return qt[t]||_t&&w(e)||t==xt&&-1<n&&n===n>>>0&&E(e.splice)?n:cn(e).length},s.some=kn,s.sortBy=Ln,s.sortedIndex=O,s.tap=function(e,t){return t(e),e},s.template=function(e,t,n){n||(n={});var e=e+"",o,u;o=n.escape;var a=n.evaluate,f=n.interpolate,h=s.templateSettings,p=n=n.variable||h.variable;o==r&&(o=h.escape),a==r&&(a=h.evaluate||i),f==r&&(f=h.interpolate),o&&(e=e.replace
|
||||
(o,m)),f&&(e=e.replace(f,y)),a!=H&&(H=a,F=RegExp("<e%-([\\s\\S]+?)%>|<e%=([\\s\\S]+?)%>"+(a?"|"+a.source:""),"g")),o=ut.length,e=e.replace(F,g),o=o!=ut.length,e="__p += '"+e.replace(it,c).replace(nt,l)+"';",ut.length=0,p||(n=B||"obj",o?e="with("+n+"){"+e+"}":(n!=B&&(B=n,j=RegExp("(\\(\\s*)"+n+"\\."+n+"\\b","g")),e=e.replace(et,"$&"+n+".").replace(j,"$1__d"))),e=(o?e.replace(Q,""):e).replace(G,"$1").replace(Y,"$1;"),e="function("+n+"){"+(p?"":n+"||("+n+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"
|
||||
:(p?"":",__d="+n+"."+n+"||"+n)+";")+e+"return __p}";try{u=Function("_","return "+e)(s)}catch(d){u=function(){throw d}}return t?u(t):(u.source=e,u)},s.throttle=function(e,t){function n(){a=new Date,u=r,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?(a=r,s=e.apply(o,i)):u||(u=kt(n,f)),s}},s.times=function(e,t,n){var r=-1;if(n)for(;++r<e;)t.call(n,r);else for(;++r<e;)t(r)},s.toArray=function(e){if(!e)return[];if(e.toArray&&E(e.toArray))return e
|
||||
.toArray();var t=e.length;return-1<t&&t===t>>>0?(Dt?pt.call(e)==Nt:"string"==typeof e)?e.split(""):ht.call(e):dn(e)},s.unescape=function(e){return e==r?"":(e+"").replace(K,b)},s.union=function(){for(var e=-1,t=[],n=at.apply(t,arguments),r=n.length;++e<r;)0>k(t,n[e])&&t.push(n[e]);return t},s.uniq=M,s.uniqueId=function(e){var t=X++;return e?e+t:t},s.values=dn,s.where=An,s.without=function(e){var t=[];if(!e)return t;for(var n=-1,r=e.length,i=u(arguments,1,20);++n<r;)i(e[n])||t.push(e[n]);return t},
|
||||
s.wrap=function(e,t){return function(){var n=[e];return arguments.length&<.apply(n,arguments),t.apply(this,n)}},s.zip=function(e){if(!e)return[];for(var t=-1,n=L(Tn(arguments,"length")),r=Array(n);++t<n;)r[t]=Tn(arguments,t);return r},s.zipObject=function(e,t){if(!e)return{};var n=-1,r=e.length,i={};for(t||(t=[]);++n<r;)i[e[n]]=t[n];return i},s.all=gn,s.any=kn,s.collect=xn,s.detect=bn,s.each=wn,s.foldl=Nn,s.foldr=T,s.head=N,s.include=vn,s.inject=Nn,s.methods=fn,s.omit=sn,s.select=yn,s.tail=A,s.
|
||||
take=N,s.unique=M,wn({Date:Et,Number:St,RegExp:Tt,String:Nt},function(e,t){s["is"+t]=function(t){return pt.call(t)==e}}),o.prototype=s.prototype,P(s),o.prototype.chain=function(){return this._chain=n,this},o.prototype.value=function(){return this._wrapped},wn("pop push reverse shift sort splice unshift".split(" "),function(e){var t=q[e];o.prototype[e]=function(){var e=this._wrapped;return t.apply(e,arguments),At&&e.length===0&&delete e[0],this._chain&&(e=new o(e),e._chain=n),e}}),wn(["concat","join"
|
||||
,"slice"],function(e){var t=q[e];o.prototype[e]=function(){var e=t.apply(this._wrapped,arguments);return this._chain&&(e=new o(e),e._chain=n),e}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(e._=s,define(function(){return s})):I?"object"==typeof module&&module&&module.t==I?(module.t=s)._=s:I._=s:e._=s})(this);
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "lodash",
|
||||
"version": "0.5.1",
|
||||
"version": "0.6.0",
|
||||
"description": "A drop-in replacement for Underscore.js delivering performance, bug fixes, and additional features.",
|
||||
"homepage": "http://lodash.com",
|
||||
"main": "lodash",
|
||||
|
||||
@@ -27,7 +27,9 @@
|
||||
<script src="perf.js"></script>
|
||||
<script>
|
||||
(function() {
|
||||
var useApplet = !/[?&]nojava=true(?:&|$)/.test(location.search);
|
||||
var measured,
|
||||
perfNow,
|
||||
begin = new Date;
|
||||
|
||||
function init() {
|
||||
var fbUI = document.getElementById('FirebugUI'),
|
||||
@@ -38,18 +40,18 @@
|
||||
return setTimeout(init, 15);
|
||||
}
|
||||
fbUI.style.height = fbDoc.body.style.height = fbDoc.documentElement.style.height = '100%';
|
||||
|
||||
// give applet time to initialize
|
||||
lodash.delay(run, useApplet ? 500 : 15);
|
||||
setTimeout(run, 15);
|
||||
}
|
||||
|
||||
if (useApplet) {
|
||||
// using innerHTML avoids an alert in some versions of IE6
|
||||
var div = document.createElement('div');
|
||||
div.innerHTML = '<applet code=nano archive="../vendor/benchmark.js/nano.jar">';
|
||||
document.body.insertBefore(div.lastChild, document.body.firstChild);
|
||||
// is the applet permitted?
|
||||
if (!/[?&]nojava=true(?:&|$)/.test(location.search)) {
|
||||
// is the applet really needed?
|
||||
while (!(measured = new Date - begin)) { }
|
||||
if (measured != 1 && !((perfNow = window.performance) && typeof (perfNow.now || perfNow.webkitNow) == 'function')) {
|
||||
// load applet
|
||||
document.write('<applet code="nano" archive="../vendor/benchmark.js/nano.jar"></applet>');
|
||||
}
|
||||
}
|
||||
|
||||
window.onload = init;
|
||||
}());
|
||||
</script>
|
||||
|
||||
1530
perf/perf.js
1530
perf/perf.js
File diff suppressed because it is too large
Load Diff
376
test/test.js
376
test/test.js
@@ -102,7 +102,7 @@
|
||||
if (window.document && window.require) {
|
||||
equal((lodashModule || {}).moduleName, 'lodash');
|
||||
} else {
|
||||
skipTest()
|
||||
skipTest();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
if (window.document && window.require) {
|
||||
equal((underscoreModule || {}).moduleName, 'underscore');
|
||||
} else {
|
||||
skipTest()
|
||||
skipTest();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -145,7 +145,7 @@
|
||||
(function() {
|
||||
test('should correctly append array arguments to partially applied arguments (test in IE < 9)', function() {
|
||||
var args,
|
||||
bound = _.bind(function() { args = slice.call(arguments); }, null, 'a');
|
||||
bound = _.bind(function() { args = slice.call(arguments); }, {}, 'a');
|
||||
|
||||
bound(['b'], 'c');
|
||||
deepEqual(args, ['a', ['b'], 'c']);
|
||||
@@ -272,14 +272,14 @@
|
||||
QUnit.module('lodash.contains');
|
||||
|
||||
(function() {
|
||||
_.each([
|
||||
{ 'kind': 'literal', 'value': 'abc' },
|
||||
{ 'kind': 'object', 'value': Object('abc') }
|
||||
],
|
||||
function(data) {
|
||||
test('should work with a string ' + data.kind + ' for `collection`', function() {
|
||||
equal(_.contains(data.value, 'bc'), true);
|
||||
equal(_.contains(data.value, 'd'), false);
|
||||
_.each({
|
||||
'literal': 'abc',
|
||||
'object': Object('abc')
|
||||
},
|
||||
function(collection, key) {
|
||||
test('should work with a string ' + key + ' for `collection`', function() {
|
||||
equal(_.contains(collection, 'bc'), true);
|
||||
equal(_.contains(collection, 'd'), false);
|
||||
});
|
||||
});
|
||||
}());
|
||||
@@ -289,13 +289,13 @@
|
||||
QUnit.module('lodash.countBy');
|
||||
|
||||
(function() {
|
||||
test('should only add elements to own, not inherited, properties', function() {
|
||||
test('should only add values to own, not inherited, properties', function() {
|
||||
var actual = _.countBy([4.2, 6.1, 6.4], function(num) {
|
||||
return Math.floor(num) > 4 ? 'hasOwnProperty' : 'constructor';
|
||||
});
|
||||
|
||||
deepEqual(actual.constructor, 1);
|
||||
deepEqual(actual.hasOwnProperty, 2);
|
||||
equal(actual.constructor, 1);
|
||||
equal(actual.hasOwnProperty, 2);
|
||||
});
|
||||
}());
|
||||
|
||||
@@ -336,11 +336,11 @@
|
||||
QUnit.module('lodash.drop');
|
||||
|
||||
(function() {
|
||||
var object = { 'a': 1, 'b': 2, 'c': 3 },
|
||||
var object = { 'a': 1, 'b': 2 },
|
||||
actual = { 'b': 2 };
|
||||
|
||||
test('should accept individual property names', function() {
|
||||
deepEqual(_.drop(object, 'a', 'c'), actual);
|
||||
deepEqual(_.drop(object, 'a'), actual);
|
||||
});
|
||||
|
||||
test('should accept an array of property names', function() {
|
||||
@@ -355,7 +355,38 @@
|
||||
function Foo() {}
|
||||
Foo.prototype = object;
|
||||
|
||||
deepEqual(_.drop(new Foo, 'a', 'c'), actual);
|
||||
deepEqual(_.drop(new Foo, 'a'), actual);
|
||||
});
|
||||
|
||||
test('should work with a `callback` argument', function() {
|
||||
var actual = _.drop(object, function(value) {
|
||||
return value == 1;
|
||||
});
|
||||
|
||||
deepEqual(actual, { 'b': 2 });
|
||||
});
|
||||
|
||||
test('should pass the correct `callback` arguments', function() {
|
||||
var args,
|
||||
lastKey = _.keys(object).pop();
|
||||
|
||||
var expected = lastKey == 'b'
|
||||
? [1, 'a', object]
|
||||
: [2, 'b', object];
|
||||
|
||||
_.drop(object, function() {
|
||||
args || (args = slice.call(arguments));
|
||||
});
|
||||
|
||||
deepEqual(args, expected);
|
||||
});
|
||||
|
||||
test('should correct set the `this` binding', function() {
|
||||
var actual = _.drop(object, function(value) {
|
||||
return value == this.a;
|
||||
}, { 'a': 1 });
|
||||
|
||||
deepEqual(actual, { 'b': 2 });
|
||||
});
|
||||
}());
|
||||
|
||||
@@ -364,15 +395,11 @@
|
||||
QUnit.module('lodash.escape');
|
||||
|
||||
(function() {
|
||||
test('should not escape the ">" character', function() {
|
||||
equal(_.escape('>'), '>');
|
||||
});
|
||||
|
||||
test('should not escape the "/" character', function() {
|
||||
equal(_.escape('/'), '/');
|
||||
});
|
||||
|
||||
test('should return empty string when passed `null` or `undefined`', function() {
|
||||
test('should return an empty string when passed `null` or `undefined`', function() {
|
||||
equal(_.escape(null), '');
|
||||
equal(_.escape(undefined), '');
|
||||
});
|
||||
@@ -508,14 +535,13 @@
|
||||
deepEqual(keys, ['length']);
|
||||
});
|
||||
|
||||
_.each([
|
||||
{ 'kind': 'literal', 'value': 'abc' },
|
||||
{ 'kind': 'object', 'value': Object('abc') }
|
||||
],
|
||||
function(data) {
|
||||
test('should work with a string ' + data.kind + ' for `collection` (test in IE < 9)', function() {
|
||||
_.each({
|
||||
'literal': 'abc',
|
||||
'object': Object('abc')
|
||||
},
|
||||
function(collection, key) {
|
||||
test('should work with a string ' + key + ' for `collection` (test in IE < 9)', function() {
|
||||
var args,
|
||||
collection = data.value,
|
||||
values = [];
|
||||
|
||||
_.forEach(collection, function(value) {
|
||||
@@ -621,7 +647,7 @@
|
||||
deepEqual(actual, { '4': [4.2], '6': [6.1, 6.4] });
|
||||
});
|
||||
|
||||
test('should only add elements to own, not inherited, properties', function() {
|
||||
test('should only add values to own, not inherited, properties', function() {
|
||||
var actual = _.groupBy([4.2, 6.1, 6.4], function(num) {
|
||||
return Math.floor(num) > 4 ? 'hasOwnProperty' : 'constructor';
|
||||
});
|
||||
@@ -699,6 +725,23 @@
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
QUnit.module('lodash.isElement');
|
||||
|
||||
(function() {
|
||||
test('should use strict equality in its duck type check', function() {
|
||||
var element = window.document ? document.body : { 'nodeType': 1 };
|
||||
equal(_.isElement(element), true);
|
||||
|
||||
equal(_.isElement({ 'nodeType': new Number(1) }), false);
|
||||
equal(_.isElement({ 'nodeType': true }), false);
|
||||
equal(_.isElement({ 'nodeType': [1] }), false);
|
||||
equal(_.isElement({ 'nodeType': '1' }), false);
|
||||
equal(_.isElement({ 'nodeType': '001' }), false);
|
||||
});
|
||||
}());
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
QUnit.module('lodash.isEmpty');
|
||||
|
||||
(function() {
|
||||
@@ -817,6 +860,50 @@
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
_.each([
|
||||
'isArguments',
|
||||
'isArray',
|
||||
'isBoolean',
|
||||
'isDate',
|
||||
'isElement',
|
||||
'isEmpty',
|
||||
'isEqual',
|
||||
'isFinite',
|
||||
'isFunction',
|
||||
'isNaN',
|
||||
'isNull',
|
||||
'isNumber',
|
||||
'isObject',
|
||||
'isRegExp',
|
||||
'isString',
|
||||
'isUndefined'
|
||||
], function(methodName) {
|
||||
var func = _[methodName];
|
||||
QUnit.module('lodash.' + methodName + ' result');
|
||||
|
||||
test('should return a boolean', function() {
|
||||
var expected = 'boolean';
|
||||
|
||||
equal(typeof func(arguments), expected);
|
||||
equal(typeof func([]), expected);
|
||||
equal(typeof func(true), expected);
|
||||
equal(typeof func(false), expected);
|
||||
equal(typeof func(new Date), expected);
|
||||
equal(typeof func(window.document && document.body), expected);
|
||||
equal(typeof func({}), expected);
|
||||
equal(typeof func(undefined), expected);
|
||||
equal(typeof func(Infinity), expected);
|
||||
equal(typeof func(_), expected);
|
||||
equal(typeof func(NaN), expected);
|
||||
equal(typeof func(null), expected);
|
||||
equal(typeof func(0), expected);
|
||||
equal(typeof func({ 'a': 1 }), expected);
|
||||
equal(typeof func('a'), expected);
|
||||
});
|
||||
});
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
QUnit.module('lodash.keys');
|
||||
|
||||
(function() {
|
||||
@@ -997,11 +1084,11 @@
|
||||
});
|
||||
|
||||
test('should not alter the `this` binding of either function', function() {
|
||||
var o = { 'cat': 'nip' },
|
||||
var object = { 'cat': 'nip' },
|
||||
func = function() { return this.cat; };
|
||||
|
||||
equal(_.partial(_.bind(func, o))(), o.cat);
|
||||
equal(_.bind(_.partial(func), o)(), o.cat);
|
||||
equal(_.partial(_.bind(func, object))(), object.cat);
|
||||
equal(_.bind(_.partial(func), object)(), object.cat);
|
||||
});
|
||||
}());
|
||||
|
||||
@@ -1010,12 +1097,45 @@
|
||||
QUnit.module('lodash.pick');
|
||||
|
||||
(function() {
|
||||
var object = { 'a': 1, 'b': 2 };
|
||||
|
||||
test('should iterate over inherited properties', function() {
|
||||
function Foo() {}
|
||||
Foo.prototype = { 'a': 1, 'b': 2, 'c': 3 };
|
||||
Foo.prototype = object;
|
||||
|
||||
deepEqual(_.pick(new Foo, 'b'), { 'b': 2 });
|
||||
});
|
||||
|
||||
test('should work with a `callback` argument', function() {
|
||||
var actual = _.pick(object, function(value) {
|
||||
return value == 2;
|
||||
});
|
||||
|
||||
deepEqual(actual, { 'b': 2 });
|
||||
});
|
||||
|
||||
test('should pass the correct `callback` arguments', function() {
|
||||
var args,
|
||||
lastKey = _.keys(object).pop();
|
||||
|
||||
var expected = lastKey == 'b'
|
||||
? [1, 'a', object]
|
||||
: [2, 'b', object];
|
||||
|
||||
_.pick(object, function() {
|
||||
args || (args = slice.call(arguments));
|
||||
});
|
||||
|
||||
deepEqual(args, expected);
|
||||
});
|
||||
|
||||
test('should correct set the `this` binding', function() {
|
||||
var actual = _.pick(object, function(value) {
|
||||
return value == this.b;
|
||||
}, { 'b': 2 });
|
||||
|
||||
deepEqual(actual, { 'b': 2 });
|
||||
});
|
||||
}());
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
@@ -1055,17 +1175,41 @@
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
QUnit.module('lodash.reduce');
|
||||
|
||||
(function() {
|
||||
_.each({
|
||||
'literal': 'abc',
|
||||
'object': Object('abc')
|
||||
},
|
||||
function(collection, key) {
|
||||
test('should work with a string ' + key + ' for `collection` (test in IE < 9)', function() {
|
||||
var args;
|
||||
|
||||
var actual = _.reduce(collection, function(accumulator, value) {
|
||||
args || (args = slice.call(arguments));
|
||||
return accumulator + value;
|
||||
});
|
||||
|
||||
deepEqual(args, ['a', 'b', 1, collection]);
|
||||
equal(actual, 'abc');
|
||||
});
|
||||
});
|
||||
}());
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
QUnit.module('lodash.reduceRight');
|
||||
|
||||
(function() {
|
||||
test('should pass the correct `callback` arguments when iterating an object', function() {
|
||||
var args,
|
||||
object = { 'a': 'A', 'b': 'B' },
|
||||
object = { 'a': 1, 'b': 2 },
|
||||
lastKey = _.keys(object).pop();
|
||||
|
||||
var expected = lastKey == 'a'
|
||||
? ['A', 'B', 'b', object]
|
||||
: ['B', 'A', 'a', object];
|
||||
var expected = lastKey == 'b'
|
||||
? [2, 1, 'a', object]
|
||||
: [1, 2, 'b', object];
|
||||
|
||||
_.reduceRight(object, function() {
|
||||
args || (args = slice.call(arguments));
|
||||
@@ -1076,12 +1220,12 @@
|
||||
|
||||
test('should treat array-like object with invalid `length` as a regular object', function() {
|
||||
var args,
|
||||
object = { 'a': 'A', 'length': -1 },
|
||||
object = { 'a': 1, 'length': -1 },
|
||||
lastKey = _.keys(object).pop();
|
||||
|
||||
var expected = lastKey == 'a'
|
||||
? ['A', '-1', 'length', object]
|
||||
: [-1, 'A', 'a', object];
|
||||
var expected = lastKey == 'length'
|
||||
? [-1, 1, 'a', object]
|
||||
: [1, -1, 'length', object];
|
||||
|
||||
_.reduceRight(object, function() {
|
||||
args || (args = slice.call(arguments));
|
||||
@@ -1090,14 +1234,13 @@
|
||||
deepEqual(args, expected);
|
||||
});
|
||||
|
||||
_.each([
|
||||
{ 'kind': 'literal', 'value': 'abc' },
|
||||
{ 'kind': 'object', 'value': Object('abc') }
|
||||
],
|
||||
function(data) {
|
||||
test('should work with a string ' + data.kind + ' for `collection` (test in IE < 9)', function() {
|
||||
var args,
|
||||
collection = data.value;
|
||||
_.each({
|
||||
'literal': 'abc',
|
||||
'object': Object('abc')
|
||||
},
|
||||
function(collection, key) {
|
||||
test('should work with a string ' + key + ' for `collection` (test in IE < 9)', function() {
|
||||
var args;
|
||||
|
||||
var actual = _.reduceRight(collection, function(accumulator, value) {
|
||||
args || (args = slice.call(arguments));
|
||||
@@ -1364,10 +1507,14 @@
|
||||
(function() {
|
||||
var args = arguments;
|
||||
|
||||
test('should call custom `toArray` method of an array', function() {
|
||||
var array = [1, 2, 3];
|
||||
array.toArray = function() { return [3, 2, 1]; };
|
||||
deepEqual(_.toArray(array), [3, 2, 1]);
|
||||
_.each({
|
||||
'an array': ['a', 'b', 'c'],
|
||||
'a string': Object('abc')
|
||||
}, function(collection, key) {
|
||||
test('should call custom `toArray` method of ' + key, function() {
|
||||
collection.toArray = function() { return [3, 2, 1]; };
|
||||
deepEqual(_.toArray(collection), [3, 2, 1]);
|
||||
});
|
||||
});
|
||||
|
||||
test('should treat array-like objects like arrays', function() {
|
||||
@@ -1389,6 +1536,32 @@
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
QUnit.module('lodash.unescape');
|
||||
|
||||
(function() {
|
||||
var escaped = '<h1>Moe's famous "death by chocolate" brownies & cake<\/h1>',
|
||||
unescaped = '<h1>Moe\'s famous "death by chocolate" brownies & cake<\/h1>';
|
||||
|
||||
test('should unescape entities in the correct order', function() {
|
||||
equal(_.unescape('&lt;'), '<');
|
||||
});
|
||||
|
||||
test('should unescape the proper entities', function() {
|
||||
equal(_.unescape(escaped), unescaped);
|
||||
});
|
||||
|
||||
test('should unescape the same characters escaped by `_.escape`', function() {
|
||||
equal(_.unescape(_.escape(unescaped)), unescaped);
|
||||
});
|
||||
|
||||
test('should return an empty string when passed `null` or `undefined`', function() {
|
||||
equal(_.unescape(null), '');
|
||||
equal(_.unescape(undefined), '');
|
||||
});
|
||||
}());
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
QUnit.module('lodash.uniq');
|
||||
|
||||
(function() {
|
||||
@@ -1489,88 +1662,43 @@
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
QUnit.module('lodash "Arrays" methods');
|
||||
QUnit.module('lodash methods');
|
||||
|
||||
(function() {
|
||||
test('should allow a falsey `array` argument', function() {
|
||||
_.each([
|
||||
'compact',
|
||||
'difference',
|
||||
'first',
|
||||
'flatten',
|
||||
'groupBy',
|
||||
'indexOf',
|
||||
'initial',
|
||||
'intersection',
|
||||
'last',
|
||||
'lastIndexOf',
|
||||
'max',
|
||||
'min',
|
||||
'range',
|
||||
'rest',
|
||||
'shuffle',
|
||||
'sortBy',
|
||||
'sortedIndex',
|
||||
'union',
|
||||
'uniq',
|
||||
'without',
|
||||
'zip',
|
||||
'zipObject'
|
||||
], function(methodName) {
|
||||
test('should allow falsey arguments', function() {
|
||||
var funcs = _.without.apply(_, [_.functions(_)].concat([
|
||||
'_',
|
||||
'_iteratorTemplate',
|
||||
'_shimKeys',
|
||||
'after',
|
||||
'bind',
|
||||
'bindAll',
|
||||
'compose',
|
||||
'debounce',
|
||||
'defer',
|
||||
'delay',
|
||||
'functions',
|
||||
'memoize',
|
||||
'once',
|
||||
'partial',
|
||||
'tap',
|
||||
'throttle',
|
||||
'wrap'
|
||||
]));
|
||||
|
||||
_.each(funcs, function(methodName) {
|
||||
var func = _[methodName],
|
||||
pass = true;
|
||||
|
||||
_.each(falsey, function(value, index) {
|
||||
try {
|
||||
index ? func() : func(value);
|
||||
index ? func(value) : func();
|
||||
} catch(e) {
|
||||
pass = false;
|
||||
}
|
||||
});
|
||||
|
||||
ok(pass, methodName + ' allows a falsey `array` argument');
|
||||
});
|
||||
});
|
||||
}());
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
QUnit.module('lodash "Collections" methods');
|
||||
|
||||
(function() {
|
||||
test('should allow a falsey `collection` argument', function() {
|
||||
_.each([
|
||||
'contains',
|
||||
'every',
|
||||
'filter',
|
||||
'find',
|
||||
'forEach',
|
||||
'invoke',
|
||||
'map',
|
||||
'pluck',
|
||||
'reduce',
|
||||
'reduceRight',
|
||||
'reject',
|
||||
'some',
|
||||
'toArray'
|
||||
], function(methodName) {
|
||||
var func = _[methodName],
|
||||
identity = _.identity,
|
||||
pass = true;
|
||||
|
||||
_.each(falsey, function(value, index) {
|
||||
try {
|
||||
if (/^(?:contains|toArray)$/.test(methodName)) {
|
||||
index ? func() : func(value);
|
||||
} else if (index) {
|
||||
func(value, identity);
|
||||
}
|
||||
} catch(e) {
|
||||
pass = false;
|
||||
}
|
||||
});
|
||||
|
||||
ok(pass, methodName + ' allows a falsey `collection` argument');
|
||||
ok(pass, methodName + ' allows falsey arguments');
|
||||
});
|
||||
});
|
||||
}());
|
||||
|
||||
46
vendor/backbone/backbone.js
vendored
46
vendor/backbone/backbone.js
vendored
@@ -561,7 +561,10 @@
|
||||
if (options.comparator !== void 0) this.comparator = options.comparator;
|
||||
this._reset();
|
||||
this.initialize.apply(this, arguments);
|
||||
if (models) this.reset(models, {silent: true, parse: options.parse});
|
||||
if (models) {
|
||||
if (options.parse) models = this.parse(models);
|
||||
this.reset(models, {silent: true, parse: options.parse});
|
||||
}
|
||||
};
|
||||
|
||||
// Define the Collection's inheritable methods.
|
||||
@@ -788,14 +791,14 @@
|
||||
// collection immediately, unless `wait: true` is passed, in which case we
|
||||
// wait for the server to agree.
|
||||
create: function(model, options) {
|
||||
var coll = this;
|
||||
var collection = this;
|
||||
options = options ? _.clone(options) : {};
|
||||
model = this._prepareModel(model, options);
|
||||
if (!model) return false;
|
||||
if (!options.wait) coll.add(model, options);
|
||||
if (!options.wait) collection.add(model, options);
|
||||
var success = options.success;
|
||||
options.success = function(model, resp, options) {
|
||||
if (options.wait) coll.add(model, options);
|
||||
if (options.wait) collection.add(model, options);
|
||||
if (success) success(model, resp, options);
|
||||
};
|
||||
model.save(null, options);
|
||||
@@ -864,11 +867,12 @@
|
||||
});
|
||||
|
||||
// Underscore methods that we want to implement on the Collection.
|
||||
var methods = ['forEach', 'each', 'map', 'reduce', 'reduceRight', 'find',
|
||||
'detect', 'filter', 'select', 'reject', 'every', 'all', 'some', 'any',
|
||||
'include', 'contains', 'invoke', 'max', 'min', 'sortBy', 'sortedIndex',
|
||||
'toArray', 'size', 'first', 'initial', 'rest', 'last', 'without', 'indexOf',
|
||||
'shuffle', 'lastIndexOf', 'isEmpty', 'groupBy'];
|
||||
var methods = ['forEach', 'each', 'map', 'collect', 'reduce', 'foldl',
|
||||
'inject', 'reduceRight', 'foldr', 'find', 'detect', 'filter', 'select',
|
||||
'reject', 'every', 'all', 'some', 'any', 'include', 'contains', 'invoke',
|
||||
'max', 'min', 'sortBy', 'sortedIndex', 'toArray', 'size', 'first', 'head',
|
||||
'take', 'initial', 'rest', 'tail', 'last', 'without', 'indexOf', 'shuffle',
|
||||
'lastIndexOf', 'isEmpty', 'groupBy'];
|
||||
|
||||
// Mix in each Underscore method as a proxy to `Collection#models`.
|
||||
_.each(methods, function(method) {
|
||||
@@ -1201,9 +1205,19 @@
|
||||
return this;
|
||||
},
|
||||
|
||||
// Clean up references to this view in order to prevent latent effects and
|
||||
// memory leaks.
|
||||
dispose: function() {
|
||||
this.undelegateEvents();
|
||||
if (this.model) this.model.off(null, null, this);
|
||||
if (this.collection) this.collection.off(null, null, this);
|
||||
return this;
|
||||
},
|
||||
|
||||
// Remove this view from the DOM. Note that the view isn't present in the
|
||||
// DOM by default, so calling this method may be a no-op.
|
||||
remove: function() {
|
||||
this.dispose();
|
||||
this.$el.remove();
|
||||
return this;
|
||||
},
|
||||
@@ -1300,14 +1314,6 @@
|
||||
|
||||
});
|
||||
|
||||
// The self-propagating extend function that Backbone classes use.
|
||||
var extend = function(protoProps, classProps) {
|
||||
return inherits(this, protoProps, classProps);
|
||||
};
|
||||
|
||||
// Set up inheritance for the model, collection, and view.
|
||||
Model.extend = Collection.extend = Router.extend = View.extend = extend;
|
||||
|
||||
// Backbone.sync
|
||||
// -------------
|
||||
|
||||
@@ -1407,7 +1413,8 @@
|
||||
// Helper function to correctly set up the prototype chain, for subclasses.
|
||||
// Similar to `goog.inherits`, but uses a hash of prototype properties and
|
||||
// class properties to be extended.
|
||||
var inherits = function(parent, protoProps, staticProps) {
|
||||
var extend = function(protoProps, staticProps) {
|
||||
var parent = this;
|
||||
var child;
|
||||
|
||||
// The constructor function for the new subclass is either defined by you
|
||||
@@ -1443,6 +1450,9 @@
|
||||
return child;
|
||||
};
|
||||
|
||||
// Set up inheritance for the model, collection, and view.
|
||||
Model.extend = Collection.extend = Router.extend = View.extend = extend;
|
||||
|
||||
// Helper function to get a value from a Backbone object as a property
|
||||
// or as a function.
|
||||
var getValue = function(object, prop) {
|
||||
|
||||
23
vendor/backbone/test/collection.js
vendored
23
vendor/backbone/test/collection.js
vendored
@@ -47,6 +47,29 @@ $(document).ready(function() {
|
||||
equal(col.length, 4);
|
||||
});
|
||||
|
||||
test("Collection: new and parse", 3, function() {
|
||||
var MyCol = Backbone.Collection.extend({
|
||||
// only save the models that have an even value.
|
||||
parse : function(data) {
|
||||
var onlyEven = [];
|
||||
_.each(data, function(datum) {
|
||||
if (datum.a % 2 === 0) {
|
||||
onlyEven.push(datum);
|
||||
}
|
||||
});
|
||||
|
||||
return onlyEven;
|
||||
}
|
||||
});
|
||||
anotherCol = new MyCol([
|
||||
{ a : 1 },{ a : 2 },{ a : 3 },{ a : 4 }
|
||||
], { parse : true });
|
||||
|
||||
equal(anotherCol.length, 2);
|
||||
equal(anotherCol.first().get('a'), 2)
|
||||
equal(anotherCol.last().get('a'), 4);
|
||||
});
|
||||
|
||||
test("Collection: get, getByCid", 3, function() {
|
||||
equal(col.get(0), d);
|
||||
equal(col.get(2), b);
|
||||
|
||||
24
vendor/backbone/test/view.js
vendored
24
vendor/backbone/test/view.js
vendored
@@ -241,4 +241,28 @@ $(document).ready(function() {
|
||||
ok(new View().$el.is('p'));
|
||||
});
|
||||
|
||||
test("dispose", 0, function() {
|
||||
var View = Backbone.View.extend({
|
||||
events: {click: function(){ ok(false); }},
|
||||
initialize: function() {
|
||||
this.model.on('all x', function(){ ok(false); }, this);
|
||||
this.collection.on('all x', function(){ ok(false); }, this);
|
||||
}
|
||||
});
|
||||
var view = new View({
|
||||
model: new Backbone.Model,
|
||||
collection: new Backbone.Collection
|
||||
});
|
||||
view.dispose();
|
||||
view.model.trigger('x');
|
||||
view.collection.trigger('x');
|
||||
view.$el.click();
|
||||
});
|
||||
|
||||
test("view#remove calls dispose.", 1, function() {
|
||||
var view = new Backbone.View();
|
||||
view.dispose = function() { ok(true); };
|
||||
view.remove();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
2
vendor/benchmark.js/README.md
vendored
2
vendor/benchmark.js/README.md
vendored
@@ -14,7 +14,7 @@ For a list of upcoming features, check out our [roadmap](https://github.com/best
|
||||
|
||||
## Support
|
||||
|
||||
Benchmark.js has been tested in at least Adobe AIR 3.1, Chrome 5-21, Firefox 1.5-13, IE 6-9, Opera 9.25-12.01, Safari 3-6, Node.js 0.8.6, Narwhal 0.3.2, RingoJS 0.8, and Rhino 1.7RC5.
|
||||
Benchmark.js has been tested in at least Adobe AIR 3.1, Chrome 5-21, Firefox 1-14, IE 6-9, Opera 9.25-12, Safari 3-6, Node.js 0.8.7, Narwhal 0.3.2, RingoJS 0.8, and Rhino 1.7RC5.
|
||||
|
||||
## Installation and usage
|
||||
|
||||
|
||||
4
vendor/docdown/src/DocDown/Entry.php
vendored
4
vendor/docdown/src/DocDown/Entry.php
vendored
@@ -196,7 +196,7 @@ class Entry {
|
||||
* @returns {Array} The entry `param` data.
|
||||
*/
|
||||
public function getParams( $index = null ) {
|
||||
preg_match_all('#\*\s*@param\s+\{([^}]+)\}\s+(\[.+\]|[$\w]+)\s+([\s\S]*?)(?=\*\s\@[a-z]|\*/)#i', $this->entry, $result);
|
||||
preg_match_all('#\*\s*@param\s+\{([^}]+)\}\s+(\[.+\]|[$\w|]+(?:\[.+\])?)\s+([\s\S]*?)(?=\*\s\@[a-z]|\*/)#i', $this->entry, $result);
|
||||
if (count($result = array_filter(array_slice($result, 1)))) {
|
||||
// repurpose array
|
||||
foreach ($result as $param) {
|
||||
@@ -204,7 +204,7 @@ class Entry {
|
||||
if (!is_array($result[0][$key])) {
|
||||
$result[0][$key] = array();
|
||||
}
|
||||
$result[0][$key][] = trim(preg_replace('/(?:^|\n)\s*\* ?/', ' ', $value));
|
||||
$result[0][$key][] = trim(preg_replace('/(?:^|\n)\s*\* */', ' ', $value));
|
||||
}
|
||||
}
|
||||
$result = $result[0];
|
||||
|
||||
2
vendor/platform.js/README.md
vendored
2
vendor/platform.js/README.md
vendored
@@ -18,7 +18,7 @@ For a list of upcoming features, check out our [roadmap](https://github.com/best
|
||||
|
||||
## Support
|
||||
|
||||
Platform.js has been tested in at least Adobe AIR 3.1, Chrome 5-21, Firefox 1.5-13, IE 6-9, Opera 9.25-12.01, Safari 3-6, Node.js 0.8.6, Narwhal 0.3.2, RingoJS 0.8, and Rhino 1.7RC5.
|
||||
Platform.js has been tested in at least Adobe AIR 3.1, Chrome 5-21, Firefox 1-14, IE 6-9, Opera 9.25-12, Safari 3-6, Node.js 0.8.6, Narwhal 0.3.2, RingoJS 0.8, and Rhino 1.7RC5.
|
||||
|
||||
## Installation and usage
|
||||
|
||||
|
||||
30
vendor/requirejs/require.js
vendored
30
vendor/requirejs/require.js
vendored
@@ -1,5 +1,5 @@
|
||||
/** vim: et:ts=4:sw=4:sts=4
|
||||
* @license RequireJS 2.0.5 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
|
||||
* @license RequireJS 2.0.6 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
|
||||
* Available via the MIT or new BSD license.
|
||||
* see: http://github.com/jrburke/requirejs for details
|
||||
*/
|
||||
@@ -12,7 +12,7 @@ var requirejs, require, define;
|
||||
(function (global) {
|
||||
var req, s, head, baseElement, dataMain, src,
|
||||
interactiveScript, currentlyAddingScript, mainScript, subPath,
|
||||
version = '2.0.5',
|
||||
version = '2.0.6',
|
||||
commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,
|
||||
cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,
|
||||
jsSuffixRegExp = /\.js$/,
|
||||
@@ -612,7 +612,7 @@ var requirejs, require, define;
|
||||
});
|
||||
}
|
||||
|
||||
function findCycle(mod, traced) {
|
||||
function findCycle(mod, traced, processed) {
|
||||
var id = mod.map.id,
|
||||
depArray = mod.depMaps,
|
||||
foundModule;
|
||||
@@ -635,28 +635,16 @@ var requirejs, require, define;
|
||||
var depId = depMap.id,
|
||||
depMod = registry[depId];
|
||||
|
||||
if (!depMod) {
|
||||
if (!depMod || processed[depId] ||
|
||||
!depMod.inited || !depMod.enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!depMod.inited || !depMod.enabled) {
|
||||
//Dependency is not inited, so this cannot
|
||||
//be used to determine a cycle.
|
||||
foundModule = null;
|
||||
delete traced[id];
|
||||
return true;
|
||||
}
|
||||
|
||||
//mixin traced to a new object for each dependency, so that
|
||||
//sibling dependencies in this object to not generate a
|
||||
//false positive match on a cycle. Ideally an Object.create
|
||||
//type of prototype delegation would be used here, but
|
||||
//optimizing for file size vs. execution speed since hopefully
|
||||
//the trees are small for circular dependency scans relative
|
||||
//to the full app perf.
|
||||
return (foundModule = findCycle(depMod, mixin({}, traced)));
|
||||
return (foundModule = findCycle(depMod, traced, processed));
|
||||
});
|
||||
|
||||
processed[id] = true;
|
||||
|
||||
return foundModule;
|
||||
}
|
||||
|
||||
@@ -779,7 +767,7 @@ var requirejs, require, define;
|
||||
return;
|
||||
}
|
||||
|
||||
var cycleMod = findCycle(mod, {}),
|
||||
var cycleMod = findCycle(mod, {}, {}),
|
||||
traced = {};
|
||||
|
||||
if (cycleMod) {
|
||||
|
||||
18
vendor/underscore/test/objects.js
vendored
18
vendor/underscore/test/objects.js
vendored
@@ -48,6 +48,24 @@ $(document).ready(function() {
|
||||
ok(_.isEqual(result, {b:2, c:3}), 'can restrict properties to those named in an array');
|
||||
result = _.pick({a:1, b:2, c:3}, ['a'], 'b');
|
||||
ok(_.isEqual(result, {a:1, b:2}), 'can restrict properties to those named in mixed args');
|
||||
|
||||
var Obj = function(){};
|
||||
Obj.prototype = {a: 1, b: 2, c: 3};
|
||||
ok(_.isEqual(_.pick(new Obj, 'a', 'c'), {a:1, c: 3}), 'include prototype props');
|
||||
});
|
||||
|
||||
test("objects: omit", function() {
|
||||
var result;
|
||||
result = _.omit({a:1, b:2, c:3}, 'b');
|
||||
ok(_.isEqual(result, {a:1, c:3}), 'can omit a single named property');
|
||||
result = _.omit({a:1, b:2, c:3}, 'a', 'c');
|
||||
ok(_.isEqual(result, {b:2}), 'can omit several named properties');
|
||||
result = _.omit({a:1, b:2, c:3}, ['b', 'c']);
|
||||
ok(_.isEqual(result, {a:1}), 'can omit properties named in an array');
|
||||
|
||||
var Obj = function(){};
|
||||
Obj.prototype = {a: 1, b: 2, c: 3};
|
||||
ok(_.isEqual(_.omit(new Obj, 'b'), {a:1, c: 3}), 'include prototype props');
|
||||
});
|
||||
|
||||
test("objects: defaults", function() {
|
||||
|
||||
52
vendor/underscore/underscore-min.js
vendored
52
vendor/underscore/underscore-min.js
vendored
@@ -1,32 +1,32 @@
|
||||
// Underscore.js 1.3.3
|
||||
// (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc.
|
||||
// Underscore is freely distributable under the MIT license.
|
||||
// Underscore may be freely distributed under the MIT license.
|
||||
// Portions of Underscore are inspired or borrowed from Prototype,
|
||||
// Oliver Steele's Functional, and John Resig's Micro-Templating.
|
||||
// For all details and documentation:
|
||||
// http://documentcloud.github.com/underscore
|
||||
(function(){var s=this,L=s._,p={},k=Array.prototype,q=Object.prototype,M=k.push,i=k.slice,N=k.unshift,m=q.toString,O=q.hasOwnProperty,z=k.forEach,A=k.map,B=k.reduce,C=k.reduceRight,D=k.filter,E=k.every,F=k.some,r=k.indexOf,G=k.lastIndexOf,q=Array.isArray,P=Object.keys,t=Function.prototype.bind,b=function(a){return new l(a)};"undefined"!==typeof exports?("undefined"!==typeof module&&module.exports&&(exports=module.exports=b),exports._=b):s._=b;b.VERSION="1.3.3";var j=b.each=b.forEach=function(a,c,
|
||||
d){if(a!=null)if(z&&a.forEach===z)a.forEach(c,d);else if(a.length===+a.length)for(var e=0,f=a.length;e<f;e++){if(c.call(d,a[e],e,a)===p)break}else for(e in a)if(b.has(a,e)&&c.call(d,a[e],e,a)===p)break};b.map=b.collect=function(a,c,d){var b=[];if(a==null)return b;if(A&&a.map===A)return a.map(c,d);j(a,function(a,g,h){b[b.length]=c.call(d,a,g,h)});return b};b.reduce=b.foldl=b.inject=function(a,c,d,e){var f=arguments.length>2;a==null&&(a=[]);if(B&&a.reduce===B){e&&(c=b.bind(c,e));return f?a.reduce(c,
|
||||
d):a.reduce(c)}j(a,function(a,b,i){if(f)d=c.call(e,d,a,b,i);else{d=a;f=true}});if(!f)throw new TypeError("Reduce of empty array with no initial value");return d};b.reduceRight=b.foldr=function(a,c,d,e){var f=arguments.length>2;a==null&&(a=[]);if(C&&a.reduceRight===C){e&&(c=b.bind(c,e));return f?a.reduceRight(c,d):a.reduceRight(c)}var g=b.toArray(a).reverse();e&&!f&&(c=b.bind(c,e));return f?b.reduce(g,c,d,e):b.reduce(g,c)};b.find=b.detect=function(a,c,b){var e;H(a,function(a,g,h){if(c.call(b,a,g,h)){e=
|
||||
a;return true}});return e};b.filter=b.select=function(a,c,b){var e=[];if(a==null)return e;if(D&&a.filter===D)return a.filter(c,b);j(a,function(a,g,h){c.call(b,a,g,h)&&(e[e.length]=a)});return e};b.reject=function(a,c,b){var e=[];if(a==null)return e;j(a,function(a,g,h){c.call(b,a,g,h)||(e[e.length]=a)});return e};b.every=b.all=function(a,c,b){var e=true;if(a==null)return e;if(E&&a.every===E)return a.every(c,b);j(a,function(a,g,h){if(!(e=e&&c.call(b,a,g,h)))return p});return!!e};var H=b.some=b.any=
|
||||
function(a,c,d){c||(c=b.identity);var e=false;if(a==null)return e;if(F&&a.some===F)return a.some(c,d);j(a,function(a,b,h){if(e||(e=c.call(d,a,b,h)))return p});return!!e};b.include=b.contains=function(a,c){var b=false;if(a==null)return b;if(r&&a.indexOf===r)return a.indexOf(c)!=-1;return b=H(a,function(a){return a===c})};b.invoke=function(a,c){var d=i.call(arguments,2);return b.map(a,function(a){return(b.isFunction(c)?c:a[c]).apply(a,d)})};b.pluck=function(a,c){return b.map(a,function(a){return a[c]})};
|
||||
b.max=function(a,c,d){if(!c&&b.isArray(a)&&a[0]===+a[0]&&a.length<65535)return Math.max.apply(Math,a);if(!c&&b.isEmpty(a))return-Infinity;var e={computed:-Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;b>=e.computed&&(e={value:a,computed:b})});return e.value};b.min=function(a,c,d){if(!c&&b.isArray(a)&&a[0]===+a[0]&&a.length<65535)return Math.min.apply(Math,a);if(!c&&b.isEmpty(a))return Infinity;var e={computed:Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;b<e.computed&&(e={value:a,computed:b})});
|
||||
return e.value};b.shuffle=function(a){var c,b=0,e=[];j(a,function(a){c=Math.floor(Math.random()*++b);e[b-1]=e[c];e[c]=a});return e};b.sortBy=function(a,c,d){var e=I(a,c);return b.pluck(b.map(a,function(a,c,b){return{value:a,criteria:e.call(d,a,c,b)}}).sort(function(a,c){var b=a.criteria,d=c.criteria;return b===void 0?1:d===void 0?-1:b<d?-1:b>d?1:0}),"value")};var I=function(a,c){return b.isFunction(c)?c:function(a){return a[c]}},J=function(a,c,b){var e={},f=I(a,c);j(a,function(a,c){var i=f(a,c);b(e,
|
||||
i,a)});return e};b.groupBy=function(a,c){return J(a,c,function(a,c,b){(a[c]||(a[c]=[])).push(b)})};b.countBy=function(a,c){return J(a,c,function(a,c){a[c]||(a[c]=0);a[c]++})};b.sortedIndex=function(a,c,d){d||(d=b.identity);for(var c=d(c),e=0,f=a.length;e<f;){var g=e+f>>1;d(a[g])<c?e=g+1:f=g}return e};b.toArray=function(a){return!a?[]:b.isArray(a)||b.isArguments(a)?i.call(a):a.toArray&&b.isFunction(a.toArray)?a.toArray():b.values(a)};b.size=function(a){return b.isArray(a)?a.length:b.keys(a).length};
|
||||
b.first=b.head=b.take=function(a,c,b){return c!=null&&!b?i.call(a,0,c):a[0]};b.initial=function(a,c,b){return i.call(a,0,a.length-(c==null||b?1:c))};b.last=function(a,c,b){return c!=null&&!b?i.call(a,Math.max(a.length-c,0)):a[a.length-1]};b.rest=b.tail=function(a,c,b){return i.call(a,c==null||b?1:c)};b.compact=function(a){return b.filter(a,function(a){return!!a})};var n=function(a,c,d){j(a,function(a){b.isArray(a)?c?M.apply(d,a):n(a,c,d):d.push(a)});return d};b.flatten=function(a,c){return n(a,c,
|
||||
[])};b.without=function(a){return b.difference(a,i.call(arguments,1))};b.uniq=b.unique=function(a,c,d){var d=d?b.map(a,d):a,e=[];b.reduce(d,function(d,g,h){if(c?b.last(d)!==g||!d.length:!b.include(d,g)){d.push(g);e.push(a[h])}return d},[]);return e};b.union=function(){return b.uniq(n(arguments,true,[]))};b.intersection=function(a){var c=i.call(arguments,1);return b.filter(b.uniq(a),function(a){return b.every(c,function(c){return b.indexOf(c,a)>=0})})};b.difference=function(a){var c=n(i.call(arguments,
|
||||
1),true,[]);return b.filter(a,function(a){return!b.include(c,a)})};b.zip=function(){for(var a=i.call(arguments),c=b.max(b.pluck(a,"length")),d=Array(c),e=0;e<c;e++)d[e]=b.pluck(a,""+e);return d};b.zipObject=function(a,c){for(var b={},e=0,f=a.length;e<f;e++)b[a[e]]=c[e];return b};b.indexOf=function(a,c,d){if(a==null)return-1;var e;if(d){d=b.sortedIndex(a,c);return a[d]===c?d:-1}if(r&&a.indexOf===r)return a.indexOf(c);d=0;for(e=a.length;d<e;d++)if(a[d]===c)return d;return-1};b.lastIndexOf=function(a,
|
||||
c){if(a==null)return-1;if(G&&a.lastIndexOf===G)return a.lastIndexOf(c);for(var b=a.length;b--;)if(a[b]===c)return b;return-1};b.range=function(a,c,b){if(arguments.length<=1){c=a||0;a=0}for(var b=arguments[2]||1,e=Math.max(Math.ceil((c-a)/b),0),f=0,g=Array(e);f<e;){g[f++]=a;a=a+b}return g};var K=function(){};b.bind=function(a,c){var d,e;if(a.bind===t&&t)return t.apply(a,i.call(arguments,1));if(!b.isFunction(a))throw new TypeError;e=i.call(arguments,2);return d=function(){if(!(this instanceof d))return a.apply(c,
|
||||
e.concat(i.call(arguments)));K.prototype=a.prototype;var b=new K,g=a.apply(b,e.concat(i.call(arguments)));return Object(g)===g?g:b}};b.bindAll=function(a){var c=i.call(arguments,1);c.length==0&&(c=b.functions(a));j(c,function(c){a[c]=b.bind(a[c],a)});return a};b.memoize=function(a,c){var d={};c||(c=b.identity);return function(){var e=c.apply(this,arguments);return b.has(d,e)?d[e]:d[e]=a.apply(this,arguments)}};b.delay=function(a,c){var b=i.call(arguments,2);return setTimeout(function(){return a.apply(null,
|
||||
b)},c)};b.defer=function(a){return b.delay.apply(b,[a,1].concat(i.call(arguments,1)))};b.throttle=function(a,c){var d,e,f,g,h,i,j=b.debounce(function(){h=g=false},c);return function(){d=this;e=arguments;f||(f=setTimeout(function(){f=null;h&&a.apply(d,e);j()},c));if(g)h=true;else{g=true;i=a.apply(d,e)}j();return i}};b.debounce=function(a,b,d){var e;return function(){var f=this,g=arguments,h=d&&!e;clearTimeout(e);e=setTimeout(function(){e=null;d||a.apply(f,g)},b);h&&a.apply(f,g)}};b.once=function(a){var b=
|
||||
false,d;return function(){if(b)return d;b=true;return d=a.apply(this,arguments)}};b.wrap=function(a,b){return function(){var d=[a].concat(i.call(arguments,0));return b.apply(this,d)}};b.compose=function(){var a=arguments;return function(){for(var b=arguments,d=a.length-1;d>=0;d--)b=[a[d].apply(this,b)];return b[0]}};b.after=function(a,b){return a<=0?b():function(){if(--a<1)return b.apply(this,arguments)}};b.keys=P||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var c=[],d;for(d in a)b.has(a,
|
||||
d)&&(c[c.length]=d);return c};b.values=function(a){return b.map(a,b.identity)};b.functions=b.methods=function(a){var c=[],d;for(d in a)b.isFunction(a[d])&&c.push(d);return c.sort()};b.extend=function(a){j(i.call(arguments,1),function(b){for(var d in b)a[d]=b[d]});return a};b.pick=function(a){var b={};j(n(i.call(arguments,1),true,[]),function(d){d in a&&(b[d]=a[d])});return b};b.defaults=function(a){j(i.call(arguments,1),function(b){for(var d in b)a[d]==null&&(a[d]=b[d])});return a};b.clone=function(a){return!b.isObject(a)?
|
||||
a:b.isArray(a)?a.slice():b.extend({},a)};b.tap=function(a,b){b(a);return a};var u=function(a,c,d){if(a===c)return a!==0||1/a==1/c;if(a==null||c==null)return a===c;if(a._chain)a=a._wrapped;if(c._chain)c=c._wrapped;if(a.isEqual&&b.isFunction(a.isEqual))return a.isEqual(c);if(c.isEqual&&b.isFunction(c.isEqual))return c.isEqual(a);var e=m.call(a);if(e!=m.call(c))return false;switch(e){case "[object String]":return a==""+c;case "[object Number]":return a!=+a?c!=+c:a==0?1/a==1/c:a==+c;case "[object Date]":case "[object Boolean]":return+a==
|
||||
+c;case "[object RegExp]":return a.source==c.source&&a.global==c.global&&a.multiline==c.multiline&&a.ignoreCase==c.ignoreCase}if(typeof a!="object"||typeof c!="object")return false;for(var f=d.length;f--;)if(d[f]==a)return true;d.push(a);var f=0,g=true;if(e=="[object Array]"){f=a.length;if(g=f==c.length)for(;f--;)if(!(g=f in a==f in c&&u(a[f],c[f],d)))break}else{if("constructor"in a!="constructor"in c||a.constructor!=c.constructor)return false;for(var h in a)if(b.has(a,h)){f++;if(!(g=b.has(c,h)&&
|
||||
u(a[h],c[h],d)))break}if(g){for(h in c)if(b.has(c,h)&&!f--)break;g=!f}}d.pop();return g};b.isEqual=function(a,b){return u(a,b,[])};b.isEmpty=function(a){if(a==null)return true;if(b.isArray(a)||b.isString(a))return a.length===0;for(var c in a)if(b.has(a,c))return false;return true};b.isElement=function(a){return!!(a&&a.nodeType==1)};b.isArray=q||function(a){return m.call(a)=="[object Array]"};b.isObject=function(a){return a===Object(a)};j("Arguments,Function,String,Number,Date,RegExp".split(","),function(a){b["is"+
|
||||
a]=function(b){return m.call(b)=="[object "+a+"]"}});b.isArguments(arguments)||(b.isArguments=function(a){return!(!a||!b.has(a,"callee"))});b.isFinite=function(a){return b.isNumber(a)&&isFinite(a)};b.isNaN=function(a){return a!==a};b.isBoolean=function(a){return a===true||a===false||m.call(a)=="[object Boolean]"};b.isNull=function(a){return a===null};b.isUndefined=function(a){return a===void 0};b.has=function(a,b){return O.call(a,b)};b.noConflict=function(){s._=L;return this};b.identity=function(a){return a};
|
||||
b.times=function(a,b,d){for(var e=0;e<a;e++)b.call(d,e)};var Q={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"},R=/[&<>"'\/]/g;b.escape=function(a){return(""+a).replace(R,function(a){return Q[a]})};b.result=function(a,c){if(a==null)return null;var d=a[c];return b.isFunction(d)?d.call(a):d};b.mixin=function(a){j(b.functions(a),function(c){S(c,b[c]=a[c])})};var T=0;b.uniqueId=function(a){var b=T++;return a?a+b:b};b.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,
|
||||
escape:/<%-([\s\S]+?)%>/g};var v=/.^/,o={"\\":"\\","'":"'",r:"\r",n:"\n",t:"\t",u2028:"\u2028",u2029:"\u2029"},w;for(w in o)o[o[w]]=w;var U=/\\|'|\r|\n|\t|\u2028|\u2029/g,V=/\\(\\|'|r|n|t|u2028|u2029)/g,x=function(a){return a.replace(V,function(a,b){return o[b]})};b.template=function(a,c,d){d=b.defaults(d||{},b.templateSettings);a="__p+='"+a.replace(U,function(a){return"\\"+o[a]}).replace(d.escape||v,function(a,b){return"'+\n((__t=("+x(b)+"))==null?'':_.escape(__t))+\n'"}).replace(d.interpolate||
|
||||
v,function(a,b){return"'+\n((__t=("+x(b)+"))==null?'':__t)+\n'"}).replace(d.evaluate||v,function(a,b){return"';\n"+x(b)+"\n__p+='"})+"';\n";d.variable||(a="with(obj||{}){\n"+a+"}\n");var a="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'')};\n"+a+"return __p;\n",e=new Function(d.variable||"obj","_",a);if(c)return e(c,b);c=function(a){return e.call(this,a,b)};c.source="function("+(d.variable||"obj")+"){\n"+a+"}";return c};b.chain=function(a){return b(a).chain()};
|
||||
var l=function(a){this._wrapped=a};b.prototype=l.prototype;var y=function(a,c){return c?b(a).chain():a},S=function(a,c){l.prototype[a]=function(){var a=i.call(arguments);N.call(a,this._wrapped);return y(c.apply(b,a),this._chain)}};b.mixin(b);j("pop,push,reverse,shift,sort,splice,unshift".split(","),function(a){var b=k[a];l.prototype[a]=function(){var d=this._wrapped;b.apply(d,arguments);(a=="shift"||a=="splice")&&d.length===0&&delete d[0];return y(d,this._chain)}});j(["concat","join","slice"],function(a){var b=
|
||||
k[a];l.prototype[a]=function(){return y(b.apply(this._wrapped,arguments),this._chain)}});l.prototype.chain=function(){this._chain=true;return this};l.prototype.value=function(){return this._wrapped}}).call(this);
|
||||
(function(){var s=this,L=s._,o={},k=Array.prototype,p=Object.prototype,M=k.push,h=k.slice,N=k.unshift,m=p.toString,O=p.hasOwnProperty,z=k.forEach,A=k.map,B=k.reduce,C=k.reduceRight,D=k.filter,E=k.every,F=k.some,q=k.indexOf,G=k.lastIndexOf,p=Array.isArray,P=Object.keys,t=Function.prototype.bind,b=function(a){return new l(a)};"undefined"!==typeof exports?("undefined"!==typeof module&&module.exports&&(exports=module.exports=b),exports._=b):s._=b;b.VERSION="1.3.3";var i=b.each=b.forEach=function(a,c,
|
||||
d){if(a!=null)if(z&&a.forEach===z)a.forEach(c,d);else if(a.length===+a.length)for(var e=0,f=a.length;e<f;e++){if(c.call(d,a[e],e,a)===o)break}else for(e in a)if(b.has(a,e)&&c.call(d,a[e],e,a)===o)break};b.map=b.collect=function(a,c,d){var b=[];if(a==null)return b;if(A&&a.map===A)return a.map(c,d);i(a,function(a,g,j){b[b.length]=c.call(d,a,g,j)});return b};b.reduce=b.foldl=b.inject=function(a,c,d,e){var f=arguments.length>2;a==null&&(a=[]);if(B&&a.reduce===B){e&&(c=b.bind(c,e));return f?a.reduce(c,
|
||||
d):a.reduce(c)}i(a,function(a,b,h){if(f)d=c.call(e,d,a,b,h);else{d=a;f=true}});if(!f)throw new TypeError("Reduce of empty array with no initial value");return d};b.reduceRight=b.foldr=function(a,c,d,e){var f=arguments.length>2;a==null&&(a=[]);if(C&&a.reduceRight===C){e&&(c=b.bind(c,e));return f?a.reduceRight(c,d):a.reduceRight(c)}var g=b.toArray(a).reverse();e&&!f&&(c=b.bind(c,e));return f?b.reduce(g,c,d,e):b.reduce(g,c)};b.find=b.detect=function(a,c,b){var e;H(a,function(a,g,j){if(c.call(b,a,g,j)){e=
|
||||
a;return true}});return e};b.filter=b.select=function(a,c,b){var e=[];if(a==null)return e;if(D&&a.filter===D)return a.filter(c,b);i(a,function(a,g,j){c.call(b,a,g,j)&&(e[e.length]=a)});return e};b.reject=function(a,c,b){var e=[];if(a==null)return e;i(a,function(a,g,j){c.call(b,a,g,j)||(e[e.length]=a)});return e};b.every=b.all=function(a,c,b){var e=true;if(a==null)return e;if(E&&a.every===E)return a.every(c,b);i(a,function(a,g,j){if(!(e=e&&c.call(b,a,g,j)))return o});return!!e};var H=b.some=b.any=
|
||||
function(a,c,d){c||(c=b.identity);var e=false;if(a==null)return e;if(F&&a.some===F)return a.some(c,d);i(a,function(a,b,j){if(e||(e=c.call(d,a,b,j)))return o});return!!e};b.include=b.contains=function(a,c){var b=false;if(a==null)return b;if(q&&a.indexOf===q)return a.indexOf(c)!=-1;return b=H(a,function(a){return a===c})};b.invoke=function(a,c){var d=h.call(arguments,2);return b.map(a,function(a){return(b.isFunction(c)?c:a[c]).apply(a,d)})};b.pluck=function(a,c){return b.map(a,function(a){return a[c]})};
|
||||
b.max=function(a,c,d){if(!c&&b.isArray(a)&&a[0]===+a[0]&&a.length<65535)return Math.max.apply(Math,a);if(!c&&b.isEmpty(a))return-Infinity;var e={computed:-Infinity};i(a,function(a,b,j){b=c?c.call(d,a,b,j):a;b>=e.computed&&(e={value:a,computed:b})});return e.value};b.min=function(a,c,d){if(!c&&b.isArray(a)&&a[0]===+a[0]&&a.length<65535)return Math.min.apply(Math,a);if(!c&&b.isEmpty(a))return Infinity;var e={computed:Infinity};i(a,function(a,b,j){b=c?c.call(d,a,b,j):a;b<e.computed&&(e={value:a,computed:b})});
|
||||
return e.value};b.shuffle=function(a){var c,b=0,e=[];i(a,function(a){c=Math.floor(Math.random()*++b);e[b-1]=e[c];e[c]=a});return e};b.sortBy=function(a,c,d){var e=I(a,c);return b.pluck(b.map(a,function(a,c,b){return{value:a,criteria:e.call(d,a,c,b)}}).sort(function(a,c){var b=a.criteria,d=c.criteria;return b===void 0?1:d===void 0?-1:b<d?-1:b>d?1:0}),"value")};var I=function(a,c){return b.isFunction(c)?c:function(a){return a[c]}},J=function(a,c,b){var e={},f=I(a,c);i(a,function(a,c){var h=f(a,c);b(e,
|
||||
h,a)});return e};b.groupBy=function(a,c){return J(a,c,function(a,c,b){(a[c]||(a[c]=[])).push(b)})};b.countBy=function(a,c){return J(a,c,function(a,c){a[c]||(a[c]=0);a[c]++})};b.sortedIndex=function(a,c,d){d||(d=b.identity);for(var c=d(c),e=0,f=a.length;e<f;){var g=e+f>>1;d(a[g])<c?e=g+1:f=g}return e};b.toArray=function(a){return!a?[]:b.isArray(a)||b.isArguments(a)?h.call(a):b.isFunction(a.toArray)?a.toArray():b.values(a)};b.size=function(a){return b.isArray(a)?a.length:b.keys(a).length};b.first=b.head=
|
||||
b.take=function(a,c,b){return c!=null&&!b?h.call(a,0,c):a[0]};b.initial=function(a,c,b){return h.call(a,0,a.length-(c==null||b?1:c))};b.last=function(a,c,b){return c!=null&&!b?h.call(a,Math.max(a.length-c,0)):a[a.length-1]};b.rest=b.tail=function(a,c,b){return h.call(a,c==null||b?1:c)};b.compact=function(a){return b.filter(a,function(a){return!!a})};var r=function(a,c,d){i(a,function(a){b.isArray(a)?c?M.apply(d,a):r(a,c,d):d.push(a)});return d};b.flatten=function(a,c){return r(a,c,[])};b.without=
|
||||
function(a){return b.difference(a,h.call(arguments,1))};b.uniq=b.unique=function(a,c,d){var d=d?b.map(a,d):a,e=[];b.reduce(d,function(d,g,j){if(c?b.last(d)!==g||!d.length:!b.include(d,g)){d.push(g);e.push(a[j])}return d},[]);return e};b.union=function(){return b.uniq(r(arguments,true,[]))};b.intersection=function(a){var c=h.call(arguments,1);return b.filter(b.uniq(a),function(a){return b.every(c,function(c){return b.indexOf(c,a)>=0})})};b.difference=function(a){var c=r(h.call(arguments,1),true,[]);
|
||||
return b.filter(a,function(a){return!b.include(c,a)})};b.zip=function(){for(var a=h.call(arguments),c=b.max(b.pluck(a,"length")),d=Array(c),e=0;e<c;e++)d[e]=b.pluck(a,""+e);return d};b.zipObject=function(a,c){for(var b={},e=0,f=a.length;e<f;e++)b[a[e]]=c[e];return b};b.indexOf=function(a,c,d){if(a==null)return-1;var e;if(d){d=b.sortedIndex(a,c);return a[d]===c?d:-1}if(q&&a.indexOf===q)return a.indexOf(c);d=0;for(e=a.length;d<e;d++)if(a[d]===c)return d;return-1};b.lastIndexOf=function(a,c){if(a==null)return-1;
|
||||
if(G&&a.lastIndexOf===G)return a.lastIndexOf(c);for(var b=a.length;b--;)if(a[b]===c)return b;return-1};b.range=function(a,c,b){if(arguments.length<=1){c=a||0;a=0}for(var b=arguments[2]||1,e=Math.max(Math.ceil((c-a)/b),0),f=0,g=Array(e);f<e;){g[f++]=a;a=a+b}return g};var K=function(){};b.bind=function(a,c){var d,e;if(a.bind===t&&t)return t.apply(a,h.call(arguments,1));if(!b.isFunction(a))throw new TypeError;e=h.call(arguments,2);return d=function(){if(!(this instanceof d))return a.apply(c,e.concat(h.call(arguments)));
|
||||
K.prototype=a.prototype;var b=new K,g=a.apply(b,e.concat(h.call(arguments)));return Object(g)===g?g:b}};b.bindAll=function(a){var c=h.call(arguments,1);c.length==0&&(c=b.functions(a));i(c,function(c){a[c]=b.bind(a[c],a)});return a};b.memoize=function(a,c){var d={};c||(c=b.identity);return function(){var e=c.apply(this,arguments);return b.has(d,e)?d[e]:d[e]=a.apply(this,arguments)}};b.delay=function(a,b){var d=h.call(arguments,2);return setTimeout(function(){return a.apply(null,d)},b)};b.defer=function(a){return b.delay.apply(b,
|
||||
[a,1].concat(h.call(arguments,1)))};b.throttle=function(a,c){var d,e,f,g,j,h,i=b.debounce(function(){j=g=false},c);return function(){d=this;e=arguments;f||(f=setTimeout(function(){f=null;j&&a.apply(d,e);i()},c));if(g)j=true;else{g=true;h=a.apply(d,e)}i();return h}};b.debounce=function(a,b,d){var e;return function(){var f=this,g=arguments,h=d&&!e;clearTimeout(e);e=setTimeout(function(){e=null;d||a.apply(f,g)},b);h&&a.apply(f,g)}};b.once=function(a){var b=false,d;return function(){if(b)return d;b=true;
|
||||
return d=a.apply(this,arguments)}};b.wrap=function(a,b){return function(){var d=[a].concat(h.call(arguments,0));return b.apply(this,d)}};b.compose=function(){var a=arguments;return function(){for(var b=arguments,d=a.length-1;d>=0;d--)b=[a[d].apply(this,b)];return b[0]}};b.after=function(a,b){return a<=0?b():function(){if(--a<1)return b.apply(this,arguments)}};b.keys=P||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var c=[],d;for(d in a)b.has(a,d)&&(c[c.length]=d);return c};b.values=
|
||||
function(a){return b.map(a,b.identity)};b.functions=b.methods=function(a){var c=[],d;for(d in a)b.isFunction(a[d])&&c.push(d);return c.sort()};b.extend=function(a){i(h.call(arguments,1),function(b){for(var d in b)a[d]=b[d]});return a};b.pick=function(a){var c={},d=b.flatten(h.call(arguments,1));i(d,function(b){b in a&&(c[b]=a[b])});return c};b.omit=function(a){var c={},d=b.flatten(h.call(arguments,1)),e;for(e in a)b.include(d,e)||(c[e]=a[e]);return c};b.defaults=function(a){i(h.call(arguments,1),
|
||||
function(b){for(var d in b)a[d]==null&&(a[d]=b[d])});return a};b.clone=function(a){return!b.isObject(a)?a:b.isArray(a)?a.slice():b.extend({},a)};b.tap=function(a,b){b(a);return a};var u=function(a,c,d){if(a===c)return a!==0||1/a==1/c;if(a==null||c==null)return a===c;if(a._chain)a=a._wrapped;if(c._chain)c=c._wrapped;if(a.isEqual&&b.isFunction(a.isEqual))return a.isEqual(c);if(c.isEqual&&b.isFunction(c.isEqual))return c.isEqual(a);var e=m.call(a);if(e!=m.call(c))return false;switch(e){case "[object String]":return a==
|
||||
""+c;case "[object Number]":return a!=+a?c!=+c:a==0?1/a==1/c:a==+c;case "[object Date]":case "[object Boolean]":return+a==+c;case "[object RegExp]":return a.source==c.source&&a.global==c.global&&a.multiline==c.multiline&&a.ignoreCase==c.ignoreCase}if(typeof a!="object"||typeof c!="object")return false;for(var f=d.length;f--;)if(d[f]==a)return true;d.push(a);var f=0,g=true;if(e=="[object Array]"){f=a.length;if(g=f==c.length)for(;f--;)if(!(g=f in a==f in c&&u(a[f],c[f],d)))break}else{if("constructor"in
|
||||
a!="constructor"in c||a.constructor!=c.constructor)return false;for(var h in a)if(b.has(a,h)){f++;if(!(g=b.has(c,h)&&u(a[h],c[h],d)))break}if(g){for(h in c)if(b.has(c,h)&&!f--)break;g=!f}}d.pop();return g};b.isEqual=function(a,b){return u(a,b,[])};b.isEmpty=function(a){if(a==null)return true;if(b.isArray(a)||b.isString(a))return a.length===0;for(var c in a)if(b.has(a,c))return false;return true};b.isElement=function(a){return!!(a&&a.nodeType==1)};b.isArray=p||function(a){return m.call(a)=="[object Array]"};
|
||||
b.isObject=function(a){return a===Object(a)};i("Arguments,Function,String,Number,Date,RegExp".split(","),function(a){b["is"+a]=function(b){return m.call(b)=="[object "+a+"]"}});b.isArguments(arguments)||(b.isArguments=function(a){return!(!a||!b.has(a,"callee"))});b.isFinite=function(a){return b.isNumber(a)&&isFinite(a)};b.isNaN=function(a){return a!==a};b.isBoolean=function(a){return a===true||a===false||m.call(a)=="[object Boolean]"};b.isNull=function(a){return a===null};b.isUndefined=function(a){return a===
|
||||
void 0};b.has=function(a,b){return O.call(a,b)};b.noConflict=function(){s._=L;return this};b.identity=function(a){return a};b.times=function(a,b,d){for(var e=0;e<a;e++)b.call(d,e)};var Q={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"},R=/[&<>"'\/]/g;b.escape=function(a){return(""+a).replace(R,function(a){return Q[a]})};b.result=function(a,c){if(a==null)return null;var d=a[c];return b.isFunction(d)?d.call(a):d};b.mixin=function(a){i(b.functions(a),function(c){S(c,b[c]=a[c])})};
|
||||
var T=0;b.uniqueId=function(a){var b=T++;return a?a+b:b};b.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var v=/.^/,n={"\\":"\\","'":"'",r:"\r",n:"\n",t:"\t",u2028:"\u2028",u2029:"\u2029"},w;for(w in n)n[n[w]]=w;var U=/\\|'|\r|\n|\t|\u2028|\u2029/g,V=/\\(\\|'|r|n|t|u2028|u2029)/g,x=function(a){return a.replace(V,function(a,b){return n[b]})};b.template=function(a,c,d){d=b.defaults(d||{},b.templateSettings);a="__p+='"+a.replace(U,function(a){return"\\"+
|
||||
n[a]}).replace(d.escape||v,function(a,b){return"'+\n((__t=("+x(b)+"))==null?'':_.escape(__t))+\n'"}).replace(d.interpolate||v,function(a,b){return"'+\n((__t=("+x(b)+"))==null?'':__t)+\n'"}).replace(d.evaluate||v,function(a,b){return"';\n"+x(b)+"\n__p+='"})+"';\n";d.variable||(a="with(obj||{}){\n"+a+"}\n");var a="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'')};\n"+a+"return __p;\n",e=new Function(d.variable||"obj","_",a);if(c)return e(c,b);c=function(a){return e.call(this,
|
||||
a,b)};c.source="function("+(d.variable||"obj")+"){\n"+a+"}";return c};b.chain=function(a){return b(a).chain()};var l=function(a){this._wrapped=a};b.prototype=l.prototype;var y=function(a,c){return c?b(a).chain():a},S=function(a,c){l.prototype[a]=function(){var a=h.call(arguments);N.call(a,this._wrapped);return y(c.apply(b,a),this._chain)}};b.mixin(b);i("pop,push,reverse,shift,sort,splice,unshift".split(","),function(a){var b=k[a];l.prototype[a]=function(){var d=this._wrapped;b.apply(d,arguments);
|
||||
(a=="shift"||a=="splice")&&d.length===0&&delete d[0];return y(d,this._chain)}});i(["concat","join","slice"],function(a){var b=k[a];l.prototype[a]=function(){return y(b.apply(this._wrapped,arguments),this._chain)}});l.prototype.chain=function(){this._chain=true;return this};l.prototype.value=function(){return this._wrapped}}).call(this);
|
||||
|
||||
28
vendor/underscore/underscore.js
vendored
28
vendor/underscore/underscore.js
vendored
@@ -1,6 +1,6 @@
|
||||
// Underscore.js 1.3.3
|
||||
// (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc.
|
||||
// Underscore is freely distributable under the MIT license.
|
||||
// Underscore may be freely distributed under the MIT license.
|
||||
// Portions of Underscore are inspired or borrowed from Prototype,
|
||||
// Oliver Steele's Functional, and John Resig's Micro-Templating.
|
||||
// For all details and documentation:
|
||||
@@ -330,10 +330,9 @@
|
||||
|
||||
// Safely convert anything iterable into a real, live array.
|
||||
_.toArray = function(obj) {
|
||||
if (!obj) return [];
|
||||
if (_.isArray(obj)) return slice.call(obj);
|
||||
if (_.isArguments(obj)) return slice.call(obj);
|
||||
if (obj.toArray && _.isFunction(obj.toArray)) return obj.toArray();
|
||||
if (!obj) return [];
|
||||
if (_.isArray(obj) || _.isArguments(obj)) return slice.call(obj);
|
||||
if (_.isFunction(obj.toArray)) return obj.toArray();
|
||||
return _.values(obj);
|
||||
};
|
||||
|
||||
@@ -699,11 +698,22 @@
|
||||
|
||||
// Return a copy of the object only containing the whitelisted properties.
|
||||
_.pick = function(obj) {
|
||||
var result = {};
|
||||
each(flatten(slice.call(arguments, 1), true, []), function(key) {
|
||||
if (key in obj) result[key] = obj[key];
|
||||
var copy = {};
|
||||
var keys = _.flatten(slice.call(arguments, 1));
|
||||
each(keys, function(key) {
|
||||
if (key in obj) copy[key] = obj[key];
|
||||
});
|
||||
return result;
|
||||
return copy;
|
||||
};
|
||||
|
||||
// Return a copy of the object without the blacklisted properties.
|
||||
_.omit = function(obj) {
|
||||
var copy = {};
|
||||
var keys = _.flatten(slice.call(arguments, 1));
|
||||
for (var key in obj) {
|
||||
if (!_.include(keys, key)) copy[key] = obj[key];
|
||||
}
|
||||
return copy;
|
||||
};
|
||||
|
||||
// Fill in a given object with default properties.
|
||||
|
||||
Reference in New Issue
Block a user