Compare commits

..

1 Commits
1.1.1 ... 1.0.2

Author SHA1 Message Date
jdalton
7467a2a2eb Bump to v1.0.2. 2013-02-18 03:13:40 -07:00
38 changed files with 21489 additions and 23055 deletions

View File

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

260
README.md
View File

@@ -1,195 +1,30 @@
# Lo-Dash <sup>v1.1.1</sup> # Lo-Dash v1.0.2
[![build status](https://secure.travis-ci.org/bestiejs/lodash.png)](http://travis-ci.org/bestiejs/lodash)
A low-level utility library delivering consistency, [customization](https://github.com/bestiejs/lodash#custom-builds), [performance](http://lodash.com/benchmarks), and [extra features](https://github.com/bestiejs/lodash#features). A utility library delivering consistency, [customization](https://lodash.com/custom-builds), [performance](https://lodash.com/benchmarks), & [extras](https://lodash.com/#features).
## Download ## Download
* Lo-Dash builds (for modern environments):<br> * Lo-Dash builds (for modern environments):<br>
[Development](https://raw.github.com/bestiejs/lodash/v1.1.1/dist/lodash.js) and [Development](https://raw.github.com/lodash/lodash/1.0.2/dist/lodash.js) and
[Production](https://raw.github.com/bestiejs/lodash/v1.1.1/dist/lodash.min.js) [Production](https://raw.github.com/lodash/lodash/1.0.2/dist/lodash.min.js)
* Lo-Dash compatibility builds (for legacy and modern environments):<br> * Lo-Dash compatibility builds (for legacy and modern environments):<br>
[Development](https://raw.github.com/bestiejs/lodash/v1.1.1/dist/lodash.compat.js) and [Development](https://raw.github.com/lodash/lodash/1.0.2/dist/lodash.compat.js) and
[Production](https://raw.github.com/bestiejs/lodash/v1.1.1/dist/lodash.compat.min.js) [Production](https://raw.github.com/lodash/lodash/1.0.2/dist/lodash.compat.min.js)
* Underscore compatibility builds:<br> * Underscore compatibility builds:<br>
[Development](https://raw.github.com/bestiejs/lodash/v1.1.1/dist/lodash.underscore.js) and [Development](https://raw.github.com/lodash/lodash/1.0.2/dist/lodash.underscore.js) and
[Production](https://raw.github.com/bestiejs/lodash/v1.1.1/dist/lodash.underscore.min.js) [Production](https://raw.github.com/lodash/lodash/1.0.2/dist/lodash.underscore.min.js)
* CDN copies of ≤ v1.1.1s builds are available on [cdnjs](http://cdnjs.com/) thanks to [CloudFlare](http://www.cloudflare.com/):<br> * For optimal file size, [create a custom build](https://lodash.com/custom-builds) with only the features you need
[Lo-Dash dev](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.1.1/lodash.js),
[Lo-Dash prod](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.1.1/lodash.min.js),<br>
[Lo-Dash compat-dev](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.1.1/lodash.compat.js),
[Lo-Dash compat-prod](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.1.1/lodash.compat.min.js),<br>
[Underscore compat-dev](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.1.1/lodash.underscore.js), and
[Underscore compat-prod](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.1.1/lodash.underscore.min.js)
* For optimal file size, [create a custom build](https://github.com/bestiejs/lodash#custom-builds) with only the features you need
## Dive in ## Dive in
Weve got [API docs](http://lodash.com/docs), [benchmarks](http://lodash.com/benchmarks), and [unit tests](http://lodash.com/tests). Weve got [API docs](https://lodash.com/docs), [benchmarks](https://lodash.com/benchmarks), and [unit tests](https://lodash.com/tests).
For a list of upcoming features, check out our [roadmap](https://github.com/bestiejs/lodash/wiki/Roadmap). For a list of upcoming features, check out our [roadmap](https://github.com/lodash/lodash/wiki/Roadmap).
## Resources The full changelog is available [here](https://github.com/lodash/lodash/wiki/Changelog).
For more information check out these articles, screencasts, and other videos over Lo-Dash:
* Posts
- [Say “Hello” to Lo-Dash](http://kitcambridge.be/blog/say-hello-to-lo-dash/)
* Videos
- [Introducing Lo-Dash](https://vimeo.com/44154599)
- [Lo-Dash optimizations and custom builds](https://vimeo.com/44154601)
- [Lo-Dashs origin and why its a better utility belt](https://vimeo.com/44154600)
- [Unit testing in Lo-Dash](https://vimeo.com/45865290)
- [Lo-Dashs approach to native method use](https://vimeo.com/48576012)
- [CascadiaJS: Lo-Dash for a better utility belt](http://www.youtube.com/watch?v=dpPy4f_SeEk)
## Features
* AMD loader support ([RequireJS](http://requirejs.org/), [curl.js](https://github.com/cujojs/curl), etc.)
* [_(…)](http://lodash.com/docs#_) supports intuitive chaining
* [_.at](http://lodash.com/docs#at) for cherry-picking collection values
* [_.bindKey](http://lodash.com/docs#bindKey) for binding [*“lazy”* defined](http://michaux.ca/articles/lazy-function-definition-pattern) methods
* [_.cloneDeep](http://lodash.com/docs#cloneDeep) for deep cloning arrays and objects
* [_.contains](http://lodash.com/docs#contains) accepts a `fromIndex` argument
* [_.createCallback](http://lodash.com/docs#createCallback) to customize how callback arguments are handled and support callback shorthands in mixins
* [_.findIndex](http://lodash.com/docs#findIndex) and [_.findKey](http://lodash.com/docs#findKey) for finding indexes and keys of collections
* [_.forEach](http://lodash.com/docs#forEach) is chainable and supports exiting iteration early
* [_.forIn](http://lodash.com/docs#forIn) for iterating over an objects own and inherited properties
* [_.forOwn](http://lodash.com/docs#forOwn) for iterating over an objects own properties
* [_.isPlainObject](http://lodash.com/docs#isPlainObject) checks if values are created by the `Object` constructor
* [_.merge](http://lodash.com/docs#merge) for a deep [_.extend](http://lodash.com/docs#extend)
* [_.parseInt](http://lodash.com/docs#parseInt) for consistent cross-environment behavior
* [_.partial](http://lodash.com/docs#partial) and [_.partialRight](http://lodash.com/docs#partialRight) for partial application without `this` binding
* [_.runInContext](http://lodash.com/docs#runInContext) for easier mocking and extended environment support
* [_.support](http://lodash.com/docs#support) to flag environment features
* [_.template](http://lodash.com/docs#template) supports [*“imports”* options](http://lodash.com/docs#templateSettings_imports), [ES6 template delimiters](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-7.8.6), and [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
* [_.where](http://lodash.com/docs#where) supports deep object comparisons
* [_.clone](http://lodash.com/docs#clone), [_.omit](http://lodash.com/docs#omit), [_.pick](http://lodash.com/docs#pick),
[and more…](http://lodash.com/docs "_.assign, _.cloneDeep, _.first, _.initial, _.isEqual, _.last, _.merge, _.rest") accept `callback` and `thisArg` arguments
* [_.contains](http://lodash.com/docs#contains), [_.size](http://lodash.com/docs#size), [_.toArray](http://lodash.com/docs#toArray),
[and more…](http://lodash.com/docs "_.at, _.countBy, _.every, _.filter, _.find, _.forEach, _.groupBy, _.invoke, _.map, _.max, _.min, _.pluck, _.reduce, _.reduceRight, _.reject, _.shuffle, _.some, _.sortBy, _.where") accept strings
* [_.filter](http://lodash.com/docs#filter), [_.find](http://lodash.com/docs#find), [_.map](http://lodash.com/docs#map),
[and more…](http://lodash.com/docs "_.countBy, _.every, _.first, _.groupBy, _.initial, _.last, _.max, _.min, _.reject, _.rest, _.some, _.sortBy, _.sortedIndex, _.uniq") support *“_.pluck”* and *“_.where”* `callback` shorthands
## Support
Lo-Dash has been tested in at least Chrome 5~25, Firefox 2~19, IE 6-10, Opera 9.25-12, Safari 3-6, Node.js 0.4.8-0.10.1, Narwhal 0.3.2, PhantomJS 1.8.1, RingoJS 0.9, and Rhino 1.7RC5.
## Custom builds
Custom builds make it easy to create lightweight versions of Lo-Dash containing only the methods you need.
To top it off, we handle all method dependency and alias mapping for you.
* Backbone builds, with only methods required by Backbone, may be created using the `backbone` modifier argument.
```bash
lodash backbone
```
* CSP builds, supporting default [Content Security Policy](https://dvcs.w3.org/hg/content-security-policy/raw-file/tip/csp-specification.dev.html) restrictions, may be created using the `csp` modifier argument.
The `csp` modifier is an alias of the `mobile` modifier. Lo-Dash may be used in Chrome extensions by using either the `csp`, `mobile`, or `underscore` build and using precompiled templates, or loading Lo-Dash in a [sandbox](http://developer.chrome.com/stable/extensions/sandboxingEval.html).
```bash
lodash csp
```
* Legacy builds, tailored for older environments without [ES5 support](http://es5.github.com/), may be created using the `legacy` modifier argument.
```bash
lodash legacy
```
* Modern builds, tailored for newer environments with ES5 support, may be created using the `modern` modifier argument.
```bash
lodash modern
```
* Mobile builds, without method compilation and most bug fixes for old browsers, may be created using the `mobile` modifier argument.
```bash
lodash mobile
```
* Strict builds, with `_.bindAll`, `_.defaults`, and `_.extend` in [strict mode](http://es5.github.com/#C), may be created using the `strict` modifier argument.
```bash
lodash strict
```
* Underscore builds, tailored for projects already using Underscore, may be created using the `underscore` modifier argument.
```bash
lodash underscore
```
Custom builds may be created using the following commands:
* Use the `category` argument to pass comma separated categories of methods to include in the build.<br>
Valid categories (case-insensitive) are *“arrays”*, *“chaining”*, *“collections”*, *“functions”*, *“objects”*, and *“utilities”*.
```bash
lodash category=collections,functions
lodash category="collections, functions"
```
* Use the `exports` argument to pass comma separated names of ways to export the `LoDash` function.<br>
Valid exports are *“amd”*, *“commonjs”*, *“global”*, *“node”*, and *“none”*.
```bash
lodash exports=amd,commonjs,node
lodash exports="amd, commonjs, node"
```
* Use the `iife` argument to specify code to replace the immediately-invoked function expression that wraps Lo-Dash.
```bash
lodash iife="!function(window,undefined){%output%}(this)"
```
* Use the `include` argument to pass comma separated method/category names to include in the build.
```bash
lodash include=each,filter,map
lodash include="each, filter, map"
```
* Use the `minus` argument to pass comma separated method/category names to remove from those included in the build.
```bash
lodash underscore minus=result,shuffle
lodash underscore minus="result, shuffle"
```
* Use the `plus` argument to pass comma separated method/category names to add to those included in the build.
```bash
lodash backbone plus=random,template
lodash backbone plus="random, template"
```
* Use the `template` argument to pass the file path pattern used to match template files to precompile.
```bash
lodash template="./*.jst"
```
* Use the `settings` argument to pass the template settings used when precompiling templates.
```bash
lodash settings="{interpolate:/\{\{([\s\S]+?)\}\}/g}"
```
* Use the `moduleId` argument to specify the AMD module ID of Lo-Dash, which defaults to “lodash”, used by precompiled templates.
```bash
lodash moduleId="underscore"
```
All arguments, except `legacy` with `csp`, `mobile`, `modern`, or `underscore`, may be combined.<br>
Unless specified by `-o` or `--output`, all files created are saved to the current working directory.
The following options are also supported:
* `-c`, `--stdout` ......... Write output to standard output
* `-d`, `--debug` ........... Write only the non-minified development output
* `-h`, `--help` ............. Display help information
* `-m`, `--minify` ......... Write only the minified production output
* `-o`, `--output` ......... Write output to a given path/filename
* `-p`, `--source-map` .. Generate a source map for the minified output, using an optional source map URL
* `-s`, `--silent` ......... Skip status updates normally logged to the console
* `-V`, `--version` ....... Output current version of Lo-Dash
The `lodash` command-line utility is available when Lo-Dash is installed as a global package (i.e. `npm install -g lodash`).
## Installation and usage ## Installation and usage
@@ -214,18 +49,18 @@ To avoid potential issues, update `npm` before installing Lo-Dash:
npm install npm -g npm install npm -g
``` ```
In [Node.js](http://nodejs.org/) and [RingoJS v0.8.0](http://ringojs.org/): In [Node.js](http://nodejs.org/) and [RingoJS v0.8.0+](http://ringojs.org/):
```js ```js
var _ = require('lodash'); var _ = require('lodash');
// or as a drop-in replacement for Underscore // or as a drop-in replacement for Underscore
var _ = require('lodash/dist/lodash.underscore'); var _ = require('lodash/lodash.underscore');
``` ```
**Note:** If Lo-Dash is installed globally, run [`npm link lodash`](http://blog.nodejs.org/2011/03/23/npm-1-0-global-vs-local-installation/) in your projects root directory before requiring it. **Note:** If Lo-Dash is installed globally, run [`npm link lodash`](http://blog.nodejs.org/2011/03/23/npm-1-0-global-vs-local-installation/) in your projects root directory before requiring it.
In [RingoJS v0.7.0](http://ringojs.org/): In [RingoJS v0.7.0-](http://ringojs.org/):
```js ```js
var _ = require('lodash')._; var _ = require('lodash')._;
@@ -250,41 +85,44 @@ require({
}); });
``` ```
## Release Notes ## Resources
### <sup>v1.1.1</sup> For more information check out these articles, screencasts, and other videos over Lo-Dash:
* Ensured the `underscore` build version of `_.forEach` accepts a `thisArg` argument * Posts
* Updated vendor/tar to work with Node v0.10.x - [Say “Hello” to Lo-Dash](http://kitcambridge.be/blog/say-hello-to-lo-dash/)
### <sup>v1.1.0</sup> * Videos
- [Introducing Lo-Dash](https://vimeo.com/44154599)
- [Lo-Dash optimizations and custom builds](https://vimeo.com/44154601)
- [Lo-Dashs origin and why its a better utility belt](https://vimeo.com/44154600)
- [Unit testing in Lo-Dash](https://vimeo.com/45865290)
- [Lo-Dashs approach to native method use](https://vimeo.com/48576012)
- [CascadiaJS: Lo-Dash for a better utility belt](http://www.youtube.com/watch?v=dpPy4f_SeEk)
* Added `rhino -require` support ## Features
* Added `_.createCallback`, `_findIndex`, `_.findKey`, `_.parseInt`, `_.runInContext`, and `_.support`
* Added support for `callback` and `thisArg` arguments to `_.flatten`
* Added CommonJS/Node support to precompiled templates
* Ensured the `exports` object is not a DOM element
* Ensured `_.isPlainObject` returns `false` for objects without a `[[Class]]` of “Object”
* Made `_.cloneDeep`s `callback` support more closely follow its documentation
* Made the template precompiler create nonexistent directories of `--output` paths
* Made `_.object` an alias of `_.zipObject`
* Optimized method chaining, object iteration, `_.find`, and `_.pluck` (an average of 18% overall better performance)
* Updated `backbone` build Lo-Dash method dependencies
The full changelog is available [here](https://github.com/bestiejs/lodash/wiki/Changelog). * AMD loader support ([RequireJS](http://requirejs.org/), [curl.js](https://github.com/cujojs/curl), etc.)
* [_(…)](https://lodash.com/docs#_) supports intuitive chaining
* [_.at](https://lodash.com/docs#at) for cherry-picking collection values
* [_.bindKey](https://lodash.com/docs#bindKey) for binding [*“lazy”* defined](http://michaux.ca/articles/lazy-function-definition-pattern) methods
* [_.cloneDeep](https://lodash.com/docs#cloneDeep) for deep cloning arrays and objects
* [_.contains](https://lodash.com/docs#contains) accepts a `fromIndex` argument
* [_.forEach](https://lodash.com/docs#forEach) is chainable and supports exiting iteration early
* [_.forIn](https://lodash.com/docs#forIn) for iterating over an objects own and inherited properties
* [_.forOwn](https://lodash.com/docs#forOwn) for iterating over an objects own properties
* [_.isPlainObject](https://lodash.com/docs#isPlainObject) checks if values are created by the `Object` constructor
* [_.merge](https://lodash.com/docs#merge) for a deep [_.extend](https://lodash.com/docs#extend)
* [_.partial](https://lodash.com/docs#partial) and [_.partialRight](https://lodash.com/docs#partialRight) for partial application without `this` binding
* [_.template](https://lodash.com/docs#template) supports [*“imports”* options](https://lodash.com/docs#templateSettings_imports), [ES6 template delimiters](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-7.8.6), and [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
* [_.where](https://lodash.com/docs#where) supports deep object comparisons
* [_.clone](https://lodash.com/docs#clone), [_.omit](https://lodash.com/docs#omit), [_.pick](https://lodash.com/docs#pick),
[and more…](https://lodash.com/docs "_.assign, _.cloneDeep, _.first, _.initial, _.isEqual, _.last, _.merge, _.rest") accept `callback` and `thisArg` arguments
* [_.contains](https://lodash.com/docs#contains), [_.size](https://lodash.com/docs#size), [_.toArray](https://lodash.com/docs#toArray),
[and more…](https://lodash.com/docs "_.at, _.countBy, _.every, _.filter, _.find, _.forEach, _.groupBy, _.invoke, _.map, _.max, _.min, _.pluck, _.reduce, _.reduceRight, _.reject, _.shuffle, _.some, _.sortBy, _.where") accept strings
* [_.filter](https://lodash.com/docs#filter), [_.find](https://lodash.com/docs#find), [_.map](https://lodash.com/docs#map),
[and more…](https://lodash.com/docs "_.countBy, _.every, _.first, _.groupBy, _.initial, _.last, _.max, _.min, _.reject, _.rest, _.some, _.sortBy, _.sortedIndex, _.uniq") support *“_.pluck”* and *“_.where”* `callback` shorthands
## BestieJS ## Support
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 has been tested in at least Chrome 5~24, Firefox 1~18, IE 6-10, Opera 9.25-12, Safari 3-6, Node.js 0.4.8-0.8.20, Narwhal 0.3.2, PhantomJS 1.8.1, RingoJS 0.9, and Rhino 1.7RC5.
## Author
* [John-David Dalton](http://allyoucanleet.com/)
[![twitter/jdalton](http://gravatar.com/avatar/299a3d891ff1920b69c364d061007043?s=70)](https://twitter.com/jdalton "Follow @jdalton on Twitter")
## Contributors
* [Kit Cambridge](http://kitcambridge.github.com/)
[![twitter/kitcambridge](http://gravatar.com/avatar/6662a1d02f351b5ef2f8b4d815804661?s=70)](https://twitter.com/kitcambridge "Follow @kitcambridge on Twitter")
* [Mathias Bynens](http://mathiasbynens.be/)
[![twitter/mathias](http://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](https://twitter.com/mathias "Follow @mathias on Twitter")

2007
build.js

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

@@ -2,7 +2,7 @@
;(function() { ;(function() {
'use strict'; 'use strict';
/** The Node.js filesystem module */ /** The Node filesystem module */
var fs = require('fs'); var fs = require('fs');
/** The minimal license/copyright template */ /** The minimal license/copyright template */
@@ -30,11 +30,7 @@
// correct overly aggressive Closure Compiler advanced optimizations // correct overly aggressive Closure Compiler advanced optimizations
source = source source = source
.replace(/prototype\s*=\s*{\s*valueOf\s*:\s*1\s*}/, 'prototype={valueOf:1,y:1}') .replace(/prototype\s*=\s*{\s*valueOf\s*:\s*1\s*}/, 'prototype={valueOf:1,y:1}')
.replace(/(document[^&]+&&)\s*(?:\w+|!\d)/, '$1!({toString:0}+"")') .replace(/(document[^&]+&&)\s*(?:\w+|!\d)/, '$1!({toString:0}+"")');
source = source.replace(/(\w+\.prototype\s*=\s*)\w+(?=\.prototype;)/, function(match, left) {
return left + /\w+(?=\.VERSION)/.exec(source);
});
// flip `typeof` expressions to help optimize Safari and // flip `typeof` expressions to help optimize Safari and
// correct the AMD module definition for AMD build optimizers // correct the AMD module definition for AMD build optimizers

View File

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

9838
dist/lodash.compat.js vendored

File diff suppressed because it is too large Load Diff

View File

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

9622
dist/lodash.js vendored

File diff suppressed because it is too large Load Diff

73
dist/lodash.min.js vendored
View File

@@ -1,42 +1,41 @@
/** /**
* @license * @license
* Lo-Dash 1.1.1 (Custom Build) lodash.com/license * Lo-Dash 1.0.2 (Custom Build) lodash.com/license
* Build: `lodash modern -o ./dist/lodash.js` * Build: `lodash modern -o ./dist/lodash.js`
* Underscore.js 1.4.4 underscorejs.org/LICENSE * Underscore.js 1.4.4 underscorejs.org/LICENSE
*/ */
;(function(n){function t(r){function a(n){return n&&typeof n=="object"&&!ae(n)&&Ut.call(n,"__wrapped__")?n:new z(n)}function $(n,t,e){var r=n.length,u=r-t>=e;if(u){var a={};for(e=t-1;++e<r;){var o=$t(n[e]);(Ut.call(a,o)?a[o]:a[o]=[]).push(n[e])}}return function(e){if(u){var r=$t(e);return Ut.call(a,r)&&-1<gt(a[r],e)}return-1<gt(n,e,t)}}function q(n){return n.charCodeAt(0)}function B(n,t){var e=n.b,r=t.b;if(n=n.a,t=t.a,n!==t){if(n>t||typeof n=="undefined")return 1;if(n<t||typeof t=="undefined")return-1 ;(function(n,r){function t(n){return n&&"object"==typeof n&&n.__wrapped__?n:this instanceof t?(this.__wrapped__=n,r):new t(n)}function e(n,r,t){r||(r=0);var e=n.length,u=e-r>=(t||ut);if(u)for(var a={},o=r-1;++o<e;){var i=n[o]+"";(wt.call(a,i)?a[i]:a[i]=[]).push(n[o])}return function(t){if(u){var e=t+"";return wt.call(a,e)&&sr(a[e],t)>-1}return sr(n,t,r)>-1}}function u(n){return n.charCodeAt(0)}function a(n,r){var t=n.index,e=r.index;if(n=n.criteria,r=r.criteria,n!==r){if(n>r||"undefined"==typeof n)return 1;
}return e<r?-1:1}function F(n,t,e,r){function u(){var r=arguments,c=o?this:t;return a||(n=t[i]),e.length&&(r=r.length?(r=M(r),f?r.concat(e):e.concat(r)):e),this instanceof u?(P.prototype=n.prototype,c=new P,P.prototype=null,r=n.apply(c,r),W(r)?r:c):n.apply(c,r)}var a=Q(n),o=!e,i=t;if(o){var f=r;e=t}else if(!a){if(!r)throw new qt;t=n}return u}function R(){for(var n,t={b:"k(m)",c:"",e:"m",f:"",h:"",i:!0,j:!!oe},e=0;n=arguments[e];e++)for(var r in n)t[r]=n[r];return n=t.a,t.d=/^[^,]+/.exec(n)[0],e=Nt,r="var i,m="+t.d+",u="+t.e+";if(!m)return u;"+t.h+";",t.b&&(r+="var n=m.length;i=-1;if("+t.b+"){while(++i<n){"+t.f+"}}else{"),t.i&&t.j?r+="var s=-1,t=r[typeof m]?o(m):[],n=t.length;while(++s<n){i=t[s];"+t.f+"}":(r+="for(i in m){",t.i&&(r+="if(",t.i&&(r+="h.call(m,i)"),r+="){"),r+=t.f+";",t.i&&(r+="}"),r+="}"),t.b&&(r+="}"),r+=t.c+";return u",e("h,j,k,l,o,p,r","return function("+n+"){"+r+"}")(Ut,V,ae,Y,oe,a,I) if(n<r||"undefined"==typeof r)return-1}return t<e?-1:1}function o(n,r,t,e){function u(){var f=arguments,l=o?this:r;if(a||(n=r[i]),t.length&&(f=f.length?(f=p(f),e?f.concat(t):t.concat(f)):t),this instanceof u){s.prototype=n.prototype,l=new s,s.prototype=null;var c=n.apply(l,f);return S(c)?c:l}return n.apply(l,f)}var a=E(n),o=!t,i=r;return o&&(t=r),a||(r=n),u}function i(n,r,t){if(null==n)return Br;var e=typeof n;if("function"!=e){if("object"!=e)return function(r){return r[n]};var u=ue(n);return function(r){for(var t=u.length,e=!1;t--&&(e=O(r[u[t]],n[u[t]],et)););return e
}function T(n){return"\\"+S[n]}function D(n){return ie[n]}function z(n){this.__wrapped__=n}function P(){}function K(n){var t=!1;if(!n||Jt.call(n)!=x)return t;var e=n.constructor;return(Q(e)?e instanceof e:ue.nodeClass||!isNode(n))?(pe(n,function(n,e){t=e}),!1===t||Ut.call(n,t)):t}function M(n,t,e){t||(t=0),typeof e=="undefined"&&(e=n?n.length:0);var r=-1;e=e-t||0;for(var u=Ct(0>e?0:e);++r<e;)u[r]=n[t+r];return u}function U(n){return fe[n]}function V(n){return Jt.call(n)==_}function G(n,t,r,u,o,i){var f=n; }}return"undefined"!=typeof r?1===t?function(t){return n.call(r,t)}:2===t?function(t,e){return n.call(r,t,e)}:4===t?function(t,e,u,a){return n.call(r,t,e,u,a)}:function(t,e,u){return n.call(r,t,e,u)}:n}function f(){for(var n,r={isKeysFast:Ut,arrays:"isArray(iterable)",bottom:"",loop:"",top:"",useHas:!0},t=0;n=arguments[t];t++)for(var e in n)r[e]=n[e];var u=r.args;r.firstArg=/^[^,]+/.exec(u)[0];var a=Function("createCallback, hasOwnProperty, isArguments, isArray, isString, objectTypes, nativeKeys","return function("+u+") {\n"+Wt(r)+"\n}");
if(typeof t=="function"&&(u=r,r=t,t=!1),typeof r=="function"){if(r=typeof u=="undefined"?r:a.createCallback(r,u,1),f=r(f),typeof f!="undefined")return f;f=n}if(u=W(f)){var c=Jt.call(f);if(!E[c])return f;var l=ae(f)}if(!u||!t)return u?l?M(f):ce({},f):f;switch(u=re[c],c){case w:case j:return new u(+f);case C:case N:return new u(f);case O:return u(f.source,v.exec(f))}for(o||(o=[]),i||(i=[]),c=o.length;c--;)if(o[c]==n)return i[c];return f=l?u(f.length):{},l&&(Ut.call(n,"index")&&(f.index=n.index),Ut.call(n,"input")&&(f.input=n.input)),o.push(n),i.push(f),(l?at:se)(n,function(n,u){f[u]=G(n,t,r,e,o,i) return a(i,wt,v,ee,N,Jt,St)}function l(n){return"\\"+Qt[n]}function c(n){return ae[n]}function s(){}function p(n,r,t){r||(r=0),"undefined"==typeof t&&(t=n?n.length:0);for(var e=-1,u=t-r||0,a=Array(u<0?0:u);++e<u;)a[e]=n[r+e];return a}function g(n){return oe[n]}function v(n){return At.call(n)==Ft}function y(n){var r=!1;if(!n||"object"!=typeof n||v(n))return r;var t=n.constructor;return!E(t)||t instanceof t?(re(n,function(n,t){r=t}),r===!1||wt.call(n,r)):r}function h(n){var r=[];return te(n,function(n,t){r.push(t)
}),f}function H(n){var t=[];return pe(n,function(n,e){Q(n)&&t.push(e)}),t.sort()}function J(n){for(var t=-1,e=oe(n),r=e.length,u={};++t<r;){var a=e[t];u[n[a]]=a}return u}function L(n,t,e,r,u,o){var f=e===i;if(e&&!f){e=typeof r=="undefined"?e:a.createCallback(e,r,2);var c=e(n,t);if(typeof c!="undefined")return!!c}if(n===t)return 0!==n||1/n==1/t;var l=typeof n,p=typeof t;if(n===n&&(!n||"function"!=l&&"object"!=l)&&(!t||"function"!=p&&"object"!=p))return!1;if(null==n||null==t)return n===t;if(p=Jt.call(n),l=Jt.call(t),p==_&&(p=x),l==_&&(l=x),p!=l)return!1; }),r}function d(n,t,e,u,a,o){var f=n;if("function"==typeof t&&(u=e,e=t,t=!1),"function"==typeof e){e="undefined"==typeof u?e:i(e,u,1),f=e(f);var l="undefined"!=typeof f;l||(f=n)}var c=S(f);if(c){var s=At.call(f);if(!Vt[s])return f;var g=ee(f)}if(!c||!t)return c&&!l?g?p(f):ie({},f):f;var v=Gt[s];switch(s){case $t:case Pt:return l?f:new v(+f);case qt:case Ct:return l?f:new v(f);case Ht:return l?f:v(f.source,ct.exec(f))}a||(a=[]),o||(o=[]);for(var y=a.length;y--;)if(a[y]==n)return o[y];return l||(f=g?v(f.length):{},g&&(wt.call(n,"index")&&(f.index=n.index),wt.call(n,"input")&&(f.input=n.input))),a.push(n),o.push(f),(g?G:te)(l?f:n,function(n,u){f[u]=d(n,t,e,r,a,o)
switch(p){case w:case j:return+n==+t;case C:return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case O:case N:return n==$t(t)}if(l=p==k,!l){if(Ut.call(n,"__wrapped__")||Ut.call(t,"__wrapped__"))return L(n.__wrapped__||n,t.__wrapped__||t,e,r,u,o);if(p!=x)return!1;var p=n.constructor,s=t.constructor;if(p!=s&&(!Q(p)||!(p instanceof p&&Q(s)&&s instanceof s)))return!1}for(u||(u=[]),o||(o=[]),p=u.length;p--;)if(u[p]==n)return o[p]==t;var v=0,c=!0;if(u.push(n),o.push(t),l){if(p=n.length,v=t.length,c=v==n.length,!c&&!f)return c; }),f}function m(n,r,t){return d(n,!0,r,t)}function b(n){var r=[];return re(n,function(n,t){E(n)&&r.push(t)}),r.sort()}function _(n,r){return n?wt.call(n,r):!1}function x(n){for(var r=-1,t=ue(n),e=t.length,u={};++r<e;){var a=t[r];u[n[a]]=a}return u}function w(n){return n===!0||n===!1||At.call(n)==$t}function j(n){return n instanceof Date||At.call(n)==Pt}function A(n){return n?1===n.nodeType:!1}function k(n){var r=!0;if(!n)return r;var t=At.call(n),e=n.length;return t==Nt||t==Ct||t==Ft||t==Bt&&"number"==typeof e&&E(n.splice)?!e:(te(n,function(){return r=!1
for(;v--;)if(l=p,s=t[v],f)for(;l--&&!(c=L(n[l],s,e,r,u,o)););else if(!(c=L(n[v],s,e,r,u,o)))break;return c}return pe(t,function(t,a,i){return Ut.call(i,a)?(v++,c=Ut.call(n,a)&&L(n[a],t,e,r,u,o)):void 0}),c&&!f&&pe(n,function(n,t,e){return Ut.call(e,t)?c=-1<--v:void 0}),c}function Q(n){return typeof n=="function"}function W(n){return n?I[typeof n]:!1}function X(n){return typeof n=="number"||Jt.call(n)==C}function Y(n){return typeof n=="string"||Jt.call(n)==N}function Z(n,t,e){var r=arguments,u=0,o=2; }),r)}function O(n,t,e,u,a,o){var f=e===et;if(e&&!f){e="undefined"==typeof u?e:i(e,u,2);var l=e(n,t);if("undefined"!=typeof l)return!!l}if(n===t)return 0!==n||1/n==1/t;var c=typeof n,s=typeof t;if(n===n&&(!n||"function"!=c&&"object"!=c)&&(!t||"function"!=s&&"object"!=s))return!1;if(null==n||null==t)return n===t;var p=At.call(n),g=At.call(t);if(p==Ft&&(p=Bt),g==Ft&&(g=Bt),p!=g)return!1;switch(p){case $t:case Pt:return+n==+t;case qt:return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case Ht:case Ct:return n==t+""
if(!W(n))return n;if(e===i)var f=r[3],c=r[4],l=r[5];else c=[],l=[],typeof e!="number"&&(o=r.length),3<o&&"function"==typeof r[o-2]?f=a.createCallback(r[--o-1],r[o--],2):2<o&&"function"==typeof r[o-1]&&(f=r[--o]);for(;++u<o;)(ae(r[u])?at:se)(r[u],function(t,e){var r,u,a=t,o=n[e];if(t&&((u=ae(t))||ve(t))){for(a=c.length;a--;)if(r=c[a]==t){o=l[a];break}r||(o=u?ae(o)?o:[]:ve(o)?o:{},f&&(a=f(o,t),typeof a!="undefined"&&(o=a)),c.push(t),l.push(o),f||(o=Z(o,t,i,f,c,l)))}else f&&(a=f(o,t),typeof a=="undefined"&&(a=t)),typeof a!="undefined"&&(o=a); }var v=p==Nt;if(!v){if(n.__wrapped__||t.__wrapped__)return O(n.__wrapped__||n,t.__wrapped__||t,e,u,a,o);if(p!=Bt)return!1;var y=n.constructor,h=t.constructor;if(y!=h&&!(E(y)&&y instanceof y&&E(h)&&h instanceof h))return!1}a||(a=[]),o||(o=[]);for(var d=a.length;d--;)if(a[d]==n)return o[d]==t;var m=0;if(l=!0,a.push(n),o.push(t),v){if(d=n.length,m=t.length,l=m==n.length,!l&&!f)return l;for(;m--;){var b=d,_=t[m];if(f)for(;b--&&!(l=O(n[b],_,e,u,a,o)););else if(!(l=O(n[m],_,e,u,a,o)))break}return l}return re(t,function(t,i,f){return wt.call(f,i)?(m++,l=wt.call(n,i)&&O(n[i],t,e,u,a,o)):r
n[e]=o});return n}function nt(n){for(var t=-1,e=oe(n),r=e.length,u=Ct(r);++t<r;)u[t]=n[e[t]];return u}function tt(n,t,e){var r=-1,u=n?n.length:0,a=!1;return e=(0>e?Zt(0,u+e):e)||0,typeof u=="number"?a=-1<(Y(n)?n.indexOf(t,e):gt(n,t,e)):se(n,function(n){return++r<e?void 0:!(a=n===t)}),a}function et(n,t,e){var r=!0;t=a.createCallback(t,e),e=-1;var u=n?n.length:0;if(typeof u=="number")for(;++e<u&&(r=!!t(n[e],e,n)););else se(n,function(n,e,u){return r=!!t(n,e,u)});return r}function rt(n,t,e){var r=[]; }),l&&!f&&re(n,function(n,t,e){return wt.call(e,t)?l=--m>-1:r}),l}function I(n){return It(n)&&!Et(parseFloat(n))}function E(n){return"function"==typeof n}function S(n){return n?Jt[typeof n]:!1}function L(n){return T(n)&&n!=+n}function R(n){return null===n}function T(n){return"number"==typeof n||At.call(n)==qt}function F(n){return n instanceof RegExp||At.call(n)==Ht}function N(n){return"string"==typeof n||At.call(n)==Ct}function $(n){return"undefined"==typeof n}function P(n,r,t){var e=arguments,u=0,a=2;
t=a.createCallback(t,e),e=-1;var u=n?n.length:0;if(typeof u=="number")for(;++e<u;){var o=n[e];t(o,e,n)&&r.push(o)}else se(n,function(n,e,u){t(n,e,u)&&r.push(n)});return r}function ut(n,t,e){t=a.createCallback(t,e),e=-1;var r=n?n.length:0;if(typeof r!="number"){var u;return se(n,function(n,e,r){return t(n,e,r)?(u=n,!1):void 0}),u}for(;++e<r;){var o=n[e];if(t(o,e,n))return o}}function at(n,t,e){var r=-1,u=n?n.length:0;if(t=t&&typeof e=="undefined"?t:a.createCallback(t,e),typeof u=="number")for(;++r<u&&!1!==t(n[r],r,n););else se(n,t); if(!S(n))return n;if(t===et)var o=e[3],f=e[4],l=e[5];else f=[],l=[],"number"!=typeof t&&(a=e.length),a>3&&"function"==typeof e[a-2]?o=i(e[--a-1],e[a--],2):a>2&&"function"==typeof e[a-1]&&(o=e[--a]);for(;++u<a;)(ee(e[u])?G:te)(e[u],function(r,t){var e,u,a=r,i=n[t];if(r&&((u=ee(r))||le(r))){for(var c=f.length;c--;)if(e=f[c]==r){i=l[c];break}e||(i=u?ee(i)?i:[]:le(i)?i:{},o&&(a=o(i,r),"undefined"!=typeof a&&(i=a)),f.push(r),l.push(i),o||(i=P(i,r,et,o,f,l)))}else o&&(a=o(i,r),"undefined"==typeof a&&(a=r)),"undefined"!=typeof a&&(i=a);
return n}function ot(n,t,e){var r=-1,u=n?n.length:0;if(t=a.createCallback(t,e),typeof u=="number")for(var o=Ct(u);++r<u;)o[r]=t(n[r],r,n);else o=[],se(n,function(n,e,u){o[++r]=t(n,e,u)});return o}function it(n,t,e){var r=-1/0,u=r;if(!t&&ae(n)){e=-1;for(var o=n.length;++e<o;){var i=n[e];i>u&&(u=i)}}else t=!t&&Y(n)?q:a.createCallback(t,e),at(n,function(n,e,a){e=t(n,e,a),e>r&&(r=e,u=n)});return u}function ft(n,t){var e=-1,r=n?n.length:0;if(typeof r=="number")for(var u=Ct(r);++e<r;)u[e]=n[e][t];return u||ot(n,t) n[t]=i});return n}function D(n,r,t){var e="function"==typeof r,u={};if(e)r=i(r,t);else var a=bt.apply(nt,arguments);return re(n,function(n,t,o){(e?!r(n,t,o):sr(a,t,1)<0)&&(u[t]=n)}),u}function q(n){for(var r=-1,t=ue(n),e=t.length,u=Array(e);++r<e;){var a=t[r];u[r]=[a,n[a]]}return u}function B(n,r,t){var e={};if("function"!=typeof r)for(var u=0,a=bt.apply(nt,arguments),o=S(n)?a.length:0;++u<o;){var f=a[u];f in n&&(e[f]=n[f])}else r=i(r,t),re(n,function(n,t,u){r(n,t,u)&&(e[t]=n)});return e}function H(n){for(var r=-1,t=ue(n),e=t.length,u=Array(e);++r<e;)u[r]=n[t[r]];
}function ct(n,t,e,r){if(!n)return e;var u=3>arguments.length;t=a.createCallback(t,r,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(e=n[++o]);++o<i;)e=t(e,n[o],o,n);else se(n,function(n,r,a){e=u?(u=!1,n):t(e,n,r,a)});return e}function lt(n,t,e,r){var u=n?n.length:0,o=3>arguments.length;if(typeof u!="number")var i=oe(n),u=i.length;return t=a.createCallback(t,r,4),at(n,function(r,a,f){a=i?i[--u]:--u,e=o?(o=!1,n[a]):t(e,n[a],a,f)}),e}function pt(n,t,e){var r;t=a.createCallback(t,e),e=-1;var u=n?n.length:0; return u}function C(n){for(var r=-1,t=bt.apply(nt,p(arguments,1)),e=t.length,u=Array(e);++r<e;)u[r]=n[t[r]];return u}function K(n,t,e){var u=-1,a=n?n.length:0,o=!1;return e=(e<0?Lt(0,a+e):e)||0,"number"==typeof a?o=(N(n)?n.indexOf(t,e):sr(n,t,e))>-1:ne(n,function(n){return++u<e?r:!(o=n===t)}),o}function M(n,r,t){var e={};return r=i(r,t),G(n,function(n,t,u){t=r(n,t,u)+"",wt.call(e,t)?e[t]++:e[t]=1}),e}function z(n,r,t){var e=!0;if(r=i(r,t),ee(n))for(var u=-1,a=n.length;++u<a&&(e=!!r(n[u],u,n)););else ne(n,function(n,t,u){return e=!!r(n,t,u)
if(typeof u=="number")for(;++e<u&&!(r=t(n[e],e,n)););else se(n,function(n,e,u){return!(r=t(n,e,u))});return!!r}function st(n,t,e){if(n){var r=0,u=n.length;if(typeof t!="number"&&null!=t){var o=-1;for(t=a.createCallback(t,e);++o<u&&t(n[o],o,n);)r++}else if(r=t,null==r||e)return n[0];return M(n,0,ne(Zt(0,r),u))}}function vt(n,t,e,r){var u=-1,o=n?n.length:0,i=[];for(typeof t!="boolean"&&null!=t&&(r=e,e=t,t=!1),null!=e&&(e=a.createCallback(e,r));++u<o;)r=n[u],e&&(r=e(r,u,n)),ae(r)?Vt.apply(i,t?r:vt(r)):i.push(r); });return e}function U(n,r,t){var e=[];if(r=i(r,t),ee(n))for(var u=-1,a=n.length;++u<a;){var o=n[u];r(o,u,n)&&e.push(o)}else ne(n,function(n,t,u){r(n,t,u)&&e.push(n)});return e}function V(n,t,e){var u;return t=i(t,e),G(n,function(n,e,a){return t(n,e,a)?(u=n,!1):r}),u}function G(n,r,t){if(r&&"undefined"==typeof t&&ee(n))for(var e=-1,u=n.length;++e<u&&r(n[e],e,n)!==!1;);else ne(n,r,t);return n}function J(n,r,t){var e={};return r=i(r,t),G(n,function(n,t,u){t=r(n,t,u)+"",(wt.call(e,t)?e[t]:e[t]=[]).push(n)
return i}function gt(n,t,e){var r=-1,u=n?n.length:0;if(typeof e=="number")r=(0>e?Zt(0,u+e):e||0)-1;else if(e)return r=yt(n,t),n[r]===t?r:-1;for(;++r<u;)if(n[r]===t)return r;return-1}function ht(n,t,e){if(typeof t!="number"&&null!=t){var r=0,u=-1,o=n?n.length:0;for(t=a.createCallback(t,e);++u<o&&t(n[u],u,n);)r++}else r=null==t||e?1:Zt(0,t);return M(n,r)}function yt(n,t,e,r){var u=0,o=n?n.length:u;for(e=e?a.createCallback(e,r,1):kt,t=e(t);u<o;)r=u+o>>>1,e(n[r])<t?u=r+1:o=r;return u}function mt(n,t,e,r){var u=-1,o=n?n.length:0,i=[],f=i; }),e}function Q(n,r){var t=p(arguments,2),e=-1,u="function"==typeof r,a=n?n.length:0,o=Array("number"==typeof a?a:0);return G(n,function(n){o[++e]=(u?r:n[r]).apply(n,t)}),o}function W(n,r,t){var e=-1,u=n?n.length:0,a=Array("number"==typeof u?u:0);if(r=i(r,t),ee(n))for(;++e<u;)a[e]=r(n[e],e,n);else ne(n,function(n,t,u){a[++e]=r(n,t,u)});return a}function X(n,r,t){var e=-1/0,a=e;if(!r&&ee(n))for(var o=-1,f=n.length;++o<f;){var l=n[o];l>a&&(a=l)}else r=!r&&N(n)?u:i(r,t),ne(n,function(n,t,u){var o=r(n,t,u);
typeof t!="boolean"&&null!=t&&(r=e,e=t,t=!1);var c=!t&&75<=o;if(c)var l={};for(null!=e&&(f=[],e=a.createCallback(e,r));++u<o;){r=n[u];var p=e?e(r,u,n):r;if(c)var s=$t(p),s=Ut.call(l,s)?!(f=l[s]):f=l[s]=[];(t?!u||f[f.length-1]!==p:s||0>gt(f,p))&&((e||c)&&f.push(p),i.push(r))}return i}function bt(n,t){for(var e=-1,r=n?n.length:0,u={};++e<r;){var a=n[e];t?u[a]=t[e]:u[a[0]]=a[1]}return u}function dt(n,t){return ue.fastBind||Lt&&2<arguments.length?Lt.call.apply(Lt,arguments):F(n,t,M(arguments,2))}function _t(n){var t=M(arguments,1); o>e&&(e=o,a=n)});return a}function Y(n,r,t){var e=1/0,a=e;if(!r&&ee(n))for(var o=-1,f=n.length;++o<f;){var l=n[o];l<a&&(a=l)}else r=!r&&N(n)?u:i(r,t),ne(n,function(n,t,u){var o=r(n,t,u);o<e&&(e=o,a=n)});return a}function Z(n,r,t,e){var u=arguments.length<3;if(r=i(r,e,4),ee(n)){var a=-1,o=n.length;for(u&&(t=n[++a]);++a<o;)t=r(t,n[a],a,n)}else ne(n,function(n,e,a){t=u?(u=!1,n):r(t,n,e,a)});return t}function nr(n,r,t,e){var u=n,a=n?n.length:0,o=arguments.length<3;if("number"!=typeof a){var f=ue(n);a=f.length
return Ht(function(){n.apply(e,t)},1)}function kt(n){return n}function wt(n){at(H(n),function(t){var e=a[t]=n[t];a.prototype[t]=function(){var n=this.__wrapped__,t=[n];return Vt.apply(t,arguments),t=e.apply(a,t),n&&typeof n=="object"&&n==t?this:new z(t)}})}function jt(){return this.__wrapped__}r=r?A.defaults(n.Object(),r,A.pick(n,d)):n;var Ct=r.Array,xt=r.Boolean,Ot=r.Date,Nt=r.Function,Et=r.Math,It=r.Number,St=r.Object,At=r.RegExp,$t=r.String,qt=r.TypeError,Bt=Ct(),Ft=St(),Rt=r._,Tt=At("^"+$t(Ft.valueOf).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),Dt=Et.ceil,zt=r.clearTimeout,Pt=Bt.concat,Kt=Et.floor,Mt=Tt.test(Mt=St.getPrototypeOf)&&Mt,Ut=Ft.hasOwnProperty,Vt=Bt.push,Gt=r.setImmediate,Ht=r.setTimeout,Jt=Ft.toString,Lt=Tt.test(Lt=M.bind)&&Lt,Qt=Tt.test(Qt=Ct.isArray)&&Qt,Wt=r.isFinite,Xt=r.isNaN,Yt=Tt.test(Yt=St.keys)&&Yt,Zt=Et.max,ne=Et.min,te=r.parseInt,ee=Et.random,Et=Tt.test(r.attachEvent),Et=Lt&&!/\n|true/.test(Lt+Et),re={}; }return r=i(r,e,4),G(n,function(n,e,i){e=f?f[--a]:--a,t=o?(o=!1,u[e]):r(t,u[e],e,i)}),t}function rr(n,r,t){return r=i(r,t),U(n,function(n,t,e){return!r(n,t,e)})}function tr(n){var r=-1,t=n?n.length:0,e=Array("number"==typeof t?t:0);return G(n,function(n){var t=_t(Tt()*(++r+1));e[r]=e[t],e[t]=n}),e}function er(n){var r=n?n.length:0;return"number"==typeof r?r:ue(n).length}function ur(n,r,t){var e;if(r=i(r,t),ee(n))for(var u=-1,a=n.length;++u<a&&!(e=r(n[u],u,n)););else ne(n,function(n,t,u){return!(e=r(n,t,u))
re[k]=Ct,re[w]=xt,re[j]=Ot,re[x]=St,re[C]=It,re[O]=At,re[N]=$t;var ue=a.support={};ue.fastBind=Lt&&!Et,a.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:g,variable:"",imports:{_:a}},xt={a:"q,w,g",h:"var a=arguments,b=0,c=typeof g=='number'?2:a.length;while(++b<c){m=a[b];if(m&&r[typeof m]){",f:"if(typeof u[i]=='undefined')u[i]=m[i]",c:"}}"},It={a:"e,d,x",h:"d=d&&typeof x=='undefined'?d:p.createCallback(d,x)",b:!1,f:"if(d(m[i],i,e)===false)return u"},St={h:"if(!r[typeof m])return u;"+It.h,b:!1},z.prototype=a.prototype; });return!!e}function ar(n,r,t){var e=-1,u=n?n.length:0,o=Array("number"==typeof u?u:0);for(r=i(r,t),G(n,function(n,t,u){o[++e]={criteria:r(n,t,u),index:e,value:n}}),u=o.length,o.sort(a);u--;)o[u]=o[u].value;return o}function or(n){return n&&"number"==typeof n.length?p(n):H(n)}function ir(n){for(var r=-1,t=n?n.length:0,e=[];++r<t;){var u=n[r];u&&e.push(u)}return e}function fr(n){for(var r=-1,t=n?n.length:0,u=bt.apply(nt,arguments),a=e(u,t),o=[];++r<t;){var i=n[r];a(i)||o.push(i)}return o}function lr(n,r,t){if(n){var e=0,u=n.length;
var ae=Qt||function(n){return n instanceof Ct||Jt.call(n)==k},Qt=R({a:"q",e:"[]",h:"if(!(r[typeof q]))return u",f:"u.push(i)",b:!1}),oe=Yt?function(n){return W(n)?Yt(n):[]}:Qt,ie={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},fe=J(ie),ce=R(xt,{h:xt.h.replace(";",";if(c>3&&typeof a[c-2]=='function'){var d=p.createCallback(a[--c-1],a[c--],2);}else if(c>2&&typeof a[c-1]=='function'){d=a[--c];}"),f:"u[i]=d?d(u[i],m[i]):m[i]"}),le=R(xt),pe=R(It,St,{i:!1}),se=R(It,St),ve=function(n){if(!n||Jt.call(n)!=x)return!1; if("number"!=typeof r&&null!=r){var a=-1;for(r=i(r,t);++a<u&&r(n[a],a,n);)e++}else if(e=r,null==e||t)return n[0];return p(n,0,Rt(Lt(0,e),u))}}function cr(n,r){for(var t=-1,e=n?n.length:0,u=[];++t<e;){var a=n[t];ee(a)?jt.apply(u,r?a:cr(a)):u.push(a)}return u}function sr(n,r,t){var e=-1,u=n?n.length:0;if("number"==typeof t)e=(t<0?Lt(0,u+t):t||0)-1;else if(t)return e=br(n,r),n[e]===r?e:-1;for(;++e<u;)if(n[e]===r)return e;return-1}function pr(n,r,t){if(!n)return[];var e=0,u=n.length;if("number"!=typeof r&&null!=r){var a=u;
var t=n.valueOf,e=typeof t=="function"&&(e=Mt(t))&&Mt(e);return e?n==e||Mt(n)==e:K(n)};return Et&&u&&typeof Gt=="function"&&(_t=dt(Gt,r)),Gt=8==te("08")?te:function(n,t){return te(Y(n)?n.replace(h,""):n,t||0)},a.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},a.assign=ce,a.at=function(n){for(var t=-1,e=Pt.apply(Bt,M(arguments,1)),r=e.length,u=Ct(r);++t<r;)u[t]=n[e[t]];return u},a.bind=dt,a.bindAll=function(n){for(var t=Pt.apply(Bt,arguments),e=1<t.length?0:(t=H(n),-1),r=t.length;++e<r;){var u=t[e]; for(r=i(r,t);a--&&r(n[a],a,n);)e++}else e=null==r||t?1:r||e;return p(n,0,Rt(Lt(0,u-e),u))}function gr(n){var r=arguments,t=r.length,u={0:{}},a=-1,o=n?n.length:0,i=o>=100,f=[],l=f;n:for(;++a<o;){var c=n[a];if(i)var s=c+"",p=wt.call(u[0],s)?!(l=u[0][s]):l=u[0][s]=[];if(p||sr(l,c)<0){i&&l.push(c);for(var g=t;--g;)if(!(u[g]||(u[g]=e(r[g],0,100)))(c))continue n;f.push(c)}}return f}function vr(n,r,t){if(n){var e=0,u=n.length;if("number"!=typeof r&&null!=r){var a=u;for(r=i(r,t);a--&&r(n[a],a,n);)e++}else if(e=r,null==e||t)return n[u-1];
n[u]=dt(n[u],n)}return n},a.bindKey=function(n,t){return F(n,t,M(arguments,2),i)},a.compact=function(n){for(var t=-1,e=n?n.length:0,r=[];++t<e;){var u=n[t];u&&r.push(u)}return r},a.compose=function(){var n=arguments;return function(){for(var t=arguments,e=n.length;e--;)t=[n[e].apply(this,t)];return t[0]}},a.countBy=function(n,t,e){var r={};return t=a.createCallback(t,e),at(n,function(n,e,u){e=$t(t(n,e,u)),Ut.call(r,e)?r[e]++:r[e]=1}),r},a.createCallback=function(n,t,e){if(null==n)return kt;var r=typeof n; return p(n,Lt(0,u-e))}}function yr(n,r,t){var e=n?n.length:0;for("number"==typeof t&&(e=(t<0?Lt(0,e+t):Rt(t,e-1))+1);e--;)if(n[e]===r)return e;return-1}function hr(n,r){for(var t=-1,e=n?n.length:0,u={};++t<e;){var a=n[t];r?u[a]=r[t]:u[a[0]]=a[1]}return u}function dr(n,r,t){n=+n||0,t=+t||1,null==r&&(r=n,n=0);for(var e=-1,u=Lt(0,mt((r-n)/t)),a=Array(u);++e<u;)a[e]=n,n+=t;return a}function mr(n,r,t){if("number"!=typeof r&&null!=r){var e=0,u=-1,a=n?n.length:0;for(r=i(r,t);++u<a&&r(n[u],u,n);)e++}else e=null==r||t?1:Lt(0,r);
if("function"!=r){if("object"!=r)return function(t){return t[n]};var u=oe(n);return function(t){for(var e=u.length,r=!1;e--&&(r=L(t[u[e]],n[u[e]],i)););return r}}return typeof t!="undefined"?1===e?function(e){return n.call(t,e)}:2===e?function(e,r){return n.call(t,e,r)}:4===e?function(e,r,u,a){return n.call(t,e,r,u,a)}:function(e,r,u){return n.call(t,e,r,u)}:n},a.debounce=function(n,t,e){function r(){i=null,e||(a=n.apply(o,u))}var u,a,o,i;return function(){var f=e&&!i;return u=arguments,o=this,zt(i),i=Ht(r,t),f&&(a=n.apply(o,u)),a return p(n,e)}function br(n,r,t,e){var u=0,a=n?n.length:u;for(t=t?i(t,e,1):Br,r=t(r);u<a;){var o=u+a>>>1;t(n[o])<r?u=o+1:a=o}return u}function _r(){return xr(bt.apply(nt,arguments))}function xr(n,r,t,e){var u=-1,a=n?n.length:0,o=[],f=o;"function"==typeof r&&(e=t,t=r,r=!1);var l=!r&&a>=75;if(l)var c={};for(t&&(f=[],t=i(t,e));++u<a;){var s=n[u],p=t?t(s,u,n):s;if(l)var g=p+"",v=wt.call(c,g)?!(f=c[g]):f=c[g]=[];(r?!u||f[f.length-1]!==p:v||sr(f,p)<0)&&((t||l)&&f.push(p),o.push(s))}return o}function wr(n){for(var r=-1,t=n?n.length:0,u=e(arguments,1),a=[];++r<t;){var o=n[r];
}},a.defaults=le,a.defer=_t,a.delay=function(n,t){var r=M(arguments,2);return Ht(function(){n.apply(e,r)},t)},a.difference=function(n){for(var t=-1,e=n?n.length:0,r=Pt.apply(Bt,arguments),r=$(r,e,100),u=[];++t<e;){var a=n[t];r(a)||u.push(a)}return u},a.filter=rt,a.flatten=vt,a.forEach=at,a.forIn=pe,a.forOwn=se,a.functions=H,a.groupBy=function(n,t,e){var r={};return t=a.createCallback(t,e),at(n,function(n,e,u){e=$t(t(n,e,u)),(Ut.call(r,e)?r[e]:r[e]=[]).push(n)}),r},a.initial=function(n,t,e){if(!n)return[]; u(o)||a.push(o)}return a}function jr(n){for(var r=-1,t=n?X(ce(arguments,"length")):0,e=Array(t);++r<t;)e[r]=ce(arguments,r);return e}function Ar(n,t){return n<1?t():function(){return--n<1?t.apply(this,arguments):r}}function kr(n,r){return zt||kt&&arguments.length>2?kt.call.apply(kt,arguments):o(n,r,p(arguments,2))}function Or(n){for(var r=bt.apply(nt,arguments),t=r.length>1?0:(r=b(n),-1),e=r.length;++t<e;){var u=r[t];n[u]=kr(n[u],n)}return n}function Ir(n,r){return o(n,r,p(arguments,2))}function Er(){var n=arguments;
var r=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=a.createCallback(t,e);o--&&t(n[o],o,n);)r++}else r=null==t||e?1:t||r;return M(n,0,ne(Zt(0,u-r),u))},a.intersection=function(n){var t=arguments,e=t.length,r={0:{}},u=-1,a=n?n.length:0,o=100<=a,i=[],f=i;n:for(;++u<a;){var c=n[u];if(o)var l=$t(c),l=Ut.call(r[0],l)?!(f=r[0][l]):f=r[0][l]=[];if(l||0>gt(f,c)){o&&f.push(c);for(var p=e;--p;)if(!(r[p]||(r[p]=$(t[p],0,100)))(c))continue n;i.push(c)}}return i},a.invert=J,a.invoke=function(n,t){var e=M(arguments,2),r=-1,u=typeof t=="function",a=n?n.length:0,o=Ct(typeof a=="number"?a:0); return function(){for(var r=arguments,t=n.length;t--;)r=[n[t].apply(this,r)];return r[0]}}function Sr(n,r,t){function e(){i=null,t||(a=n.apply(o,u))}var u,a,o,i;return function(){var f=t&&!i;return u=arguments,o=this,clearTimeout(i),i=setTimeout(e,r),f&&(a=n.apply(o,u)),a}}function Lr(n,t){var e=p(arguments,2);return setTimeout(function(){n.apply(r,e)},t)}function Rr(n){var t=p(arguments,1);return setTimeout(function(){n.apply(r,t)},1)}function Tr(n,r){var t={};return function(){var e=(r?r.apply(this,arguments):arguments[0])+"";
return at(n,function(n){o[++r]=(u?t:n[t]).apply(n,e)}),o},a.keys=oe,a.map=ot,a.max=it,a.memoize=function(n,t){var e={};return function(){var r=$t(t?t.apply(this,arguments):arguments[0]);return Ut.call(e,r)?e[r]:e[r]=n.apply(this,arguments)}},a.merge=Z,a.min=function(n,t,e){var r=1/0,u=r;if(!t&&ae(n)){e=-1;for(var o=n.length;++e<o;){var i=n[e];i<u&&(u=i)}}else t=!t&&Y(n)?q:a.createCallback(t,e),at(n,function(n,e,a){e=t(n,e,a),e<r&&(r=e,u=n)});return u},a.omit=function(n,t,e){var r=typeof t=="function",u={}; return wt.call(t,e)?t[e]:t[e]=n.apply(this,arguments)}}function Fr(n){var r,t;return function(){return r?t:(r=!0,t=n.apply(this,arguments),n=null,t)}}function Nr(n){return o(n,p(arguments,1))}function $r(n){return o(n,p(arguments,1),null,et)}function Pr(n,r){function t(){i=new Date,o=null,u=n.apply(a,e)}var e,u,a,o,i=0;return function(){var f=new Date,l=r-(f-i);return e=arguments,a=this,l>0?o||(o=setTimeout(t,l)):(clearTimeout(o),o=null,i=f,u=n.apply(a,e)),u}}function Dr(n,r){return function(){var t=[n];
if(r)t=a.createCallback(t,e);else var o=Pt.apply(Bt,arguments);return pe(n,function(n,e,a){(r?!t(n,e,a):0>gt(o,e,1))&&(u[e]=n)}),u},a.once=function(n){var t,e;return function(){return t?e:(t=!0,e=n.apply(this,arguments),n=null,e)}},a.pairs=function(n){for(var t=-1,e=oe(n),r=e.length,u=Ct(r);++t<r;){var a=e[t];u[t]=[a,n[a]]}return u},a.partial=function(n){return F(n,M(arguments,1))},a.partialRight=function(n){return F(n,M(arguments,1),null,i)},a.pick=function(n,t,e){var r={};if(typeof t!="function")for(var u=0,o=Pt.apply(Bt,arguments),i=W(n)?o.length:0;++u<i;){var f=o[u]; return jt.apply(t,arguments),r.apply(this,t)}}function qr(n){return null==n?"":(n+"").replace(yt,c)}function Br(n){return n}function Hr(n){G(b(n),function(r){var e=t[r]=n[r];t.prototype[r]=function(){var n=[this.__wrapped__];return jt.apply(n,arguments),new t(e.apply(t,n))}})}function Cr(){return n._=at,this}function Kr(n,r){return null==n&&null==r&&(r=1),n=+n||0,null==r&&(r=n,n=0),n+_t(Tt()*((+r||0)-n+1))}function Mr(n,t){var e=n?n[t]:r;return E(e)?n[t]():e}function zr(n,e,u){var a=t.templateSettings;
f in n&&(r[f]=n[f])}else t=a.createCallback(t,e),pe(n,function(n,e,u){t(n,e,u)&&(r[e]=n)});return r},a.pluck=ft,a.range=function(n,t,e){n=+n||0,e=+e||1,null==t&&(t=n,n=0);var r=-1;t=Zt(0,Dt((t-n)/e));for(var u=Ct(t);++r<t;)u[r]=n,n+=e;return u},a.reject=function(n,t,e){return t=a.createCallback(t,e),rt(n,function(n,e,r){return!t(n,e,r)})},a.rest=ht,a.shuffle=function(n){var t=-1,e=n?n.length:0,r=Ct(typeof e=="number"?e:0);return at(n,function(n){var e=Kt(ee()*(++t+1));r[t]=r[e],r[e]=n}),r},a.sortBy=function(n,t,e){var r=-1,u=n?n.length:0,o=Ct(typeof u=="number"?u:0); n||(n=""),u=fe({},u,a);var o,i=fe({},u.imports,a.imports),f=ue(i),c=H(i),s=0,p=u.interpolate||vt,g="__p += '",v=RegExp((u.escape||vt).source+"|"+p.source+"|"+(p===gt?pt:vt).source+"|"+(u.evaluate||vt).source+"|$","g");n.replace(v,function(r,t,e,u,a,i){return e||(e=u),g+=n.slice(s,i).replace(ht,l),t&&(g+="' +\n__e("+t+") +\n'"),a&&(o=!0,g+="';\n"+a+";\n__p += '"),e&&(g+="' +\n((__t = ("+e+")) == null ? '' : __t) +\n'"),s=i+r.length,r}),g+="';\n";var y=u.variable,h=y;h||(y="obj",g="with ("+y+") {\n"+g+"\n}\n"),g=(o?g.replace(it,""):g).replace(ft,"$1").replace(lt,"$1;"),g="function("+y+") {\n"+(h?"":y+" || ("+y+" = {});\n")+"var __t, __p = '', __e = _.escape"+(o?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+g+"return __p\n}";
for(t=a.createCallback(t,e),at(n,function(n,e,u){o[++r]={a:t(n,e,u),b:r,c:n}}),u=o.length,o.sort(B);u--;)o[u]=o[u].c;return o},a.tap=function(n,t){return t(n),n},a.throttle=function(n,t){function e(){i=new Ot,o=null,u=n.apply(a,r)}var r,u,a,o,i=0;return function(){var f=new Ot,c=t-(f-i);return r=arguments,a=this,0<c?o||(o=Ht(e,c)):(zt(o),o=null,i=f,u=n.apply(a,r)),u}},a.times=function(n,t,e){n=-1<(n=+n)?n:0;var r=-1,u=Ct(n);for(t=a.createCallback(t,e,1);++r<n;)u[r]=t(r);return u},a.toArray=function(n){return n&&typeof n.length=="number"?M(n):nt(n) var d="\n/*\n//@ sourceURL="+(u.sourceURL||"/lodash/template/source["+dt++ +"]")+"\n*/";try{var m=Function(f,"return "+g+d).apply(r,c)}catch(b){throw b.source=g,b}return e?m(e):(m.source=g,m)}function Ur(n,r,t){n=+n||0;for(var e=-1,u=Array(n);++e<n;)u[e]=r.call(t,e);return u}function Vr(n){return null==n?"":(n+"").replace(ot,g)}function Gr(n){var r=++tt;return(null==n?"":n+"")+r}function Jr(n,r){return r(n),n}function Qr(){return this.__wrapped__+""}function Wr(){return this.__wrapped__}var Xr="object"==typeof exports&&exports,Yr="object"==typeof module&&module&&module.exports==Xr&&module,Zr="object"==typeof global&&global;
},a.union=function(){return mt(Pt.apply(Bt,arguments))},a.uniq=mt,a.values=nt,a.where=rt,a.without=function(n){for(var t=-1,e=n?n.length:0,r=$(arguments,1,30),u=[];++t<e;){var a=n[t];r(a)||u.push(a)}return u},a.wrap=function(n,t){return function(){var e=[n];return Vt.apply(e,arguments),t.apply(this,e)}},a.zip=function(n){for(var t=-1,e=n?it(ft(arguments,"length")):0,r=Ct(e);++t<e;)r[t]=ft(arguments,t);return r},a.zipObject=bt,a.collect=ot,a.drop=ht,a.each=at,a.extend=ce,a.methods=H,a.object=bt,a.select=rt,a.tail=ht,a.unique=mt,wt(a),a.clone=G,a.cloneDeep=function(n,t,e){return G(n,!0,t,e) Zr.global===Zr&&(n=Zr);var nt=[],rt={},tt=0,et=rt,ut=30,at=n._,ot=/&(?:amp|lt|gt|quot|#39);/g,it=/\b__p \+= '';/g,ft=/\b(__p \+=) '' \+/g,lt=/(__e\(.*?\)|\b__t\)) \+\n'';/g,ct=/\w*$/,st=RegExp("^"+(rt.valueOf+"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),pt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,gt=/<%=([\s\S]+?)%>/g,vt=/($^)/,yt=/[&<>"']/g,ht=/['\n\r\t\u2028\u2029\\]/g,dt=0,mt=Math.ceil,bt=nt.concat,_t=Math.floor,xt=st.test(xt=Object.getPrototypeOf)&&xt,wt=rt.hasOwnProperty,jt=nt.push,At=rt.toString,kt=st.test(kt=p.bind)&&kt,Ot=st.test(Ot=Array.isArray)&&Ot,It=n.isFinite,Et=n.isNaN,St=st.test(St=Object.keys)&&St,Lt=Math.max,Rt=Math.min,Tt=Math.random,Ft="[object Arguments]",Nt="[object Array]",$t="[object Boolean]",Pt="[object Date]",Dt="[object Function]",qt="[object Number]",Bt="[object Object]",Ht="[object RegExp]",Ct="[object String]",Kt=!!n.attachEvent,Mt=kt&&!/\n|true/.test(kt+Kt),zt=kt&&!Mt,Ut=St&&(Kt||Mt),Vt={};
},a.contains=tt,a.escape=function(n){return null==n?"":$t(n).replace(m,D)},a.every=et,a.find=ut,a.findIndex=function(n,t,e){var r=-1,u=n?n.length:0;for(t=a.createCallback(t,e);++r<u;)if(t(n[r],r,n))return r;return-1},a.findKey=function(n,t,e){var r;return t=a.createCallback(t,e),se(n,function(n,e,u){return t(n,e,u)?(r=e,!1):void 0}),r},a.has=function(n,t){return n?Ut.call(n,t):!1},a.identity=kt,a.indexOf=gt,a.isArguments=V,a.isArray=ae,a.isBoolean=function(n){return!0===n||!1===n||Jt.call(n)==w},a.isDate=function(n){return n instanceof Ot||Jt.call(n)==j Vt[Dt]=!1,Vt[Ft]=Vt[Nt]=Vt[$t]=Vt[Pt]=Vt[qt]=Vt[Bt]=Vt[Ht]=Vt[Ct]=!0;var Gt={};Gt[Nt]=Array,Gt[$t]=Boolean,Gt[Pt]=Date,Gt[Bt]=Object,Gt[qt]=Number,Gt[Ht]=RegExp,Gt[Ct]=String;var Jt={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},Qt={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"};t.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:gt,variable:"",imports:{_:t}};var Wt=function(n){var r="var index, iterable = "+n.firstArg+", result = iterable;\nif (!iterable) return result;\n"+n.top+";\n";
},a.isElement=function(n){return n?1===n.nodeType:!1},a.isEmpty=function(n){var t=!0;if(!n)return t;var e=Jt.call(n),r=n.length;return e==k||e==N||e==_||e==x&&typeof r=="number"&&Q(n.splice)?!r:(se(n,function(){return t=!1}),t)},a.isEqual=L,a.isFinite=function(n){return Wt(n)&&!Xt(parseFloat(n))},a.isFunction=Q,a.isNaN=function(n){return X(n)&&n!=+n},a.isNull=function(n){return null===n},a.isNumber=X,a.isObject=W,a.isPlainObject=ve,a.isRegExp=function(n){return n instanceof At||Jt.call(n)==O},a.isString=Y,a.isUndefined=function(n){return typeof n=="undefined" return n.arrays&&(r+="var length = iterable.length; index = -1;\nif ("+n.arrays+") {\n while (++index < length) {\n "+n.loop+"\n }\n}\nelse { "),n.isKeysFast&&n.useHas?r+="\n var ownIndex = -1,\n ownProps = objectTypes[typeof iterable] ? nativeKeys(iterable) : [],\n length = ownProps.length;\n\n while (++ownIndex < length) {\n index = ownProps[ownIndex];\n "+n.loop+"\n } ":(r+="\n for (index in iterable) {",n.useHas&&(r+="\n if (",n.useHas&&(r+="hasOwnProperty.call(iterable, index)"),r+=") { "),r+=n.loop+"; ",n.useHas&&(r+="\n }"),r+="\n } "),n.arrays&&(r+="\n}"),r+=n.bottom+";\nreturn result"
},a.lastIndexOf=function(n,t,e){var r=n?n.length:0;for(typeof e=="number"&&(r=(0>e?Zt(0,r+e):ne(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},a.mixin=wt,a.noConflict=function(){return r._=Rt,this},a.parseInt=Gt,a.random=function(n,t){return null==n&&null==t&&(t=1),n=+n||0,null==t&&(t=n,n=0),n+Kt(ee()*((+t||0)-n+1))},a.reduce=ct,a.reduceRight=lt,a.result=function(n,t){var r=n?n[t]:e;return Q(r)?n[t]():r},a.runInContext=t,a.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:oe(n).length },Xt={args:"object, source, guard",top:"var args = arguments,\n argsIndex = 0,\n argsLength = typeof guard == 'number' ? 2 : args.length;\nwhile (++argsIndex < argsLength) {\n iterable = args[argsIndex];\n if (iterable && objectTypes[typeof iterable]) {",loop:"if (typeof result[index] == 'undefined') result[index] = iterable[index]",bottom:" }\n}"},Yt={args:"collection, callback, thisArg",top:"callback = callback && typeof thisArg == 'undefined' ? callback : createCallback(callback, thisArg)",arrays:"typeof length == 'number'",loop:"if (callback(iterable[index], index, collection) === false) return result"},Zt={top:"if (!objectTypes[typeof iterable]) return result;\n"+Yt.top,arrays:!1},ne=f(Yt),re=f(Yt,Zt,{useHas:!1}),te=f(Yt,Zt),ee=Ot||function(n){return n instanceof Array||At.call(n)==Nt
},a.some=pt,a.sortedIndex=yt,a.template=function(n,t,r){var u=a.templateSettings;n||(n=""),r=le({},r,u);var o,i=le({},r.imports,u.imports),u=oe(i),i=nt(i),p=0,v=r.interpolate||y,h="__p+='",v=At((r.escape||y).source+"|"+v.source+"|"+(v===g?s:y).source+"|"+(r.evaluate||y).source+"|$","g");n.replace(v,function(t,e,r,u,a,i){return r||(r=u),h+=n.slice(p,i).replace(b,T),e&&(h+="'+__e("+e+")+'"),a&&(o=!0,h+="';"+a+";__p+='"),r&&(h+="'+((__t=("+r+"))==null?'':__t)+'"),p=i+t.length,t}),h+="';\n",v=r=r.variable,v||(r="obj",h="with("+r+"){"+h+"}"),h=(o?h.replace(f,""):h).replace(c,"$1").replace(l,"$1;"),h="function("+r+"){"+(v?"":r+"||("+r+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+h+"return __p}"; },ue=St?function(n){return S(n)?St(n):[]}:h,ae={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},oe=x(ae),ie=f(Xt,{top:Xt.top.replace(";",";\nif (argsLength > 3 && typeof args[argsLength - 2] == 'function') {\n var callback = createCallback(args[--argsLength - 1], args[argsLength--], 2);\n} else if (argsLength > 2 && typeof args[argsLength - 1] == 'function') {\n callback = args[--argsLength];\n}"),loop:"result[index] = callback ? callback(result[index], iterable[index]) : iterable[index]"}),fe=f(Xt);
try{var m=Nt(u,"return "+h).apply(e,i)}catch(d){throw d.source=h,d}return t?m(t):(m.source=h,m)},a.unescape=function(n){return null==n?"":$t(n).replace(p,U)},a.uniqueId=function(n){var t=++o;return $t(null==n?"":n)+t},a.all=et,a.any=pt,a.detect=ut,a.foldl=ct,a.foldr=lt,a.include=tt,a.inject=ct,se(a,function(n,t){a.prototype[t]||(a.prototype[t]=function(){var t=[this.__wrapped__];return Vt.apply(t,arguments),n.apply(a,t)})}),a.first=st,a.last=function(n,t,e){if(n){var r=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u; E(/x/)&&(E=function(n){return n instanceof Function||At.call(n)==Dt});var le=xt?function(n){if(!n||"object"!=typeof n)return!1;var r=n.valueOf,t="function"==typeof r&&(t=xt(r))&&xt(t);return t?n==t||xt(n)==t&&!v(n):y(n)}:y,ce=W,se=U;Mt&&Yr&&"function"==typeof setImmediate&&(Rr=kr(setImmediate,n)),t.after=Ar,t.assign=ie,t.at=C,t.bind=kr,t.bindAll=Or,t.bindKey=Ir,t.compact=ir,t.compose=Er,t.countBy=M,t.debounce=Sr,t.defaults=fe,t.defer=Rr,t.delay=Lr,t.difference=fr,t.filter=U,t.flatten=cr,t.forEach=G,t.forIn=re,t.forOwn=te,t.functions=b,t.groupBy=J,t.initial=pr,t.intersection=gr,t.invert=x,t.invoke=Q,t.keys=ue,t.map=W,t.max=X,t.memoize=Tr,t.merge=P,t.min=Y,t.object=hr,t.omit=D,t.once=Fr,t.pairs=q,t.partial=Nr,t.partialRight=$r,t.pick=B,t.pluck=ce,t.range=dr,t.reject=rr,t.rest=mr,t.shuffle=tr,t.sortBy=ar,t.tap=Jr,t.throttle=Pr,t.times=Ur,t.toArray=or,t.union=_r,t.uniq=xr,t.values=H,t.where=se,t.without=wr,t.wrap=Dr,t.zip=jr,t.collect=W,t.drop=mr,t.each=G,t.extend=ie,t.methods=b,t.select=U,t.tail=mr,t.unique=xr,Hr(t),t.clone=d,t.cloneDeep=m,t.contains=K,t.escape=qr,t.every=z,t.find=V,t.has=_,t.identity=Br,t.indexOf=sr,t.isArguments=v,t.isArray=ee,t.isBoolean=w,t.isDate=j,t.isElement=A,t.isEmpty=k,t.isEqual=O,t.isFinite=I,t.isFunction=E,t.isNaN=L,t.isNull=R,t.isNumber=T,t.isObject=S,t.isPlainObject=le,t.isRegExp=F,t.isString=N,t.isUndefined=$,t.lastIndexOf=yr,t.mixin=Hr,t.noConflict=Cr,t.random=Kr,t.reduce=Z,t.reduceRight=nr,t.result=Mr,t.size=er,t.some=ur,t.sortedIndex=br,t.template=zr,t.unescape=Vr,t.uniqueId=Gr,t.all=z,t.any=ur,t.detect=V,t.foldl=Z,t.foldr=nr,t.include=K,t.inject=Z,te(t,function(n,r){t.prototype[r]||(t.prototype[r]=function(){var r=[this.__wrapped__];
for(t=a.createCallback(t,e);o--&&t(n[o],o,n);)r++}else if(r=t,null==r||e)return n[u-1];return M(n,Zt(0,u-r))}},a.take=st,a.head=st,se(a,function(n,t){a.prototype[t]||(a.prototype[t]=function(t,e){var r=n(this.__wrapped__,t,e);return null==t||e&&typeof t!="function"?r:new z(r)})}),a.VERSION="1.1.1",a.prototype.toString=function(){return $t(this.__wrapped__)},a.prototype.value=jt,a.prototype.valueOf=jt,at(["join","pop","shift"],function(n){var t=Bt[n];a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments) return jt.apply(r,arguments),n.apply(t,r)})}),t.first=lr,t.last=vr,t.take=lr,t.head=lr,te(t,function(n,r){t.prototype[r]||(t.prototype[r]=function(r,e){var u=n(this.__wrapped__,r,e);return null==r||e&&"function"!=typeof r?u:new t(u)})}),t.VERSION="1.0.2",t.prototype.toString=Qr,t.prototype.value=Wr,t.prototype.valueOf=Wr,ne(["join","pop","shift"],function(n){var r=nt[n];t.prototype[n]=function(){return r.apply(this.__wrapped__,arguments)}}),ne(["push","reverse","sort","unshift"],function(n){var r=nt[n];
}}),at(["push","reverse","sort","unshift"],function(n){var t=Bt[n];a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),at(["concat","slice","splice"],function(n){var t=Bt[n];a.prototype[n]=function(){return new z(t.apply(this.__wrapped__,arguments))}}),a}var e,r=typeof exports=="object"&&exports,u=typeof module=="object"&&module&&module.exports==r&&module,a=typeof global=="object"&&global;a.global===a&&(n=a);var o=0,i={},f=/\b__p\+='';/g,c=/\b(__p\+=)''\+/g,l=/(__e\(.*?\)|\b__t\))\+'';/g,p=/&(?:amp|lt|gt|quot|#39);/g,s=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,v=/\w*$/,g=/<%=([\s\S]+?)%>/g,h=/^0+(?=.$)/,y=/($^)/,m=/[&<>"']/g,b=/['\n\r\t\u2028\u2029\\]/g,d="Array Boolean Date Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),_="[object Arguments]",k="[object Array]",w="[object Boolean]",j="[object Date]",C="[object Number]",x="[object Object]",O="[object RegExp]",N="[object String]",E={"[object Function]":!1}; t.prototype[n]=function(){return r.apply(this.__wrapped__,arguments),this}}),ne(["concat","slice","splice"],function(n){var r=nt[n];t.prototype[n]=function(){return new t(r.apply(this.__wrapped__,arguments))}}),"function"==typeof define&&"object"==typeof define.amd&&define.amd?(n._=t,define(function(){return t})):Xr?Yr?(Yr.exports=t)._=t:Xr._=t:n._=t})(this);
E[_]=E[k]=E[w]=E[j]=E[C]=E[x]=E[O]=E[N]=!0;var I={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},S={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"},A=t();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=A,define(function(){return A})):r&&!r.nodeType?u?(u.exports=A)._=A:r._=A:n._=A})(this);

File diff suppressed because it is too large Load Diff

View File

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

File diff suppressed because it is too large Load Diff

View File

@@ -1,36 +1,38 @@
<?php <?php
// cleanup requested filepath // cleanup requested file path
$file = isset($_GET['f']) ? $_GET['f'] : 'lodash'; $filePath = isset($_GET['f']) ? $_GET['f'] : 'lodash';
$file = preg_replace('#(\.*[\/])+#', '', $file); $filePath = preg_replace('#(\.*[\/])+#', '', $filePath);
$file .= preg_match('/\.[a-z]+$/', $file) ? '' : '.js'; $filePath .= preg_match('/\.[a-z]+$/', $filePath) ? '' : '.js';
// output filename // output filename
if (isset($_GET['o'])) { if (isset($_GET['o'])) {
$output = $_GET['o']; $outputName = $_GET['o'];
} else if (isset($_SERVER['argv'][1])) { } else if (isset($_SERVER['argv'][1])) {
$output = $_SERVER['argv'][1]; $outputName = $_SERVER['argv'][1];
} else { } else {
$output = basename($file); $outputName = basename($filePath);
} }
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
require('../vendor/docdown/docdown.php'); require('../vendor/docdown/docdown.php');
// get package version
$version = json_decode(file_get_contents('../package.json'))->version;
// generate Markdown // generate Markdown
$markdown = docdown(array( $markdown = docdown(array(
'path' => '../' . $file, 'path' => '../' . $filePath,
'title' => 'Lo-Dash <sup>v1.1.1</sup>', 'title' => '<a href="http://lodash.com/">Lo-Dash</a> <span>v' . $version . '</span>',
'toc' => 'categories', 'toc' => 'categories',
'url' => 'https://github.com/lodash/lodash/blob/1.1.1/lodash.js' 'url' => 'https://github.com/lodash/lodash/blob/' . $version . '/lodash.js'
)); ));
// save to a .md file // save to a `.md` file
file_put_contents($output . '.md', $markdown); file_put_contents($outputName . '.md', $markdown);
// print // print
header('Content-Type: text/plain;charset=utf-8'); header('Content-Type: text/plain;charset=utf-8');
echo $markdown . PHP_EOL; echo $markdown . PHP_EOL;
?> ?>

9928
lodash.js

File diff suppressed because it is too large Load Diff

View File

@@ -1,52 +1,20 @@
{ {
"name": "lodash", "name": "lodash",
"version": "1.1.1", "version": "1.0.2",
"description": "A low-level utility library delivering consistency, customization, performance, and extra features.", "description": "A utility library delivering consistency, customization, performance, and extras.",
"homepage": "http://lodash.com", "homepage": "https://lodash.com/",
"main": "./dist/lodash", "license": "MIT",
"keywords": [ "main": "./dist/lodash.js",
"browser", "keywords": ["browser", "client", "functional", "performance", "server", "speed", "util"],
"client", "author": "John-David Dalton <john.david.dalton@gmail.com> (http://allyoucanleet.com/)",
"functional", "contributors": [
"performance", "John-David Dalton <john.david.dalton@gmail.com> (http://allyoucanleet.com/)",
"server", "Blaine Bublitz <blaine@iceddev.com> (http://www.iceddev.com/)",
"speed", "Kit Cambridge <github@kitcambridge.be> (http://kitcambridge.be/)",
"util" "Mathias Bynens <mathias@qiwi.be> (https://mathiasbynens.be/)"
],
"licenses": [
{
"type": "MIT",
"url": "http://lodash.com/license"
}
],
"author": {
"name": "John-David Dalton",
"email": "john.david.dalton@gmail.com",
"web": "http://allyoucanleet.com/"
},
"bugs": {
"url": "https://github.com/bestiejs/lodash/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/bestiejs/lodash.git"
},
"bin": {
"lodash": "./build.js"
},
"directories": {
"doc": "./doc",
"test": "./test"
},
"engines": [
"node",
"rhino"
], ],
"repository": "lodash/lodash",
"jam": { "jam": {
"main": "./lodash.js" "main": "./dist/lodash.compat.js"
},
"scripts": {
"build": "node ./build.js",
"test": "node ./test/test.js ./dist/lodash.js && node ./test/test.js ./dist/lodash.min.js && node ./test/test-build.js"
} }
} }

View File

@@ -29,7 +29,6 @@
<body> <body>
<div id="perf-toolbar"></div> <div id="perf-toolbar"></div>
<script src="../vendor/platform.js/platform.js"></script> <script src="../vendor/platform.js/platform.js"></script>
<script src="../lodash.js"></script>
<script src="../vendor/benchmark.js/benchmark.js"></script> <script src="../vendor/benchmark.js/benchmark.js"></script>
<script src="../vendor/firebug-lite/src/firebug-lite-debug.js"></script> <script src="../vendor/firebug-lite/src/firebug-lite-debug.js"></script>
<script src="perf-ui.js"></script> <script src="perf-ui.js"></script>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

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

View File

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

View File

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