diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index f2eb92f587..7ebb5bc1b3 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -7,7 +7,7 @@ Please make sure to [search the issue tracker](https://github.com/bestiejs/lodas
Include updated unit tests in the `test` directory as part of your pull request.
You can run the tests from the command line via `npm test`, or open `test/index.html` in a web browser.
-The `test/run-test.sh` script attempts to run the tests in [Rhino](https://developer.mozilla.org/en-US/docs/Rhino), [RingoJS](http://ringojs.org/), [Narwhal](https://github.com/280north/narwhal), and [Node](http://nodejs.org/), before running them in your default browser.
+The `test/run-test.sh` script attempts to run the tests in [Rhino](https://developer.mozilla.org/en-US/docs/Rhino), [Narwhal](https://github.com/280north/narwhal), [RingoJS](http://ringojs.org/), [PhantomJS](http://phantomjs.org/), and [Node](http://nodejs.org/), before running them in your default browser.
The [Backbone](http://backbonejs.org/) and [Underscore](http://http://underscorejs.org/) test suites are included as well.
## Contributor License Agreement
diff --git a/README.md b/README.md
index 28d4dfc1fd..6181c7790f 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# Lo-Dash v1.0.0
+# Lo-Dash v1.0.1
[](http://travis-ci.org/bestiejs/lodash)
An alternative to Underscore.js, delivering consistency, [customization](https://github.com/bestiejs/lodash#custom-builds), [performance](http://lodash.com/benchmarks), and [extra features](https://github.com/bestiejs/lodash#features).
@@ -6,24 +6,24 @@ An alternative to Underscore.js, delivering consistency, [customization](https:/
## Download
* Lo-Dash builds (for modern environments):
-[Development](https://raw.github.com/bestiejs/lodash/v1.0.0/dist/lodash.js) and
-[Production](https://raw.github.com/bestiejs/lodash/v1.0.0/dist/lodash.min.js)
+[Development](https://raw.github.com/bestiejs/lodash/v1.0.1/dist/lodash.js) and
+[Production](https://raw.github.com/bestiejs/lodash/v1.0.1/dist/lodash.min.js)
* Lo-Dash compatibility builds (for legacy and modern environments):
-[Development](https://raw.github.com/bestiejs/lodash/v1.0.0/dist/lodash.compat.js) and
-[Production](https://raw.github.com/bestiejs/lodash/v1.0.0/dist/lodash.compat.min.js)
+[Development](https://raw.github.com/bestiejs/lodash/v1.0.1/dist/lodash.compat.js) and
+[Production](https://raw.github.com/bestiejs/lodash/v1.0.1/dist/lodash.compat.min.js)
* Underscore compatibility builds:
-[Development](https://raw.github.com/bestiejs/lodash/v1.0.0/dist/lodash.underscore.js) and
-[Production](https://raw.github.com/bestiejs/lodash/v1.0.0/dist/lodash.underscore.min.js)
+[Development](https://raw.github.com/bestiejs/lodash/v1.0.1/dist/lodash.underscore.js) and
+[Production](https://raw.github.com/bestiejs/lodash/v1.0.1/dist/lodash.underscore.min.js)
-* CDN copies of ≤ v1.0.0’s builds are available on [cdnjs](http://cdnjs.com/) thanks to [CloudFlare](http://www.cloudflare.com/):
-[Lo-Dash dev](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.0.0/lodash.js),
-[Lo-Dash prod](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.0.0/lodash.min.js),
-[Lo-Dash compat-dev](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.0.0/lodash.compat.js),
-[Lo-Dash compat-prod](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.0.0/lodash.compat.min.js),
-[Underscore compat-dev](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.0.0/lodash.underscore.js), and
-[Underscore compat-prod](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.0.0/lodash.underscore.min.js)
+* CDN copies of ≤ v1.0.1’s builds are available on [cdnjs](http://cdnjs.com/) thanks to [CloudFlare](http://www.cloudflare.com/):
+[Lo-Dash dev](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.0.1/lodash.js),
+[Lo-Dash prod](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.0.1/lodash.min.js),
+[Lo-Dash compat-dev](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.0.1/lodash.compat.js),
+[Lo-Dash compat-prod](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.0.1/lodash.compat.min.js),
+[Underscore compat-dev](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.0.1/lodash.underscore.js), and
+[Underscore compat-prod](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.0.1/lodash.underscore.min.js)
* For optimal file size, [create a custom build](https://github.com/bestiejs/lodash#custom-builds) with only the features you need
@@ -33,16 +33,20 @@ We’ve got [API docs](http://lodash.com/docs), [benchmarks](http://lodash.com/b
For a list of upcoming features, check out our [roadmap](https://github.com/bestiejs/lodash/wiki/Roadmap).
-## Screencasts
+## Resources
-For more information check out these screencasts over Lo-Dash:
+For more information check out these articles, screencasts, and other videos over Lo-Dash:
- * [Introducing Lo-Dash](https://vimeo.com/44154599)
- * [Lo-Dash optimizations and custom builds](https://vimeo.com/44154601)
- * [Lo-Dash’s origin and why it’s a better utility belt](https://vimeo.com/44154600)
- * [Unit testing in Lo-Dash](https://vimeo.com/45865290)
- * [Lo-Dash’s approach to native method use](https://vimeo.com/48576012)
- * [CascadiaJS: Lo-Dash for a better utility belt](http://www.youtube.com/watch?v=dpPy4f_SeEk)
+ * Posts
+ - [Say “Hello” to Lo-Dash](http://kitcambridge.be/blog/say-hello-to-lo-dash/)
+
+ * Videos
+ - [Introducing Lo-Dash](https://vimeo.com/44154599)
+ - [Lo-Dash optimizations and custom builds](https://vimeo.com/44154601)
+ - [Lo-Dash’s origin and why it’s a better utility belt](https://vimeo.com/44154600)
+ - [Unit testing in Lo-Dash](https://vimeo.com/45865290)
+ - [Lo-Dash’s approach to native method use](https://vimeo.com/48576012)
+ - [CascadiaJS: Lo-Dash for a better utility belt](http://www.youtube.com/watch?v=dpPy4f_SeEk)
## Features
@@ -69,7 +73,7 @@ For more information check out these screencasts over Lo-Dash:
## Support
-Lo-Dash has been tested in at least Chrome 5~24, Firefox 1~18, IE 6-10, Opera 9.25-12, Safari 3-6, Node.js 0.4.8-0.8.19, Narwhal 0.3.2, PhantomJS 1.8.1, RingoJS 0.9, and Rhino 1.7RC5.
+Lo-Dash has been tested in at least Chrome 5~24, Firefox 1~18, IE 6-10, Opera 9.25-12, Safari 3-6, Node.js 0.4.8-0.8.20, Narwhal 0.3.2, PhantomJS 1.8.1, RingoJS 0.9, and Rhino 1.7RC5.
## Custom builds
@@ -176,7 +180,7 @@ The following options are also supported:
* `-h`, `--help` ............. Display help information
* `-m`, `--minify` ......... Write only the minified production output
* `-o`, `--output` ......... Write output to a given path/filename
- * `-p`, `--source-map` .. Generate a source map for the minified output
+ * `-p`, `--source-map` .. Generate a source map for the minified output, using an optional source map URL
* `-s`, `--silent` ......... Skip status updates normally logged to the console
* `-V`, `--version` ....... Output current version of Lo-Dash
@@ -243,30 +247,15 @@ require({
## Release Notes
-### v1.0.0
-
-#### Compatibility Warnings
-
- * Made `_.defaults` preserve `null` values, instead of overwriting them
-
-#### Changes
-
- * Added [_.at](http://lodash.com/docs#at) and [_.partialRight](http://lodash.com/docs#partialRight)
- * Added [*“imports”*](http://lodash.com/docs#templateSettings_imports) option to `_.templateSettings`
- * Added `modern` and `--source-map`/`-p` build options
- * Added support for *“_.pluck”* and *“_.where”* `callback` shorthands
- * Ensured `_.assign` and `_.defaults` support arrays
- * Ensured `_.merge` assigns `null` values and produces dense arrays
- * Deferred minifier downloads until the `lodash` utility requires them
- * Flipped `noNodeClass` test to avoid triggering Firebug’s *“break on all errors”* feature
- * Made `_.where` support deep object comparisons
- * Optimized `_.invert`, `_.pairs`, and `_.values`
- * Reduced `_.max`, `_.min`, `_.pluck`, `_.toArray`, and `_.where`
- * Simplified `createIterator` and `iteratorTemplate`
- * Tweaked `_.uniqueId` to avoid problems with buggy minifiers
- * Updated `underscore` build compatibility to v1.4.4
- * Added support for `callback` and `thisArg` arguments to `_.assign`, `_.clone`,
- `_.cloneDeep`, `_.first`, `_.last`, `_.initial`, `_.isEqual`, `_.merge`, and `_.rest`
+### v1.0.1
+
+ * Add support for specifying source map URLs in `-p`/`--source-map` build options
+ * Ensured the second argument passed to `_.assign` is not treated as a `callback`
+ * Ensured `-p`/`--source-map` build options correctly set the `sourceMappingURL`
+ * Made `-p`/`--source-map` build options set source map *“sources”* keys based on the builds performed
+ * Made `_.defer` use `setImmediate`, in Node.js, when available
+ * Made `_.where` search arrays for values regardless of their index position
+ * Removed dead code from `_.template`
The full changelog is available [here](https://github.com/bestiejs/lodash/wiki/Changelog).
diff --git a/build.js b/build.js
index e38a3f1aa5..4e34c827da 100755
--- a/build.js
+++ b/build.js
@@ -79,7 +79,7 @@
'countBy': ['forEach', 'identity', 'isEqual', 'keys'],
'debounce': [],
'defaults': ['isArray', 'forEach', 'forOwn'],
- 'defer': [],
+ 'defer': ['bind'],
'delay': [],
'difference': ['indexOf'],
'escape': [],
@@ -472,8 +472,14 @@
var source = [
';(function(window) {',
- " var freeExports = typeof exports == 'object' && exports &&",
- " (typeof global == 'object' && global && global == global.global && (window = global), exports);",
+ " var freeExports = typeof exports == 'object' && exports;",
+ '',
+ " var freeModule = typeof module == 'object' && module && module.exports == freeExports && module;",
+ '',
+ " var freeGlobal = typeof global == 'object' && global;",
+ ' if (freeGlobal.global === freeGlobal) {',
+ ' window = freeGlobal;',
+ ' }',
'',
' var templates = {},',
' _ = window._;',
@@ -505,8 +511,8 @@
' lodash.templates = lodash.extend(lodash.templates || {}, templates);',
' });',
" } else if (freeExports) {",
- " if (typeof module == 'object' && module && module.exports == freeExports) {",
- ' (module.exports = templates).templates = templates;',
+ " if (freeModule) {",
+ ' (freeModule.exports = templates).templates = templates;',
' } else {',
' freeExports.templates = templates;',
' }',
@@ -594,7 +600,7 @@
' -h, --help Display help information',
' -m, --minify Write only the minified production output',
' -o, --output Write output to a given path/filename',
- ' -p, --source-map Generate a source map for the minified output',
+ ' -p, --source-map Generate a source map for the minified output, using an optional source map URL',
' -s, --silent Skip status updates normally logged to the console',
' -V, --version Output current version of Lo-Dash',
''
@@ -989,7 +995,7 @@
source = source.replace(getIteratorTemplate(source), function(match) {
return match
.replace(/(?: *\/\/.*\n)* *["'] *(?:<% *)?if *\(hasEnumPrototype *(?:&&|\))[\s\S]+?<% *} *(?:%>|["']).+/g, '')
- .replace(/hasEnumPrototype *\|\|/g, '');
+ .replace(/hasEnumPrototype *\|\|\s*/g, '');
});
return source;
@@ -1071,7 +1077,7 @@
// remove `noArgsClass` from `_.isEmpty`
source = source.replace(matchFunction(source, 'isEmpty'), function(match) {
- return match.replace(/ *\|\| *\(noArgsClass *&&[^)]+?\)\)/g, '');
+ return match.replace(/ *\|\|\s*\(noArgsClass *&&[^)]+?\)\)/g, '');
});
return source;
@@ -1136,7 +1142,7 @@
source = source.replace(getIteratorTemplate(source), function(match) {
return match
.replace(/(?: *\/\/.*\n)*( *["'] *)<% *} *else *if *\(nonEnumArgs[\s\S]+?(\1<% *} *%>.+)/, '$2')
- .replace(/ *\|\| *nonEnumArgs/, '');
+ .replace(/ *\|\|\s*nonEnumArgs/, '');
});
return source;
@@ -1160,12 +1166,12 @@
// remove `noNodeClass` from `_.clone`
source = source.replace(matchFunction(source, 'clone'), function(match) {
- return match.replace(/ *\|\| *\(noNodeClass[\s\S]+?\)\)/, '');
+ return match.replace(/ *\|\|\s*\(noNodeClass[\s\S]+?\)\)/, '');
});
// remove `noNodeClass` from `_.isEqual`
source = source.replace(matchFunction(source, 'isEqual'), function(match) {
- return match.replace(/ *\|\| *\(noNodeClass[\s\S]+?\)\)\)/, '');
+ return match.replace(/ *\|\|\s*\(noNodeClass[\s\S]+?\)\)\)/, '');
});
return source;
@@ -1184,6 +1190,17 @@
.replace(/(?:\s*\/\/.*)*\n( *)if *\(hasObjectSpliceBug[\s\S]+?(?:{\s*}|\n\1})/, '');
}
+ /**
+ * Removes the `setImmediate` fork of `_.defer`.
+ *
+ * @private
+ * @param {String} source The source to process.
+ * @returns {String} Returns the modified source.
+ */
+ function removeSetImmediate(source) {
+ return source.replace(/(?:\s*\/\/.*)*\n( *)if *\(isV8 *&& *freeModule[\s\S]+?\n\1}/, '');
+ }
+
/**
* Removes a given variable from `source`.
*
@@ -1304,13 +1321,16 @@
// the debug version of `source`
var debugSource;
+ // used to specify the source map URL
+ var sourceMapURL;
+
// used to report invalid command-line arguments
var invalidArgs = _.reject(options.slice(options[0] == 'node' ? 2 : 0), function(value, index, options) {
if (/^(?:-o|--output)$/.test(options[index - 1]) ||
/^(?:category|exclude|exports|iife|include|moduleId|minus|plus|settings|template)=.*$/.test(value)) {
return true;
}
- return [
+ var result = [
'backbone',
'csp',
'legacy',
@@ -1328,6 +1348,12 @@
'-s', '--silent',
'-V', '--version'
].indexOf(value) > -1;
+
+ if (!result && /^(?:-p|--source-map)$/.test(options[index - 1])) {
+ result = true;
+ sourceMapURL = value;
+ }
+ return result;
});
// report invalid arguments
@@ -1517,8 +1543,8 @@
useUnderscoreClone = methods.indexOf('clone') < 0;
}
// update dependencies
- if (isModern || isUnderscore) {
- dependencyMap.reduceRight = _.without(dependencyMap.reduceRight, 'isEqual', 'isString');
+ if (isLegacy) {
+ dependencyMap.defer = _.without(dependencyMap.defer, 'bind');
}
if (isUnderscore) {
dependencyMap.contains = _.without(dependencyMap.contains, 'isString');
@@ -1546,6 +1572,9 @@
dependencyMap.clone = _.without(dependencyMap.clone, 'forEach', 'forOwn');
}
}
+ if (isModern || isUnderscore) {
+ dependencyMap.reduceRight = _.without(dependencyMap.reduceRight, 'isEqual', 'isString');
+ }
// add method names explicitly
if (includeMethods.length) {
@@ -2098,6 +2127,8 @@
/*----------------------------------------------------------------------*/
if (isLegacy) {
+ source = removeSetImmediate(source);
+
_.each(['isBindFast', 'isV8', 'nativeBind', 'nativeIsArray', 'nativeKeys', 'reNative'], function(varName) {
source = removeVar(source, varName);
});
@@ -2109,7 +2140,7 @@
// remove native `Array.isArray` branch in `_.isArray`
source = source.replace(matchFunction(source, 'isArray'), function(match) {
- return match.replace(/nativeIsArray * \|\|/, '');
+ return match.replace(/nativeIsArray * \|\|\s*/, '');
});
// replace `_.keys` with `shimKeys`
@@ -2245,7 +2276,7 @@
// minor cleanup
snippet = snippet
- .replace(/obj *\|\| *\(obj *= *{}\);/, '')
+ .replace(/obj *\|\|\s*\(obj *= *{}\);/, '')
.replace(/var __p = '';\s*__p \+=/, 'var __p =');
// remove comments, including sourceURLs
@@ -2279,7 +2310,7 @@
source = source.replace(/(?: *\/\/.*\n)*( *)if *\(typeof +define[\s\S]+?else /, '$1');
}
if (!isNode) {
- source = source.replace(/(?: *\/\/.*\n)*( *)if *\(typeof +module[\s\S]+?else *{([\s\S]+?\n)\1}\n/, '$1$2');
+ source = source.replace(/(?: *\/\/.*\n)*( *)if *\(freeModule[\s\S]+?else *{([\s\S]+?\n)\1}\n/, '$1$2');
}
if (!isCommonJS) {
source = source.replace(/(?: *\/\/.*\n)*(?:( *)else *{)?\s*freeExports\.\w+ *=[\s\S]+?(?:\n\1})?\n/, '');
@@ -2293,9 +2324,6 @@
} else {
source = source.replace(/(?: *\/\/.*\n)* *(?:else )?if *\(freeExports\) *{\s*}(?:\s*else *{([\s\S]+?) *})?\n/, '$1\n');
}
- if ((source.match(/\bfreeExports\b/g) || []).length < 2) {
- source = removeVar(source, 'freeExports');
- }
}());
/*------------------------------------------------------------------------*/
@@ -2363,6 +2391,7 @@
source = removeHasEnumPrototype(source);
}
if (isRemoved(source, 'createIterator', 'bind', 'keys')) {
+ source = removeSetImmediate(source);
source = removeVar(source, 'isBindFast');
source = removeVar(source, 'isV8');
source = removeVar(source, 'nativeBind');
@@ -2377,6 +2406,12 @@
source = source.replace(/^ *\(function\(\) *{[\s\S]+?}\(1\)\);\n/m, '');
}
}
+ if ((source.match(/\bfreeModule\b/g) || []).length < 2) {
+ source = removeVar(source, 'freeModule');
+ }
+ if ((source.match(/\bfreeExports\b/g) || []).length < 2) {
+ source = removeVar(source, 'freeExports');
+ }
debugSource = cleanupSource(source);
source = cleanupSource(source);
@@ -2413,10 +2448,11 @@
});
}
else if (!isStdOut) {
+ filePath = outputPath || path.join(cwd, basename + '.js');
outputUsed = true;
callback({
'source': debugSource,
- 'outputPath': outputPath || path.join(cwd, basename + '.js')
+ 'outputPath': filePath
});
}
}
@@ -2434,6 +2470,7 @@
'isTemplate': isTemplate,
'modes': isIIFE && ['simple', 'hybrid'],
'outputPath': outputPath,
+ 'sourceMapURL': sourceMapURL,
'onComplete': function(data) {
if (isCustom) {
data.source = addCommandsToHeader(data.source, options);
diff --git a/build/minify.js b/build/minify.js
index becc7fca6e..2250669eeb 100755
--- a/build/minify.js
+++ b/build/minify.js
@@ -7,8 +7,9 @@
https = require('https'),
path = require('path'),
spawn = require('child_process').spawn,
+ zlib = require('zlib'),
tar = require('../vendor/tar/tar.js'),
- zlib = require('zlib');
+ _ = require('../lodash.js');
/** Load other modules */
var preprocess = require('./pre-compile.js'),
@@ -18,7 +19,7 @@
var closureId = '23cf67d0f0b979d97631fc108a2a43bb82225994';
/** The Git object ID of `uglifyjs.tar.gz` */
- var uglifyId = '326ede8f4a3d8e0ae82cec7b9579d45892836629';
+ var uglifyId = 'a934fb18f8fa2768c6a68de44b6e035fe96a268b';
/** The path of the directory that is the base of the repository */
var basePath = fs.realpathSync(path.join(__dirname, '..'));
@@ -80,7 +81,12 @@
* onComplete - The function called once minification has finished.
*/
function minify(source, options) {
+ // used to specify the source map URL
+ var sourceMapURL;
+
+ // used to specify the default minifer modes
var modes = ['simple', 'advanced', 'hybrid'];
+
source || (source = '');
options || (options = {});
@@ -89,6 +95,35 @@
// convert commands to an options object
options = source;
+ // used to report invalid command-line arguments
+ var invalidArgs = _.reject(options.slice(options[0] == 'node' ? 2 : 0), function(value, index, options) {
+ if (/^(?:-o|--output)$/.test(options[index - 1]) ||
+ /^modes=.*$/.test(value)) {
+ return true;
+ }
+ var result = [
+ '-o', '--output',
+ '-p', '--source-map',
+ '-s', '--silent',
+ '-t', '--template'
+ ].indexOf(value) > -1;
+
+ if (!result && /^(?:-p|--source-map)$/.test(options[index - 1])) {
+ result = true;
+ sourceMapURL = value;
+ }
+ return result;
+ });
+
+ // report invalid arguments
+ if (invalidArgs.length) {
+ console.log(
+ '\n' +
+ 'Invalid argument' + (invalidArgs.length > 1 ? 's' : '') +
+ ' passed: ' + invalidArgs.join(', ')
+ );
+ return;
+ }
var filePath = options[options.length - 1],
isMapped = options.indexOf('-p') > -1 || options.indexOf('--source-map') > -1,
isSilent = options.indexOf('-s') > -1 || options.indexOf('--silent') > -1,
@@ -114,7 +149,8 @@
'isSilent': isSilent,
'isTemplate': isTemplate,
'modes': modes,
- 'outputPath': outputPath
+ 'outputPath': outputPath,
+ 'sourceMapURL': sourceMapURL
};
source = fs.readFileSync(filePath, 'utf8');
@@ -186,6 +222,7 @@
this.isSilent = !!options.isSilent;
this.isTemplate = !!options.isTemplate;
this.outputPath = options.outputPath;
+ this.sourceMapURL = options.sourceMapURL;
var modes = this.modes = options.modes;
source = this.source = preprocess(source, options);
@@ -305,9 +342,10 @@
var filePath = this.filePath,
isAdvanced = mode == 'advanced',
isMapped = this.isMapped,
- mapPath = getMapPath(outputPath),
options = closureOptions.slice(),
- outputPath = this.outputPath;
+ outputPath = this.outputPath,
+ mapPath = getMapPath(outputPath),
+ sourceMapURL = this.sourceMapURL || path.basename(mapPath);
// remove copyright header to make other modifications easier
var license = (/^(?:\s*\/\/.*\s*|\s*\/\*[^*]*\*+(?:[^\/][^*]*\*+)*\/\s*)*/.exec(source) || [''])[0];
@@ -369,13 +407,12 @@
if (isMapped) {
var mapOutput = fs.readFileSync(mapPath, 'utf8');
fs.unlinkSync(mapPath);
+ output = output.replace(/[\s;]*$/, '\n/*\n//@ sourceMappingURL=' + sourceMapURL) + '\n*/';
- output = output
- .replace(/[\s;]*$/, '\n/*\n//@ sourceMappingURL=' + path.basename(mapPath)) + '\n*/';
-
- mapOutput = mapOutput
- .replace(/("file":)""/, '$1"' + path.basename(outputPath) + '"')
- .replace(/("sources":)\["stdin"\]/, '$1["' + path.basename(filePath) + '"]');
+ mapOutput = JSON.parse(mapOutput);
+ mapOutput.file = path.basename(outputPath);
+ mapOutput.sources = [path.basename(filePath)];
+ mapOutput = JSON.stringify(mapOutput, null, 2);
}
callback(exception, output, mapOutput);
});
diff --git a/build/pre-compile.js b/build/pre-compile.js
index 67097afc3a..94e1011b34 100644
--- a/build/pre-compile.js
+++ b/build/pre-compile.js
@@ -70,6 +70,7 @@
'bind',
'bindAll',
'bindKey',
+ 'clearTimeout',
'clone',
'cloneDeep',
'collect',
@@ -164,6 +165,8 @@
'rest',
'result',
'select',
+ 'setImmediate',
+ 'setTimeout',
'shuffle',
'size',
'some',
@@ -233,7 +236,7 @@
source = source.replace("result[length]['value']", 'result[length].value');
// remove whitespace from string literals
- source = source.replace(/^([ "'\w]+:)? *"(?:(?=(\\?))\2.)*?"|'(?:(?=(\\?))\3.)*?'/gm, function(string, captured) {
+ source = source.replace(/^([ "'\w]+:)? *"[^"\\\n]*(?:\\.[^"\\\n]*)*"|'[^'\\\n]*(?:\\.[^'\\\n]*)*'/gm, function(string, captured) {
// remove object literal property name
if (/:$/.test(captured)) {
string = string.slice(captured.length);
@@ -247,7 +250,7 @@
});
// remove whitespace from `_.template` related regexes
- source = source.replace(/(?:reEmptyString\w+|reInsertVariable) *=.+/g, function(match) {
+ source = source.replace(/reEmptyString\w+ *=.+/g, function(match) {
return match.replace(/ |\\n/g, '');
});
diff --git a/dist/lodash.compat.js b/dist/lodash.compat.js
index 7fcf2b3999..37ebc920be 100644
--- a/dist/lodash.compat.js
+++ b/dist/lodash.compat.js
@@ -1,6 +1,6 @@
/**
* @license
- * Lo-Dash 1.0.0 (Custom Build)
+ * Lo-Dash 1.0.1 (Custom Build)
* Build: `lodash -o ./dist/lodash.compat.js`
* Copyright 2012-2013 The Dojo Foundation
* Based on Underscore.js 1.4.4
@@ -12,6 +12,9 @@
/** Detect free variable `exports` */
var freeExports = typeof exports == 'object' && exports;
+ /** Detect free variable `module` */
+ var freeModule = typeof module == 'object' && module && module.exports == freeExports && module;
+
/** Detect free variable `global` and use it as `window` */
var freeGlobal = typeof global == 'object' && global;
if (freeGlobal.global === freeGlobal) {
@@ -56,7 +59,7 @@
* Used to match ES6 template delimiters
* http://people.mozilla.org/~jorendorff/es6-draft.html#sec-7.8.6
*/
- var reEsTemplate = /\$\{((?:(?=\\?)\\?[\s\S])*?)\}/g;
+ var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
/** Used to match "interpolate" template delimiters */
var reInterpolate = /<%=([\s\S]+?)%>/g;
@@ -183,7 +186,7 @@
var noCharByIndex = ('x'[0] + Object('x')[0]) != 'xx';
/**
- * Detect if a node's [[Class]] is unresolvable (IE < 9)
+ * Detect if a DOM node's [[Class]] is unresolvable (IE < 9)
* and that the JS engine won't error when attempting to coerce an object to
* a string without a `toString` function.
*/
@@ -1053,12 +1056,10 @@
'top':
defaultsIteratorOptions.top.replace(';',
';\n' +
- 'if (argsLength > 2) {\n' +
- " if (typeof args[argsLength - 2] == 'function') {\n" +
- ' var callback = createCallback(args[--argsLength - 1], args[argsLength--], 2);\n' +
- " } else if (typeof args[argsLength - 1] == 'function') {\n" +
- ' callback = args[--argsLength];\n' +
- ' }\n' +
+ "if (argsLength > 3 && typeof args[argsLength - 2] == 'function') {\n" +
+ ' var callback = createCallback(args[--argsLength - 1], args[argsLength--], 2);\n' +
+ "} else if (argsLength > 2 && typeof args[argsLength - 1] == 'function') {\n" +
+ ' callback = args[--argsLength];\n' +
'}'
),
'loop': 'result[index] = callback ? callback(result[index], iterable[index]) : iterable[index]'
@@ -1563,16 +1564,27 @@
// recursively compare objects and arrays (susceptible to call stack limits)
if (isArr) {
- // compare lengths to determine if a deep comparison is necessary
+ length = a.length;
size = b.length;
- result = whereIndicator || size == a.length;
- if (result) {
- // deep compare the contents, ignoring non-numeric properties
- while (size--) {
- if (!(result = isEqual(a[size], b[size], callback, thisArg, stackA, stackB))) {
- break;
+ // compare lengths to determine if a deep comparison is necessary
+ result = size == a.length;
+ if (!result && !whereIndicator) {
+ return result;
+ }
+ // deep compare the contents, ignoring non-numeric properties
+ while (size--) {
+ var index = length,
+ value = b[size];
+
+ if (whereIndicator) {
+ while (index--) {
+ if ((result = isEqual(a[index], value, callback, thisArg, stackA, stackB))) {
+ break;
+ }
}
+ } else if (!(result = isEqual(a[size], value, callback, thisArg, stackA, stackB))) {
+ break;
}
}
return result;
@@ -1915,12 +1927,10 @@
if (typeof deepIndicator != 'number') {
length = args.length;
}
- if (length > 2) {
- if (typeof args[length - 2] == 'function') {
- callback = createCallback(args[--length - 1], args[length--], 2);
- } else if (typeof args[length - 1] == 'function') {
- callback = args[--length];
- }
+ if (length > 3 && typeof args[length - 2] == 'function') {
+ callback = createCallback(args[--length - 1], args[length--], 2);
+ } else if (length > 2 && typeof args[length - 1] == 'function') {
+ callback = args[--length];
}
}
while (++index < length) {
@@ -2127,7 +2137,7 @@
/*--------------------------------------------------------------------------*/
/**
- * Creates an array of elements from the specified index(es), or keys, of the
+ * Creates an array of elements from the specified indexes, or keys, of the
* `collection`. Indexes may be specified as individual arguments or as arrays
* of indexes.
*
@@ -2135,7 +2145,7 @@
* @memberOf _
* @category Collections
* @param {Array|Object|String} collection The collection to iterate over.
- * @param {Array|Number|String} [index1, index2, ...] The index(es) of
+ * @param {Array|Number|String} [index1, index2, ...] The indexes of
* `collection` to retrieve, either as individual arguments or arrays.
* @returns {Array} Returns a new array of elements corresponding to the
* provided indexes.
@@ -4221,6 +4231,10 @@
var args = slice(arguments, 1);
return setTimeout(function() { func.apply(undefined, args); }, 1);
}
+ // use `setImmediate` if it's available in Node.js
+ if (isV8 && freeModule && typeof setImmediate == 'function') {
+ defer = bind(setImmediate, window);
+ }
/**
* Creates a function that memoizes the result of `func`. If `resolver` is
@@ -4726,7 +4740,7 @@
(isEvaluating
? ', __j = Array.prototype.join;\n' +
"function print() { __p += __j.call(arguments, '') }\n"
- : (hasVariable ? '' : ', __d = ' + variable + '.' + variable + ' || ' + variable) + ';\n'
+ : ';\n'
) +
source +
'return __p\n}';
@@ -5052,7 +5066,7 @@
* @memberOf _
* @type String
*/
- lodash.VERSION = '1.0.0';
+ lodash.VERSION = '1.0.1';
// add "Chaining" functions to the wrapper
lodash.prototype.toString = wrapperToString;
@@ -5123,8 +5137,8 @@
// check for `exports` after `define` in case a build optimizer adds an `exports` object
else if (freeExports) {
// in Node.js or RingoJS v0.8.0+
- if (typeof module == 'object' && module && module.exports == freeExports) {
- (module.exports = lodash)._ = lodash;
+ if (freeModule) {
+ (freeModule.exports = lodash)._ = lodash;
}
// in Narwhal or RingoJS v0.7.0-
else {
diff --git a/dist/lodash.compat.min.js b/dist/lodash.compat.min.js
index e6c8de36fa..adb164d973 100644
--- a/dist/lodash.compat.min.js
+++ b/dist/lodash.compat.min.js
@@ -1,42 +1,42 @@
/**
* @license
- * Lo-Dash 1.0.0 (Custom Build) lodash.com/license
+ * Lo-Dash 1.0.1 (Custom Build) lodash.com/license
* Build: `lodash -o ./dist/lodash.compat.js`
* Underscore.js 1.4.4 underscorejs.org/LICENSE
*/
-;(function(n,t){function r(n){return n&&typeof n=="object"&&n.__wrapped__?n:this instanceof r?(this.__wrapped__=n,void 0):new r(n)}function e(n,t,r){t||(t=0);var e=n.length,u=e-t>=(r||it);if(u){var o={};for(r=t-1;++rt||typeof n=="undefined")return 1;if(ne;e++)r+="j='"+t.k[e]+"';if(","constructor"==t.k[e]&&(r+="!(g&&g.prototype===n)&&"),r+="i.call(n,j)){"+t.h+"}";
-return(t.b||t.i)&&(r+="}"),r+=t.c+";return u",Function("f,i,k,l,m,r,p","return function("+n+"){"+r+"}")(f,Ot,y,lr,A,rr,$t)}function c(n){return"\\"+er[n]}function l(n){return sr[n]}function p(n){return typeof n.toString!="function"&&typeof(n+"")=="string"}function s(){}function v(n,t,r){t||(t=0),typeof r=="undefined"&&(r=n?n.length:0);var e=-1;r=r-t||0;for(var u=Array(0>r?0:r);++er?Ft(0,u+r):r)||0,typeof u=="number"?o=-1<(A(n)?n.indexOf(t,r):z(n,t,r)):fr(n,function(n){return++eo&&(o=a)}}else t=!t&&A(n)?u:f(t,r),fr(n,function(n,r,u){r=t(n,r,u),r>e&&(e=r,o=n)});return o}function I(n,t,r,e){var u=3>arguments.length;if(t=f(t,e,4),lr(n)){var o=-1,i=n.length;for(u&&(r=n[++o]);++oarguments.length;if(typeof o!="number")var a=pr(n),o=a.length;else Xt&&A(n)&&(u=n.split(""));return t=f(t,e,4),F(n,function(n,e,f){e=a?a[--o]:--o,r=i?(i=W,u[e]):t(r,u[e],e,f)}),r}function B(n,t,r){var e;if(t=f(t,r),lr(n)){r=-1;for(var u=n.length;++rr?Ft(0,u+r):r||0)-1;else if(r)return e=K(n,t),n[e]===t?e:-1;for(;++e>>1,r(n[e])z(a,p))&&((r||c)&&a.push(p),i.push(e))}return i}function U(n,t){return Vt||Et&&2/g,ht=/($^)/,mt=/[&<>"']/g,dt=/['\n\r\t\u2028\u2029\\]/g,_t="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),bt=Math.ceil,jt=rt.concat,wt=Math.floor,xt=vt.test(xt=Object.getPrototypeOf)&&xt,Ot=et.hasOwnProperty,At=rt.push,St=et.toString,Et=vt.test(Et=v.bind)&&Et,kt=vt.test(kt=Array.isArray)&&kt,Nt=n.isFinite,Rt=n.isNaN,$t=vt.test($t=Object.keys)&&$t,Ft=Math.max,qt=Math.min,Dt=Math.random,It="[object Arguments]",Tt="[object Array]",Bt="[object Boolean]",Mt="[object Date]",Pt="[object Number]",zt="[object Object]",Ct="[object RegExp]",Kt="[object String]",Lt=!!n.attachEvent,Ut=Et&&!/\n|true/.test(Et+Lt),Vt=Et&&!Ut,Gt=$t&&(Lt||Ut),Ht=(Ht={0:1,length:1},rt.splice.call(Ht,0,1),Ht[0]),Jt=J;
-(function(){function n(){this.x=1}var t=[];n.prototype={valueOf:1,y:1};for(var r in new n)t.push(r);for(r in arguments)Jt=!r;Z=!/valueOf/.test(t),nt=n.propertyIsEnumerable("prototype"),tt="x"!=t[0]})(1);var Qt=arguments.constructor==Object,Wt=!y(arguments),Xt="xx"!="x"[0]+Object("x")[0];try{var Yt=St.call(document)==zt&&!({toString:0}+"")}catch(Zt){}var nr={"[object Function]":W};nr[It]=nr[Tt]=nr[Bt]=nr[Mt]=nr[Pt]=nr[zt]=nr[Ct]=nr[Kt]=J;var tr={};tr[Tt]=Array,tr[Bt]=Boolean,tr[Mt]=Date,tr[zt]=Object,tr[Pt]=Number,tr[Ct]=RegExp,tr[Kt]=String;
-var rr={"boolean":W,"function":J,object:J,number:W,string:W,undefined:W},er={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"};r.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:yt,variable:"",imports:{_:r}};var ur={a:"q,w,h",l:"var a=arguments,b=0,c=typeof h=='number'?2:a.length;while(++b":">",'"':""","'":"'"},vr=b(sr),gr=a(ur,{l:ur.l.replace(";",";if(c>2){if(typeof a[c-2]=='function'){var d=f(a[--c-1],a[c--],2);}else if(typeof a[c-1]=='function'){d=a[--c];}}"),h:"u[j]=d?d(u[j],n[j]):n[j]"}),yr=a(ur);
-w(/x/)&&(w=function(n){return n instanceof Function||"[object Function]"==St.call(n)});var hr=xt?function(n){if(!n||typeof n!="object")return W;var t=n.valueOf,r=typeof t=="function"&&(r=xt(t))&&xt(r);return r?n==r||xt(n)==r&&!y(n):h(n)}:h,mr=q,dr=R;r.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},r.assign=gr,r.at=function(n){var t=-1,r=jt.apply(rt,v(arguments,1)),e=r.length,u=Array(e);for(Xt&&A(n)&&(n=n.split(""));++tz(c,l)){f&&c.push(l);for(var s=r;--s;)if(!(u[s]||(u[s]=e(t[s],0,100)))(l))continue n;
-a.push(l)}}return a},r.invert=b,r.invoke=function(n,t){var r=v(arguments,2),e=-1,u=typeof t=="function",o=n?n.length:0,i=Array(typeof o=="number"?o:0);return F(n,function(n){i[++e]=(u?t:n[t]).apply(n,r)}),i},r.keys=pr,r.map=q,r.max=D,r.memoize=function(n,t){var r={};return function(){var e=(t?t.apply(this,arguments):arguments[0])+"";return Ot.call(r,e)?r[e]:r[e]=n.apply(this,arguments)}},r.merge=S,r.min=function(n,t,r){var e=1/0,o=e;if(!t&&lr(n)){r=-1;for(var i=n.length;++rz(o,r,1))&&(u[r]=n)}),u},r.once=function(n){var t,r;return function(){return t?r:(t=J,r=n.apply(this,arguments),n=Q,r)}},r.pairs=function(n){for(var t=-1,r=pr(n),e=r.length,u=Array(e);++tr?Ft(0,e+r):qt(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},r.mixin=G,r.noConflict=function(){return n._=ft,this},r.random=function(n,t){return n==Q&&t==Q&&(t=1),n=+n||0,t==Q&&(t=n,n=0),n+wt(Dt()*((+t||0)-n+1))},r.reduce=I,r.reduceRight=T,r.result=function(n,r){var e=n?n[r]:t;return w(e)?n[r]():e},r.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:pr(n).length
-},r.some=B,r.sortedIndex=K,r.template=function(n,e,u){var o=r.templateSettings;n||(n=""),u=yr({},u,o);var i,f=yr({},u.imports,o.imports),o=pr(f),f=E(f),a=0,l=u.interpolate||ht,p="__p+='";n.replace(RegExp((u.escape||ht).source+"|"+l.source+"|"+(l===yt?gt:ht).source+"|"+(u.evaluate||ht).source+"|$","g"),function(t,r,e,u,o,f){return e||(e=u),p+=n.slice(a,f).replace(dt,c),r&&(p+="'+__e("+r+")+'"),o&&(i=J,p+="';"+o+";__p+='"),e&&(p+="'+((__t=("+e+"))==null?'':__t)+'"),a=f+t.length,t}),p+="';\n",l=u=u.variable,l||(u="obj",p="with("+u+"){"+p+"}"),p=(i?p.replace(ct,""):p).replace(lt,"$1").replace(pt,"$1;"),p="function("+u+"){"+(l?"":u+"||("+u+"={});")+"var __t,__p='',__e=_.escape"+(i?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":(l?"":",__d="+u+"."+u+"||"+u)+";")+p+"return __p}";
-try{var s=Function(o,"return "+p).apply(t,f)}catch(v){throw v.source=p,v}return e?s(e):(s.source=p,s)},r.unescape=function(n){return n==Q?"":(n+"").replace(at,g)},r.uniqueId=function(n){var t=++ut;return(n==Q?"":n+"")+t},r.all=N,r.any=B,r.detect=$,r.foldl=I,r.foldr=T,r.include=k,r.inject=I,cr(r,function(n,t){r.prototype[t]||(r.prototype[t]=function(){var t=[this.__wrapped__];return At.apply(t,arguments),n.apply(r,t)})}),r.first=M,r.last=function(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&t!=Q){var o=u;
-for(t=f(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,e==Q||r)return n[u-1];return v(n,Ft(0,u-e))}},r.take=M,r.head=M,cr(r,function(n,t){r.prototype[t]||(r.prototype[t]=function(t,e){var u=n(this.__wrapped__,t,e);return t==Q||e&&typeof t!="function"?u:new r(u)})}),r.VERSION="1.0.0",r.prototype.toString=function(){return this.__wrapped__+""},r.prototype.value=H,r.prototype.valueOf=H,fr(["join","pop","shift"],function(n){var t=rt[n];r.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),fr(["push","reverse","sort","unshift"],function(n){var t=rt[n];
-r.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),fr(["concat","slice","splice"],function(n){var t=rt[n];r.prototype[n]=function(){return new r(t.apply(this.__wrapped__,arguments))}}),Ht&&fr(["pop","shift","splice"],function(n){var t=rt[n],e="splice"==n;r.prototype[n]=function(){var n=this.__wrapped__,u=t.apply(n,arguments);return 0===n.length&&delete n[0],e?new r(u):u}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=r,define(function(){return r
-})):X?typeof module=="object"&&module&&module.exports==X?(module.exports=r)._=r:X._=r:n._=r})(this);
\ No newline at end of file
+;(function(n,t){function r(n){return n&&typeof n=="object"&&n.__wrapped__?n:this instanceof r?(this.__wrapped__=n,void 0):new r(n)}function e(n,t,r){t||(t=0);var e=n.length,u=e-t>=(r||at);if(u){var o={};for(r=t-1;++rt||typeof n=="undefined")return 1;if(ne;e++)r+="j='"+t.k[e]+"';if(","constructor"==t.k[e]&&(r+="!(g&&g.prototype===n)&&"),r+="i.call(n,j)){"+t.h+"}";
+return(t.b||t.i)&&(r+="}"),r+=t.c+";return u",Function("f,i,k,l,m,r,p","return function("+n+"){"+r+"}")(f,St,y,sr,A,ur,Ft)}function c(n){return"\\"+or[n]}function l(n){return gr[n]}function p(n){return typeof n.toString!="function"&&typeof(n+"")=="string"}function s(){}function v(n,t,r){t||(t=0),typeof r=="undefined"&&(r=n?n.length:0);var e=-1;r=r-t||0;for(var u=Array(0>r?0:r);++er?qt(0,u+r):r)||0,typeof u=="number"?o=-1<(A(n)?n.indexOf(t,r):z(n,t,r)):cr(n,function(n){return++eo&&(o=a)}}else t=!t&&A(n)?u:f(t,r),cr(n,function(n,r,u){r=t(n,r,u),r>e&&(e=r,o=n)});return o}function D(n,t,r,e){var u=3>arguments.length;if(t=f(t,e,4),sr(n)){var o=-1,i=n.length;for(u&&(r=n[++o]);++oarguments.length;if(typeof o!="number")var a=vr(n),o=a.length;else Zt&&A(n)&&(u=n.split(""));return t=f(t,e,4),$(n,function(n,e,f){e=a?a[--o]:--o,r=i?(i=X,u[e]):t(r,u[e],e,f)}),r}function B(n,t,r){var e;if(t=f(t,r),sr(n)){r=-1;for(var u=n.length;++rr?qt(0,u+r):r||0)-1;else if(r)return e=K(n,t),n[e]===t?e:-1;for(;++e>>1,r(n[e])z(a,p))&&((r||c)&&a.push(p),i.push(e))}return i}function U(n,t){return Ht||It&&2/g,dt=/($^)/,_t=/[&<>"']/g,bt=/['\n\r\t\u2028\u2029\\]/g,jt="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),wt=Math.ceil,xt=ut.concat,Ot=Math.floor,At=yt.test(At=Object.getPrototypeOf)&&At,St=ot.hasOwnProperty,Et=ut.push,kt=ot.toString,It=yt.test(It=v.bind)&&It,Nt=yt.test(Nt=Array.isArray)&&Nt,Rt=n.isFinite,$t=n.isNaN,Ft=yt.test(Ft=Object.keys)&&Ft,qt=Math.max,Dt=Math.min,Tt=Math.random,Bt="[object Arguments]",Mt="[object Array]",Pt="[object Boolean]",zt="[object Date]",Ct="[object Number]",Kt="[object Object]",Lt="[object RegExp]",Ut="[object String]",Vt=!!n.attachEvent,Gt=It&&!/\n|true/.test(It+Vt),Ht=It&&!Gt,Jt=Ft&&(Vt||Gt),Qt=(Qt={0:1,length:1},ut.splice.call(Qt,0,1),Qt[0]),Wt=Q;
+(function(){function n(){this.x=1}var t=[];n.prototype={valueOf:1,y:1};for(var r in new n)t.push(r);for(r in arguments)Wt=!r;tt=!/valueOf/.test(t),rt=n.propertyIsEnumerable("prototype"),et="x"!=t[0]})(1);var Xt=arguments.constructor==Object,Yt=!y(arguments),Zt="xx"!="x"[0]+Object("x")[0];try{var nr=kt.call(document)==Kt&&!({toString:0}+"")}catch(tr){}var rr={"[object Function]":X};rr[Bt]=rr[Mt]=rr[Pt]=rr[zt]=rr[Ct]=rr[Kt]=rr[Lt]=rr[Ut]=Q;var er={};er[Mt]=Array,er[Pt]=Boolean,er[zt]=Date,er[Kt]=Object,er[Ct]=Number,er[Lt]=RegExp,er[Ut]=String;
+var ur={"boolean":X,"function":Q,object:Q,number:X,string:X,undefined:X},or={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"};r.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:mt,variable:"",imports:{_:r}};var ir={a:"q,w,h",l:"var a=arguments,b=0,c=typeof h=='number'?2:a.length;while(++b":">",'"':""","'":"'"},yr=b(gr),hr=a(ir,{l:ir.l.replace(";",";if(c>3&&typeof a[c-2]=='function'){var d=f(a[--c-1],a[c--],2);}else if(c>2&&typeof a[c-1]=='function'){d=a[--c];}"),h:"u[j]=d?d(u[j],n[j]):n[j]"}),mr=a(ir);
+w(/x/)&&(w=function(n){return n instanceof Function||"[object Function]"==kt.call(n)});var dr=At?function(n){if(!n||typeof n!="object")return X;var t=n.valueOf,r=typeof t=="function"&&(r=At(t))&&At(r);return r?n==r||At(n)==r&&!y(n):h(n)}:h,_r=F,br=N;Gt&&Z&&typeof setImmediate=="function"&&(V=U(setImmediate,n)),r.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},r.assign=hr,r.at=function(n){var t=-1,r=xt.apply(ut,v(arguments,1)),e=r.length,u=Array(e);for(Zt&&A(n)&&(n=n.split(""));++tz(c,l)){f&&c.push(l);for(var s=r;--s;)if(!(u[s]||(u[s]=e(t[s],0,100)))(l))continue n;
+a.push(l)}}return a},r.invert=b,r.invoke=function(n,t){var r=v(arguments,2),e=-1,u=typeof t=="function",o=n?n.length:0,i=Array(typeof o=="number"?o:0);return $(n,function(n){i[++e]=(u?t:n[t]).apply(n,r)}),i},r.keys=vr,r.map=F,r.max=q,r.memoize=function(n,t){var r={};return function(){var e=(t?t.apply(this,arguments):arguments[0])+"";return St.call(r,e)?r[e]:r[e]=n.apply(this,arguments)}},r.merge=S,r.min=function(n,t,r){var e=1/0,o=e;if(!t&&sr(n)){r=-1;for(var i=n.length;++rz(o,r,1))&&(u[r]=n)}),u},r.once=function(n){var t,r;return function(){return t?r:(t=Q,r=n.apply(this,arguments),n=W,r)}},r.pairs=function(n){for(var t=-1,r=vr(n),e=r.length,u=Array(e);++tr?qt(0,e+r):Dt(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},r.mixin=H,r.noConflict=function(){return n._=ct,this},r.random=function(n,t){return n==W&&t==W&&(t=1),n=+n||0,t==W&&(t=n,n=0),n+Ot(Tt()*((+t||0)-n+1))},r.reduce=D,r.reduceRight=T,r.result=function(n,r){var e=n?n[r]:t;return w(e)?n[r]():e},r.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:vr(n).length
+},r.some=B,r.sortedIndex=K,r.template=function(n,e,u){var o=r.templateSettings;n||(n=""),u=mr({},u,o);var i,f=mr({},u.imports,o.imports),o=vr(f),f=E(f),a=0,l=u.interpolate||dt,p="__p+='";n.replace(RegExp((u.escape||dt).source+"|"+l.source+"|"+(l===mt?ht:dt).source+"|"+(u.evaluate||dt).source+"|$","g"),function(t,r,e,u,o,f){return e||(e=u),p+=n.slice(a,f).replace(bt,c),r&&(p+="'+__e("+r+")+'"),o&&(i=Q,p+="';"+o+";__p+='"),e&&(p+="'+((__t=("+e+"))==null?'':__t)+'"),a=f+t.length,t}),p+="';\n",l=u=u.variable,l||(u="obj",p="with("+u+"){"+p+"}"),p=(i?p.replace(pt,""):p).replace(st,"$1").replace(vt,"$1;"),p="function("+u+"){"+(l?"":u+"||("+u+"={});")+"var __t,__p='',__e=_.escape"+(i?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+p+"return __p}";
+try{var s=Function(o,"return "+p).apply(t,f)}catch(v){throw v.source=p,v}return e?s(e):(s.source=p,s)},r.unescape=function(n){return n==W?"":(n+"").replace(lt,g)},r.uniqueId=function(n){var t=++it;return(n==W?"":n+"")+t},r.all=I,r.any=B,r.detect=R,r.foldl=D,r.foldr=T,r.include=k,r.inject=D,pr(r,function(n,t){r.prototype[t]||(r.prototype[t]=function(){var t=[this.__wrapped__];return Et.apply(t,arguments),n.apply(r,t)})}),r.first=M,r.last=function(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&t!=W){var o=u;
+for(t=f(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,e==W||r)return n[u-1];return v(n,qt(0,u-e))}},r.take=M,r.head=M,pr(r,function(n,t){r.prototype[t]||(r.prototype[t]=function(t,e){var u=n(this.__wrapped__,t,e);return t==W||e&&typeof t!="function"?u:new r(u)})}),r.VERSION="1.0.1",r.prototype.toString=function(){return this.__wrapped__+""},r.prototype.value=J,r.prototype.valueOf=J,cr(["join","pop","shift"],function(n){var t=ut[n];r.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),cr(["push","reverse","sort","unshift"],function(n){var t=ut[n];
+r.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),cr(["concat","slice","splice"],function(n){var t=ut[n];r.prototype[n]=function(){return new r(t.apply(this.__wrapped__,arguments))}}),Qt&&cr(["pop","shift","splice"],function(n){var t=ut[n],e="splice"==n;r.prototype[n]=function(){var n=this.__wrapped__,u=t.apply(n,arguments);return 0===n.length&&delete n[0],e?new r(u):u}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=r,define(function(){return r
+})):Y?Z?(Z.exports=r)._=r:Y._=r:n._=r})(this);
\ No newline at end of file
diff --git a/dist/lodash.js b/dist/lodash.js
index 97aed0a765..67c6055838 100644
--- a/dist/lodash.js
+++ b/dist/lodash.js
@@ -1,6 +1,6 @@
/**
* @license
- * Lo-Dash 1.0.0 (Custom Build)
+ * Lo-Dash 1.0.1 (Custom Build)
* Build: `lodash modern -o ./dist/lodash.js`
* Copyright 2012-2013 The Dojo Foundation
* Based on Underscore.js 1.4.4
@@ -12,6 +12,9 @@
/** Detect free variable `exports` */
var freeExports = typeof exports == 'object' && exports;
+ /** Detect free variable `module` */
+ var freeModule = typeof module == 'object' && module && module.exports == freeExports && module;
+
/** Detect free variable `global` and use it as `window` */
var freeGlobal = typeof global == 'object' && global;
if (freeGlobal.global === freeGlobal) {
@@ -56,7 +59,7 @@
* Used to match ES6 template delimiters
* http://people.mozilla.org/~jorendorff/es6-draft.html#sec-7.8.6
*/
- var reEsTemplate = /\$\{((?:(?=\\?)\\?[\s\S])*?)\}/g;
+ var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
/** Used to match "interpolate" template delimiters */
var reInterpolate = /<%=([\s\S]+?)%>/g;
@@ -292,7 +295,7 @@
'\n } ';
} else {
__p += '\n for (index in iterable) {';
- if ( obj.useHas) {
+ if (obj.useHas) {
__p += '\n if (';
if (obj.useHas) {
__p += 'hasOwnProperty.call(iterable, index)';
@@ -302,7 +305,7 @@
__p +=
(obj.loop ) +
'; ';
- if ( obj.useHas) {
+ if (obj.useHas) {
__p += '\n }';
} ;
__p += '\n } ';
@@ -910,12 +913,10 @@
'top':
defaultsIteratorOptions.top.replace(';',
';\n' +
- 'if (argsLength > 2) {\n' +
- " if (typeof args[argsLength - 2] == 'function') {\n" +
- ' var callback = createCallback(args[--argsLength - 1], args[argsLength--], 2);\n' +
- " } else if (typeof args[argsLength - 1] == 'function') {\n" +
- ' callback = args[--argsLength];\n' +
- ' }\n' +
+ "if (argsLength > 3 && typeof args[argsLength - 2] == 'function') {\n" +
+ ' var callback = createCallback(args[--argsLength - 1], args[argsLength--], 2);\n' +
+ "} else if (argsLength > 2 && typeof args[argsLength - 1] == 'function') {\n" +
+ ' callback = args[--argsLength];\n' +
'}'
),
'loop': 'result[index] = callback ? callback(result[index], iterable[index]) : iterable[index]'
@@ -1420,16 +1421,27 @@
// recursively compare objects and arrays (susceptible to call stack limits)
if (isArr) {
- // compare lengths to determine if a deep comparison is necessary
+ length = a.length;
size = b.length;
- result = whereIndicator || size == a.length;
- if (result) {
- // deep compare the contents, ignoring non-numeric properties
- while (size--) {
- if (!(result = isEqual(a[size], b[size], callback, thisArg, stackA, stackB))) {
- break;
+ // compare lengths to determine if a deep comparison is necessary
+ result = size == a.length;
+ if (!result && !whereIndicator) {
+ return result;
+ }
+ // deep compare the contents, ignoring non-numeric properties
+ while (size--) {
+ var index = length,
+ value = b[size];
+
+ if (whereIndicator) {
+ while (index--) {
+ if ((result = isEqual(a[index], value, callback, thisArg, stackA, stackB))) {
+ break;
+ }
}
+ } else if (!(result = isEqual(a[size], value, callback, thisArg, stackA, stackB))) {
+ break;
}
}
return result;
@@ -1772,12 +1784,10 @@
if (typeof deepIndicator != 'number') {
length = args.length;
}
- if (length > 2) {
- if (typeof args[length - 2] == 'function') {
- callback = createCallback(args[--length - 1], args[length--], 2);
- } else if (typeof args[length - 1] == 'function') {
- callback = args[--length];
- }
+ if (length > 3 && typeof args[length - 2] == 'function') {
+ callback = createCallback(args[--length - 1], args[length--], 2);
+ } else if (length > 2 && typeof args[length - 1] == 'function') {
+ callback = args[--length];
}
}
while (++index < length) {
@@ -1984,7 +1994,7 @@
/*--------------------------------------------------------------------------*/
/**
- * Creates an array of elements from the specified index(es), or keys, of the
+ * Creates an array of elements from the specified indexes, or keys, of the
* `collection`. Indexes may be specified as individual arguments or as arrays
* of indexes.
*
@@ -1992,7 +2002,7 @@
* @memberOf _
* @category Collections
* @param {Array|Object|String} collection The collection to iterate over.
- * @param {Array|Number|String} [index1, index2, ...] The index(es) of
+ * @param {Array|Number|String} [index1, index2, ...] The indexes of
* `collection` to retrieve, either as individual arguments or arrays.
* @returns {Array} Returns a new array of elements corresponding to the
* provided indexes.
@@ -4071,6 +4081,10 @@
var args = slice(arguments, 1);
return setTimeout(function() { func.apply(undefined, args); }, 1);
}
+ // use `setImmediate` if it's available in Node.js
+ if (isV8 && freeModule && typeof setImmediate == 'function') {
+ defer = bind(setImmediate, window);
+ }
/**
* Creates a function that memoizes the result of `func`. If `resolver` is
@@ -4576,7 +4590,7 @@
(isEvaluating
? ', __j = Array.prototype.join;\n' +
"function print() { __p += __j.call(arguments, '') }\n"
- : (hasVariable ? '' : ', __d = ' + variable + '.' + variable + ' || ' + variable) + ';\n'
+ : ';\n'
) +
source +
'return __p\n}';
@@ -4902,7 +4916,7 @@
* @memberOf _
* @type String
*/
- lodash.VERSION = '1.0.0';
+ lodash.VERSION = '1.0.1';
// add "Chaining" functions to the wrapper
lodash.prototype.toString = wrapperToString;
@@ -4954,8 +4968,8 @@
// check for `exports` after `define` in case a build optimizer adds an `exports` object
else if (freeExports) {
// in Node.js or RingoJS v0.8.0+
- if (typeof module == 'object' && module && module.exports == freeExports) {
- (module.exports = lodash)._ = lodash;
+ if (freeModule) {
+ (freeModule.exports = lodash)._ = lodash;
}
// in Narwhal or RingoJS v0.7.0-
else {
diff --git a/dist/lodash.min.js b/dist/lodash.min.js
index a7ea6ed129..c898ff0f0c 100644
--- a/dist/lodash.min.js
+++ b/dist/lodash.min.js
@@ -1,40 +1,40 @@
/**
* @license
- * Lo-Dash 1.0.0 (Custom Build) lodash.com/license
+ * Lo-Dash 1.0.1 (Custom Build) lodash.com/license
* Build: `lodash modern -o ./dist/lodash.js`
* Underscore.js 1.4.4 underscorejs.org/LICENSE
*/
-;(function(n,t){function r(n){if(!n||typeof n!="object")return Q;var t=n.valueOf,r=typeof t=="function"&&(r=dt(t))&&dt(r);if(r)n=n==r||dt(n)==r&&!h(n);else{var e=Q;!n||typeof n!="object"||h(n)?n=e:(t=n.constructor,!j(t)||t instanceof t?(Wt(n,function(n,t){e=t}),n=e===Q||_t.call(n,e)):n=e)}return n}function e(n){return n&&typeof n=="object"&&n.__wrapped__?n:this instanceof e?(this.__wrapped__=n,void 0):new e(n)}function u(n,t,r){t||(t=0);var e=n.length,u=e-t>=(r||rt);if(u){var o={};for(r=t-1;++rt||typeof n=="undefined")return 1;if(nr?0:r);++er?St(0,u+r):r)||0,typeof u=="number"?o=-1<(A(n)?n.indexOf(t,r):z(n,t,r)):Qt(n,function(n){return++eu&&(u=f)}}else t=!t&&A(n)?o:a(t,r),Qt(n,function(n,r,o){r=t(n,r,o),r>e&&(e=r,u=n)});return u}function D(n,t,r,e){var u=3>arguments.length;if(t=a(t,e,4),Yt(n)){var o=-1,i=n.length;for(u&&(r=n[++o]);++oarguments.length;if(typeof u!="number")var i=Zt(n),u=i.length;return t=a(t,e,4),F(n,function(e,f,a){f=i?i[--u]:--u,r=o?(o=Q,n[f]):t(r,n[f],f,a)}),r}function B(n,t,r){var e;if(t=a(t,r),Yt(n)){r=-1;for(var u=n.length;++rr?St(0,u+r):r||0)-1;else if(r)return e=C(n,t),n[e]===t?e:-1;for(;++e>>1,r(n[e])z(f,p))&&((r||c)&&f.push(p),i.push(e))}return i}function U(n,t){return Pt||wt&&2/g,st=/($^)/,vt=/[&<>"']/g,gt=/['\n\r\t\u2028\u2029\\]/g,ht=Math.ceil,yt=Y.concat,mt=Math.floor,dt=ct.test(dt=Object.getPrototypeOf)&&dt,_t=Z.hasOwnProperty,bt=Y.push,jt=Z.toString,wt=ct.test(wt=v.bind)&&wt,xt=ct.test(xt=Array.isArray)&&xt,At=n.isFinite,Ot=n.isNaN,Et=ct.test(Et=Object.keys)&&Et,St=Math.max,Nt=Math.min,Rt=Math.random,$t="[object Arguments]",Ft="[object Array]",kt="[object Boolean]",qt="[object Date]",Dt="[object Number]",Tt="[object Object]",Bt="[object RegExp]",It="[object String]",Mt=!!n.attachEvent,zt=wt&&!/\n|true/.test(wt+Mt),Pt=wt&&!zt,Ct=Et&&(Mt||zt),Kt={"[object Function]":Q};
-Kt[$t]=Kt[Ft]=Kt[kt]=Kt[qt]=Kt[Dt]=Kt[Tt]=Kt[Bt]=Kt[It]=J;var Ut={};Ut[Ft]=Array,Ut[kt]=Boolean,Ut[qt]=Date,Ut[Tt]=Object,Ut[Dt]=Number,Ut[Bt]=RegExp,Ut[It]=String;var Vt={"boolean":Q,"function":J,object:J,number:Q,string:Q,undefined:Q},Gt={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"};e.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:pt,variable:"",imports:{_:e}};var Ht={a:"q,w,h",l:"var a=arguments,b=0,c=typeof h=='number'?2:a.length;while(++b":">",'"':""","'":"'"},tr=_(nr),rr=c(Ht,{l:Ht.l.replace(";",";if(c>2){if(typeof a[c-2]=='function'){var d=f(a[--c-1],a[c--],2);}else if(typeof a[c-1]=='function'){d=a[--c];}}"),h:"u[j]=d?d(u[j],n[j]):n[j]"}),er=c(Ht);j(/x/)&&(j=function(n){return n instanceof Function||"[object Function]"==jt.call(n)}),e.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},e.assign=rr,e.at=function(n){for(var t=-1,r=yt.apply(Y,v(arguments,1)),e=r.length,u=Array(e);++tz(c,l)){f&&c.push(l);for(var s=r;--s;)if(!(e[s]||(e[s]=u(t[s],0,100)))(l))continue n;a.push(l)}}return a},e.invert=_,e.invoke=function(n,t){var r=v(arguments,2),e=-1,u=typeof t=="function",o=n?n.length:0,i=Array(typeof o=="number"?o:0);return F(n,function(n){i[++e]=(u?t:n[t]).apply(n,r)}),i},e.keys=Zt,e.map=k,e.max=q,e.memoize=function(n,t){var r={};return function(){var e=(t?t.apply(this,arguments):arguments[0])+"";return _t.call(r,e)?r[e]:r[e]=n.apply(this,arguments)
-}},e.merge=O,e.min=function(n,t,r){var e=1/0,u=e;if(!t&&Yt(n)){r=-1;for(var i=n.length;++rz(o,r,1))&&(u[r]=n)}),u},e.once=function(n){var t,r;
-return function(){return t?r:(t=J,r=n.apply(this,arguments),n=L,r)}},e.pairs=function(n){for(var t=-1,r=Zt(n),e=r.length,u=Array(e);++tr?St(0,e+r):Nt(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},e.mixin=G,e.noConflict=function(){return n._=et,this},e.random=function(n,t){return n==L&&t==L&&(t=1),n=+n||0,t==L&&(t=n,n=0),n+mt(Rt()*((+t||0)-n+1))
-},e.reduce=D,e.reduceRight=T,e.result=function(n,r){var e=n?n[r]:t;return j(e)?n[r]():e},e.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Zt(n).length},e.some=B,e.sortedIndex=C,e.template=function(n,r,u){var o=e.templateSettings;n||(n=""),u=er({},u,o);var i,f=er({},u.imports,o.imports),o=Zt(f),f=E(f),a=0,c=u.interpolate||st,p="__p+='";n.replace(RegExp((u.escape||st).source+"|"+c.source+"|"+(c===pt?lt:st).source+"|"+(u.evaluate||st).source+"|$","g"),function(t,r,e,u,o,f){return e||(e=u),p+=n.slice(a,f).replace(gt,l),r&&(p+="'+__e("+r+")+'"),o&&(i=J,p+="';"+o+";__p+='"),e&&(p+="'+((__t=("+e+"))==null?'':__t)+'"),a=f+t.length,t
-}),p+="';\n",c=u=u.variable,c||(u="obj",p="with("+u+"){"+p+"}"),p=(i?p.replace(ot,""):p).replace(it,"$1").replace(ft,"$1;"),p="function("+u+"){"+(c?"":u+"||("+u+"={});")+"var __t,__p='',__e=_.escape"+(i?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":(c?"":",__d="+u+"."+u+"||"+u)+";")+p+"return __p}";try{var s=Function(o,"return "+p).apply(t,f)}catch(v){throw v.source=p,v}return r?s(r):(s.source=p,s)},e.unescape=function(n){return n==L?"":(n+"").replace(ut,g)},e.uniqueId=function(n){var t=++nt;
-return(n==L?"":n+"")+t},e.all=N,e.any=B,e.detect=$,e.foldl=D,e.foldr=T,e.include=S,e.inject=D,Xt(e,function(n,t){e.prototype[t]||(e.prototype[t]=function(){var t=[this.__wrapped__];return bt.apply(t,arguments),n.apply(e,t)})}),e.first=I,e.last=function(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&t!=L){var o=u;for(t=a(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,e==L||r)return n[u-1];return v(n,St(0,u-e))}},e.take=I,e.head=I,Xt(e,function(n,t){e.prototype[t]||(e.prototype[t]=function(t,r){var u=n(this.__wrapped__,t,r);
-return t==L||r&&typeof t!="function"?u:new e(u)})}),e.VERSION="1.0.0",e.prototype.toString=function(){return this.__wrapped__+""},e.prototype.value=H,e.prototype.valueOf=H,Qt(["join","pop","shift"],function(n){var t=Y[n];e.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),Qt(["push","reverse","sort","unshift"],function(n){var t=Y[n];e.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),Qt(["concat","slice","splice"],function(n){var t=Y[n];e.prototype[n]=function(){return new e(t.apply(this.__wrapped__,arguments))
-}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=e,define(function(){return e})):W?typeof module=="object"&&module&&module.exports==W?(module.exports=e)._=e:W._=e:n._=e})(this);
\ No newline at end of file
+;(function(n,t){function r(n){if(!n||typeof n!="object")return W;var t=n.valueOf,r=typeof t=="function"&&(r=bt(t))&&bt(r);if(r)n=n==r||bt(n)==r&&!h(n);else{var e=W;!n||typeof n!="object"||h(n)?n=e:(t=n.constructor,!j(t)||t instanceof t?(Yt(n,function(n,t){e=t}),n=e===W||jt.call(n,e)):n=e)}return n}function e(n){return n&&typeof n=="object"&&n.__wrapped__?n:this instanceof e?(this.__wrapped__=n,void 0):new e(n)}function u(n,t,r){t||(t=0);var e=n.length,u=e-t>=(r||ut);if(u){var o={};for(r=t-1;++rt||typeof n=="undefined")return 1;if(nr?0:r);++er?Nt(0,u+r):r)||0,typeof u=="number"?o=-1<(A(n)?n.indexOf(t,r):z(n,t,r)):Xt(n,function(n){return++eu&&(u=f)}}else t=!t&&A(n)?o:a(t,r),Xt(n,function(n,r,o){r=t(n,r,o),r>e&&(e=r,u=n)});return u}function D(n,t,r,e){var u=3>arguments.length;if(t=a(t,e,4),nr(n)){var o=-1,i=n.length;for(u&&(r=n[++o]);++oarguments.length;if(typeof u!="number")var i=tr(n),u=i.length;return t=a(t,e,4),$(n,function(e,f,a){f=i?i[--u]:--u,r=o?(o=W,n[f]):t(r,n[f],f,a)}),r}function T(n,t,r){var e;if(t=a(t,r),nr(n)){r=-1;for(var u=n.length;++rr?Nt(0,u+r):r||0)-1;else if(r)return e=C(n,t),n[e]===t?e:-1;for(;++e>>1,r(n[e])z(f,p))&&((r||c)&&f.push(p),i.push(e))}return i}function U(n,t){return Kt||At&&2/g,gt=/($^)/,ht=/[&<>"']/g,yt=/['\n\r\t\u2028\u2029\\]/g,mt=Math.ceil,dt=nt.concat,_t=Math.floor,bt=pt.test(bt=Object.getPrototypeOf)&&bt,jt=tt.hasOwnProperty,wt=nt.push,xt=tt.toString,At=pt.test(At=v.bind)&&At,Ot=pt.test(Ot=Array.isArray)&&Ot,Et=n.isFinite,St=n.isNaN,kt=pt.test(kt=Object.keys)&&kt,Nt=Math.max,Rt=Math.min,$t=Math.random,Ft="[object Arguments]",qt="[object Array]",Dt="[object Boolean]",It="[object Date]",Tt="[object Number]",Bt="[object Object]",Mt="[object RegExp]",zt="[object String]",Pt=!!n.attachEvent,Ct=At&&!/\n|true/.test(At+Pt),Kt=At&&!Ct,Ut=kt&&(Pt||Ct),Vt={"[object Function]":W};
+Vt[Ft]=Vt[qt]=Vt[Dt]=Vt[It]=Vt[Tt]=Vt[Bt]=Vt[Mt]=Vt[zt]=L;var Gt={};Gt[qt]=Array,Gt[Dt]=Boolean,Gt[It]=Date,Gt[Bt]=Object,Gt[Tt]=Number,Gt[Mt]=RegExp,Gt[zt]=String;var Ht={"boolean":W,"function":L,object:L,number:W,string:W,undefined:W},Jt={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"};e.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:vt,variable:"",imports:{_:e}};var Lt={a:"q,w,h",l:"var a=arguments,b=0,c=typeof h=='number'?2:a.length;while(++b":">",'"':""","'":"'"},er=_(rr),ur=c(Lt,{l:Lt.l.replace(";",";if(c>3&&typeof a[c-2]=='function'){var d=f(a[--c-1],a[c--],2);}else if(c>2&&typeof a[c-1]=='function'){d=a[--c];}"),h:"u[j]=d?d(u[j],n[j]):n[j]"}),or=c(Lt);j(/x/)&&(j=function(n){return n instanceof Function||"[object Function]"==xt.call(n)}),Ct&&Y&&typeof setImmediate=="function"&&(V=U(setImmediate,n)),e.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0
+}},e.assign=ur,e.at=function(n){for(var t=-1,r=dt.apply(nt,v(arguments,1)),e=r.length,u=Array(e);++tz(c,l)){f&&c.push(l);for(var s=r;--s;)if(!(e[s]||(e[s]=u(t[s],0,100)))(l))continue n;a.push(l)}}return a},e.invert=_,e.invoke=function(n,t){var r=v(arguments,2),e=-1,u=typeof t=="function",o=n?n.length:0,i=Array(typeof o=="number"?o:0);return $(n,function(n){i[++e]=(u?t:n[t]).apply(n,r)}),i},e.keys=tr,e.map=F,e.max=q,e.memoize=function(n,t){var r={};return function(){var e=(t?t.apply(this,arguments):arguments[0])+"";
+return jt.call(r,e)?r[e]:r[e]=n.apply(this,arguments)}},e.merge=O,e.min=function(n,t,r){var e=1/0,u=e;if(!t&&nr(n)){r=-1;for(var i=n.length;++rz(o,r,1))&&(u[r]=n)
+}),u},e.once=function(n){var t,r;return function(){return t?r:(t=L,r=n.apply(this,arguments),n=Q,r)}},e.pairs=function(n){for(var t=-1,r=tr(n),e=r.length,u=Array(e);++tr?Nt(0,e+r):Rt(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},e.mixin=H,e.noConflict=function(){return n._=ot,this},e.random=function(n,t){return n==Q&&t==Q&&(t=1),n=+n||0,t==Q&&(t=n,n=0),n+_t($t()*((+t||0)-n+1))
+},e.reduce=D,e.reduceRight=I,e.result=function(n,r){var e=n?n[r]:t;return j(e)?n[r]():e},e.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:tr(n).length},e.some=T,e.sortedIndex=C,e.template=function(n,r,u){var o=e.templateSettings;n||(n=""),u=or({},u,o);var i,f=or({},u.imports,o.imports),o=tr(f),f=E(f),a=0,c=u.interpolate||gt,p="__p+='";n.replace(RegExp((u.escape||gt).source+"|"+c.source+"|"+(c===vt?st:gt).source+"|"+(u.evaluate||gt).source+"|$","g"),function(t,r,e,u,o,f){return e||(e=u),p+=n.slice(a,f).replace(yt,l),r&&(p+="'+__e("+r+")+'"),o&&(i=L,p+="';"+o+";__p+='"),e&&(p+="'+((__t=("+e+"))==null?'':__t)+'"),a=f+t.length,t
+}),p+="';\n",c=u=u.variable,c||(u="obj",p="with("+u+"){"+p+"}"),p=(i?p.replace(ft,""):p).replace(at,"$1").replace(ct,"$1;"),p="function("+u+"){"+(c?"":u+"||("+u+"={});")+"var __t,__p='',__e=_.escape"+(i?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+p+"return __p}";try{var s=Function(o,"return "+p).apply(t,f)}catch(v){throw v.source=p,v}return r?s(r):(s.source=p,s)},e.unescape=function(n){return n==Q?"":(n+"").replace(it,g)},e.uniqueId=function(n){var t=++rt;return(n==Q?"":n+"")+t
+},e.all=k,e.any=T,e.detect=R,e.foldl=D,e.foldr=I,e.include=S,e.inject=D,Zt(e,function(n,t){e.prototype[t]||(e.prototype[t]=function(){var t=[this.__wrapped__];return wt.apply(t,arguments),n.apply(e,t)})}),e.first=B,e.last=function(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&t!=Q){var o=u;for(t=a(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,e==Q||r)return n[u-1];return v(n,Nt(0,u-e))}},e.take=B,e.head=B,Zt(e,function(n,t){e.prototype[t]||(e.prototype[t]=function(t,r){var u=n(this.__wrapped__,t,r);
+return t==Q||r&&typeof t!="function"?u:new e(u)})}),e.VERSION="1.0.1",e.prototype.toString=function(){return this.__wrapped__+""},e.prototype.value=J,e.prototype.valueOf=J,Xt(["join","pop","shift"],function(n){var t=nt[n];e.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),Xt(["push","reverse","sort","unshift"],function(n){var t=nt[n];e.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),Xt(["concat","slice","splice"],function(n){var t=nt[n];e.prototype[n]=function(){return new e(t.apply(this.__wrapped__,arguments))
+}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=e,define(function(){return e})):X?Y?(Y.exports=e)._=e:X._=e:n._=e})(this);
\ No newline at end of file
diff --git a/dist/lodash.underscore.js b/dist/lodash.underscore.js
index eda71ebd73..516edda036 100644
--- a/dist/lodash.underscore.js
+++ b/dist/lodash.underscore.js
@@ -1,6 +1,6 @@
/**
* @license
- * Lo-Dash 1.0.0 (Custom Build)
+ * Lo-Dash 1.0.1 (Custom Build)
* Build: `lodash underscore -o ./dist/lodash.underscore.js`
* Copyright 2012-2013 The Dojo Foundation
* Based on Underscore.js 1.4.4
@@ -12,6 +12,9 @@
/** Detect free variable `exports` */
var freeExports = typeof exports == 'object' && exports;
+ /** Detect free variable `module` */
+ var freeModule = typeof module == 'object' && module && module.exports == freeExports && module;
+
/** Detect free variable `global` and use it as `window` */
var freeGlobal = typeof global == 'object' && global;
if (freeGlobal.global === freeGlobal) {
@@ -53,7 +56,7 @@
* Used to match ES6 template delimiters
* http://people.mozilla.org/~jorendorff/es6-draft.html#sec-7.8.6
*/
- var reEsTemplate = /\$\{((?:(?=\\?)\\?[\s\S])*?)\}/g;
+ var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
/** Used to match "interpolate" template delimiters */
var reInterpolate = /<%=([\s\S]+?)%>/g;
@@ -3467,6 +3470,10 @@
var args = slice(arguments, 1);
return setTimeout(function() { func.apply(undefined, args); }, 1);
}
+ // use `setImmediate` if it's available in Node.js
+ if (isV8 && freeModule && typeof setImmediate == 'function') {
+ defer = bind(setImmediate, window);
+ }
/**
* Creates a function that memoizes the result of `func`. If `resolver` is
@@ -4241,7 +4248,7 @@
* @memberOf _
* @type String
*/
- lodash.VERSION = '1.0.0';
+ lodash.VERSION = '1.0.1';
// add functions to `lodash.prototype`
mixin(lodash);
@@ -4285,8 +4292,8 @@
if (freeExports) {
// in Node.js or RingoJS v0.8.0+
- if (typeof module == 'object' && module && module.exports == freeExports) {
- (module.exports = lodash)._ = lodash;
+ if (freeModule) {
+ (freeModule.exports = lodash)._ = lodash;
}
// in Narwhal or RingoJS v0.7.0-
else {
diff --git a/dist/lodash.underscore.min.js b/dist/lodash.underscore.min.js
index 1c9cd67e15..42897cec28 100644
--- a/dist/lodash.underscore.min.js
+++ b/dist/lodash.underscore.min.js
@@ -1,34 +1,34 @@
/**
* @license
- * Lo-Dash 1.0.0 (Custom Build) lodash.com/license
+ * Lo-Dash 1.0.1 (Custom Build) lodash.com/license
* Build: `lodash underscore -o ./dist/lodash.underscore.js`
* Underscore.js 1.4.4 underscorejs.org/LICENSE
*/
-;(function(n,r){function t(n,r){var t;if(n&&Rr[typeof n])for(t in r||(r=W),n)if(r(n[t],t,n)===Z)break}function e(n,r,t){if(n){r=r&&typeof t=="undefined"?r:a(r,t);var e=n.length;if(t=-1,typeof e=="number")for(;++tr||typeof n=="undefined")return 1;if(nt?0:t);++eo&&(o=f)}}else r=a(r,t),e(n,function(n,t,e){t=r(n,t,e),t>u&&(u=t,o=n)});return o}function q(n,r,t,u){var o=3>arguments.length;if(r=a(r,u,4),qr(n)){var i=-1,f=n.length;for(o&&(t=n[++i]);++iarguments.length;if(typeof u!="number")var i=Br(n),u=i.length;return r=a(r,e,4),F(n,function(e,a,f){a=i?i[--u]:--u,t=o?(o=K,n[a]):r(t,n[a],a,f)}),t}function D(n,r,t){var u;
-if(r=a(r,t),qr(n)){t=-1;for(var o=n.length;++tt?mr(0,u+t):t||0)-1;else if(t)return e=P(n,r),n[e]===r?e:-1;for(;++e>>1,t(n[e])z(f,c))&&(t&&f.push(c),i.push(e))}return i}function V(n,r){return Nr||sr&&2"']/g,or=/['\n\r\t\u2028\u2029\\]/g,ir=Math.ceil,ar=X.concat,fr=Math.floor,cr=Q.hasOwnProperty,lr=X.push,pr=Q.toString,sr=tr.test(sr=p.bind)&&sr,vr=tr.test(vr=Array.isArray)&&vr,hr=n.isFinite,gr=n.isNaN,yr=tr.test(yr=Object.keys)&&yr,mr=Math.max,_r=Math.min,dr=Math.random,br="[object Arguments]",jr="[object Array]",wr="[object Boolean]",Ar="[object Date]",xr="[object Number]",Er="[object Object]",Or="[object RegExp]",Sr="[object String]",Q=!!n.attachEvent,Q=sr&&!/\n|true/.test(sr+Q),Nr=sr&&!Q,kr=(kr={0:1,length:1},X.splice.call(kr,0,1),kr[0]),Fr=arguments.constructor==Object,Rr={"boolean":K,"function":H,object:H,number:K,string:K,undefined:K},Tr={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"};
-u.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},v(arguments)||(v=function(n){return n?cr.call(n,"callee"):K});var qr=vr||function(n){return Fr&&n instanceof Array||pr.call(n)==jr},Br=yr?function(n){return w(n)?yr(n):[]}:h,Dr={"&":"&","<":"<",">":">",'"':""","'":"'"},Mr=_(Dr);j(/x/)&&(j=function(n){return n instanceof Function||"[object Function]"==pr.call(n)});var $r=R;u.after=function(n,r){return 1>n?r():function(){return 1>--n?r.apply(this,arguments):void 0
-}},u.bind=V,u.bindAll=function(n){for(var r=ar.apply(X,arguments),t=1z(e,o,t)&&u.push(o)}return u},u.filter=N,u.flatten=I,u.forEach=F,u.functions=m,u.groupBy=function(n,r,t){var e={};
-return r=a(r,t),F(n,function(n,t,u){t=r(n,t,u)+"",(cr.call(e,t)?e[t]:e[t]=[]).push(n)}),e},u.initial=function(n,r,t){if(!n)return[];var e=0,u=n.length;if(typeof r!="number"&&r!=J){var o=u;for(r=a(r,t);o--&&r(n[o],o,n);)e++}else e=r==J||t?1:r||e;return p(n,0,_r(mr(0,u-e),u))},u.intersection=function(n){var r=arguments,t=r.length,e=-1,u=n?n.length:0,o=[];n:for(;++ez(o,i)){for(var a=t;--a;)if(0>z(r[a],i))continue n;o.push(i)}}return o},u.invert=_,u.invoke=function(n,r){var t=p(arguments,2),e=-1,u=typeof r=="function",o=n?n.length:0,i=Array(typeof o=="number"?o:0);
-return F(n,function(n){i[++e]=(u?r:n[r]).apply(n,t)}),i},u.keys=Br,u.map=R,u.max=T,u.memoize=function(n,r){var t={};return function(){var e=(r?r.apply(this,arguments):arguments[0])+"";return cr.call(t,e)?t[e]:t[e]=n.apply(this,arguments)}},u.min=function(n,r,t){var u=1/0,o=u;if(!r&&qr(n)){t=-1;for(var i=n.length;++tz(r,t,1)&&(e[t]=n)}),e},u.once=function(n){var r,t;return function(){return r?t:(r=H,t=n.apply(this,arguments),n=J,t)}},u.pairs=function(n){for(var r=-1,t=Br(n),e=t.length,u=Array(e);++rz(arguments,u,1)&&e.push(u)}return e},u.wrap=function(n,r){return function(){var t=[n];return lr.apply(t,arguments),r.apply(this,t)}},u.zip=function(n){for(var r=-1,t=n?T($r(arguments,"length")):0,e=Array(t);++rt?mr(0,e+t):_r(t,e-1))+1);e--;)if(n[e]===r)return e;return-1},u.mixin=G,u.noConflict=function(){return n._=nr,this},u.random=function(n,r){return n==J&&r==J&&(r=1),n=+n||0,r==J&&(r=n,n=0),n+fr(dr()*((+r||0)-n+1))},u.reduce=q,u.reduceRight=B,u.result=function(n,r){var t=n?n[r]:J;return j(t)?n[r]():t},u.size=function(n){var r=n?n.length:0;return typeof r=="number"?r:Br(n).length
-},u.some=D,u.sortedIndex=P,u.template=function(n,r,t){n||(n=""),t=y({},t,u.templateSettings);var e=0,o="__p+='",i=t.variable;n.replace(RegExp((t.escape||er).source+"|"+(t.interpolate||er).source+"|"+(t.evaluate||er).source+"|$","g"),function(r,t,u,i,a){return o+=n.slice(e,a).replace(or,f),t&&(o+="'+_['escape']("+t+")+'"),i&&(o+="';"+i+";__p+='"),u&&(o+="'+((__t=("+u+"))==null?'':__t)+'"),e=a+r.length,r}),o+="';\n",i||(i="obj",o="with("+i+"||{}){"+o+"}"),o="function("+i+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+o+"return __p}";
-try{var a=Function("_","return "+o)(u)}catch(c){throw c.source=o,c}return r?a(r):(a.source=o,a)},u.unescape=function(n){return n==J?"":(n+"").replace(rr,s)},u.uniqueId=function(n){var r=++Y+"";return n?n+r:r},u.all=S,u.any=D,u.detect=k,u.foldl=q,u.foldr=B,u.include=O,u.inject=q,u.first=$,u.last=function(n,r,t){if(n){var e=0,u=n.length;if(typeof r!="number"&&r!=J){var o=u;for(r=a(r,t);o--&&r(n[o],o,n);)e++}else if(e=r,e==J||t)return n[u-1];return p(n,mr(0,u-e))}},u.take=$,u.head=$,u.chain=function(n){return n=new u(n),n.__chain__=H,n
-},u.VERSION="1.0.0",G(u),u.prototype.chain=function(){return this.__chain__=H,this},u.prototype.value=function(){return this.__wrapped__},e("pop push reverse shift sort splice unshift".split(" "),function(n){var r=X[n];u.prototype[n]=function(){var n=this.__wrapped__;return r.apply(n,arguments),kr&&0===n.length&&delete n[0],this}}),e(["concat","join","slice"],function(n){var r=X[n];u.prototype[n]=function(){var n=r.apply(this.__wrapped__,arguments);return this.__chain__&&(n=new u(n),n.__chain__=H),n
-}}),L?typeof module=="object"&&module&&module.exports==L?(module.exports=u)._=u:L._=u:n._=u})(this);
\ No newline at end of file
+;(function(n,t){function r(n,t){var r;if(n&&qt[typeof n])for(r in t||(t=G),n)if(t(n[r],r,n)===tt)break}function e(n,t,r){if(n){t=t&&typeof r=="undefined"?t:a(t,r);var e=n.length;if(r=-1,typeof e=="number")for(;++rt||typeof n=="undefined")return 1;if(nr?0:r);++eo&&(o=f)}}else t=a(t,r),e(n,function(n,r,e){r=t(n,r,e),r>u&&(u=r,o=n)});return o}function q(n,t,r,u){var o=3>arguments.length;if(t=a(t,u,4),Bt(n)){var i=-1,f=n.length;for(o&&(r=n[++i]);++iarguments.length;if(typeof u!="number")var i=Dt(n),u=i.length;return t=a(t,e,4),F(n,function(e,a,f){a=i?i[--u]:--u,r=o?(o=L,n[a]):t(r,n[a],a,f)}),r}function B(n,t,r){var u;
+if(t=a(t,r),Bt(n)){r=-1;for(var o=n.length;++rr?dt(0,u+r):r||0)-1;else if(r)return e=P(n,t),n[e]===t?e:-1;for(;++e>>1,r(n[e])z(f,c))&&(r&&f.push(c),i.push(e))}return i}function V(n,t){return Ft||ht&&2"']/g,at=/['\n\r\t\u2028\u2029\\]/g,ft=Math.ceil,ct=Z.concat,lt=Math.floor,pt=Y.hasOwnProperty,st=Z.push,vt=Y.toString,ht=ut.test(ht=p.bind)&&ht,gt=ut.test(gt=Array.isArray)&>,yt=n.isFinite,mt=n.isNaN,_t=ut.test(_t=Object.keys)&&_t,dt=Math.max,bt=Math.min,jt=Math.random,wt="[object Arguments]",At="[object Array]",xt="[object Boolean]",Et="[object Date]",Ot="[object Number]",St="[object Object]",Nt="[object RegExp]",kt="[object String]",Y=!!n.attachEvent,Y=ht&&!/\n|true/.test(ht+Y),Ft=ht&&!Y,Rt=(Rt={0:1,length:1},Z.splice.call(Rt,0,1),Rt[0]),Tt=arguments.constructor==Object,qt={"boolean":L,"function":J,object:J,number:L,string:L,undefined:L},It={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"};
+u.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},v(arguments)||(v=function(n){return n?pt.call(n,"callee"):L});var Bt=gt||function(n){return Tt&&n instanceof Array||vt.call(n)==At},Dt=_t?function(n){return w(n)?_t(n):[]}:h,Mt={"&":"&","<":"<",">":">",'"':""","'":"'"},$t=_(Mt);j(/x/)&&(j=function(n){return n instanceof Function||"[object Function]"==vt.call(n)});var zt=R;Y&&X&&typeof setImmediate=="function"&&(W=V(setImmediate,n)),u.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0
+}},u.bind=V,u.bindAll=function(n){for(var t=ct.apply(Z,arguments),r=1z(e,o,r)&&u.push(o)}return u},u.filter=N,u.flatten=$,u.forEach=F,u.functions=m,u.groupBy=function(n,t,r){var e={};return t=a(t,r),F(n,function(n,r,u){r=t(n,r,u)+"",(pt.call(e,r)?e[r]:e[r]=[]).push(n)
+}),e},u.initial=function(n,t,r){if(!n)return[];var e=0,u=n.length;if(typeof t!="number"&&t!=K){var o=u;for(t=a(t,r);o--&&t(n[o],o,n);)e++}else e=t==K||r?1:t||e;return p(n,0,bt(dt(0,u-e),u))},u.intersection=function(n){var t=arguments,r=t.length,e=-1,u=n?n.length:0,o=[];n:for(;++ez(o,i)){for(var a=r;--a;)if(0>z(t[a],i))continue n;o.push(i)}}return o},u.invert=_,u.invoke=function(n,t){var r=p(arguments,2),e=-1,u=typeof t=="function",o=n?n.length:0,i=Array(typeof o=="number"?o:0);
+return F(n,function(n){i[++e]=(u?t:n[t]).apply(n,r)}),i},u.keys=Dt,u.map=R,u.max=T,u.memoize=function(n,t){var r={};return function(){var e=(t?t.apply(this,arguments):arguments[0])+"";return pt.call(r,e)?r[e]:r[e]=n.apply(this,arguments)}},u.min=function(n,t,r){var u=1/0,o=u;if(!t&&Bt(n)){r=-1;for(var i=n.length;++rz(t,r,1)&&(e[r]=n)}),e},u.once=function(n){var t,r;return function(){return t?r:(t=J,r=n.apply(this,arguments),n=K,r)}},u.pairs=function(n){for(var t=-1,r=Dt(n),e=r.length,u=Array(e);++tz(arguments,u,1)&&e.push(u)}return e},u.wrap=function(n,t){return function(){var r=[n];return st.apply(r,arguments),t.apply(this,r)}},u.zip=function(n){for(var t=-1,r=n?T(zt(arguments,"length")):0,e=Array(r);++tr?dt(0,e+r):bt(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},u.mixin=H,u.noConflict=function(){return n._=rt,this},u.random=function(n,t){return n==K&&t==K&&(t=1),n=+n||0,t==K&&(t=n,n=0),n+lt(jt()*((+t||0)-n+1))},u.reduce=q,u.reduceRight=I,u.result=function(n,t){var r=n?n[t]:K;return j(r)?n[t]():r},u.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Dt(n).length
+},u.some=B,u.sortedIndex=P,u.template=function(n,t,r){n||(n=""),r=y({},r,u.templateSettings);var e=0,o="__p+='",i=r.variable;n.replace(RegExp((r.escape||ot).source+"|"+(r.interpolate||ot).source+"|"+(r.evaluate||ot).source+"|$","g"),function(t,r,u,i,a){return o+=n.slice(e,a).replace(at,f),r&&(o+="'+_['escape']("+r+")+'"),i&&(o+="';"+i+";__p+='"),u&&(o+="'+((__t=("+u+"))==null?'':__t)+'"),e=a+t.length,t}),o+="';\n",i||(i="obj",o="with("+i+"||{}){"+o+"}"),o="function("+i+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+o+"return __p}";
+try{var a=Function("_","return "+o)(u)}catch(c){throw c.source=o,c}return t?a(t):(a.source=o,a)},u.unescape=function(n){return n==K?"":(n+"").replace(et,s)},u.uniqueId=function(n){var t=++nt+"";return n?n+t:t},u.all=S,u.any=B,u.detect=k,u.foldl=q,u.foldr=I,u.include=O,u.inject=q,u.first=M,u.last=function(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&t!=K){var o=u;for(t=a(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,e==K||r)return n[u-1];return p(n,dt(0,u-e))}},u.take=M,u.head=M,u.chain=function(n){return n=new u(n),n.__chain__=J,n
+},u.VERSION="1.0.1",H(u),u.prototype.chain=function(){return this.__chain__=J,this},u.prototype.value=function(){return this.__wrapped__},e("pop push reverse shift sort splice unshift".split(" "),function(n){var t=Z[n];u.prototype[n]=function(){var n=this.__wrapped__;return t.apply(n,arguments),Rt&&0===n.length&&delete n[0],this}}),e(["concat","join","slice"],function(n){var t=Z[n];u.prototype[n]=function(){var n=t.apply(this.__wrapped__,arguments);return this.__chain__&&(n=new u(n),n.__chain__=J),n
+}}),Q?X?(X.exports=u)._=u:Q._=u:n._=u})(this);
\ No newline at end of file
diff --git a/doc/README.md b/doc/README.md
index a61bb0c1b5..8e22b33a07 100644
--- a/doc/README.md
+++ b/doc/README.md
@@ -1,4 +1,4 @@
-# Lo-Dash v1.0.0
+# Lo-Dash v1.0.1
@@ -197,7 +197,7 @@
### `_.compact(array)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3156 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3166 "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.
@@ -221,7 +221,7 @@ _.compact([0, 1, false, 2, '', 3]);
### `_.difference(array [, array1, array2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3186 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3196 "View in source") [Ⓣ][1]
Creates an array of `array` elements not present in the other arrays using strict equality for comparisons, i.e. `===`.
@@ -246,7 +246,7 @@ _.difference([1, 2, 3, 4, 5], [5, 2, 10]);
### `_.first(array [, callback|n, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3258 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3268 "View in source") [Ⓣ][1]
Gets the first element of the `array`. If a number `n` is passed, the first `n` elements of the `array` are returned. If a `callback` function is passed, the first elements the `callback` returns truthy for are returned. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*.
@@ -306,7 +306,7 @@ _.first(food, { 'type': 'fruit' });
### `_.flatten(array, shallow)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3297 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3307 "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.
@@ -334,7 +334,7 @@ _.flatten([1, [2], [3, [[4]]]], true);
### `_.indexOf(array, value [, fromIndex=0])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3339 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3349 "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.
@@ -366,7 +366,7 @@ _.indexOf([1, 1, 2, 2, 3, 3], 2, true);
### `_.initial(array [, callback|n=1, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3413 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3423 "View in source") [Ⓣ][1]
Gets all but the last element of `array`. If a number `n` is passed, the last `n` elements are excluded from the result. If a `callback` function is passed, the last elements the `callback` returns truthy for are excluded from the result. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*.
@@ -423,7 +423,7 @@ _.initial(food, { 'type': 'vegetable' });
### `_.intersection([array1, array2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3447 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3457 "View in source") [Ⓣ][1]
Computes the intersection of all the passed-in arrays using strict equality for comparisons, i.e. `===`.
@@ -447,7 +447,7 @@ _.intersection([1, 2, 3], [101, 2, 1, 10], [2, 1]);
### `_.last(array [, callback|n, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3538 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3548 "View in source") [Ⓣ][1]
Gets the last element of the `array`. If a number `n` is passed, the last `n` elements of the `array` are returned. If a `callback` function is passed, the last elements the `callback` returns truthy for are returned. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*.
@@ -504,7 +504,7 @@ _.last(food, { 'type': 'vegetable' });
### `_.lastIndexOf(array, value [, fromIndex=array.length-1])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3579 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3589 "View in source") [Ⓣ][1]
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.
@@ -533,7 +533,7 @@ _.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3);
### `_.object(keys [, values=[]])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3609 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3619 "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`.
@@ -558,7 +558,7 @@ _.object(['moe', 'larry'], [30, 40]);
### `_.range([start=0], end [, step=1])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3653 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3663 "View in source") [Ⓣ][1]
Creates an array of numbers *(positive and/or negative)* progressing from `start` up to but not including `end`.
@@ -596,7 +596,7 @@ _.range(0);
### `_.rest(array [, callback|n=1, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3731 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3741 "View in source") [Ⓣ][1]
The opposite of `_.initial`, this method gets all but the first value of `array`. If a number `n` is passed, the first `n` values are excluded from the result. If a `callback` function is passed, the first elements the `callback` returns truthy for are excluded from the result. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*.
@@ -656,7 +656,7 @@ _.rest(food, { 'type': 'fruit' });
### `_.sortedIndex(array, value [, callback=identity, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3795 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3805 "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)*.
@@ -705,7 +705,7 @@ _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) {
### `_.union([array1, array2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3827 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3837 "View in source") [Ⓣ][1]
Computes the union of the passed-in arrays using strict equality for comparisons, i.e. `===`.
@@ -729,7 +729,7 @@ _.union([1, 2, 3], [101, 2, 1, 10], [2, 1]);
### `_.uniq(array [, isSorted=false, callback=identity, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3874 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3884 "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)*.
@@ -776,7 +776,7 @@ _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
### `_.without(array [, value1, value2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3933 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3943 "View in source") [Ⓣ][1]
Creates an array with all occurrences of the passed values removed using strict equality for comparisons, i.e. `===`.
@@ -801,7 +801,7 @@ _.without([1, 2, 1, 0, 3, 1, 4], 0, 1);
### `_.zip([array1, array2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3964 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3974 "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.
@@ -832,7 +832,7 @@ _.zip(['moe', 'larry'], [30, 40], [true, false]);
### `_(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L269 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L272 "View in source") [Ⓣ][1]
Creates a `lodash` object, that wraps the given `value`, to enable method chaining.
@@ -861,7 +861,7 @@ The wrapper functions `first` and `last` return wrapped values when `n` is passe
### `_.tap(value, interceptor)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4860 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4874 "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.
@@ -891,7 +891,7 @@ _([1, 2, 3, 4])
### `_.prototype.toString()`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4877 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4891 "View in source") [Ⓣ][1]
Produces the `toString` result of the wrapped value.
@@ -912,7 +912,7 @@ _([1, 2, 3]).toString();
### `_.prototype.valueOf()`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4894 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4908 "View in source") [Ⓣ][1]
Extracts the wrapped value.
@@ -943,13 +943,13 @@ _([1, 2, 3]).valueOf();
### `_.at(collection [, index1, index2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2157 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2167 "View in source") [Ⓣ][1]
-Creates an array of elements from the specified index(es), or keys, of the `collection`. Indexes may be specified as individual arguments or as arrays of indexes.
+Creates an array of elements from the specified indexes, or keys, of the `collection`. Indexes may be specified as individual arguments or as arrays of indexes.
#### Arguments
1. `collection` *(Array|Object|String)*: The collection to iterate over.
-2. `[index1, index2, ...]` *(Array|Number|String)*: The index(es) of `collection` to retrieve, either as individual arguments or arrays.
+2. `[index1, index2, ...]` *(Array|Number|String)*: The indexes of `collection` to retrieve, either as individual arguments or arrays.
#### Returns
*(Array)*: Returns a new array of elements corresponding to the provided indexes.
@@ -971,7 +971,7 @@ _.at(['moe', 'larry', 'curly'], 0, 2);
### `_.contains(collection, target [, fromIndex=0])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2199 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2209 "View in source") [Ⓣ][1]
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.
@@ -1009,7 +1009,7 @@ _.contains('curly', 'ur');
### `_.countBy(collection [, callback=identity, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2253 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2263 "View in source") [Ⓣ][1]
Creates an object composed of keys returned from running each element of the `collection` through the given `callback`. The corresponding value of each key is the number of times the key was returned by the `callback`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*.
@@ -1045,7 +1045,7 @@ _.countBy(['one', 'two', 'three'], 'length');
### `_.every(collection [, callback=identity, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2305 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2315 "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)*.
@@ -1091,7 +1091,7 @@ _.every(stooges, { 'age': 50 });
### `_.filter(collection [, callback=identity, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2366 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2376 "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)*.
@@ -1137,7 +1137,7 @@ _.filter(food, { 'type': 'fruit' });
### `_.find(collection [, callback=identity, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2433 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2443 "View in source") [Ⓣ][1]
Examines each element in a `collection`, returning the first that the `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*.
@@ -1185,7 +1185,7 @@ var healthy = _.find(food, 'organic');
### `_.forEach(collection [, callback=identity, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2468 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2478 "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`.
@@ -1217,7 +1217,7 @@ _.forEach({ 'one': 1, 'two': 2, 'three': 3 }, alert);
### `_.groupBy(collection [, callback=identity, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2518 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2528 "View in source") [Ⓣ][1]
Creates an object composed of keys returned from running each element of the `collection` through the `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)*.
@@ -1254,7 +1254,7 @@ _.groupBy(['one', 'two', 'three'], 'length');
### `_.invoke(collection, methodName [, arg1, arg2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2551 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2561 "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`.
@@ -1283,7 +1283,7 @@ _.invoke([123, 456], String.prototype.split, '');
### `_.map(collection [, callback=identity, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2603 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2613 "View in source") [Ⓣ][1]
Creates an array of values by running each element in the `collection` through the `callback`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*.
@@ -1328,7 +1328,7 @@ _.map(stooges, 'name');
### `_.max(collection [, callback=identity, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2660 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2670 "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)*.
@@ -1370,7 +1370,7 @@ _.max(stooges, 'age');
### `_.min(collection [, callback=identity, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2729 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2739 "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)*.
@@ -1412,7 +1412,7 @@ _.min(stooges, 'age');
### `_.pluck(collection, property)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2779 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2789 "View in source") [Ⓣ][1]
Retrieves the value of a specified property from all elements in the `collection`.
@@ -1442,7 +1442,7 @@ _.pluck(stooges, 'name');
### `_.reduce(collection [, callback=identity, accumulator, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2811 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2821 "View in source") [Ⓣ][1]
Reduces a `collection` to a value that is the accumulated result of running each element in the `collection` through the `callback`, where each successive `callback` execution consumes the return value of the previous execution. If `accumulator` is not passed, the first element of the `collection` will be used as the initial `accumulator` value. The `callback` is bound to `thisArg` and invoked with four arguments; *(accumulator, value, index|key, collection)*.
@@ -1480,7 +1480,7 @@ var mapped = _.reduce({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) {
### `_.reduceRight(collection [, callback=identity, accumulator, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2854 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2864 "View in source") [Ⓣ][1]
This method is similar to `_.reduce`, except that it iterates over a `collection` from right to left.
@@ -1511,7 +1511,7 @@ var flat = _.reduceRight(list, function(a, b) { return a.concat(b); }, []);
### `_.reject(collection [, callback=identity, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2914 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2924 "View in source") [Ⓣ][1]
The opposite of `_.filter`, this method returns the elements of a `collection` that `callback` does **not** return truthy for.
@@ -1554,7 +1554,7 @@ _.reject(food, { 'type': 'fruit' });
### `_.shuffle(collection)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2935 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2945 "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.
@@ -1578,7 +1578,7 @@ _.shuffle([1, 2, 3, 4, 5, 6]);
### `_.size(collection)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2968 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2978 "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.
@@ -1608,7 +1608,7 @@ _.size('curly');
### `_.some(collection [, callback=identity, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3015 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3025 "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)*.
@@ -1654,7 +1654,7 @@ _.some(food, { 'type': 'meat' });
### `_.sortBy(collection [, callback=identity, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3071 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3081 "View in source") [Ⓣ][1]
Creates an array of elements, sorted in ascending order by the results of running each element in the `collection` through the `callback`. This method performs a stable sort, that is, it will preserve the original sort order of equal elements. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*.
@@ -1691,7 +1691,7 @@ _.sortBy(['banana', 'strawberry', 'apple'], 'length');
### `_.toArray(collection)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3106 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3116 "View in source") [Ⓣ][1]
Converts the `collection` to an array.
@@ -1715,7 +1715,7 @@ Converts the `collection` to an array.
### `_.where(collection, properties)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3138 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3148 "View in source") [Ⓣ][1]
Examines each element in a `collection`, returning an array of all elements that have the given `properties`. When checking `properties`, this method performs a deep comparison between values to determine if they are equivalent to each other.
@@ -1752,7 +1752,7 @@ _.where(stooges, { 'age': 40 });
### `_.after(n, func)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3997 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4007 "View in source") [Ⓣ][1]
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.
@@ -1780,7 +1780,7 @@ _.forEach(notes, function(note) {
### `_.bind(func [, thisArg, arg1, arg2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4030 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4040 "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.
@@ -1811,7 +1811,7 @@ func();
### `_.bindAll(object [, methodName1, methodName2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4061 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4071 "View in source") [Ⓣ][1]
Binds methods on `object` to `object`, overwriting the existing method. Method names may be specified as individual arguments or as arrays of method names. If no method names are provided, all the function properties of `object` will be bound.
@@ -1842,7 +1842,7 @@ jQuery('#docs').on('click', view.onClick);
### `_.bindKey(object, key [, arg1, arg2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4107 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4117 "View in source") [Ⓣ][1]
Creates a function that, when called, invokes the method at `object[key]` and prepends any additional `bindKey` 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. See http://michaux.ca/articles/lazy-function-definition-pattern.
@@ -1883,7 +1883,7 @@ func();
### `_.compose([func1, func2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4130 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4140 "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. For example, composing the functions `f()`, `g()`, and `h()` produces `f(g(h()))`. Each function is executed with the `this` binding of the composed function.
@@ -1910,7 +1910,7 @@ welcome('moe');
### `_.debounce(func, wait, immediate)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4163 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4173 "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.
@@ -1936,7 +1936,7 @@ jQuery(window).on('resize', lazyLayout);
### `_.defer(func [, arg1, arg2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4227 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4237 "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.
@@ -1961,7 +1961,7 @@ _.defer(function() { alert('deferred'); });
### `_.delay(func, wait [, arg1, arg2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4207 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4217 "View in source") [Ⓣ][1]
Executes the `func` function after `wait` milliseconds. Additional arguments will be passed to `func` when it is invoked.
@@ -1988,7 +1988,7 @@ _.delay(log, 1000, 'logged later');
### `_.memoize(func [, resolver])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4251 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4265 "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. The `func` is executed with the `this` binding of the memoized function.
@@ -2014,7 +2014,7 @@ var fibonacci = _.memoize(function(n) {
### `_.once(func)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4278 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4292 "View in source") [Ⓣ][1]
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.
@@ -2040,7 +2040,7 @@ initialize();
### `_.partial(func [, arg1, arg2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4313 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4327 "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.
@@ -2067,7 +2067,7 @@ hi('moe');
### `_.partialRight(func [, arg1, arg2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4344 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4358 "View in source") [Ⓣ][1]
This method is similar to `_.partial`, except that `partial` arguments are appended to those passed to the new function.
@@ -2104,7 +2104,7 @@ options.imports
### `_.throttle(func, wait)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4366 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4380 "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.
@@ -2129,7 +2129,7 @@ jQuery(window).on('scroll', throttled);
### `_.wrap(value, wrapper)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4419 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4433 "View in source") [Ⓣ][1]
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.
@@ -2165,7 +2165,7 @@ hello();
### `_.assign(object [, source1, source2, ..., callback, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1059 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1062 "View in source") [Ⓣ][1]
Assigns own enumerable properties of source object(s) to the destination object. Subsequent sources will overwrite propery assignments of previous sources. If a `callback` function is passed, it will be executed to produce the assigned values. The `callback` is bound to `thisArg` and invoked with two arguments; *(objectValue, sourceValue)*.
@@ -2203,7 +2203,7 @@ defaults(food, { 'name': 'banana', 'type': 'fruit' });
### `_.clone(value [, deep=false, callback, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1116 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1117 "View in source") [Ⓣ][1]
Creates a clone of `value`. If `deep` is `true`, nested objects will also be cloned, otherwise they will be assigned by reference. If a `callback` function is passed, it will be executed to produce the cloned values. If `callback` returns `undefined`, cloning will be handled by the method instead. The `callback` is bound to `thisArg` and invoked with one argument; *(value)*.
@@ -2250,7 +2250,7 @@ clone.childNodes.length;
### `_.cloneDeep(value [, callback, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1241 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1242 "View in source") [Ⓣ][1]
Creates a deep clone of `value`. If a `callback` function is passed, it will be executed to produce the cloned values. If `callback` returns the value it was passed, cloning will be handled by the method instead. The `callback` is bound to `thisArg` and invoked with one argument; *(value)*.
@@ -2296,7 +2296,7 @@ clone.node == view.node;
### `_.defaults(object [, source1, source2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1265 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1266 "View in source") [Ⓣ][1]
Assigns own enumerable properties of source object(s) to the destination object for all destination properties that resolve to `undefined`. Once a property is set, additional defaults of the same property will be ignored.
@@ -2322,7 +2322,7 @@ _.defaults(food, { 'name': 'banana', 'type': 'fruit' });
### `_.forIn(object [, callback=identity, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L879 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L882 "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`.
@@ -2358,7 +2358,7 @@ _.forIn(new Dog('Dagny'), function(value, key) {
### `_.forOwn(object [, callback=identity, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L904 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L907 "View in source") [Ⓣ][1]
Iterates over an 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`.
@@ -2386,7 +2386,7 @@ _.forOwn({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) {
### `_.functions(object)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1282 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1283 "View in source") [Ⓣ][1]
Creates a sorted array of all enumerable properties, own and inherited, of `object` that have function values.
@@ -2413,7 +2413,7 @@ _.functions(_);
### `_.has(object, property)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1307 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1308 "View in source") [Ⓣ][1]
Checks if the specified object `property` exists and is a direct property, instead of an inherited property.
@@ -2438,7 +2438,7 @@ _.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b');
### `_.invert(object)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1324 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1325 "View in source") [Ⓣ][1]
Creates an object composed of the inverted keys and values of the given `object`.
@@ -2462,7 +2462,7 @@ _.invert({ 'first': 'moe', 'second': 'larry' });
### `_.isArguments(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L840 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L843 "View in source") [Ⓣ][1]
Checks if `value` is an `arguments` object.
@@ -2489,7 +2489,7 @@ _.isArguments([1, 2, 3]);
### `_.isArray(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L922 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L925 "View in source") [Ⓣ][1]
Checks if `value` is an array.
@@ -2516,7 +2516,7 @@ _.isArray([1, 2, 3]);
### `_.isBoolean(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1350 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1351 "View in source") [Ⓣ][1]
Checks if `value` is a boolean value.
@@ -2540,7 +2540,7 @@ _.isBoolean(null);
### `_.isDate(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1367 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1368 "View in source") [Ⓣ][1]
Checks if `value` is a date.
@@ -2564,7 +2564,7 @@ _.isDate(new Date);
### `_.isElement(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1384 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1385 "View in source") [Ⓣ][1]
Checks if `value` is a DOM element.
@@ -2588,7 +2588,7 @@ _.isElement(document.body);
### `_.isEmpty(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1409 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1410 "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".
@@ -2618,7 +2618,7 @@ _.isEmpty('');
### `_.isEqual(a, b [, callback, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1468 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1469 "View in source") [Ⓣ][1]
Performs a deep comparison between two values to determine if they are equivalent to each other. If `callback` is passed, it will be executed to compare values. If `callback` returns `undefined`, comparisons will be handled by the method instead. The `callback` is bound to `thisArg` and invoked with two arguments; *(a, b)*.
@@ -2663,7 +2663,7 @@ _.isEqual(words, otherWords, function(a, b) {
### `_.isFinite(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1638 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1650 "View in source") [Ⓣ][1]
Checks if `value` is, or can be coerced to, a finite number.
@@ -2701,7 +2701,7 @@ _.isFinite(Infinity);
### `_.isFunction(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1655 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1667 "View in source") [Ⓣ][1]
Checks if `value` is a function.
@@ -2725,7 +2725,7 @@ _.isFunction(_);
### `_.isNaN(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1718 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1730 "View in source") [Ⓣ][1]
Checks if `value` is `NaN`.
@@ -2760,7 +2760,7 @@ _.isNaN(undefined);
### `_.isNull(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1740 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1752 "View in source") [Ⓣ][1]
Checks if `value` is `null`.
@@ -2787,7 +2787,7 @@ _.isNull(undefined);
### `_.isNumber(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1757 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1769 "View in source") [Ⓣ][1]
Checks if `value` is a number.
@@ -2811,7 +2811,7 @@ _.isNumber(8.4 * 5);
### `_.isObject(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1685 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1697 "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('')`)*
@@ -2841,7 +2841,7 @@ _.isObject(1);
### `_.isPlainObject(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1785 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1797 "View in source") [Ⓣ][1]
Checks if a given `value` is an object created by the `Object` constructor.
@@ -2876,7 +2876,7 @@ _.isPlainObject({ 'name': 'moe', 'age': 40 });
### `_.isRegExp(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1810 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1822 "View in source") [Ⓣ][1]
Checks if `value` is a regular expression.
@@ -2900,7 +2900,7 @@ _.isRegExp(/moe/);
### `_.isString(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1827 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1839 "View in source") [Ⓣ][1]
Checks if `value` is a string.
@@ -2924,7 +2924,7 @@ _.isString('moe');
### `_.isUndefined(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1844 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1856 "View in source") [Ⓣ][1]
Checks if `value` is `undefined`.
@@ -2948,7 +2948,7 @@ _.isUndefined(void 0);
### `_.keys(object)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L941 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L944 "View in source") [Ⓣ][1]
Creates an array composed of the own enumerable property names of `object`.
@@ -2972,7 +2972,7 @@ _.keys({ 'one': 1, 'two': 2, 'three': 3 });
### `_.merge(object [, source1, source2, ..., callback, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1904 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1916 "View in source") [Ⓣ][1]
Recursively merges own enumerable properties of the source object(s), that don't resolve to `undefined`, into the destination object. Subsequent sources will overwrite propery assignments of previous sources. If a `callback` function is passed, it will be executed to produce the merged values of the destination and source properties. If `callback` returns `undefined`, merging will be handled by the method instead. The `callback` is bound to `thisArg` and invoked with two arguments; *(objectValue, sourceValue)*.
@@ -3028,7 +3028,7 @@ _.merge(food, otherFood, function(a, b) {
### `_.omit(object, callback|[prop1, prop2, ..., thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2013 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2023 "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 a `callback` function 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)*.
@@ -3059,7 +3059,7 @@ _.omit({ 'name': 'moe', 'age': 40 }, function(value) {
### `_.pairs(object)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2047 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2057 "View in source") [Ⓣ][1]
Creates a two dimensional array of the given object's key-value pairs, i.e. `[[key1, value1], [key2, value2]]`.
@@ -3083,7 +3083,7 @@ _.pairs({ 'moe': 30, 'larry': 40 });
### `_.pick(object, callback|[prop1, prop2, ..., thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2085 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2095 "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)*.
@@ -3114,7 +3114,7 @@ _.pick({ 'name': 'moe', '_userid': 'moe1' }, function(value, key) {
### `_.values(object)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2122 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2132 "View in source") [Ⓣ][1]
Creates an array composed of the own enumerable property values of `object`.
@@ -3145,7 +3145,7 @@ _.values({ 'one': 1, 'two': 2, 'three': 3 });
### `_.escape(string)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4443 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4457 "View in source") [Ⓣ][1]
Converts the characters `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding HTML entities.
@@ -3169,7 +3169,7 @@ _.escape('Moe, Larry & Curly');
### `_.identity(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4461 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4475 "View in source") [Ⓣ][1]
This function returns the first argument passed to it.
@@ -3194,7 +3194,7 @@ moe === _.identity(moe);
### `_.mixin(object)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4487 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4501 "View in source") [Ⓣ][1]
Adds functions properties of `object` to the `lodash` function and chainable wrapper.
@@ -3224,7 +3224,7 @@ _('moe').capitalize();
### `_.noConflict()`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4511 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4525 "View in source") [Ⓣ][1]
Reverts the '_' variable to its previous value and returns a reference to the `lodash` function.
@@ -3244,7 +3244,7 @@ var lodash = _.noConflict();
### `_.random([min=0, max=1])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4534 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4548 "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.
@@ -3272,7 +3272,7 @@ _.random(5);
### `_.result(object, property)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4572 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4586 "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.
@@ -3307,7 +3307,7 @@ _.result(object, 'stuff');
### `_.template(text, data, options)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4660 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4674 "View in source") [Ⓣ][1]
A micro-templating method that handles arbitrary delimiters, preserves whitespace, and correctly escapes quotes within interpolated code.
@@ -3391,7 +3391,7 @@ fs.writeFileSync(path.join(cwd, 'jst.js'), '\
### `_.times(n, callback [, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4786 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4800 "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)*.
@@ -3423,7 +3423,7 @@ _.times(3, function(n) { this.cast(n); }, mage);
### `_.unescape(string)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4812 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4826 "View in source") [Ⓣ][1]
The opposite of `_.escape`, this method converts the HTML entities `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding characters.
@@ -3447,7 +3447,7 @@ _.unescape('Moe, Larry & Curly');
### `_.uniqueId([prefix])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4832 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4846 "View in source") [Ⓣ][1]
Generates a unique ID. If `prefix` is passed, the ID will be appended to it.
@@ -3481,7 +3481,7 @@ _.uniqueId();
### `_.templateSettings.imports._`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L338 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L341 "View in source") [Ⓣ][1]
A reference to the `lodash` function.
@@ -3500,7 +3500,7 @@ A reference to the `lodash` function.
### `_.VERSION`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5062 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5076 "View in source") [Ⓣ][1]
*(String)*: The semantic version number.
@@ -3512,7 +3512,7 @@ A reference to the `lodash` function.
### `_.templateSettings`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L290 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L293 "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.
@@ -3524,7 +3524,7 @@ A reference to the `lodash` function.
### `_.templateSettings.escape`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L298 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L301 "View in source") [Ⓣ][1]
*(RegExp)*: Used to detect `data` property values to be HTML-escaped.
@@ -3536,7 +3536,7 @@ A reference to the `lodash` function.
### `_.templateSettings.evaluate`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L306 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L309 "View in source") [Ⓣ][1]
*(RegExp)*: Used to detect code to be evaluated.
@@ -3548,7 +3548,7 @@ A reference to the `lodash` function.
### `_.templateSettings.interpolate`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L314 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L317 "View in source") [Ⓣ][1]
*(RegExp)*: Used to detect `data` property values to inject.
@@ -3560,7 +3560,7 @@ A reference to the `lodash` function.
### `_.templateSettings.variable`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L322 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L325 "View in source") [Ⓣ][1]
*(String)*: Used to reference the data object in the template text.
@@ -3572,7 +3572,7 @@ A reference to the `lodash` function.
### `_.templateSettings.imports`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L330 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L333 "View in source") [Ⓣ][1]
*(Object)*: Used to import variables into the compiled template.
diff --git a/doc/parse.php b/doc/parse.php
index 6cf7d397d7..978138945e 100644
--- a/doc/parse.php
+++ b/doc/parse.php
@@ -21,7 +21,7 @@
// generate Markdown
$markdown = docdown(array(
'path' => '../' . $file,
- 'title' => 'Lo-Dash v1.0.0',
+ 'title' => 'Lo-Dash v1.0.1',
'toc' => 'categories',
'url' => 'https://github.com/bestiejs/lodash/blob/master/lodash.js'
));
diff --git a/lodash.js b/lodash.js
index c7c0c4c543..6babfef378 100644
--- a/lodash.js
+++ b/lodash.js
@@ -1,6 +1,6 @@
/**
* @license
- * Lo-Dash 1.0.0
+ * Lo-Dash 1.0.1
* Copyright 2012-2013 The Dojo Foundation
* Based on Underscore.js 1.4.4
* Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud Inc.
@@ -11,6 +11,9 @@
/** Detect free variable `exports` */
var freeExports = typeof exports == 'object' && exports;
+ /** Detect free variable `module` */
+ var freeModule = typeof module == 'object' && module && module.exports == freeExports && module;
+
/** Detect free variable `global` and use it as `window` */
var freeGlobal = typeof global == 'object' && global;
if (freeGlobal.global === freeGlobal) {
@@ -55,7 +58,7 @@
* Used to match ES6 template delimiters
* http://people.mozilla.org/~jorendorff/es6-draft.html#sec-7.8.6
*/
- var reEsTemplate = /\$\{((?:(?=\\?)\\?[\s\S])*?)\}/g;
+ var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
/** Used to match "interpolate" template delimiters */
var reInterpolate = /<%=([\s\S]+?)%>/g;
@@ -182,7 +185,7 @@
var noCharByIndex = ('x'[0] + Object('x')[0]) != 'xx';
/**
- * Detect if a node's [[Class]] is unresolvable (IE < 9)
+ * Detect if a DOM node's [[Class]] is unresolvable (IE < 9)
* and that the JS engine won't error when attempting to coerce an object to
* a string without a `toString` function.
*/
@@ -1060,12 +1063,10 @@
'top':
defaultsIteratorOptions.top.replace(';',
';\n' +
- 'if (argsLength > 2) {\n' +
- " if (typeof args[argsLength - 2] == 'function') {\n" +
- ' var callback = createCallback(args[--argsLength - 1], args[argsLength--], 2);\n' +
- " } else if (typeof args[argsLength - 1] == 'function') {\n" +
- ' callback = args[--argsLength];\n' +
- ' }\n' +
+ "if (argsLength > 3 && typeof args[argsLength - 2] == 'function') {\n" +
+ ' var callback = createCallback(args[--argsLength - 1], args[argsLength--], 2);\n' +
+ "} else if (argsLength > 2 && typeof args[argsLength - 1] == 'function') {\n" +
+ ' callback = args[--argsLength];\n' +
'}'
),
'loop': 'result[index] = callback ? callback(result[index], iterable[index]) : iterable[index]'
@@ -1570,16 +1571,27 @@
// recursively compare objects and arrays (susceptible to call stack limits)
if (isArr) {
- // compare lengths to determine if a deep comparison is necessary
+ length = a.length;
size = b.length;
- result = whereIndicator || size == a.length;
- if (result) {
- // deep compare the contents, ignoring non-numeric properties
- while (size--) {
- if (!(result = isEqual(a[size], b[size], callback, thisArg, stackA, stackB))) {
- break;
+ // compare lengths to determine if a deep comparison is necessary
+ result = size == a.length;
+ if (!result && !whereIndicator) {
+ return result;
+ }
+ // deep compare the contents, ignoring non-numeric properties
+ while (size--) {
+ var index = length,
+ value = b[size];
+
+ if (whereIndicator) {
+ while (index--) {
+ if ((result = isEqual(a[index], value, callback, thisArg, stackA, stackB))) {
+ break;
+ }
}
+ } else if (!(result = isEqual(a[size], value, callback, thisArg, stackA, stackB))) {
+ break;
}
}
return result;
@@ -1922,12 +1934,10 @@
if (typeof deepIndicator != 'number') {
length = args.length;
}
- if (length > 2) {
- if (typeof args[length - 2] == 'function') {
- callback = createCallback(args[--length - 1], args[length--], 2);
- } else if (typeof args[length - 1] == 'function') {
- callback = args[--length];
- }
+ if (length > 3 && typeof args[length - 2] == 'function') {
+ callback = createCallback(args[--length - 1], args[length--], 2);
+ } else if (length > 2 && typeof args[length - 1] == 'function') {
+ callback = args[--length];
}
}
while (++index < length) {
@@ -2134,7 +2144,7 @@
/*--------------------------------------------------------------------------*/
/**
- * Creates an array of elements from the specified index(es), or keys, of the
+ * Creates an array of elements from the specified indexes, or keys, of the
* `collection`. Indexes may be specified as individual arguments or as arrays
* of indexes.
*
@@ -2142,7 +2152,7 @@
* @memberOf _
* @category Collections
* @param {Array|Object|String} collection The collection to iterate over.
- * @param {Array|Number|String} [index1, index2, ...] The index(es) of
+ * @param {Array|Number|String} [index1, index2, ...] The indexes of
* `collection` to retrieve, either as individual arguments or arrays.
* @returns {Array} Returns a new array of elements corresponding to the
* provided indexes.
@@ -4228,6 +4238,10 @@
var args = slice(arguments, 1);
return setTimeout(function() { func.apply(undefined, args); }, 1);
}
+ // use `setImmediate` if it's available in Node.js
+ if (isV8 && freeModule && typeof setImmediate == 'function') {
+ defer = bind(setImmediate, window);
+ }
/**
* Creates a function that memoizes the result of `func`. If `resolver` is
@@ -4733,7 +4747,7 @@
(isEvaluating
? ', __j = Array.prototype.join;\n' +
"function print() { __p += __j.call(arguments, '') }\n"
- : (hasVariable ? '' : ', __d = ' + variable + '.' + variable + ' || ' + variable) + ';\n'
+ : ';\n'
) +
source +
'return __p\n}';
@@ -5059,7 +5073,7 @@
* @memberOf _
* @type String
*/
- lodash.VERSION = '1.0.0';
+ lodash.VERSION = '1.0.1';
// add "Chaining" functions to the wrapper
lodash.prototype.toString = wrapperToString;
@@ -5134,8 +5148,8 @@
// check for `exports` after `define` in case a build optimizer adds an `exports` object
else if (freeExports) {
// in Node.js or RingoJS v0.8.0+
- if (typeof module == 'object' && module && module.exports == freeExports) {
- (module.exports = lodash)._ = lodash;
+ if (freeModule) {
+ (freeModule.exports = lodash)._ = lodash;
}
// in Narwhal or RingoJS v0.7.0-
else {
diff --git a/package.json b/package.json
index ffdb2a26ea..a55a0c0713 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "lodash",
- "version": "1.0.0",
+ "version": "1.0.1",
"description": "An alternative to Underscore.js, delivering consistency, customization, performance, and extra features.",
"homepage": "http://lodash.com",
"main": "./dist/lodash",
diff --git a/test/test-build.js b/test/test-build.js
index 62f4d3ebd1..759d98ebc1 100644
--- a/test/test-build.js
+++ b/test/test-build.js
@@ -537,7 +537,7 @@
commands.forEach(function(command) {
var expectedId = /underscore/.test(command) ? 'underscore' : 'lodash';
- asyncTest('`lodash template=*.jst` exports=amd' + (command ? ' ' + command : ''), function() {
+ asyncTest('`lodash template=*.jst exports=amd' + (command ? ' ' + command : '') + '`', function() {
var start = _.after(2, _.once(QUnit.start));
build(['-s', 'template=' + templatePath + '/*.jst', 'exports=amd'].concat(command || []), function(data) {
@@ -562,7 +562,7 @@
});
});
- asyncTest('`lodash settings=...`' + (command ? ' ' + command : ''), function() {
+ asyncTest('`lodash settings=...' + (command ? ' ' + command : '') + '`', function() {
var start = _.after(2, _.once(QUnit.start));
build(['-s', 'template=' + templatePath + '/*.tpl', 'settings={interpolate:/{{([\\s\\S]+?)}}/}'].concat(command || []), function(data) {
@@ -640,6 +640,51 @@
/*--------------------------------------------------------------------------*/
+ QUnit.module('source maps');
+
+ (function() {
+ var mapCommands = [
+ '-p',
+ '-p custom.map',
+ '--source-map',
+ '--source-map custom.map'
+ ];
+
+ var outputCommands = [
+ '',
+ '-o foo.js',
+ '-m -o bar.js'
+ ];
+
+ mapCommands.forEach(function(mapCommand) {
+ outputCommands.forEach(function(outputCommand) {
+ asyncTest('`lodash ' + mapCommand + (outputCommand ? ' ' + outputCommand : '') + '`', function() {
+ var callback = _.once(function(data) {
+ var basename = path.basename(data.outputPath, '.js'),
+ comment = (/(\s*\/\/.*\s*|\s*\/\*[^*]*\*+(?:[^\/][^*]*\*+)*\/\s*)$/.exec(data.source) || [])[0],
+ sources = /foo.js/.test(outputCommand) ? ['foo.js'] : ['lodash' + (outputCommand.length ? '' : '.custom') + '.js'],
+ sourceMap = JSON.parse(data.sourceMap),
+ sourceMapURL = (/\w+(?=\.map$)/.exec(mapCommand) || [basename])[0];
+
+ ok(RegExp('/\\*\\n//@ sourceMappingURL=' + sourceMapURL + '.map\\n\\*/').test(comment), basename);
+ equal(sourceMap.file, basename + '.js', basename);
+ deepEqual(sourceMap.sources, sources, basename);
+
+ QUnit.start();
+ });
+
+ outputCommand = outputCommand ? outputCommand.split(' ') : [];
+ if (outputCommand.indexOf('-m') < 0) {
+ callback = _.after(2, callback);
+ }
+ build(['-s'].concat(mapCommand.split(' '), outputCommand), callback);
+ });
+ });
+ });
+ }());
+
+ /*--------------------------------------------------------------------------*/
+
QUnit.module('strict modifier');
(function() {
@@ -648,7 +693,12 @@
'b': undefined
});
- ['non-strict', 'strict'].forEach(function(strictMode, index) {
+ var modes = [
+ 'non-strict',
+ 'strict'
+ ];
+
+ modes.forEach(function(strictMode, index) {
asyncTest(strictMode + ' should ' + (index ? 'error': 'silently fail') + ' attempting to overwrite read-only properties', function() {
var commands = ['-s', 'include=bindAll,defaults,extend'],
start = _.after(2, _.once(QUnit.start));
@@ -1150,6 +1200,8 @@
'include=once plus=bind,Chaining',
'category=collections,functions',
'backbone legacy category=utilities minus=first,last',
+ 'legacy include=defer',
+ 'legacy underscore',
'underscore include=debounce,throttle plus=after minus=throttle',
'underscore mobile strict category=functions exports=amd,global plus=pick,uniq',
]
@@ -1164,19 +1216,19 @@
var command = origCommand;
if (index == 1) {
- if (/mobile/.test(command)) {
+ if (/legacy|mobile/.test(command)) {
return;
}
command = 'mobile ' + command;
}
if (index == 2) {
- if (/modern/.test(command)) {
+ if (/legacy|modern/.test(command)) {
return;
}
command = 'modern ' + command;
}
if (index == 3) {
- if (/category|underscore/.test(command)) {
+ if (/category|legacy|underscore/.test(command)) {
return;
}
command = 'underscore ' + command;
diff --git a/test/test.js b/test/test.js
index 9a8164deb1..632af43abf 100644
--- a/test/test.js
+++ b/test/test.js
@@ -545,6 +545,19 @@
/*--------------------------------------------------------------------------*/
+ QUnit.module('lodash.defer');
+
+ (function() {
+ asyncTest('should accept additional arguments', function() {
+ _.defer(function() {
+ deepEqual(slice.call(arguments), [1, 2, 3]);
+ QUnit.start();
+ }, 1, 2, 3);
+ });
+ }());
+
+ /*--------------------------------------------------------------------------*/
+
QUnit.module('lodash.difference');
(function() {
@@ -952,12 +965,15 @@
deepEqual(actual, { 'a': 2 });
});
- test('lodash.' + methodName + ' should not treat a function as a `callback` if less than two arguments are passed', function() {
+ test('lodash.' + methodName + ' should not treat the second argument as a `callback`', function() {
function callback() {}
callback.b = 2;
var actual = func({ 'a': 1 }, callback);
deepEqual(actual, { 'a': 1, 'b': 2 });
+
+ actual = func({ 'a': 1 }, callback, { 'c': 3 });
+ deepEqual(actual, { 'a': 1, 'b': 2, 'c': 3 });
});
});
@@ -1259,6 +1275,16 @@
var actual = _.isEqual('a', 'a', function() { });
strictEqual(actual, true);
});
+
+ test('should return a boolean value even if `callback` does not', function() {
+ var actual = _.isEqual('a', 'a', function() { return 'a'; });
+ strictEqual(actual, true);
+
+ _.each(falsey, function(value) {
+ var actual = _.isEqual('a', 'b', function() { return value; });
+ strictEqual(actual, false);
+ });
+ });
}());
/*--------------------------------------------------------------------------*/
@@ -2604,6 +2630,14 @@
deepEqual(_.where(collection, { 'a': { 'b': { 'c': 1 } } }), expected);
});
+
+ test('should search of arrays for values', function() {
+ var collection = [{ 'a': [1, 2] }],
+ expected = _.cloneDeep(collection);
+
+ deepEqual(_.where(collection, { 'a': [] }), []);
+ deepEqual(_.where(collection, { 'a': [2] }), expected);
+ });
}());
/*--------------------------------------------------------------------------*/
diff --git a/vendor/backbone/LICENSE b/vendor/backbone/LICENSE
index dda0a5809d..f79bb00587 100644
--- a/vendor/backbone/LICENSE
+++ b/vendor/backbone/LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2010-2013 Jeremy Ashkenas, DocumentCloud
+Copyright (c) 2010-2012 Jeremy Ashkenas, DocumentCloud
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
@@ -19,4 +19,4 @@ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
+OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
diff --git a/vendor/backbone/backbone.js b/vendor/backbone/backbone.js
index 0a1669d11f..9682be585c 100644
--- a/vendor/backbone/backbone.js
+++ b/vendor/backbone/backbone.js
@@ -1,6 +1,6 @@
// Backbone.js 0.9.10
-// (c) 2010-2013 Jeremy Ashkenas, DocumentCloud Inc.
+// (c) 2010-2012 Jeremy Ashkenas, DocumentCloud Inc.
// Backbone may be freely distributed under the MIT license.
// For all details and documentation:
// http://backbonejs.org
@@ -89,15 +89,15 @@
// Optimized internal dispatch function for triggering events. Tries to
// keep the usual cases speedy (most Backbone events have 3 arguments).
var triggerEvents = function(events, args) {
- var ev, i = -1, l = events.length, a1 = args[0], a2 = args[1], a3 = args[2];
+ var ev, i = -1, l = events.length;
switch (args.length) {
case 0: while (++i < l) (ev = events[i]).callback.call(ev.ctx);
return;
- case 1: while (++i < l) (ev = events[i]).callback.call(ev.ctx, a1);
+ case 1: while (++i < l) (ev = events[i]).callback.call(ev.ctx, args[0]);
return;
- case 2: while (++i < l) (ev = events[i]).callback.call(ev.ctx, a1, a2);
+ case 2: while (++i < l) (ev = events[i]).callback.call(ev.ctx, args[0], args[1]);
return;
- case 3: while (++i < l) (ev = events[i]).callback.call(ev.ctx, a1, a2, a3);
+ case 3: while (++i < l) (ev = events[i]).callback.call(ev.ctx, args[0], args[1], args[2]);
return;
default: while (++i < l) (ev = events[i]).callback.apply(ev.ctx, args);
}
@@ -119,24 +119,25 @@
// to a `callback` function. Passing `"all"` will bind the callback to
// all events fired.
on: function(name, callback, context) {
- if (!eventsApi(this, 'on', name, [callback, context]) || !callback) return this;
+ if (!(eventsApi(this, 'on', name, [callback, context]) && callback)) return this;
this._events || (this._events = {});
- var events = this._events[name] || (this._events[name] = []);
- events.push({callback: callback, context: context, ctx: context || this});
+ var list = this._events[name] || (this._events[name] = []);
+ list.push({callback: callback, context: context, ctx: context || this});
return this;
},
// Bind events to only be triggered a single time. After the first time
// the callback is invoked, it will be removed.
once: function(name, callback, context) {
- if (!eventsApi(this, 'once', name, [callback, context]) || !callback) return this;
+ if (!(eventsApi(this, 'once', name, [callback, context]) && callback)) return this;
var self = this;
var once = _.once(function() {
self.off(name, once);
callback.apply(this, arguments);
});
once._callback = callback;
- return this.on(name, once, context);
+ this.on(name, once, context);
+ return this;
},
// Remove one or many callbacks. If `context` is null, removes all
@@ -144,7 +145,7 @@
// callbacks for the event. If `name` is null, removes all bound
// callbacks for all events.
off: function(name, callback, context) {
- var retain, ev, events, names, i, l, j, k;
+ var list, ev, events, names, i, l, j, k;
if (!this._events || !eventsApi(this, 'off', name, [callback, context])) return this;
if (!name && !callback && !context) {
this._events = {};
@@ -154,19 +155,19 @@
names = name ? [name] : _.keys(this._events);
for (i = 0, l = names.length; i < l; i++) {
name = names[i];
- if (events = this._events[name]) {
- this._events[name] = retain = [];
+ if (list = this._events[name]) {
+ events = [];
if (callback || context) {
- for (j = 0, k = events.length; j < k; j++) {
- ev = events[j];
+ for (j = 0, k = list.length; j < k; j++) {
+ ev = list[j];
if ((callback && callback !== ev.callback &&
callback !== ev.callback._callback) ||
(context && context !== ev.context)) {
- retain.push(ev);
+ events.push(ev);
}
}
}
- if (!retain.length) delete this._events[name];
+ this._events[name] = events;
}
}
@@ -188,37 +189,35 @@
return this;
},
+ // An inversion-of-control version of `on`. Tell *this* object to listen to
+ // an event in another object ... keeping track of what it's listening to.
+ listenTo: function(obj, name, callback) {
+ var listeners = this._listeners || (this._listeners = {});
+ var id = obj._listenerId || (obj._listenerId = _.uniqueId('l'));
+ listeners[id] = obj;
+ obj.on(name, typeof name === 'object' ? this : callback, this);
+ return this;
+ },
+
// Tell this object to stop listening to either specific events ... or
// to every object it's currently listening to.
stopListening: function(obj, name, callback) {
var listeners = this._listeners;
- if (!listeners) return this;
- var deleteListener = !name && !callback;
- if (typeof name === 'object') callback = this;
- if (obj) (listeners = {})[obj._listenerId] = obj;
- for (var id in listeners) {
- listeners[id].off(name, callback, this);
- if (deleteListener) delete this._listeners[id];
+ if (!listeners) return;
+ if (obj) {
+ obj.off(name, typeof name === 'object' ? this : callback, this);
+ if (!name && !callback) delete listeners[obj._listenerId];
+ } else {
+ if (typeof name === 'object') callback = this;
+ for (var id in listeners) {
+ listeners[id].off(name, callback, this);
+ }
+ this._listeners = {};
}
return this;
}
};
- var listenMethods = {listenTo: 'on', listenToOnce: 'once'};
-
- // An inversion-of-control versions of `on` and `once`. Tell *this* object to listen to
- // an event in another object ... keeping track of what it's listening to.
- _.each(listenMethods, function(implementation, method) {
- Events[method] = function(obj, name, callback) {
- var listeners = this._listeners || (this._listeners = {});
- var id = obj._listenerId || (obj._listenerId = _.uniqueId('l'));
- listeners[id] = obj;
- if (typeof name === 'object') callback = this;
- obj[implementation](name, callback, this);
- return this;
- };
- });
-
// Aliases for backwards compatibility.
Events.bind = Events.on;
Events.unbind = Events.off;
@@ -253,9 +252,6 @@
// A hash of attributes whose current and previous value differ.
changed: null,
- // The value returned during the last failed validation.
- validationError: null,
-
// The default name for the JSON `id` attribute is `"id"`. MongoDB and
// CouchDB users may want to set this to `"_id"`.
idAttribute: 'id',
@@ -418,14 +414,11 @@
fetch: function(options) {
options = options ? _.clone(options) : {};
if (options.parse === void 0) options.parse = true;
- var model = this;
var success = options.success;
- options.success = function(resp) {
+ options.success = function(model, resp, options) {
if (!model.set(model.parse(resp, options), options)) return false;
if (success) success(model, resp, options);
- model.trigger('sync', model, resp, options);
};
- wrapError(this, options);
return this.sync('read', this, options);
},
@@ -433,7 +426,7 @@
// If the server returns an attributes hash that differs, the model's
// state will be `set` again.
save: function(key, val, options) {
- var attrs, method, xhr, attributes = this.attributes;
+ var attrs, success, method, xhr, attributes = this.attributes;
// Handle both `"key", value` and `{key: value}` -style arguments.
if (key == null || typeof key === 'object') {
@@ -459,9 +452,8 @@
// After a successful server-side save, the client is (optionally)
// updated with the server-side state.
if (options.parse === void 0) options.parse = true;
- var model = this;
- var success = options.success;
- options.success = function(resp) {
+ success = options.success;
+ options.success = function(model, resp, options) {
// Ensure attributes are restored during synchronous saves.
model.attributes = attributes;
var serverAttrs = model.parse(resp, options);
@@ -470,10 +462,9 @@
return false;
}
if (success) success(model, resp, options);
- model.trigger('sync', model, resp, options);
};
- wrapError(this, options);
+ // Finish configuring and sending the Ajax request.
method = this.isNew() ? 'create' : (options.patch ? 'patch' : 'update');
if (method === 'patch') options.attrs = attrs;
xhr = this.sync(method, this, options);
@@ -496,17 +487,15 @@
model.trigger('destroy', model, model.collection, options);
};
- options.success = function(resp) {
+ options.success = function(model, resp, options) {
if (options.wait || model.isNew()) destroy();
if (success) success(model, resp, options);
- if (!model.isNew()) model.trigger('sync', model, resp, options);
};
if (this.isNew()) {
- options.success();
+ options.success(this, null, options);
return false;
}
- wrapError(this, options);
var xhr = this.sync('delete', this, options);
if (!options.wait) destroy();
@@ -544,8 +533,8 @@
},
// Run validation against the next complete set of model attributes,
- // returning `true` if all is well. Otherwise, fire an
- // `"invalid"` event and call the invalid callback, if specified.
+ // returning `true` if all is well. Otherwise, fire a general
+ // `"error"` event and call the error callback, if specified.
_validate: function(attrs, options) {
if (!options.validate || !this.validate) return true;
attrs = _.extend({}, this.attributes, attrs);
@@ -567,6 +556,7 @@
options || (options = {});
if (options.model) this.model = options.model;
if (options.comparator !== void 0) this.comparator = options.comparator;
+ this.models = [];
this._reset();
this.initialize.apply(this, arguments);
if (models) this.reset(models, _.extend({silent: true}, options));
@@ -601,13 +591,16 @@
var i, l, model, attrs, existing, doSort, add, at, sort, sortAttr;
add = [];
at = options.at;
- sort = this.comparator && (at == null) && options.sort !== false;
+ sort = this.comparator && (at == null) && options.sort != false;
sortAttr = _.isString(this.comparator) ? this.comparator : null;
// Turn bare objects into model references, and prevent invalid models
// from being added.
for (i = 0, l = models.length; i < l; i++) {
- if (!(model = this._prepareModel(attrs = models[i], options))) continue;
+ if (!(model = this._prepareModel(attrs = models[i], options))) {
+ this.trigger('invalid', this, attrs, options);
+ continue;
+ }
// If a duplicate is found, prevent it from being added and
// optionally merge it into the existing model.
@@ -714,7 +707,8 @@
// Get a model from the set by id.
get: function(obj) {
if (obj == null) return void 0;
- return this._byId[obj.id || obj.cid || obj];
+ this._idAttr || (this._idAttr = this.model.prototype.idAttribute);
+ return this._byId[obj.id || obj.cid || obj[this._idAttr] || obj];
},
// Get the model at the given index.
@@ -722,11 +716,10 @@
return this.models[index];
},
- // Return models with matching attributes. Useful for simple cases of
- // `filter`.
- where: function(attrs, first) {
- if (_.isEmpty(attrs)) return first ? void 0 : [];
- return this[first ? 'find' : 'filter'](function(model) {
+ // Return models with matching attributes. Useful for simple cases of `filter`.
+ where: function(attrs) {
+ if (_.isEmpty(attrs)) return [];
+ return this.filter(function(model) {
for (var key in attrs) {
if (attrs[key] !== model.get(key)) return false;
}
@@ -734,12 +727,6 @@
});
},
- // Return the first model with matching attributes. Useful for simple cases
- // of `find`.
- findWhere: function(attrs) {
- return this.where(attrs, true);
- },
-
// Force the collection to re-sort itself. You don't need to call this under
// normal circumstances, as the set will maintain sort order as each item
// is added.
@@ -770,7 +757,7 @@
update: function(models, options) {
options = _.extend({add: true, merge: true, remove: true}, options);
if (options.parse) models = this.parse(models, options);
- var attrs, model, i, l, existing;
+ var model, i, l, existing;
var add = [], remove = [], modelMap = {};
// Allow a single model (or no argument) to be passed.
@@ -781,12 +768,11 @@
// Determine which models to add and merge, and which to remove.
for (i = 0, l = models.length; i < l; i++) {
- if (!((attrs = models[i]) instanceof Model)) attrs = _.clone(attrs);
- if (!(model = this._prepareModel(attrs, options))) continue;
+ model = models[i];
existing = this.get(model);
if (options.remove && existing) modelMap[existing.cid] = true;
if ((options.add && !existing) || (options.merge && existing)) {
- add.push(models[i]);
+ add.push(model);
}
}
if (options.remove) {
@@ -811,7 +797,7 @@
for (var i = 0, l = this.models.length; i < l; i++) {
this._removeReference(this.models[i]);
}
- options.previousModels = this.models;
+ options.previousModels = this.models.slice();
this._reset();
if (models) this.add(models, _.extend({silent: true}, options));
if (!options.silent) this.trigger('reset', this, options);
@@ -825,14 +811,11 @@
options = options ? _.clone(options) : {};
if (options.parse === void 0) options.parse = true;
var success = options.success;
- var collection = this;
- options.success = function(resp) {
+ options.success = function(collection, resp, options) {
var method = options.update ? 'update' : 'reset';
collection[method](resp, options);
if (success) success(collection, resp, options);
- collection.trigger('sync', collection, resp, options);
};
- wrapError(this, options);
return this.sync('read', this, options);
},
@@ -845,7 +828,7 @@
if (!options.wait) this.add(model, options);
var collection = this;
var success = options.success;
- options.success = function(resp) {
+ options.success = function(model, resp, options) {
if (options.wait) collection.add(model, options);
if (success) success(model, resp, options);
};
@@ -867,7 +850,7 @@
// Reset all internal state. Called when the collection is reset.
_reset: function() {
this.length = 0;
- this.models = [];
+ this.models.length = 0;
this._byId = {};
},
@@ -880,10 +863,7 @@
options || (options = {});
options.collection = this;
var model = new this.model(attrs, options);
- if (!model._validate(attrs, options)) {
- this.trigger('invalid', this, attrs, options);
- return false;
- }
+ if (!model._validate(attrs, options)) return false;
return model;
},
@@ -1320,7 +1300,7 @@
// This only works for delegate-able events: not `focus`, `blur`, and
// not `change`, `submit`, and `reset` in Internet Explorer.
delegateEvents: function(events) {
- if (!(events || (events = _.result(this, 'events')))) return this;
+ if (!(events || (events = _.result(this, 'events')))) return;
this.undelegateEvents();
for (var key in events) {
var method = events[key];
@@ -1336,7 +1316,6 @@
this.$el.on(eventName, selector, method);
}
}
- return this;
},
// Clears all callbacks previously bound to the view with `delegateEvents`.
@@ -1344,7 +1323,6 @@
// Backbone views attached to the same DOM element.
undelegateEvents: function() {
this.$el.off('.delegateEvents' + this.cid);
- return this;
},
// Performs the initial configuration of a View with a set of options.
@@ -1447,6 +1425,18 @@
params.processData = false;
}
+ var success = options.success;
+ options.success = function(resp) {
+ if (success) success(model, resp, options);
+ model.trigger('sync', model, resp, options);
+ };
+
+ var error = options.error;
+ options.error = function(xhr) {
+ if (error) error(model, xhr, options);
+ model.trigger('error', model, xhr, options);
+ };
+
// Make the request, allowing the user to override any Ajax options.
var xhr = options.xhr = Backbone.ajax(_.extend(params, options));
model.trigger('request', model, xhr, options);
@@ -1505,13 +1495,4 @@
throw new Error('A "url" property or function must be specified');
};
- // Wrap an optional error callback with a fallback error event.
- var wrapError = function (model, options) {
- var error = options.error;
- options.error = function(resp) {
- if (error) error(model, resp, options);
- model.trigger('error', model, resp, options);
- };
- };
-
}).call(this);
diff --git a/vendor/backbone/test/collection.js b/vendor/backbone/test/collection.js
index c67600b6d1..64193fdee3 100644
--- a/vendor/backbone/test/collection.js
+++ b/vendor/backbone/test/collection.js
@@ -70,20 +70,22 @@ $(document).ready(function() {
equal(col.get(col.first().cid), col.first());
});
- test("get with non-default ids", 5, function() {
+ test("get with non-default ids", 4, function() {
var col = new Backbone.Collection();
- var MongoModel = Backbone.Model.extend({idAttribute: '_id'});
+ var MongoModel = Backbone.Model.extend({
+ idAttribute: '_id'
+ });
var model = new MongoModel({_id: 100});
- col.add(model);
+ col.push(model);
equal(col.get(100), model);
- equal(col.get(model.cid), model);
- equal(col.get(model), model);
- equal(col.get(101), void 0);
+ model.set({_id: 101});
+ equal(col.get(101), model);
- var col2 = new Backbone.Collection();
- col2.model = MongoModel;
- col2.add(model.attributes);
- equal(col2.get(model.clone()), col2.first());
+ var Col2 = Backbone.Collection.extend({ model: MongoModel });
+ var col2 = new Col2();
+ col2.push(model);
+ equal(col2.get({_id: 101}), model);
+ equal(col2.get(model.clone()), model);
});
test("update index when id changes", 3, function() {
@@ -360,7 +362,9 @@ $(document).ready(function() {
test("model destroy removes from all collections", 3, function() {
var e = new Backbone.Model({id: 5, title: 'Othello'});
- e.sync = function(method, model, options) { options.success(); };
+ e.sync = function(method, model, options) {
+ options.success(model, [], options);
+ };
var colE = new Backbone.Collection([e]);
var colF = new Backbone.Collection([e]);
e.destroy();
@@ -392,15 +396,6 @@ $(document).ready(function() {
equal(this.syncArgs.options.parse, false);
});
- test("fetch with an error response triggers an error event", 1, function () {
- var collection = new Backbone.Collection();
- collection.on('error', function () {
- ok(true);
- });
- collection.sync = function (method, model, options) { options.error(); };
- collection.fetch();
- });
-
test("ensure fetch only parses once", 1, function() {
var collection = new Backbone.Collection;
var counter = 0;
@@ -410,7 +405,7 @@ $(document).ready(function() {
};
collection.url = '/test';
collection.fetch();
- this.syncArgs.options.success();
+ this.syncArgs.options.success([]);
equal(counter, 1);
});
@@ -466,10 +461,9 @@ $(document).ready(function() {
equal(JSON.stringify(col), '[{"id":3,"label":"a"},{"id":2,"label":"b"},{"id":1,"label":"c"},{"id":0,"label":"d"}]');
});
- test("where and findWhere", 8, function() {
- var model = new Backbone.Model({a: 1});
+ test("where", 6, function() {
var coll = new Backbone.Collection([
- model,
+ {a: 1},
{a: 1},
{a: 1, b: 2},
{a: 2, b: 2},
@@ -481,8 +475,6 @@ $(document).ready(function() {
equal(coll.where({b: 1}).length, 0);
equal(coll.where({b: 2}).length, 2);
equal(coll.where({a: 1, b: 2}).length, 1);
- equal(coll.findWhere({a: 1}), model);
- equal(coll.findWhere({a: 4}), void 0);
});
test("Underscore methods", 13, function() {
@@ -492,10 +484,10 @@ $(document).ready(function() {
equal(col.indexOf(b), 1);
equal(col.size(), 4);
equal(col.rest().length, 3);
- ok(!_.include(col.rest(), a));
- ok(_.include(col.rest(), d));
+ ok(!_.include(col.rest()), a);
+ ok(!_.include(col.rest()), d);
ok(!col.isEmpty());
- ok(!_.include(col.without(d), d));
+ ok(!_.include(col.without(d)), d);
equal(col.max(function(model){ return model.id; }).id, 3);
equal(col.min(function(model){ return model.id; }).id, 0);
deepEqual(col.chain()
@@ -519,7 +511,7 @@ $(document).ready(function() {
test("reset", 10, function() {
var resetCount = 0;
- var models = col.models;
+ var models = col.models.slice();
col.on('reset', function() { resetCount += 1; });
col.reset([]);
equal(resetCount, 1);
@@ -710,7 +702,9 @@ $(document).ready(function() {
test("#1447 - create with wait adds model.", 1, function() {
var collection = new Backbone.Collection;
var model = new Backbone.Model;
- model.sync = function(method, model, options){ options.success(); };
+ model.sync = function(method, model, options){
+ options.success(model, [], options);
+ };
collection.on('add', function(){ ok(true); });
collection.create(model, {wait: true});
});
@@ -934,35 +928,6 @@ $(document).ready(function() {
equal(col.length, 1);
});
- test("`update` and model level `parse`", function() {
- var Model = Backbone.Model.extend({
- parse: function (res) { return res.model; }
- });
- var Collection = Backbone.Collection.extend({
- model: Model,
- parse: function (res) { return res.models; }
- });
- var model = new Model({id: 1});
- var collection = new Collection(model);
- collection.update({models: [
- {model: {id: 1}},
- {model: {id: 2}}
- ]}, {parse: true});
- equal(collection.first(), model);
- });
-
- test("`update` data is only parsed once", function() {
- var collection = new Backbone.Collection();
- collection.model = Backbone.Model.extend({
- parse: function (data) {
- equal(data.parsed, void 0);
- data.parsed = true;
- return data;
- }
- });
- collection.update({}, {parse: true});
- });
-
test("#1894 - Push should not trigger a sort", 0, function() {
var Collection = Backbone.Collection.extend({
comparator: 'id',
diff --git a/vendor/backbone/test/events.js b/vendor/backbone/test/events.js
index 920943ad83..f94d32c3d4 100644
--- a/vendor/backbone/test/events.js
+++ b/vendor/backbone/test/events.js
@@ -99,43 +99,6 @@ $(document).ready(function() {
a.listenTo(b, 'event2', cb);
a.stopListening(null, {event: cb});
b.trigger('event event2');
- b.off();
- a.listenTo(b, 'event event2', cb);
- a.stopListening(null, 'event');
- a.stopListening();
- b.trigger('event2');
- });
-
- test("listenToOnce and stopListening", 1, function() {
- var a = _.extend({}, Backbone.Events);
- var b = _.extend({}, Backbone.Events);
- a.listenToOnce(b, 'all', function() { ok(true); });
- b.trigger('anything');
- b.trigger('anything');
- a.listenToOnce(b, 'all', function() { ok(false); });
- a.stopListening();
- b.trigger('anything');
- });
-
- test("listenTo, listenToOnce and stopListening", 1, function() {
- var a = _.extend({}, Backbone.Events);
- var b = _.extend({}, Backbone.Events);
- a.listenToOnce(b, 'all', function() { ok(true); });
- b.trigger('anything');
- b.trigger('anything');
- a.listenTo(b, 'all', function() { ok(false); });
- a.stopListening();
- b.trigger('anything');
- });
-
- test("listenTo and stopListening with event maps", 1, function() {
- var a = _.extend({}, Backbone.Events);
- var b = _.extend({}, Backbone.Events);
- a.listenTo(b, {change: function(){ ok(true); }});
- b.trigger('change');
- a.listenTo(b, {change: function(){ ok(false); }});
- a.stopListening();
- b.trigger('change');
});
test("listenTo yourself", 1, function(){
@@ -296,6 +259,18 @@ $(document).ready(function() {
obj.trigger('x y');
});
+ test("off is chainable", 3, function() {
+ var obj = _.extend({}, Backbone.Events);
+ // With no events
+ ok(obj.off() === obj);
+ // When removing all events
+ obj.on('event', function(){}, obj);
+ ok(obj.off() === obj);
+ // When removing some events
+ obj.on('event', function(){}, obj);
+ ok(obj.off('event') === obj);
+ });
+
test("#1310 - off does not skip consecutive events", 0, function() {
var obj = _.extend({}, Backbone.Events);
obj.on('event', function() { ok(false); }, obj);
@@ -425,21 +400,4 @@ $(document).ready(function() {
_.extend({}, Backbone.Events).once('event').trigger('event');
});
- test("event functions are chainable", function() {
- var obj = _.extend({}, Backbone.Events);
- var obj2 = _.extend({}, Backbone.Events);
- var fn = function() {};
- equal(obj, obj.trigger('noeventssetyet'));
- equal(obj, obj.off('noeventssetyet'));
- equal(obj, obj.stopListening('noeventssetyet'));
- equal(obj, obj.on('a', fn));
- equal(obj, obj.once('c', fn));
- equal(obj, obj.trigger('a'));
- equal(obj, obj.listenTo(obj2, 'a', fn));
- equal(obj, obj.listenToOnce(obj2, 'b', fn));
- equal(obj, obj.off('a c'));
- equal(obj, obj.stopListening(obj2, 'a'));
- equal(obj, obj.stopListening());
- });
-
});
diff --git a/vendor/backbone/test/model.js b/vendor/backbone/test/model.js
index 088032d7f6..7bbb8337c7 100644
--- a/vendor/backbone/test/model.js
+++ b/vendor/backbone/test/model.js
@@ -401,7 +401,7 @@ $(document).ready(function() {
if (attrs.admin) return "Can't change admin status.";
};
model.sync = function(method, model, options) {
- options.success.call(this, {admin: true});
+ options.success.call(this, this, {admin: true}, options);
};
model.on('invalid', function(model, error) {
lastError = error;
@@ -418,19 +418,6 @@ $(document).ready(function() {
ok(_.isEqual(this.syncArgs.model, doc));
});
- test("save, fetch, destroy triggers error event when an error occurs", 3, function () {
- var model = new Backbone.Model();
- model.on('error', function () {
- ok(true);
- });
- model.sync = function (method, model, options) {
- options.error();
- };
- model.save({data: 2, id: 1});
- model.fetch();
- model.destroy();
- });
-
test("save with PATCH", function() {
doc.clear().set({id: 1, a: 1, b: 2, c: 3, d: 4});
doc.save();
@@ -448,7 +435,7 @@ $(document).ready(function() {
test("save in positional style", 1, function() {
var model = new Backbone.Model();
model.sync = function(method, model, options) {
- options.success();
+ options.success(model, {}, options);
};
model.save('title', 'Twelfth Night');
equal(model.get('title'), 'Twelfth Night');
@@ -457,8 +444,8 @@ $(document).ready(function() {
test("save with non-object success response", 2, function () {
var model = new Backbone.Model();
model.sync = function(method, model, options) {
- options.success('', options);
- options.success(null, options);
+ options.success(model, '', options);
+ options.success(model, null, options);
};
model.save({testing:'empty'}, {
success: function (model) {
@@ -733,7 +720,7 @@ $(document).ready(function() {
test("#1030 - `save` with `wait` results in correct attributes if success is called during sync", 2, function() {
var model = new Backbone.Model({x: 1, y: 2});
model.sync = function(method, model, options) {
- options.success();
+ options.success(model, {}, options);
};
model.on("change:x", function() { ok(true); });
model.save({x: 3}, {wait: true});
@@ -906,7 +893,7 @@ $(document).ready(function() {
}
};
model.sync = function(method, model, options) {
- options.success();
+ options.success(model, {}, options);
};
model.save({id: 1}, opts);
model.fetch(opts);
@@ -915,8 +902,9 @@ $(document).ready(function() {
test("#1412 - Trigger 'sync' event.", 3, function() {
var model = new Backbone.Model({id: 1});
- model.sync = function (method, model, options) { options.success(); };
+ model.url = '/test';
model.on('sync', function(){ ok(true); });
+ Backbone.ajax = function(settings){ settings.success(); };
model.fetch();
model.save();
model.destroy();
@@ -962,7 +950,7 @@ $(document).ready(function() {
var Model = Backbone.Model.extend({
sync: function(method, model, options) {
setTimeout(function(){
- options.success();
+ options.success(model, {}, options);
start();
}, 0);
}