mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-02 16:17:50 +00:00
Compare commits
36 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c65250ec39 | ||
|
|
607eec6ff0 | ||
|
|
14fb3bde60 | ||
|
|
6782bc8ca2 | ||
|
|
3db6841305 | ||
|
|
f478fa8029 | ||
|
|
d255f8400f | ||
|
|
a1545c60d6 | ||
|
|
ed48603ab5 | ||
|
|
23a0507439 | ||
|
|
482e013887 | ||
|
|
265727c30f | ||
|
|
4d3f4e096b | ||
|
|
7629bca62d | ||
|
|
2712f17262 | ||
|
|
86a37559ba | ||
|
|
b504a557f4 | ||
|
|
e849b46f6b | ||
|
|
738dc50a6f | ||
|
|
3138523b5b | ||
|
|
537643a4c3 | ||
|
|
04bfe098ed | ||
|
|
c507887bdd | ||
|
|
ee261313ac | ||
|
|
c9c152bc8a | ||
|
|
6c8e19a321 | ||
|
|
218e3b66f2 | ||
|
|
1d3488fa8e | ||
|
|
f4c1682592 | ||
|
|
28ac6623c7 | ||
|
|
16ab179e1d | ||
|
|
a8ff5385dc | ||
|
|
9dc33c6086 | ||
|
|
b17c576705 | ||
|
|
96f8f2891b | ||
|
|
581d73afe0 |
@@ -1,9 +1,11 @@
|
|||||||
.*
|
.*
|
||||||
*.custom.*
|
*.custom.*
|
||||||
|
*.md
|
||||||
|
*.txt
|
||||||
build.js
|
build.js
|
||||||
index.js
|
index.js
|
||||||
build/
|
build/
|
||||||
doc/*.php
|
doc/
|
||||||
node_modules/
|
node_modules/
|
||||||
perf/
|
perf/
|
||||||
test/
|
test/
|
||||||
|
|||||||
62
README.md
62
README.md
@@ -1,4 +1,4 @@
|
|||||||
# Lo-Dash <sup>v0.9.1</sup>
|
# Lo-Dash <sup>v0.9.2</sup>
|
||||||
[](http://travis-ci.org/bestiejs/lodash)
|
[](http://travis-ci.org/bestiejs/lodash)
|
||||||
|
|
||||||
A drop-in replacement<sup>[*](https://github.com/bestiejs/lodash/wiki/Drop-in-Disclaimer)</sup> for Underscore.js, from the devs behind [jsPerf.com](http://jsperf.com), delivering [performance](http://lodash.com/benchmarks), [bug fixes](https://github.com/bestiejs/lodash#resolved-underscorejs-issues), and [additional features](http://lodash.com/#features).
|
A drop-in replacement<sup>[*](https://github.com/bestiejs/lodash/wiki/Drop-in-Disclaimer)</sup> for Underscore.js, from the devs behind [jsPerf.com](http://jsperf.com), delivering [performance](http://lodash.com/benchmarks), [bug fixes](https://github.com/bestiejs/lodash#resolved-underscorejs-issues), and [additional features](http://lodash.com/#features).
|
||||||
@@ -7,10 +7,10 @@ Lo-Dash’s performance is gained by avoiding slower native methods, instead opt
|
|||||||
|
|
||||||
## Download
|
## Download
|
||||||
|
|
||||||
* [Development build](https://raw.github.com/bestiejs/lodash/v0.9.1/lodash.js)
|
* [Development build](https://raw.github.com/bestiejs/lodash/v0.9.2/lodash.js)
|
||||||
* [Production build](https://raw.github.com/bestiejs/lodash/v0.9.1/lodash.min.js)
|
* [Production build](https://raw.github.com/bestiejs/lodash/v0.9.2/lodash.min.js)
|
||||||
* [Underscore build](https://raw.github.com/bestiejs/lodash/v0.9.1/lodash.underscore.min.js) tailored for projects already using Underscore
|
* [Underscore build](https://raw.github.com/bestiejs/lodash/v0.9.2/lodash.underscore.min.js) tailored for projects already using Underscore
|
||||||
* CDN copies of ≤ v0.9.1’s [Production](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/0.9.1/lodash.min.js), [Underscore](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/0.9.1/lodash.underscore.min.js), and [Development](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/0.9.1/lodash.js) builds are available on [cdnjs](http://cdnjs.com/) thanks to [CloudFlare](http://www.cloudflare.com/)
|
* CDN copies of ≤ v0.9.2’s [Production](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/0.9.2/lodash.min.js), [Underscore](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/0.9.2/lodash.underscore.min.js), and [Development](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/0.9.2/lodash.js) builds are available on [cdnjs](http://cdnjs.com/) thanks to [CloudFlare](http://www.cloudflare.com/)
|
||||||
* For optimal file size, [create a custom build](https://github.com/bestiejs/lodash#custom-builds) with only the features you need
|
* 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
|
||||||
@@ -35,6 +35,7 @@ For more information check out these screencasts over Lo-Dash:
|
|||||||
|
|
||||||
* AMD loader support ([RequireJS](http://requirejs.org/), [curl.js](https://github.com/cujojs/curl), etc.)
|
* AMD loader support ([RequireJS](http://requirejs.org/), [curl.js](https://github.com/cujojs/curl), etc.)
|
||||||
* [_.clone](http://lodash.com/docs#clone) supports *“deep”* cloning
|
* [_.clone](http://lodash.com/docs#clone) supports *“deep”* cloning
|
||||||
|
* [_.contains](http://lodash.com/docs#contains) accepts a `fromIndex` argument
|
||||||
* [_.forEach](http://lodash.com/docs#forEach) is chainable and supports exiting iteration early
|
* [_.forEach](http://lodash.com/docs#forEach) is chainable and supports exiting iteration early
|
||||||
* [_.forIn](http://lodash.com/docs#forIn) for iterating over an object’s own and inherited properties
|
* [_.forIn](http://lodash.com/docs#forIn) for iterating over an object’s own and inherited properties
|
||||||
* [_.forOwn](http://lodash.com/docs#forOwn) for iterating over an object’s own properties
|
* [_.forOwn](http://lodash.com/docs#forOwn) for iterating over an object’s own properties
|
||||||
@@ -42,14 +43,14 @@ For more information check out these screencasts over Lo-Dash:
|
|||||||
* [_.lateBind](http://lodash.com/docs#lateBind) for late binding
|
* [_.lateBind](http://lodash.com/docs#lateBind) for late binding
|
||||||
* [_.merge](http://lodash.com/docs#merge) for a *“deep”* [_.extend](http://lodash.com/docs#extend)
|
* [_.merge](http://lodash.com/docs#merge) for a *“deep”* [_.extend](http://lodash.com/docs#extend)
|
||||||
* [_.partial](http://lodash.com/docs#partial) for partial application without `this` binding
|
* [_.partial](http://lodash.com/docs#partial) for partial application without `this` binding
|
||||||
* [_.pick](http://lodash.com/docs#pick) and [_.omit](http://lodash.com/docs#omit) accept `callback` and `thisArg` arguments
|
* [_.pick](http://lodash.com/docs#pick) and [_.omit](http://lodash.com/docs#omit) accepts `callback` and `thisArg` arguments
|
||||||
* [_.template](http://lodash.com/docs#template) utilizes [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) for easier debugging
|
* [_.template](http://lodash.com/docs#template) supports [ES6 delimiters](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-7.8.6) and utilizes [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) for easier debugging
|
||||||
* [_.contains](http://lodash.com/docs#contains), [_.size](http://lodash.com/docs#size), [_.toArray](http://lodash.com/docs#toArray),
|
* [_.contains](http://lodash.com/docs#contains), [_.size](http://lodash.com/docs#size), [_.toArray](http://lodash.com/docs#toArray),
|
||||||
[and more…](http://lodash.com/docs "_.countBy, _.every, _.filter, _.find, _.forEach, _.groupBy, _.invoke, _.map, _.pluck, _.reduce, _.reduceRight, _.reject, _.some, _.sortBy, _.where") accept strings
|
[and more…](http://lodash.com/docs "_.countBy, _.every, _.filter, _.find, _.forEach, _.groupBy, _.invoke, _.map, _.max, _.min, _.pluck, _.reduce, _.reduceRight, _.reject, _.shuffle, _.some, _.sortBy, _.where") accept strings
|
||||||
|
|
||||||
## Support
|
## Support
|
||||||
|
|
||||||
Lo-Dash has been tested in at least Chrome 5~22, Firefox 1~16, IE 6-10, Opera 9.25-12, Safari 3-6, Node.js 0.4.8-0.8.14, Narwhal 0.3.2, RingoJS 0.8, and Rhino 1.7RC5.
|
Lo-Dash has been tested in at least Chrome 5~23, Firefox 1~16, IE 6-10, Opera 9.25-12, Safari 3-6, Node.js 0.4.8-0.8.14, Narwhal 0.3.2, RingoJS 0.8, and Rhino 1.7RC5.
|
||||||
|
|
||||||
## Custom builds
|
## Custom builds
|
||||||
|
|
||||||
@@ -125,14 +126,19 @@ lodash backbone plus=random,template
|
|||||||
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
|
* Use the `template` argument to pass the file path pattern used to match template files to precompile.
|
||||||
```bash
|
```bash
|
||||||
lodash template="./*.jst"
|
lodash template="./*.jst"
|
||||||
```
|
```
|
||||||
|
|
||||||
* Use the `settings` argument to pass the template settings used when precompiling templates
|
* Use the `settings` argument to pass the template settings used when precompiling templates.
|
||||||
```bash
|
```bash
|
||||||
lodash settings="{interpolate:/\\{\\{([\\s\\S]+?)\\}\\}/g}"
|
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` or `mobile`, may be combined.<br>
|
All arguments, except `legacy` with `csp` or `mobile`, may be combined.<br>
|
||||||
@@ -202,29 +208,25 @@ require({
|
|||||||
|
|
||||||
## Resolved Underscore.js issues
|
## Resolved Underscore.js issues
|
||||||
|
|
||||||
* Add AMD loader support [[#431](https://github.com/documentcloud/underscore/pull/431), [test](https://github.com/bestiejs/lodash/blob/v0.9.1/test/test.js#L116-146)]
|
* Allow iteration of objects with a `length` property [[#799](https://github.com/documentcloud/underscore/pull/799), [test](https://github.com/bestiejs/lodash/blob/v0.9.2/test/test.js#L545-551)]
|
||||||
* Allow iteration of objects with a `length` property [[#799](https://github.com/documentcloud/underscore/pull/799), [test](https://github.com/bestiejs/lodash/blob/v0.9.1/test/test.js#L518-524)]
|
* Fix cross-browser object iteration bugs [[#60](https://github.com/documentcloud/underscore/issues/60), [#376](https://github.com/documentcloud/underscore/issues/376), [test](https://github.com/bestiejs/lodash/blob/v0.9.2/test/test.js#L558-582)]
|
||||||
* Ensure *“Collections”* methods allow string `collection` arguments [[#247](https://github.com/documentcloud/underscore/issues/247), [#276](https://github.com/documentcloud/underscore/issues/276), [#561](https://github.com/documentcloud/underscore/pull/561), [test](https://github.com/bestiejs/lodash/blob/v0.9.1/test/test.js#L478-495)]
|
* Methods should work on pages with incorrectly shimmed native methods [[#7](https://github.com/documentcloud/underscore/issues/7), [#742](https://github.com/documentcloud/underscore/issues/742), [test](https://github.com/bestiejs/lodash/blob/v0.9.2/test/test.js#L140-146)]
|
||||||
* Fix cross-browser object iteration bugs [[#60](https://github.com/documentcloud/underscore/issues/60), [#376](https://github.com/documentcloud/underscore/issues/376), [test](https://github.com/bestiejs/lodash/blob/v0.9.1/test/test.js#L531-555)]
|
* `_.isEmpty` should support jQuery/MooTools DOM query collections [[#690](https://github.com/documentcloud/underscore/pull/690), [test](https://github.com/bestiejs/lodash/blob/v0.9.2/test/test.js#L747-752)]
|
||||||
* Methods should work on pages with incorrectly shimmed native methods [[#7](https://github.com/documentcloud/underscore/issues/7), [#742](https://github.com/documentcloud/underscore/issues/742), [test](https://github.com/bestiejs/lodash/blob/v0.9.1/test/test.js#L140-146)]
|
* `_.isObject` should avoid V8 bug [#2291](http://code.google.com/p/v8/issues/detail?id=2291) [[#605](https://github.com/documentcloud/underscore/issues/605), [test](https://github.com/bestiejs/lodash/blob/v0.9.2/test/test.js#L828-840)]
|
||||||
* `_.clone` should allow `deep` cloning [[#595](https://github.com/documentcloud/underscore/pull/595), [test](https://github.com/bestiejs/lodash/blob/v0.9.1/test/test.js#L212-223)]
|
* `_.keys` should work with `arguments` objects cross-browser [[#396](https://github.com/documentcloud/underscore/issues/396), [test](https://github.com/bestiejs/lodash/blob/v0.9.2/test/test.js#L921-923)]
|
||||||
* `_.contains` should work with strings [[#667](https://github.com/documentcloud/underscore/pull/667), [test](https://github.com/bestiejs/lodash/blob/v0.9.1/test/test.js#L265-274)]
|
* `_.range` should coerce arguments to numbers [[#634](https://github.com/documentcloud/underscore/issues/634), [#683](https://github.com/documentcloud/underscore/issues/683), [test](https://github.com/bestiejs/lodash/blob/v0.9.2/test/test.js#L1337-1340)]
|
||||||
* `_.extend` should recursively extend objects [[#379](https://github.com/documentcloud/underscore/pull/379), [#718](https://github.com/documentcloud/underscore/issues/718), [test](https://github.com/bestiejs/lodash/blob/v0.9.1/test/test.js#L1020-1042)]
|
|
||||||
* `_.forEach` should be chainable [[#142](https://github.com/documentcloud/underscore/issues/142), [test](https://github.com/bestiejs/lodash/blob/v0.9.1/test/test.js#L473-476)]
|
|
||||||
* `_.forEach` should allow exiting iteration early [[#211](https://github.com/documentcloud/underscore/issues/211), [test](https://github.com/bestiejs/lodash/blob/v0.9.1/test/test.js#L561-579)]
|
|
||||||
* `_.isEmpty` should support jQuery/MooTools DOM query collections [[#690](https://github.com/documentcloud/underscore/pull/690), [test](https://github.com/bestiejs/lodash/blob/v0.9.1/test/test.js#L720-725)]
|
|
||||||
* `_.isObject` should avoid V8 bug [#2291](http://code.google.com/p/v8/issues/detail?id=2291) [[#605](https://github.com/documentcloud/underscore/issues/605), [test](https://github.com/bestiejs/lodash/blob/v0.9.1/test/test.js#L801-813)]
|
|
||||||
* `_.keys` should work with `arguments` objects cross-browser [[#396](https://github.com/documentcloud/underscore/issues/396), [test](https://github.com/bestiejs/lodash/blob/v0.9.1/test/test.js#L894-896)]
|
|
||||||
* `_.range` should coerce arguments to numbers [[#634](https://github.com/documentcloud/underscore/issues/634), [#683](https://github.com/documentcloud/underscore/issues/683), [test](https://github.com/bestiejs/lodash/blob/v0.9.1/test/test.js#L1295-1298)]
|
|
||||||
|
|
||||||
## Release Notes
|
## Release Notes
|
||||||
|
|
||||||
### <sup>v0.9.1</sup>
|
### <sup>v0.9.2</sup>
|
||||||
|
|
||||||
* Ensured `_.every` returns `false` as soon as the `callback` result is falsey
|
* Added `fromIndex` argument to `_.contains`
|
||||||
* Ensured `_.isFinite` returns `false` for non-numeric values
|
* Added `moduleId` build option
|
||||||
* Removed `_.forEach` chainability in the `underscore` build
|
* Added Closure Compiler *“simple”* optimizations to the build process
|
||||||
* Simplified `_.union`
|
* Added support for strings in `_.max` and `_.min`
|
||||||
|
* Added support for ES6 template delimiters to `_.template`
|
||||||
|
* Ensured re-minification of Lo-Dash by third parties avoids Closure Compiler bugs
|
||||||
|
* Optimized `_.every`, `_.find`, `_.some`, and `_.uniq`
|
||||||
|
|
||||||
The full changelog is available [here](https://github.com/bestiejs/lodash/wiki/Changelog).
|
The full changelog is available [here](https://github.com/bestiejs/lodash/wiki/Changelog).
|
||||||
|
|
||||||
|
|||||||
160
build.js
160
build.js
@@ -6,8 +6,8 @@
|
|||||||
var fs = require('fs'),
|
var fs = require('fs'),
|
||||||
path = require('path'),
|
path = require('path'),
|
||||||
vm = require('vm'),
|
vm = require('vm'),
|
||||||
minify = require(path.join(__dirname, 'build', 'minify')),
|
minify = require(path.join(__dirname, 'build', 'minify.js')),
|
||||||
_ = require(path.join(__dirname, 'lodash'));
|
_ = require(path.join(__dirname, 'lodash.js'));
|
||||||
|
|
||||||
/** The current working directory */
|
/** The current working directory */
|
||||||
var cwd = process.cwd();
|
var cwd = process.cwd();
|
||||||
@@ -64,13 +64,13 @@
|
|||||||
/** Used to track function dependencies */
|
/** Used to track function dependencies */
|
||||||
var dependencyMap = {
|
var dependencyMap = {
|
||||||
'after': [],
|
'after': [],
|
||||||
'bind': ['isFunction'],
|
'bind': ['isFunction', 'isObject'],
|
||||||
'bindAll': ['bind', 'functions'],
|
'bindAll': ['bind', 'functions'],
|
||||||
'chain': ['mixin'],
|
'chain': ['mixin'],
|
||||||
'clone': ['extend', 'forEach', 'forOwn', 'isArguments', 'isPlainObject'],
|
'clone': ['extend', 'forEach', 'forOwn', 'isArguments', 'isObject', 'isPlainObject'],
|
||||||
'compact': [],
|
'compact': [],
|
||||||
'compose': [],
|
'compose': [],
|
||||||
'contains': ['indexOf', 'some'],
|
'contains': ['indexOf', 'isString', 'some'],
|
||||||
'countBy': ['forEach'],
|
'countBy': ['forEach'],
|
||||||
'debounce': [],
|
'debounce': [],
|
||||||
'defaults': ['isArguments'],
|
'defaults': ['isArguments'],
|
||||||
@@ -78,13 +78,13 @@
|
|||||||
'delay': [],
|
'delay': [],
|
||||||
'difference': ['indexOf'],
|
'difference': ['indexOf'],
|
||||||
'escape': [],
|
'escape': [],
|
||||||
'every': ['forEach'],
|
'every': ['forEach', 'isArray'],
|
||||||
'extend': ['isArguments'],
|
'extend': ['isArguments'],
|
||||||
'filter': ['forEach'],
|
'filter': ['forEach'],
|
||||||
'find': ['some'],
|
'find': ['forEach'],
|
||||||
'first': [],
|
'first': [],
|
||||||
'flatten': ['isArray'],
|
'flatten': ['isArray'],
|
||||||
'forEach': ['identity'],
|
'forEach': ['identity', 'isString'],
|
||||||
'forIn': ['identity', 'isArguments'],
|
'forIn': ['identity', 'isArguments'],
|
||||||
'forOwn': ['identity', 'isArguments'],
|
'forOwn': ['identity', 'isArguments'],
|
||||||
'functions': ['forIn', 'isFunction'],
|
'functions': ['forIn', 'isFunction'],
|
||||||
@@ -113,34 +113,34 @@
|
|||||||
'isRegExp': [],
|
'isRegExp': [],
|
||||||
'isString': [],
|
'isString': [],
|
||||||
'isUndefined': [],
|
'isUndefined': [],
|
||||||
'keys': ['forOwn', 'isArguments'],
|
'keys': ['forOwn', 'isArguments', 'isObject'],
|
||||||
'last': [],
|
'last': [],
|
||||||
'lastIndexOf': [],
|
'lastIndexOf': [],
|
||||||
'lateBind': ['isFunction'],
|
'lateBind': ['isFunction', 'isObject'],
|
||||||
'map': ['forEach', 'isArray'],
|
'map': ['forEach', 'isArray'],
|
||||||
'max': ['forEach'],
|
'max': ['forEach', 'isArray', 'isString'],
|
||||||
'memoize': [],
|
'memoize': [],
|
||||||
'merge': ['forOwn', 'isArray', 'isPlainObject'],
|
'merge': ['forOwn', 'isArray', 'isPlainObject'],
|
||||||
'min': ['forEach'],
|
'min': ['forEach', 'isArray', 'isString'],
|
||||||
'mixin': ['forEach', 'functions'],
|
'mixin': ['forEach', 'functions'],
|
||||||
'noConflict': [],
|
'noConflict': [],
|
||||||
'object': [],
|
'object': [],
|
||||||
'omit': ['forIn', 'indexOf'],
|
'omit': ['forIn', 'indexOf'],
|
||||||
'once': [],
|
'once': [],
|
||||||
'pairs': ['forOwn'],
|
'pairs': ['forOwn'],
|
||||||
'partial': ['isFunction'],
|
'partial': ['isFunction', 'isObject'],
|
||||||
'pick': ['forIn'],
|
'pick': ['forIn'],
|
||||||
'pluck': ['forEach'],
|
'pluck': ['forEach'],
|
||||||
'random': [],
|
'random': [],
|
||||||
'range': [],
|
'range': [],
|
||||||
'reduce': ['forEach'],
|
'reduce': ['forEach'],
|
||||||
'reduceRight': ['forEach', 'keys'],
|
'reduceRight': ['forEach', 'isString', 'keys'],
|
||||||
'reject': ['filter'],
|
'reject': ['filter'],
|
||||||
'rest': [],
|
'rest': [],
|
||||||
'result': ['isFunction'],
|
'result': ['isFunction'],
|
||||||
'shuffle': ['forEach'],
|
'shuffle': ['forEach'],
|
||||||
'size': ['keys'],
|
'size': ['keys'],
|
||||||
'some': ['forEach'],
|
'some': ['forEach', 'isArray'],
|
||||||
'sortBy': ['forEach'],
|
'sortBy': ['forEach'],
|
||||||
'sortedIndex': ['identity'],
|
'sortedIndex': ['identity'],
|
||||||
'tap': ['mixin'],
|
'tap': ['mixin'],
|
||||||
@@ -254,17 +254,14 @@
|
|||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {String} [pattern='<cwd>/*.jst'] The file path pattern.
|
* @param {String} [pattern='<cwd>/*.jst'] The file path pattern.
|
||||||
* @param {Object} [options=_.templateSettings] The options object.
|
* @param {Object} options The options object.
|
||||||
* @returns {String} Returns the compiled source.
|
* @returns {String} Returns the compiled source.
|
||||||
*/
|
*/
|
||||||
function buildTemplate(pattern, options) {
|
function buildTemplate(pattern, options) {
|
||||||
pattern || (pattern = path.join(cwd, '*.jst'));
|
pattern || (pattern = path.join(cwd, '*.jst'));
|
||||||
options || (options = _.templateSettings);
|
|
||||||
|
|
||||||
var directory = path.dirname(pattern);
|
var directory = path.dirname(pattern);
|
||||||
|
|
||||||
var moduleName = 'lodash';
|
|
||||||
|
|
||||||
var source = [
|
var source = [
|
||||||
';(function(window) {',
|
';(function(window) {',
|
||||||
" var freeExports = typeof exports == 'object' && exports &&",
|
" var freeExports = typeof exports == 'object' && exports &&",
|
||||||
@@ -295,7 +292,7 @@
|
|||||||
|
|
||||||
source.push(
|
source.push(
|
||||||
" if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {",
|
" if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {",
|
||||||
" define(['" + moduleName + "'], function(lodash) {",
|
" define(['" + options.moduleId + "'], function(lodash) {",
|
||||||
' lodash.templates = lodash.extend(lodash.templates || {}, templates);',
|
' lodash.templates = lodash.extend(lodash.templates || {}, templates);',
|
||||||
' });',
|
' });',
|
||||||
" } else if (freeExports) {",
|
" } else if (freeExports) {",
|
||||||
@@ -362,6 +359,7 @@
|
|||||||
' (e.g. `lodash template=./*.jst`)',
|
' (e.g. `lodash template=./*.jst`)',
|
||||||
' lodash settings=... Template settings used when precompiling templates',
|
' lodash settings=... Template settings used when precompiling templates',
|
||||||
' (e.g. `lodash settings="{interpolate:/\\\\{\\\\{([\\\\s\\\\S]+?)\\\\}\\\\}/g}"`)',
|
' (e.g. `lodash settings="{interpolate:/\\\\{\\\\{([\\\\s\\\\S]+?)\\\\}\\\\}/g}"`)',
|
||||||
|
' lodash moduleId=... The AMD module ID of Lo-Dash, which defaults to “lodash”, used by precompiled templates',
|
||||||
'',
|
'',
|
||||||
' All arguments, except `legacy` with `csp` or `mobile`, may be combined.',
|
' All arguments, except `legacy` with `csp` or `mobile`, may be combined.',
|
||||||
' Unless specified by `-o` or `--output`, all files created are saved to the current working directory.',
|
' Unless specified by `-o` or `--output`, all files created are saved to the current working directory.',
|
||||||
@@ -469,7 +467,7 @@
|
|||||||
* @returns {String} Returns the `isArguments` fallback.
|
* @returns {String} Returns the `isArguments` fallback.
|
||||||
*/
|
*/
|
||||||
function getIsArgumentsFallback(source) {
|
function getIsArgumentsFallback(source) {
|
||||||
return (source.match(/(?:\s*\/\/.*)*\n( +)if *\(noArgsClass\)[\s\S]+?};\n\1}/) || [''])[0];
|
return (source.match(/(?:\s*\/\/.*)*\n( *)if *\(noArgsClass\)[\s\S]+?};\n\1}/) || [''])[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -480,7 +478,7 @@
|
|||||||
* @returns {String} Returns the `isFunction` fallback.
|
* @returns {String} Returns the `isFunction` fallback.
|
||||||
*/
|
*/
|
||||||
function getIsFunctionFallback(source) {
|
function getIsFunctionFallback(source) {
|
||||||
return (source.match(/(?:\s*\/\/.*)*\n( +)if *\(isFunction\(\/x\/[\s\S]+?};\n\1}/) || [''])[0];
|
return (source.match(/(?:\s*\/\/.*)*\n( *)if *\(isFunction\(\/x\/[\s\S]+?};\n\1}/) || [''])[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -538,11 +536,11 @@
|
|||||||
// begin non-capturing group
|
// begin non-capturing group
|
||||||
'(?:' +
|
'(?:' +
|
||||||
// match a function declaration
|
// match a function declaration
|
||||||
'( +)function ' + funcName + '\\b[\\s\\S]+?\\n\\1}|' +
|
'( *)function ' + funcName + '\\b[\\s\\S]+?\\n\\1}|' +
|
||||||
// match a variable declaration with `createIterator`
|
// match a variable declaration with `createIterator`
|
||||||
' +var ' + funcName + ' *=.*?createIterator\\((?:{|[a-zA-Z])[\\s\\S]+?\\);|' +
|
' +var ' + funcName + ' *=.*?createIterator\\((?:{|[a-zA-Z])[\\s\\S]+?\\);|' +
|
||||||
// match a variable declaration with function expression
|
// match a variable declaration with function expression
|
||||||
'( +)var ' + funcName + ' *=.*?function[\\s\\S]+?\\n\\2};' +
|
'( *)var ' + funcName + ' *=.*?function[\\s\\S]+?\\n\\2};' +
|
||||||
// end non-capturing group
|
// end non-capturing group
|
||||||
')\\n'
|
')\\n'
|
||||||
));
|
));
|
||||||
@@ -728,7 +726,7 @@
|
|||||||
// match multi-line comment block
|
// match multi-line comment block
|
||||||
'(?:\\n +/\\*[^*]*\\*+(?:[^/][^*]*\\*+)*/)?\\n' +
|
'(?:\\n +/\\*[^*]*\\*+(?:[^/][^*]*\\*+)*/)?\\n' +
|
||||||
// match a variable declaration that's not part of a declaration list
|
// match a variable declaration that's not part of a declaration list
|
||||||
'( +)var ' + varName + ' *= *(?:.+?(?:;|&&\\n[^;]+;)|(?:\\w+\\(|{)[\\s\\S]+?\\n\\1.+?;)\\n|' +
|
'( *)var ' + varName + ' *= *(?:.+?(?:;|&&\\n[^;]+;)|(?:\\w+\\(|{)[\\s\\S]+?\\n\\1.+?;)\\n|' +
|
||||||
// match a variable in a declaration list
|
// match a variable in a declaration list
|
||||||
'\\n +' + varName + ' *=.+?,'
|
'\\n +' + varName + ' *=.+?,'
|
||||||
), '');
|
), '');
|
||||||
@@ -757,7 +755,7 @@
|
|||||||
function replaceVar(source, varName, varValue) {
|
function replaceVar(source, varName, varValue) {
|
||||||
// replace a variable that's not part of a declaration list
|
// replace a variable that's not part of a declaration list
|
||||||
var result = source.replace(RegExp(
|
var result = source.replace(RegExp(
|
||||||
'(( +)var ' + varName + ' *= *)' +
|
'(( *)var ' + varName + ' *= *)' +
|
||||||
'(?:.+?;|(?:Function\\(.+?|.*?[^,])\\n[\\s\\S]+?\\n\\2.+?;)\\n'
|
'(?:.+?;|(?:Function\\(.+?|.*?[^,])\\n[\\s\\S]+?\\n\\2.+?;)\\n'
|
||||||
), '$1' + varValue + ';\n');
|
), '$1' + varValue + ';\n');
|
||||||
|
|
||||||
@@ -809,7 +807,7 @@
|
|||||||
// used to report invalid command-line arguments
|
// used to report invalid command-line arguments
|
||||||
var invalidArgs = _.reject(options.slice(options[0] == 'node' ? 2 : 0), function(value, index, options) {
|
var invalidArgs = _.reject(options.slice(options[0] == 'node' ? 2 : 0), function(value, index, options) {
|
||||||
if (/^(?:-o|--output)$/.test(options[index - 1]) ||
|
if (/^(?:-o|--output)$/.test(options[index - 1]) ||
|
||||||
/^(?:category|exclude|exports|iife|include|minus|plus|settings|template)=.*$/.test(value)) {
|
/^(?:category|exclude|exports|iife|include|moduleId|minus|plus|settings|template)=.*$/i.test(value)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return [
|
return [
|
||||||
@@ -906,6 +904,12 @@
|
|||||||
: exportsAll.slice()
|
: exportsAll.slice()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// used to specify the AMD module ID of Lo-Dash used by precompiled templates
|
||||||
|
var moduleId = options.reduce(function(result, value) {
|
||||||
|
var match = value.match(/moduleId=(.*)/);
|
||||||
|
return match ? match[1] : result;
|
||||||
|
}, 'lodash');
|
||||||
|
|
||||||
// used to specify the output path for builds
|
// used to specify the output path for builds
|
||||||
var outputPath = options.reduce(function(result, value, index) {
|
var outputPath = options.reduce(function(result, value, index) {
|
||||||
if (/-o|--output/.test(value)) {
|
if (/-o|--output/.test(value)) {
|
||||||
@@ -929,7 +933,9 @@
|
|||||||
return match
|
return match
|
||||||
? Function('return {' + match[1].replace(/^{|}$/g, '') + '}')()
|
? Function('return {' + match[1].replace(/^{|}$/g, '') + '}')()
|
||||||
: result;
|
: result;
|
||||||
}, _.clone(_.templateSettings));
|
}, _.extend(_.clone(_.templateSettings), {
|
||||||
|
'moduleId': moduleId
|
||||||
|
}));
|
||||||
|
|
||||||
// flag used to specify a template build
|
// flag used to specify a template build
|
||||||
var isTemplate = !!templatePattern;
|
var isTemplate = !!templatePattern;
|
||||||
@@ -964,9 +970,15 @@
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
// update dependencies
|
// update dependencies
|
||||||
|
if (isMobile) {
|
||||||
|
dependencyMap.reduceRight = ['forEach', 'keys'];
|
||||||
|
}
|
||||||
if (isUnderscore) {
|
if (isUnderscore) {
|
||||||
|
dependencyMap.contains = ['indexOf', 'some'],
|
||||||
dependencyMap.isEqual = ['isArray', 'isFunction'];
|
dependencyMap.isEqual = ['isArray', 'isFunction'];
|
||||||
dependencyMap.isEmpty = ['isArray', 'isString'];
|
dependencyMap.isEmpty = ['isArray', 'isString'];
|
||||||
|
dependencyMap.max = ['forEach', 'isArray'];
|
||||||
|
dependencyMap.min = ['forEach', 'isArray'];
|
||||||
dependencyMap.pick = [];
|
dependencyMap.pick = [];
|
||||||
dependencyMap.template = ['defaults', 'escape'];
|
dependencyMap.template = ['defaults', 'escape'];
|
||||||
|
|
||||||
@@ -1051,7 +1063,7 @@
|
|||||||
|
|
||||||
// replace `_.clone`
|
// replace `_.clone`
|
||||||
if (useUnderscoreClone) {
|
if (useUnderscoreClone) {
|
||||||
source = source.replace(/^( +)function clone[\s\S]+?\n\1}/m, [
|
source = source.replace(/^( *)function clone[\s\S]+?\n\1}/m, [
|
||||||
' function clone(value) {',
|
' function clone(value) {',
|
||||||
' return value && objectTypes[typeof value]',
|
' return value && objectTypes[typeof value]',
|
||||||
' ? (isArray(value) ? slice.call(value) : extend({}, value))',
|
' ? (isArray(value) ? slice.call(value) : extend({}, value))',
|
||||||
@@ -1060,8 +1072,18 @@
|
|||||||
].join('\n'));
|
].join('\n'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// replace `_.contains`
|
||||||
|
source = source.replace(/^( *)function contains[\s\S]+?\n\1}/m, [
|
||||||
|
' function contains(collection, target) {',
|
||||||
|
' var length = collection ? collection.length : 0;',
|
||||||
|
" return typeof length == 'number'",
|
||||||
|
' ? indexOf(collection, target) > -1',
|
||||||
|
' : some(collection, function(value) { return value === target; });',
|
||||||
|
' }'
|
||||||
|
].join('\n'));
|
||||||
|
|
||||||
// replace `_.difference`
|
// replace `_.difference`
|
||||||
source = source.replace(/^( +)function difference[\s\S]+?\n\1}/m, [
|
source = source.replace(/^( *)function difference[\s\S]+?\n\1}/m, [
|
||||||
' function difference(array) {',
|
' function difference(array) {',
|
||||||
' var index = -1,',
|
' var index = -1,',
|
||||||
' length = array.length,',
|
' length = array.length,',
|
||||||
@@ -1079,7 +1101,7 @@
|
|||||||
].join('\n'));
|
].join('\n'));
|
||||||
|
|
||||||
// replace `_.intersection`
|
// replace `_.intersection`
|
||||||
source = source.replace(/^( +)function intersection[\s\S]+?\n\1}/m, [
|
source = source.replace(/^( *)function intersection[\s\S]+?\n\1}/m, [
|
||||||
' function intersection(array) {',
|
' function intersection(array) {',
|
||||||
' var args = arguments,',
|
' var args = arguments,',
|
||||||
' argsLength = args.length,',
|
' argsLength = args.length,',
|
||||||
@@ -1101,7 +1123,7 @@
|
|||||||
].join('\n'));
|
].join('\n'));
|
||||||
|
|
||||||
// replace `_.isEmpty`
|
// replace `_.isEmpty`
|
||||||
source = source.replace(/^( +)function isEmpty[\s\S]+?\n\1}/m, [
|
source = source.replace(/^( *)function isEmpty[\s\S]+?\n\1}/m, [
|
||||||
' function isEmpty(value) {',
|
' function isEmpty(value) {',
|
||||||
' if (!value) {',
|
' if (!value) {',
|
||||||
' return true;',
|
' return true;',
|
||||||
@@ -1118,8 +1140,15 @@
|
|||||||
' }'
|
' }'
|
||||||
].join('\n'));
|
].join('\n'));
|
||||||
|
|
||||||
|
// replace `_.isFinite`
|
||||||
|
source = source.replace(/^( *)function isFinite[\s\S]+?\n\1}/m, [
|
||||||
|
' function isFinite(value) {',
|
||||||
|
' return nativeIsFinite(value) && toString.call(value) == numberClass;',
|
||||||
|
' }'
|
||||||
|
].join('\n'));
|
||||||
|
|
||||||
// replace `_.omit`
|
// replace `_.omit`
|
||||||
source = source.replace(/^( +)function omit[\s\S]+?\n\1}/m, [
|
source = source.replace(/^( *)function omit[\s\S]+?\n\1}/m, [
|
||||||
' function omit(object) {',
|
' function omit(object) {',
|
||||||
' var props = concat.apply(arrayRef, arguments),',
|
' var props = concat.apply(arrayRef, arguments),',
|
||||||
' result = {};',
|
' result = {};',
|
||||||
@@ -1134,7 +1163,7 @@
|
|||||||
].join('\n'));
|
].join('\n'));
|
||||||
|
|
||||||
// replace `_.pick`
|
// replace `_.pick`
|
||||||
source = source.replace(/^( +)function pick[\s\S]+?\n\1}/m, [
|
source = source.replace(/^( *)function pick[\s\S]+?\n\1}/m, [
|
||||||
' function pick(object) {',
|
' function pick(object) {',
|
||||||
' var index = 0,',
|
' var index = 0,',
|
||||||
' props = concat.apply(arrayRef, arguments),',
|
' props = concat.apply(arrayRef, arguments),',
|
||||||
@@ -1151,8 +1180,38 @@
|
|||||||
' }'
|
' }'
|
||||||
].join('\n'));
|
].join('\n'));
|
||||||
|
|
||||||
|
// replace `_.uniq`
|
||||||
|
source = source.replace(/^( *)function uniq[\s\S]+?\n\1}/m, [
|
||||||
|
' function uniq(array, isSorted, callback, thisArg) {',
|
||||||
|
' var index = -1,',
|
||||||
|
' length = array ? array.length : 0,',
|
||||||
|
' result = [],',
|
||||||
|
' seen = result;',
|
||||||
|
'',
|
||||||
|
' if (callback) {',
|
||||||
|
' seen = [];',
|
||||||
|
' callback = createCallback(callback, thisArg);',
|
||||||
|
' }',
|
||||||
|
' while (++index < length) {',
|
||||||
|
' var value = array[index],',
|
||||||
|
' computed = callback ? callback(value, index, array) : value;',
|
||||||
|
'',
|
||||||
|
' if (isSorted',
|
||||||
|
' ? !index || seen[seen.length - 1] !== computed',
|
||||||
|
' : indexOf(seen, computed) < 0',
|
||||||
|
' ) {',
|
||||||
|
' if (callback) {',
|
||||||
|
' seen.push(computed);',
|
||||||
|
' }',
|
||||||
|
' result.push(value);',
|
||||||
|
' }',
|
||||||
|
' }',
|
||||||
|
' return result;',
|
||||||
|
' }'
|
||||||
|
].join('\n'));
|
||||||
|
|
||||||
// replace `_.without`
|
// replace `_.without`
|
||||||
source = source.replace(/^( +)function without[\s\S]+?\n\1}/m, [
|
source = source.replace(/^( *)function without[\s\S]+?\n\1}/m, [
|
||||||
' function without(array) {',
|
' function without(array) {',
|
||||||
' var index = -1,',
|
' var index = -1,',
|
||||||
' length = array.length,',
|
' length = array.length,',
|
||||||
@@ -1168,19 +1227,14 @@
|
|||||||
' }'
|
' }'
|
||||||
].join('\n'));
|
].join('\n'));
|
||||||
|
|
||||||
// remove string support from `_.contains`
|
|
||||||
source = source.replace(/return *\(toString\.call.+?stringClass[\s\S]+?;/, 'return indexOf(collection, target) > -1;');
|
|
||||||
|
|
||||||
// remove `arguments` object check from `_.isEqual`
|
// remove `arguments` object check from `_.isEqual`
|
||||||
source = source.replace(/ *\|\| *className *== *argsClass/, '');
|
source = source.replace(/ *\|\| *className *== *argsClass/, '');
|
||||||
|
|
||||||
// simplify DOM node check from `_.isEqual`
|
// simplify DOM node check from `_.isEqual`
|
||||||
source = source.replace(/(if *\(className *!= *objectClass).+?noNodeClass[\s\S]+?{/, '$1) {');
|
source = source.replace(/(if *\(className *!= *objectClass).+?noNodeClass[\s\S]+?{/, '$1) {');
|
||||||
|
|
||||||
// remove arguments juggling from `_.uniq`
|
// remove conditional `charCodeCallback` use from `_.max` and `_.min`
|
||||||
source = source.replace(matchFunction(source, 'uniq'), function(match) {
|
source = source.replace(/!callback *&& *isString\(collection\)[\s\S]+?: */g, '');
|
||||||
return match.replace(/(?: *\/\/.*\n)*( +)if *\(typeof isSorted[^}]+?}\n/, '');
|
|
||||||
});
|
|
||||||
|
|
||||||
// remove unused features from `createBound`
|
// remove unused features from `createBound`
|
||||||
if (buildMethods.indexOf('partial') == -1) {
|
if (buildMethods.indexOf('partial') == -1) {
|
||||||
@@ -1196,7 +1250,7 @@
|
|||||||
source = removeKeysOptimization(source);
|
source = removeKeysOptimization(source);
|
||||||
|
|
||||||
// remove `prototype` [[Enumerable]] fix from `_.keys`
|
// remove `prototype` [[Enumerable]] fix from `_.keys`
|
||||||
source = source.replace(/(?:\s*\/\/.*)*\n( +)if *\(.+?propertyIsEnumerable[\s\S]+?\n\1}/, '');
|
source = source.replace(/(?:\s*\/\/.*)*(\s*return *).+?propertyIsEnumerable[\s\S]+?: */, '$1');
|
||||||
|
|
||||||
// remove `prototype` [[Enumerable]] fix from `iteratorTemplate`
|
// remove `prototype` [[Enumerable]] fix from `iteratorTemplate`
|
||||||
source = source
|
source = source
|
||||||
@@ -1349,7 +1403,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
// replace `_.template`
|
// replace `_.template`
|
||||||
source = source.replace(/^( +)function template[\s\S]+?\n\1}/m, function() {
|
source = source.replace(/^( *)function template[\s\S]+?\n\1}/m, function() {
|
||||||
return [
|
return [
|
||||||
' function template(text, data, options) {',
|
' function template(text, data, options) {',
|
||||||
" text || (text = '');",
|
" text || (text = '');",
|
||||||
@@ -1357,7 +1411,7 @@
|
|||||||
'',
|
'',
|
||||||
' var index = 0,',
|
' var index = 0,',
|
||||||
' source = "__p += \'",',
|
' source = "__p += \'",',
|
||||||
" variable = options.variable;",
|
' variable = options.variable;',
|
||||||
'',
|
'',
|
||||||
' var reDelimiters = RegExp(',
|
' var reDelimiters = RegExp(',
|
||||||
" (options.escape || reNoMatch).source + '|' +",
|
" (options.escape || reNoMatch).source + '|' +",
|
||||||
@@ -1413,7 +1467,7 @@
|
|||||||
source = removeVar(source, 'hasObjectSpliceBug');
|
source = removeVar(source, 'hasObjectSpliceBug');
|
||||||
|
|
||||||
// remove `hasObjectSpliceBug` fix from the mutator Array functions mixin
|
// remove `hasObjectSpliceBug` fix from the mutator Array functions mixin
|
||||||
source = source.replace(/(?:\s*\/\/.*)*\n( +)if *\(hasObjectSpliceBug[\s\S]+?\n\1}/, '');
|
source = source.replace(/(?:\s*\/\/.*)*\n( *)if *\(hasObjectSpliceBug[\s\S]+?\n\1}/, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove `thisArg` from unexposed `forIn` and `forOwn`
|
// remove `thisArg` from unexposed `forIn` and `forOwn`
|
||||||
@@ -1434,10 +1488,10 @@
|
|||||||
.replace(/(?:\n +\/\*[^*]*\*+(?:[^\/][^*]*\*+)*\/)?\n *var (?:hasDontEnumBug|iteratesOwnLast|noArgsEnum).+\n/g, '');
|
.replace(/(?:\n +\/\*[^*]*\*+(?:[^\/][^*]*\*+)*\/)?\n *var (?:hasDontEnumBug|iteratesOwnLast|noArgsEnum).+\n/g, '');
|
||||||
|
|
||||||
// remove `iteratesOwnLast` from `isPlainObject`
|
// remove `iteratesOwnLast` from `isPlainObject`
|
||||||
source = source.replace(/(?:\s*\/\/.*)*\n( +)if *\(iteratesOwnLast[\s\S]+?\n\1}/, '');
|
source = source.replace(/(?:\s*\/\/.*)*\n( *)if *\(iteratesOwnLast[\s\S]+?\n\1}/, '');
|
||||||
|
|
||||||
// remove JScript [[DontEnum]] fix from `_.isEqual`
|
// remove JScript [[DontEnum]] fix from `_.isEqual`
|
||||||
source = source.replace(/(?:\s*\/\/.*)*\n( +)if *\(hasDontEnumBug[\s\S]+?\n\1}/, '');
|
source = source.replace(/(?:\s*\/\/.*)*\n( *)if *\(hasDontEnumBug[\s\S]+?\n\1}/, '');
|
||||||
|
|
||||||
// remove `noArraySliceOnStrings` from `_.toArray`
|
// remove `noArraySliceOnStrings` from `_.toArray`
|
||||||
source = source.replace(/noArraySliceOnStrings *\?[^:]+: *([^)]+)/g, '$1');
|
source = source.replace(/noArraySliceOnStrings *\?[^:]+: *([^)]+)/g, '$1');
|
||||||
@@ -1454,7 +1508,7 @@
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// inline `iteratorTemplate` template
|
// inline `iteratorTemplate` template
|
||||||
source = source.replace(/(( +)var iteratorTemplate *= *)[\s\S]+?\n\2.+?;\n/, (function() {
|
source = source.replace(/(( *)var iteratorTemplate *= *)[\s\S]+?\n\2.+?;\n/, (function() {
|
||||||
var snippet = getFunctionSource(lodash._iteratorTemplate);
|
var snippet = getFunctionSource(lodash._iteratorTemplate);
|
||||||
|
|
||||||
// prepend data object references to property names to avoid having to
|
// prepend data object references to property names to avoid having to
|
||||||
@@ -1514,16 +1568,16 @@
|
|||||||
isNode = exportsOptions.indexOf('node') > -1;
|
isNode = exportsOptions.indexOf('node') > -1;
|
||||||
|
|
||||||
if (!isAMD) {
|
if (!isAMD) {
|
||||||
source = source.replace(/(?: *\/\/.*\n)*( +)if *\(typeof +define[\s\S]+?else /, '$1');
|
source = source.replace(/(?: *\/\/.*\n)*( *)if *\(typeof +define[\s\S]+?else /, '$1');
|
||||||
}
|
}
|
||||||
if (!isNode) {
|
if (!isNode) {
|
||||||
source = source.replace(/(?: *\/\/.*\n)*( +)if *\(typeof +module[\s\S]+?else *{([\s\S]+?\n)\1}\n/, '$1$2');
|
source = source.replace(/(?: *\/\/.*\n)*( *)if *\(typeof +module[\s\S]+?else *{([\s\S]+?\n)\1}\n/, '$1$2');
|
||||||
}
|
}
|
||||||
if (!isCommonJS) {
|
if (!isCommonJS) {
|
||||||
source = source.replace(/(?: *\/\/.*\n)*(?:( +)else *{)?\s*freeExports\.\w+ *=[\s\S]+?(?:\n\1})?\n/, '');
|
source = source.replace(/(?: *\/\/.*\n)*(?:( *)else *{)?\s*freeExports\.\w+ *=[\s\S]+?(?:\n\1})?\n/, '');
|
||||||
}
|
}
|
||||||
if (!isGlobal) {
|
if (!isGlobal) {
|
||||||
source = source.replace(/(?:( +)(})? *else(?: *if *\(_\))? *{)?(?:\s*\/\/.*)*\s*(?:window\._|_\.templates) *=[\s\S]+?(?:\n\1})?\n/g, '$1$2\n');
|
source = source.replace(/(?:( *)(})? *else(?: *if *\(_\))? *{)?(?:\s*\/\/.*)*\s*(?:window\._|_\.templates) *=[\s\S]+?(?:\n\1})?\n/g, '$1$2\n');
|
||||||
}
|
}
|
||||||
// remove `if (freeExports) {...}` if it's empty
|
// remove `if (freeExports) {...}` if it's empty
|
||||||
if (isAMD && isGlobal) {
|
if (isAMD && isGlobal) {
|
||||||
|
|||||||
220
build/minify.js
220
build/minify.js
@@ -15,15 +15,18 @@
|
|||||||
var closurePath = path.join(basePath, 'vendor', 'closure-compiler', 'compiler.jar');
|
var closurePath = path.join(basePath, 'vendor', 'closure-compiler', 'compiler.jar');
|
||||||
|
|
||||||
/** Load other modules */
|
/** Load other modules */
|
||||||
var preprocess = require('./pre-compile'),
|
var preprocess = require('./pre-compile.js'),
|
||||||
postprocess = require('./post-compile'),
|
postprocess = require('./post-compile.js'),
|
||||||
uglifyJS = require('../vendor/uglifyjs/uglify-js');
|
uglifyJS = require('../vendor/uglifyjs/uglify-js.js');
|
||||||
|
|
||||||
/** The Closure Compiler command-line options */
|
/** The Closure Compiler command-line options */
|
||||||
var closureOptions = [
|
var closureOptions = ['--warning_level=QUIET'];
|
||||||
'--compilation_level=ADVANCED_OPTIMIZATIONS',
|
|
||||||
'--warning_level=QUIET'
|
/** The Closure Compiler optimization modes */
|
||||||
];
|
var optimizationModes = {
|
||||||
|
'simple': 'SIMPLE_OPTIMIZATIONS',
|
||||||
|
'advanced': 'ADVANCED_OPTIMIZATIONS'
|
||||||
|
};
|
||||||
|
|
||||||
/** Reassign `existsSync` for older versions of Node */
|
/** Reassign `existsSync` for older versions of Node */
|
||||||
fs.existsSync || (fs.existsSync = path.existsSync);
|
fs.existsSync || (fs.existsSync = path.existsSync);
|
||||||
@@ -97,9 +100,10 @@
|
|||||||
options = source || options;
|
options = source || options;
|
||||||
source = options.source || '';
|
source = options.source || '';
|
||||||
}
|
}
|
||||||
this.compiled = {};
|
this.compiled = { 'simple': {}, 'advanced': {} };
|
||||||
this.hybrid = {};
|
this.hybrid = { 'simple': {}, 'advanced': {} };
|
||||||
this.uglified = {};
|
this.uglified = {};
|
||||||
|
|
||||||
this.isSilent = !!options.isSilent;
|
this.isSilent = !!options.isSilent;
|
||||||
this.isTemplate = !!options.isTemplate;
|
this.isTemplate = !!options.isTemplate;
|
||||||
this.outputPath = options.outputPath;
|
this.outputPath = options.outputPath;
|
||||||
@@ -112,7 +116,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
// begin the minification process
|
// begin the minification process
|
||||||
closureCompile.call(this, source, onClosureCompile.bind(this));
|
closureCompile.call(this, source, 'simple', onClosureSimpleCompile.bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
@@ -123,33 +127,21 @@
|
|||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {String} source The JavaScript source to minify.
|
* @param {String} source The JavaScript source to minify.
|
||||||
* @param {String} [message] The message to log.
|
* @param {String} mode The optimization mode.
|
||||||
* @param {Function} callback The function called once the process has completed.
|
* @param {Function} callback The function called once the process has completed.
|
||||||
*/
|
*/
|
||||||
function closureCompile(source, message, callback) {
|
function closureCompile(source, mode, callback) {
|
||||||
var options = closureOptions.slice();
|
|
||||||
|
|
||||||
// use simple optimizations when minifying template files
|
// use simple optimizations when minifying template files
|
||||||
if (this.isTemplate) {
|
var options = closureOptions.slice();
|
||||||
options = options.map(function(value) {
|
options.push('--compilation_level=' + optimizationModes[this.isTemplate ? 'simple' : mode]);
|
||||||
return value.replace(/^(--compilation_level)=.+$/, '$1=SIMPLE_OPTIMIZATIONS');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
// the standard error stream, standard output stream, and the Closure Compiler process
|
// the standard error stream, standard output stream, and the Closure Compiler process
|
||||||
var error = '',
|
var error = '',
|
||||||
output = '',
|
output = '',
|
||||||
compiler = spawn('java', ['-jar', closurePath].concat(options));
|
compiler = spawn('java', ['-jar', closurePath].concat(options));
|
||||||
|
|
||||||
// juggle arguments
|
|
||||||
if (typeof message == 'function') {
|
|
||||||
callback = message;
|
|
||||||
message = null;
|
|
||||||
}
|
|
||||||
if (!this.isSilent) {
|
if (!this.isSilent) {
|
||||||
console.log(message == null
|
console.log('Compressing ' + path.basename(this.outputPath, '.js') + ' using the Closure Compiler (' + mode + ')...');
|
||||||
? 'Compressing ' + path.basename(this.outputPath, '.js') + ' using the Closure Compiler...'
|
|
||||||
: message
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
compiler.stdout.on('data', function(data) {
|
compiler.stdout.on('data', function(data) {
|
||||||
// append the data to the output stream
|
// append the data to the output stream
|
||||||
@@ -162,9 +154,8 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
compiler.on('exit', function(status) {
|
compiler.on('exit', function(status) {
|
||||||
var exception = null;
|
|
||||||
|
|
||||||
// `status` contains the process exit code
|
// `status` contains the process exit code
|
||||||
|
var exception = null;
|
||||||
if (status) {
|
if (status) {
|
||||||
exception = new Error(error);
|
exception = new Error(error);
|
||||||
exception.status = status;
|
exception.status = status;
|
||||||
@@ -183,24 +174,16 @@
|
|||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {String} source The JavaScript source to minify.
|
* @param {String} source The JavaScript source to minify.
|
||||||
* @param {String} [message] The message to log.
|
* @param {String} label The label to log.
|
||||||
* @param {Function} callback The function called once the process has completed.
|
* @param {Function} callback The function called once the process has completed.
|
||||||
*/
|
*/
|
||||||
function uglify(source, message, callback) {
|
function uglify(source, label, callback) {
|
||||||
var exception,
|
var exception,
|
||||||
result,
|
result,
|
||||||
ugly = uglifyJS.uglify;
|
ugly = uglifyJS.uglify;
|
||||||
|
|
||||||
// juggle arguments
|
|
||||||
if (typeof message == 'function') {
|
|
||||||
callback = message;
|
|
||||||
message = null;
|
|
||||||
}
|
|
||||||
if (!this.isSilent) {
|
if (!this.isSilent) {
|
||||||
console.log(message == null
|
console.log('Compressing ' + path.basename(this.outputPath, '.js') + ' using ' + label + '...');
|
||||||
? 'Compressing ' + path.basename(this.outputPath, '.js') + ' using UglifyJS...'
|
|
||||||
: message
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
result = ugly.gen_code(
|
result = ugly.gen_code(
|
||||||
@@ -225,44 +208,79 @@
|
|||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The `closureCompile()` callback.
|
* The Closure Compiler callback for simple optimizations.
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {Object|Undefined} exception The error object.
|
* @param {Object|Undefined} exception The error object.
|
||||||
* @param {String} result The resulting minified source.
|
* @param {String} result The resulting minified source.
|
||||||
*/
|
*/
|
||||||
function onClosureCompile(exception, result) {
|
function onClosureSimpleCompile(exception, result) {
|
||||||
if (exception) {
|
if (exception) {
|
||||||
throw exception;
|
throw exception;
|
||||||
}
|
}
|
||||||
// store the post-processed Closure Compiler result and gzip it
|
result = postprocess(result);
|
||||||
this.compiled.source = result = postprocess(result);
|
this.compiled.simple.source = result;
|
||||||
gzip(result, onClosureGzip.bind(this));
|
gzip(result, onClosureSimpleGzip.bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Closure Compiler `gzip` callback.
|
* The Closure Compiler `gzip` callback for simple optimizations.
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {Object|Undefined} exception The error object.
|
* @param {Object|Undefined} exception The error object.
|
||||||
* @param {Buffer} result The resulting gzipped source.
|
* @param {Buffer} result The resulting gzipped source.
|
||||||
*/
|
*/
|
||||||
function onClosureGzip(exception, result) {
|
function onClosureSimpleGzip(exception, result) {
|
||||||
if (exception) {
|
if (exception) {
|
||||||
throw exception;
|
throw exception;
|
||||||
}
|
}
|
||||||
if (!this.isSilent) {
|
if (!this.isSilent) {
|
||||||
console.log('Done. Size: %d bytes.', result.length);
|
console.log('Done. Size: %d bytes.', result.length);
|
||||||
}
|
}
|
||||||
// store the gzipped result and report the size
|
this.compiled.simple.gzip = result;
|
||||||
this.compiled.gzip = result;
|
|
||||||
|
|
||||||
// next, minify the source using only UglifyJS
|
// next, compile the source using advanced optimizations
|
||||||
uglify.call(this, this.source, onUglify.bind(this));
|
closureCompile.call(this, this.source, 'advanced', onClosureAdvancedCompile.bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The `uglify()` callback.
|
* The Closure Compiler callback for advanced optimizations.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {Object|Undefined} exception The error object.
|
||||||
|
* @param {String} result The resulting minified source.
|
||||||
|
*/
|
||||||
|
function onClosureAdvancedCompile(exception, result) {
|
||||||
|
if (exception) {
|
||||||
|
throw exception;
|
||||||
|
}
|
||||||
|
result = postprocess(result);
|
||||||
|
this.compiled.advanced.source = result;
|
||||||
|
gzip(result, onClosureAdvancedGzip.bind(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Closure Compiler `gzip` callback for advanced optimizations.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {Object|Undefined} exception The error object.
|
||||||
|
* @param {Buffer} result The resulting gzipped source.
|
||||||
|
*/
|
||||||
|
function onClosureAdvancedGzip(exception, result) {
|
||||||
|
if (exception) {
|
||||||
|
throw exception;
|
||||||
|
}
|
||||||
|
if (!this.isSilent) {
|
||||||
|
console.log('Done. Size: %d bytes.', result.length);
|
||||||
|
}
|
||||||
|
this.compiled.advanced.gzip = result;
|
||||||
|
|
||||||
|
// next, minify the source using only UglifyJS
|
||||||
|
uglify.call(this, this.source, 'UglifyJS', onUglify.bind(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The UglifyJS callback.
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {Object|Undefined} exception The error object.
|
* @param {Object|Undefined} exception The error object.
|
||||||
@@ -272,8 +290,8 @@
|
|||||||
if (exception) {
|
if (exception) {
|
||||||
throw exception;
|
throw exception;
|
||||||
}
|
}
|
||||||
// store the post-processed Uglified result and gzip it
|
result = postprocess(result);
|
||||||
this.uglified.source = result = postprocess(result);
|
this.uglified.source = result;
|
||||||
gzip(result, onUglifyGzip.bind(this));
|
gzip(result, onUglifyGzip.bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -291,74 +309,112 @@
|
|||||||
if (!this.isSilent) {
|
if (!this.isSilent) {
|
||||||
console.log('Done. Size: %d bytes.', result.length);
|
console.log('Done. Size: %d bytes.', result.length);
|
||||||
}
|
}
|
||||||
var message = 'Compressing ' + path.basename(this.outputPath, '.js') + ' using hybrid minification...';
|
|
||||||
|
|
||||||
// store the gzipped result and report the size
|
|
||||||
this.uglified.gzip = result;
|
this.uglified.gzip = result;
|
||||||
|
|
||||||
// next, minify the Closure Compiler minified source using UglifyJS
|
// next, minify the already Closure Compiler simple optimized source using UglifyJS
|
||||||
uglify.call(this, this.compiled.source, message, onHybrid.bind(this));
|
uglify.call(this, this.compiled.simple.source, 'hybrid (simple)', onSimpleHybrid.bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The hybrid `uglify()` callback.
|
* The hybrid callback for simple optimizations.
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {Object|Undefined} exception The error object.
|
* @param {Object|Undefined} exception The error object.
|
||||||
* @param {String} result The resulting minified source.
|
* @param {String} result The resulting minified source.
|
||||||
*/
|
*/
|
||||||
function onHybrid(exception, result) {
|
function onSimpleHybrid(exception, result) {
|
||||||
if (exception) {
|
if (exception) {
|
||||||
throw exception;
|
throw exception;
|
||||||
}
|
}
|
||||||
// store the post-processed Uglified result and gzip it
|
result = postprocess(result);
|
||||||
this.hybrid.source = result = postprocess(result);
|
this.hybrid.simple.source = result;
|
||||||
gzip(result, onHybridGzip.bind(this));
|
gzip(result, onSimpleHybridGzip.bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The hybrid `gzip` callback.
|
* The hybrid `gzip` callback for simple optimizations.
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {Object|Undefined} exception The error object.
|
* @param {Object|Undefined} exception The error object.
|
||||||
* @param {Buffer} result The resulting gzipped source.
|
* @param {Buffer} result The resulting gzipped source.
|
||||||
*/
|
*/
|
||||||
function onHybridGzip(exception, result) {
|
function onSimpleHybridGzip(exception, result) {
|
||||||
if (exception) {
|
if (exception) {
|
||||||
throw exception;
|
throw exception;
|
||||||
}
|
}
|
||||||
if (!this.isSilent) {
|
if (!this.isSilent) {
|
||||||
console.log('Done. Size: %d bytes.', result.length);
|
console.log('Done. Size: %d bytes.', result.length);
|
||||||
}
|
}
|
||||||
// store the gzipped result and report the size
|
this.hybrid.simple.gzip = result;
|
||||||
this.hybrid.gzip = result;
|
|
||||||
|
// next, minify the already Closure Compiler advance optimized source using UglifyJS
|
||||||
|
uglify.call(this, this.compiled.advanced.source, 'hybrid (advanced)', onAdvancedHybrid.bind(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The hybrid callback for advanced optimizations.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {Object|Undefined} exception The error object.
|
||||||
|
* @param {String} result The resulting minified source.
|
||||||
|
*/
|
||||||
|
function onAdvancedHybrid(exception, result) {
|
||||||
|
if (exception) {
|
||||||
|
throw exception;
|
||||||
|
}
|
||||||
|
result = postprocess(result);
|
||||||
|
this.hybrid.advanced.source = result;
|
||||||
|
gzip(result, onAdvancedHybridGzip.bind(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The hybrid `gzip` callback for advanced optimizations.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {Object|Undefined} exception The error object.
|
||||||
|
* @param {Buffer} result The resulting gzipped source.
|
||||||
|
*/
|
||||||
|
function onAdvancedHybridGzip(exception, result) {
|
||||||
|
if (exception) {
|
||||||
|
throw exception;
|
||||||
|
}
|
||||||
|
if (!this.isSilent) {
|
||||||
|
console.log('Done. Size: %d bytes.', result.length);
|
||||||
|
}
|
||||||
|
this.hybrid.advanced.gzip = result;
|
||||||
|
|
||||||
// finish by choosing the smallest compressed file
|
// finish by choosing the smallest compressed file
|
||||||
onComplete.call(this);
|
onComplete.call(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The callback executed after JavaScript source is minified and gzipped.
|
* The callback executed after the source is minified and gzipped.
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
function onComplete() {
|
function onComplete() {
|
||||||
var compiled = this.compiled,
|
var compiledSimple = this.compiled.simple,
|
||||||
hybrid = this.hybrid,
|
compiledAdvanced = this.compiled.advanced,
|
||||||
uglified = this.uglified;
|
uglified = this.uglified,
|
||||||
|
hybridSimple = this.hybrid.simple,
|
||||||
|
hybridAdvanced = this.hybrid.advanced;
|
||||||
|
|
||||||
// select the smallest gzipped file and use its minified counterpart as the
|
// select the smallest gzipped file and use its minified counterpart as the
|
||||||
// official minified release (ties go to the Closure Compiler)
|
// official minified release (ties go to the Closure Compiler)
|
||||||
var min = Math.min(compiled.gzip.length, hybrid.gzip.length, uglified.gzip.length);
|
var min = Math.min(
|
||||||
|
compiledSimple.gzip.length,
|
||||||
// pass the minified source to the minify instances "onComplete" callback
|
compiledAdvanced.gzip.length,
|
||||||
this.onComplete(
|
uglified.gzip.length,
|
||||||
compiled.gzip.length == min
|
hybridSimple.gzip.length,
|
||||||
? compiled.source
|
hybridAdvanced.gzip.length
|
||||||
: uglified.gzip.length == min
|
|
||||||
? uglified.source
|
|
||||||
: hybrid.source
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// pass the minified source to the "onComplete" callback
|
||||||
|
[compiledSimple, compiledAdvanced, uglified, hybridSimple, hybridAdvanced].some(function(data) {
|
||||||
|
if (data.gzip.length == min) {
|
||||||
|
this.onComplete(data.source);
|
||||||
|
}
|
||||||
|
}, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|||||||
@@ -29,13 +29,8 @@
|
|||||||
// move vars exposed by the Closure Compiler into the IIFE
|
// move vars exposed by the Closure Compiler into the IIFE
|
||||||
source = source.replace(/^((?:(['"])use strict\2;)?(?:var (?:[a-z]+=(?:!0|!1|null)[,;])+)?)([\s\S]*?function[^)]+\){)/, '$3$1');
|
source = source.replace(/^((?:(['"])use strict\2;)?(?:var (?:[a-z]+=(?:!0|!1|null)[,;])+)?)([\s\S]*?function[^)]+\){)/, '$3$1');
|
||||||
|
|
||||||
// avoid bugs with the Closure Compiler
|
// 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}');
|
||||||
// correct overly aggressive Closure Compiler minification
|
|
||||||
.replace(/prototype\s*=\s*{\s*valueOf\s*:\s*1\s*}/, 'prototype={valueOf:1,y:1}')
|
|
||||||
// restore `arrayRef` and `objectRef` values modified by pre-compile.js
|
|
||||||
.replace(/= *Array.prototype/, '=[]')
|
|
||||||
.replace(/= *Object.prototype/, '={}');
|
|
||||||
|
|
||||||
// unescape properties (i.e. foo["bar"] => foo.bar)
|
// unescape properties (i.e. foo["bar"] => foo.bar)
|
||||||
source = source.replace(/(\w)\["([^."]+)"\]/g, function(match, left, right) {
|
source = source.replace(/(\w)\["([^."]+)"\]/g, function(match, left, right) {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
fs = require('fs'),
|
fs = require('fs'),
|
||||||
https = require('https'),
|
https = require('https'),
|
||||||
path = require('path'),
|
path = require('path'),
|
||||||
tar = require('tar'),
|
tar = require('../vendor/tar/tar.js'),
|
||||||
zlib = require('zlib');
|
zlib = require('zlib');
|
||||||
|
|
||||||
/** The path of the directory that is the base of the repository */
|
/** The path of the directory that is the base of the repository */
|
||||||
@@ -76,8 +76,8 @@
|
|||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
exec('npm -g root', function(exception, stdout, stderr) {
|
exec('npm -g root', function(exception, stdout) {
|
||||||
if (exception || stderr) {
|
if (exception) {
|
||||||
console.error('There was a problem loading the npm registry.');
|
console.error('There was a problem loading the npm registry.');
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
'hasOwnProperty',
|
'hasOwnProperty',
|
||||||
'index',
|
'index',
|
||||||
'isArguments',
|
'isArguments',
|
||||||
|
'isString',
|
||||||
'iteratee',
|
'iteratee',
|
||||||
'length',
|
'length',
|
||||||
'nativeKeys',
|
'nativeKeys',
|
||||||
@@ -26,9 +27,7 @@
|
|||||||
'propertyIsEnumerable',
|
'propertyIsEnumerable',
|
||||||
'result',
|
'result',
|
||||||
'skipProto',
|
'skipProto',
|
||||||
'stringClass',
|
|
||||||
'thisArg',
|
'thisArg',
|
||||||
'toString',
|
|
||||||
'value'
|
'value'
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -216,11 +215,6 @@
|
|||||||
// remove copyright to add later in post-compile.js
|
// remove copyright to add later in post-compile.js
|
||||||
source = source.replace(/\/\*![\s\S]+?\*\//, '');
|
source = source.replace(/\/\*![\s\S]+?\*\//, '');
|
||||||
|
|
||||||
// replace `arrayRef` and `objectRef` values to avoid a bug in the Closure Compiler
|
|
||||||
source = source
|
|
||||||
.replace(/(arrayRef *= *)\[\]/, '$1Array.prototype')
|
|
||||||
.replace(/(objectRef *= *)\{\}/, '$1Object.prototype');
|
|
||||||
|
|
||||||
// add brackets to whitelisted properties so the Closure Compiler won't mung them
|
// add brackets to whitelisted properties so the Closure Compiler won't mung them
|
||||||
// http://code.google.com/closure/compiler/docs/api-tutorial3.html#export
|
// http://code.google.com/closure/compiler/docs/api-tutorial3.html#export
|
||||||
source = source.replace(RegExp('\\.(' + propWhitelist.join('|') + ')\\b', 'g'), "['$1']");
|
source = source.replace(RegExp('\\.(' + propWhitelist.join('|') + ')\\b', 'g'), "['$1']");
|
||||||
|
|||||||
262
doc/README.md
262
doc/README.md
@@ -1,4 +1,4 @@
|
|||||||
# Lo-Dash <sup>v0.9.1</sup>
|
# Lo-Dash <sup>v0.9.2</sup>
|
||||||
|
|
||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
@@ -8,20 +8,20 @@
|
|||||||
## <a id="Arrays"></a>`Arrays`
|
## <a id="Arrays"></a>`Arrays`
|
||||||
* [`_.compact`](#_compactarray)
|
* [`_.compact`](#_compactarray)
|
||||||
* [`_.difference`](#_differencearray--array1-array2-)
|
* [`_.difference`](#_differencearray--array1-array2-)
|
||||||
* [`_.drop`](#_restarray--n)
|
* [`_.drop`](#_restarray--n1)
|
||||||
* [`_.first`](#_firstarray--n)
|
* [`_.first`](#_firstarray--n)
|
||||||
* [`_.flatten`](#_flattenarray-shallow)
|
* [`_.flatten`](#_flattenarray-shallow)
|
||||||
* [`_.head`](#_firstarray--n)
|
* [`_.head`](#_firstarray--n)
|
||||||
* [`_.indexOf`](#_indexofarray-value--fromindex0)
|
* [`_.indexOf`](#_indexofarray-value--fromindex0)
|
||||||
* [`_.initial`](#_initialarray--n)
|
* [`_.initial`](#_initialarray--n1)
|
||||||
* [`_.intersection`](#_intersectionarray1-array2-)
|
* [`_.intersection`](#_intersectionarray1-array2-)
|
||||||
* [`_.last`](#_lastarray--n)
|
* [`_.last`](#_lastarray--n)
|
||||||
* [`_.lastIndexOf`](#_lastindexofarray-value--fromindexarraylength-1)
|
* [`_.lastIndexOf`](#_lastindexofarray-value--fromindexarraylength-1)
|
||||||
* [`_.object`](#_objectkeys--values)
|
* [`_.object`](#_objectkeys--values)
|
||||||
* [`_.range`](#_rangestart0-end--step1)
|
* [`_.range`](#_rangestart0-end--step1)
|
||||||
* [`_.rest`](#_restarray--n)
|
* [`_.rest`](#_restarray--n1)
|
||||||
* [`_.sortedIndex`](#_sortedindexarray-value--callbackidentityproperty-thisarg)
|
* [`_.sortedIndex`](#_sortedindexarray-value--callbackidentityproperty-thisarg)
|
||||||
* [`_.tail`](#_restarray--n)
|
* [`_.tail`](#_restarray--n1)
|
||||||
* [`_.take`](#_firstarray--n)
|
* [`_.take`](#_firstarray--n)
|
||||||
* [`_.union`](#_unionarray1-array2-)
|
* [`_.union`](#_unionarray1-array2-)
|
||||||
* [`_.uniq`](#_uniqarray--issortedfalse-callbackidentity-thisarg)
|
* [`_.uniq`](#_uniqarray--issortedfalse-callbackidentity-thisarg)
|
||||||
@@ -50,7 +50,7 @@
|
|||||||
* [`_.all`](#_everycollection--callbackidentity-thisarg)
|
* [`_.all`](#_everycollection--callbackidentity-thisarg)
|
||||||
* [`_.any`](#_somecollection--callbackidentity-thisarg)
|
* [`_.any`](#_somecollection--callbackidentity-thisarg)
|
||||||
* [`_.collect`](#_mapcollection--callbackidentity-thisarg)
|
* [`_.collect`](#_mapcollection--callbackidentity-thisarg)
|
||||||
* [`_.contains`](#_containscollection-target)
|
* [`_.contains`](#_containscollection-target--fromindex0)
|
||||||
* [`_.countBy`](#_countbycollection-callbackproperty--thisarg)
|
* [`_.countBy`](#_countbycollection-callbackproperty--thisarg)
|
||||||
* [`_.detect`](#_findcollection-callback--thisarg)
|
* [`_.detect`](#_findcollection-callback--thisarg)
|
||||||
* [`_.each`](#_foreachcollection-callback--thisarg)
|
* [`_.each`](#_foreachcollection-callback--thisarg)
|
||||||
@@ -61,7 +61,7 @@
|
|||||||
* [`_.foldr`](#_reducerightcollection-callback--accumulator-thisarg)
|
* [`_.foldr`](#_reducerightcollection-callback--accumulator-thisarg)
|
||||||
* [`_.forEach`](#_foreachcollection-callback--thisarg)
|
* [`_.forEach`](#_foreachcollection-callback--thisarg)
|
||||||
* [`_.groupBy`](#_groupbycollection-callbackproperty--thisarg)
|
* [`_.groupBy`](#_groupbycollection-callbackproperty--thisarg)
|
||||||
* [`_.include`](#_containscollection-target)
|
* [`_.include`](#_containscollection-target--fromindex0)
|
||||||
* [`_.inject`](#_reducecollection-callback--accumulator-thisarg)
|
* [`_.inject`](#_reducecollection-callback--accumulator-thisarg)
|
||||||
* [`_.invoke`](#_invokecollection-methodname--arg1-arg2-)
|
* [`_.invoke`](#_invokecollection-methodname--arg1-arg2-)
|
||||||
* [`_.map`](#_mapcollection--callbackidentity-thisarg)
|
* [`_.map`](#_mapcollection--callbackidentity-thisarg)
|
||||||
@@ -184,7 +184,7 @@
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_compactarray"></a>`_.compact(array)`
|
### <a id="_compactarray"></a>`_.compact(array)`
|
||||||
<a href="#_compactarray">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2496 "View in source") [Ⓣ][1]
|
<a href="#_compactarray">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2554 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates an array with all falsey values of `array` removed. The values `false`, `null`, `0`, `""`, `undefined` and `NaN` are all falsey.
|
Creates an array with all falsey values of `array` removed. The values `false`, `null`, `0`, `""`, `undefined` and `NaN` are all falsey.
|
||||||
|
|
||||||
@@ -208,7 +208,7 @@ _.compact([0, 1, false, 2, '', 3]);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_differencearray--array1-array2-"></a>`_.difference(array [, array1, array2, ...])`
|
### <a id="_differencearray--array1-array2-"></a>`_.difference(array [, array1, array2, ...])`
|
||||||
<a href="#_differencearray--array1-array2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2526 "View in source") [Ⓣ][1]
|
<a href="#_differencearray--array1-array2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2584 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates an array of `array` elements not present in the other arrays using strict equality for comparisons, i.e. `===`.
|
Creates an array of `array` elements not present in the other arrays using strict equality for comparisons, i.e. `===`.
|
||||||
|
|
||||||
@@ -233,7 +233,7 @@ _.difference([1, 2, 3, 4, 5], [5, 2, 10]);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_firstarray--n"></a>`_.first(array [, n])`
|
### <a id="_firstarray--n"></a>`_.first(array [, n])`
|
||||||
<a href="#_firstarray--n">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2561 "View in source") [Ⓣ][1]
|
<a href="#_firstarray--n">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2619 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Gets the first element of the `array`. Pass `n` to return the first `n` elements of the `array`.
|
Gets the first element of the `array`. Pass `n` to return the first `n` elements of the `array`.
|
||||||
|
|
||||||
@@ -261,7 +261,7 @@ _.first([5, 4, 3, 2, 1]);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_flattenarray-shallow"></a>`_.flatten(array, shallow)`
|
### <a id="_flattenarray-shallow"></a>`_.flatten(array, shallow)`
|
||||||
<a href="#_flattenarray-shallow">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2585 "View in source") [Ⓣ][1]
|
<a href="#_flattenarray-shallow">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2643 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Flattens a nested array *(the nesting can be to any depth)*. If `shallow` is truthy, `array` will only be flattened a single level.
|
Flattens a nested array *(the nesting can be to any depth)*. If `shallow` is truthy, `array` will only be flattened a single level.
|
||||||
|
|
||||||
@@ -289,14 +289,14 @@ _.flatten([1, [2], [3, [[4]]]], true);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_indexofarray-value--fromindex0"></a>`_.indexOf(array, value [, fromIndex=0])`
|
### <a id="_indexofarray-value--fromindex0"></a>`_.indexOf(array, value [, fromIndex=0])`
|
||||||
<a href="#_indexofarray-value--fromindex0">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2627 "View in source") [Ⓣ][1]
|
<a href="#_indexofarray-value--fromindex0">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2685 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Gets the index at which the first occurrence of `value` is found using strict equality for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` for `fromIndex` will run a faster binary search.
|
Gets the index at which the first occurrence of `value` is found using strict equality for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` for `fromIndex` will run a faster binary search.
|
||||||
|
|
||||||
#### Arguments
|
#### Arguments
|
||||||
1. `array` *(Array)*: The array to search.
|
1. `array` *(Array)*: The array to search.
|
||||||
2. `value` *(Mixed)*: The value to search for.
|
2. `value` *(Mixed)*: The value to search for.
|
||||||
3. `[fromIndex=0]` *(Boolean|Number)*: The index to start searching from or `true` to perform a binary search on a sorted `array`.
|
3. `[fromIndex=0]` *(Boolean|Number)*: The index to search from or `true` to perform a binary search on a sorted `array`.
|
||||||
|
|
||||||
#### Returns
|
#### Returns
|
||||||
*(Number)*: Returns the index of the matched value or `-1`.
|
*(Number)*: Returns the index of the matched value or `-1`.
|
||||||
@@ -320,14 +320,14 @@ _.indexOf([1, 1, 2, 2, 3, 3], 2, true);
|
|||||||
|
|
||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_initialarray--n"></a>`_.initial(array [, n])`
|
### <a id="_initialarray--n1"></a>`_.initial(array [, n=1])`
|
||||||
<a href="#_initialarray--n">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2662 "View in source") [Ⓣ][1]
|
<a href="#_initialarray--n1">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2720 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Gets all but the last element of `array`. Pass `n` to exclude the last `n` elements from the result.
|
Gets all but the last element of `array`. Pass `n` to exclude the last `n` elements from the result.
|
||||||
|
|
||||||
#### Arguments
|
#### Arguments
|
||||||
1. `array` *(Array)*: The array to query.
|
1. `array` *(Array)*: The array to query.
|
||||||
2. `[n]` *(Number)*: The number of elements to return.
|
2. `[n=1]` *(Number)*: The number of elements to exclude.
|
||||||
|
|
||||||
#### Returns
|
#### Returns
|
||||||
*(Array)*: Returns all but the last element or `n` elements of `array`.
|
*(Array)*: Returns all but the last element or `n` elements of `array`.
|
||||||
@@ -346,7 +346,7 @@ _.initial([3, 2, 1]);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_intersectionarray1-array2-"></a>`_.intersection([array1, array2, ...])`
|
### <a id="_intersectionarray1-array2-"></a>`_.intersection([array1, array2, ...])`
|
||||||
<a href="#_intersectionarray1-array2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2683 "View in source") [Ⓣ][1]
|
<a href="#_intersectionarray1-array2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2741 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Computes the intersection of all the passed-in arrays using strict equality for comparisons, i.e. `===`.
|
Computes the intersection of all the passed-in arrays using strict equality for comparisons, i.e. `===`.
|
||||||
|
|
||||||
@@ -370,7 +370,7 @@ _.intersection([1, 2, 3], [101, 2, 1, 10], [2, 1]);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_lastarray--n"></a>`_.last(array [, n])`
|
### <a id="_lastarray--n"></a>`_.last(array [, n])`
|
||||||
<a href="#_lastarray--n">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2721 "View in source") [Ⓣ][1]
|
<a href="#_lastarray--n">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2779 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Gets the last element of the `array`. Pass `n` to return the last `n` elements of the `array`.
|
Gets the last element of the `array`. Pass `n` to return the last `n` elements of the `array`.
|
||||||
|
|
||||||
@@ -395,14 +395,14 @@ _.last([3, 2, 1]);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_lastindexofarray-value--fromindexarraylength-1"></a>`_.lastIndexOf(array, value [, fromIndex=array.length-1])`
|
### <a id="_lastindexofarray-value--fromindexarraylength-1"></a>`_.lastIndexOf(array, value [, fromIndex=array.length-1])`
|
||||||
<a href="#_lastindexofarray-value--fromindexarraylength-1">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2747 "View in source") [Ⓣ][1]
|
<a href="#_lastindexofarray-value--fromindexarraylength-1">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2806 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Gets the index at which the last occurrence of `value` is found using strict equality for comparisons, i.e. `===`.
|
Gets the index at which the last occurrence of `value` is found using strict equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the offset from the end of the collection.
|
||||||
|
|
||||||
#### Arguments
|
#### Arguments
|
||||||
1. `array` *(Array)*: The array to search.
|
1. `array` *(Array)*: The array to search.
|
||||||
2. `value` *(Mixed)*: The value to search for.
|
2. `value` *(Mixed)*: The value to search for.
|
||||||
3. `[fromIndex=array.length-1]` *(Number)*: The index to start searching from.
|
3. `[fromIndex=array.length-1]` *(Number)*: The index to search from.
|
||||||
|
|
||||||
#### Returns
|
#### Returns
|
||||||
*(Number)*: Returns the index of the matched value or `-1`.
|
*(Number)*: Returns the index of the matched value or `-1`.
|
||||||
@@ -424,7 +424,7 @@ _.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_objectkeys--values"></a>`_.object(keys [, values=[]])`
|
### <a id="_objectkeys--values"></a>`_.object(keys [, values=[]])`
|
||||||
<a href="#_objectkeys--values">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2777 "View in source") [Ⓣ][1]
|
<a href="#_objectkeys--values">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2836 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates an object composed from arrays of `keys` and `values`. Pass either a single two dimensional array, i.e. `[[key1, value1], [key2, value2]]`, or two arrays, one of `keys` and one of corresponding `values`.
|
Creates an object composed from arrays of `keys` and `values`. Pass either a single two dimensional array, i.e. `[[key1, value1], [key2, value2]]`, or two arrays, one of `keys` and one of corresponding `values`.
|
||||||
|
|
||||||
@@ -449,7 +449,7 @@ _.object(['moe', 'larry', 'curly'], [30, 40, 50]);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_rangestart0-end--step1"></a>`_.range([start=0], end [, step=1])`
|
### <a id="_rangestart0-end--step1"></a>`_.range([start=0], end [, step=1])`
|
||||||
<a href="#_rangestart0-end--step1">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2822 "View in source") [Ⓣ][1]
|
<a href="#_rangestart0-end--step1">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2881 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates an array of numbers *(positive and/or negative)* progressing from `start` up to but not including `stop`. This method is a port of Python's `range()` function. See http://docs.python.org/library/functions.html#range.
|
Creates an array of numbers *(positive and/or negative)* progressing from `start` up to but not including `stop`. This method is a port of Python's `range()` function. See http://docs.python.org/library/functions.html#range.
|
||||||
|
|
||||||
@@ -486,8 +486,8 @@ _.range(0);
|
|||||||
|
|
||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_restarray--n"></a>`_.rest(array [, n])`
|
### <a id="_restarray--n1"></a>`_.rest(array [, n=1])`
|
||||||
<a href="#_restarray--n">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2861 "View in source") [Ⓣ][1]
|
<a href="#_restarray--n1">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2920 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
The opposite of `_.initial`, this method gets all but the first value of `array`. Pass `n` to exclude the first `n` values from the result.
|
The opposite of `_.initial`, this method gets all but the first value of `array`. Pass `n` to exclude the first `n` values from the result.
|
||||||
|
|
||||||
@@ -496,7 +496,7 @@ The opposite of `_.initial`, this method gets all but the first value of `array`
|
|||||||
|
|
||||||
#### Arguments
|
#### Arguments
|
||||||
1. `array` *(Array)*: The array to query.
|
1. `array` *(Array)*: The array to query.
|
||||||
2. `[n]` *(Number)*: The number of elements to return.
|
2. `[n=1]` *(Number)*: The number of elements to exclude.
|
||||||
|
|
||||||
#### Returns
|
#### Returns
|
||||||
*(Array)*: Returns all but the first value or `n` values of `array`.
|
*(Array)*: Returns all but the first value or `n` values of `array`.
|
||||||
@@ -515,7 +515,7 @@ _.rest([3, 2, 1]);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_sortedindexarray-value--callbackidentityproperty-thisarg"></a>`_.sortedIndex(array, value [, callback=identity|property, thisArg])`
|
### <a id="_sortedindexarray-value--callbackidentityproperty-thisarg"></a>`_.sortedIndex(array, value [, callback=identity|property, thisArg])`
|
||||||
<a href="#_sortedindexarray-value--callbackidentityproperty-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2907 "View in source") [Ⓣ][1]
|
<a href="#_sortedindexarray-value--callbackidentityproperty-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2966 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Uses a binary search to determine the smallest index at which the `value` should be inserted into `array` in order to maintain the sort order of the sorted `array`. If `callback` is passed, it will be executed for `value` and each element in `array` to compute their sort ranking. The `callback` is bound to `thisArg` and invoked with one argument; *(value)*. The `callback` argument may also be the name of a property to order by.
|
Uses a binary search to determine the smallest index at which the `value` should be inserted into `array` in order to maintain the sort order of the sorted `array`. If `callback` is passed, it will be executed for `value` and each element in `array` to compute their sort ranking. The `callback` is bound to `thisArg` and invoked with one argument; *(value)*. The `callback` argument may also be the name of a property to order by.
|
||||||
|
|
||||||
@@ -559,7 +559,7 @@ _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) {
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_unionarray1-array2-"></a>`_.union([array1, array2, ...])`
|
### <a id="_unionarray1-array2-"></a>`_.union([array1, array2, ...])`
|
||||||
<a href="#_unionarray1-array2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2938 "View in source") [Ⓣ][1]
|
<a href="#_unionarray1-array2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2997 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Computes the union of the passed-in arrays using strict equality for comparisons, i.e. `===`.
|
Computes the union of the passed-in arrays using strict equality for comparisons, i.e. `===`.
|
||||||
|
|
||||||
@@ -583,7 +583,7 @@ _.union([1, 2, 3], [101, 2, 1, 10], [2, 1]);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_uniqarray--issortedfalse-callbackidentity-thisarg"></a>`_.uniq(array [, isSorted=false, callback=identity, thisArg])`
|
### <a id="_uniqarray--issortedfalse-callbackidentity-thisarg"></a>`_.uniq(array [, isSorted=false, callback=identity, thisArg])`
|
||||||
<a href="#_uniqarray--issortedfalse-callbackidentity-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2972 "View in source") [Ⓣ][1]
|
<a href="#_uniqarray--issortedfalse-callbackidentity-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3031 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates a duplicate-value-free version of the `array` using strict equality for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` for `isSorted` will run a faster algorithm. If `callback` is passed, each element of `array` is passed through a callback` before uniqueness is computed. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*.
|
Creates a duplicate-value-free version of the `array` using strict equality for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` for `isSorted` will run a faster algorithm. If `callback` is passed, each element of `array` is passed through a callback` before uniqueness is computed. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*.
|
||||||
|
|
||||||
@@ -622,7 +622,7 @@ _.uniq([1, 2, 1.5, 3, 2.5], function(num) { return this.floor(num); }, Math);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_withoutarray--value1-value2-"></a>`_.without(array [, value1, value2, ...])`
|
### <a id="_withoutarray--value1-value2-"></a>`_.without(array [, value1, value2, ...])`
|
||||||
<a href="#_withoutarray--value1-value2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3020 "View in source") [Ⓣ][1]
|
<a href="#_withoutarray--value1-value2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3089 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates an array with all occurrences of the passed values removed using strict equality for comparisons, i.e. `===`.
|
Creates an array with all occurrences of the passed values removed using strict equality for comparisons, i.e. `===`.
|
||||||
|
|
||||||
@@ -647,7 +647,7 @@ _.without([1, 2, 1, 0, 3, 1, 4], 0, 1);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_ziparray1-array2-"></a>`_.zip([array1, array2, ...])`
|
### <a id="_ziparray1-array2-"></a>`_.zip([array1, array2, ...])`
|
||||||
<a href="#_ziparray1-array2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3051 "View in source") [Ⓣ][1]
|
<a href="#_ziparray1-array2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3120 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Groups the elements of each array at their corresponding indexes. Useful for separate data sources that are coordinated through matching array indexes. For a matrix of nested arrays, `_.zip.apply(...)` can transpose the matrix in a similar fashion.
|
Groups the elements of each array at their corresponding indexes. Useful for separate data sources that are coordinated through matching array indexes. For a matrix of nested arrays, `_.zip.apply(...)` can transpose the matrix in a similar fashion.
|
||||||
|
|
||||||
@@ -678,7 +678,7 @@ _.zip(['moe', 'larry', 'curly'], [30, 40, 50], [true, false, false]);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_value"></a>`_(value)`
|
### <a id="_value"></a>`_(value)`
|
||||||
<a href="#_value">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L232 "View in source") [Ⓣ][1]
|
<a href="#_value">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L242 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
The `lodash` function.
|
The `lodash` function.
|
||||||
|
|
||||||
@@ -696,7 +696,7 @@ The `lodash` function.
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_chainvalue"></a>`_.chain(value)`
|
### <a id="_chainvalue"></a>`_.chain(value)`
|
||||||
<a href="#_chainvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3903 "View in source") [Ⓣ][1]
|
<a href="#_chainvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3985 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Wraps the value in a `lodash` wrapper object.
|
Wraps the value in a `lodash` wrapper object.
|
||||||
|
|
||||||
@@ -730,7 +730,7 @@ var youngest = _.chain(stooges)
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_tapvalue-interceptor"></a>`_.tap(value, interceptor)`
|
### <a id="_tapvalue-interceptor"></a>`_.tap(value, interceptor)`
|
||||||
<a href="#_tapvalue-interceptor">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3930 "View in source") [Ⓣ][1]
|
<a href="#_tapvalue-interceptor">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4012 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Invokes `interceptor` with the `value` as the first argument, and then returns `value`. The purpose of this method is to "tap into" a method chain, in order to perform operations on intermediate results within the chain.
|
Invokes `interceptor` with the `value` as the first argument, and then returns `value`. The purpose of this method is to "tap into" a method chain, in order to perform operations on intermediate results within the chain.
|
||||||
|
|
||||||
@@ -760,7 +760,7 @@ _.chain([1, 2, 3, 200])
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_prototypechain"></a>`_.prototype.chain()`
|
### <a id="_prototypechain"></a>`_.prototype.chain()`
|
||||||
<a href="#_prototypechain">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3948 "View in source") [Ⓣ][1]
|
<a href="#_prototypechain">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4030 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Enables method chaining on the wrapper object.
|
Enables method chaining on the wrapper object.
|
||||||
|
|
||||||
@@ -781,7 +781,7 @@ _([1, 2, 3]).value();
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_prototypevalue"></a>`_.prototype.value()`
|
### <a id="_prototypevalue"></a>`_.prototype.value()`
|
||||||
<a href="#_prototypevalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3965 "View in source") [Ⓣ][1]
|
<a href="#_prototypevalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4047 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Extracts the wrapped value.
|
Extracts the wrapped value.
|
||||||
|
|
||||||
@@ -808,10 +808,10 @@ _([1, 2, 3]).value();
|
|||||||
|
|
||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_containscollection-target"></a>`_.contains(collection, target)`
|
### <a id="_containscollection-target--fromindex0"></a>`_.contains(collection, target [, fromIndex=0])`
|
||||||
<a href="#_containscollection-target">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1815 "View in source") [Ⓣ][1]
|
<a href="#_containscollection-target--fromindex0">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1837 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Checks if a given `target` element is present in a `collection` using strict equality for comparisons, i.e. `===`.
|
Checks if a given `target` element is present in a `collection` using strict equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the offset from the end of the collection.
|
||||||
|
|
||||||
#### Aliases
|
#### Aliases
|
||||||
*include*
|
*include*
|
||||||
@@ -819,15 +819,19 @@ Checks if a given `target` element is present in a `collection` using strict equ
|
|||||||
#### Arguments
|
#### Arguments
|
||||||
1. `collection` *(Array|Object|String)*: The collection to iterate over.
|
1. `collection` *(Array|Object|String)*: The collection to iterate over.
|
||||||
2. `target` *(Mixed)*: The value to check for.
|
2. `target` *(Mixed)*: The value to check for.
|
||||||
|
3. `[fromIndex=0]` *(Number)*: The index to search from.
|
||||||
|
|
||||||
#### Returns
|
#### Returns
|
||||||
*(Boolean)*: Returns `true` if the `target` element is found, else `false`.
|
*(Boolean)*: Returns `true` if the `target` element is found, else `false`.
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
```js
|
```js
|
||||||
_.contains([1, 2, 3], 3);
|
_.contains([1, 2, 3], 1);
|
||||||
// => true
|
// => true
|
||||||
|
|
||||||
|
_.contains([1, 2, 3], 1, 2);
|
||||||
|
// => false
|
||||||
|
|
||||||
_.contains({ 'name': 'moe', 'age': 40 }, 'moe');
|
_.contains({ 'name': 'moe', 'age': 40 }, 'moe');
|
||||||
// => true
|
// => true
|
||||||
|
|
||||||
@@ -843,7 +847,7 @@ _.contains('curly', 'ur');
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_countbycollection-callbackproperty--thisarg"></a>`_.countBy(collection, callback|property [, thisArg])`
|
### <a id="_countbycollection-callbackproperty--thisarg"></a>`_.countBy(collection, callback|property [, thisArg])`
|
||||||
<a href="#_countbycollection-callbackproperty--thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1854 "View in source") [Ⓣ][1]
|
<a href="#_countbycollection-callbackproperty--thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1879 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates an object composed of keys returned from running each element of `collection` through a `callback`. The corresponding value of each key is the number of times the key was returned by `callback`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. The `callback` argument may also be the name of a property to count by *(e.g. 'length')*.
|
Creates an object composed of keys returned from running each element of `collection` through a `callback`. The corresponding value of each key is the number of times the key was returned by `callback`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. The `callback` argument may also be the name of a property to count by *(e.g. 'length')*.
|
||||||
|
|
||||||
@@ -875,7 +879,7 @@ _.countBy(['one', 'two', 'three'], 'length');
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_everycollection--callbackidentity-thisarg"></a>`_.every(collection [, callback=identity, thisArg])`
|
### <a id="_everycollection--callbackidentity-thisarg"></a>`_.every(collection [, callback=identity, thisArg])`
|
||||||
<a href="#_everycollection--callbackidentity-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1883 "View in source") [Ⓣ][1]
|
<a href="#_everycollection--callbackidentity-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1908 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Checks if the `callback` returns a truthy value for **all** elements of a `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*.
|
Checks if the `callback` returns a truthy value for **all** elements of a `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*.
|
||||||
|
|
||||||
@@ -904,7 +908,7 @@ _.every([true, 1, null, 'yes'], Boolean);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_filtercollection--callbackidentity-thisarg"></a>`_.filter(collection [, callback=identity, thisArg])`
|
### <a id="_filtercollection--callbackidentity-thisarg"></a>`_.filter(collection [, callback=identity, thisArg])`
|
||||||
<a href="#_filtercollection--callbackidentity-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1910 "View in source") [Ⓣ][1]
|
<a href="#_filtercollection--callbackidentity-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1947 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Examines each element in a `collection`, returning an array of all elements the `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*.
|
Examines each element in a `collection`, returning an array of all elements the `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*.
|
||||||
|
|
||||||
@@ -933,7 +937,7 @@ var evens = _.filter([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; })
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_findcollection-callback--thisarg"></a>`_.find(collection, callback [, thisArg])`
|
### <a id="_findcollection-callback--thisarg"></a>`_.find(collection, callback [, thisArg])`
|
||||||
<a href="#_findcollection-callback--thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1941 "View in source") [Ⓣ][1]
|
<a href="#_findcollection-callback--thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1978 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Examines each element in a `collection`, returning the first one the `callback` returns truthy for. The function returns as soon as it finds an acceptable element, and does not iterate over the entire `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*.
|
Examines each element in a `collection`, returning the first one the `callback` returns truthy for. The function returns as soon as it finds an acceptable element, and does not iterate over the entire `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*.
|
||||||
|
|
||||||
@@ -962,7 +966,7 @@ var even = _.find([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; });
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_foreachcollection-callback--thisarg"></a>`_.forEach(collection, callback [, thisArg])`
|
### <a id="_foreachcollection-callback--thisarg"></a>`_.forEach(collection, callback [, thisArg])`
|
||||||
<a href="#_foreachcollection-callback--thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1972 "View in source") [Ⓣ][1]
|
<a href="#_foreachcollection-callback--thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2012 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Iterates over a `collection`, executing the `callback` for each element in the `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. Callbacks may exit iteration early by explicitly returning `false`.
|
Iterates over a `collection`, executing the `callback` for each element in the `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. Callbacks may exit iteration early by explicitly returning `false`.
|
||||||
|
|
||||||
@@ -994,7 +998,7 @@ _.forEach({ 'one': 1, 'two': 2, 'three': 3 }, alert);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_groupbycollection-callbackproperty--thisarg"></a>`_.groupBy(collection, callback|property [, thisArg])`
|
### <a id="_groupbycollection-callbackproperty--thisarg"></a>`_.groupBy(collection, callback|property [, thisArg])`
|
||||||
<a href="#_groupbycollection-callbackproperty--thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2000 "View in source") [Ⓣ][1]
|
<a href="#_groupbycollection-callbackproperty--thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2040 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates an object composed of keys returned from running each element of `collection` through a `callback`. The corresponding value of each key is an array of elements passed to `callback` that returned the key. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. The `callback` argument may also be the name of a property to group by *(e.g. 'length')*.
|
Creates an object composed of keys returned from running each element of `collection` through a `callback`. The corresponding value of each key is an array of elements passed to `callback` that returned the key. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. The `callback` argument may also be the name of a property to group by *(e.g. 'length')*.
|
||||||
|
|
||||||
@@ -1026,7 +1030,7 @@ _.groupBy(['one', 'two', 'three'], 'length');
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_invokecollection-methodname--arg1-arg2-"></a>`_.invoke(collection, methodName [, arg1, arg2, ...])`
|
### <a id="_invokecollection-methodname--arg1-arg2-"></a>`_.invoke(collection, methodName [, arg1, arg2, ...])`
|
||||||
<a href="#_invokecollection-methodname--arg1-arg2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2032 "View in source") [Ⓣ][1]
|
<a href="#_invokecollection-methodname--arg1-arg2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2072 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Invokes the method named by `methodName` on each element in the `collection`, returning an array of the results of each invoked method. Additional arguments will be passed to each invoked method. If `methodName` is a function it will be invoked for, and `this` bound to, each element in the `collection`.
|
Invokes the method named by `methodName` on each element in the `collection`, returning an array of the results of each invoked method. Additional arguments will be passed to each invoked method. If `methodName` is a function it will be invoked for, and `this` bound to, each element in the `collection`.
|
||||||
|
|
||||||
@@ -1055,7 +1059,7 @@ _.invoke([123, 456], String.prototype.split, '');
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_mapcollection--callbackidentity-thisarg"></a>`_.map(collection [, callback=identity, thisArg])`
|
### <a id="_mapcollection--callbackidentity-thisarg"></a>`_.map(collection [, callback=identity, thisArg])`
|
||||||
<a href="#_mapcollection--callbackidentity-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2064 "View in source") [Ⓣ][1]
|
<a href="#_mapcollection--callbackidentity-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2104 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates an array of values by running each element in the `collection` through a `callback`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*.
|
Creates an array of values by running each element in the `collection` through a `callback`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*.
|
||||||
|
|
||||||
@@ -1087,7 +1091,7 @@ _.map({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { return num * 3; });
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_maxcollection--callback-thisarg"></a>`_.max(collection [, callback, thisArg])`
|
### <a id="_maxcollection--callback-thisarg"></a>`_.max(collection [, callback, thisArg])`
|
||||||
<a href="#_maxcollection--callback-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2106 "View in source") [Ⓣ][1]
|
<a href="#_maxcollection--callback-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2146 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Retrieves the maximum value of an `array`. If `callback` is passed, it will be executed for each value in the `array` to generate the criterion by which the value is ranked. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, collection)*.
|
Retrieves the maximum value of an `array`. If `callback` is passed, it will be executed for each value in the `array` to generate the criterion by which the value is ranked. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, collection)*.
|
||||||
|
|
||||||
@@ -1119,7 +1123,7 @@ _.max(stooges, function(stooge) { return stooge.age; });
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_mincollection--callback-thisarg"></a>`_.min(collection [, callback, thisArg])`
|
### <a id="_mincollection--callback-thisarg"></a>`_.min(collection [, callback, thisArg])`
|
||||||
<a href="#_mincollection--callback-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2149 "View in source") [Ⓣ][1]
|
<a href="#_mincollection--callback-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2192 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Retrieves the minimum value of an `array`. If `callback` is passed, it will be executed for each value in the `array` to generate the criterion by which the value is ranked. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, collection)*.
|
Retrieves the minimum value of an `array`. If `callback` is passed, it will be executed for each value in the `array` to generate the criterion by which the value is ranked. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, collection)*.
|
||||||
|
|
||||||
@@ -1145,7 +1149,7 @@ _.min([10, 5, 100, 2, 1000]);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_pluckcollection-property"></a>`_.pluck(collection, property)`
|
### <a id="_pluckcollection-property"></a>`_.pluck(collection, property)`
|
||||||
<a href="#_pluckcollection-property">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2195 "View in source") [Ⓣ][1]
|
<a href="#_pluckcollection-property">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2241 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Retrieves the value of a specified property from all elements in the `collection`.
|
Retrieves the value of a specified property from all elements in the `collection`.
|
||||||
|
|
||||||
@@ -1176,7 +1180,7 @@ _.pluck(stooges, 'name');
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_reducecollection-callback--accumulator-thisarg"></a>`_.reduce(collection, callback [, accumulator, thisArg])`
|
### <a id="_reducecollection-callback--accumulator-thisarg"></a>`_.reduce(collection, callback [, accumulator, thisArg])`
|
||||||
<a href="#_reducecollection-callback--accumulator-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2223 "View in source") [Ⓣ][1]
|
<a href="#_reducecollection-callback--accumulator-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2269 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Boils down a `collection` to a single value. The initial state of the reduction is `accumulator` and each successive step of it should be returned by the `callback`. The `callback` is bound to `thisArg` and invoked with `4` arguments; for arrays they are *(accumulator, value, index|key, collection)*.
|
Boils down a `collection` to a single value. The initial state of the reduction is `accumulator` and each successive step of it should be returned by the `callback`. The `callback` is bound to `thisArg` and invoked with `4` arguments; for arrays they are *(accumulator, value, index|key, collection)*.
|
||||||
|
|
||||||
@@ -1206,7 +1210,7 @@ var sum = _.reduce([1, 2, 3], function(memo, num) { return memo + num; });
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_reducerightcollection-callback--accumulator-thisarg"></a>`_.reduceRight(collection, callback [, accumulator, thisArg])`
|
### <a id="_reducerightcollection-callback--accumulator-thisarg"></a>`_.reduceRight(collection, callback [, accumulator, thisArg])`
|
||||||
<a href="#_reducerightcollection-callback--accumulator-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2252 "View in source") [Ⓣ][1]
|
<a href="#_reducerightcollection-callback--accumulator-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2298 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
The right-associative version of `_.reduce`.
|
The right-associative version of `_.reduce`.
|
||||||
|
|
||||||
@@ -1237,7 +1241,7 @@ var flat = _.reduceRight(list, function(a, b) { return a.concat(b); }, []);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_rejectcollection--callbackidentity-thisarg"></a>`_.reject(collection [, callback=identity, thisArg])`
|
### <a id="_rejectcollection--callbackidentity-thisarg"></a>`_.reject(collection [, callback=identity, thisArg])`
|
||||||
<a href="#_rejectcollection--callbackidentity-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2289 "View in source") [Ⓣ][1]
|
<a href="#_rejectcollection--callbackidentity-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2335 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
The opposite of `_.filter`, this method returns the values of a `collection` that `callback` does **not** return truthy for.
|
The opposite of `_.filter`, this method returns the values of a `collection` that `callback` does **not** return truthy for.
|
||||||
|
|
||||||
@@ -1263,7 +1267,7 @@ var odds = _.reject([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; });
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_shufflecollection"></a>`_.shuffle(collection)`
|
### <a id="_shufflecollection"></a>`_.shuffle(collection)`
|
||||||
<a href="#_shufflecollection">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2310 "View in source") [Ⓣ][1]
|
<a href="#_shufflecollection">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2356 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates an array of shuffled `array` values, using a version of the Fisher-Yates shuffle. See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle.
|
Creates an array of shuffled `array` values, using a version of the Fisher-Yates shuffle. See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle.
|
||||||
|
|
||||||
@@ -1287,7 +1291,7 @@ _.shuffle([1, 2, 3, 4, 5, 6]);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_sizecollection"></a>`_.size(collection)`
|
### <a id="_sizecollection"></a>`_.size(collection)`
|
||||||
<a href="#_sizecollection">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2342 "View in source") [Ⓣ][1]
|
<a href="#_sizecollection">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2388 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Gets the size of the `collection` by returning `collection.length` for arrays and array-like objects or the number of own enumerable properties for objects.
|
Gets the size of the `collection` by returning `collection.length` for arrays and array-like objects or the number of own enumerable properties for objects.
|
||||||
|
|
||||||
@@ -1317,7 +1321,7 @@ _.size('curly');
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_somecollection--callbackidentity-thisarg"></a>`_.some(collection [, callback=identity, thisArg])`
|
### <a id="_somecollection--callbackidentity-thisarg"></a>`_.some(collection [, callback=identity, thisArg])`
|
||||||
<a href="#_somecollection--callbackidentity-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2367 "View in source") [Ⓣ][1]
|
<a href="#_somecollection--callbackidentity-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2413 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Checks if the `callback` returns a truthy value for **any** element of a `collection`. The function returns as soon as it finds passing value, and does not iterate over the entire `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*.
|
Checks if the `callback` returns a truthy value for **any** element of a `collection`. The function returns as soon as it finds passing value, and does not iterate over the entire `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*.
|
||||||
|
|
||||||
@@ -1346,7 +1350,7 @@ _.some([null, 0, 'yes', false]);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_sortbycollection-callbackproperty--thisarg"></a>`_.sortBy(collection, callback|property [, thisArg])`
|
### <a id="_sortbycollection-callbackproperty--thisarg"></a>`_.sortBy(collection, callback|property [, thisArg])`
|
||||||
<a href="#_sortbycollection-callbackproperty--thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2401 "View in source") [Ⓣ][1]
|
<a href="#_sortbycollection-callbackproperty--thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2459 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates an array, stable sorted in ascending order by the results of running each element of `collection` through a `callback`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. The `callback` argument may also be the name of a property to sort by *(e.g. 'length')*.
|
Creates an array, stable sorted in ascending order by the results of running each element of `collection` through a `callback`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. The `callback` argument may also be the name of a property to sort by *(e.g. 'length')*.
|
||||||
|
|
||||||
@@ -1378,7 +1382,7 @@ _.sortBy(['larry', 'brendan', 'moe'], 'length');
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_toarraycollection"></a>`_.toArray(collection)`
|
### <a id="_toarraycollection"></a>`_.toArray(collection)`
|
||||||
<a href="#_toarraycollection">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2433 "View in source") [Ⓣ][1]
|
<a href="#_toarraycollection">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2491 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Converts the `collection`, to an array.
|
Converts the `collection`, to an array.
|
||||||
|
|
||||||
@@ -1402,7 +1406,7 @@ Converts the `collection`, to an array.
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_wherecollection-properties"></a>`_.where(collection, properties)`
|
### <a id="_wherecollection-properties"></a>`_.where(collection, properties)`
|
||||||
<a href="#_wherecollection-properties">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2463 "View in source") [Ⓣ][1]
|
<a href="#_wherecollection-properties">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2521 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Examines each element in a `collection`, returning an array of all elements that contain the given `properties`.
|
Examines each element in a `collection`, returning an array of all elements that contain the given `properties`.
|
||||||
|
|
||||||
@@ -1440,9 +1444,9 @@ _.where(stooges, { 'age': 40 });
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_aftern-func"></a>`_.after(n, func)`
|
### <a id="_aftern-func"></a>`_.after(n, func)`
|
||||||
<a href="#_aftern-func">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3083 "View in source") [Ⓣ][1]
|
<a href="#_aftern-func">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3153 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates a function that is restricted to executing only after it is called `n` times.
|
Creates a function that is restricted to executing `func` only after it is called `n` times. The `func` is executed with the `this` binding of the created function.
|
||||||
|
|
||||||
#### Arguments
|
#### Arguments
|
||||||
1. `n` *(Number)*: The number of times the function must be called before it is executed.
|
1. `n` *(Number)*: The number of times the function must be called before it is executed.
|
||||||
@@ -1468,7 +1472,7 @@ _.forEach(notes, function(note) {
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_bindfunc--thisarg-arg1-arg2-"></a>`_.bind(func [, thisArg, arg1, arg2, ...])`
|
### <a id="_bindfunc--thisarg-arg1-arg2-"></a>`_.bind(func [, thisArg, arg1, arg2, ...])`
|
||||||
<a href="#_bindfunc--thisarg-arg1-arg2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3116 "View in source") [Ⓣ][1]
|
<a href="#_bindfunc--thisarg-arg1-arg2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3186 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates a function that, when called, invokes `func` with the `this` binding of `thisArg` and prepends any additional `bind` arguments to those passed to the bound function.
|
Creates a function that, when called, invokes `func` with the `this` binding of `thisArg` and prepends any additional `bind` arguments to those passed to the bound function.
|
||||||
|
|
||||||
@@ -1499,7 +1503,7 @@ func();
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_bindallobject--methodname1-methodname2-"></a>`_.bindAll(object [, methodName1, methodName2, ...])`
|
### <a id="_bindallobject--methodname1-methodname2-"></a>`_.bindAll(object [, methodName1, methodName2, ...])`
|
||||||
<a href="#_bindallobject--methodname1-methodname2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3146 "View in source") [Ⓣ][1]
|
<a href="#_bindallobject--methodname1-methodname2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3216 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Binds methods on `object` to `object`, overwriting the existing method. If no method names are provided, all the function properties of `object` will be bound.
|
Binds methods on `object` to `object`, overwriting the existing method. If no method names are provided, all the function properties of `object` will be bound.
|
||||||
|
|
||||||
@@ -1530,9 +1534,9 @@ jQuery('#lodash_button').on('click', buttonView.onClick);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_composefunc1-func2-"></a>`_.compose([func1, func2, ...])`
|
### <a id="_composefunc1-func2-"></a>`_.compose([func1, func2, ...])`
|
||||||
<a href="#_composefunc1-func2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3176 "View in source") [Ⓣ][1]
|
<a href="#_composefunc1-func2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3247 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates a function that is the composition of the passed functions, where each function consumes the return value of the function that follows. In math terms, composing the functions `f()`, `g()`, and `h()` produces `f(g(h()))`.
|
Creates a function that is the composition of the passed functions, where each function consumes the return value of the function that follows. In math terms, composing the functions `f()`, `g()`, and `h()` produces `f(g(h()))`. Each function is executed with the `this` binding of the composed function.
|
||||||
|
|
||||||
#### Arguments
|
#### Arguments
|
||||||
1. `[func1, func2, ...]` *(Function)*: Functions to compose.
|
1. `[func1, func2, ...]` *(Function)*: Functions to compose.
|
||||||
@@ -1557,7 +1561,7 @@ welcome('moe');
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_debouncefunc-wait-immediate"></a>`_.debounce(func, wait, immediate)`
|
### <a id="_debouncefunc-wait-immediate"></a>`_.debounce(func, wait, immediate)`
|
||||||
<a href="#_debouncefunc-wait-immediate">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3209 "View in source") [Ⓣ][1]
|
<a href="#_debouncefunc-wait-immediate">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3280 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates a function that will delay the execution of `func` until after `wait` milliseconds have elapsed since the last time it was invoked. Pass `true` for `immediate` to cause debounce to invoke `func` on the leading, instead of the trailing, edge of the `wait` timeout. Subsequent calls to the debounced function will return the result of the last `func` call.
|
Creates a function that will delay the execution of `func` until after `wait` milliseconds have elapsed since the last time it was invoked. Pass `true` for `immediate` to cause debounce to invoke `func` on the leading, instead of the trailing, edge of the `wait` timeout. Subsequent calls to the debounced function will return the result of the last `func` call.
|
||||||
|
|
||||||
@@ -1583,7 +1587,7 @@ jQuery(window).on('resize', lazyLayout);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_deferfunc--arg1-arg2-"></a>`_.defer(func [, arg1, arg2, ...])`
|
### <a id="_deferfunc--arg1-arg2-"></a>`_.defer(func [, arg1, arg2, ...])`
|
||||||
<a href="#_deferfunc--arg1-arg2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3273 "View in source") [Ⓣ][1]
|
<a href="#_deferfunc--arg1-arg2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3344 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Defers executing the `func` function until the current call stack has cleared. Additional arguments will be passed to `func` when it is invoked.
|
Defers executing the `func` function until the current call stack has cleared. Additional arguments will be passed to `func` when it is invoked.
|
||||||
|
|
||||||
@@ -1608,7 +1612,7 @@ _.defer(function() { alert('deferred'); });
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_delayfunc-wait--arg1-arg2-"></a>`_.delay(func, wait [, arg1, arg2, ...])`
|
### <a id="_delayfunc-wait--arg1-arg2-"></a>`_.delay(func, wait [, arg1, arg2, ...])`
|
||||||
<a href="#_delayfunc-wait--arg1-arg2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3253 "View in source") [Ⓣ][1]
|
<a href="#_delayfunc-wait--arg1-arg2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3324 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Executes the `func` function after `wait` milliseconds. Additional arguments will be passed to `func` when it is invoked.
|
Executes the `func` function after `wait` milliseconds. Additional arguments will be passed to `func` when it is invoked.
|
||||||
|
|
||||||
@@ -1635,7 +1639,7 @@ _.delay(log, 1000, 'logged later');
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_latebindobject-methodname--arg1-arg2-"></a>`_.lateBind(object, methodName [, arg1, arg2, ...])`
|
### <a id="_latebindobject-methodname--arg1-arg2-"></a>`_.lateBind(object, methodName [, arg1, arg2, ...])`
|
||||||
<a href="#_latebindobject-methodname--arg1-arg2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3311 "View in source") [Ⓣ][1]
|
<a href="#_latebindobject-methodname--arg1-arg2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3382 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates a function that, when called, invokes `object[methodName]` and prepends any additional `lateBind` arguments to those passed to the bound function. This method differs from `_.bind` by allowing bound functions to reference methods that will be redefined or don't yet exist.
|
Creates a function that, when called, invokes `object[methodName]` and prepends any additional `lateBind` arguments to those passed to the bound function. This method differs from `_.bind` by allowing bound functions to reference methods that will be redefined or don't yet exist.
|
||||||
|
|
||||||
@@ -1676,9 +1680,9 @@ func();
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_memoizefunc--resolver"></a>`_.memoize(func [, resolver])`
|
### <a id="_memoizefunc--resolver"></a>`_.memoize(func [, resolver])`
|
||||||
<a href="#_memoizefunc--resolver">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3333 "View in source") [Ⓣ][1]
|
<a href="#_memoizefunc--resolver">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3405 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates a function that memoizes the result of `func`. If `resolver` is passed, it will be used to determine the cache key for storing the result based on the arguments passed to the memoized function. By default, the first argument passed to the memoized function is used as the cache key.
|
Creates a function that memoizes the result of `func`. If `resolver` is passed, it will be used to determine the cache key for storing the result based on the arguments passed to the memoized function. By default, the first argument passed to the memoized function is used as the cache key. The `func` is executed with the `this` binding of the memoized function.
|
||||||
|
|
||||||
#### Arguments
|
#### Arguments
|
||||||
1. `func` *(Function)*: The function to have its output memoized.
|
1. `func` *(Function)*: The function to have its output memoized.
|
||||||
@@ -1702,9 +1706,9 @@ var fibonacci = _.memoize(function(n) {
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_oncefunc"></a>`_.once(func)`
|
### <a id="_oncefunc"></a>`_.once(func)`
|
||||||
<a href="#_oncefunc">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3359 "View in source") [Ⓣ][1]
|
<a href="#_oncefunc">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3432 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates a function that is restricted to one execution. Repeat calls to the function will return the value of the first call.
|
Creates a function that is restricted to execute `func` once. Repeat calls to the function will return the value of the first call. The `func` is executed with the `this` binding of the created function.
|
||||||
|
|
||||||
#### Arguments
|
#### Arguments
|
||||||
1. `func` *(Function)*: The function to restrict.
|
1. `func` *(Function)*: The function to restrict.
|
||||||
@@ -1728,7 +1732,7 @@ initialize();
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_partialfunc--arg1-arg2-"></a>`_.partial(func [, arg1, arg2, ...])`
|
### <a id="_partialfunc--arg1-arg2-"></a>`_.partial(func [, arg1, arg2, ...])`
|
||||||
<a href="#_partialfunc--arg1-arg2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3394 "View in source") [Ⓣ][1]
|
<a href="#_partialfunc--arg1-arg2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3467 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates a function that, when called, invokes `func` with any additional `partial` arguments prepended to those passed to the new function. This method is similar to `bind`, except it does **not** alter the `this` binding.
|
Creates a function that, when called, invokes `func` with any additional `partial` arguments prepended to those passed to the new function. This method is similar to `bind`, except it does **not** alter the `this` binding.
|
||||||
|
|
||||||
@@ -1755,7 +1759,7 @@ hi('moe');
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_throttlefunc-wait"></a>`_.throttle(func, wait)`
|
### <a id="_throttlefunc-wait"></a>`_.throttle(func, wait)`
|
||||||
<a href="#_throttlefunc-wait">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3416 "View in source") [Ⓣ][1]
|
<a href="#_throttlefunc-wait">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3489 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates a function that, when executed, will only call the `func` function at most once per every `wait` milliseconds. If the throttled function is invoked more than once during the `wait` timeout, `func` will also be called on the trailing edge of the timeout. Subsequent calls to the throttled function will return the result of the last `func` call.
|
Creates a function that, when executed, will only call the `func` function at most once per every `wait` milliseconds. If the throttled function is invoked more than once during the `wait` timeout, `func` will also be called on the trailing edge of the timeout. Subsequent calls to the throttled function will return the result of the last `func` call.
|
||||||
|
|
||||||
@@ -1780,9 +1784,9 @@ jQuery(window).on('scroll', throttled);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_wrapvalue-wrapper"></a>`_.wrap(value, wrapper)`
|
### <a id="_wrapvalue-wrapper"></a>`_.wrap(value, wrapper)`
|
||||||
<a href="#_wrapvalue-wrapper">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3467 "View in source") [Ⓣ][1]
|
<a href="#_wrapvalue-wrapper">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3541 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates a function that passes `value` to the `wrapper` function as its first argument. Additional arguments passed to the new function are appended to those passed to the `wrapper` function.
|
Creates a function that passes `value` to the `wrapper` function as its first argument. Additional arguments passed to the function are appended to those passed to the `wrapper` function. The `wrapper` is executed with the `this` binding of the created function.
|
||||||
|
|
||||||
#### Arguments
|
#### Arguments
|
||||||
1. `value` *(Mixed)*: The value to wrap.
|
1. `value` *(Mixed)*: The value to wrap.
|
||||||
@@ -1816,7 +1820,7 @@ hello();
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_clonevalue-deep"></a>`_.clone(value, deep)`
|
### <a id="_clonevalue-deep"></a>`_.clone(value, deep)`
|
||||||
<a href="#_clonevalue-deep">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L874 "View in source") [Ⓣ][1]
|
<a href="#_clonevalue-deep">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L896 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates a clone of `value`. If `deep` is `true`, all nested objects will also be cloned otherwise they will be assigned by reference. Functions, DOM nodes, `arguments` objects, and objects created by constructors other than `Object` are **not** cloned.
|
Creates a clone of `value`. If `deep` is `true`, all nested objects will also be cloned otherwise they will be assigned by reference. Functions, DOM nodes, `arguments` objects, and objects created by constructors other than `Object` are **not** cloned.
|
||||||
|
|
||||||
@@ -1855,7 +1859,7 @@ shallow[0] === stooges[0];
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_defaultsobject--default1-default2-"></a>`_.defaults(object [, default1, default2, ...])`
|
### <a id="_defaultsobject--default1-default2-"></a>`_.defaults(object [, default1, default2, ...])`
|
||||||
<a href="#_defaultsobject--default1-default2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L957 "View in source") [Ⓣ][1]
|
<a href="#_defaultsobject--default1-default2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L979 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Assigns enumerable properties of the default object(s) to the `destination` object for all `destination` properties that resolve to `null`/`undefined`. Once a property is set, additional defaults of the same property will be ignored.
|
Assigns enumerable properties of the default object(s) to the `destination` object for all `destination` properties that resolve to `null`/`undefined`. Once a property is set, additional defaults of the same property will be ignored.
|
||||||
|
|
||||||
@@ -1881,7 +1885,7 @@ _.defaults(iceCream, { 'flavor': 'vanilla', 'sprinkles': 'rainbow' });
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_extendobject--source1-source2-"></a>`_.extend(object [, source1, source2, ...])`
|
### <a id="_extendobject--source1-source2-"></a>`_.extend(object [, source1, source2, ...])`
|
||||||
<a href="#_extendobject--source1-source2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L977 "View in source") [Ⓣ][1]
|
<a href="#_extendobject--source1-source2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L999 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Assigns enumerable properties of the source object(s) to the `destination` object. Subsequent sources will overwrite propery assignments of previous sources.
|
Assigns enumerable properties of the source object(s) to the `destination` object. Subsequent sources will overwrite propery assignments of previous sources.
|
||||||
|
|
||||||
@@ -1906,7 +1910,7 @@ _.extend({ 'name': 'moe' }, { 'age': 40 });
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_forinobject-callback--thisarg"></a>`_.forIn(object, callback [, thisArg])`
|
### <a id="_forinobject-callback--thisarg"></a>`_.forIn(object, callback [, thisArg])`
|
||||||
<a href="#_forinobject-callback--thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L732 "View in source") [Ⓣ][1]
|
<a href="#_forinobject-callback--thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L754 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Iterates over `object`'s own and inherited enumerable properties, executing the `callback` for each property. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`.
|
Iterates over `object`'s own and inherited enumerable properties, executing the `callback` for each property. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`.
|
||||||
|
|
||||||
@@ -1942,7 +1946,7 @@ _.forIn(new Dog('Dagny'), function(value, key) {
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_forownobject-callback--thisarg"></a>`_.forOwn(object, callback [, thisArg])`
|
### <a id="_forownobject-callback--thisarg"></a>`_.forOwn(object, callback [, thisArg])`
|
||||||
<a href="#_forownobject-callback--thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L756 "View in source") [Ⓣ][1]
|
<a href="#_forownobject-callback--thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L778 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Iterates over `object`'s own enumerable properties, executing the `callback` for each property. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`.
|
Iterates over `object`'s own enumerable properties, executing the `callback` for each property. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`.
|
||||||
|
|
||||||
@@ -1970,7 +1974,7 @@ _.forOwn({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) {
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_functionsobject"></a>`_.functions(object)`
|
### <a id="_functionsobject"></a>`_.functions(object)`
|
||||||
<a href="#_functionsobject">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L994 "View in source") [Ⓣ][1]
|
<a href="#_functionsobject">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1016 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates a sorted array of all enumerable properties, own and inherited, of `object` that have function values.
|
Creates a sorted array of all enumerable properties, own and inherited, of `object` that have function values.
|
||||||
|
|
||||||
@@ -1997,7 +2001,7 @@ _.functions(_);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_hasobject-property"></a>`_.has(object, property)`
|
### <a id="_hasobject-property"></a>`_.has(object, property)`
|
||||||
<a href="#_hasobject-property">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1019 "View in source") [Ⓣ][1]
|
<a href="#_hasobject-property">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1041 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Checks if the specified object `property` exists and is a direct property, instead of an inherited property.
|
Checks if the specified object `property` exists and is a direct property, instead of an inherited property.
|
||||||
|
|
||||||
@@ -2022,7 +2026,7 @@ _.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b');
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_invertobject"></a>`_.invert(object)`
|
### <a id="_invertobject"></a>`_.invert(object)`
|
||||||
<a href="#_invertobject">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1036 "View in source") [Ⓣ][1]
|
<a href="#_invertobject">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1058 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates an object composed of the inverted keys and values of the given `object`.
|
Creates an object composed of the inverted keys and values of the given `object`.
|
||||||
|
|
||||||
@@ -2046,7 +2050,7 @@ _.invert({ 'first': 'Moe', 'second': 'Larry', 'third': 'Curly' });
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_isargumentsvalue"></a>`_.isArguments(value)`
|
### <a id="_isargumentsvalue"></a>`_.isArguments(value)`
|
||||||
<a href="#_isargumentsvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L694 "View in source") [Ⓣ][1]
|
<a href="#_isargumentsvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L716 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Checks if `value` is an `arguments` object.
|
Checks if `value` is an `arguments` object.
|
||||||
|
|
||||||
@@ -2073,7 +2077,7 @@ _.isArguments([1, 2, 3]);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_isarrayvalue"></a>`_.isArray(value)`
|
### <a id="_isarrayvalue"></a>`_.isArray(value)`
|
||||||
<a href="#_isarrayvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1060 "View in source") [Ⓣ][1]
|
<a href="#_isarrayvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1082 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Checks if `value` is an array.
|
Checks if `value` is an array.
|
||||||
|
|
||||||
@@ -2100,7 +2104,7 @@ _.isArray([1, 2, 3]);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_isbooleanvalue"></a>`_.isBoolean(value)`
|
### <a id="_isbooleanvalue"></a>`_.isBoolean(value)`
|
||||||
<a href="#_isbooleanvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1077 "View in source") [Ⓣ][1]
|
<a href="#_isbooleanvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1099 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Checks if `value` is a boolean *(`true` or `false`)* value.
|
Checks if `value` is a boolean *(`true` or `false`)* value.
|
||||||
|
|
||||||
@@ -2124,7 +2128,7 @@ _.isBoolean(null);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_isdatevalue"></a>`_.isDate(value)`
|
### <a id="_isdatevalue"></a>`_.isDate(value)`
|
||||||
<a href="#_isdatevalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1094 "View in source") [Ⓣ][1]
|
<a href="#_isdatevalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1116 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Checks if `value` is a date.
|
Checks if `value` is a date.
|
||||||
|
|
||||||
@@ -2148,7 +2152,7 @@ _.isDate(new Date);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_iselementvalue"></a>`_.isElement(value)`
|
### <a id="_iselementvalue"></a>`_.isElement(value)`
|
||||||
<a href="#_iselementvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1111 "View in source") [Ⓣ][1]
|
<a href="#_iselementvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1133 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Checks if `value` is a DOM element.
|
Checks if `value` is a DOM element.
|
||||||
|
|
||||||
@@ -2172,7 +2176,7 @@ _.isElement(document.body);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_isemptyvalue"></a>`_.isEmpty(value)`
|
### <a id="_isemptyvalue"></a>`_.isEmpty(value)`
|
||||||
<a href="#_isemptyvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1136 "View in source") [Ⓣ][1]
|
<a href="#_isemptyvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1158 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Checks if `value` is empty. Arrays, strings, or `arguments` objects with a length of `0` and objects with no own enumerable properties are considered "empty".
|
Checks if `value` is empty. Arrays, strings, or `arguments` objects with a length of `0` and objects with no own enumerable properties are considered "empty".
|
||||||
|
|
||||||
@@ -2202,7 +2206,7 @@ _.isEmpty('');
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_isequala-b"></a>`_.isEqual(a, b)`
|
### <a id="_isequala-b"></a>`_.isEqual(a, b)`
|
||||||
<a href="#_isequala-b">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1178 "View in source") [Ⓣ][1]
|
<a href="#_isequala-b">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1200 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Performs a deep comparison between two values to determine if they are equivalent to each other.
|
Performs a deep comparison between two values to determine if they are equivalent to each other.
|
||||||
|
|
||||||
@@ -2233,7 +2237,7 @@ _.isEqual(moe, clone);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_isfinitevalue"></a>`_.isFinite(value)`
|
### <a id="_isfinitevalue"></a>`_.isFinite(value)`
|
||||||
<a href="#_isfinitevalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1340 "View in source") [Ⓣ][1]
|
<a href="#_isfinitevalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1362 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Checks if `value` is, or can be coerced to, a finite number. Note: This is not the same as native `isFinite`, which will return true for booleans and empty strings. See http://es5.github.com/#x15.1.2.5.
|
Checks if `value` is, or can be coerced to, a finite number. Note: This is not the same as native `isFinite`, which will return true for booleans and empty strings. See http://es5.github.com/#x15.1.2.5.
|
||||||
|
|
||||||
@@ -2269,7 +2273,7 @@ _.isFinite(Infinity);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_isfunctionvalue"></a>`_.isFunction(value)`
|
### <a id="_isfunctionvalue"></a>`_.isFunction(value)`
|
||||||
<a href="#_isfunctionvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1357 "View in source") [Ⓣ][1]
|
<a href="#_isfunctionvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1379 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Checks if `value` is a function.
|
Checks if `value` is a function.
|
||||||
|
|
||||||
@@ -2293,7 +2297,7 @@ _.isFunction(_);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_isnanvalue"></a>`_.isNaN(value)`
|
### <a id="_isnanvalue"></a>`_.isNaN(value)`
|
||||||
<a href="#_isnanvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1421 "View in source") [Ⓣ][1]
|
<a href="#_isnanvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1443 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Checks if `value` is `NaN`. Note: This is not the same as native `isNaN`, which will return true for `undefined` and other values. See http://es5.github.com/#x15.1.2.4.
|
Checks if `value` is `NaN`. Note: This is not the same as native `isNaN`, which will return true for `undefined` and other values. See http://es5.github.com/#x15.1.2.4.
|
||||||
|
|
||||||
@@ -2326,7 +2330,7 @@ _.isNaN(undefined);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_isnullvalue"></a>`_.isNull(value)`
|
### <a id="_isnullvalue"></a>`_.isNull(value)`
|
||||||
<a href="#_isnullvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1444 "View in source") [Ⓣ][1]
|
<a href="#_isnullvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1466 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Checks if `value` is `null`.
|
Checks if `value` is `null`.
|
||||||
|
|
||||||
@@ -2353,7 +2357,7 @@ _.isNull(undefined);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_isnumbervalue"></a>`_.isNumber(value)`
|
### <a id="_isnumbervalue"></a>`_.isNumber(value)`
|
||||||
<a href="#_isnumbervalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1461 "View in source") [Ⓣ][1]
|
<a href="#_isnumbervalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1483 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Checks if `value` is a number.
|
Checks if `value` is a number.
|
||||||
|
|
||||||
@@ -2377,7 +2381,7 @@ _.isNumber(8.4 * 5);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_isobjectvalue"></a>`_.isObject(value)`
|
### <a id="_isobjectvalue"></a>`_.isObject(value)`
|
||||||
<a href="#_isobjectvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1387 "View in source") [Ⓣ][1]
|
<a href="#_isobjectvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1409 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Checks if `value` is the language type of Object. *(e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)*
|
Checks if `value` is the language type of Object. *(e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)*
|
||||||
|
|
||||||
@@ -2407,7 +2411,7 @@ _.isObject(1);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_isplainobjectvalue"></a>`_.isPlainObject(value)`
|
### <a id="_isplainobjectvalue"></a>`_.isPlainObject(value)`
|
||||||
<a href="#_isplainobjectvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1489 "View in source") [Ⓣ][1]
|
<a href="#_isplainobjectvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1511 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Checks if a given `value` is an object created by the `Object` constructor.
|
Checks if a given `value` is an object created by the `Object` constructor.
|
||||||
|
|
||||||
@@ -2442,7 +2446,7 @@ _.isPlainObject({ 'name': 'moe', 'age': 40 });
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_isregexpvalue"></a>`_.isRegExp(value)`
|
### <a id="_isregexpvalue"></a>`_.isRegExp(value)`
|
||||||
<a href="#_isregexpvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1514 "View in source") [Ⓣ][1]
|
<a href="#_isregexpvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1536 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Checks if `value` is a regular expression.
|
Checks if `value` is a regular expression.
|
||||||
|
|
||||||
@@ -2466,7 +2470,7 @@ _.isRegExp(/moe/);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_isstringvalue"></a>`_.isString(value)`
|
### <a id="_isstringvalue"></a>`_.isString(value)`
|
||||||
<a href="#_isstringvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1531 "View in source") [Ⓣ][1]
|
<a href="#_isstringvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1553 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Checks if `value` is a string.
|
Checks if `value` is a string.
|
||||||
|
|
||||||
@@ -2490,7 +2494,7 @@ _.isString('moe');
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_isundefinedvalue"></a>`_.isUndefined(value)`
|
### <a id="_isundefinedvalue"></a>`_.isUndefined(value)`
|
||||||
<a href="#_isundefinedvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1549 "View in source") [Ⓣ][1]
|
<a href="#_isundefinedvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1571 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Checks if `value` is `undefined`.
|
Checks if `value` is `undefined`.
|
||||||
|
|
||||||
@@ -2514,7 +2518,7 @@ _.isUndefined(void 0);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_keysobject"></a>`_.keys(object)`
|
### <a id="_keysobject"></a>`_.keys(object)`
|
||||||
<a href="#_keysobject">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1566 "View in source") [Ⓣ][1]
|
<a href="#_keysobject">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1588 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates an array composed of the own enumerable property names of `object`.
|
Creates an array composed of the own enumerable property names of `object`.
|
||||||
|
|
||||||
@@ -2538,7 +2542,7 @@ _.keys({ 'one': 1, 'two': 2, 'three': 3 });
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_mergeobject--source1-source2-"></a>`_.merge(object [, source1, source2, ...])`
|
### <a id="_mergeobject--source1-source2-"></a>`_.merge(object [, source1, source2, ...])`
|
||||||
<a href="#_mergeobject--source1-source2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1609 "View in source") [Ⓣ][1]
|
<a href="#_mergeobject--source1-source2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1626 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Merges enumerable properties of the source object(s) into the `destination` object. Subsequent sources will overwrite propery assignments of previous sources.
|
Merges enumerable properties of the source object(s) into the `destination` object. Subsequent sources will overwrite propery assignments of previous sources.
|
||||||
|
|
||||||
@@ -2573,7 +2577,7 @@ _.merge(stooges, ages);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_omitobject-callback-prop1-prop2--thisarg"></a>`_.omit(object, callback|[prop1, prop2, ..., thisArg])`
|
### <a id="_omitobject-callback-prop1-prop2--thisarg"></a>`_.omit(object, callback|[prop1, prop2, ..., thisArg])`
|
||||||
<a href="#_omitobject-callback-prop1-prop2--thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1679 "View in source") [Ⓣ][1]
|
<a href="#_omitobject-callback-prop1-prop2--thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1696 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates a shallow clone of `object` excluding the specified properties. Property names may be specified as individual arguments or as arrays of property names. If `callback` is passed, it will be executed for each property in the `object`, omitting the properties `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*.
|
Creates a shallow clone of `object` excluding the specified properties. Property names may be specified as individual arguments or as arrays of property names. If `callback` is passed, it will be executed for each property in the `object`, omitting the properties `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*.
|
||||||
|
|
||||||
@@ -2604,7 +2608,7 @@ _.omit({ 'name': 'moe', '_hint': 'knucklehead', '_seed': '96c4eb' }, function(va
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_pairsobject"></a>`_.pairs(object)`
|
### <a id="_pairsobject"></a>`_.pairs(object)`
|
||||||
<a href="#_pairsobject">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1713 "View in source") [Ⓣ][1]
|
<a href="#_pairsobject">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1730 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates a two dimensional array of the given object's key-value pairs, i.e. `[[key1, value1], [key2, value2]]`.
|
Creates a two dimensional array of the given object's key-value pairs, i.e. `[[key1, value1], [key2, value2]]`.
|
||||||
|
|
||||||
@@ -2628,7 +2632,7 @@ _.pairs({ 'moe': 30, 'larry': 40, 'curly': 50 });
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_pickobject-callback-prop1-prop2--thisarg"></a>`_.pick(object, callback|[prop1, prop2, ..., thisArg])`
|
### <a id="_pickobject-callback-prop1-prop2--thisarg"></a>`_.pick(object, callback|[prop1, prop2, ..., thisArg])`
|
||||||
<a href="#_pickobject-callback-prop1-prop2--thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1746 "View in source") [Ⓣ][1]
|
<a href="#_pickobject-callback-prop1-prop2--thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1763 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates a shallow clone of `object` composed of the specified properties. Property names may be specified as individual arguments or as arrays of property names. If `callback` is passed, it will be executed for each property in the `object`, picking the properties `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*.
|
Creates a shallow clone of `object` composed of the specified properties. Property names may be specified as individual arguments or as arrays of property names. If `callback` is passed, it will be executed for each property in the `object`, picking the properties `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*.
|
||||||
|
|
||||||
@@ -2659,7 +2663,7 @@ _.pick({ 'name': 'moe', '_hint': 'knucklehead', '_seed': '96c4eb' }, function(va
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_valuesobject"></a>`_.values(object)`
|
### <a id="_valuesobject"></a>`_.values(object)`
|
||||||
<a href="#_valuesobject">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1783 "View in source") [Ⓣ][1]
|
<a href="#_valuesobject">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1800 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates an array composed of the own enumerable property values of `object`.
|
Creates an array composed of the own enumerable property values of `object`.
|
||||||
|
|
||||||
@@ -2690,7 +2694,7 @@ _.values({ 'one': 1, 'two': 2, 'three': 3 });
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_escapestring"></a>`_.escape(string)`
|
### <a id="_escapestring"></a>`_.escape(string)`
|
||||||
<a href="#_escapestring">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3491 "View in source") [Ⓣ][1]
|
<a href="#_escapestring">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3565 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Converts the characters `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding HTML entities.
|
Converts the characters `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding HTML entities.
|
||||||
|
|
||||||
@@ -2714,7 +2718,7 @@ _.escape('Moe, Larry & Curly');
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_identityvalue"></a>`_.identity(value)`
|
### <a id="_identityvalue"></a>`_.identity(value)`
|
||||||
<a href="#_identityvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3511 "View in source") [Ⓣ][1]
|
<a href="#_identityvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3585 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
This function returns the first argument passed to it. Note: It is used throughout Lo-Dash as a default callback.
|
This function returns the first argument passed to it. Note: It is used throughout Lo-Dash as a default callback.
|
||||||
|
|
||||||
@@ -2739,7 +2743,7 @@ moe === _.identity(moe);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_mixinobject"></a>`_.mixin(object)`
|
### <a id="_mixinobject"></a>`_.mixin(object)`
|
||||||
<a href="#_mixinobject">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3537 "View in source") [Ⓣ][1]
|
<a href="#_mixinobject">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3611 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Adds functions properties of `object` to the `lodash` function and chainable wrapper.
|
Adds functions properties of `object` to the `lodash` function and chainable wrapper.
|
||||||
|
|
||||||
@@ -2769,7 +2773,7 @@ _('curly').capitalize();
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_noconflict"></a>`_.noConflict()`
|
### <a id="_noconflict"></a>`_.noConflict()`
|
||||||
<a href="#_noconflict">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3567 "View in source") [Ⓣ][1]
|
<a href="#_noconflict">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3641 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Reverts the '_' variable to its previous value and returns a reference to the `lodash` function.
|
Reverts the '_' variable to its previous value and returns a reference to the `lodash` function.
|
||||||
|
|
||||||
@@ -2789,7 +2793,7 @@ var lodash = _.noConflict();
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_randommin0-max1"></a>`_.random([min=0, max=1])`
|
### <a id="_randommin0-max1"></a>`_.random([min=0, max=1])`
|
||||||
<a href="#_randommin0-max1">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3590 "View in source") [Ⓣ][1]
|
<a href="#_randommin0-max1">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3664 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Produces a random number between `min` and `max` *(inclusive)*. If only one argument is passed, a number between `0` and the given number will be returned.
|
Produces a random number between `min` and `max` *(inclusive)*. If only one argument is passed, a number between `0` and the given number will be returned.
|
||||||
|
|
||||||
@@ -2817,7 +2821,7 @@ _.random(5);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_resultobject-property"></a>`_.result(object, property)`
|
### <a id="_resultobject-property"></a>`_.result(object, property)`
|
||||||
<a href="#_resultobject-property">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3629 "View in source") [Ⓣ][1]
|
<a href="#_resultobject-property">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3703 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Resolves the value of `property` on `object`. If `property` is a function it will be invoked and its result returned, else the property value is returned. If `object` is falsey, then `null` is returned.
|
Resolves the value of `property` on `object`. If `property` is a function it will be invoked and its result returned, else the property value is returned. If `object` is falsey, then `null` is returned.
|
||||||
|
|
||||||
@@ -2852,7 +2856,7 @@ _.result(object, 'stuff');
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_templatetext-data-options"></a>`_.template(text, data, options)`
|
### <a id="_templatetext-data-options"></a>`_.template(text, data, options)`
|
||||||
<a href="#_templatetext-data-options">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3710 "View in source") [Ⓣ][1]
|
<a href="#_templatetext-data-options">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3788 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
A micro-templating method that handles arbitrary delimiters, preserves whitespace, and correctly escapes quotes within interpolated code. Note: In the development build `_.template` utilizes sourceURLs for easier debugging. See http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl Note: Lo-Dash may be used in Chrome extensions by either creating a `lodash csp` build and avoiding `_.template` use, or loading Lo-Dash in a sandboxed page. See http://developer.chrome.com/trunk/extensions/sandboxingEval.html
|
A micro-templating method that handles arbitrary delimiters, preserves whitespace, and correctly escapes quotes within interpolated code. Note: In the development build `_.template` utilizes sourceURLs for easier debugging. See http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl Note: Lo-Dash may be used in Chrome extensions by either creating a `lodash csp` build and avoiding `_.template` use, or loading Lo-Dash in a sandboxed page. See http://developer.chrome.com/trunk/extensions/sandboxingEval.html
|
||||||
|
|
||||||
@@ -2877,7 +2881,11 @@ _.template(list, { 'people': ['moe', 'larry', 'curly'] });
|
|||||||
|
|
||||||
// using the "escape" delimiter to escape HTML in data property values
|
// using the "escape" delimiter to escape HTML in data property values
|
||||||
_.template('<b><%- value %></b>', { 'value': '<script>' });
|
_.template('<b><%- value %></b>', { 'value': '<script>' });
|
||||||
// => '<b><script></b>'
|
// => '<b><script></b>'
|
||||||
|
|
||||||
|
// using the ES6 delimiter as an alternative to the default "interpolate" delimiter
|
||||||
|
_.template('hello ${ name }', { 'name': 'curly' });
|
||||||
|
// => 'hello curly'
|
||||||
|
|
||||||
// using the internal `print` function in "evaluate" delimiters
|
// using the internal `print` function in "evaluate" delimiters
|
||||||
_.template('<% print("hello " + epithet); %>!', { 'epithet': 'stooge' });
|
_.template('<% print("hello " + epithet); %>!', { 'epithet': 'stooge' });
|
||||||
@@ -2885,7 +2893,7 @@ _.template('<% print("hello " + epithet); %>!', { 'epithet': 'stooge' });
|
|||||||
|
|
||||||
// using custom template delimiters
|
// using custom template delimiters
|
||||||
_.templateSettings = {
|
_.templateSettings = {
|
||||||
'interpolate': /\{\{([\s\S]+?)\}\}/g
|
'interpolate': /{{([\s\S]+?)}}/g
|
||||||
};
|
};
|
||||||
|
|
||||||
_.template('hello {{ name }}!', { 'name': 'mustache' });
|
_.template('hello {{ name }}!', { 'name': 'mustache' });
|
||||||
@@ -2922,7 +2930,7 @@ fs.writeFileSync(path.join(cwd, 'jst.js'), '\
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_timesn-callback--thisarg"></a>`_.times(n, callback [, thisArg])`
|
### <a id="_timesn-callback--thisarg"></a>`_.times(n, callback [, thisArg])`
|
||||||
<a href="#_timesn-callback--thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3829 "View in source") [Ⓣ][1]
|
<a href="#_timesn-callback--thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3911 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Executes the `callback` function `n` times, returning an array of the results of each `callback` execution. The `callback` is bound to `thisArg` and invoked with one argument; *(index)*.
|
Executes the `callback` function `n` times, returning an array of the results of each `callback` execution. The `callback` is bound to `thisArg` and invoked with one argument; *(index)*.
|
||||||
|
|
||||||
@@ -2954,7 +2962,7 @@ _.times(3, function(n) { this.cast(n); }, mage);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_unescapestring"></a>`_.unescape(string)`
|
### <a id="_unescapestring"></a>`_.unescape(string)`
|
||||||
<a href="#_unescapestring">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3855 "View in source") [Ⓣ][1]
|
<a href="#_unescapestring">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3937 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
The opposite of `_.escape`, this method converts the HTML entities `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding characters.
|
The opposite of `_.escape`, this method converts the HTML entities `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding characters.
|
||||||
|
|
||||||
@@ -2978,7 +2986,7 @@ _.unescape('Moe, Larry & Curly');
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_uniqueidprefix"></a>`_.uniqueId([prefix])`
|
### <a id="_uniqueidprefix"></a>`_.uniqueId([prefix])`
|
||||||
<a href="#_uniqueidprefix">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3873 "View in source") [Ⓣ][1]
|
<a href="#_uniqueidprefix">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3955 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Generates a unique id. If `prefix` is passed, the id will be appended to it.
|
Generates a unique id. If `prefix` is passed, the id will be appended to it.
|
||||||
|
|
||||||
@@ -3009,7 +3017,7 @@ _.uniqueId('contact_');
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_version"></a>`_.VERSION`
|
### <a id="_version"></a>`_.VERSION`
|
||||||
<a href="#_version">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3978 "View in source") [Ⓣ][1]
|
<a href="#_version">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4060 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
*(String)*: The semantic version number.
|
*(String)*: The semantic version number.
|
||||||
|
|
||||||
@@ -3021,7 +3029,7 @@ _.uniqueId('contact_');
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_templatesettings"></a>`_.templateSettings`
|
### <a id="_templatesettings"></a>`_.templateSettings`
|
||||||
<a href="#_templatesettings">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L253 "View in source") [Ⓣ][1]
|
<a href="#_templatesettings">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L263 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
*(Object)*: By default, the template delimiters used by Lo-Dash are similar to those in embedded Ruby *(ERB)*. Change the following template settings to use alternative delimiters.
|
*(Object)*: By default, the template delimiters used by Lo-Dash are similar to those in embedded Ruby *(ERB)*. Change the following template settings to use alternative delimiters.
|
||||||
|
|
||||||
@@ -3033,7 +3041,7 @@ _.uniqueId('contact_');
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_templatesettingsescape"></a>`_.templateSettings.escape`
|
### <a id="_templatesettingsescape"></a>`_.templateSettings.escape`
|
||||||
<a href="#_templatesettingsescape">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L262 "View in source") [Ⓣ][1]
|
<a href="#_templatesettingsescape">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L272 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
*(RegExp)*: Used to detect `data` property values to be HTML-escaped.
|
*(RegExp)*: Used to detect `data` property values to be HTML-escaped.
|
||||||
|
|
||||||
@@ -3045,7 +3053,7 @@ _.uniqueId('contact_');
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_templatesettingsevaluate"></a>`_.templateSettings.evaluate`
|
### <a id="_templatesettingsevaluate"></a>`_.templateSettings.evaluate`
|
||||||
<a href="#_templatesettingsevaluate">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L271 "View in source") [Ⓣ][1]
|
<a href="#_templatesettingsevaluate">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L281 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
*(RegExp)*: Used to detect code to be evaluated.
|
*(RegExp)*: Used to detect code to be evaluated.
|
||||||
|
|
||||||
@@ -3057,7 +3065,7 @@ _.uniqueId('contact_');
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_templatesettingsinterpolate"></a>`_.templateSettings.interpolate`
|
### <a id="_templatesettingsinterpolate"></a>`_.templateSettings.interpolate`
|
||||||
<a href="#_templatesettingsinterpolate">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L280 "View in source") [Ⓣ][1]
|
<a href="#_templatesettingsinterpolate">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L290 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
*(RegExp)*: Used to detect `data` property values to inject.
|
*(RegExp)*: Used to detect `data` property values to inject.
|
||||||
|
|
||||||
@@ -3069,7 +3077,7 @@ _.uniqueId('contact_');
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_templatesettingsvariable"></a>`_.templateSettings.variable`
|
### <a id="_templatesettingsvariable"></a>`_.templateSettings.variable`
|
||||||
<a href="#_templatesettingsvariable">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L289 "View in source") [Ⓣ][1]
|
<a href="#_templatesettingsvariable">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L299 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
*(String)*: Used to reference the data object in the template text.
|
*(String)*: Used to reference the data object in the template text.
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
// generate Markdown
|
// generate Markdown
|
||||||
$markdown = docdown(array(
|
$markdown = docdown(array(
|
||||||
'path' => '../' . $file,
|
'path' => '../' . $file,
|
||||||
'title' => 'Lo-Dash <sup>v0.9.1</sup>',
|
'title' => 'Lo-Dash <sup>v0.9.2</sup>',
|
||||||
'toc' => 'categories',
|
'toc' => 'categories',
|
||||||
'url' => 'https://github.com/bestiejs/lodash/blob/master/lodash.js'
|
'url' => 'https://github.com/bestiejs/lodash/blob/master/lodash.js'
|
||||||
));
|
));
|
||||||
|
|||||||
234
lodash.js
234
lodash.js
@@ -1,5 +1,5 @@
|
|||||||
/*!
|
/*!
|
||||||
* Lo-Dash v0.9.1 <http://lodash.com>
|
* Lo-Dash v0.9.2 <http://lodash.com>
|
||||||
* (c) 2012 John-David Dalton <http://allyoucanleet.com/>
|
* (c) 2012 John-David Dalton <http://allyoucanleet.com/>
|
||||||
* Based on Underscore.js 1.4.2 <http://underscorejs.org>
|
* Based on Underscore.js 1.4.2 <http://underscorejs.org>
|
||||||
* (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc.
|
* (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc.
|
||||||
@@ -18,13 +18,14 @@
|
|||||||
|
|
||||||
/** Used for array and object method references */
|
/** Used for array and object method references */
|
||||||
var arrayRef = [],
|
var arrayRef = [],
|
||||||
objectRef = {};
|
// avoid a Closure Compiler bug by creatively creating an object
|
||||||
|
objectRef = new function(){};
|
||||||
|
|
||||||
/** Used to generate unique IDs */
|
/** Used to generate unique IDs */
|
||||||
var idCounter = 0;
|
var idCounter = 0;
|
||||||
|
|
||||||
/** Used internally to indicate various things */
|
/** Used internally to indicate various things */
|
||||||
var indicatorObject = {};
|
var indicatorObject = objectRef;
|
||||||
|
|
||||||
/** Used by `cachedContains` as the default size when optimizations are enabled for large arrays */
|
/** Used by `cachedContains` as the default size when optimizations are enabled for large arrays */
|
||||||
var largeArraySize = 30;
|
var largeArraySize = 30;
|
||||||
@@ -32,7 +33,7 @@
|
|||||||
/** Used to restore the original `_` reference in `noConflict` */
|
/** Used to restore the original `_` reference in `noConflict` */
|
||||||
var oldDash = window._;
|
var oldDash = window._;
|
||||||
|
|
||||||
/** Used to detect delimiter values that should be processed by `tokenizeEvaluate` */
|
/** Used to detect template delimiter values that require a with-statement */
|
||||||
var reComplexDelimiter = /[-?+=!~*%&^<>|{(\/]|\[\D|\b(?:delete|in|instanceof|new|typeof|void)\b/;
|
var reComplexDelimiter = /[-?+=!~*%&^<>|{(\/]|\[\D|\b(?:delete|in|instanceof|new|typeof|void)\b/;
|
||||||
|
|
||||||
/** Used to match HTML entities */
|
/** Used to match HTML entities */
|
||||||
@@ -56,7 +57,16 @@
|
|||||||
.replace(/valueOf|for [^\]]+/g, '.+?') + '$'
|
.replace(/valueOf|for [^\]]+/g, '.+?') + '$'
|
||||||
);
|
);
|
||||||
|
|
||||||
/** Used to ensure capturing order and avoid matches for undefined delimiters */
|
/**
|
||||||
|
* Used to match ES6 template delimiters
|
||||||
|
* http://people.mozilla.org/~jorendorff/es6-draft.html#sec-7.8.6
|
||||||
|
*/
|
||||||
|
var reEsTemplate = /\$\{((?:(?=\\?)\\?[\s\S])*?)}/g;
|
||||||
|
|
||||||
|
/** Used to match "interpolate" template delimiters */
|
||||||
|
var reInterpolate = /<%=([\s\S]+?)%>/g;
|
||||||
|
|
||||||
|
/** Used to ensure capturing order of template delimiters */
|
||||||
var reNoMatch = /($^)/;
|
var reNoMatch = /($^)/;
|
||||||
|
|
||||||
/** Used to match HTML characters */
|
/** Used to match HTML characters */
|
||||||
@@ -277,7 +287,7 @@
|
|||||||
* @memberOf _.templateSettings
|
* @memberOf _.templateSettings
|
||||||
* @type RegExp
|
* @type RegExp
|
||||||
*/
|
*/
|
||||||
'interpolate': /<%=([\s\S]+?)%>/g,
|
'interpolate': reInterpolate,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to reference the data object in the template text.
|
* Used to reference the data object in the template text.
|
||||||
@@ -318,7 +328,7 @@
|
|||||||
|
|
||||||
// add support for accessing string characters by index if needed
|
// add support for accessing string characters by index if needed
|
||||||
' <% if (noCharByIndex) { %>\n' +
|
' <% if (noCharByIndex) { %>\n' +
|
||||||
' if (toString.call(iteratee) == stringClass) {\n' +
|
' if (isString(iteratee)) {\n' +
|
||||||
' iteratee = iteratee.split(\'\')\n' +
|
' iteratee = iteratee.split(\'\')\n' +
|
||||||
' }' +
|
' }' +
|
||||||
' <% } %>\n' +
|
' <% } %>\n' +
|
||||||
@@ -436,13 +446,13 @@
|
|||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a function optimized for searching large arrays for a given `value`,
|
* Creates a function optimized to search large arrays for a given `value`,
|
||||||
* starting at `fromIndex`, using strict equality for comparisons, i.e. `===`.
|
* starting at `fromIndex`, using strict equality for comparisons, i.e. `===`.
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {Array} array The array to search.
|
* @param {Array} array The array to search.
|
||||||
* @param {Mixed} value The value to search for.
|
* @param {Mixed} value The value to search for.
|
||||||
* @param {Number} [fromIndex=0] The index to start searching from.
|
* @param {Number} [fromIndex=0] The index to search from.
|
||||||
* @param {Number} [largeSize=30] The length at which an array is considered large.
|
* @param {Number} [largeSize=30] The length at which an array is considered large.
|
||||||
* @returns {Boolean} Returns `true` if `value` is found, else `false`.
|
* @returns {Boolean} Returns `true` if `value` is found, else `false`.
|
||||||
*/
|
*/
|
||||||
@@ -450,14 +460,14 @@
|
|||||||
fromIndex || (fromIndex = 0);
|
fromIndex || (fromIndex = 0);
|
||||||
|
|
||||||
var length = array.length,
|
var length = array.length,
|
||||||
isLarge = (length - fromIndex) >= (largeSize || largeArraySize),
|
isLarge = (length - fromIndex) >= (largeSize || largeArraySize);
|
||||||
cache = isLarge ? {} : array;
|
|
||||||
|
|
||||||
if (isLarge) {
|
if (isLarge) {
|
||||||
// init value cache
|
var cache = {},
|
||||||
var index = fromIndex - 1;
|
index = fromIndex - 1;
|
||||||
|
|
||||||
while (++index < length) {
|
while (++index < length) {
|
||||||
// manually coerce `value` to string because `hasOwnProperty`, in some
|
// manually coerce `value` to a string because `hasOwnProperty`, in some
|
||||||
// older versions of Firefox, coerces objects incorrectly
|
// older versions of Firefox, coerces objects incorrectly
|
||||||
var key = array[index] + '';
|
var key = array[index] + '';
|
||||||
(hasOwnProperty.call(cache, key) ? cache[key] : (cache[key] = [])).push(array[index]);
|
(hasOwnProperty.call(cache, key) ? cache[key] : (cache[key] = [])).push(array[index]);
|
||||||
@@ -468,10 +478,22 @@
|
|||||||
var key = value + '';
|
var key = value + '';
|
||||||
return hasOwnProperty.call(cache, key) && indexOf(cache[key], value) > -1;
|
return hasOwnProperty.call(cache, key) && indexOf(cache[key], value) > -1;
|
||||||
}
|
}
|
||||||
return indexOf(cache, value, fromIndex) > -1;
|
return indexOf(array, value, fromIndex) > -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used by `_.max` and `_.min` as the default `callback` when a given
|
||||||
|
* `collection` is a string value.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {String} value The character to inspect.
|
||||||
|
* @returns {Number} Returns the code unit of given character.
|
||||||
|
*/
|
||||||
|
function charAtCallback(value) {
|
||||||
|
return value.charCodeAt(0);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used by `sortBy` to compare transformed `collection` values, stable sorting
|
* Used by `sortBy` to compare transformed `collection` values, stable sorting
|
||||||
* them in ascending order.
|
* them in ascending order.
|
||||||
@@ -544,7 +566,7 @@
|
|||||||
// mimic the constructor's `return` behavior
|
// mimic the constructor's `return` behavior
|
||||||
// http://es5.github.com/#x13.2.2
|
// http://es5.github.com/#x13.2.2
|
||||||
var result = func.apply(thisBinding, args);
|
var result = func.apply(thisBinding, args);
|
||||||
return result && objectTypes[typeof result]
|
return isObject(result)
|
||||||
? result
|
? result
|
||||||
: thisBinding
|
: thisBinding
|
||||||
}
|
}
|
||||||
@@ -619,14 +641,14 @@
|
|||||||
|
|
||||||
// create the function factory
|
// create the function factory
|
||||||
var factory = Function(
|
var factory = Function(
|
||||||
'createCallback, hasOwnProperty, isArguments, objectTypes, nativeKeys, ' +
|
'createCallback, hasOwnProperty, isArguments, isString, objectTypes, ' +
|
||||||
'propertyIsEnumerable, stringClass, toString',
|
'nativeKeys, propertyIsEnumerable',
|
||||||
'return function(' + args + ') {\n' + iteratorTemplate(data) + '\n}'
|
'return function(' + args + ') {\n' + iteratorTemplate(data) + '\n}'
|
||||||
);
|
);
|
||||||
// return the compiled function
|
// return the compiled function
|
||||||
return factory(
|
return factory(
|
||||||
createCallback, hasOwnProperty, isArguments, objectTypes, nativeKeys,
|
createCallback, hasOwnProperty, isArguments, isString, objectTypes,
|
||||||
propertyIsEnumerable, stringClass, toString
|
nativeKeys, propertyIsEnumerable
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -879,7 +901,7 @@
|
|||||||
deep = false;
|
deep = false;
|
||||||
}
|
}
|
||||||
// inspect [[Class]]
|
// inspect [[Class]]
|
||||||
var isObj = objectTypes[typeof value];
|
var isObj = isObject(value);
|
||||||
if (isObj) {
|
if (isObj) {
|
||||||
// don't clone `arguments` objects, functions, or non-object Objects
|
// don't clone `arguments` objects, functions, or non-object Objects
|
||||||
var className = toString.call(value);
|
var className = toString.call(value);
|
||||||
@@ -1564,15 +1586,10 @@
|
|||||||
* // => ['one', 'two', 'three'] (order is not guaranteed)
|
* // => ['one', 'two', 'three'] (order is not guaranteed)
|
||||||
*/
|
*/
|
||||||
var keys = !nativeKeys ? shimKeys : function(object) {
|
var keys = !nativeKeys ? shimKeys : function(object) {
|
||||||
var type = typeof object;
|
|
||||||
|
|
||||||
// avoid iterating over the `prototype` property
|
// avoid iterating over the `prototype` property
|
||||||
if (type == 'function' && propertyIsEnumerable.call(object, 'prototype')) {
|
return typeof object == 'function' && propertyIsEnumerable.call(object, 'prototype')
|
||||||
return shimKeys(object);
|
? shimKeys(object)
|
||||||
}
|
: (isObject(object) ? nativeKeys(object) : []);
|
||||||
return object && objectTypes[type]
|
|
||||||
? nativeKeys(object)
|
|
||||||
: [];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1613,7 +1630,7 @@
|
|||||||
stackA = args[3],
|
stackA = args[3],
|
||||||
stackB = args[4];
|
stackB = args[4];
|
||||||
|
|
||||||
if (indicator !== indicatorObject) {
|
if (indicator !== objectRef) {
|
||||||
stackA = [];
|
stackA = [];
|
||||||
stackB = [];
|
stackB = [];
|
||||||
length = args.length;
|
length = args.length;
|
||||||
@@ -1641,7 +1658,7 @@
|
|||||||
: (isPlainObject(value) ? value : {})
|
: (isPlainObject(value) ? value : {})
|
||||||
);
|
);
|
||||||
// recursively merge objects and arrays (susceptible to call stack limits)
|
// recursively merge objects and arrays (susceptible to call stack limits)
|
||||||
object[key] = merge(value, source, indicatorObject, stackA, stackB);
|
object[key] = merge(value, source, objectRef, stackA, stackB);
|
||||||
}
|
}
|
||||||
} else if (source != null) {
|
} else if (source != null) {
|
||||||
object[key] = source;
|
object[key] = source;
|
||||||
@@ -1792,7 +1809,8 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if a given `target` element is present in a `collection` using strict
|
* Checks if a given `target` element is present in a `collection` using strict
|
||||||
* equality for comparisons, i.e. `===`.
|
* equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used
|
||||||
|
* as the offset from the end of the collection.
|
||||||
*
|
*
|
||||||
* @static
|
* @static
|
||||||
* @memberOf _
|
* @memberOf _
|
||||||
@@ -1800,28 +1818,35 @@
|
|||||||
* @category Collections
|
* @category Collections
|
||||||
* @param {Array|Object|String} collection The collection to iterate over.
|
* @param {Array|Object|String} collection The collection to iterate over.
|
||||||
* @param {Mixed} target The value to check for.
|
* @param {Mixed} target The value to check for.
|
||||||
|
* @param {Number} [fromIndex=0] The index to search from.
|
||||||
* @returns {Boolean} Returns `true` if the `target` element is found, else `false`.
|
* @returns {Boolean} Returns `true` if the `target` element is found, else `false`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* _.contains([1, 2, 3], 3);
|
* _.contains([1, 2, 3], 1);
|
||||||
* // => true
|
* // => true
|
||||||
*
|
*
|
||||||
|
* _.contains([1, 2, 3], 1, 2);
|
||||||
|
* // => false
|
||||||
|
*
|
||||||
* _.contains({ 'name': 'moe', 'age': 40 }, 'moe');
|
* _.contains({ 'name': 'moe', 'age': 40 }, 'moe');
|
||||||
* // => true
|
* // => true
|
||||||
*
|
*
|
||||||
* _.contains('curly', 'ur');
|
* _.contains('curly', 'ur');
|
||||||
* // => true
|
* // => true
|
||||||
*/
|
*/
|
||||||
function contains(collection, target) {
|
function contains(collection, target, fromIndex) {
|
||||||
var length = collection ? collection.length : 0;
|
var index = -1,
|
||||||
|
length = collection ? collection.length : 0;
|
||||||
|
|
||||||
|
fromIndex = (fromIndex < 0 ? nativeMax(0, length + fromIndex) : fromIndex) || 0;
|
||||||
if (typeof length == 'number') {
|
if (typeof length == 'number') {
|
||||||
return (toString.call(collection) == stringClass
|
return (isString(collection)
|
||||||
? collection.indexOf(target)
|
? collection.indexOf(target, fromIndex)
|
||||||
: indexOf(collection, target)
|
: indexOf(collection, target, fromIndex)
|
||||||
) > -1;
|
) > -1;
|
||||||
}
|
}
|
||||||
return some(collection, function(value) {
|
return some(collection, function(value) {
|
||||||
return value === target;
|
return ++index >= fromIndex && value === target;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1883,9 +1908,21 @@
|
|||||||
function every(collection, callback, thisArg) {
|
function every(collection, callback, thisArg) {
|
||||||
var result = true;
|
var result = true;
|
||||||
callback = createCallback(callback, thisArg);
|
callback = createCallback(callback, thisArg);
|
||||||
forEach(collection, function(value, index, collection) {
|
|
||||||
return (result = !!callback(value, index, collection));
|
if (isArray(collection)) {
|
||||||
});
|
var index = -1,
|
||||||
|
length = collection.length;
|
||||||
|
|
||||||
|
while (++index < length) {
|
||||||
|
if (!(result = !!callback(collection[index], index, collection))) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
forEach(collection, function(value, index, collection) {
|
||||||
|
return (result = !!callback(value, index, collection));
|
||||||
|
});
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1941,8 +1978,11 @@
|
|||||||
function find(collection, callback, thisArg) {
|
function find(collection, callback, thisArg) {
|
||||||
var result;
|
var result;
|
||||||
callback = createCallback(callback, thisArg);
|
callback = createCallback(callback, thisArg);
|
||||||
some(collection, function(value, index, collection) {
|
forEach(collection, function(value, index, collection) {
|
||||||
return callback(value, index, collection) && (result = value, true);
|
if (callback(value, index, collection)) {
|
||||||
|
result = value;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -2109,8 +2149,11 @@
|
|||||||
length = collection ? collection.length : 0,
|
length = collection ? collection.length : 0,
|
||||||
result = computed;
|
result = computed;
|
||||||
|
|
||||||
if (callback || typeof length != 'number') {
|
if (callback || !isArray(collection)) {
|
||||||
callback = createCallback(callback, thisArg);
|
callback = !callback && isString(collection)
|
||||||
|
? charAtCallback
|
||||||
|
: createCallback(callback, thisArg);
|
||||||
|
|
||||||
forEach(collection, function(value, index, collection) {
|
forEach(collection, function(value, index, collection) {
|
||||||
var current = callback(value, index, collection);
|
var current = callback(value, index, collection);
|
||||||
if (current > computed) {
|
if (current > computed) {
|
||||||
@@ -2152,8 +2195,11 @@
|
|||||||
length = collection ? collection.length : 0,
|
length = collection ? collection.length : 0,
|
||||||
result = computed;
|
result = computed;
|
||||||
|
|
||||||
if (callback || typeof length != 'number') {
|
if (callback || !isArray(collection)) {
|
||||||
callback = createCallback(callback, thisArg);
|
callback = !callback && isString(collection)
|
||||||
|
? charAtCallback
|
||||||
|
: createCallback(callback, thisArg);
|
||||||
|
|
||||||
forEach(collection, function(value, index, collection) {
|
forEach(collection, function(value, index, collection) {
|
||||||
var current = callback(value, index, collection);
|
var current = callback(value, index, collection);
|
||||||
if (current < computed) {
|
if (current < computed) {
|
||||||
@@ -2257,7 +2303,7 @@
|
|||||||
if (typeof length != 'number') {
|
if (typeof length != 'number') {
|
||||||
var props = keys(collection);
|
var props = keys(collection);
|
||||||
length = props.length;
|
length = props.length;
|
||||||
} else if (noCharByIndex && toString.call(collection) == stringClass) {
|
} else if (noCharByIndex && isString(collection)) {
|
||||||
iteratee = collection.split('');
|
iteratee = collection.split('');
|
||||||
}
|
}
|
||||||
forEach(collection, function(value, index, collection) {
|
forEach(collection, function(value, index, collection) {
|
||||||
@@ -2367,9 +2413,21 @@
|
|||||||
function some(collection, callback, thisArg) {
|
function some(collection, callback, thisArg) {
|
||||||
var result;
|
var result;
|
||||||
callback = createCallback(callback, thisArg);
|
callback = createCallback(callback, thisArg);
|
||||||
forEach(collection, function(value, index, collection) {
|
|
||||||
return !(result = callback(value, index, collection));
|
if (isArray(collection)) {
|
||||||
});
|
var index = -1,
|
||||||
|
length = collection.length;
|
||||||
|
|
||||||
|
while (++index < length) {
|
||||||
|
if (result = callback(collection[index], index, collection)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
forEach(collection, function(value, index, collection) {
|
||||||
|
return !(result = callback(value, index, collection));
|
||||||
|
});
|
||||||
|
}
|
||||||
return !!result;
|
return !!result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2432,7 +2490,7 @@
|
|||||||
*/
|
*/
|
||||||
function toArray(collection) {
|
function toArray(collection) {
|
||||||
if (collection && typeof collection.length == 'number') {
|
if (collection && typeof collection.length == 'number') {
|
||||||
return (noArraySliceOnStrings ? toString.call(collection) == stringClass : typeof collection == 'string')
|
return (noArraySliceOnStrings ? isString(collection) : typeof collection == 'string')
|
||||||
? collection.split('')
|
? collection.split('')
|
||||||
: slice.call(collection);
|
: slice.call(collection);
|
||||||
}
|
}
|
||||||
@@ -2610,8 +2668,8 @@
|
|||||||
* @category Arrays
|
* @category Arrays
|
||||||
* @param {Array} array The array to search.
|
* @param {Array} array The array to search.
|
||||||
* @param {Mixed} value The value to search for.
|
* @param {Mixed} value The value to search for.
|
||||||
* @param {Boolean|Number} [fromIndex=0] The index to start searching from or
|
* @param {Boolean|Number} [fromIndex=0] The index to search from or `true` to
|
||||||
* `true` to perform a binary search on a sorted `array`.
|
* perform a binary search on a sorted `array`.
|
||||||
* @returns {Number} Returns the index of the matched value or `-1`.
|
* @returns {Number} Returns the index of the matched value or `-1`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
@@ -2650,7 +2708,7 @@
|
|||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @category Arrays
|
* @category Arrays
|
||||||
* @param {Array} array The array to query.
|
* @param {Array} array The array to query.
|
||||||
* @param {Number} [n] The number of elements to return.
|
* @param {Number} [n=1] The number of elements to exclude.
|
||||||
* @param- {Object} [guard] Internally used to allow this method to work with
|
* @param- {Object} [guard] Internally used to allow this method to work with
|
||||||
* others like `_.map` without using their callback `index` argument for `n`.
|
* others like `_.map` without using their callback `index` argument for `n`.
|
||||||
* @returns {Array} Returns all but the last element or `n` elements of `array`.
|
* @returns {Array} Returns all but the last element or `n` elements of `array`.
|
||||||
@@ -2726,15 +2784,16 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the index at which the last occurrence of `value` is found using
|
* Gets the index at which the last occurrence of `value` is found using strict
|
||||||
* strict equality for comparisons, i.e. `===`.
|
* equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used
|
||||||
|
* as the offset from the end of the collection.
|
||||||
*
|
*
|
||||||
* @static
|
* @static
|
||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @category Arrays
|
* @category Arrays
|
||||||
* @param {Array} array The array to search.
|
* @param {Array} array The array to search.
|
||||||
* @param {Mixed} value The value to search for.
|
* @param {Mixed} value The value to search for.
|
||||||
* @param {Number} [fromIndex=array.length-1] The index to start searching from.
|
* @param {Number} [fromIndex=array.length-1] The index to search from.
|
||||||
* @returns {Number} Returns the index of the matched value or `-1`.
|
* @returns {Number} Returns the index of the matched value or `-1`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
@@ -2849,7 +2908,7 @@
|
|||||||
* @alias drop, tail
|
* @alias drop, tail
|
||||||
* @category Arrays
|
* @category Arrays
|
||||||
* @param {Array} array The array to query.
|
* @param {Array} array The array to query.
|
||||||
* @param {Number} [n] The number of elements to return.
|
* @param {Number} [n=1] The number of elements to exclude.
|
||||||
* @param- {Object} [guard] Internally used to allow this method to work with
|
* @param- {Object} [guard] Internally used to allow this method to work with
|
||||||
* others like `_.map` without using their callback `index` argument for `n`.
|
* others like `_.map` without using their callback `index` argument for `n`.
|
||||||
* @returns {Array} Returns all but the first value or `n` values of `array`.
|
* @returns {Array} Returns all but the first value or `n` values of `array`.
|
||||||
@@ -2981,6 +3040,11 @@
|
|||||||
callback = isSorted;
|
callback = isSorted;
|
||||||
isSorted = false;
|
isSorted = false;
|
||||||
}
|
}
|
||||||
|
// init value cache for large arrays
|
||||||
|
var isLarge = !isSorted && length > 74;
|
||||||
|
if (isLarge) {
|
||||||
|
var cache = {};
|
||||||
|
}
|
||||||
if (callback) {
|
if (callback) {
|
||||||
seen = [];
|
seen = [];
|
||||||
callback = createCallback(callback, thisArg);
|
callback = createCallback(callback, thisArg);
|
||||||
@@ -2989,11 +3053,16 @@
|
|||||||
var value = array[index],
|
var value = array[index],
|
||||||
computed = callback ? callback(value, index, array) : value;
|
computed = callback ? callback(value, index, array) : value;
|
||||||
|
|
||||||
|
if (isLarge) {
|
||||||
|
// manually coerce `computed` to a string because `hasOwnProperty`, in
|
||||||
|
// some older versions of Firefox, coerces objects incorrectly
|
||||||
|
seen = hasOwnProperty.call(cache, computed + '') ? cache[computed] : (cache[computed] = []);
|
||||||
|
}
|
||||||
if (isSorted
|
if (isSorted
|
||||||
? !index || seen[seen.length - 1] !== computed
|
? !index || seen[seen.length - 1] !== computed
|
||||||
: indexOf(seen, computed) < 0
|
: indexOf(seen, computed) < 0
|
||||||
) {
|
) {
|
||||||
if (callback) {
|
if (callback || isLarge) {
|
||||||
seen.push(computed);
|
seen.push(computed);
|
||||||
}
|
}
|
||||||
result.push(value);
|
result.push(value);
|
||||||
@@ -3062,8 +3131,9 @@
|
|||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a function that is restricted to executing only after it is
|
* Creates a function that is restricted to executing `func` only after it is
|
||||||
* called `n` times.
|
* called `n` times. The `func` is executed with the `this` binding of the
|
||||||
|
* created function.
|
||||||
*
|
*
|
||||||
* @static
|
* @static
|
||||||
* @memberOf _
|
* @memberOf _
|
||||||
@@ -3159,6 +3229,7 @@
|
|||||||
* Creates a function that is the composition of the passed functions,
|
* Creates a function that is the composition of the passed functions,
|
||||||
* where each function consumes the return value of the function that follows.
|
* where each function consumes the return value of the function that follows.
|
||||||
* In math terms, composing the functions `f()`, `g()`, and `h()` produces `f(g(h()))`.
|
* In math terms, composing the functions `f()`, `g()`, and `h()` produces `f(g(h()))`.
|
||||||
|
* Each function is executed with the `this` binding of the composed function.
|
||||||
*
|
*
|
||||||
* @static
|
* @static
|
||||||
* @memberOf _
|
* @memberOf _
|
||||||
@@ -3316,7 +3387,8 @@
|
|||||||
* Creates a function that memoizes the result of `func`. If `resolver` is
|
* Creates a function that memoizes the result of `func`. If `resolver` is
|
||||||
* passed, it will be used to determine the cache key for storing the result
|
* passed, it will be used to determine the cache key for storing the result
|
||||||
* based on the arguments passed to the memoized function. By default, the first
|
* based on the arguments passed to the memoized function. By default, the first
|
||||||
* argument passed to the memoized function is used as the cache key.
|
* argument passed to the memoized function is used as the cache key. The `func`
|
||||||
|
* is executed with the `this` binding of the memoized function.
|
||||||
*
|
*
|
||||||
* @static
|
* @static
|
||||||
* @memberOf _
|
* @memberOf _
|
||||||
@@ -3341,8 +3413,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a function that is restricted to one execution. Repeat calls to
|
* Creates a function that is restricted to execute `func` once. Repeat calls to
|
||||||
* the function will return the value of the first call.
|
* the function will return the value of the first call. The `func` is executed
|
||||||
|
* with the `this` binding of the created function.
|
||||||
*
|
*
|
||||||
* @static
|
* @static
|
||||||
* @memberOf _
|
* @memberOf _
|
||||||
@@ -3375,8 +3448,8 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a function that, when called, invokes `func` with any additional
|
* Creates a function that, when called, invokes `func` with any additional
|
||||||
* `partial` arguments prepended to those passed to the new function. This method
|
* `partial` arguments prepended to those passed to the new function. This
|
||||||
* is similar to `bind`, except it does **not** alter the `this` binding.
|
* method is similar to `bind`, except it does **not** alter the `this` binding.
|
||||||
*
|
*
|
||||||
* @static
|
* @static
|
||||||
* @memberOf _
|
* @memberOf _
|
||||||
@@ -3446,8 +3519,9 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a function that passes `value` to the `wrapper` function as its
|
* Creates a function that passes `value` to the `wrapper` function as its
|
||||||
* first argument. Additional arguments passed to the new function are appended
|
* first argument. Additional arguments passed to the function are appended
|
||||||
* to those passed to the `wrapper` function.
|
* to those passed to the `wrapper` function. The `wrapper` is executed with
|
||||||
|
* the `this` binding of the created function.
|
||||||
*
|
*
|
||||||
* @static
|
* @static
|
||||||
* @memberOf _
|
* @memberOf _
|
||||||
@@ -3671,7 +3745,11 @@
|
|||||||
*
|
*
|
||||||
* // using the "escape" delimiter to escape HTML in data property values
|
* // using the "escape" delimiter to escape HTML in data property values
|
||||||
* _.template('<b><%- value %></b>', { 'value': '<script>' });
|
* _.template('<b><%- value %></b>', { 'value': '<script>' });
|
||||||
* // => '<b><script></b>'
|
* // => '<b><script></b>'
|
||||||
|
*
|
||||||
|
* // using the ES6 delimiter as an alternative to the default "interpolate" delimiter
|
||||||
|
* _.template('hello ${ name }', { 'name': 'curly' });
|
||||||
|
* // => 'hello curly'
|
||||||
*
|
*
|
||||||
* // using the internal `print` function in "evaluate" delimiters
|
* // using the internal `print` function in "evaluate" delimiters
|
||||||
* _.template('<% print("hello " + epithet); %>!', { 'epithet': 'stooge' });
|
* _.template('<% print("hello " + epithet); %>!', { 'epithet': 'stooge' });
|
||||||
@@ -3679,7 +3757,7 @@
|
|||||||
*
|
*
|
||||||
* // using custom template delimiters
|
* // using custom template delimiters
|
||||||
* _.templateSettings = {
|
* _.templateSettings = {
|
||||||
* 'interpolate': /\{\{([\s\S]+?)\}\}/g
|
* 'interpolate': /{{([\s\S]+?)}}/g
|
||||||
* };
|
* };
|
||||||
*
|
*
|
||||||
* _.template('hello {{ name }}!', { 'name': 'mustache' });
|
* _.template('hello {{ name }}!', { 'name': 'mustache' });
|
||||||
@@ -3717,8 +3795,9 @@
|
|||||||
|
|
||||||
var isEvaluating,
|
var isEvaluating,
|
||||||
result,
|
result,
|
||||||
index = 0,
|
|
||||||
settings = lodash.templateSettings,
|
settings = lodash.templateSettings,
|
||||||
|
index = 0,
|
||||||
|
interpolate = options.interpolate || settings.interpolate || reNoMatch,
|
||||||
source = "__p += '",
|
source = "__p += '",
|
||||||
variable = options.variable || settings.variable,
|
variable = options.variable || settings.variable,
|
||||||
hasVariable = variable;
|
hasVariable = variable;
|
||||||
@@ -3726,11 +3805,14 @@
|
|||||||
// compile regexp to match each delimiter
|
// compile regexp to match each delimiter
|
||||||
var reDelimiters = RegExp(
|
var reDelimiters = RegExp(
|
||||||
(options.escape || settings.escape || reNoMatch).source + '|' +
|
(options.escape || settings.escape || reNoMatch).source + '|' +
|
||||||
(options.interpolate || settings.interpolate || reNoMatch).source + '|' +
|
interpolate.source + '|' +
|
||||||
|
(interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
|
||||||
(options.evaluate || settings.evaluate || reNoMatch).source + '|$'
|
(options.evaluate || settings.evaluate || reNoMatch).source + '|$'
|
||||||
, 'g');
|
, 'g');
|
||||||
|
|
||||||
text.replace(reDelimiters, function(match, escapeValue, interpolateValue, evaluateValue, offset) {
|
text.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
|
||||||
|
interpolateValue || (interpolateValue = esTemplateValue);
|
||||||
|
|
||||||
// escape characters that cannot be included in string literals
|
// escape characters that cannot be included in string literals
|
||||||
source += text.slice(index, offset).replace(reUnescapedString, escapeStringChar);
|
source += text.slice(index, offset).replace(reUnescapedString, escapeStringChar);
|
||||||
|
|
||||||
@@ -3975,7 +4057,7 @@
|
|||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @type String
|
* @type String
|
||||||
*/
|
*/
|
||||||
lodash.VERSION = '0.9.1';
|
lodash.VERSION = '0.9.2';
|
||||||
|
|
||||||
// assign static methods
|
// assign static methods
|
||||||
lodash.after = after;
|
lodash.after = after;
|
||||||
|
|||||||
73
lodash.min.js
vendored
73
lodash.min.js
vendored
@@ -1,39 +1,40 @@
|
|||||||
/*!
|
/*!
|
||||||
Lo-Dash 0.9.1 lodash.com/license
|
Lo-Dash 0.9.2 lodash.com/license
|
||||||
Underscore.js 1.4.2 underscorejs.org/LICENSE
|
Underscore.js 1.4.2 underscorejs.org/LICENSE
|
||||||
*/
|
*/
|
||||||
;(function(e,t){function s(e){if(e&&e.__wrapped__)return e;if(!(this instanceof s))return new s(e);this.__wrapped__=e}function o(e,t,n){t||(t=0);var r=e.length,i=r-t>=(n||Q),s=i?{}:e;if(i)for(n=t-1;++n<r;){var o=e[n]+"";(dt.call(s,o)?s[o]:s[o]=[]).push(e[n])}return function(e){if(i){var n=e+"";return dt.call(s,n)&&-1<j(s[n],e)}return-1<j(s,e,t)}}function u(e,n){var r=e.b,i=n.b,e=e.a,n=n.a;if(e!==n){if(e>n||e===t)return 1;if(e<n||n===t)return-1}return r<i?-1:1}function a(e,t,n){function r(){var u=arguments
|
;(function(e,t){function s(e){if(e&&e.__wrapped__)return e;if(!(this instanceof s))return new s(e);this.__wrapped__=e}function o(e,t,n){t||(t=0);var r=e.length,i=r-t>=(n||Y);if(i)for(var s={},n=t-1;++n<r;){var o=e[n]+"";(yt.call(s,o)?s[o]:s[o]=[]).push(e[n])}return function(n){if(i){var r=n+"";return yt.call(s,r)&&-1<q(s[r],n)}return-1<q(e,n,t)}}function u(e){return e.charCodeAt(0)}function a(e,n){var r=e.b,i=n.b,e=e.a,n=n.a;if(e!==n){if(e>n||e===t)return 1;if(e<n||n===t)return-1}return r<i?-1:1}function f
|
||||||
,a=s?this:t;return i||(e=t[o]),n.length&&(u=u.length?n.concat(gt.call(u)):n),this instanceof r?(p.prototype=e.prototype,a=new p,(u=e.apply(a,u))&&$t[typeof u]?u:a):e.apply(a,u)}var i=S(e),s=!n,o=e;return s&&(n=t),r}function f(e,n){return e?"function"!=typeof e?function(t){return t[e]}:n!==t?function(t,r,i){return e.call(n,t,r,i)}:e:U}function l(){for(var e={b:"",c:"",e:Ht,f:Xt,g:"",h:Ft,i:Rt,j:ft,k:"",l:n},t,r=0;t=arguments[r];r++)for(var i in t)e[i]=t[i];t=e.a,e.d=/^[^,]+/.exec(t)[0],r="var h,w,j="+
|
(e,t,n){function r(){var u=arguments,a=s?this:t;return i||(e=t[o]),n.length&&(u=u.length?n.concat(Et.call(u)):n),this instanceof r?(d.prototype=e.prototype,a=new d,u=e.apply(a,u),T(u)?u:a):e.apply(a,u)}var i=x(e),s=!n,o=e;return s&&(n=t),r}function l(e,n){return e?"function"!=typeof e?function(t){return t[e]}:n!==t?function(t,r,i){return e.call(n,t,r,i)}:e:X}function c(){for(var e={b:"",c:"",e:It,f:Kt,g:"",h:Ut,i:Xt,j:pt,k:"",l:n},t,r=0;t=arguments[r];r++)for(var i in t)e[i]=t[i];t=e.a,e.d=/^[^,]+/
|
||||||
e.d+",r="+e.d+";if(!"+e.d+")return r;"+e.k+";",e.b?(r+="var k=j.length;h=-1;if(typeof k=='number'){",e.i&&(r+="if(v.call(j)==t){j=j.split('')}"),r+="while(++h<k){w=j[h];"+e.b+"}}else {"):e.h&&(r+="var k=j.length;h=-1;if(k&&i(j)){while(++h<k){w=j[h+=''];"+e.g+"}}else {"),e.e||(r+="var s=typeof j=='function'&&q.call(j,'prototype');");if(e.f&&e.l)r+="var o=-1,p=n[typeof j]?l(j):[],k=p.length;while(++o<k){h=p[o];",e.e||(r+="if(!(s&&h=='prototype')){"),r+="w=j[h];"+e.g+"",e.e||(r+="}");else{r+="for(h in j){"
|
.exec(t)[0],r="var h,v,k="+e.d+",s="+e.d+";if(!"+e.d+")return s;"+e.k+";",e.b?(r+="var l=k.length;h=-1;if(typeof l=='number'){",e.i&&(r+="if(j(k)){k=k.split('')}"),r+="while(++h<l){v=k[h];"+e.b+"}}else {"):e.h&&(r+="var l=k.length;h=-1;if(l&&i(k)){while(++h<l){v=k[h+=''];"+e.g+"}}else {"),e.e||(r+="var t=typeof k=='function'&&r.call(k,'prototype');");if(e.f&&e.l)r+="var p=-1,q=o[typeof k]?m(k):[],l=q.length;while(++p<l){h=q[p];",e.e||(r+="if(!(t&&h=='prototype')){"),r+="v=k[h];"+e.g+"",e.e||(r+="}"
|
||||||
;if(!e.e||e.l)r+="if(",e.e||(r+="!(s&&h=='prototype')"),!e.e&&e.l&&(r+="&&"),e.l&&(r+="g.call(j,h)"),r+="){";r+="w=j[h];"+e.g+";";if(!e.e||e.l)r+="}"}r+="}";if(e.e){r+="var f=j.constructor;";for(i=0;7>i;i++)r+="h='"+e.j[i]+"';if(","constructor"==e.j[i]&&(r+="!(f&&f.prototype===j)&&"),r+="g.call(j,h)){w=j[h];"+e.g+"}"}if(e.b||e.h)r+="}";return r+=e.c+";return r",Function("e,g,i,n,l,q,t,v","return function("+t+"){"+r+"}")(f,dt,v,$t,xt,mt,Pt,yt)}function c(e){return"\\"+Jt[e]}function h(e){return en
|
);else{r+="for(h in k){";if(!e.e||e.l)r+="if(",e.e||(r+="!(t&&h=='prototype')"),!e.e&&e.l&&(r+="&&"),e.l&&(r+="g.call(k,h)"),r+="){";r+="v=k[h];"+e.g+";";if(!e.e||e.l)r+="}"}r+="}";if(e.e){r+="var f=k.constructor;";for(i=0;7>i;i++)r+="h='"+e.j[i]+"';if(","constructor"==e.j[i]&&(r+="!(f&&f.prototype===k)&&"),r+="g.call(k,h)){v=k[h];"+e.g+"}"}if(e.b||e.h)r+="}";return r+=e.c+";return s",Function("e,g,i,j,o,m,r","return function("+t+"){"+r+"}")(l,yt,m,N,Gt,kt,wt)}function h(e){return"\\"+Yt[e]}function p
|
||||||
[e]}function p(){}function d(e){return tn[e]}function v(e){return yt.call(e)==kt}function m(e){var t=i;if(!e||"object"!=typeof e||v(e))return t;var n=e.constructor;return(!Ut||"function"==typeof e.toString||"string"!=typeof (e+""))&&(!S(n)||n instanceof n)?Bt?(Yt(e,function(e,n,r){return t=!dt.call(r,n),i}),t===i):(Yt(e,function(e,n){t=n}),t===i||dt.call(e,t)):t}function g(e){var t=[];return Zt(e,function(e,n){t.push(n)}),t}function y(e,t,n,s,o){if(e==r)return e;n&&(t=i);if(n=$t[typeof e]){var u=
|
(e){return sn[e]}function d(){}function v(e){return on[e]}function m(e){return St.call(e)==Mt}function g(e){var t=i;if(!e||"object"!=typeof e||m(e))return t;var n=e.constructor;return(!Vt||"function"==typeof e.toString||"string"!=typeof (e+""))&&(!x(n)||n instanceof n)?qt?(nn(e,function(e,n,r){return t=!yt.call(r,n),i}),t===i):(nn(e,function(e,n){t=n}),t===i||yt.call(e,t)):t}function y(e){var t=[];return rn(e,function(e,n){t.push(n)}),t}function b(e,t,n,s,o){if(e==r)return e;n&&(t=i);if(n=T(e)){var u=
|
||||||
yt.call(e);if(!Vt[u]||It&&v(e))return e;var a=u==Lt,n=a||(u==_t?on(e):n)}if(!n||!t)return n?a?gt.call(e):rn({},e):e;n=e.constructor;switch(u){case At:case Ot:return new n(+e);case Mt:case Pt:return new n(e);case Dt:return n(e.source,rt.exec(e))}s||(s=[]),o||(o=[]);for(u=s.length;u--;)if(s[u]==e)return o[u];var f=a?n(e.length):{};return s.push(e),o.push(f),(a?an:Zt)(e,function(e,n){f[n]=y(e,t,r,s,o)}),f}function b(e){var t=[];return Yt(e,function(e,n){S(e)&&t.push(n)}),t.sort()}function w(e){var t=
|
St.call(e);if(!Qt[u]||zt&&m(e))return e;var a=u==_t,n=a||(u==Bt?ln(e):n)}if(!n||!t)return n?a?Et.call(e):an({},e):e;n=e.constructor;switch(u){case Dt:case Pt:return new n(+e);case Ht:case Ft:return new n(e);case jt:return n(e.source,st.exec(e))}s||(s=[]),o||(o=[]);for(u=s.length;u--;)if(s[u]==e)return o[u];var f=a?n(e.length):{};return s.push(e),o.push(f),(a?hn:rn)(e,function(e,n){f[n]=b(e,t,r,s,o)}),f}function w(e){var t=[];return nn(e,function(e,n){x(e)&&t.push(n)}),t.sort()}function E(e){var t=
|
||||||
{};return Zt(e,function(e,n){t[e]=n}),t}function E(e,t,s,o){if(e===t)return 0!==e||1/e==1/t;if(e==r||t==r)return e===t;var u=yt.call(e);if(u!=yt.call(t))return i;switch(u){case At:case Ot:return+e==+t;case Mt:return e!=+e?t!=+t:0==e?1/e==1/t:e==+t;case Dt:case Pt:return e==t+""}var a=u==Lt||u==kt;if(It&&!a&&(a=v(e))&&!v(t))return i;if(!a){if(e.__wrapped__||t.__wrapped__)return E(e.__wrapped__||e,t.__wrapped__||t);if(u!=_t||Ut&&("function"!=typeof e.toString&&"string"==typeof (e+"")||"function"!=typeof
|
{};return rn(e,function(e,n){t[e]=n}),t}function S(e,t,s,o){if(e===t)return 0!==e||1/e==1/t;if(e==r||t==r)return e===t;var u=St.call(e);if(u!=St.call(t))return i;switch(u){case Dt:case Pt:return+e==+t;case Ht:return e!=+e?t!=+t:0==e?1/e==1/t:e==+t;case jt:case Ft:return e==t+""}var a=u==_t||u==Mt;if(zt&&!a&&(a=m(e))&&!m(t))return i;if(!a){if(e.__wrapped__||t.__wrapped__)return S(e.__wrapped__||e,t.__wrapped__||t);if(u!=Bt||Vt&&("function"!=typeof e.toString&&"string"==typeof (e+"")||"function"!=typeof
|
||||||
t.toString&&"string"==typeof (t+"")))return i;var u=e.constructor,f=t.constructor;if(u!=f&&(!S(u)||!(u instanceof u&&S(f)&&f instanceof f)))return i}s||(s=[]),o||(o=[]);for(u=s.length;u--;)if(s[u]==e)return o[u]==t;var u=-1,f=n,l=0;s.push(e),o.push(t);if(a){l=e.length;if(f=l==t.length)for(;l--&&(f=E(e[l],t[l],s,o)););return f}for(var c in e)if(dt.call(e,c)&&(l++,!dt.call(t,c)||!E(e[c],t[c],s,o)))return i;for(c in t)if(dt.call(t,c)&&!(l--))return i;if(Ht)for(;7>++u;)if(c=ft[u],dt.call(e,c)&&(!dt.call
|
t.toString&&"string"==typeof (t+"")))return i;var u=e.constructor,f=t.constructor;if(u!=f&&(!x(u)||!(u instanceof u&&x(f)&&f instanceof f)))return i}s||(s=[]),o||(o=[]);for(u=s.length;u--;)if(s[u]==e)return o[u]==t;var u=-1,f=n,l=0;s.push(e),o.push(t);if(a){l=e.length;if(f=l==t.length)for(;l--&&(f=S(e[l],t[l],s,o)););return f}for(var c in e)if(yt.call(e,c)&&(l++,!yt.call(t,c)||!S(e[c],t[c],s,o)))return i;for(c in t)if(yt.call(t,c)&&!(l--))return i;if(It)for(;7>++u;)if(c=pt[u],yt.call(e,c)&&(!yt.call
|
||||||
(t,c)||!E(e[c],t[c],s,o)))return i;return n}function S(e){return"function"==typeof e}function x(e,t,n){var i=arguments,s=0,o=2,u=i[3],a=i[4];n!==K&&(u=[],a=[],o=i.length);for(;++s<o;)Zt(i[s],function(t,n){var i,s,o;if(t&&((s=sn(t))||on(t))){for(var f=u.length;f--;)if(i=u[f]==t)break;i?e[n]=a[f]:(u.push(t),a.push(o=(o=e[n],s)?sn(o)?o:[]:on(o)?o:{}),e[n]=x(o,t,K,u,a))}else t!=r&&(e[n]=t)});return e}function T(e){var t=[];return Zt(e,function(e){t.push(e)}),t}function N(e,t){return"number"==typeof (
|
(t,c)||!S(e[c],t[c],s,o)))return i;return n}function x(e){return"function"==typeof e}function T(e){return e?Gt[typeof e]:i}function N(e){return St.call(e)==Ft}function C(e,t,n){var i=arguments,s=0,o=2,u=i[3],a=i[4];n!==Q&&(u=[],a=[],o=i.length);for(;++s<o;)rn(i[s],function(t,n){var i,s,o;if(t&&((s=fn(t))||ln(t))){for(var f=u.length;f--;)if(i=u[f]==t)break;i?e[n]=a[f]:(u.push(t),a.push(o=(o=e[n],s)?fn(o)?o:[]:ln(o)?o:{}),e[n]=C(o,t,Q,u,a))}else t!=r&&(e[n]=t)});return e}function k(e){var t=[];return rn
|
||||||
e?e.length:0)?-1<(yt.call(e)==Pt?e.indexOf(t):j(e,t)):P(e,function(e){return e===t})}function C(e,t,r){var i=n,t=f(t,r);return an(e,function(e,n,r){return i=!!t(e,n,r)}),i}function k(e,t,n){var r=[],t=f(t,n);return an(e,function(e,n,i){t(e,n,i)&&r.push(e)}),r}function L(e,t,r){var i,t=f(t,r);return P(e,function(e,r,s){return t(e,r,s)&&(i=e,n)}),i}function A(e,t,n){var r=-1,i=e?e.length:0,s=Array("number"==typeof i?i:0),t=f(t,n);if(sn(e))for(;++r<i;)s[r]=t(e[r],r,e);else an(e,function(e,n,i){s[++r
|
(e,function(e){t.push(e)}),t}function L(e,t,n){var r=-1,i=e?e.length:0,n=(0>n?Lt(0,i+n):n)||0;return"number"==typeof i?-1<(N(e)?e.indexOf(t,n):q(e,t,n)):j(e,function(e){return++r>=n&&e===t})}function A(e,t,r){var i=n,t=l(t,r);if(fn(e))for(var r=-1,s=e.length;++r<s&&(i=!!t(e[r],r,e)););else hn(e,function(e,n,r){return i=!!t(e,n,r)});return i}function O(e,t,n){var r=[],t=l(t,n);return hn(e,function(e,n,i){t(e,n,i)&&r.push(e)}),r}function M(e,t,n){var r,t=l(t,n);return hn(e,function(e,n,s){if(t(e,n,
|
||||||
]=t(e,n,i)});return s}function O(e,t,n){var r=-Infinity,i=-1,s=e?e.length:0,o=r;if(t||"number"!=typeof s)t=f(t,n),an(e,function(e,n,i){n=t(e,n,i),n>r&&(r=n,o=e)});else for(;++i<s;)e[i]>o&&(o=e[i]);return o}function M(e,t){var n=[];return an(e,function(e){n.push(e[t])}),n}function _(e,t,n,r){var s=3>arguments.length,t=f(t,r);return an(e,function(e,r,o){n=s?(s=i,e):t(n,e,r,o)}),n}function D(e,t,n,r){var s=e,o=e?e.length:0,u=3>arguments.length;if("number"!=typeof o)var a=un(e),o=a.length;else Rt&&yt
|
s))return r=e,i}),r}function _(e,t,n){var r=-1,i=e?e.length:0,s=Array("number"==typeof i?i:0),t=l(t,n);if(fn(e))for(;++r<i;)s[r]=t(e[r],r,e);else hn(e,function(e,n,i){s[++r]=t(e,n,i)});return s}function D(e,t,n){var r=-Infinity,i=-1,s=e?e.length:0,o=r;if(t||!fn(e))t=!t&&N(e)?u:l(t,n),hn(e,function(e,n,i){n=t(e,n,i),n>r&&(r=n,o=e)});else for(;++i<s;)e[i]>o&&(o=e[i]);return o}function P(e,t){var n=[];return hn(e,function(e){n.push(e[t])}),n}function H(e,t,n,r){var s=3>arguments.length,t=l(t,r);return hn
|
||||||
.call(e)==Pt&&(s=e.split(""));return an(e,function(e,f,l){f=a?a[--o]:--o,n=u?(u=i,s[f]):t.call(r,n,s[f],f,l)}),n}function P(e,t,n){var r,t=f(t,n);return an(e,function(e,n,i){return!(r=t(e,n,i))}),!!r}function H(e,t,n){if(e)return t==r||n?e[0]:gt.call(e,0,t)}function B(e,t){for(var n=-1,r=e?e.length:0,i=[];++n<r;){var s=e[n];sn(s)?vt.apply(i,t?s:B(s)):i.push(s)}return i}function j(e,t,n){var r=-1,i=e?e.length:0;if("number"==typeof n)r=(0>n?Tt(0,i+n):n||0)-1;else if(n)return r=I(e,t),e[r]===t?r:-1;
|
(e,function(e,r,o){n=s?(s=i,e):t(n,e,r,o)}),n}function B(e,t,n,r){var s=e,o=e?e.length:0,u=3>arguments.length;if("number"!=typeof o)var a=cn(e),o=a.length;else Xt&&N(e)&&(s=e.split(""));return hn(e,function(e,f,l){f=a?a[--o]:--o,n=u?(u=i,s[f]):t.call(r,n,s[f],f,l)}),n}function j(e,t,n){var r,t=l(t,n);if(fn(e))for(var n=-1,i=e.length;++n<i&&!(r=t(e[n],n,e)););else hn(e,function(e,n,i){return!(r=t(e,n,i))});return!!r}function F(e,t,n){if(e)return t==r||n?e[0]:Et.call(e,0,t)}function I(e,t){for(var n=-1
|
||||||
for(;++r<i;)if(e[r]===t)return r;return-1}function F(e,t,n){return e?gt.call(e,t==r||n?1:t):[]}function I(e,t,n,r){for(var i=0,s=e?e.length:i,n=n?f(n,r):U,t=n(t);i<s;)r=i+s>>>1,n(e[r])<t?i=r+1:s=r;return i}function q(e,t,n,r){var s=-1,o=e?e.length:0,u=[],a=u;"function"==typeof t&&(r=n,n=t,t=i),n&&(a=[],n=f(n,r));for(;++s<o;){var r=e[s],l=n?n(r,s,e):r;if(t?!s||a[a.length-1]!==l:0>j(a,l))n&&a.push(l),u.push(r)}return u}function R(e,t){return Wt||bt&&2<arguments.length?bt.call.apply(bt,arguments):a(
|
,r=e?e.length:0,i=[];++n<r;){var s=e[n];fn(s)?bt.apply(i,t?s:I(s)):i.push(s)}return i}function q(e,t,n){var r=-1,i=e?e.length:0;if("number"==typeof n)r=(0>n?Lt(0,i+n):n||0)-1;else if(n)return r=U(e,t),e[r]===t?r:-1;for(;++r<i;)if(e[r]===t)return r;return-1}function R(e,t,n){return e?Et.call(e,t==r||n?1:t):[]}function U(e,t,n,r){for(var i=0,s=e?e.length:i,n=n?l(n,r):X,t=n(t);i<s;)r=i+s>>>1,n(e[r])<t?i=r+1:s=r;return i}function z(e,t,n,r){var s=-1,o=e?e.length:0,u=[],a=u;"function"==typeof t&&(r=n,
|
||||||
e,t,gt.call(arguments,2))}function U(e){return e}function z(e){an(b(e),function(t){var r=s[t]=e[t];s.prototype[t]=function(){var e=[this.__wrapped__];return vt.apply(e,arguments),e=r.apply(s,e),this.__chain__&&(e=new s(e),e.__chain__=n),e}})}var n=!0,r=null,i=!1,W="object"==typeof exports&&exports,X="object"==typeof global&&global;X.global===X&&(e=X);var V=[],$={},J=0,K={},Q=30,G=e._,Y=/[-?+=!~*%&^<>|{(\/]|\[\D|\b(?:delete|in|instanceof|new|typeof|void)\b/,Z=/&(?:amp|lt|gt|quot|#x27);/g,et=/\b__p\+='';/g
|
n=t,t=i);var f=!t&&74<o;if(f)var c={};n&&(a=[],n=l(n,r));for(;++s<o;){var r=e[s],h=n?n(r,s,e):r;f&&(a=yt.call(c,h+"")?c[h]:c[h]=[]);if(t?!s||a[a.length-1]!==h:0>q(a,h))(n||f)&&a.push(h),u.push(r)}return u}function W(e,t){return Jt||xt&&2<arguments.length?xt.call.apply(xt,arguments):f(e,t,Et.call(arguments,2))}function X(e){return e}function V(e){hn(w(e),function(t){var r=s[t]=e[t];s.prototype[t]=function(){var e=[this.__wrapped__];return bt.apply(e,arguments),e=r.apply(s,e),this.__chain__&&(e=new
|
||||||
,tt=/\b(__p\+=)''\+/g,nt=/(__e\(.*?\)|\b__t\))\+'';/g,rt=/\w*$/,it=/(?:__e|__t=)\(\s*(?![\d\s"']|this\.)/g,st=RegExp("^"+($.valueOf+"").replace(/[.*+?^=!:${}()|[\]\/\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),ot=/($^)/,ut=/[&<>"']/g,at=/['\n\r\t\u2028\u2029\\]/g,ft="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),lt=Math.ceil,ct=V.concat,ht=Math.floor,pt=st.test(pt=Object.getPrototypeOf)&&pt,dt=$.hasOwnProperty,vt=V.push,mt=$.propertyIsEnumerable
|
s(e),e.__chain__=n),e}})}var n=!0,r=null,i=!1,$="object"==typeof exports&&exports,J="object"==typeof global&&global;J.global===J&&(e=J);var K=[],Q=new function(){},G=0,Y=30,Z=e._,et=/[-?+=!~*%&^<>|{(\/]|\[\D|\b(?:delete|in|instanceof|new|typeof|void)\b/,tt=/&(?:amp|lt|gt|quot|#x27);/g,nt=/\b__p\+='';/g,rt=/\b(__p\+=)''\+/g,it=/(__e\(.*?\)|\b__t\))\+'';/g,st=/\w*$/,ot=/(?:__e|__t=)\(\s*(?![\d\s"']|this\.)/g,ut=RegExp("^"+(Q.valueOf+"").replace(/[.*+?^=!:${}()|[\]\/\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g
|
||||||
,gt=V.slice,yt=$.toString,bt=st.test(bt=gt.bind)&&bt,wt=st.test(wt=Array.isArray)&&wt,Et=e.isFinite,St=e.isNaN,xt=st.test(xt=Object.keys)&&xt,Tt=Math.max,Nt=Math.min,Ct=Math.random,kt="[object Arguments]",Lt="[object Array]",At="[object Boolean]",Ot="[object Date]",Mt="[object Number]",_t="[object Object]",Dt="[object RegExp]",Pt="[object String]",Ht,Bt,jt=(jt={0:1,length:1},V.splice.call(jt,0,1),jt[0]),Ft=n;(function(){function e(){this.x=1}var t=[];e.prototype={valueOf:1,y:1};for(var n in new e
|
,".+?")+"$"),at=/\$\{((?:(?=\\?)\\?[\s\S])*?)}/g,ft=/<%=([\s\S]+?)%>/g,lt=/($^)/,ct=/[&<>"']/g,ht=/['\n\r\t\u2028\u2029\\]/g,pt="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),dt=Math.ceil,vt=K.concat,mt=Math.floor,gt=ut.test(gt=Object.getPrototypeOf)&>,yt=Q.hasOwnProperty,bt=K.push,wt=Q.propertyIsEnumerable,Et=K.slice,St=Q.toString,xt=ut.test(xt=Et.bind)&&xt,Tt=ut.test(Tt=Array.isArray)&&Tt,Nt=e.isFinite,Ct=e.isNaN,kt=ut.test(kt=Object
|
||||||
)t.push(n);for(n in arguments)Ft=!n;Ht=!/valueOf/.test(t),Bt="x"!=t[0]})(1);var It=!v(arguments),qt="x"!=gt.call("x")[0],Rt="xx"!="x"[0]+Object("x")[0];try{var Ut=("[object Object]",yt.call(e.document||0)==_t)}catch(zt){}var Wt=bt&&/\n|Opera/.test(bt+yt.call(e.opera)),Xt=xt&&/^.+$|true/.test(xt+!!e.attachEvent),Vt={};Vt[kt]=Vt["[object Function]"]=i,Vt[Lt]=Vt[At]=Vt[Ot]=Vt[Mt]=Vt[_t]=Vt[Dt]=Vt[Pt]=n;var $t={"boolean":i,"function":n,object:n,number:i,string:i,"undefined":i},Jt={"\\":"\\","'":"'","\n"
|
.keys)&&kt,Lt=Math.max,At=Math.min,Ot=Math.random,Mt="[object Arguments]",_t="[object Array]",Dt="[object Boolean]",Pt="[object Date]",Ht="[object Number]",Bt="[object Object]",jt="[object RegExp]",Ft="[object String]",It,qt,Rt=(Rt={0:1,length:1},K.splice.call(Rt,0,1),Rt[0]),Ut=n;(function(){function e(){this.x=1}var t=[];e.prototype={valueOf:1,y:1};for(var n in new e)t.push(n);for(n in arguments)Ut=!n;It=!/valueOf/.test(t),qt="x"!=t[0]})(1);var zt=!m(arguments),Wt="x"!=Et.call("x")[0],Xt="xx"!="x"
|
||||||
:"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"};s.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""};var Kt={a:"d,c,u",k:"c=e(c,u)",b:"if(c(w,h,d)===false)return r",g:"if(c(w,h,d)===false)return r"},Qt={l:i,a:"m",k:"for(var a=1,b=arguments.length;a<b;a++){if(j=arguments[a]){",g:"r[h]=w",c:"}}"},Gt={b:r};It&&(v=function(e){return e?dt.call(e,"callee"):i});var Yt=l(Kt,Gt,{l:i}),Zt=l(Kt,Gt),en={"&":"&","<":"<",">":">"
|
[0]+Object("x")[0];try{var Vt=("[object Object]",St.call(e.document||0)==Bt)}catch($t){}var Jt=xt&&/\n|Opera/.test(xt+St.call(e.opera)),Kt=kt&&/^.+$|true/.test(kt+!!e.attachEvent),Qt={};Qt[Mt]=Qt["[object Function]"]=i,Qt[_t]=Qt[Dt]=Qt[Pt]=Qt[Ht]=Qt[Bt]=Qt[jt]=Qt[Ft]=n;var Gt={"boolean":i,"function":n,object:n,number:i,string:i,"undefined":i},Yt={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"};s.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,
|
||||||
,'"':""","'":"'"},tn=w(en),nn=l(Qt,{g:"if(r[h]==null)"+Qt.g}),rn=l(Qt),sn=wt||function(e){return yt.call(e)==Lt};S(/x/)&&(S=function(e){return"[object Function]"==yt.call(e)});var on=pt?function(e){if(!e||"object"!=typeof e)return i;var t=e.valueOf,n="function"==typeof t&&(n=pt(t))&&pt(n);return n?e==n||pt(e)==n&&!v(e):m(e)}:m,un=xt?function(e){var t=typeof e;return"function"==t&&mt.call(e,"prototype")?g(e):e&&$t[t]?xt(e):[]}:g,an=l(Kt);s.VERSION="0.9.1",s.after=function(e,t){return 1>e?
|
interpolate:ft,variable:""};var Zt={a:"d,c,u",k:"c=e(c,u)",b:"if(c(v,h,d)===false)return s",g:"if(c(v,h,d)===false)return s"},en={l:i,a:"n",k:"for(var a=1,b=arguments.length;a<b;a++){if(k=arguments[a]){",g:"s[h]=v",c:"}}"},tn={b:r};zt&&(m=function(e){return e?yt.call(e,"callee"):i});var nn=c(Zt,tn,{l:i}),rn=c(Zt,tn),sn={"&":"&","<":"<",">":">",'"':""","'":"'"},on=E(sn),un=c(en,{g:"if(s[h]==null)"+en.g}),an=c(en),fn=Tt||function(e){return St.call(e)==_t};x(/x/)&&(x=function(e){
|
||||||
t():function(){if(1>--e)return t.apply(this,arguments)}},s.bind=R,s.bindAll=function(e){for(var t=arguments,n=1<t.length?0:(t=b(e),-1),r=t.length;++n<r;){var i=t[n];e[i]=R(e[i],e)}return e},s.chain=function(e){return e=new s(e),e.__chain__=n,e},s.clone=y,s.compact=function(e){for(var t=-1,n=e?e.length:0,r=[];++t<n;){var i=e[t];i&&r.push(i)}return r},s.compose=function(){var e=arguments;return function(){for(var t=arguments,n=e.length;n--;)t=[e[n].apply(this,t)];return t[0]}},s.contains=N,s.countBy=
|
return"[object Function]"==St.call(e)});var ln=gt?function(e){if(!e||"object"!=typeof e)return i;var t=e.valueOf,n="function"==typeof t&&(n=gt(t))&>(n);return n?e==n||gt(e)==n&&!m(e):g(e)}:g,cn=kt?function(e){return"function"==typeof e&&wt.call(e,"prototype")?y(e):T(e)?kt(e):[]}:y,hn=c(Zt);s.VERSION="0.9.2",s.after=function(e,t){return 1>e?t():function(){if(1>--e)return t.apply(this,arguments)}},s.bind=W,s.bindAll=function(e){for(var t=arguments,n=1<t.length?0:(t=w(e),-1),r=t.length;++n<r;){var i=
|
||||||
function(e,t,n){var r={},t=f(t,n);return an(e,function(e,n,i){n=t(e,n,i),dt.call(r,n)?r[n]++:r[n]=1}),r},s.debounce=function(e,t,n){function i(){a=r,n||(o=e.apply(u,s))}var s,o,u,a;return function(){var r=n&&!a;return s=arguments,u=this,clearTimeout(a),a=setTimeout(i,t),r&&(o=e.apply(u,s)),o}},s.defaults=nn,s.defer=function(e){var n=gt.call(arguments,1);return setTimeout(function(){e.apply(t,n)},1)},s.delay=function(e,n){var r=gt.call(arguments,2);return setTimeout(function(){e.apply(t,r)},n)},s.
|
t[n];e[i]=W(e[i],e)}return e},s.chain=function(e){return e=new s(e),e.__chain__=n,e},s.clone=b,s.compact=function(e){for(var t=-1,n=e?e.length:0,r=[];++t<n;){var i=e[t];i&&r.push(i)}return r},s.compose=function(){var e=arguments;return function(){for(var t=arguments,n=e.length;n--;)t=[e[n].apply(this,t)];return t[0]}},s.contains=L,s.countBy=function(e,t,n){var r={},t=l(t,n);return hn(e,function(e,n,i){n=t(e,n,i),yt.call(r,n)?r[n]++:r[n]=1}),r},s.debounce=function(e,t,n){function i(){a=r,n||(o=e.apply
|
||||||
difference=function(e){for(var t=-1,n=e?e.length:0,r=ct.apply(V,arguments),r=o(r,n),i=[];++t<n;){var s=e[t];r(s)||i.push(s)}return i},s.escape=function(e){return e==r?"":(e+"").replace(ut,h)},s.every=C,s.extend=rn,s.filter=k,s.find=L,s.first=H,s.flatten=B,s.forEach=an,s.forIn=Yt,s.forOwn=Zt,s.functions=b,s.groupBy=function(e,t,n){var r={},t=f(t,n);return an(e,function(e,n,i){n=t(e,n,i),(dt.call(r,n)?r[n]:r[n]=[]).push(e)}),r},s.has=function(e,t){return e?dt.call(e,t):i},s.identity=U,s.indexOf=j,s
|
(u,s))}var s,o,u,a;return function(){var r=n&&!a;return s=arguments,u=this,clearTimeout(a),a=setTimeout(i,t),r&&(o=e.apply(u,s)),o}},s.defaults=un,s.defer=function(e){var n=Et.call(arguments,1);return setTimeout(function(){e.apply(t,n)},1)},s.delay=function(e,n){var r=Et.call(arguments,2);return setTimeout(function(){e.apply(t,r)},n)},s.difference=function(e){for(var t=-1,n=e?e.length:0,r=vt.apply(K,arguments),r=o(r,n),i=[];++t<n;){var s=e[t];r(s)||i.push(s)}return i},s.escape=function(e){return e==
|
||||||
.initial=function(e,t,n){return e?gt.call(e,0,-(t==r||n?1:t)):[]},s.intersection=function(e){var t=arguments,n=t.length,r={},i=[];return an(e,function(e){if(0>j(i,e)){for(var s=n;--s;)if(!(r[s]||(r[s]=o(t[s])))(e))return;i.push(e)}}),i},s.invert=w,s.invoke=function(e,t){var n=gt.call(arguments,2),r="function"==typeof t,i=[];return an(e,function(e){i.push((r?t:e[t]).apply(e,n))}),i},s.isArguments=v,s.isArray=sn,s.isBoolean=function(e){return e===n||e===i||yt.call(e)==At},s.isDate=function(e){return yt
|
r?"":(e+"").replace(ct,p)},s.every=A,s.extend=an,s.filter=O,s.find=M,s.first=F,s.flatten=I,s.forEach=hn,s.forIn=nn,s.forOwn=rn,s.functions=w,s.groupBy=function(e,t,n){var r={},t=l(t,n);return hn(e,function(e,n,i){n=t(e,n,i),(yt.call(r,n)?r[n]:r[n]=[]).push(e)}),r},s.has=function(e,t){return e?yt.call(e,t):i},s.identity=X,s.indexOf=q,s.initial=function(e,t,n){return e?Et.call(e,0,-(t==r||n?1:t)):[]},s.intersection=function(e){var t=arguments,n=t.length,r={},i=[];return hn(e,function(e){if(0>q(i,e)
|
||||||
.call(e)==Ot},s.isElement=function(e){return e?1===e.nodeType:i},s.isEmpty=function(e){var t=n;if(!e)return t;var r=yt.call(e),s=e.length;return r==Lt||r==Pt||r==kt||It&&v(e)||r==_t&&"number"==typeof s&&S(e.splice)?!s:(Zt(e,function(){return t=i}),t)},s.isEqual=E,s.isFinite=function(e){return Et(e)&&!St(parseFloat(e))},s.isFunction=S,s.isNaN=function(e){return yt.call(e)==Mt&&e!=+e},s.isNull=function(e){return e===r},s.isNumber=function(e){return yt.call(e)==Mt},s.isObject=function(e){return e?$t
|
){for(var s=n;--s;)if(!(r[s]||(r[s]=o(t[s])))(e))return;i.push(e)}}),i},s.invert=E,s.invoke=function(e,t){var n=Et.call(arguments,2),r="function"==typeof t,i=[];return hn(e,function(e){i.push((r?t:e[t]).apply(e,n))}),i},s.isArguments=m,s.isArray=fn,s.isBoolean=function(e){return e===n||e===i||St.call(e)==Dt},s.isDate=function(e){return St.call(e)==Pt},s.isElement=function(e){return e?1===e.nodeType:i},s.isEmpty=function(e){var t=n;if(!e)return t;var r=St.call(e),s=e.length;return r==_t||r==Ft||r==
|
||||||
[typeof e]:i},s.isPlainObject=on,s.isRegExp=function(e){return yt.call(e)==Dt},s.isString=function(e){return yt.call(e)==Pt},s.isUndefined=function(e){return e===t},s.keys=un,s.last=function(e,t,n){if(e){var i=e.length;return t==r||n?e[i-1]:gt.call(e,-t||i)}},s.lastIndexOf=function(e,t,n){var r=e?e.length:0;for("number"==typeof n&&(r=(0>n?Tt(0,r+n):Nt(n,r-1))+1);r--;)if(e[r]===t)return r;return-1},s.lateBind=function(e,t){return a(t,e,gt.call(arguments,2))},s.map=A,s.max=O,s.memoize=function(e,t)
|
Mt||zt&&m(e)||r==Bt&&"number"==typeof s&&x(e.splice)?!s:(rn(e,function(){return t=i}),t)},s.isEqual=S,s.isFinite=function(e){return Nt(e)&&!Ct(parseFloat(e))},s.isFunction=x,s.isNaN=function(e){return St.call(e)==Ht&&e!=+e},s.isNull=function(e){return e===r},s.isNumber=function(e){return St.call(e)==Ht},s.isObject=T,s.isPlainObject=ln,s.isRegExp=function(e){return St.call(e)==jt},s.isString=N,s.isUndefined=function(e){return e===t},s.keys=cn,s.last=function(e,t,n){if(e){var i=e.length;return t==r||
|
||||||
{var n={};return function(){var r=t?t.apply(this,arguments):arguments[0];return dt.call(n,r)?n[r]:n[r]=e.apply(this,arguments)}},s.merge=x,s.min=function(e,t,n){var r=Infinity,i=-1,s=e?e.length:0,o=r;if(t||"number"!=typeof s)t=f(t,n),an(e,function(e,n,i){n=t(e,n,i),n<r&&(r=n,o=e)});else for(;++i<s;)e[i]<o&&(o=e[i]);return o},s.mixin=z,s.noConflict=function(){return e._=G,this},s.object=function(e,t){for(var n=-1,r=e?e.length:0,i={};++n<r;){var s=e[n];t?i[s]=t[n]:i[s[0]]=s[1]}return i},s.omit=function(
|
n?e[i-1]:Et.call(e,-t||i)}},s.lastIndexOf=function(e,t,n){var r=e?e.length:0;for("number"==typeof n&&(r=(0>n?Lt(0,r+n):At(n,r-1))+1);r--;)if(e[r]===t)return r;return-1},s.lateBind=function(e,t){return f(t,e,Et.call(arguments,2))},s.map=_,s.max=D,s.memoize=function(e,t){var n={};return function(){var r=t?t.apply(this,arguments):arguments[0];return yt.call(n,r)?n[r]:n[r]=e.apply(this,arguments)}},s.merge=C,s.min=function(e,t,n){var r=Infinity,i=-1,s=e?e.length:0,o=r;if(t||!fn(e))t=!t&&N(e)?u:l(t,n)
|
||||||
e,t,n){var r="function"==typeof t,i={};if(r)t=f(t,n);else var s=ct.apply(V,arguments);return Yt(e,function(e,n,o){if(r?!t(e,n,o):0>j(s,n,1))i[n]=e}),i},s.once=function(e){var t,s=i;return function(){return s?t:(s=n,t=e.apply(this,arguments),e=r,t)}},s.pairs=function(e){var t=[];return Zt(e,function(e,n){t.push([n,e])}),t},s.partial=function(e){return a(e,gt.call(arguments,1))},s.pick=function(e,t,n){var r={};if("function"!=typeof t)for(var i=0,s=ct.apply(V,arguments),o=s.length;++i<o;){var u=s[i]
|
,hn(e,function(e,n,i){n=t(e,n,i),n<r&&(r=n,o=e)});else for(;++i<s;)e[i]<o&&(o=e[i]);return o},s.mixin=V,s.noConflict=function(){return e._=Z,this},s.object=function(e,t){for(var n=-1,r=e?e.length:0,i={};++n<r;){var s=e[n];t?i[s]=t[n]:i[s[0]]=s[1]}return i},s.omit=function(e,t,n){var r="function"==typeof t,i={};if(r)t=l(t,n);else var s=vt.apply(K,arguments);return nn(e,function(e,n,o){if(r?!t(e,n,o):0>q(s,n,1))i[n]=e}),i},s.once=function(e){var t,s=i;return function(){return s?t:(s=n,t=e.apply(this
|
||||||
;u in e&&(r[u]=e[u])}else t=f(t,n),Yt(e,function(e,n,i){t(e,n,i)&&(r[n]=e)});return r},s.pluck=M,s.random=function(e,t){return e==r&&t==r&&(t=1),e=+e||0,t==r&&(t=e,e=0),e+ht(Ct()*((+t||0)-e+1))},s.range=function(e,t,n){e=+e||0,n=+n||1,t==r&&(t=e,e=0);for(var i=-1,t=Tt(0,lt((t-e)/n)),s=Array(t);++i<t;)s[i]=e,e+=n;return s},s.reduce=_,s.reduceRight=D,s.reject=function(e,t,n){return t=f(t,n),k(e,function(e,n,r){return!t(e,n,r)})},s.rest=F,s.result=function(e,t){var n=e?e[t]:r;return S(n)?e[t]():n},s
|
,arguments),e=r,t)}},s.pairs=function(e){var t=[];return rn(e,function(e,n){t.push([n,e])}),t},s.partial=function(e){return f(e,Et.call(arguments,1))},s.pick=function(e,t,n){var r={};if("function"!=typeof t)for(var i=0,s=vt.apply(K,arguments),o=s.length;++i<o;){var u=s[i];u in e&&(r[u]=e[u])}else t=l(t,n),nn(e,function(e,n,i){t(e,n,i)&&(r[n]=e)});return r},s.pluck=P,s.random=function(e,t){return e==r&&t==r&&(t=1),e=+e||0,t==r&&(t=e,e=0),e+mt(Ot()*((+t||0)-e+1))},s.range=function(e,t,n){e=+e||0,n=+
|
||||||
.shuffle=function(e){var t=-1,n=Array(e?e.length:0);return an(e,function(e){var r=ht(Ct()*(++t+1));n[t]=n[r],n[r]=e}),n},s.size=function(e){var t=e?e.length:0;return"number"==typeof t?t:un(e).length},s.some=P,s.sortBy=function(e,t,n){var r=[],t=f(t,n);an(e,function(e,n,i){r.push({a:t(e,n,i),b:n,c:e})}),e=r.length;for(r.sort(u);e--;)r[e]=r[e].c;return r},s.sortedIndex=I,s.tap=function(e,t){return t(e),e},s.template=function(e,t,n){e||(e=""),n||(n={});var r,i,o=0,u=s.templateSettings,a="__p += '",f=
|
n||1,t==r&&(t=e,e=0);for(var i=-1,t=Lt(0,dt((t-e)/n)),s=Array(t);++i<t;)s[i]=e,e+=n;return s},s.reduce=H,s.reduceRight=B,s.reject=function(e,t,n){return t=l(t,n),O(e,function(e,n,r){return!t(e,n,r)})},s.rest=R,s.result=function(e,t){var n=e?e[t]:r;return x(n)?e[t]():n},s.shuffle=function(e){var t=-1,n=Array(e?e.length:0);return hn(e,function(e){var r=mt(Ot()*(++t+1));n[t]=n[r],n[r]=e}),n},s.size=function(e){var t=e?e.length:0;return"number"==typeof t?t:cn(e).length},s.some=j,s.sortBy=function(e,t
|
||||||
n.variable||u.variable,l=f;e.replace(RegExp((n.escape||u.escape||ot).source+"|"+(n.interpolate||u.interpolate||ot).source+"|"+(n.evaluate||u.evaluate||ot).source+"|$","g"),function(t,n,i,s,u){a+=e.slice(o,u).replace(at,c),a+=n?"'+__e("+n+")+'":s?"';"+s+";__p+='":i?"'+((__t=("+i+"))==null?'':__t)+'":"",r||(r=s||Y.test(n||i)),o=u+t.length}),a+="';",l||(f="obj",r?a="with("+f+"){"+a+"}":(n=RegExp("(\\(\\s*)"+f+"\\."+f+"\\b","g"),a=a.replace(it,"$&"+f+".").replace(n,"$1__d"))),a=(r?a.replace(et,""):a)
|
,n){var r=[],t=l(t,n);hn(e,function(e,n,i){r.push({a:t(e,n,i),b:n,c:e})}),e=r.length;for(r.sort(a);e--;)r[e]=r[e].c;return r},s.sortedIndex=U,s.tap=function(e,t){return t(e),e},s.template=function(e,t,n){e||(e=""),n||(n={});var r,i,o=s.templateSettings,u=0,a=n.interpolate||o.interpolate||lt,f="__p += '",l=n.variable||o.variable,c=l;e.replace(RegExp((n.escape||o.escape||lt).source+"|"+a.source+"|"+(a===ft?at:lt).source+"|"+(n.evaluate||o.evaluate||lt).source+"|$","g"),function(t,n,i,s,o,a){i||(i=s
|
||||||
.replace(tt,"$1").replace(nt,"$1;"),a="function("+f+"){"+(l?"":f+"||("+f+"={});")+"var __t,__p='',__e=_.escape"+(r?",__j=[].join;function print(){__p+=__j.call(arguments,'')}":(l?"":",__d="+f+"."+f+"||"+f)+";")+a+"return __p}";try{i=Function("_","return "+a)(s)}catch(h){throw h.source=a,h}return t?i(t):(i.source=a,i)},s.throttle=function(e,t){function n(){a=new Date,u=r,s=e.apply(o,i)}var i,s,o,u,a=0;return function(){var r=new Date,f=t-(r-a);return i=arguments,o=this,0>=f?(clearTimeout
|
),f+=e.slice(u,a).replace(ht,h),f+=n?"'+__e("+n+")+'":o?"';"+o+";__p+='":i?"'+((__t=("+i+"))==null?'':__t)+'":"",r||(r=o||et.test(n||i)),u=a+t.length}),f+="';",c||(l="obj",r?f="with("+l+"){"+f+"}":(n=RegExp("(\\(\\s*)"+l+"\\."+l+"\\b","g"),f=f.replace(ot,"$&"+l+".").replace(n,"$1__d"))),f=(r?f.replace(nt,""):f).replace(rt,"$1").replace(it,"$1;"),f="function("+l+"){"+(c?"":l+"||("+l+"={});")+"var __t,__p='',__e=_.escape"+(r?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":
|
||||||
(u),a=r,s=e.apply(o,i)):u||(u=setTimeout(n,f)),s}},s.times=function(e,t,n){for(var e=+e||0,r=-1,i=Array(e);++r<e;)i[r]=t.call(n,r);return i},s.toArray=function(e){return e&&"number"==typeof e.length?(qt?yt.call(e)==Pt:"string"==typeof e)?e.split(""):gt.call(e):T(e)},s.unescape=function(e){return e==r?"":(e+"").replace(Z,d)},s.union=function(){return q(ct.apply(V,arguments))},s.uniq=q,s.uniqueId=function(e){var t=J++;return e?e+t:t},s.values=T,s.where=function(e,t){var n=[];return Yt(t,function(e,
|
(c?"":",__d="+l+"."+l+"||"+l)+";")+f+"return __p}";try{i=Function("_","return "+f)(s)}catch(p){throw p.source=f,p}return t?i(t):(i.source=f,i)},s.throttle=function(e,t){function n(){a=new Date,u=r,s=e.apply(o,i)}var i,s,o,u,a=0;return function(){var r=new Date,f=t-(r-a);return i=arguments,o=this,0>=f?(clearTimeout(u),a=r,s=e.apply(o,i)):u||(u=setTimeout(n,f)),s}},s.times=function(e,t,n){for(var e=+e||0,r=-1,i=Array(e);++r<e;)i[r]=t.call(n,r);return i},s.toArray=function(e){return e&&"number"==typeof
|
||||||
t){n.push(t)}),k(e,function(e){for(var r=n.length;r--;){var i=e[n[r]]===t[n[r]];if(!i)break}return!!i})},s.without=function(e){for(var t=-1,n=e?e.length:0,r=o(arguments,1,20),i=[];++t<n;){var s=e[t];r(s)||i.push(s)}return i},s.wrap=function(e,t){return function(){var n=[e];return vt.apply(n,arguments),t.apply(this,n)}},s.zip=function(e){for(var t=-1,n=e?O(M(arguments,"length")):0,r=Array(n);++t<n;)r[t]=M(arguments,t);return r},s.all=C,s.any=P,s.collect=A,s.detect=L,s.drop=F,s.each=an,s.foldl=_,s.
|
e.length?(Wt?N(e):"string"==typeof e)?e.split(""):Et.call(e):k(e)},s.unescape=function(e){return e==r?"":(e+"").replace(tt,v)},s.union=function(){return z(vt.apply(K,arguments))},s.uniq=z,s.uniqueId=function(e){var t=G++;return e?e+t:t},s.values=k,s.where=function(e,t){var n=[];return nn(t,function(e,t){n.push(t)}),O(e,function(e){for(var r=n.length;r--;){var i=e[n[r]]===t[n[r]];if(!i)break}return!!i})},s.without=function(e){for(var t=-1,n=e?e.length:0,r=o(arguments,1,20),i=[];++t<n;){var s=e[t];
|
||||||
foldr=D,s.head=H,s.include=N,s.inject=_,s.methods=b,s.select=k,s.tail=F,s.take=H,s.unique=q,z(s),s.prototype.chain=function(){return this.__chain__=n,this},s.prototype.value=function(){return this.__wrapped__},an("pop push reverse shift sort splice unshift".split(" "),function(e){var t=V[e];s.prototype[e]=function(){var e=this.__wrapped__;return t.apply(e,arguments),jt&&e.length===0&&delete e[0],this.__chain__&&(e=new s(e),e.__chain__=n),e}}),an(["concat","join","slice"],function(e){var t=V[e];s.
|
r(s)||i.push(s)}return i},s.wrap=function(e,t){return function(){var n=[e];return bt.apply(n,arguments),t.apply(this,n)}},s.zip=function(e){for(var t=-1,n=e?D(P(arguments,"length")):0,r=Array(n);++t<n;)r[t]=P(arguments,t);return r},s.all=A,s.any=j,s.collect=_,s.detect=M,s.drop=R,s.each=hn,s.foldl=H,s.foldr=B,s.head=F,s.include=L,s.inject=H,s.methods=w,s.select=O,s.tail=R,s.take=F,s.unique=z,V(s),s.prototype.chain=function(){return this.__chain__=n,this},s.prototype.value=function(){return this.__wrapped__
|
||||||
prototype[e]=function(){var e=t.apply(this.__wrapped__,arguments);return this.__chain__&&(e=new s(e),e.__chain__=n),e}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(e._=s,define(function(){return s})):W?"object"==typeof module&&module&&module.exports==W?(module.exports=s)._=s:W._=s:e._=s})(this);
|
},hn("pop push reverse shift sort splice unshift".split(" "),function(e){var t=K[e];s.prototype[e]=function(){var e=this.__wrapped__;return t.apply(e,arguments),Rt&&e.length===0&&delete e[0],this.__chain__&&(e=new s(e),e.__chain__=n),e}}),hn(["concat","join","slice"],function(e){var t=K[e];s.prototype[e]=function(){var e=t.apply(this.__wrapped__,arguments);return this.__chain__&&(e=new s(e),e.__chain__=n),e}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(e._=s,define(function(
|
||||||
|
){return s})):$?"object"==typeof module&&module&&module.exports==$?(module.exports=s)._=s:$._=s:e._=s})(this);
|
||||||
55
lodash.underscore.min.js
vendored
55
lodash.underscore.min.js
vendored
@@ -1,30 +1,31 @@
|
|||||||
/*!
|
/*!
|
||||||
Lo-Dash 0.9.1 lodash.com/license
|
Lo-Dash 0.9.2 lodash.com/license
|
||||||
Underscore.js 1.4.2 underscorejs.org/LICENSE
|
Underscore.js 1.4.2 underscorejs.org/LICENSE
|
||||||
*/
|
*/
|
||||||
;(function(e,t){function s(e,t,n){var r;if(!e)return e;var t=p(t,n),i=e.length,n=-1;if("number"==typeof i){for(;++n<i;)if(r=e[n],t(r,n,e)===J)return e}else for(n in e)if(it.call(e,n)&&(r=e[n],t(r,n,e)===J))return e}function o(e){var t,n,r=e;if(!e)return e;for(var i=1,s=arguments.length;i<s;i++)if(r=arguments[i])for(t in r)n=r[t],e[t]=n;return e}function u(e){var t,n,i=e;if(!e)return e;for(var s=1,o=arguments.length;s<o;s++)if(i=arguments[s])for(t in i)n=i[t],e[t]==r&&(e[t]=n);return e}function a(e
|
;(function(e,t){function n(e){if(e&&e.__wrapped__)return e;if(!(this instanceof n))return new n(e);this.__wrapped__=e}function r(e,n){var r=e.b,i=n.b,e=e.a,n=n.a;if(e!==n){if(e>n||e===t)return 1;if(e<n||n===t)return-1}return r<i?-1:1}function i(e,t,n){function r(){var i=arguments,s=t;return n.length&&(i=i.length?n.concat(Z.call(i)):n),this instanceof r?(a.prototype=e.prototype,s=new a,i=e.apply(s,i),v(i)?i:s):e.apply(s,i)}return r}function s(e,n){return e?"function"!=typeof e?function(t){return t[
|
||||||
,t){var n,r;if(e)for(n in t=p(t),e)if(it.call(e,n)&&(r=e[n],t(r,n,e)===J))break}function f(e,t){var n,r;if(e)for(n in t=p(t),e)if(r=e[n],t(r,n,e)===J)break}function l(e){if(e&&e.__wrapped__)return e;if(!(this instanceof l))return new l(e);this.__wrapped__=e}function c(e,n){var r=e.b,i=n.b,e=e.a,n=n.a;if(e!==n){if(e>n||e===t)return 1;if(e<n||n===t)return-1}return r<i?-1:1}function h(e,t,n){function r(){var i=arguments,s=t;return n.length&&(i=i.length?n.concat(ot.call(i)):n),this instanceof r?(m.prototype=
|
e]}:n!==t?function(t,r,i){return e.call(n,t,r,i)}:e:H}function o(e){return"\\"+yt[e]}function u(e){return Et[e]}function a(){}function f(e){return St[e]}function l(e){var t=[];return wt(e,function(e,n){t.push(n)}),t}function c(e){var t=[];return bt(e,function(e,n){d(e)&&t.push(n)}),t.sort()}function h(e){var t={};return wt(e,function(e,n){t[e]=n}),t}function p(e,t,n,r){if(e===t)return 0!==e||1/e==1/t;if(null==e||null==t)return e===t;var i=et.call(e);if(i!=et.call(t))return!1;switch(i){case ft:case lt
|
||||||
e.prototype,s=new m,(i=e.apply(s,i))&&Nt[typeof i]?i:s):e.apply(s,i)}return r}function p(e,n){return e?"function"!=typeof e?function(t){return t[e]}:n!==t?function(t,r,i){return e.call(n,t,r,i)}:e:U}function d(e){return"\\"+Ct[e]}function v(e){return kt[e]}function m(){}function g(e){return Lt[e]}function y(e){var t=[];return a(e,function(e,n){t.push(n)}),t}function b(e){var t=[];return f(e,function(e,n){S(e)&&t.push(n)}),t.sort()}function w(e){var t={};return a(e,function(e,n){t[e]=n}),t}function E
|
:return+e==+t;case ct:return e!=+e?t!=+t:0==e?1/e==1/t:e==+t;case pt:case dt:return e==t+""}var s=i==at;if(!s){if(e.__wrapped__||t.__wrapped__)return p(e.__wrapped__||e,t.__wrapped__||t);if(i!=ht)return!1;var i=e.constructor,o=t.constructor;if(i!=o&&(!d(i)||!(i instanceof i&&d(o)&&o instanceof o)))return!1}n||(n=[]),r||(r=[]);for(i=n.length;i--;)if(n[i]==e)return r[i]==t;i=!0,o=0,n.push(e),r.push(t);if(s){o=e.length;if(i=o==t.length)for(;o--&&(i=p(e[o],t[o],n,r)););return i}for(var u in e)if(G.call
|
||||||
(e,t,s,o){if(e===t)return 0!==e||1/e==1/t;if(e==r||t==r)return e===t;var u=ut.call(e);if(u!=ut.call(t))return i;switch(u){case gt:case yt:return+e==+t;case bt:return e!=+e?t!=+t:0==e?1/e==1/t:e==+t;case Et:case St:return e==t+""}var a=u==mt;if(!a){if(e.__wrapped__||t.__wrapped__)return E(e.__wrapped__||e,t.__wrapped__||t);if(u!=wt)return i;var u=e.constructor,f=t.constructor;if(u!=f&&(!S(u)||!(u instanceof u&&S(f)&&f instanceof f)))return i}s||(s=[]),o||(o=[]);for(u=s.length;u--;)if(s[u]==e)return o
|
(e,u)&&(o++,!G.call(t,u)||!p(e[u],t[u],n,r)))return!1;for(u in t)if(G.call(t,u)&&!(o--))return!1;return!0}function d(e){return"function"==typeof e}function v(e){return e?gt[typeof e]:!1}function m(e){return et.call(e)==dt}function g(e){var t=[];return wt(e,function(e){t.push(e)}),t}function y(e,t){return"number"==typeof (e?e.length:0)?-1<O(e,t):k(e,function(e){return e===t})}function b(e,t,n){var r=!0,t=s(t,n);if(Nt(e))for(var n=-1,i=e.length;++n<i&&(r=!!t(e[n],n,e)););else kt(e,function(e,n,i){return!
|
||||||
[u]==t;u=n,f=0,s.push(e),o.push(t);if(a){f=e.length;if(u=f==t.length)for(;f--&&(u=E(e[f],t[f],s,o)););return u}for(var l in e)if(it.call(e,l)&&(f++,!it.call(t,l)||!E(e[l],t[l],s,o)))return i;for(l in t)if(it.call(t,l)&&!(f--))return i;return n}function S(e){return"function"==typeof e}function x(e){return ut.call(e)==St}function T(e){var t=[];return a(e,function(e){t.push(e)}),t}function N(e,t){return"number"==typeof (e?e.length:0)?-1<j(e,t):P(e,function(e){return e===t})}function C(e,t,r){var i=n
|
(r=!!t(e,n,i))&&R});return r}function w(e,t,n){var r=[],t=s(t,n);return kt(e,function(e,n,i){t(e,n,i)&&r.push(e)}),r}function E(e,t,n){var r,t=s(t,n);return kt(e,function(e,n,i){if(t(e,n,i))return r=e,!1}),r}function S(e,t,n){var r=-1,i=e?e.length:0,o=Array("number"==typeof i?i:0),t=s(t,n);if(Nt(e))for(;++r<i;)o[r]=t(e[r],r,e);else kt(e,function(e,n,i){o[++r]=t(e,n,i)});return o}function x(e,t,n){var r=-Infinity,i=-1,o=e?e.length:0,u=r;if(t||!Nt(e))t=s(t,n),kt(e,function(e,n,i){n=t(e,n,i),n>r&&(r=
|
||||||
,t=p(t,r);return s(e,function(e,n,r){return!(i=!!t(e,n,r))&&J}),i}function k(e,t,n){var r=[],t=p(t,n);return s(e,function(e,n,i){t(e,n,i)&&r.push(e)}),r}function L(e,t,r){var i,t=p(t,r);return P(e,function(e,r,s){return t(e,r,s)&&(i=e,n)}),i}function A(e,t,n){var r=-1,i=e?e.length:0,o=Array("number"==typeof i?i:0),t=p(t,n);if(At(e))for(;++r<i;)o[r]=t(e[r],r,e);else s(e,function(e,n,i){o[++r]=t(e,n,i)});return o}function O(e,t,n){var r=-Infinity,i=-1,o=e?e.length:0,u=r;if(t||"number"!=typeof o)t=p
|
n,u=e)});else for(;++i<o;)e[i]>u&&(u=e[i]);return u}function T(e,t){var n=[];return kt(e,function(e){n.push(e[t])}),n}function N(e,t,n,r){var i=3>arguments.length,t=s(t,r);return kt(e,function(e,r,s){n=i?(i=!1,e):t(n,e,r,s)}),n}function C(e,t,n,r){var i=e?e.length:0,s=3>arguments.length;if("number"!=typeof i)var o=Ct(e),i=o.length;return kt(e,function(u,a,f){a=o?o[--i]:--i,n=s?(s=!1,e[a]):t.call(r,n,e[a],a,f)}),n}function k(e,t,n){var r,t=s(t,n);if(Nt(e))for(var n=-1,i=e.length;++n<i&&!(r=t(e[n],
|
||||||
(t,n),s(e,function(e,n,i){n=t(e,n,i),n>r&&(r=n,u=e)});else for(;++i<o;)e[i]>u&&(u=e[i]);return u}function M(e,t){var n=[];return s(e,function(e){n.push(e[t])}),n}function _(e,t,n,r){var o=3>arguments.length,t=p(t,r);return s(e,function(e,r,s){n=o?(o=i,e):t(n,e,r,s)}),n}function D(e,t,n,r){var o=e?e.length:0,u=3>arguments.length;if("number"!=typeof o)var a=Ot(e),o=a.length;return s(e,function(s,f,l){f=a?a[--o]:--o,n=u?(u=i,e[f]):t.call(r,n,e[f],f,l)}),n}function P(e,t,n){var r,t=p(t,n);return s(e,
|
n,e)););else kt(e,function(e,n,i){return(r=t(e,n,i))&&R});return!!r}function L(e,t,n){if(e)return null==t||n?e[0]:Z.call(e,0,t)}function A(e,t){for(var n=-1,r=e?e.length:0,i=[];++n<r;){var s=e[n];Nt(s)?Y.apply(i,t?s:A(s)):i.push(s)}return i}function O(e,t,n){var r=-1,i=e?e.length:0;if("number"==typeof n)r=(0>n?st(0,i+n):n||0)-1;else if(n)return r=_(e,t),e[r]===t?r:-1;for(;++r<i;)if(e[r]===t)return r;return-1}function M(e,t,n){return e?Z.call(e,null==t||n?1:t):[]}function _(e,t,n,r){for(var i=0,o=
|
||||||
function(e,n,i){return(r=t(e,n,i))&&J}),!!r}function H(e,t,n){if(e)return t==r||n?e[0]:ot.call(e,0,t)}function B(e,t){for(var n=-1,r=e?e.length:0,i=[];++n<r;){var s=e[n];At(s)?st.apply(i,t?s:B(s)):i.push(s)}return i}function j(e,t,n){var r=-1,i=e?e.length:0;if("number"==typeof n)r=(0>n?pt(0,i+n):n||0)-1;else if(n)return r=I(e,t),e[r]===t?r:-1;for(;++r<i;)if(e[r]===t)return r;return-1}function F(e,t,n){return e?ot.call(e,t==r||n?1:t):[]}function I(e,t,n,r){for(var i=0,s=e?e.length:i,n=n?p(n,r):U,t=
|
e?e.length:i,n=n?s(n,r):H,t=n(t);i<o;)r=i+o>>>1,n(e[r])<t?i=r+1:o=r;return i}function D(e,t,n,r){var i=-1,o=e?e.length:0,u=[],a=u;n&&(a=[],n=s(n,r));for(;++i<o;){var r=e[i],f=n?n(r,i,e):r;if(t?!i||a[a.length-1]!==f:0>O(a,f))n&&a.push(f),u.push(r)}return u}function P(e,t){return mt||tt&&2<arguments.length?tt.call.apply(tt,arguments):i(e,t,Z.call(arguments,2))}function H(e){return e}function B(e){kt(c(e),function(t){var r=n[t]=e[t];n.prototype[t]=function(){var e=[this.__wrapped__];return Y.apply(e
|
||||||
n(t);i<s;)r=i+s>>>1,n(e[r])<t?i=r+1:s=r;return i}function q(e,t,n,r){var i=-1,s=e?e.length:0,o=[],u=o;n&&(u=[],n=p(n,r));for(;++i<s;){var r=e[i],a=n?n(r,i,e):r;if(t?!i||u[u.length-1]!==a:0>j(u,a))n&&u.push(a),o.push(r)}return o}function R(e,t){return Tt||at&&2<arguments.length?at.call.apply(at,arguments):h(e,t,ot.call(arguments,2))}function U(e){return e}function z(e){s(b(e),function(t){var r=l[t]=e[t];l.prototype[t]=function(){var e=[this.__wrapped__];return st.apply(e,arguments),e=r.apply(l,e),
|
,arguments),e=r.apply(n,e),this.__chain__&&(e=new n(e),e.__chain__=!0),e}})}var j="object"==typeof exports&&exports,F="object"==typeof global&&global;F.global===F&&(e=F);var I=[],F=new function(){},q=0,R=F,U=e._,z=/&(?:amp|lt|gt|quot|#x27);/g,W=RegExp("^"+(F.valueOf+"").replace(/[.*+?^=!:${}()|[\]\/\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),X=/($^)/,V=/[&<>"']/g,$=/['\n\r\t\u2028\u2029\\]/g,J=Math.ceil,K=I.concat,Q=Math.floor,G=F.hasOwnProperty,Y=I.push,Z=I.slice,et=F.toString,tt=W.test
|
||||||
this.__chain__&&(e=new l(e),e.__chain__=n),e}})}var n=!0,r=null,i=!1,W="object"==typeof exports&&exports,X="object"==typeof global&&global;X.global===X&&(e=X);var V=[],X={},$=0,J={},K=e._,Q=/&(?:amp|lt|gt|quot|#x27);/g,G=RegExp("^"+(X.valueOf+"").replace(/[.*+?^=!:${}()|[\]\/\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),Y=/($^)/,Z=/[&<>"']/g,et=/['\n\r\t\u2028\u2029\\]/g,tt=Math.ceil,nt=V.concat,rt=Math.floor,it=X.hasOwnProperty,st=V.push,ot=V.slice,ut=X.toString,at=G.test(at=ot.bind)&&
|
(tt=Z.bind)&&tt,nt=W.test(nt=Array.isArray)&&nt,rt=e.isFinite,it=W.test(it=Object.keys)&&it,st=Math.max,ot=Math.min,ut=Math.random,at="[object Array]",ft="[object Boolean]",lt="[object Date]",ct="[object Number]",ht="[object Object]",pt="[object RegExp]",dt="[object String]",vt=(vt={0:1,length:1},I.splice.call(vt,0,1),vt[0]),mt=tt&&/\n|Opera/.test(tt+et.call(e.opera)),gt={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,"undefined":!1},yt={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028"
|
||||||
at,ft=G.test(ft=Array.isArray)&&ft,lt=e.isFinite,ct=e.isNaN,ht=G.test(ht=Object.keys)&&ht,pt=Math.max,dt=Math.min,vt=Math.random,mt="[object Array]",gt="[object Boolean]",yt="[object Date]",bt="[object Number]",wt="[object Object]",Et="[object RegExp]",St="[object String]",xt=(xt={0:1,length:1},V.splice.call(xt,0,1),xt[0]),Tt=at&&/\n|Opera/.test(at+ut.call(e.opera)),Nt={"boolean":i,"function":n,object:n,number:i,string:i,"undefined":i},Ct={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028"
|
:"u2028","\u2029":"u2029"};n.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},n.isArguments=function(e){return"[object Arguments]"==et.call(e)},n.isArguments(arguments)||(n.isArguments=function(e){return e?G.call(e,"callee"):!1});var bt=function(e,t){var n,r;if(!e)return e;t=s(t);for(n in e)if(r=e[n],t(r,n,e)===R)break;return e},wt=function(e,t){var n,r;if(!e)return e;t=s(t);for(n in e)if(G.call(e,n)&&(r=e[n],t(r,n,e)===R))break;return e
|
||||||
,"\u2029":"u2029"};l.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},l.isArguments=function(e){return"[object Arguments]"==ut.call(e)},l.isArguments(arguments)||(l.isArguments=function(e){return e?it.call(e,"callee"):i});var kt={"&":"&","<":"<",">":">",'"':""","'":"'"},Lt=w(kt),At=ft||function(e){return ut.call(e)==mt};S(/x/)&&(S=function(e){return"[object Function]"==ut.call(e)});var Ot=ht?function(e){return e&&
|
},Et={"&":"&","<":"<",">":">",'"':""","'":"'"},St=h(Et),xt=function(e){var t,n,r=e;if(!e)return e;for(var i=1,s=arguments.length;i<s;i++)if(r=arguments[i])for(t in r)n=r[t],null==e[t]&&(e[t]=n);return e},Tt=function(e){var t,n,r=e;if(!e)return e;for(var i=1,s=arguments.length;i<s;i++)if(r=arguments[i])for(t in r)n=r[t],e[t]=n;return e},Nt=nt||function(e){return et.call(e)==at};d(/x/)&&(d=function(e){return"[object Function]"==et.call(e)});var Ct=it?function(e){return v(e)?it(e
|
||||||
Nt[typeof e]?ht(e):[]}:y;l.VERSION="0.9.1",l.after=function(e,t){return 1>e?t():function(){if(1>--e)return t.apply(this,arguments)}},l.bind=R,l.bindAll=function(e){for(var t=arguments,n=1<t.length?0:(t=b(e),-1),r=t.length;++n<r;){var i=t[n];e[i]=R(e[i],e)}return e},l.chain=function(e){return e=new l(e),e.__chain__=n,e},l.clone=function(e){return e&&Nt[typeof e]?At(e)?ot.call(e):o({},e):e},l.compact=function(e){for(var t=-1,n=e?e.length:0,r=[];++t<n;){var i=e[t];i&&r.push(i)}return r},l.compose=function(
|
):[]}:l,kt=function(e,t,n){var r;if(!e)return e;var t=s(t,n),i=e.length,n=-1;if("number"==typeof i){for(;++n<i;)if(r=e[n],t(r,n,e)===R)return e}else for(n in e)if(G.call(e,n)&&(r=e[n],t(r,n,e)===R))return e};n.VERSION="0.9.2",n.after=function(e,t){return 1>e?t():function(){if(1>--e)return t.apply(this,arguments)}},n.bind=P,n.bindAll=function(e){for(var t=arguments,n=1<t.length?0:(t=c(e),-1),r=t.length;++n<r;){var i=t[n];e[i]=P(e[i],e)}return e},n.chain=function(e){return e=new n(e),e.__chain__=!0
|
||||||
){var e=arguments;return function(){for(var t=arguments,n=e.length;n--;)t=[e[n].apply(this,t)];return t[0]}},l.contains=N,l.countBy=function(e,t,n){var r={},t=p(t,n);return s(e,function(e,n,i){n=t(e,n,i),it.call(r,n)?r[n]++:r[n]=1}),r},l.debounce=function(e,t,n){function i(){a=r,n||(o=e.apply(u,s))}var s,o,u,a;return function(){var r=n&&!a;return s=arguments,u=this,clearTimeout(a),a=setTimeout(i,t),r&&(o=e.apply(u,s)),o}},l.defaults=u,l.defer=function(e){var n=ot.call(arguments,1);return setTimeout
|
,e},n.clone=function(e){return e&>[typeof e]?Nt(e)?Z.call(e):Tt({},e):e},n.compact=function(e){for(var t=-1,n=e?e.length:0,r=[];++t<n;){var i=e[t];i&&r.push(i)}return r},n.compose=function(){var e=arguments;return function(){for(var t=arguments,n=e.length;n--;)t=[e[n].apply(this,t)];return t[0]}},n.contains=y,n.countBy=function(e,t,n){var r={},t=s(t,n);return kt(e,function(e,n,i){n=t(e,n,i),G.call(r,n)?r[n]++:r[n]=1}),r},n.debounce=function(e,t,n){function r(){u=null,n||(s=e.apply(o,i))}var i,s
|
||||||
(function(){e.apply(t,n)},1)},l.delay=function(e,n){var r=ot.call(arguments,2);return setTimeout(function(){e.apply(t,r)},n)},l.difference=function(e){for(var t=-1,n=e.length,r=nt.apply(V,arguments),i=[];++t<n;){var s=e[t];0>j(r,s,n)&&i.push(s)}return i},l.escape=function(e){return e==r?"":(e+"").replace(Z,v)},l.every=C,l.extend=o,l.filter=k,l.find=L,l.first=H,l.flatten=B,l.forEach=s,l.functions=b,l.groupBy=function(e,t,n){var r={},t=p(t,n);return s(e,function(e,n,i){n=t(e,n,i),(it.call(r,n)?r[n]
|
,o,u;return function(){var a=n&&!u;return i=arguments,o=this,clearTimeout(u),u=setTimeout(r,t),a&&(s=e.apply(o,i)),s}},n.defaults=xt,n.defer=function(e){var n=Z.call(arguments,1);return setTimeout(function(){e.apply(t,n)},1)},n.delay=function(e,n){var r=Z.call(arguments,2);return setTimeout(function(){e.apply(t,r)},n)},n.difference=function(e){for(var t=-1,n=e.length,r=K.apply(I,arguments),i=[];++t<n;){var s=e[t];0>O(r,s,n)&&i.push(s)}return i},n.escape=function(e){return null==e?"":(e+"").replace
|
||||||
:r[n]=[]).push(e)}),r},l.has=function(e,t){return e?it.call(e,t):i},l.identity=U,l.indexOf=j,l.initial=function(e,t,n){return e?ot.call(e,0,-(t==r||n?1:t)):[]},l.intersection=function(e){var t=arguments,n=t.length,r=[];return s(e,function(e){if(0>j(r,e)){for(var i=n;--i;)if(0>j(t[i],e))return;r.push(e)}}),r},l.invert=w,l.invoke=function(e,t){var n=ot.call(arguments,2),r="function"==typeof t,i=[];return s(e,function(e){i.push((r?t:e[t]).apply(e,n))}),i},l.isArray=At,l.isBoolean=function(e){return e===
|
(V,u)},n.every=b,n.extend=Tt,n.filter=w,n.find=E,n.first=L,n.flatten=A,n.forEach=kt,n.functions=c,n.groupBy=function(e,t,n){var r={},t=s(t,n);return kt(e,function(e,n,i){n=t(e,n,i),(G.call(r,n)?r[n]:r[n]=[]).push(e)}),r},n.has=function(e,t){return e?G.call(e,t):!1},n.identity=H,n.indexOf=O,n.initial=function(e,t,n){return e?Z.call(e,0,-(null==t||n?1:t)):[]},n.intersection=function(e){var t=arguments,n=t.length,r=[];return kt(e,function(e){if(0>O(r,e)){for(var i=n;--i;)if(0>O(t[i],e))return;r.push
|
||||||
n||e===i||ut.call(e)==gt},l.isDate=function(e){return ut.call(e)==yt},l.isElement=function(e){return e?1===e.nodeType:i},l.isEmpty=function(e){if(!e)return n;if(At(e)||x(e))return!e.length;for(var t in e)if(it.call(e,t))return i;return n},l.isEqual=E,l.isFinite=function(e){return lt(e)&&!ct(parseFloat(e))},l.isFunction=S,l.isNaN=function(e){return ut.call(e)==bt&&e!=+e},l.isNull=function(e){return e===r},l.isNumber=function(e){return ut.call(e)==bt},l.isObject=function(e){return e?Nt[typeof e]:i}
|
(e)}}),r},n.invert=h,n.invoke=function(e,t){var n=Z.call(arguments,2),r="function"==typeof t,i=[];return kt(e,function(e){i.push((r?t:e[t]).apply(e,n))}),i},n.isArray=Nt,n.isBoolean=function(e){return!0===e||!1===e||et.call(e)==ft},n.isDate=function(e){return et.call(e)==lt},n.isElement=function(e){return e?1===e.nodeType:!1},n.isEmpty=function(e){if(!e)return!0;if(Nt(e)||m(e))return!e.length;for(var t in e)if(G.call(e,t))return!1;return!0},n.isEqual=p,n.isFinite=function(e){return rt(e)&&et.call
|
||||||
,l.isRegExp=function(e){return ut.call(e)==Et},l.isString=x,l.isUndefined=function(e){return e===t},l.keys=Ot,l.last=function(e,t,n){if(e){var i=e.length;return t==r||n?e[i-1]:ot.call(e,-t||i)}},l.lastIndexOf=function(e,t,n){var r=e?e.length:0;for("number"==typeof n&&(r=(0>n?pt(0,r+n):dt(n,r-1))+1);r--;)if(e[r]===t)return r;return-1},l.map=A,l.max=O,l.memoize=function(e,t){var n={};return function(){var r=t?t.apply(this,arguments):arguments[0];return it.call(n,r)?n[r]:n[r]=e.apply(this,arguments)
|
(e)==ct},n.isFunction=d,n.isNaN=function(e){return et.call(e)==ct&&e!=+e},n.isNull=function(e){return null===e},n.isNumber=function(e){return et.call(e)==ct},n.isObject=v,n.isRegExp=function(e){return et.call(e)==pt},n.isString=m,n.isUndefined=function(e){return e===t},n.keys=Ct,n.last=function(e,t,n){if(e){var r=e.length;return null==t||n?e[r-1]:Z.call(e,-t||r)}},n.lastIndexOf=function(e,t,n){var r=e?e.length:0;for("number"==typeof n&&(r=(0>n?st(0,r+n):ot(n,r-1))+1);r--;)if(e[r]===t)return r;return-1
|
||||||
}},l.min=function(e,t,n){var r=Infinity,i=-1,o=e?e.length:0,u=r;if(t||"number"!=typeof o)t=p(t,n),s(e,function(e,n,i){n=t(e,n,i),n<r&&(r=n,u=e)});else for(;++i<o;)e[i]<u&&(u=e[i]);return u},l.mixin=z,l.noConflict=function(){return e._=K,this},l.object=function(e,t){for(var n=-1,r=e?e.length:0,i={};++n<r;){var s=e[n];t?i[s]=t[n]:i[s[0]]=s[1]}return i},l.omit=function(e){var t=nt.apply(V,arguments),n={};return f(e,function(e,r){0>j(t,r,1)&&(n[r]=e)}),n},l.once=function(e){var t,s=i;return function(
|
},n.map=S,n.max=x,n.memoize=function(e,t){var n={};return function(){var r=t?t.apply(this,arguments):arguments[0];return G.call(n,r)?n[r]:n[r]=e.apply(this,arguments)}},n.min=function(e,t,n){var r=Infinity,i=-1,o=e?e.length:0,u=r;if(t||!Nt(e))t=s(t,n),kt(e,function(e,n,i){n=t(e,n,i),n<r&&(r=n,u=e)});else for(;++i<o;)e[i]<u&&(u=e[i]);return u},n.mixin=B,n.noConflict=function(){return e._=U,this},n.object=function(e,t){for(var n=-1,r=e?e.length:0,i={};++n<r;){var s=e[n];t?i[s]=t[n]:i[s[0]]=s[1]}return i
|
||||||
){return s?t:(s=n,t=e.apply(this,arguments),e=r,t)}},l.pairs=function(e){var t=[];return a(e,function(e,n){t.push([n,e])}),t},l.pick=function(e){for(var t=0,n=nt.apply(V,arguments),r=n.length,i={};++t<r;){var s=n[t];s in e&&(i[s]=e[s])}return i},l.pluck=M,l.random=function(e,t){return e==r&&t==r&&(t=1),e=+e||0,t==r&&(t=e,e=0),e+rt(vt()*((+t||0)-e+1))},l.range=function(e,t,n){e=+e||0,n=+n||1,t==r&&(t=e,e=0);for(var i=-1,t=pt(0,tt((t-e)/n)),s=Array(t);++i<t;)s[i]=e,e+=n;return s},l.reduce=_,l.reduceRight=
|
},n.omit=function(e){var t=K.apply(I,arguments),n={};return bt(e,function(e,r){0>O(t,r,1)&&(n[r]=e)}),n},n.once=function(e){var t,n=!1;return function(){return n?t:(n=!0,t=e.apply(this,arguments),e=null,t)}},n.pairs=function(e){var t=[];return wt(e,function(e,n){t.push([n,e])}),t},n.pick=function(e){for(var t=0,n=K.apply(I,arguments),r=n.length,i={};++t<r;){var s=n[t];s in e&&(i[s]=e[s])}return i},n.pluck=T,n.random=function(e,t){return null==e&&null==t&&(t=1),e=+e||0,null==t&&(t=e,e=0),e+Q(ut()*
|
||||||
D,l.reject=function(e,t,n){return t=p(t,n),k(e,function(e,n,r){return!t(e,n,r)})},l.rest=F,l.result=function(e,t){var n=e?e[t]:r;return S(n)?e[t]():n},l.shuffle=function(e){var t=-1,n=Array(e?e.length:0);return s(e,function(e){var r=rt(vt()*(++t+1));n[t]=n[r],n[r]=e}),n},l.size=function(e){var t=e?e.length:0;return"number"==typeof t?t:Ot(e).length},l.some=P,l.sortBy=function(e,t,n){var r=[],t=p(t,n);s(e,function(e,n,i){r.push({a:t(e,n,i),b:n,c:e})}),e=r.length;for(r.sort(c);e--;)r[e]=r[e].c;return r
|
((+t||0)-e+1))},n.range=function(e,t,n){e=+e||0,n=+n||1,null==t&&(t=e,e=0);for(var r=-1,t=st(0,J((t-e)/n)),i=Array(t);++r<t;)i[r]=e,e+=n;return i},n.reduce=N,n.reduceRight=C,n.reject=function(e,t,n){return t=s(t,n),w(e,function(e,n,r){return!t(e,n,r)})},n.rest=M,n.result=function(e,t){var n=e?e[t]:null;return d(n)?e[t]():n},n.shuffle=function(e){var t=-1,n=Array(e?e.length:0);return kt(e,function(e){var r=Q(ut()*(++t+1));n[t]=n[r],n[r]=e}),n},n.size=function(e){var t=e?e.length:0;return"number"==typeof
|
||||||
},l.sortedIndex=I,l.tap=function(e,t){return t(e),e},l.template=function(e,t,n){e||(e="");var n=u({},n,l.templateSettings),r=0,i="__p += '",s=n.variable;e.replace(RegExp((n.escape||Y).source+"|"+(n.interpolate||Y).source+"|"+(n.evaluate||Y).source+"|$","g"),function(t,n,s,o,u){i+=e.slice(r,u).replace(et,d),i+=n?"'+_['escape']("+n+")+'":o?"';"+o+";__p+='":s?"'+((__t=("+s+"))==null?'':__t)+'":"",r=u+t.length}),i+="';",s||(s="obj",i="with("+s+"||{}){"+i+"}"),i="function("+s+"){var __t,__p='',__j=[].join;function print(){__p+=__j.call(arguments,'')}"+
|
t?t:Ct(e).length},n.some=k,n.sortBy=function(e,t,n){var i=[],t=s(t,n);kt(e,function(e,n,r){i.push({a:t(e,n,r),b:n,c:e})}),e=i.length;for(i.sort(r);e--;)i[e]=i[e].c;return i},n.sortedIndex=_,n.tap=function(e,t){return t(e),e},n.template=function(e,t,r){e||(e="");var r=xt({},r,n.templateSettings),i=0,s="__p += '",u=r.variable;e.replace(RegExp((r.escape||X).source+"|"+(r.interpolate||X).source+"|"+(r.evaluate||X).source+"|$","g"),function(t,n,r,u,a){s+=e.slice(i,a).replace($,o),s+=n?"'+_['escape']("+
|
||||||
i+"return __p}";try{var o=Function("_","return "+i)(l)}catch(a){throw a.source=i,a}return t?o(t):(o.source=i,o)},l.throttle=function(e,t){function n(){a=new Date,u=r,s=e.apply(o,i)}var i,s,o,u,a=0;return function(){var r=new Date,f=t-(r-a);return i=arguments,o=this,0>=f?(clearTimeout(u),a=r,s=e.apply(o,i)):u||(u=setTimeout(n,f)),s}},l.times=function(e,t,n){for(var e=+e||0,r=-1,i=Array(e);++r<e;)i[r]=t.call(n,r);return i},l.toArray=function(e){return e&&"number"==typeof e.length?"string"==typeof e?
|
n+")+'":u?"';"+u+";__p+='":r?"'+((__t=("+r+"))==null?'':__t)+'":"",i=a+t.length}),s+="';",u||(u="obj",s="with("+u+"||{}){"+s+"}"),s="function("+u+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+s+"return __p}";try{var a=Function("_","return "+s)(n)}catch(f){throw f.source=s,f}return t?a(t):(a.source=s,a)},n.throttle=function(e,t){function n(){u=new Date,o=null,i=e.apply(s,r)}var r,i,s,o,u=0;return function(){var a=new Date,f=t-(a-u);return r=arguments,s=this
|
||||||
e.split(""):ot.call(e):T(e)},l.unescape=function(e){return e==r?"":(e+"").replace(Q,g)},l.union=function(){return q(nt.apply(V,arguments))},l.uniq=q,l.uniqueId=function(e){var t=$++;return e?e+t:t},l.values=T,l.where=function(e,t){var n=[];return f(t,function(e,t){n.push(t)}),k(e,function(e){for(var r=n.length;r--;){var i=e[n[r]]===t[n[r]];if(!i)break}return!!i})},l.without=function(e){for(var t=-1,n=e.length,r=[];++t<n;){var i=e[t];0>j(arguments,i,1)&&r.push(i)}return r},l.wrap=function(e,t){return function(
|
,0>=f?(clearTimeout(o),u=a,i=e.apply(s,r)):o||(o=setTimeout(n,f)),i}},n.times=function(e,t,n){for(var e=+e||0,r=-1,i=Array(e);++r<e;)i[r]=t.call(n,r);return i},n.toArray=function(e){return e&&"number"==typeof e.length?"string"==typeof e?e.split(""):Z.call(e):g(e)},n.unescape=function(e){return null==e?"":(e+"").replace(z,f)},n.union=function(){return D(K.apply(I,arguments))},n.uniq=D,n.uniqueId=function(e){var t=q++;return e?e+t:t},n.values=g,n.where=function(e,t){var n=[];return bt(t,function(e,
|
||||||
){var n=[e];return st.apply(n,arguments),t.apply(this,n)}},l.zip=function(e){for(var t=-1,n=e?O(M(arguments,"length")):0,r=Array(n);++t<n;)r[t]=M(arguments,t);return r},l.all=C,l.any=P,l.collect=A,l.detect=L,l.drop=F,l.each=s,l.foldl=_,l.foldr=D,l.head=H,l.include=N,l.inject=_,l.methods=b,l.select=k,l.tail=F,l.take=H,l.unique=q,z(l),l.prototype.chain=function(){return this.__chain__=n,this},l.prototype.value=function(){return this.__wrapped__},s("pop push reverse shift sort splice unshift".split(" "
|
t){n.push(t)}),w(e,function(e){for(var r=n.length;r--;){var i=e[n[r]]===t[n[r]];if(!i)break}return!!i})},n.without=function(e){for(var t=-1,n=e.length,r=[];++t<n;){var i=e[t];0>O(arguments,i,1)&&r.push(i)}return r},n.wrap=function(e,t){return function(){var n=[e];return Y.apply(n,arguments),t.apply(this,n)}},n.zip=function(e){for(var t=-1,n=e?x(T(arguments,"length")):0,r=Array(n);++t<n;)r[t]=T(arguments,t);return r},n.all=b,n.any=k,n.collect=S,n.detect=E,n.drop=M,n.each=kt,n.foldl=N,n.foldr=C,n.head=
|
||||||
),function(e){var t=V[e];l.prototype[e]=function(){var e=this.__wrapped__;return t.apply(e,arguments),xt&&e.length===0&&delete e[0],this.__chain__&&(e=new l(e),e.__chain__=n),e}}),s(["concat","join","slice"],function(e){var t=V[e];l.prototype[e]=function(){var e=t.apply(this.__wrapped__,arguments);return this.__chain__&&(e=new l(e),e.__chain__=n),e}}),W?"object"==typeof module&&module&&module.exports==W?(module.exports=l)._=l:W._=l:e._=l})(this);
|
L,n.include=y,n.inject=N,n.methods=c,n.select=w,n.tail=M,n.take=L,n.unique=D,B(n),n.prototype.chain=function(){return this.__chain__=!0,this},n.prototype.value=function(){return this.__wrapped__},kt("pop push reverse shift sort splice unshift".split(" "),function(e){var t=I[e];n.prototype[e]=function(){var e=this.__wrapped__;return t.apply(e,arguments),vt&&e.length===0&&delete e[0],this.__chain__&&(e=new n(e),e.__chain__=!0),e}}),kt(["concat","join","slice"],function(e){var t=I[e];n.prototype[e]=
|
||||||
|
function(){var e=t.apply(this.__wrapped__,arguments);return this.__chain__&&(e=new n(e),e.__chain__=!0),e}}),j?"object"==typeof module&&module&&module.exports==j?(module.exports=n)._=n:j._=n:e._=n})(this);
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "lodash",
|
"name": "lodash",
|
||||||
"version": "0.9.1",
|
"version": "0.9.2",
|
||||||
"description": "A drop-in replacement for Underscore.js delivering performance, bug fixes, and additional features.",
|
"description": "A drop-in replacement for Underscore.js delivering performance, bug fixes, and additional features.",
|
||||||
"homepage": "http://lodash.com",
|
"homepage": "http://lodash.com",
|
||||||
"main": "./lodash",
|
"main": "./lodash",
|
||||||
@@ -24,9 +24,6 @@
|
|||||||
"email": "john.david.dalton@gmail.com",
|
"email": "john.david.dalton@gmail.com",
|
||||||
"web": "http://allyoucanleet.com/"
|
"web": "http://allyoucanleet.com/"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
|
||||||
"tar": "~0.1.13"
|
|
||||||
},
|
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/bestiejs/lodash/issues"
|
"url": "https://github.com/bestiejs/lodash/issues"
|
||||||
},
|
},
|
||||||
|
|||||||
44
perf/perf.js
44
perf/perf.js
@@ -1577,11 +1577,11 @@
|
|||||||
Benchmark.Suite('`_.times`')
|
Benchmark.Suite('`_.times`')
|
||||||
.add(buildName, '\
|
.add(buildName, '\
|
||||||
var result = [];\
|
var result = [];\
|
||||||
lodash.times(length, function(n) { result.push(n); })'
|
lodash.times(limit, function(n) { result.push(n); })'
|
||||||
)
|
)
|
||||||
.add(otherName, '\
|
.add(otherName, '\
|
||||||
var result = [];\
|
var result = [];\
|
||||||
_.times(length, function(n) { result.push(n); })'
|
_.times(limit, function(n) { result.push(n); })'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -1589,11 +1589,11 @@
|
|||||||
Benchmark.Suite('`_.times` with `thisArg`')
|
Benchmark.Suite('`_.times` with `thisArg`')
|
||||||
.add(buildName, '\
|
.add(buildName, '\
|
||||||
var result = [];\
|
var result = [];\
|
||||||
lodash.times(length, function(n) { result.push(this.sin(n)); }, Math)'
|
lodash.times(limit, function(n) { result.push(this.sin(n)); }, Math)'
|
||||||
)
|
)
|
||||||
.add(otherName, '\
|
.add(otherName, '\
|
||||||
var result = [];\
|
var result = [];\
|
||||||
_.times(length, function(n) { result.push(this.sin(n)); }, Math)'
|
_.times(limit, function(n) { result.push(this.sin(n)); }, Math)'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -1657,6 +1657,42 @@
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
suites.push(
|
||||||
|
Benchmark.Suite('`_.uniq` iterating an array of 50 elements')
|
||||||
|
.add(buildName, {
|
||||||
|
'fn': 'lodash.uniq(twentyFiveValues.concat(twentyFiveValues2));',
|
||||||
|
'teardown': 'function multiArrays(){}'
|
||||||
|
})
|
||||||
|
.add(otherName, {
|
||||||
|
'fn': '_.uniq(twentyFiveValues.concat(twentyFiveValues2));',
|
||||||
|
'teardown': 'function multiArrays(){}'
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
suites.push(
|
||||||
|
Benchmark.Suite('`_.uniq` iterating an array of 75 elements')
|
||||||
|
.add(buildName, {
|
||||||
|
'fn': 'lodash.uniq(fiftyValues.concat(twentyFiveValues2));',
|
||||||
|
'teardown': 'function multiArrays(){}'
|
||||||
|
})
|
||||||
|
.add(otherName, {
|
||||||
|
'fn': '_.uniq(fiftyValues.concat(twentyFiveValues2));',
|
||||||
|
'teardown': 'function multiArrays(){}'
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
suites.push(
|
||||||
|
Benchmark.Suite('`_.uniq` iterating an array of 100 elements')
|
||||||
|
.add(buildName, {
|
||||||
|
'fn': 'lodash.uniq(seventyFiveValues.concat(twentyFiveValues2));',
|
||||||
|
'teardown': 'function multiArrays(){}'
|
||||||
|
})
|
||||||
|
.add(otherName, {
|
||||||
|
'fn': '_.uniq(seventyFiveValues.concat(twentyFiveValues2));',
|
||||||
|
'teardown': 'function multiArrays(){}'
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
suites.push(
|
suites.push(
|
||||||
|
|||||||
@@ -488,25 +488,31 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
asyncTest('`lodash template=*.jst` exports=amd', function() {
|
['', 'moduleId=underscore'].forEach(function(command) {
|
||||||
var start = _.after(2, _.once(QUnit.start));
|
asyncTest('`lodash template=*.jst` exports=amd' + (command ? ' ' + command : ''), function() {
|
||||||
|
var start = _.after(2, _.once(QUnit.start));
|
||||||
|
|
||||||
build(['-s', 'template=' + templatePath + '/*.jst', 'exports=amd'], function(source, filePath) {
|
build(['-s', 'template=' + templatePath + '/*.jst', 'exports=amd'].concat(command || []), function(source, filePath) {
|
||||||
var basename = path.basename(filePath, '.js'),
|
var moduleId,
|
||||||
context = createContext(),
|
basename = path.basename(filePath, '.js'),
|
||||||
pass = false;
|
context = createContext(),
|
||||||
|
pass = false;
|
||||||
|
|
||||||
(context.define = function(requires, factory) {
|
(context.define = function(requires, factory) {
|
||||||
factory(_);
|
factory(_);
|
||||||
var templates = _.templates;
|
var templates = _.templates;
|
||||||
pass = 'a' in templates && 'b' in templates;
|
moduleId = requires + '';
|
||||||
})
|
pass = 'a' in templates && 'b' in templates;
|
||||||
.amd = {};
|
})
|
||||||
|
.amd = {};
|
||||||
|
|
||||||
vm.runInContext(source, context);
|
vm.runInContext(source, context);
|
||||||
ok(pass, basename);
|
|
||||||
delete _.templates;
|
equal(moduleId, command ? 'underscore' : 'lodash');
|
||||||
start();
|
ok(pass, basename);
|
||||||
|
delete _.templates;
|
||||||
|
start();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -636,28 +642,34 @@
|
|||||||
equal(object.fn(), 2, '_.bind: ' + basename);
|
equal(object.fn(), 2, '_.bind: ' + basename);
|
||||||
|
|
||||||
ok(lodash.clone(array, true)[0] === array[0], '_.clone should be shallow: ' + basename);
|
ok(lodash.clone(array, true)[0] === array[0], '_.clone should be shallow: ' + basename);
|
||||||
|
equal(lodash.contains([1, 2, 3], 1, 2), true, '_.contains should ignore `fromIndex`: ' + basename);
|
||||||
equal(lodash.every([true, false, true]), false, '_.every: ' + basename);
|
equal(lodash.every([true, false, true]), false, '_.every: ' + basename);
|
||||||
|
|
||||||
object = { 'length': 0, 'splice': Array.prototype.splice };
|
|
||||||
equal(lodash.isEmpty(object), false, '_.isEmpty: ' + basename);
|
|
||||||
|
|
||||||
var actual = lodash.forEach(array, function(value) {
|
var actual = lodash.forEach(array, function(value) {
|
||||||
last = value;
|
last = value;
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
equal(last.value, 2, '_.forEach should not exit early: ' + basename);
|
equal(last.value, 2, '_.forEach should not exit early: ' + basename);
|
||||||
equal(actual, undefined, '_.forEach should return undefined: ' + basename);
|
equal(actual, undefined, '_.forEach should return `undefined`: ' + basename);
|
||||||
|
|
||||||
|
object = { 'length': 0, 'splice': Array.prototype.splice };
|
||||||
|
equal(lodash.isEmpty(object), false, '_.isEmpty should return `false` for jQuery/MooTools DOM query collections: ' + basename);
|
||||||
|
|
||||||
|
equal(lodash.isFinite('2'), false, '_.isFinite should return `false` for numeric string values: ' + basename);
|
||||||
|
equal(lodash.max('abc'), -Infinity, '_.max should return `-Infinity` for strings: ' + basename);
|
||||||
|
equal(lodash.min('abc'), Infinity, '_.min should return `Infinity` for strings: ' + basename);
|
||||||
|
|
||||||
// avoid issues comparing objects with `deepEqual`
|
// avoid issues comparing objects with `deepEqual`
|
||||||
object = { 'a': 1, 'b': 2, 'c': 3 };
|
object = { 'a': 1, 'b': 2, 'c': 3 };
|
||||||
var actual = lodash.omit(object, function(value) { return value == 3; });
|
var actual = lodash.omit(object, function(value) { return value == 3; });
|
||||||
deepEqual(_.keys(actual).sort(), ['a', 'b', 'c'], '_.omit: ' + basename);
|
deepEqual(_.keys(actual).sort(), ['a', 'b', 'c'], '_.omit should not accept a `callback`: ' + basename);
|
||||||
|
|
||||||
actual = lodash.pick(object, function(value) { return value != 3; });
|
actual = lodash.pick(object, function(value) { return value != 3; });
|
||||||
deepEqual(_.keys(actual), [], '_.pick: ' + basename);
|
deepEqual(_.keys(actual), [], '_.pick should not accept a `callback`: ' + basename);
|
||||||
|
|
||||||
equal(lodash.some([false, true, false]), true, '_.some: ' + basename);
|
equal(lodash.some([false, true, false]), true, '_.some: ' + basename);
|
||||||
|
equal(lodash.template('${a}', object), '${a}', '_.template should ignore ES6 delimiters: ' + basename);
|
||||||
start();
|
start();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
55
test/test.js
55
test/test.js
@@ -262,6 +262,33 @@
|
|||||||
QUnit.module('lodash.contains');
|
QUnit.module('lodash.contains');
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
_.each({
|
||||||
|
'an array': [1, 2, 3, 1, 2, 3],
|
||||||
|
'an object': { 'a': 1, 'b': 2, 'c': 3, 'd': 1, 'e': 2, 'f': 3 },
|
||||||
|
'a string': '123123'
|
||||||
|
},
|
||||||
|
function(collection, key) {
|
||||||
|
test('should work with ' + key + ' and a positive `fromIndex`', function() {
|
||||||
|
equal(_.contains(collection, 1, 2), true);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('should work with ' + key + ' and a `fromIndex` >= collection\'s length', function() {
|
||||||
|
equal(_.contains(collection, 1, 6), false);
|
||||||
|
equal(_.contains(collection, undefined, 6), false);
|
||||||
|
equal(_.contains(collection, 1, 8), false);
|
||||||
|
equal(_.contains(collection, undefined, 8), false);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('should work with ' + key + ' and a negative `fromIndex`', function() {
|
||||||
|
equal(_.contains(collection, 2, -3), true);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('should work with ' + key + ' and a negative `fromIndex` <= negative collection\'s length', function() {
|
||||||
|
equal(_.contains(collection, 1, -6), true);
|
||||||
|
equal(_.contains(collection, 2, -8), true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
_.each({
|
_.each({
|
||||||
'literal': 'abc',
|
'literal': 'abc',
|
||||||
'object': Object('abc')
|
'object': Object('abc')
|
||||||
@@ -1012,6 +1039,21 @@
|
|||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
QUnit.module('lodash.max and lodash.min string iteration');
|
||||||
|
|
||||||
|
_.each(['max', 'min'], function(methodName) {
|
||||||
|
var func = _[methodName];
|
||||||
|
|
||||||
|
test('lodash.' + methodName + ' should iterate a string', function() {
|
||||||
|
_.each(['abc', Object('abc')], function(value) {
|
||||||
|
var actual = func(value);
|
||||||
|
equal(actual, methodName == 'max' ? 'c' : 'a');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
QUnit.module('lodash.merge');
|
QUnit.module('lodash.merge');
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
@@ -1618,6 +1660,12 @@
|
|||||||
|
|
||||||
equal(compiled({ 'value': true }), expected);
|
equal(compiled({ 'value': true }), expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('should parse ES6 template delimiters', function() {
|
||||||
|
var data = { 'value': 2 };
|
||||||
|
equal(_.template('1${value}3', data), '123');
|
||||||
|
equal(_.template('${"{" + value + "\\}"}', data), '{2}');
|
||||||
|
});
|
||||||
}());
|
}());
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
@@ -1754,6 +1802,13 @@
|
|||||||
|
|
||||||
deepEqual(actual, [1, 2, 3]);
|
deepEqual(actual, [1, 2, 3]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('should distinguish between numbers and numeric strings', function() {
|
||||||
|
var expected = ['2', 2, Object('2'), Object(2)],
|
||||||
|
actual = _.uniq(expected);
|
||||||
|
|
||||||
|
deepEqual(actual, expected);
|
||||||
|
});
|
||||||
}());
|
}());
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|||||||
54
vendor/backbone/backbone.js
vendored
54
vendor/backbone/backbone.js
vendored
@@ -185,16 +185,16 @@
|
|||||||
var defaults;
|
var defaults;
|
||||||
var attrs = attributes || {};
|
var attrs = attributes || {};
|
||||||
if (options && options.collection) this.collection = options.collection;
|
if (options && options.collection) this.collection = options.collection;
|
||||||
if (options && options.parse) attrs = this.parse(attrs);
|
|
||||||
if (defaults = _.result(this, 'defaults')) {
|
|
||||||
attrs = _.extend({}, defaults, attrs);
|
|
||||||
}
|
|
||||||
this.attributes = {};
|
this.attributes = {};
|
||||||
this._escapedAttributes = {};
|
this._escapedAttributes = {};
|
||||||
this.cid = _.uniqueId('c');
|
this.cid = _.uniqueId('c');
|
||||||
this.changed = {};
|
this.changed = {};
|
||||||
this._changes = {};
|
this._changes = {};
|
||||||
this._pending = {};
|
this._pending = {};
|
||||||
|
if (options && options.parse) attrs = this.parse(attrs);
|
||||||
|
if (defaults = _.result(this, 'defaults')) {
|
||||||
|
attrs = _.extend({}, defaults, attrs);
|
||||||
|
}
|
||||||
this.set(attrs, {silent: true});
|
this.set(attrs, {silent: true});
|
||||||
// Reset change tracking.
|
// Reset change tracking.
|
||||||
this.changed = {};
|
this.changed = {};
|
||||||
@@ -261,15 +261,16 @@
|
|||||||
|
|
||||||
// Set a hash of model attributes on the object, firing `"change"` unless
|
// Set a hash of model attributes on the object, firing `"change"` unless
|
||||||
// you choose to silence it.
|
// you choose to silence it.
|
||||||
set: function(attrs, options) {
|
set: function(key, val, options) {
|
||||||
var attr, key, val;
|
var attr, attrs;
|
||||||
if (attrs == null) return this;
|
if (key == null) return this;
|
||||||
|
|
||||||
// Handle both `"key", value` and `{key: value}` -style arguments.
|
// Handle both `"key", value` and `{key: value}` -style arguments.
|
||||||
if (!_.isObject(attrs)) {
|
if (_.isObject(key)) {
|
||||||
key = attrs;
|
attrs = key;
|
||||||
(attrs = {})[key] = options;
|
options = val;
|
||||||
options = arguments[2];
|
} else {
|
||||||
|
(attrs = {})[key] = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extract attributes and options.
|
// Extract attributes and options.
|
||||||
@@ -352,14 +353,15 @@
|
|||||||
// Set a hash of model attributes, and sync the model to the server.
|
// Set a hash of model attributes, and sync the model to the server.
|
||||||
// If the server returns an attributes hash that differs, the model's
|
// If the server returns an attributes hash that differs, the model's
|
||||||
// state will be `set` again.
|
// state will be `set` again.
|
||||||
save: function(attrs, options) {
|
save: function(key, val, options) {
|
||||||
var key, current, done;
|
var attrs, current, done;
|
||||||
|
|
||||||
// Handle both `"key", value` and `{key: value}` -style arguments.
|
// Handle both `"key", value` and `{key: value}` -style arguments.
|
||||||
if (attrs != null && !_.isObject(attrs)) {
|
if (key == null || _.isObject(key)) {
|
||||||
key = attrs;
|
attrs = key;
|
||||||
(attrs = {})[key] = options;
|
options = val;
|
||||||
options = arguments[2];
|
} else if (key != null) {
|
||||||
|
(attrs = {})[key] = val;
|
||||||
}
|
}
|
||||||
options = options ? _.clone(options) : {};
|
options = options ? _.clone(options) : {};
|
||||||
|
|
||||||
@@ -948,8 +950,7 @@
|
|||||||
if (!this.routes) return;
|
if (!this.routes) return;
|
||||||
var route, routes = _.keys(this.routes);
|
var route, routes = _.keys(this.routes);
|
||||||
while ((route = routes.pop()) != null) {
|
while ((route = routes.pop()) != null) {
|
||||||
var name = this.routes[route];
|
this.route(route, this.routes[route]);
|
||||||
this.route(route, name, this[name]);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -988,7 +989,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Cached regex for cleaning leading hashes and slashes.
|
// Cached regex for cleaning leading hashes and slashes.
|
||||||
var routeStripper = /^[#\/]/;
|
var routeStripper = /^[#\/]|\s+$/;
|
||||||
|
|
||||||
// Cached regex for stripping leading and trailing slashes.
|
// Cached regex for stripping leading and trailing slashes.
|
||||||
var rootStripper = /^\/+|\/+$/g;
|
var rootStripper = /^\/+|\/+$/g;
|
||||||
@@ -1364,7 +1365,10 @@
|
|||||||
var type = methodMap[method];
|
var type = methodMap[method];
|
||||||
|
|
||||||
// Default options, unless specified.
|
// Default options, unless specified.
|
||||||
options || (options = {});
|
_.defaults(options || (options = {}), {
|
||||||
|
emulateHTTP: Backbone.emulateHTTP,
|
||||||
|
emulateJSON: Backbone.emulateJSON
|
||||||
|
});
|
||||||
|
|
||||||
// Default JSON-request options.
|
// Default JSON-request options.
|
||||||
var params = {type: type, dataType: 'json'};
|
var params = {type: type, dataType: 'json'};
|
||||||
@@ -1381,16 +1385,16 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// For older servers, emulate JSON by encoding the request into an HTML-form.
|
// For older servers, emulate JSON by encoding the request into an HTML-form.
|
||||||
if (Backbone.emulateJSON) {
|
if (options.emulateJSON) {
|
||||||
params.contentType = 'application/x-www-form-urlencoded';
|
params.contentType = 'application/x-www-form-urlencoded';
|
||||||
params.data = params.data ? {model: params.data} : {};
|
params.data = params.data ? {model: params.data} : {};
|
||||||
}
|
}
|
||||||
|
|
||||||
// For older servers, emulate HTTP by mimicking the HTTP method with `_method`
|
// For older servers, emulate HTTP by mimicking the HTTP method with `_method`
|
||||||
// And an `X-HTTP-Method-Override` header.
|
// And an `X-HTTP-Method-Override` header.
|
||||||
if (Backbone.emulateHTTP && (type === 'PUT' || type === 'DELETE')) {
|
if (options.emulateHTTP && (type === 'PUT' || type === 'DELETE')) {
|
||||||
params.type = 'POST';
|
params.type = 'POST';
|
||||||
if (Backbone.emulateJSON) params.data._method = type;
|
if (options.emulateJSON) params.data._method = type;
|
||||||
var beforeSend = options.beforeSend;
|
var beforeSend = options.beforeSend;
|
||||||
options.beforeSend = function(xhr) {
|
options.beforeSend = function(xhr) {
|
||||||
xhr.setRequestHeader('X-HTTP-Method-Override', type);
|
xhr.setRequestHeader('X-HTTP-Method-Override', type);
|
||||||
@@ -1399,7 +1403,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Don't process data on a non-GET request.
|
// Don't process data on a non-GET request.
|
||||||
if (params.type !== 'GET' && !Backbone.emulateJSON) {
|
if (params.type !== 'GET' && !options.emulateJSON) {
|
||||||
params.processData = false;
|
params.processData = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
15
vendor/backbone/test/collection.js
vendored
15
vendor/backbone/test/collection.js
vendored
@@ -701,4 +701,19 @@ $(document).ready(function() {
|
|||||||
collection.add([{id: 1, x: 1}, {id: 2, x: 2}]);
|
collection.add([{id: 1, x: 1}, {id: 2, x: 2}]);
|
||||||
deepEqual(added, [1, 2]);
|
deepEqual(added, [1, 2]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("fetch parses models by default", 1, function() {
|
||||||
|
var model = {};
|
||||||
|
var Collection = Backbone.Collection.extend({
|
||||||
|
url: 'test',
|
||||||
|
model: Backbone.Model.extend({
|
||||||
|
parse: function(resp) {
|
||||||
|
strictEqual(resp, model);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
new Collection().fetch();
|
||||||
|
this.ajaxSettings.success([model]);
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
6
vendor/backbone/test/environment.js
vendored
6
vendor/backbone/test/environment.js
vendored
@@ -8,6 +8,10 @@
|
|||||||
|
|
||||||
sync: Backbone.sync,
|
sync: Backbone.sync,
|
||||||
|
|
||||||
|
emulateHTTP: Backbone.emulateHTTP,
|
||||||
|
|
||||||
|
emulateJSON: Backbone.emulateJSON,
|
||||||
|
|
||||||
setup: function() {
|
setup: function() {
|
||||||
var env = this;
|
var env = this;
|
||||||
|
|
||||||
@@ -32,6 +36,8 @@
|
|||||||
this.ajaxSettings = null;
|
this.ajaxSettings = null;
|
||||||
Backbone.sync = this.sync;
|
Backbone.sync = this.sync;
|
||||||
Backbone.ajax = this.ajax;
|
Backbone.ajax = this.ajax;
|
||||||
|
Backbone.emulateHTTP = this.emulateHTTP;
|
||||||
|
Backbone.emulateJSON = this.emulateJSON;
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
8
vendor/backbone/test/model.js
vendored
8
vendor/backbone/test/model.js
vendored
@@ -889,4 +889,12 @@ $(document).ready(function() {
|
|||||||
deepEqual(changes, ['a',1,'item']);
|
deepEqual(changes, ['a',1,'item']);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("#1791 - `attributes` is available for `parse`", function() {
|
||||||
|
var Model = Backbone.Model.extend({
|
||||||
|
parse: function() { this.has('a'); } // shouldn't throw an error
|
||||||
|
});
|
||||||
|
var model = new Model(null, {parse: true});
|
||||||
|
expect(0);
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
5
vendor/backbone/test/router.js
vendored
5
vendor/backbone/test/router.js
vendored
@@ -492,4 +492,9 @@ $(document).ready(function() {
|
|||||||
new Router;
|
new Router;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("#1794 - Trailing space in fragments.", 1, function() {
|
||||||
|
var history = new Backbone.History;
|
||||||
|
strictEqual(history.getFragment('fragment '), 'fragment');
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
52
vendor/backbone/test/sync.js
vendored
52
vendor/backbone/test/sync.js
vendored
@@ -64,8 +64,10 @@ $(document).ready(function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("update with emulateHTTP and emulateJSON", 7, function() {
|
test("update with emulateHTTP and emulateJSON", 7, function() {
|
||||||
Backbone.emulateHTTP = Backbone.emulateJSON = true;
|
library.first().save({id: '2-the-tempest', author: 'Tim Shakespeare'}, {
|
||||||
library.first().save({id: '2-the-tempest', author: 'Tim Shakespeare'});
|
emulateHTTP: true,
|
||||||
|
emulateJSON: true
|
||||||
|
});
|
||||||
equal(this.ajaxSettings.url, '/library/2-the-tempest');
|
equal(this.ajaxSettings.url, '/library/2-the-tempest');
|
||||||
equal(this.ajaxSettings.type, 'POST');
|
equal(this.ajaxSettings.type, 'POST');
|
||||||
equal(this.ajaxSettings.dataType, 'json');
|
equal(this.ajaxSettings.dataType, 'json');
|
||||||
@@ -74,12 +76,12 @@ $(document).ready(function() {
|
|||||||
equal(data.id, '2-the-tempest');
|
equal(data.id, '2-the-tempest');
|
||||||
equal(data.author, 'Tim Shakespeare');
|
equal(data.author, 'Tim Shakespeare');
|
||||||
equal(data.length, 123);
|
equal(data.length, 123);
|
||||||
Backbone.emulateHTTP = Backbone.emulateJSON = false;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test("update with just emulateHTTP", 6, function() {
|
test("update with just emulateHTTP", 6, function() {
|
||||||
Backbone.emulateHTTP = true;
|
library.first().save({id: '2-the-tempest', author: 'Tim Shakespeare'}, {
|
||||||
library.first().save({id: '2-the-tempest', author: 'Tim Shakespeare'});
|
emulateHTTP: true
|
||||||
|
});
|
||||||
equal(this.ajaxSettings.url, '/library/2-the-tempest');
|
equal(this.ajaxSettings.url, '/library/2-the-tempest');
|
||||||
equal(this.ajaxSettings.type, 'POST');
|
equal(this.ajaxSettings.type, 'POST');
|
||||||
equal(this.ajaxSettings.contentType, 'application/json');
|
equal(this.ajaxSettings.contentType, 'application/json');
|
||||||
@@ -87,12 +89,12 @@ $(document).ready(function() {
|
|||||||
equal(data.id, '2-the-tempest');
|
equal(data.id, '2-the-tempest');
|
||||||
equal(data.author, 'Tim Shakespeare');
|
equal(data.author, 'Tim Shakespeare');
|
||||||
equal(data.length, 123);
|
equal(data.length, 123);
|
||||||
Backbone.emulateHTTP = false;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test("update with just emulateJSON", 6, function() {
|
test("update with just emulateJSON", 6, function() {
|
||||||
Backbone.emulateJSON = true;
|
library.first().save({id: '2-the-tempest', author: 'Tim Shakespeare'}, {
|
||||||
library.first().save({id: '2-the-tempest', author: 'Tim Shakespeare'});
|
emulateJSON: true
|
||||||
|
});
|
||||||
equal(this.ajaxSettings.url, '/library/2-the-tempest');
|
equal(this.ajaxSettings.url, '/library/2-the-tempest');
|
||||||
equal(this.ajaxSettings.type, 'PUT');
|
equal(this.ajaxSettings.type, 'PUT');
|
||||||
equal(this.ajaxSettings.contentType, 'application/x-www-form-urlencoded');
|
equal(this.ajaxSettings.contentType, 'application/x-www-form-urlencoded');
|
||||||
@@ -100,7 +102,6 @@ $(document).ready(function() {
|
|||||||
equal(data.id, '2-the-tempest');
|
equal(data.id, '2-the-tempest');
|
||||||
equal(data.author, 'Tim Shakespeare');
|
equal(data.author, 'Tim Shakespeare');
|
||||||
equal(data.length, 123);
|
equal(data.length, 123);
|
||||||
Backbone.emulateJSON = false;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test("read model", 3, function() {
|
test("read model", 3, function() {
|
||||||
@@ -121,12 +122,13 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
test("destroy with emulateHTTP", 3, function() {
|
test("destroy with emulateHTTP", 3, function() {
|
||||||
library.first().save({id: '2-the-tempest', author: 'Tim Shakespeare'});
|
library.first().save({id: '2-the-tempest', author: 'Tim Shakespeare'});
|
||||||
Backbone.emulateHTTP = Backbone.emulateJSON = true;
|
library.first().destroy({
|
||||||
library.first().destroy();
|
emulateHTTP: true,
|
||||||
|
emulateJSON: true
|
||||||
|
});
|
||||||
equal(this.ajaxSettings.url, '/library/2-the-tempest');
|
equal(this.ajaxSettings.url, '/library/2-the-tempest');
|
||||||
equal(this.ajaxSettings.type, 'POST');
|
equal(this.ajaxSettings.type, 'POST');
|
||||||
equal(JSON.stringify(this.ajaxSettings.data), '{"_method":"DELETE"}');
|
equal(JSON.stringify(this.ajaxSettings.data), '{"_method":"DELETE"}');
|
||||||
Backbone.emulateHTTP = Backbone.emulateJSON = false;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test("urlError", 2, function() {
|
test("urlError", 2, function() {
|
||||||
@@ -162,6 +164,32 @@ $(document).ready(function() {
|
|||||||
this.ajaxSettings.error();
|
this.ajaxSettings.error();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('Use Backbone.emulateHTTP as default.', 2, function() {
|
||||||
|
var model = new Backbone.Model;
|
||||||
|
model.url = '/test';
|
||||||
|
|
||||||
|
Backbone.emulateHTTP = true;
|
||||||
|
model.sync('create', model);
|
||||||
|
strictEqual(this.ajaxSettings.emulateHTTP, true);
|
||||||
|
|
||||||
|
Backbone.emulateHTTP = false;
|
||||||
|
model.sync('create', model);
|
||||||
|
strictEqual(this.ajaxSettings.emulateHTTP, false);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Use Backbone.emulateJSON as default.', 2, function() {
|
||||||
|
var model = new Backbone.Model;
|
||||||
|
model.url = '/test';
|
||||||
|
|
||||||
|
Backbone.emulateJSON = true;
|
||||||
|
model.sync('create', model);
|
||||||
|
strictEqual(this.ajaxSettings.emulateJSON, true);
|
||||||
|
|
||||||
|
Backbone.emulateJSON = false;
|
||||||
|
model.sync('create', model);
|
||||||
|
strictEqual(this.ajaxSettings.emulateJSON, false);
|
||||||
|
});
|
||||||
|
|
||||||
test("#1756 - Call user provided beforeSend function.", 4, function() {
|
test("#1756 - Call user provided beforeSend function.", 4, function() {
|
||||||
Backbone.emulateHTTP = true;
|
Backbone.emulateHTTP = true;
|
||||||
var model = new Backbone.Model;
|
var model = new Backbone.Model;
|
||||||
|
|||||||
1049
vendor/firebug-lite/changelog.txt
vendored
1049
vendor/firebug-lite/changelog.txt
vendored
File diff suppressed because it is too large
Load Diff
6
vendor/json3/README.md
vendored
6
vendor/json3/README.md
vendored
@@ -4,8 +4,8 @@
|
|||||||
|
|
||||||
**JSON 3** is a modern JSON implementation compatible with a variety of JavaScript platforms, including Internet Explorer 6, Opera 7, Safari 2, and Netscape 6. The current version is **3.2.4**.
|
**JSON 3** is a modern JSON implementation compatible with a variety of JavaScript platforms, including Internet Explorer 6, Opera 7, Safari 2, and Netscape 6. The current version is **3.2.4**.
|
||||||
|
|
||||||
- [Development Version](http://bestiejs.github.com/json3/lib/json3.js) *(36.5 KB; uncompressed with comments)*
|
- [Development Version](http://cdnjs.cloudflare.com/ajax/libs/json3/3.2.4/json3.js) *(36.5 KB; uncompressed with comments)*
|
||||||
- [Production Version](http://bestiejs.github.com/json3/lib/json3.min.js) *(3.0 KB; compressed and `gzip`-ped)*
|
- [Production Version](http://cdnjs.cloudflare.com/ajax/libs/json3/3.2.4/json3.min.js) *(3.0 KB; compressed and `gzip`-ped)*
|
||||||
|
|
||||||
[JSON](http://json.org/) is a language-independent data interchange format based on a loose subset of the JavaScript grammar. Originally popularized by [Douglas Crockford](http://www.crockford.com/), the format was standardized in the [fifth edition](http://es5.github.com/) of the ECMAScript specification. The 5.1 edition, ratified in June 2011, incorporates several modifications to the grammar pertaining to the serialization of dates.
|
[JSON](http://json.org/) is a language-independent data interchange format based on a loose subset of the JavaScript grammar. Originally popularized by [Douglas Crockford](http://www.crockford.com/), the format was standardized in the [fifth edition](http://es5.github.com/) of the ECMAScript specification. The 5.1 edition, ratified in June 2011, incorporates several modifications to the grammar pertaining to the serialization of dates.
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ Portions of the date serialization code are adapted from the [`date-shim`](https
|
|||||||
|
|
||||||
## Web Browsers
|
## Web Browsers
|
||||||
|
|
||||||
<script src="http://bestiejs.github.com/json3/lib/json3.min.js"></script>
|
<script src="//cdnjs.cloudflare.com/ajax/libs/json3/3.2.4/json3.min.js"></script>
|
||||||
<script>
|
<script>
|
||||||
JSON.stringify({"Hello": 123});
|
JSON.stringify({"Hello": 123});
|
||||||
// => '{"Hello":123}'
|
// => '{"Hello":123}'
|
||||||
|
|||||||
17
vendor/json3/lib/json3.min.js
vendored
17
vendor/json3/lib/json3.min.js
vendored
@@ -1,17 +0,0 @@
|
|||||||
/*! JSON v3.2.4 | http://bestiejs.github.com/json3 | Copyright 2012, Kit Cambridge | http://kit.mit-license.org */
|
|
||||||
;(function(){var e=void 0,i=!0,k=null,l={}.toString,m,n,p="function"===typeof define&&define.c,q=!p&&"object"==typeof exports&&exports;q||p?"object"==typeof JSON&&JSON?p?q=JSON:(q.stringify=JSON.stringify,q.parse=JSON.parse):p&&(q=this.JSON={}):q=this.JSON||(this.JSON={});var r,t,u,x,z,B,C,D,E,F,G,H,I,J=new Date(-3509827334573292),K,O,P;try{J=-109252==J.getUTCFullYear()&&0===J.getUTCMonth()&&1==J.getUTCDate()&&10==J.getUTCHours()&&37==J.getUTCMinutes()&&6==J.getUTCSeconds()&&708==J.getUTCMilliseconds()}catch(Q){}
|
|
||||||
function R(b){var c,a,d,j=b=="json";if(j||b=="json-stringify"||b=="json-parse"){if(b=="json-stringify"||j){if(c=typeof q.stringify=="function"&&J){(d=function(){return 1}).toJSON=d;try{c=q.stringify(0)==="0"&&q.stringify(new Number)==="0"&&q.stringify(new String)=='""'&&q.stringify(l)===e&&q.stringify(e)===e&&q.stringify()===e&&q.stringify(d)==="1"&&q.stringify([d])=="[1]"&&q.stringify([e])=="[null]"&&q.stringify(k)=="null"&&q.stringify([e,l,k])=="[null,null,null]"&&q.stringify({A:[d,i,false,k,"\x00\u0008\n\u000c\r\t"]})==
|
|
||||||
'{"A":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}'&&q.stringify(k,d)==="1"&&q.stringify([1,2],k,1)=="[\n 1,\n 2\n]"&&q.stringify(new Date(-864E13))=='"-271821-04-20T00:00:00.000Z"'&&q.stringify(new Date(864E13))=='"+275760-09-13T00:00:00.000Z"'&&q.stringify(new Date(-621987552E5))=='"-000001-01-01T00:00:00.000Z"'&&q.stringify(new Date(-1))=='"1969-12-31T23:59:59.999Z"'}catch(f){c=false}}if(!j)return c}if(b=="json-parse"||j){if(typeof q.parse=="function")try{if(q.parse("0")===0&&!q.parse(false)){d=
|
|
||||||
q.parse('{"A":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}');if(a=d.a.length==5&&d.a[0]==1){try{a=!q.parse('"\t"')}catch(o){}if(a)try{a=q.parse("01")!=1}catch(g){}}}}catch(h){a=false}if(!j)return a}return c&&a}}
|
|
||||||
if(!R("json")){J||(K=Math.floor,O=[0,31,59,90,120,151,181,212,243,273,304,334],P=function(b,c){return O[c]+365*(b-1970)+K((b-1969+(c=+(c>1)))/4)-K((b-1901+c)/100)+K((b-1601+c)/400)});if(!(m={}.hasOwnProperty))m=function(b){var c={},a;if((c.__proto__=k,c.__proto__={toString:1},c).toString!=l)m=function(a){var b=this.__proto__,a=a in(this.__proto__=k,this);this.__proto__=b;return a};else{a=c.constructor;m=function(b){var c=(this.constructor||a).prototype;return b in this&&!(b in c&&this[b]===c[b])}}c=
|
|
||||||
k;return m.call(this,b)};n=function(b,c){var a=0,d,j,f;(d=function(){this.valueOf=0}).prototype.valueOf=0;j=new d;for(f in j)m.call(j,f)&&a++;d=j=k;if(a)a=a==2?function(a,b){var c={},d=l.call(a)=="[object Function]",f;for(f in a)!(d&&f=="prototype")&&!m.call(c,f)&&(c[f]=1)&&m.call(a,f)&&b(f)}:function(a,b){var c=l.call(a)=="[object Function]",d,f;for(d in a)!(c&&d=="prototype")&&m.call(a,d)&&!(f=d==="constructor")&&b(d);(f||m.call(a,d="constructor"))&&b(d)};else{j=["valueOf","toString","toLocaleString",
|
|
||||||
"propertyIsEnumerable","isPrototypeOf","hasOwnProperty","constructor"];a=function(a,b){var c=l.call(a)=="[object Function]",d;for(d in a)!(c&&d=="prototype")&&m.call(a,d)&&b(d);for(c=j.length;d=j[--c];m.call(a,d)&&b(d));}}a(b,c)};R("json-stringify")||(r={"\\":"\\\\",'"':'\\"',"\u0008":"\\b","\u000c":"\\f","\n":"\\n","\r":"\\r","\t":"\\t"},t=function(b,c){return("000000"+(c||0)).slice(-b)},u=function(b){for(var c='"',a=0,d;d=b.charAt(a);a++)c=c+('\\"\u0008\u000c\n\r\t'.indexOf(d)>-1?r[d]:r[d]=d<" "?
|
|
||||||
"\\u00"+t(2,d.charCodeAt(0).toString(16)):d);return c+'"'},x=function(b,c,a,d,j,f,o){var g=c[b],h,s,v,w,L,M,N,y,A;if(typeof g=="object"&&g){h=l.call(g);if(h=="[object Date]"&&!m.call(g,"toJSON"))if(g>-1/0&&g<1/0){if(P){v=K(g/864E5);for(h=K(v/365.2425)+1970-1;P(h+1,0)<=v;h++);for(s=K((v-P(h,0))/30.42);P(h,s+1)<=v;s++);v=1+v-P(h,s);w=(g%864E5+864E5)%864E5;L=K(w/36E5)%24;M=K(w/6E4)%60;N=K(w/1E3)%60;w=w%1E3}else{h=g.getUTCFullYear();s=g.getUTCMonth();v=g.getUTCDate();L=g.getUTCHours();M=g.getUTCMinutes();
|
|
||||||
N=g.getUTCSeconds();w=g.getUTCMilliseconds()}g=(h<=0||h>=1E4?(h<0?"-":"+")+t(6,h<0?-h:h):t(4,h))+"-"+t(2,s+1)+"-"+t(2,v)+"T"+t(2,L)+":"+t(2,M)+":"+t(2,N)+"."+t(3,w)+"Z"}else g=k;else if(typeof g.toJSON=="function"&&(h!="[object Number]"&&h!="[object String]"&&h!="[object Array]"||m.call(g,"toJSON")))g=g.toJSON(b)}a&&(g=a.call(c,b,g));if(g===k)return"null";h=l.call(g);if(h=="[object Boolean]")return""+g;if(h=="[object Number]")return g>-1/0&&g<1/0?""+g:"null";if(h=="[object String]")return u(g);if(typeof g==
|
|
||||||
"object"){for(b=o.length;b--;)if(o[b]===g)throw TypeError();o.push(g);y=[];c=f;f=f+j;if(h=="[object Array]"){s=0;for(b=g.length;s<b;A||(A=i),s++){h=x(s,g,a,d,j,f,o);y.push(h===e?"null":h)}b=A?j?"[\n"+f+y.join(",\n"+f)+"\n"+c+"]":"["+y.join(",")+"]":"[]"}else{n(d||g,function(b){var c=x(b,g,a,d,j,f,o);c!==e&&y.push(u(b)+":"+(j?" ":"")+c);A||(A=i)});b=A?j?"{\n"+f+y.join(",\n"+f)+"\n"+c+"}":"{"+y.join(",")+"}":"{}"}o.pop();return b}},q.stringify=function(b,c,a){var d,j,f,o,g,h;if(typeof c=="function"||
|
|
||||||
typeof c=="object"&&c)if(l.call(c)=="[object Function]")j=c;else if(l.call(c)=="[object Array]"){f={};o=0;for(g=c.length;o<g;h=c[o++],(l.call(h)=="[object String]"||l.call(h)=="[object Number]")&&(f[h]=1));}if(a)if(l.call(a)=="[object Number]"){if((a=a-a%1)>0){d="";for(a>10&&(a=10);d.length<a;d=d+" ");}}else l.call(a)=="[object String]"&&(d=a.length<=10?a:a.slice(0,10));return x("",(h={},h[""]=b,h),j,f,d,"",[])});R("json-parse")||(z=String.fromCharCode,B={"\\":"\\",'"':'"',"/":"/",b:"\u0008",t:"\t",
|
|
||||||
n:"\n",f:"\u000c",r:"\r"},C=function(){H=I=k;throw SyntaxError();},D=function(){for(var b=I,c=b.length,a,d,j,f,o;H<c;){a=b.charAt(H);if("\t\r\n ".indexOf(a)>-1)H++;else{if("{}[]:,".indexOf(a)>-1){H++;return a}if(a=='"'){d="@";for(H++;H<c;){a=b.charAt(H);if(a<" ")C();else if(a=="\\"){a=b.charAt(++H);if('\\"/btnfr'.indexOf(a)>-1){d=d+B[a];H++}else if(a=="u"){j=++H;for(f=H+4;H<f;H++){a=b.charAt(H);a>="0"&&a<="9"||a>="a"&&a<="f"||a>="A"&&a<="F"||C()}d=d+z("0x"+b.slice(j,H))}else C()}else{if(a=='"')break;
|
|
||||||
d=d+a;H++}}if(b.charAt(H)=='"'){H++;return d}}else{j=H;if(a=="-"){o=i;a=b.charAt(++H)}if(a>="0"&&a<="9"){for(a=="0"&&(a=b.charAt(H+1),a>="0"&&a<="9")&&C();H<c&&(a=b.charAt(H),a>="0"&&a<="9");H++);if(b.charAt(H)=="."){for(f=++H;f<c&&(a=b.charAt(f),a>="0"&&a<="9");f++);f==H&&C();H=f}a=b.charAt(H);if(a=="e"||a=="E"){a=b.charAt(++H);(a=="+"||a=="-")&&H++;for(f=H;f<c&&(a=b.charAt(f),a>="0"&&a<="9");f++);f==H&&C();H=f}return+b.slice(j,H)}o&&C();if(b.slice(H,H+4)=="true"){H=H+4;return i}if(b.slice(H,H+5)==
|
|
||||||
"false"){H=H+5;return false}if(b.slice(H,H+4)=="null"){H=H+4;return k}}C()}}return"$"},E=function(b){var c,a;b=="$"&&C();if(typeof b=="string"){if(b.charAt(0)=="@")return b.slice(1);if(b=="["){for(c=[];;a||(a=i)){b=D();if(b=="]")break;if(a)if(b==","){b=D();b=="]"&&C()}else C();b==","&&C();c.push(E(b))}return c}if(b=="{"){for(c={};;a||(a=i)){b=D();if(b=="}")break;if(a)if(b==","){b=D();b=="}"&&C()}else C();(b==","||typeof b!="string"||b.charAt(0)!="@"||D()!=":")&&C();c[b.slice(1)]=E(D())}return c}C()}return b},
|
|
||||||
G=function(b,c,a){a=F(b,c,a);a===e?delete b[c]:b[c]=a},F=function(b,c,a){var d=b[c],j;if(typeof d=="object"&&d)if(l.call(d)=="[object Array]")for(j=d.length;j--;)G(d,j,a);else n(d,function(b){G(d,b,a)});return a.call(b,c,d)},q.parse=function(b,c){var a,d;H=0;I=b;a=E(D());D()!="$"&&C();H=I=k;return c&&l.call(c)=="[object Function]"?F((d={},d[""]=a,d),"",c):a})}p&&define(function(){return q});
|
|
||||||
}());
|
|
||||||
2
vendor/underscore/test/arrays.js
vendored
2
vendor/underscore/test/arrays.js
vendored
@@ -91,6 +91,8 @@ $(document).ready(function() {
|
|||||||
var iterator = function(value) { return value.name; };
|
var iterator = function(value) { return value.name; };
|
||||||
equal(_.map(_.uniq(list, false, iterator), iterator).join(', '), 'moe, curly, larry', 'can find the unique values of an array using a custom iterator');
|
equal(_.map(_.uniq(list, false, iterator), iterator).join(', '), 'moe, curly, larry', 'can find the unique values of an array using a custom iterator');
|
||||||
|
|
||||||
|
equal(_.map(_.uniq(list, iterator), iterator).join(', '), 'moe, curly, larry', 'can find the unique values of an array using a custom iterator without specifying whether array is sorted');
|
||||||
|
|
||||||
var iterator = function(value) { return value +1; };
|
var iterator = function(value) { return value +1; };
|
||||||
var list = [1, 2, 2, 3, 4, 4];
|
var list = [1, 2, 2, 3, 4, 4];
|
||||||
equal(_.uniq(list, true, iterator).join(', '), '1, 2, 3, 4', 'iterator works with sorted array');
|
equal(_.uniq(list, true, iterator).join(', '), '1, 2, 3, 4', 'iterator works with sorted array');
|
||||||
|
|||||||
2
vendor/underscore/underscore-min.js
vendored
2
vendor/underscore/underscore-min.js
vendored
File diff suppressed because one or more lines are too long
11
vendor/underscore/underscore.js
vendored
11
vendor/underscore/underscore.js
vendored
@@ -213,13 +213,11 @@
|
|||||||
// Determine if the array or object contains a given value (using `===`).
|
// Determine if the array or object contains a given value (using `===`).
|
||||||
// Aliased as `include`.
|
// Aliased as `include`.
|
||||||
_.contains = _.include = function(obj, target) {
|
_.contains = _.include = function(obj, target) {
|
||||||
var found = false;
|
if (obj == null) return false;
|
||||||
if (obj == null) return found;
|
|
||||||
if (nativeIndexOf && obj.indexOf === nativeIndexOf) return obj.indexOf(target) != -1;
|
if (nativeIndexOf && obj.indexOf === nativeIndexOf) return obj.indexOf(target) != -1;
|
||||||
found = any(obj, function(value) {
|
return any(obj, function(value) {
|
||||||
return value === target;
|
return value === target;
|
||||||
});
|
});
|
||||||
return found;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Invoke a method (with arguments) on every item in a collection.
|
// Invoke a method (with arguments) on every item in a collection.
|
||||||
@@ -439,6 +437,11 @@
|
|||||||
// been sorted, you have the option of using a faster algorithm.
|
// been sorted, you have the option of using a faster algorithm.
|
||||||
// Aliased as `unique`.
|
// Aliased as `unique`.
|
||||||
_.uniq = _.unique = function(array, isSorted, iterator, context) {
|
_.uniq = _.unique = function(array, isSorted, iterator, context) {
|
||||||
|
if (_.isFunction(isSorted)) {
|
||||||
|
context = iterator;
|
||||||
|
iterator = isSorted;
|
||||||
|
isSorted = false;
|
||||||
|
}
|
||||||
var initial = iterator ? _.map(array, iterator, context) : array;
|
var initial = iterator ? _.map(array, iterator, context) : array;
|
||||||
var results = [];
|
var results = [];
|
||||||
var seen = [];
|
var seen = [];
|
||||||
|
|||||||
Reference in New Issue
Block a user