diff --git a/README.md b/README.md
index b54b932970..53ec9e8d82 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# Lo-Dash v0.5.2
+# Lo-Dash v0.6.0
A drop-in replacement[*](https://github.com/bestiejs/lodash/wiki/Drop-in-Disclaimer) for Underscore.js, from the devs behind [jsPerf.com](http://jsperf.com), delivering [performance](http://lodash.com/benchmarks), [bug fixes](https://github.com/bestiejs/lodash#resolved-underscorejs-issues-30), and [additional features](https://github.com/bestiejs/lodash#features).
@@ -6,9 +6,9 @@ Lo-Dash’s performance is gained by avoiding slower native methods, instead opt
## Download
- * [Development source](https://raw.github.com/bestiejs/lodash/v0.5.2/lodash.js)
- * [Production source](https://raw.github.com/bestiejs/lodash/v0.5.2/lodash.min.js)
- * CDN copies of ≤ [v0.5.2](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/0.5.2/lodash.min.js) are available on [cdnjs](http://cdnjs.com/) thanks to [CloudFlare](http://www.cloudflare.com/)
+ * [Development source](https://raw.github.com/bestiejs/lodash/v0.6.0/lodash.js)
+ * [Production source](https://raw.github.com/bestiejs/lodash/v0.6.0/lodash.min.js)
+ * CDN copies of ≤ [v0.6.0](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/0.6.0/lodash.min.js) are available on [cdnjs](http://cdnjs.com/) thanks to [CloudFlare](http://www.cloudflare.com/)
* For optimal performance, [create a custom build](https://github.com/bestiejs/lodash#custom-builds) with only the features you need
## Dive in
@@ -33,7 +33,7 @@ For more information check out these screencasts over Lo-Dash:
* AMD loader support ([RequireJS](http://requirejs.org/), [curl.js](https://github.com/cujojs/curl), etc.)
* [_.bind](http://lodash.com/docs#bind) supports *“lazy”* binding
* [_.clone](http://lodash.com/docs#clone) supports *“deep”* cloning
- * [_.countBy](http://lodash.com/docs#countBy) as a compainion function for [_.groupBy](http://lodash.com/docs#groupBy) and [_.sortBy](http://lodash.com/docs#sortBy)
+ * [_.countBy](http://lodash.com/docs#countBy) as a companion function for [_.groupBy](http://lodash.com/docs#groupBy) and [_.sortBy](http://lodash.com/docs#sortBy)
* [_.debounce](http://lodash.com/docs#debounce)’ed functions match [_.throttle](http://lodash.com/docs#throttle)’ed functions’ return value behavior
* [_.drop](http://lodash.com/docs#drop) for the inverse functionality of [_.pick](http://lodash.com/docs#pick)
* [_.forEach](http://lodash.com/docs#forEach) is chainable and supports exiting iteration early
@@ -43,8 +43,10 @@ For more information check out these screencasts over Lo-Dash:
* [_.indexOf](http://lodash.com/docs#indexOf) and [_.lastIndexOf](http://lodash.com/docs#lastIndexOf) accept a `fromIndex` argument
* [_.merge](http://lodash.com/docs#merge) for a *“deep”* [_.extend](http://lodash.com/docs#extend)
* [_.partial](http://lodash.com/docs#partial) for partial application without `this` binding
+ * [_.pick](http://lodash.com/docs#pick) and [_.drop](http://lodash.com/docs#drop) accept `callback` and `thisArg` arguments
* [_.sortBy](http://lodash.com/docs#sortBy) performs a [stable](http://en.wikipedia.org/wiki/Sorting_algorithm#Stability) sort
* [_.template](http://lodash.com/docs#template) utilizes [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) for easier debugging
+ * [_.unescape](http://lodash.com/docs#unescape) to unescape strings escaped by [_.escape](http://lodash.com/docs#escape)
* [_.where](http://lodash.com/docs#where) for filtering collections by contained properties
* [_.zipObject](http://lodash.com/docs#zipObject) for composing objects
* [_.contains](http://lodash.com/docs#contains), [_.size](http://lodash.com/docs#size), [_.toArray](http://lodash.com/docs#toArray),
@@ -52,7 +54,7 @@ For more information check out these screencasts over Lo-Dash:
## Support
-Lo-Dash has been tested in at least Chrome 5-21, Firefox 1.5-13, IE 6-9, Opera 9.25-12.01, Safari 3-6, Node.js 0.4.8-0.8.7, Narwhal 0.3.2, RingoJS 0.8, and Rhino 1.7RC5.
+Lo-Dash has been tested in at least Chrome 5-21, Firefox 1-14, IE 6-9, Opera 9.25-12, Safari 3-6, Node.js 0.4.8-0.8.8, Narwhal 0.3.2, RingoJS 0.8, and Rhino 1.7RC5.
## Custom builds
@@ -169,38 +171,38 @@ require({
## Resolved Underscore.js issues (30+)
- * Allow iteration of objects with a `length` property [[#148](https://github.com/documentcloud/underscore/issues/148), [#154](https://github.com/documentcloud/underscore/issues/154), [#252](https://github.com/documentcloud/underscore/issues/252), [#448](https://github.com/documentcloud/underscore/issues/448), [#659](https://github.com/documentcloud/underscore/issues/659), [test](https://github.com/bestiejs/lodash/blob/v0.5.2/test/test.js#L551-557)]
- * Ensure array-like objects with invalid `length` properties are treated like regular objects [[test](https://github.com/bestiejs/lodash/blob/v0.5.2/test/test.js#L499-509)]
- * Ensure *“Arrays”*, “Collections”, and “Objects” methods don’t error when passed falsey arguments [[#650](https://github.com/documentcloud/underscore/pull/650), [test](https://github.com/bestiejs/lodash/blob/v0.5.2/test/test.js#L1558-1593)]
- * Ensure *“Collections”* methods allow string `collection` arguments [[#247](https://github.com/documentcloud/underscore/issues/247), [#276](https://github.com/documentcloud/underscore/issues/276), [#561](https://github.com/documentcloud/underscore/pull/561), [test](https://github.com/bestiejs/lodash/blob/v0.5.2/test/test.js#L511-529)]
- * Ensure templates compiled with errors are inspectable [[#666](https://github.com/documentcloud/underscore/issues/666), [test](https://github.com/bestiejs/lodash/blob/v0.5.2/test/test.js#L1299-1302)]
- * Fix cross-browser object iteration bugs [[#60](https://github.com/documentcloud/underscore/issues/60), [#376](https://github.com/documentcloud/underscore/issues/376), [test](https://github.com/bestiejs/lodash/blob/v0.5.2/test/test.js#L562-587)]
+ * Allow iteration of objects with a `length` property [[#148](https://github.com/documentcloud/underscore/issues/148), [#154](https://github.com/documentcloud/underscore/issues/154), [#252](https://github.com/documentcloud/underscore/issues/252), [#448](https://github.com/documentcloud/underscore/issues/448), [#659](https://github.com/documentcloud/underscore/issues/659), [test](https://github.com/bestiejs/lodash/blob/v0.6.0/test/test.js#L578-584)]
+ * Ensure array-like objects with invalid `length` properties are treated like regular objects [[test](https://github.com/bestiejs/lodash/blob/v0.6.0/test/test.js#L526-536)]
+ * Ensure *“Arrays”*, “Collections”, and “Objects” methods don’t error when passed falsey arguments [[#650](https://github.com/documentcloud/underscore/pull/650), [test](https://github.com/bestiejs/lodash/blob/v0.6.0/test/test.js#L1668-1703)]
+ * Ensure *“Collections”* methods allow string `collection` arguments [[#247](https://github.com/documentcloud/underscore/issues/247), [#276](https://github.com/documentcloud/underscore/issues/276), [#561](https://github.com/documentcloud/underscore/pull/561), [test](https://github.com/bestiejs/lodash/blob/v0.6.0/test/test.js#L538-555)]
+ * Ensure templates compiled with errors are inspectable [[#666](https://github.com/documentcloud/underscore/issues/666), [test](https://github.com/bestiejs/lodash/blob/v0.6.0/test/test.js#L1383-1386)]
+ * Fix cross-browser object iteration bugs [[#60](https://github.com/documentcloud/underscore/issues/60), [#376](https://github.com/documentcloud/underscore/issues/376), [test](https://github.com/bestiejs/lodash/blob/v0.6.0/test/test.js#L589-614)]
* Handle arrays with `undefined` values correctly in IE < 9 [[#601](https://github.com/documentcloud/underscore/issues/601)]
- * Methods should work on pages with incorrectly shimmed native methods [[#7](https://github.com/documentcloud/underscore/issues/7), [test](https://github.com/bestiejs/lodash/blob/v0.5.2/test/test.js#L117-123)]
- * Register as an AMD module, but still export to global [[#431](https://github.com/documentcloud/underscore/pull/431), [test](https://github.com/bestiejs/lodash/blob/v0.5.2/test/test.js#L101-115)]
- * `_(…)` should return passed wrapper instances [[test](https://github.com/bestiejs/lodash/blob/v0.5.2/test/test.js#L135-138)]
- * `_.clone` should allow `deep` cloning [[#595](https://github.com/documentcloud/underscore/pull/595), [test](https://github.com/bestiejs/lodash/blob/v0.5.2/test/test.js#L205-220)]
- * `_.contains` should work with strings [[#667](https://github.com/documentcloud/underscore/pull/667), [test](https://github.com/bestiejs/lodash/blob/v0.5.2/test/test.js#L275-284)]
- * `_.escape` should return an empty string when passed `null` or `undefined` [[#427](https://github.com/documentcloud/underscore/issues/427), [test](https://github.com/bestiejs/lodash/blob/v0.5.2/test/test.js#L375-378)]
- * `_.extend` should recursively extend objects [[#379](https://github.com/documentcloud/underscore/pull/379), [test](https://github.com/bestiejs/lodash/blob/v0.5.2/test/test.js#L952-974)]
- * `_.forEach` should be chainable [[#142](https://github.com/documentcloud/underscore/issues/142), [test](https://github.com/bestiejs/lodash/blob/v0.5.2/test/test.js#L494-497)]
- * `_.forEach` should allow exiting iteration early [[#211](https://github.com/documentcloud/underscore/issues/211), [test](https://github.com/bestiejs/lodash/blob/v0.5.2/test/test.js#L589-608)]
- * `_.groupBy` should add values to own, not inherited, properties [[test](https://github.com/bestiejs/lodash/blob/v0.5.2/test/test.js#L623-630)]
- * `_.isElement` should use strict equality for its duck type check [[test](https://github.com/bestiejs/lodash/blob/v0.5.2/test/test.js#L704-713)]
- * `_.isEmpty` and `_.size` should support jQuery/MooTools DOM query collections [[#690](https://github.com/documentcloud/underscore/pull/690), [test](https://github.com/bestiejs/lodash/blob/v0.5.2/test/test.js#L740-745)]
- * `_.isEqual` should return `true` for like-objects from different documents [[test](https://github.com/bestiejs/lodash/blob/v0.5.2/test/test.js#L781-801)]
- * `_.isObject` should avoid V8 bug [#2291](http://code.google.com/p/v8/issues/detail?id=2291) [[#605](https://github.com/documentcloud/underscore/issues/605), [test](https://github.com/bestiejs/lodash/blob/v0.5.2/test/test.js#L809-821)]
- * `_.isNaN(new Number(NaN))` should return `true` [[test](https://github.com/bestiejs/lodash/blob/v0.5.2/test/test.js#L829-831)]
- * `_.keys` and `_.size` should work with `arguments` objects cross-browser [[#396](https://github.com/documentcloud/underscore/issues/396), [#653](https://github.com/documentcloud/underscore/issues/653), [test](https://github.com/bestiejs/lodash/blob/v0.5.2/test/test.js#L885-887)]
+ * Methods should work on pages with incorrectly shimmed native methods [[#7](https://github.com/documentcloud/underscore/issues/7), [test](https://github.com/bestiejs/lodash/blob/v0.6.0/test/test.js#L117-123)]
+ * Register as an AMD module, but still export to global [[#431](https://github.com/documentcloud/underscore/pull/431), [test](https://github.com/bestiejs/lodash/blob/v0.6.0/test/test.js#L101-115)]
+ * `_(…)` should return passed wrapper instances [[test](https://github.com/bestiejs/lodash/blob/v0.6.0/test/test.js#L135-138)]
+ * `_.clone` should allow `deep` cloning [[#595](https://github.com/documentcloud/underscore/pull/595), [test](https://github.com/bestiejs/lodash/blob/v0.6.0/test/test.js#L205-220)]
+ * `_.contains` should work with strings [[#667](https://github.com/documentcloud/underscore/pull/667), [test](https://github.com/bestiejs/lodash/blob/v0.6.0/test/test.js#L275-284)]
+ * `_.countBy` and `_.groupBy` should only add values to own, not inherited, properties [[test](https://github.com/bestiejs/lodash/blob/v0.6.0/test/test.js#L292-299)]
+ * `_.escape` should return an empty string when passed `null` or `undefined` [[#427](https://github.com/documentcloud/underscore/issues/427), [test](https://github.com/bestiejs/lodash/blob/v0.6.0/test/test.js#L402-405)]
+ * `_.extend` should recursively extend objects [[#379](https://github.com/documentcloud/underscore/pull/379), [#718](https://github.com/documentcloud/underscore/issues/718), [test](https://github.com/bestiejs/lodash/blob/v0.6.0/test/test.js#L979-1001)]
+ * `_.forEach` should be chainable [[#142](https://github.com/documentcloud/underscore/issues/142), [test](https://github.com/bestiejs/lodash/blob/v0.6.0/test/test.js#L521-524)]
+ * `_.forEach` should allow exiting iteration early [[#211](https://github.com/documentcloud/underscore/issues/211), [test](https://github.com/bestiejs/lodash/blob/v0.6.0/test/test.js#L616-635)]
+ * `_.isElement` should use strict equality for its duck type check [[test](https://github.com/bestiejs/lodash/blob/v0.6.0/test/test.js#L731-740)]
+ * `_.isEmpty` and `_.size` should support jQuery/MooTools DOM query collections [[#690](https://github.com/documentcloud/underscore/pull/690), [test](https://github.com/bestiejs/lodash/blob/v0.6.0/test/test.js#L767-772)]
+ * `_.isEqual` should return `true` for like-objects from different documents [[test](https://github.com/bestiejs/lodash/blob/v0.6.0/test/test.js#L808-828)]
+ * `_.isObject` should avoid V8 bug [#2291](http://code.google.com/p/v8/issues/detail?id=2291) [[#605](https://github.com/documentcloud/underscore/issues/605), [test](https://github.com/bestiejs/lodash/blob/v0.6.0/test/test.js#L836-848)]
+ * `_.isNaN(new Number(NaN))` should return `true` [[test](https://github.com/bestiejs/lodash/blob/v0.6.0/test/test.js#L856-858)]
+ * `_.keys` and `_.size` should work with `arguments` objects cross-browser [[#396](https://github.com/documentcloud/underscore/issues/396), [#653](https://github.com/documentcloud/underscore/issues/653), [test](https://github.com/bestiejs/lodash/blob/v0.6.0/test/test.js#L912-914)]
* `_.once` should free the given function for garbage collection [[#693](https://github.com/documentcloud/underscore/pull/693)]
- * `_.range` should coerce arguments to numbers [[#634](https://github.com/documentcloud/underscore/issues/634), [#683](https://github.com/documentcloud/underscore/issues/683), [test](https://github.com/bestiejs/lodash/blob/v0.5.2/test/test.js#L1110-1113)]
- * `_.reduceRight` should pass correct callback arguments when iterating objects [[test](https://github.com/bestiejs/lodash/blob/v0.5.2/test/test.js#L1121-1135)]
- * `_.size` should return the `length` of string values [[test](https://github.com/bestiejs/lodash/blob/v0.5.2/test/test.js#L1179-1181)]
- * `_.sortedIndex` should support arrays with high `length` values [[test](https://github.com/bestiejs/lodash/blob/v0.5.2/test/test.js#L1269-1278)]
- * `_.template` should not augment the `options` object [[test](https://github.com/bestiejs/lodash/blob/v0.5.2/test/test.js#L1293-1297)]
- * `_.throttle` should work when called in a loop [[#502](https://github.com/documentcloud/underscore/issues/502), [test](https://github.com/bestiejs/lodash/blob/v0.5.2/test/test.js#L1389-1399)]
- * `_.toArray` uses custom `toArray` methods of arrays and strings [[test](https://github.com/bestiejs/lodash/blob/v0.5.2/test/test.js#L1426-1434)]
- * `_.zipObject` should accept less than two arguments [[test](https://github.com/bestiejs/lodash/blob/v0.5.2/test/test.js#L1520-1522)]
+ * `_.range` should coerce arguments to numbers [[#634](https://github.com/documentcloud/underscore/issues/634), [#683](https://github.com/documentcloud/underscore/issues/683), [test](https://github.com/bestiejs/lodash/blob/v0.6.0/test/test.js#L1170-1173)]
+ * `_.reduceRight` should pass correct callback arguments when iterating objects [[test](https://github.com/bestiejs/lodash/blob/v0.6.0/test/test.js#L1205-1219)]
+ * `_.size` should return the `length` of string values [[test](https://github.com/bestiejs/lodash/blob/v0.6.0/test/test.js#L1263-1265)]
+ * `_.sortedIndex` should support arrays with high `length` values [[test](https://github.com/bestiejs/lodash/blob/v0.6.0/test/test.js#L1353-1362)]
+ * `_.template` should not augment the `options` object [[test](https://github.com/bestiejs/lodash/blob/v0.6.0/test/test.js#L1377-1381)]
+ * `_.throttle` should work when called in a loop [[#502](https://github.com/documentcloud/underscore/issues/502), [test](https://github.com/bestiejs/lodash/blob/v0.6.0/test/test.js#L1473-1483)]
+ * `_.toArray` uses custom `toArray` methods of arrays and strings [[test](https://github.com/bestiejs/lodash/blob/v0.6.0/test/test.js#L1510-1518)]
+ * `_.zipObject` should accept less than two arguments [[test](https://github.com/bestiejs/lodash/blob/v0.6.0/test/test.js#L1630-1632)]
## Optimized methods (50+)
@@ -212,6 +214,7 @@ require({
* `_.defaults`
* `_.defer`
* `_.difference`
+ * `_.drop`, `_.omit`
* `_.each`
* `_.escape`
* `_.every`, `_.all`
@@ -264,35 +267,16 @@ require({
## Release Notes
-### v0.5.2
-
- * Ensured `_.isElement` uses strict equality for its duck type check
- * Ensured `_.isObject` returns a boolean value
- * Ensured `_.template` and *“Objects”* methods don’t error when passed falsey arguments
- * Made `_.template` generate less unused code in compiled templates
-
-### v0.5.1
-
- * Ensured `_.bind` correctly appends array arguments to partially applied arguments in older browsers
-
-### v0.5.0
-
- * Added [_.countBy](http://lodash.com/docs#countBy), [_.drop](http://lodash.com/docs#drop), [_.merge](http://lodash.com/docs#merge), and [_.where](http://lodash.com/docs#where)
- * Added `csp` *(Content Security Policy)* and `underscore` build options
- * Added `deep` cloning support to `_.clone`
- * Added [Jam](http://jamjs.org/) package support
- * Added support for exiting `_.forEach`, `_.forIn`, and `_.forOwn` early by returning `false` in the `callback`
- * Added support for jQuery/MooTools DOM query collections to `_.isEmpty` and `_.size`
- * Ensured development build works with IE conditional compilation enabled
- * Ensured `_.clone` doesn’t clone functions, DOM nodes, `arguments` objects, and objects created by constructors other than `Object`
- * Ensured `_.filter`’s `callback` can’t modify result values
- * Ensured `_.isEmpty`, `_.isEquals`, and `_.size` support `arguments` objects
- * Ensured `_.isEqual` doesn’t inspect DOM nodes, works with objects from other documents, and calls custom `isEqual` methods before checking strict equality
- * Ensured `_.once` frees the given function for garbage collection
- * Ensured `_.sortBy` performs a stable sort
- * Ensured `reEvaluateDelimiter` is assigned when `_.templateSettings.evaluate` is undefined
- * Made `_.range` coerce arguments to numbers
- * Optimized `_.isFunction`
+### v0.6.0
+
+ * Added `callback` and `thisArg` arguments to `_.drop` and `_.pick`
+ * Added `hasObjectSpliceBug` test to avoid `delete` operator use
+ * Added `_.omit` alias for `_.drop`
+ * Added [_.unescape](http://lodash.com/docs#unescape)
+ * Ensured `_.reduce` works with string objects in IE < 9
+ * Made compiled methods take advantage of engines with strict mode optimizations
+ * Optimized `_.intersection` and removed its dependency on `_.every`
+ * Reduced the file size of the `underscore` build
The full changelog is available [here](https://github.com/bestiejs/lodash/wiki/Changelog).
diff --git a/build.js b/build.js
index c87251d168..667ccfa916 100755
--- a/build.js
+++ b/build.js
@@ -2,6 +2,9 @@
;(function() {
'use strict';
+ /** The debug version of `source` */
+ var debugSource;
+
/** Load modules */
var fs = require('fs'),
path = require('path'),
@@ -20,8 +23,11 @@
/** Flag used to specify a legacy build */
var isLegacy = process.argv.indexOf('legacy') > -1;
+ /** Flag used to specify an Underscore build */
+ var isUnderscore = process.argv.indexOf('underscore') > -1;
+
/** Flag used to specify a mobile build */
- var isMobile = !isLegacy && (isCSP || process.argv.indexOf('mobile') > -1);
+ var isMobile = !isLegacy && (isCSP || isUnderscore || process.argv.indexOf('mobile') > -1);
/**
* Flag used to specify `_.bindAll`, `_.extend`, and `_.defaults` are
@@ -29,9 +35,6 @@
*/
var isStrict = process.argv.indexOf('strict') > -1;
- /** Flag used to specify an Underscore build */
- var isUnderscore = process.argv.indexOf('underscore') > -1;
-
/** Flag used to specify if the build should include the "use strict" directive */
var useStrict = isStrict || !(isLegacy || isMobile);
@@ -47,19 +50,25 @@
if (isStrict) {
source = setUseStrictOption(source, true);
- }
- else if (!useStrict) {
+ } else {
source = removeUseStrictDirective(source);
- source = setUseStrictOption(source, false);
+ if (!useStrict) {
+ source = setUseStrictOption(source, false);
+ }
}
-
if (isLegacy) {
source = replaceVar(source, 'noArgsClass', 'true');
- ['isBindFast', 'isKeysFast', 'nativeBind', 'nativeIsArray', 'nativeKeys'].forEach(function(varName) {
+ ['isBindFast', 'isKeysFast', 'isStrictFast', 'nativeBind', 'nativeIsArray', 'nativeKeys'].forEach(function(varName) {
source = replaceVar(source, varName, 'false');
});
}
- else if (isMobile) {
+ else if (isUnderscore) {
+ // remove `prototype` [[Enumerable]] fix from `iteratorTemplate`
+ source = source
+ .replace(/(?: *\/\/.*\n)*\s*' *(?:<% *)?if *\(!hasDontEnumBug *(?:&&|\))[\s\S]+?<% *} *(?:%>|').+/g, '')
+ .replace(/!hasDontEnumBug *\|\|/g, '');
+ }
+ if (isMobile) {
source = replaceVar(source, 'isKeysFast', 'false');
}
vm.runInNewContext(source, sandbox);
@@ -79,6 +88,7 @@
'include': 'contains',
'inject': 'reduce',
'methods': 'functions',
+ 'omit': 'drop',
'select': 'filter',
'tail': 'rest',
'take': 'first',
@@ -88,6 +98,7 @@
/** Used to associate real names with their aliases */
var realToAliasMap = {
'contains': ['include'],
+ 'drop': ['omit'],
'every': ['all'],
'filter': ['select'],
'find': ['detect'],
@@ -180,7 +191,7 @@
'identity': [],
'indexOf': ['sortedIndex'],
'initial': [],
- 'intersection': ['every', 'indexOf'],
+ 'intersection': ['indexOf'],
'invoke': [],
'isArguments': [],
'isArray': [],
@@ -228,6 +239,7 @@
'throttle': [],
'times': [],
'toArray': ['isFunction', 'values'],
+ 'unescape': [],
'union': ['indexOf'],
'uniq': ['identity', 'indexOf'],
'uniqueId': [],
@@ -274,6 +286,7 @@
'forOwn',
'merge',
'partial',
+ 'unescape',
'where',
'zipObject'
]));
@@ -532,25 +545,25 @@
}
/**
- * Removes the `_.isFunction` fallback from `source`.
+ * Removes the `_.isArguments` fallback from `source`.
*
* @private
* @param {String} source The source to process.
- * @returns {String} Returns the source with the `isFunction` fallback removed.
+ * @returns {String} Returns the source with the `isArguments` fallback removed.
*/
- function removeIsFunctionFallback(source) {
- return source.replace(/(?:\s*\/\/.*)*\s*if *\(isFunction\(\/x\/[\s\S]+?};\s*}/, '');
+ function removeIsArgumentsFallback(source) {
+ return source.replace(getIsArgumentsFallback(source), '');
}
/**
- * Removes the `_.isArguments` fallback from `source`.
+ * Removes the `_.isFunction` fallback from `source`.
*
* @private
* @param {String} source The source to process.
- * @returns {String} Returns the source with the `isArguments` fallback removed.
+ * @returns {String} Returns the source with the `isFunction` fallback removed.
*/
- function removeIsArgumentsFallback(source) {
- return source.replace(getIsArgumentsFallback(source), '');
+ function removeIsFunctionFallback(source) {
+ return source.replace(/(?:\s*\/\/.*)*\s*if *\(isFunction\(\/x\/[\s\S]+?};\s*}/, '');
}
/**
@@ -683,11 +696,14 @@
* @returns {String} Returns the modified source.
*/
function setUseStrictOption(source, value) {
- return source
+ // remove `isStrictFast` assignment
+ return removeVar(source, 'isStrictFast')
// replace `useStrict` branch in `value` with hard-coded option
.replace(/(?: *\/\/.*\n)*(\s*)' *<% *if *\(useStrict\).+/, value ? "$1'\\'use strict\\';\\n' +" : '')
// remove `useStrict` from iterator options
.replace(/ *'useStrict': *false,\n/g, '')
+ // remove `useStrict` variable assignment in `createIterator`
+ .replace(/,\s*useStrict *=[^;]+/, '')
// remove `useStrict` data object property assignment in `createIterator`
.replace(/\s*.+?\.useStrict *=.+/, '');
}
@@ -705,7 +721,7 @@
source = source.replace(/prototype\s*=\s*{\s*valueOf\s*:\s*1\s*}/, 'prototype={valueOf:1,y:1}');
// re-remove "use strict" added by the minifier
- if (!useStrict) {
+ if (!isStrict) {
source = removeUseStrictDirective(source);
}
fs.writeFileSync(path.join(cwd, filename), source);
@@ -968,7 +984,7 @@
return match.replace(/\bcallee\b/g, 'merge');
});
- // remove `hasDontEnumBug`, `iteratesOwnLast`, `noArgsEnum` assignment
+ // remove `hasDontEnumBug`, `hasObjectSpliceBug`, `iteratesOwnLast`, `noArgsEnum` assignment
source = source.replace(/(?:\n +\/\*[^*]*\*+(?:[^\/][^*]*\*+)*\/)?\n *var hasDontEnumBug\b[\s\S]+?}\(1\)\);\n/, '');
// remove `iteratesOwnLast` from `isPlainObject`
@@ -977,8 +993,8 @@
// remove JScript [[DontEnum]] fix from `_.isEqual`
source = source.replace(/(?:\s*\/\/.*)*\n( +)if *\(hasDontEnumBug[\s\S]+?\n\1}/, '');
- // remove IE `shift` and `splice` fix from mutator Array functions mixin
- source = source.replace(/(?:\s*\/\/.*)*\n( +)if *\(value.length *=== *0[\s\S]+?\n\1}/, '');
+ // remove `hasObjectSpliceBug` fix from the mutator Array functions mixin
+ source = source.replace(/(?:\s*\/\/.*)*\n( +)if *\(hasObjectSpliceBug[\s\S]+?\n\1}/, '');
// remove `noArraySliceOnStrings` from `_.toArray`
source = source.replace(/noArraySliceOnStrings *\?[^:]+: *([^)]+)/g, '$1');
@@ -1033,20 +1049,13 @@
/*--------------------------------------------------------------------------*/
- // remove associated functions, variables, and code snippets that the minifier may miss
- if (isRemoved(source, 'bind')) {
- source = removeVar(source, 'nativeBind');
- source = removeVar(source, 'isBindFast');
- }
- if (isRemoved(source, 'isArray')) {
- source = removeVar(source, 'nativeIsArray');
+ // modify/remove references to removed methods/variables
+ if (isRemoved(source, 'isArguments')) {
+ source = replaceVar(source, 'noArgsClass', 'false');
}
if (isRemoved(source, 'isFunction')) {
source = removeIsFunctionFallback(source);
}
- if (isRemoved(source, 'keys')) {
- source = removeFunction(source, 'shimKeys');
- }
if (isRemoved(source, 'mixin')) {
// remove `LoDash` constructor
source = removeFunction(source, 'LoDash');
@@ -1054,6 +1063,20 @@
source = source.replace(/(?:new +LoDash(?!\()|(?:new +)?LoDash\([^)]*\));?/g, '');
// remove `LoDash.prototype` additions
source = source.replace(/(?:\s*\/\/.*)*\s*LoDash.prototype *=[\s\S]+?\/\*-+\*\//, '');
+ // remove `hasObjectSpliceBug` assignment
+ source = source.replace(/(?:\n +\/\*[^*]*\*+(?:[^\/][^*]*\*+)*\/)?\n *var hasObjectSpliceBug;|.+?hasObjectSpliceBug *=.+/g, '');
+ }
+
+ // assign debug source before further modifications that rely on the minifier
+ // to remove unused variables and other dead code
+ debugSource = source;
+
+ // remove associated functions, variables, and code snippets that the minifier may miss
+ if (isRemoved(source, 'isArray')) {
+ source = removeVar(source, 'nativeIsArray');
+ }
+ if (isRemoved(source, 'keys')) {
+ source = removeFunction(source, 'shimKeys');
}
if (isRemoved(source, 'template')) {
// remove `templateSettings` assignment
@@ -1075,6 +1098,11 @@
source = removeFunction(source, 'createIterator');
source = source.replace(/(?:\n +\/\*[^*]*\*+(?:[^\/][^*]*\*+)*\/)?\n *var noArgsEnum;|.+?noArgsEnum *=.+/g, '');
}
+ if (isRemoved(source, 'createIterator', 'bind')) {
+ source = removeVar(source, 'isBindFast');
+ source = removeVar(source, 'isStrictFast');
+ source = removeVar(source, 'nativeBind');
+ }
if (isRemoved(source, 'createIterator', 'bind', 'isArray', 'keys')) {
source = removeVar(source, 'reNative');
}
@@ -1087,9 +1115,9 @@
if (isRemoved(source, 'createIterator', 'keys')) {
source = removeVar(source, 'nativeKeys');
}
- if (!source.match(/var (?:hasDontEnumBug|iteratesOwnLast|noArgsEnum)\b/g)) {
- // remove `hasDontEnumBug`, `iteratesOwnLast`, `noArgsEnum` assignment
- source = source.replace(/ *\(function\(\) *{\s*var props\b[\s\S]+?}\(1\)\);/, '');
+ if (!source.match(/var (?:hasDontEnumBug|hasObjectSpliceBug|iteratesOwnLast|noArgsEnum)\b/g)) {
+ // remove `hasDontEnumBug`, `hasObjectSpliceBug`, `iteratesOwnLast`, and `noArgsEnum` assignment
+ source = source.replace(/ *\(function\(\) *{[\s\S]+?}\(1\)\);/, '');
}
// remove pseudo private properties
@@ -1105,7 +1133,7 @@
// begin the minification process
if (filterType || isBackbone || isLegacy || isMobile || isStrict || isUnderscore) {
- writeFile(source, 'lodash.custom.js');
+ writeFile(debugSource, 'lodash.custom.js');
minify(source, 'lodash.custom.min', function(result) {
writeFile(result, 'lodash.custom.min.js');
diff --git a/build/pre-compile.js b/build/pre-compile.js
index 887973d481..31bf03fd60 100644
--- a/build/pre-compile.js
+++ b/build/pre-compile.js
@@ -7,6 +7,8 @@
/** Used to minify variables embedded in compiled strings */
var compiledVars = [
+ 'argsIndex',
+ 'argsLength',
'callback',
'collection',
'concat',
@@ -36,8 +38,6 @@
// lesser used variables
'accumulator',
'args',
- 'argsIndex',
- 'argsLength',
'arrayLikeClasses',
'ArrayProto',
'bind',
@@ -132,7 +132,6 @@
'each',
'environment',
'escape',
- 'escape',
'evaluate',
'every',
'extend',
@@ -187,6 +186,7 @@
'min',
'mixin',
'noConflict',
+ 'omit',
'once',
'opera',
'partial',
@@ -214,6 +214,7 @@
'throttle',
'times',
'toArray',
+ 'unescape',
'union',
'uniq',
'unique',
@@ -276,7 +277,7 @@
// remove whitespace from string literals
source = source.replace(/'(?:(?=(\\?))\1.)*?'/g, function(string) {
// avoids removing the '\n' of the `stringEscapes` object
- return string.replace(/\[object |else if|function | in |return\s+[\w']|throw |typeof |use strict|var |@ |'\\n'|\\\\n|\\n|\s+/g, function(match) {
+ return string.replace(/\[object |delete |else if|function | in |return\s+[\w']|throw |typeof |use strict|var |@ |'\\n'|\\\\n|\\n|\s+/g, function(match) {
return match == false || match == '\\n' ? '' : match;
});
});
diff --git a/doc/README.md b/doc/README.md
index 54e2ed1cd0..6d88253180 100644
--- a/doc/README.md
+++ b/doc/README.md
@@ -1,4 +1,4 @@
-# Lo-Dash v0.5.2
+# Lo-Dash v0.6.0
@@ -16,13 +16,13 @@
* [`_.compact`](#_compactarray)
* [`_.compose`](#_composefunc1-func2-)
* [`_.contains`](#_containscollection-target)
-* [`_.countBy`](#_countbycollection-callback--thisarg)
+* [`_.countBy`](#_countbycollection-callback|property--thisarg)
* [`_.debounce`](#_debouncefunc-wait-immediate)
* [`_.defaults`](#_defaultsobject--default1-default2-)
* [`_.defer`](#_deferfunc--arg1-arg2-)
* [`_.delay`](#_delayfunc-wait--arg1-arg2-)
* [`_.difference`](#_differencearray--array1-array2-)
-* [`_.drop`](#_dropobject--prop1-prop2-)
+* [`_.drop`](#_dropobject-callback|-prop1-prop2--thisarg)
* [`_.escape`](#_escapestring)
* [`_.every`](#_everycollection--callbackidentity-thisarg)
* [`_.extend`](#_extendobject--source1-source2-)
@@ -34,7 +34,7 @@
* [`_.forIn`](#_forinobject-callback--thisarg)
* [`_.forOwn`](#_forownobject-callback--thisarg)
* [`_.functions`](#_functionsobject)
-* [`_.groupBy`](#_groupbycollection-callback--thisarg)
+* [`_.groupBy`](#_groupbycollection-callback|property--thisarg)
* [`_.has`](#_hasobject-property)
* [`_.identity`](#_identityvalue)
* [`_.indexOf`](#_indexofarray-value--fromindex0)
@@ -69,7 +69,7 @@
* [`_.noConflict`](#_noconflict)
* [`_.once`](#_oncefunc)
* [`_.partial`](#_partialfunc--arg1-arg2-)
-* [`_.pick`](#_pickobject--prop1-prop2-)
+* [`_.pick`](#_pickobject-callback|-prop1-prop2--thisarg)
* [`_.pluck`](#_pluckcollection-property)
* [`_.range`](#_rangestart0-end--step1)
* [`_.reduce`](#_reducecollection-callback--accumulator-thisarg)
@@ -80,13 +80,14 @@
* [`_.shuffle`](#_shufflearray)
* [`_.size`](#_sizevalue)
* [`_.some`](#_somecollection--callbackidentity-thisarg)
-* [`_.sortBy`](#_sortbycollection-callback--thisarg)
+* [`_.sortBy`](#_sortbycollection-callback|property--thisarg)
* [`_.sortedIndex`](#_sortedindexarray-value--callbackidentity-thisarg)
* [`_.tap`](#_tapvalue-interceptor)
* [`_.template`](#_templatetext-data-options)
* [`_.throttle`](#_throttlefunc-wait)
* [`_.times`](#_timesn-callback--thisarg)
* [`_.toArray`](#_toarraycollection)
+* [`_.unescape`](#_unescapestring)
* [`_.union`](#_unionarray1-array2-)
* [`_.uniq`](#_uniqarray--issortedfalse-callbackidentity-thisarg)
* [`_.uniqueId`](#_uniqueidprefix)
@@ -121,6 +122,14 @@
+
+
+## ``
+* [``](#)
+
+
+
+
@@ -134,7 +143,7 @@
### `_(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L249 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L294 "View in source") [Ⓣ][1]
The `lodash` function.
@@ -152,7 +161,7 @@ The `lodash` function.
### `_.VERSION`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4064 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4165 "View in source") [Ⓣ][1]
*(String)*: The semantic version number.
@@ -164,7 +173,7 @@ The `lodash` function.
### `_.after(n, func)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3151 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3234 "View in source") [Ⓣ][1]
Creates a new function that is restricted to executing only after it is called `n` times.
@@ -192,7 +201,7 @@ _.forEach(notes, function(note) {
### `_.bind(func [, thisArg, arg1, arg2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3205 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3288 "View in source") [Ⓣ][1]
Creates a new 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. Lazy defined methods may be bound by passing the object they are bound to as `func` and the method name as `thisArg`.
@@ -243,7 +252,7 @@ func();
### `_.bindAll(object [, methodName1, methodName2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3275 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3358 "View in source") [Ⓣ][1]
Binds methods on `object` to `object`, overwriting the existing method. If no method names are provided, all the function properties of `object` will be bound.
@@ -274,7 +283,7 @@ jQuery('#lodash_button').on('click', buttonView.onClick);
### `_.chain(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3989 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4090 "View in source") [Ⓣ][1]
Wraps the value in a `lodash` wrapper object.
@@ -308,16 +317,16 @@ var youngest = _.chain(stooges)
### `_.clone(value, deep [, guard, stack=[]], thorough)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L992 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1064 "View in source") [Ⓣ][1]
Creates a clone of `value`. If `deep` is `true`, all nested objects will also be cloned otherwise they will be assigned by reference. If a value has a `clone` method it will be used to perform the clone. Functions, DOM nodes, `arguments` objects, and objects created by constructors other than `Object` are **not** cloned unless they have a custom `clone` method.
#### Arguments
1. `value` *(Mixed)*: The value to clone.
2. `deep` *(Boolean)*: A flag to indicate a deep clone.
-3. `[guard]` *(Object)*: Internally used to allow this method to work with others like `_.map` without using their callback `index` argument for `deep`.
-4. `[stack=[]]` *(Array)*: Internally used to keep track of traversed objects to avoid circular references.
-5. `thorough` *(Object)*: Internally used to indicate whether or not to perform a more thorough clone of non-object values.
+3. `[guard]` *(Object)*: Internally used to allow this method to work with others like `_.map` without using their callback `index` argument for `deep`.
+4. `[stack=[]]` *(Array)*: Internally used to keep track of traversed objects to avoid circular references.
+5. `thorough` *(Object)*: Internally used to indicate whether or not to perform a more thorough clone of non-object values.
#### Returns
*(Mixed)*: Returns the cloned `value`.
@@ -350,7 +359,7 @@ shallow[0] === stooges[0];
### `_.compact(array)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2390 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2471 "View in source") [Ⓣ][1]
Creates a new array with all falsey values of `array` removed. The values `false`, `null`, `0`, `""`, `undefined` and `NaN` are all falsey.
@@ -374,7 +383,7 @@ _.compact([0, 1, false, 2, '', 3]);
### `_.compose([func1, func2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3313 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3396 "View in source") [Ⓣ][1]
Creates a new function that is the composition of the passed functions, where each function consumes the return value of the function that follows. In math terms, composing the functions `f()`, `g()`, and `h()` produces `f(g(h()))`.
@@ -401,7 +410,7 @@ welcome('moe');
### `_.contains(collection, target)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1874 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1955 "View in source") [Ⓣ][1]
Checks if a given `target` element is present in a `collection` using strict equality for comparisons, i.e. `===`.
@@ -431,14 +440,14 @@ _.contains('curly', 'ur');
-### `_.countBy(collection, callback [, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1910 "View in source") [Ⓣ][1]
+### `_.countBy(collection, callback|property [, thisArg])`
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1991 "View in source") [Ⓣ][1]
Creates an object composed of keys returned from running each element of `collection` through a `callback`. The corresponding value of each key is the number of times the key was returned by `callback`. The `callback` is bound to `thisArg` and invoked with `3` arguments; *(value, index|key, collection)*. The `callback` argument may also be the name of a property to count by *(e.g. 'length')*.
#### Arguments
1. `collection` *(Array|Object|String)*: The collection to iterate over.
-2. `callback` *(Function|String)*: The function called per iteration or property name to count by.
+2. `callback|property` *(Function|String)*: The function called per iteration or property name to count by.
3. `[thisArg]` *(Mixed)*: The `this` binding for the callback.
#### Returns
@@ -464,14 +473,14 @@ _.countBy(['one', 'two', 'three'], 'length');
### `_.debounce(func, wait, immediate)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3346 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3429 "View in source") [Ⓣ][1]
Creates a new 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.
#### Arguments
1. `func` *(Function)*: The function to debounce.
2. `wait` *(Number)*: The number of milliseconds to delay.
-3. `immediate` *(Boolean)*: A flag to indicate execution is on the leading edge of the timeout.
+3. `immediate` *(Boolean)*: A flag to indicate execution is on the leading edge of the timeout.
#### Returns
*(Function)*: Returns the new debounced function.
@@ -490,7 +499,7 @@ jQuery(window).on('resize', lazyLayout);
### `_.defaults(object [, default1, default2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1093 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1165 "View in source") [Ⓣ][1]
Assigns enumerable properties of the default object(s) to the `destination` object for all `destination` properties that resolve to `null`/`undefined`. Once a property is set, additional defaults of the same property will be ignored.
@@ -516,7 +525,7 @@ _.defaults(iceCream, { 'flavor': 'vanilla', 'sprinkles': 'rainbow' });
### `_.defer(func [, arg1, arg2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3411 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3494 "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.
@@ -541,7 +550,7 @@ _.defer(function() { alert('deferred'); });
### `_.delay(func, wait [, arg1, arg2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3391 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3474 "View in source") [Ⓣ][1]
Executes the `func` function after `wait` milliseconds. Additional arguments will be passed to `func` when it is invoked.
@@ -568,7 +577,7 @@ _.delay(log, 1000, 'logged later');
### `_.difference(array [, array1, array2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2422 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2503 "View in source") [Ⓣ][1]
Creates a new array of `array` elements not present in the other arrays using strict equality for comparisons, i.e. `===`.
@@ -592,14 +601,15 @@ _.difference([1, 2, 3, 4, 5], [5, 2, 10]);
-### `_.drop(object [, prop1, prop2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1113 "View in source") [Ⓣ][1]
+### `_.drop(object, callback|[prop1, prop2, ..., thisArg])`
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1195 "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.
+Creates a shallow clone of `object` excluding the specified properties. Property names may be specified as individual arguments or as arrays of property names. If `callback` is passed, it will be executed for each property in the `object`, dropping the properties `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with `3` arguments; *(value, key, object)*.
#### Arguments
1. `object` *(Object)*: The source object.
-2. `[prop1, prop2, ...]` *(Object)*: The properties to drop.
+2. `callback|[prop1, prop2, ...]` *(Function|String)*: The properties to drop or the function called per iteration.
+3. `[thisArg]` *(Mixed)*: The `this` binding for the callback.
#### Returns
*(Object)*: Returns an object without the dropped properties.
@@ -608,6 +618,11 @@ Creates a shallow clone of `object` excluding the specified properties. Property
```js
_.drop({ 'name': 'moe', 'age': 40, 'userid': 'moe1' }, 'userid');
// => { 'name': 'moe', 'age': 40 }
+
+_.drop({ 'name': 'moe', '_hint': 'knucklehead', '_seed': '96c4eb' }, function(value, key) {
+ return key.charAt(0) == '_';
+});
+// => { 'name': 'moe' }
```
* * *
@@ -618,9 +633,9 @@ _.drop({ 'name': 'moe', 'age': 40, 'userid': 'moe1' }, 'userid');
### `_.escape(string)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3608 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3691 "View in source") [Ⓣ][1]
-Escapes a string for inclusion in HTML, replacing `&`, `<`, `"`, and `'` characters.
+Converts the characters `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding HTML entities.
#### Arguments
1. `string` *(String)*: The string to escape.
@@ -642,7 +657,7 @@ _.escape('Moe, Larry & Curly');
### `_.every(collection [, callback=identity, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1930 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2011 "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 `3` arguments; *(value, index|key, collection)*.
@@ -668,7 +683,7 @@ _.every([true, 1, null, 'yes'], Boolean);
### `_.extend(object [, source1, source2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1137 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1213 "View in source") [Ⓣ][1]
Assigns enumerable properties of the source object(s) to the `destination` object. Subsequent sources will overwrite propery assignments of previous sources.
@@ -693,7 +708,7 @@ _.extend({ 'name': 'moe' }, { 'age': 40 });
### `_.filter(collection [, callback=identity, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1950 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2031 "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 `3` arguments; *(value, index|key, collection)*.
@@ -719,7 +734,7 @@ var evens = _.filter([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; })
### `_.find(collection, callback [, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1971 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2052 "View in source") [Ⓣ][1]
Examines each element in a `collection`, returning the first one the `callback` returns truthy for. The function returns as soon as it finds an acceptable element, and does not iterate over the entire `collection`. The `callback` is bound to `thisArg` and invoked with `3` arguments; *(value, index|key, collection)*.
@@ -745,14 +760,14 @@ var even = _.find([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; });
### `_.first(array [, n, guard])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2459 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2540 "View in source") [Ⓣ][1]
Gets the first element of the `array`. Pass `n` to return the first `n` elements of the `array`.
#### Arguments
1. `array` *(Array)*: The array to query.
2. `[n]` *(Number)*: The number of elements to return.
-3. `[guard]` *(Object)*: Internally used to allow this method to work with others like `_.map` without using their callback `index` argument for `n`.
+3. `[guard]` *(Object)*: Internally used to allow this method to work with others like `_.map` without using their callback `index` argument for `n`.
#### Returns
*(Mixed)*: Returns the first element or an array of the first `n` elements of `array`.
@@ -771,7 +786,7 @@ _.first([5, 4, 3, 2, 1]);
### `_.flatten(array, shallow)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2483 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2564 "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.
@@ -799,7 +814,7 @@ _.flatten([1, [2], [3, [[4]]]], true);
### `_.forEach(collection, callback [, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1998 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2079 "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 `3` arguments; *(value, index|key, collection)*. Callbacks may exit iteration early by explicitly returning `false`.
@@ -828,7 +843,7 @@ _.forEach({ 'one': 1, 'two': 2, 'three': 3 }, alert);
### `_.forIn(object, callback [, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1167 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1243 "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 `3` arguments; *(value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`.
@@ -864,7 +879,7 @@ _.forIn(new Dog('Dagny'), function(value, key) {
### `_.forOwn(object, callback [, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1191 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1267 "View in source") [Ⓣ][1]
Iterates over `object`'s own enumerable properties, executing the `callback` for each property. The `callback` is bound to `thisArg` and invoked with `3` arguments; *(value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`.
@@ -892,7 +907,7 @@ _.forOwn({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) {
### `_.functions(object)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1208 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1284 "View in source") [Ⓣ][1]
Creates a sorted array of all enumerable properties, own and inherited, of `object` that have function values.
@@ -915,14 +930,14 @@ _.functions(_);
-### `_.groupBy(collection, callback [, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2026 "View in source") [Ⓣ][1]
+### `_.groupBy(collection, callback|property [, thisArg])`
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2107 "View in source") [Ⓣ][1]
Creates an object composed of keys returned from running each element of `collection` through a `callback`. The corresponding value of each key is an array of elements passed to `callback` that returned the key. The `callback` is bound to `thisArg` and invoked with `3` arguments; *(value, index|key, collection)*. The `callback` argument may also be the name of a property to count by *(e.g. 'length')*.
#### Arguments
1. `collection` *(Array|Object|String)*: The collection to iterate over.
-2. `callback` *(Function|String)*: The function called per iteration or property name to group by.
+2. `callback|property` *(Function|String)*: The function called per iteration or property name to group by.
3. `[thisArg]` *(Mixed)*: The `this` binding for the callback.
#### Returns
@@ -948,7 +963,7 @@ _.groupBy(['one', 'two', 'three'], 'length');
### `_.has(object, property)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1231 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1307 "View in source") [Ⓣ][1]
Checks if the specified object `property` exists and is a direct property, instead of an inherited property.
@@ -973,7 +988,7 @@ _.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b');
### `_.identity(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3628 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3711 "View in source") [Ⓣ][1]
This function returns the first argument passed to it. Note: It is used throughout Lo-Dash as a default callback.
@@ -998,14 +1013,14 @@ moe === _.identity(moe);
### `_.indexOf(array, value [, fromIndex=0])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2527 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2608 "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 `isSorted` will run a faster binary search.
#### Arguments
1. `array` *(Array)*: The array to search.
2. `value` *(Mixed)*: The value to search for.
-3. `[fromIndex=0]` *(Boolean|Number)*: The index to start searching from or `true` to perform a binary search on a sorted `array`.
+3. `[fromIndex=0]` *(Boolean|Number)*: The index to start searching from or `true` to perform a binary search on a sorted `array`.
#### Returns
*(Number)*: Returns the index of the matched value or `-1`.
@@ -1030,14 +1045,14 @@ _.indexOf([1, 1, 2, 2, 3, 3], 2, true);
### `_.initial(array [, n, guard])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2567 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2648 "View in source") [Ⓣ][1]
Gets all but the last element of `array`. Pass `n` to exclude the last `n` elements from the result.
#### Arguments
1. `array` *(Array)*: The array to query.
2. `[n]` *(Number)*: The number of elements to return.
-3. `[guard]` *(Object)*: Internally used to allow this method to work with others like `_.map` without using their callback `index` argument for `n`.
+3. `[guard]` *(Object)*: Internally used to allow this method to work with others like `_.map` without using their callback `index` argument for `n`.
#### Returns
*(Array)*: Returns all but the last element or `n` elements of `array`.
@@ -1056,7 +1071,7 @@ _.initial([3, 2, 1]);
### `_.intersection([array1, array2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2589 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2670 "View in source") [Ⓣ][1]
Computes the intersection of all the passed-in arrays using strict equality for comparisons, i.e. `===`.
@@ -1080,13 +1095,13 @@ _.intersection([1, 2, 3], [101, 2, 1, 10], [2, 1]);
### `_.invoke(collection, methodName [, arg1, arg2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2054 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2135 "View in source") [Ⓣ][1]
Invokes the method named by `methodName` on each element in the `collection`. 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`.
#### Arguments
1. `collection` *(Array|Object|String)*: The collection to iterate over.
-2. `methodName` *(Function|String)*: The name of the method to invoke or the function invoked per iteration.
+2. `methodName` *(Function|String)*: The name of the method to invoke or the function invoked per iteration.
3. `[arg1, arg2, ...]` *(Mixed)*: Arguments to invoke the method with.
#### Returns
@@ -1109,7 +1124,7 @@ _.invoke([123, 456], String.prototype.split, '');
### `_.isArguments(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L885 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L957 "View in source") [Ⓣ][1]
Checks if `value` is an `arguments` object.
@@ -1136,7 +1151,7 @@ _.isArguments([1, 2, 3]);
### `_.isArray(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L911 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L983 "View in source") [Ⓣ][1]
Checks if `value` is an array.
@@ -1163,7 +1178,7 @@ _.isArray([1, 2, 3]);
### `_.isBoolean(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1248 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1324 "View in source") [Ⓣ][1]
Checks if `value` is a boolean *(`true` or `false`)* value.
@@ -1187,7 +1202,7 @@ _.isBoolean(null);
### `_.isDate(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1265 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1341 "View in source") [Ⓣ][1]
Checks if `value` is a date.
@@ -1211,7 +1226,7 @@ _.isDate(new Date);
### `_.isElement(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1282 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1358 "View in source") [Ⓣ][1]
Checks if `value` is a DOM element.
@@ -1235,7 +1250,7 @@ _.isElement(document.body);
### `_.isEmpty(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1307 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1383 "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".
@@ -1265,15 +1280,15 @@ _.isEmpty('');
### `_.isEqual(a, b [, stack=[]], thorough)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1349 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1425 "View in source") [Ⓣ][1]
Performs a deep comparison between two values to determine if they are equivalent to each other. If a value has an `isEqual` method it will be used to perform the comparison.
#### Arguments
1. `a` *(Mixed)*: The value to compare.
2. `b` *(Mixed)*: The other value to compare.
-3. `[stack=[]]` *(Array)*: Internally used to keep track of traversed objects to avoid circular references.
-4. `thorough` *(Object)*: Internally used to indicate whether or not to perform a more thorough comparison of non-object values.
+3. `[stack=[]]` *(Array)*: Internally used to keep track of traversed objects to avoid circular references.
+4. `thorough` *(Object)*: Internally used to indicate whether or not to perform a more thorough comparison of non-object values.
#### Returns
*(Boolean)*: Returns `true` if the values are equvalent, else `false`.
@@ -1298,7 +1313,7 @@ _.isEqual(moe, clone);
### `_.isFinite(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1522 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1598 "View in source") [Ⓣ][1]
Checks if `value` is a finite number. Note: This is not the same as native `isFinite`, which will return true for booleans and other values. See http://es5.github.com/#x15.1.2.5.
@@ -1328,7 +1343,7 @@ _.isFinite(Infinity);
### `_.isFunction(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L928 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1000 "View in source") [Ⓣ][1]
Checks if `value` is a function.
@@ -1352,7 +1367,7 @@ _.isFunction(''.concat);
### `_.isNaN(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1577 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1653 "View in source") [Ⓣ][1]
Checks if `value` is `NaN`. Note: This is not the same as native `isNaN`, which will return true for `undefined` and other values. See http://es5.github.com/#x15.1.2.4.
@@ -1385,7 +1400,7 @@ _.isNaN(undefined);
### `_.isNull(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1600 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1676 "View in source") [Ⓣ][1]
Checks if `value` is `null`.
@@ -1412,7 +1427,7 @@ _.isNull(undefined);
### `_.isNumber(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1617 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1693 "View in source") [Ⓣ][1]
Checks if `value` is a number.
@@ -1436,7 +1451,7 @@ _.isNumber(8.4 * 5;
### `_.isObject(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1543 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1619 "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('')`)*
@@ -1463,7 +1478,7 @@ _.isObject(1);
### `_.isRegExp(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1634 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1710 "View in source") [Ⓣ][1]
Checks if `value` is a regular expression.
@@ -1487,7 +1502,7 @@ _.isRegExp(/moe/);
### `_.isString(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1651 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1727 "View in source") [Ⓣ][1]
Checks if `value` is a string.
@@ -1511,7 +1526,7 @@ _.isString('moe');
### `_.isUndefined(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1669 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1745 "View in source") [Ⓣ][1]
Checks if `value` is `undefined`.
@@ -1535,7 +1550,7 @@ _.isUndefined(void 0);
### `_.keys(object)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1686 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1762 "View in source") [Ⓣ][1]
Creates an array composed of the own enumerable property names of `object`.
@@ -1559,14 +1574,14 @@ _.keys({ 'one': 1, 'two': 2, 'three': 3 });
### `_.last(array [, n, guard])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2630 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2713 "View in source") [Ⓣ][1]
Gets the last element of the `array`. Pass `n` to return the lasy `n` elementsvof the `array`.
#### Arguments
1. `array` *(Array)*: The array to query.
2. `[n]` *(Number)*: The number of elements to return.
-3. `[guard]` *(Object)*: Internally used to allow this method to work with others like `_.map` without using their callback `index` argument for `n`.
+3. `[guard]` *(Object)*: Internally used to allow this method to work with others like `_.map` without using their callback `index` argument for `n`.
#### Returns
*(Mixed)*: Returns the last element or an array of the last `n` elements of `array`.
@@ -1585,7 +1600,7 @@ _.last([3, 2, 1]);
### `_.lastIndexOf(array, value [, fromIndex=array.length-1])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2656 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2739 "View in source") [Ⓣ][1]
Gets the index at which the last occurrence of `value` is found using strict equality for comparisons, i.e. `===`.
@@ -1614,7 +1629,7 @@ _.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3);
### `_.map(collection [, callback=identity, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2089 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2170 "View in source") [Ⓣ][1]
Creates a new array of values by running each element in the `collection` through a `callback`. The `callback` is bound to `thisArg` and invoked with `3` arguments; *(value, index|key, collection)*.
@@ -1643,7 +1658,7 @@ _.map({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { return num * 3; });
### `_.max(array [, callback, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2696 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2779 "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 `3` arguments; *(value, index, array)*.
@@ -1675,7 +1690,7 @@ _.max(stooges, function(stooge) { return stooge.age; });
### `_.memoize(func [, resolver])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3434 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3517 "View in source") [Ⓣ][1]
Creates a new 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.
@@ -1701,15 +1716,15 @@ var fibonacci = _.memoize(function(n) {
### `_.merge(object [, source1, source2, ..., indicator, stack=[]])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1728 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1804 "View in source") [Ⓣ][1]
Merges enumerable properties of the source object(s) into the `destination` object. Subsequent sources will overwrite propery assignments of previous sources.
#### Arguments
1. `object` *(Object)*: The destination object.
2. `[source1, source2, ...]` *(Object)*: The source objects.
-3. `[indicator]` *(Object)*: Internally used to indicate that the `stack` argument is an array of traversed objects instead of another source object.
-4. `[stack=[]]` *(Array)*: Internally used to keep track of traversed objects to avoid circular references.
+3. `[indicator]` *(Object)*: Internally used to indicate that the `stack` argument is an array of traversed objects instead of another source object.
+4. `[stack=[]]` *(Array)*: Internally used to keep track of traversed objects to avoid circular references.
#### Returns
*(Object)*: Returns the destination object.
@@ -1738,7 +1753,7 @@ _.merge(stooges, ages);
### `_.min(array [, callback, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2746 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2829 "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 `3` arguments; *(value, index, array)*.
@@ -1764,7 +1779,7 @@ _.min([10, 5, 100, 2, 1000]);
### `_.mixin(object)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3654 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3737 "View in source") [Ⓣ][1]
Adds functions properties of `object` to the `lodash` function and chainable wrapper.
@@ -1794,7 +1809,7 @@ _('curly').capitalize();
### `_.noConflict()`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3685 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3768 "View in source") [Ⓣ][1]
Reverts the '_' variable to its previous value and returns a reference to the `lodash` function.
@@ -1814,7 +1829,7 @@ var lodash = _.noConflict();
### `_.once(func)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3460 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3543 "View in source") [Ⓣ][1]
Creates a new function that is restricted to one execution. Repeat calls to the function will return the value of the first call.
@@ -1840,7 +1855,7 @@ initialize();
### `_.partial(func [, arg1, arg2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3495 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3578 "View in source") [Ⓣ][1]
Creates a new function that, when called, invokes `func` with any additional `partial` arguments prepended to those passed to the new function. This method is similar `bind`, except it does **not** alter the `this` binding.
@@ -1866,14 +1881,15 @@ hi('moe');
-### `_.pick(object [, prop1, prop2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1771 "View in source") [Ⓣ][1]
+### `_.pick(object, callback|[prop1, prop2, ..., thisArg])`
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1856 "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.
+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 `3` arguments; *(value, key, object)*.
#### Arguments
1. `object` *(Object)*: The source object.
-2. `[prop1, prop2, ...]` *(Object)*: The properties to pick.
+2. `callback|[prop1, prop2, ...]` *(Function|String)*: The properties to pick or the function called per iteration.
+3. `[thisArg]` *(Mixed)*: The `this` binding for the callback.
#### Returns
*(Object)*: Returns an object composed of the picked properties.
@@ -1882,6 +1898,11 @@ Creates a shallow clone of `object` composed of the specified properties. Proper
```js
_.pick({ 'name': 'moe', 'age': 40, 'userid': 'moe1' }, 'name', 'age');
// => { 'name': 'moe', 'age': 40 }
+
+_.pick({ 'name': 'moe', '_hint': 'knucklehead', '_seed': '96c4eb' }, function(value, key) {
+ return key.charAt(0) != '_';
+});
+// => { 'name': 'moe' }
```
* * *
@@ -1892,7 +1913,7 @@ _.pick({ 'name': 'moe', 'age': 40, 'userid': 'moe1' }, 'name', 'age');
### `_.pluck(collection, property)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2112 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2193 "View in source") [Ⓣ][1]
Retrieves the value of a specified property from all elements in the `collection`.
@@ -1923,7 +1944,7 @@ _.pluck(stooges, 'name');
### `_.range([start=0], end [, step=1])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2807 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2890 "View in source") [Ⓣ][1]
Creates an array of numbers *(positive and/or negative)* progressing from `start` up to but not including `stop`. This method is a port of Python's `range()` function. See http://docs.python.org/library/functions.html#range.
@@ -1961,7 +1982,7 @@ _.range(0);
### `_.reduce(collection, callback [, accumulator, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2140 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2221 "View in source") [Ⓣ][1]
Boils down a `collection` to a single value. The initial state of the reduction is `accumulator` and each successive step of it should be returned by the `callback`. The `callback` is bound to `thisArg` and invoked with `4` arguments; for arrays they are *(accumulator, value, index|key, collection)*.
@@ -1988,7 +2009,7 @@ var sum = _.reduce([1, 2, 3], function(memo, num) { return memo + num; });
### `_.reduceRight(collection, callback [, accumulator, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2177 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2258 "View in source") [Ⓣ][1]
The right-associative version of `_.reduce`.
@@ -2016,7 +2037,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#L2233 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2314 "View in source") [Ⓣ][1]
The opposite of `_.filter`, this method returns the values of a `collection` that `callback` does **not** return truthy for.
@@ -2042,14 +2063,14 @@ var odds = _.reject([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; });
### `_.rest(array [, n, guard])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2846 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2929 "View in source") [Ⓣ][1]
The opposite of `_.initial`, this method gets all but the first value of `array`. Pass `n` to exclude the first `n` values from the result.
#### Arguments
1. `array` *(Array)*: The array to query.
2. `[n]` *(Number)*: The number of elements to return.
-3. `[guard]` *(Object)*: Internally used to allow this method to work with others like `_.map` without using their callback `index` argument for `n`.
+3. `[guard]` *(Object)*: Internally used to allow this method to work with others like `_.map` without using their callback `index` argument for `n`.
#### Returns
*(Array)*: Returns all but the first value or `n` values of `array`.
@@ -2068,7 +2089,7 @@ _.rest([3, 2, 1]);
### `_.result(object, property)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3717 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3800 "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.
@@ -2103,7 +2124,7 @@ _.result(object, 'stuff');
### `_.shuffle(array)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2867 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2950 "View in source") [Ⓣ][1]
Creates a new array of shuffled `array` values, using a version of the Fisher-Yates shuffle. See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle.
@@ -2127,7 +2148,7 @@ _.shuffle([1, 2, 3, 4, 5, 6]);
### `_.size(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1813 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1894 "View in source") [Ⓣ][1]
Gets the size of `value` by returning `value.length` if `value` is an array, string, or `arguments` object. If `value` is an object, size is determined by returning the number of own enumerable properties it has.
@@ -2157,7 +2178,7 @@ _.size('curly');
### `_.some(collection [, callback=identity, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2256 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2337 "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 `3` arguments; *(value, index|key, collection)*.
@@ -2182,14 +2203,14 @@ _.some([null, 0, 'yes', false]);
-### `_.sortBy(collection, callback [, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2286 "View in source") [Ⓣ][1]
+### `_.sortBy(collection, callback|property [, thisArg])`
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2367 "View in source") [Ⓣ][1]
Creates a new array, stable sorted in ascending order by the results of running each element of `collection` through a `callback`. The `callback` is bound to `thisArg` and invoked with `3` arguments; *(value, index|key, collection)*. The `callback` argument may also be the name of a property to sort by *(e.g. 'length')*.
#### Arguments
1. `collection` *(Array|Object|String)*: The collection to iterate over.
-2. `callback` *(Function|String)*: The function called per iteration or property name to sort by.
+2. `callback|property` *(Function|String)*: The function called per iteration or property name to sort by.
3. `[thisArg]` *(Mixed)*: The `this` binding for the callback.
#### Returns
@@ -2215,7 +2236,7 @@ _.sortBy(['larry', 'brendan', 'moe'], 'length');
### `_.sortedIndex(array, value [, callback=identity, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2919 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3002 "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 `1` argument; *(value)*.
@@ -2256,7 +2277,7 @@ _.sortedIndex(['twenty', 'thirty', 'fourty'], 'thirty-five', function(word) {
### `_.tap(value, interceptor)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4016 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4117 "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.
@@ -2286,7 +2307,7 @@ _.chain([1,2,3,200])
### `_.template(text, data, options)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3790 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3873 "View in source") [Ⓣ][1]
A micro-templating method that handles arbitrary delimiters, preserves whitespace, and correctly escapes quotes within interpolated code. Note: In the development build `_.template` utilizes sourceURLs for easier debugging. See http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl Note: Lo-Dash may be used in Chrome extensions by either creating a `lodash csp` build and avoiding `_.template` use, or loading Lo-Dash in a sandboxed page. See http://developer.chrome.com/trunk/extensions/sandboxingEval.html
@@ -2351,7 +2372,7 @@ fs.writeFileSync(path.join(cwd, 'jst.js'), '\
### `_.throttle(func, wait)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3531 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3614 "View in source") [Ⓣ][1]
Creates a new 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.
@@ -2376,7 +2397,7 @@ jQuery(window).on('scroll', throttled);
### `_.times(n, callback [, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3932 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4015 "View in source") [Ⓣ][1]
Executes the `callback` function `n` times. The `callback` is bound to `thisArg` and invoked with `1` argument; *(index)*.
@@ -2402,7 +2423,7 @@ _.times(3, function() { this.grantWish(); }, genie);
### `_.toArray(collection)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2323 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2404 "View in source") [Ⓣ][1]
Converts the `collection`, to an array. Useful for converting the `arguments` object.
@@ -2423,10 +2444,34 @@ Converts the `collection`, to an array. Useful for converting the `arguments` ob
+
+
+### `_.unescape(string)`
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4042 "View in source") [Ⓣ][1]
+
+Converts the HTML entities `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding characters.
+
+#### Arguments
+1. `string` *(String)*: The string to unescape.
+
+#### Returns
+*(String)*: Returns the unescaped string.
+
+#### Example
+```js
+_.unescape('Moe, Larry & Curly');
+// => "Moe, Larry & Curly"
+```
+
+* * *
+
+
+
+
### `_.union([array1, array2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2960 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3043 "View in source") [Ⓣ][1]
Computes the union of the passed-in arrays using strict equality for comparisons, i.e. `===`.
@@ -2450,7 +2495,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#L3004 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3087 "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 `3` arguments; *(value, index, array)*.
@@ -2486,7 +2531,7 @@ _.uniq([1, 2, 1.5, 3, 2.5], function(num) { return this.floor(num); }, Math);
### `_.uniqueId([prefix])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3959 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4060 "View in source") [Ⓣ][1]
Generates a unique id. If `prefix` is passed, the id will be appended to it.
@@ -2510,7 +2555,7 @@ _.uniqueId('contact_');
### `_.values(object)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1844 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1925 "View in source") [Ⓣ][1]
Creates an array composed of the own enumerable property values of `object`.
@@ -2534,7 +2579,7 @@ _.values({ 'one': 1, 'two': 2, 'three': 3 });
### `_.where(collection, properties)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2360 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2441 "View in source") [Ⓣ][1]
Examines each element in a `collection`, returning an array of all elements that contain the given `properties`.
@@ -2565,7 +2610,7 @@ _.where(stooges, { 'age': 40 });
### `_.without(array [, value1, value2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3053 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3136 "View in source") [Ⓣ][1]
Creates a new array with all occurrences of the passed values removed using strict equality for comparisons, i.e. `===`.
@@ -2590,7 +2635,7 @@ _.without([1, 2, 1, 0, 3, 1, 4], 0, 1);
### `_.wrap(value, wrapper)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3582 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3665 "View in source") [Ⓣ][1]
Creates a new function that passes `value` to the `wrapper` function as its first argument. Additional arguments passed to the new function are appended to those passed to the `wrapper` function.
@@ -2619,7 +2664,7 @@ hello();
### `_.zip([array1, array2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3086 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3169 "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.
@@ -2643,7 +2688,7 @@ _.zip(['moe', 'larry', 'curly'], [30, 40, 50], [true, false, false]);
### `_.zipObject(keys [, values=[]])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3115 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3198 "View in source") [Ⓣ][1]
Creates an object composed from an array of `keys` and an array of `values`.
@@ -2675,7 +2720,7 @@ _.zipObject(['moe', 'larry', 'curly'], [30, 40, 50]);
### `_.prototype.chain()`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4034 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4135 "View in source") [Ⓣ][1]
Enables method chaining on the wrapper object.
@@ -2696,7 +2741,7 @@ _([1, 2, 3]).value();
### `_.prototype.value()`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4051 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4152 "View in source") [Ⓣ][1]
Extracts the wrapped value.
@@ -2724,7 +2769,7 @@ _([1, 2, 3]).value();
### `_.templateSettings`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L278 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L323 "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.
@@ -2736,7 +2781,7 @@ _([1, 2, 3]).value();
### `_.templateSettings.escape`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L287 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L332 "View in source") [Ⓣ][1]
*(RegExp)*: Used to detect `data` property values to be HTML-escaped.
@@ -2748,7 +2793,7 @@ _([1, 2, 3]).value();
### `_.templateSettings.evaluate`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L296 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L341 "View in source") [Ⓣ][1]
*(RegExp)*: Used to detect code to be evaluated.
@@ -2760,7 +2805,7 @@ _([1, 2, 3]).value();
### `_.templateSettings.interpolate`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L305 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L350 "View in source") [Ⓣ][1]
*(RegExp)*: Used to detect `data` property values to inject.
@@ -2772,7 +2817,7 @@ _([1, 2, 3]).value();
### `_.templateSettings.variable`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L314 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L359 "View in source") [Ⓣ][1]
*(String)*: Used to reference the data object in the template text.
@@ -2784,6 +2829,25 @@ _([1, 2, 3]).value();
+
+
+## ``
+
+
+
+### ``
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L220 "View in source") [Ⓣ][1]
+
+(Unknown): Detect if sourceURL syntax is usable without erroring: The JS engine in Adobe products, like InDesign, will throw a syntax error when it encounters a single line comment beginning with the `@` symbol. The JS engine in Narwhal will generate the function `function anonymous(){//}` and throw a syntax error. In IE, `@` symbols are part of its non-standard conditional compilation support. The `@cc_on` statement activates its support while the trailing ` !` induces a syntax error to exlude it. Compatibility modes in IE > 8 require a space before the `!` to induce a syntax error. See http://msdn.microsoft.com/en-us/library/121hztk3(v=vs.94).aspx
+
+* * *
+
+
+
+
+
+
+
diff --git a/doc/parse.php b/doc/parse.php
index 5e38f29d5b..2f618e7c9c 100644
--- a/doc/parse.php
+++ b/doc/parse.php
@@ -21,7 +21,7 @@
// generate Markdown
$markdown = docdown(array(
'path' => '../' . $file,
- 'title' => 'Lo-Dash v0.5.2',
+ 'title' => 'Lo-Dash v0.6.0',
'url' => 'https://github.com/bestiejs/lodash/blob/master/lodash.js'
));
diff --git a/lodash.js b/lodash.js
index 3c5448223d..d89eb9d818 100644
--- a/lodash.js
+++ b/lodash.js
@@ -1,5 +1,5 @@
/*!
- * Lo-Dash v0.5.2
+ * Lo-Dash v0.6.0
* Copyright 2012 John-David Dalton
* Based on Underscore.js 1.3.3, copyright 2009-2012 Jeremy Ashkenas, DocumentCloud Inc.
*
@@ -47,12 +47,18 @@
/** Used to generate unique IDs */
var idCounter = 0;
+ /** Used by `cachedContains` as the default size when optimizations are enabled for large arrays */
+ var largeArraySize = 30;
+
/** Used to restore the original `_` reference in `noConflict` */
var oldDash = window._;
/** Used to detect delimiter values that should be processed by `tokenizeEvaluate` */
var reComplexDelimiter = /[-+=!~*%&^<>|{(\/]|\[\D|\b(?:delete|in|instanceof|new|typeof|void)\b/;
+ /** Used to match HTML entities */
+ var reEscapedHtml = /&(?:amp|lt|gt|quot|#x27);/g;
+
/** Used to match empty string literals in compiled template source */
var reEmptyStringLeading = /\b__p \+= '';/g,
reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
@@ -71,11 +77,11 @@
.replace(/valueOf|for [^\]]+/g, '.+?') + '$'
);
- /** Used to match tokens in template text */
+ /** Used to match internally used tokens in template text */
var reToken = /__token__(\d+)/g;
- /** Used to match unescaped characters in strings for inclusion in HTML */
- var reUnescapedHtml = /[&<"']/g;
+ /** Used to match HTML characters */
+ var reUnescapedHtml = /[&<>"']/g;
/** Used to match unescaped characters in compiled string literals */
var reUnescapedString = /['\n\r\t\u2028\u2029\\]/g;
@@ -126,11 +132,24 @@
/**
* Detect the JScript [[DontEnum]] bug:
+ *
* In IE < 9 an objects own properties, shadowing non-enumerable ones, are
* made non-enumerable as well.
*/
var hasDontEnumBug;
+ /**
+ * Detect if `Array#shift` and `Array#splice` augment array-like objects
+ * incorrectly:
+ *
+ * Firefox < 10, IE compatibility mode, and IE < 9 have buggy Array `shift()`
+ * and `splice()` functions that fail to remove the last element, `value[0]`,
+ * of array-like objects even though the `length` property is set to `0`.
+ * The `shift()` method is buggy in IE 8 compatibility mode, while `splice()`
+ * is buggy regardless of mode in IE < 9 and buggy in compatibility mode in IE 9.
+ */
+ var hasObjectSpliceBug;
+
/** Detect if own properties are iterated after inherited properties (IE < 9) */
var iteratesOwnLast;
@@ -138,13 +157,17 @@
var noArgsEnum = true;
(function() {
- var props = [];
+ var object = { '0': 1, 'length': 1 },
+ props = [];
+
function ctor() { this.x = 1; }
ctor.prototype = { 'valueOf': 1, 'y': 1 };
for (var prop in new ctor) { props.push(prop); }
for (prop in arguments) { noArgsEnum = !prop; }
+
hasDontEnumBug = (props + '').length < 4;
iteratesOwnLast = props[0] != 'x';
+ hasObjectSpliceBug = (props.splice.call(object, 0, 1), object[0]);
}(1));
/** Detect if an `arguments` object's [[Class]] is unresolvable (Firefox < 4, IE < 9) */
@@ -155,6 +178,7 @@
/**
* Detect lack of support for accessing string characters by index:
+ *
* IE < 8 can't access characters by index and IE 8 can only access
* characters by index on string literals.
*/
@@ -175,16 +199,25 @@
/* Detect if `Object.keys` exists and is inferred to be fast (IE, Opera, V8) */
var isKeysFast = nativeKeys && /^.+$|true/.test(nativeKeys + !!window.attachEvent);
- /** Detect if sourceURL syntax is usable without erroring */
+ /* Detect if strict mode, "use strict", is inferred to be fast (V8) */
+ var isStrictFast = !isBindFast;
+
+ /**
+ * Detect if sourceURL syntax is usable without erroring:
+ *
+ * The JS engine in Adobe products, like InDesign, will throw a syntax error
+ * when it encounters a single line comment beginning with the `@` symbol.
+ *
+ * The JS engine in Narwhal will generate the function `function anonymous(){//}`
+ * and throw a syntax error.
+ *
+ * In IE, `@` symbols are part of its non-standard conditional compilation support.
+ * The `@cc_on` statement activates its support while the trailing ` !` induces
+ * a syntax error to exlude it. Compatibility modes in IE > 8 require a space
+ * before the `!` to induce a syntax error.
+ * See http://msdn.microsoft.com/en-us/library/121hztk3(v=vs.94).aspx
+ */
try {
- // The JS engine in Adobe products, like InDesign, will throw a syntax error
- // when it encounters a single line comment beginning with the `@` symbol.
- // The JS engine in Narwhal will generate the function `function anonymous(){//}`
- // and throw a syntax error. In IE, `@` symbols are part of its non-standard
- // conditional compilation support. The `@cc_on` statement activates its support
- // while the trailing ` !` induces a syntax error to exlude it. Compatibility
- // modes in IE > 8 require a space before the `!` to induce a syntax error.
- // See http://msdn.microsoft.com/en-us/library/121hztk3(v=vs.94).aspx
var useSourceURL = (Function('//@cc_on !')(), true);
} catch(e){ }
@@ -202,18 +235,30 @@
cloneableClasses[stringClass] = true;
/**
- * Used to escape characters for inclusion in HTML.
- * The `>` and `/` characters don't require escaping in HTML and have no
- * special meaning unless they're part of a tag or an unquoted attribute value
- * http://mathiasbynens.be/notes/ambiguous-ampersands (semi-related fun fact)
+ * Used to convert characters to HTML entities:
+ *
+ * Though the `>` character is escaped for symmetry, characters like `>` and `/`
+ * don't require escaping in HTML and have no special meaning unless they're part
+ * of a tag or an unquoted attribute value.
+ * http://mathiasbynens.be/notes/ambiguous-ampersands (under "semi-related fun fact")
*/
var htmlEscapes = {
'&': '&',
'<': '<',
+ '>': '>',
'"': '"',
"'": '''
};
+ /** Used to convert HTML entities to characters */
+ var htmlUnescapes = {
+ '&': '&',
+ '<': '<',
+ '>': '>',
+ '"': '"',
+ ''': "'"
+ };
+
/** Used to determine if values are of the language type Object */
var objectTypes = {
'boolean': false,
@@ -371,6 +416,12 @@
' } else {' +
' <% } %>' +
+ // Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1
+ // (if the prototype or a property on the prototype has been set)
+ // incorrectly sets a function's `prototype` property [[Enumerable]]
+ // value to `true`. Because of this Lo-Dash standardizes on skipping
+ // the the `prototype` property of functions regardless of its
+ // [[Enumerable]] value.
' <% if (!hasDontEnumBug) { %>\n' +
' var skipProto = typeof iteratee == \'function\' && \n' +
' propertyIsEnumerable.call(iteratee, \'prototype\');\n' +
@@ -394,25 +445,15 @@
' <% } else { %>\n' +
' <%= objectBranch.beforeLoop %>;\n' +
' for (index in iteratee) {' +
- ' <% if (hasDontEnumBug) { %>\n' +
- ' <% if (useHas) { %>if (hasOwnProperty.call(iteratee, index)) {\n <% } %>' +
+ ' <% if (!hasDontEnumBug || useHas) { %>\n if (<%' +
+ ' if (!hasDontEnumBug) { %>!(skipProto && index == \'prototype\')<% }' +
+ ' if (!hasDontEnumBug && useHas) { %> && <% }' +
+ ' if (useHas) { %>hasOwnProperty.call(iteratee, index)<% }' +
+ ' %>) {' +
+ ' <% } %>\n' +
' value = iteratee[index];\n' +
' <%= objectBranch.inLoop %>;\n' +
- ' <% if (useHas) { %>}<% } %>' +
-
- // Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1
- // (if the prototype or a property on the prototype has been set)
- // incorrectly sets a function's `prototype` property [[Enumerable]]
- // value to `true`. Because of this Lo-Dash standardizes on skipping
- // the the `prototype` property of functions regardless of its
- // [[Enumerable]] value.
- ' <% } else { %>\n' +
- ' if (!(skipProto && index == \'prototype\')<% if (useHas) { %> &&\n' +
- ' hasOwnProperty.call(iteratee, index)<% } %>) {\n' +
- ' value = iteratee[index];\n' +
- ' <%= objectBranch.inLoop %>\n' +
- ' }' +
- ' <% } %>\n' +
+ ' <% if (!hasDontEnumBug || useHas) { %>}\n<% } %>' +
' }' +
' <% } %>' +
@@ -477,6 +518,25 @@
'(hasOwnProperty.call(result, prop) ? result[prop]++ : result[prop] = 1)'
};
+ /** Reusable iterator options for `drop` and `pick` */
+ var dropIteratorOptions = {
+ 'useHas': false,
+ 'args': 'object, callback, thisArg',
+ 'init': '{}',
+ 'top':
+ 'var isFunc = typeof callback == \'function\';\n' +
+ 'if (!isFunc) {\n' +
+ ' var props = concat.apply(ArrayProto, arguments)\n' +
+ '} else if (thisArg) {\n' +
+ ' callback = iteratorBind(callback, thisArg)\n' +
+ '}',
+ 'inLoop':
+ 'if (isFunc\n' +
+ ' ? !callback(value, index, object)\n' +
+ ' : indexOf(props, index) < 0\n' +
+ ') result[index] = value'
+ };
+
/** Reusable iterator options for `every` and `some` */
var everyIteratorOptions = {
'init': 'true',
@@ -545,7 +605,7 @@
fromIndex || (fromIndex = 0);
var length = array.length,
- isLarge = (length - fromIndex) >= (largeSize || 30),
+ isLarge = (length - fromIndex) >= (largeSize || largeArraySize),
cache = isLarge ? {} : array;
if (isLarge) {
@@ -631,8 +691,8 @@
if (typeof value == 'string') {
value = { 'array': value, 'object': value };
}
- data.arrayBranch[prop] = value.array;
- data.objectBranch[prop] = value.object;
+ data.arrayBranch[prop] = value.array || '';
+ data.objectBranch[prop] = value.object || '';
} else {
data[prop] = value;
}
@@ -640,7 +700,8 @@
}
// set additional template `data` values
var args = data.args,
- firstArg = /^[^,]+/.exec(args)[0];
+ firstArg = /^[^,]+/.exec(args)[0],
+ useStrict = data.useStrict;
data.firstArg = firstArg;
data.hasDontEnumBug = hasDontEnumBug;
@@ -648,9 +709,9 @@
data.noArgsEnum = noArgsEnum;
data.shadowed = shadowed;
data.useHas = data.useHas !== false;
- data.useStrict = data.useStrict !== false;
+ data.useStrict = useStrict == null ? isStrictFast : useStrict;
- if (!('noCharByIndex' in data)) {
+ if (data.noCharByIndex == null) {
data.noCharByIndex = noCharByIndex;
}
if (!data.exit) {
@@ -729,7 +790,7 @@
}
/**
- * Used by `escape` to escape characters for inclusion in HTML.
+ * Used by `escape` to convert characters to HTML entities.
*
* @private
* @param {String} match The matched character to escape.
@@ -864,6 +925,17 @@
return token + index;
}
+ /**
+ * Used by `unescape` to convert HTML entities to characters.
+ *
+ * @private
+ * @param {String} match The matched character to unescape.
+ * @returns {String} Returns the unescaped character.
+ */
+ function unescapeHtmlChar(match) {
+ return htmlUnescapes[match];
+ }
+
/*--------------------------------------------------------------------------*/
/**
@@ -1097,26 +1169,30 @@
/**
* Creates a shallow clone of `object` excluding the specified properties.
* Property names may be specified as individual arguments or as arrays of
- * property names.
+ * property names. If `callback` is passed, it will be executed for each property
+ * in the `object`, dropping the properties `callback` returns truthy for. The
+ * `callback` is bound to `thisArg` and invoked with 3 arguments; (value, key, object).
*
* @static
* @memberOf _
+ * @alias omit
* @category Objects
* @param {Object} object The source object.
- * @param {Object} [prop1, prop2, ...] The properties to drop.
+ * @param {Function|String} callback|[prop1, prop2, ...] The properties to drop
+ * or the function called per iteration.
+ * @param {Mixed} [thisArg] The `this` binding for the callback.
* @returns {Object} Returns an object without the dropped properties.
* @example
*
* _.drop({ 'name': 'moe', 'age': 40, 'userid': 'moe1' }, 'userid');
* // => { 'name': 'moe', 'age': 40 }
+ *
+ * _.drop({ 'name': 'moe', '_hint': 'knucklehead', '_seed': '96c4eb' }, function(value, key) {
+ * return key.charAt(0) == '_';
+ * });
+ * // => { 'name': 'moe' }
*/
- var drop = createIterator({
- 'useHas': false,
- 'args': 'object',
- 'init': '{}',
- 'top': 'var props = concat.apply(ArrayProto, arguments)',
- 'inLoop': 'if (indexOf(props, index) < 0) result[index] = value'
- });
+ var drop = createIterator(dropIteratorOptions);
/**
* Assigns enumerable properties of the source object(s) to the `destination`
@@ -1755,45 +1831,50 @@
/**
* Creates a shallow clone of `object` composed of the specified properties.
* Property names may be specified as individual arguments or as arrays of
- * property names.
+ * property names. If `callback` is passed, it will be executed for each property
+ * in the `object`, picking the properties `callback` returns truthy for. The
+ * `callback` is bound to `thisArg` and invoked with 3 arguments; (value, key, object).
*
* @static
* @memberOf _
* @category Objects
* @param {Object} object The source object.
- * @param {Object} [prop1, prop2, ...] The properties to pick.
+ * @param {Function|String} callback|[prop1, prop2, ...] The properties to pick
+ * or the function called per iteration.
+ * @param {Mixed} [thisArg] The `this` binding for the callback.
* @returns {Object} Returns an object composed of the picked properties.
* @example
*
* _.pick({ 'name': 'moe', 'age': 40, 'userid': 'moe1' }, 'name', 'age');
* // => { 'name': 'moe', 'age': 40 }
+ *
+ * _.pick({ 'name': 'moe', '_hint': 'knucklehead', '_seed': '96c4eb' }, function(value, key) {
+ * return key.charAt(0) != '_';
+ * });
+ * // => { 'name': 'moe' }
*/
- function pick(object) {
- var result = {};
- if (!object) {
- return result;
- }
- var prop,
- index = 0,
- props = concat.apply(ArrayProto, arguments),
- length = props.length;
-
- // start `index` at `1` to skip `object`
- while (++index < length) {
- prop = props[index];
- if (prop in object) {
- result[prop] = object[prop];
- }
- }
- return result;
- }
+ var pick = createIterator(dropIteratorOptions, {
+ 'top':
+ 'if (typeof callback != \'function\') {\n' +
+ ' var prop,\n' +
+ ' props = concat.apply(ArrayProto, arguments),\n' +
+ ' length = props.length;\n' +
+ ' for (index = 1; index < length; index++) {\n' +
+ ' prop = props[index];\n' +
+ ' if (prop in object) result[prop] = object[prop]\n' +
+ ' }\n' +
+ '} else {\n' +
+ ' if (thisArg) callback = iteratorBind(callback, thisArg)',
+ 'inLoop':
+ 'if (callback(value, index, object)) result[index] = value',
+ 'bottom': '}'
+ });
/**
* Gets the size of `value` by returning `value.length` if `value` is an
* array, string, or `arguments` object. If `value` is an object, size is
* determined by returning the number of own enumerable properties it has.
*
- * @deprecated
* @static
* @memberOf _
* @category Objects
@@ -1876,7 +1957,7 @@
'init': 'false',
'noCharByIndex': false,
'beforeLoop': {
- 'array': 'if (toString.call(iteratee) == stringClass) return collection.indexOf(target) > -1'
+ 'array': 'if (toString.call(collection) == stringClass) return collection.indexOf(target) > -1'
},
'inLoop': 'if (value === target) return true'
});
@@ -1892,8 +1973,8 @@
* @memberOf _
* @category Collections
* @param {Array|Object|String} collection The collection to iterate over.
- * @param {Function|String} callback The function called per iteration or
- * property name to count by.
+ * @param {Function|String} callback|property The function called per iteration
+ * or property name to count by.
* @param {Mixed} [thisArg] The `this` binding for the callback.
* @returns {Object} Returns the composed aggregate object.
* @example
@@ -2008,8 +2089,8 @@
* @memberOf _
* @category Collections
* @param {Array|Object|String} collection The collection to iterate over.
- * @param {Function|String} callback The function called per iteration or
- * property name to group by.
+ * @param {Function|String} callback|property The function called per iteration
+ * or property name to group by.
* @param {Mixed} [thisArg] The `this` binding for the callback.
* @returns {Object} Returns the composed aggregate object.
* @example
@@ -2144,7 +2225,7 @@
'var noaccum = arguments.length < 3;\n' +
'if (thisArg) callback = iteratorBind(callback, thisArg)',
'beforeLoop': {
- 'array': 'if (noaccum) result = collection[++index]'
+ 'array': 'if (noaccum) result = iteratee[++index]'
},
'inLoop': {
'array':
@@ -2268,8 +2349,8 @@
* @memberOf _
* @category Collections
* @param {Array|Object|String} collection The collection to iterate over.
- * @param {Function|String} callback The function called per iteration or
- * property name to sort by.
+ * @param {Function|String} callback|property The function called per iteration
+ * or property name to sort by.
* @param {Mixed} [thisArg] The `this` binding for the callback.
* @returns {Array} Returns a new array of sorted elements.
* @example
@@ -2360,15 +2441,15 @@
var where = createIterator(filterIteratorOptions, {
'args': 'collection, properties',
'top':
- 'var pass, prop, propIndex, props = [];\n' +
+ 'var props = [];\n' +
'forIn(properties, function(value, prop) { props.push(prop) });\n' +
'var propsLength = props.length',
'inLoop':
- 'for (pass = true, propIndex = 0; propIndex < propsLength; propIndex++) {\n' +
+ 'for (var prop, pass = true, propIndex = 0; propIndex < propsLength; propIndex++) {\n' +
' prop = props[propIndex];\n' +
' if (!(pass = value[prop] === properties[prop])) break\n' +
'}\n' +
- 'if (pass) result.push(value)'
+ 'pass && result.push(value)'
});
/*--------------------------------------------------------------------------*/
@@ -2592,17 +2673,19 @@
return result;
}
var value,
+ argsLength = arguments.length,
+ cache = [],
index = -1,
- length = array.length,
- others = slice.call(arguments, 1),
- cache = [];
+ length = array.length;
- while (++index < length) {
+ array: while (++index < length) {
value = array[index];
- if (indexOf(result, value) < 0 &&
- every(others, function(other, index) {
- return (cache[index] || (cache[index] = cachedContains(other)))(value);
- })) {
+ if (indexOf(result, value) < 0) {
+ for (var argsIndex = 1; argsIndex < argsLength; argsIndex++) {
+ if (!(cache[argsIndex] || (cache[argsIndex] = cachedContains(arguments[argsIndex])))(value)) {
+ continue array;
+ }
+ }
result.push(value);
}
}
@@ -3592,8 +3675,8 @@
/*--------------------------------------------------------------------------*/
/**
- * Escapes a string for inclusion in HTML, replacing `&`, `<`, `"`, and `'`
- * characters.
+ * Converts the characters `&`, `<`, `>`, `"`, and `'` in `string` to their
+ * corresponding HTML entities.
*
* @static
* @memberOf _
@@ -3942,6 +4025,24 @@
}
}
+ /**
+ * Converts the HTML entities `&`, `<`, `>`, `"`, and `'`
+ * in `string` to their corresponding characters.
+ *
+ * @static
+ * @memberOf _
+ * @category Utilities
+ * @param {String} string The string to unescape.
+ * @returns {String} Returns the unescaped string.
+ * @example
+ *
+ * _.unescape('Moe, Larry & Curly');
+ * // => "Moe, Larry & Curly"
+ */
+ function unescape(string) {
+ return string == null ? '' : (string + '').replace(reEscapedHtml, unescapeHtmlChar);
+ }
+
/**
* Generates a unique id. If `prefix` is passed, the id will be appended to it.
*
@@ -4061,7 +4162,7 @@
* @memberOf _
* @type String
*/
- lodash.VERSION = '0.5.2';
+ lodash.VERSION = '0.6.0';
// assign static methods
lodash.after = after;
@@ -4143,6 +4244,7 @@
lodash.throttle = throttle;
lodash.times = times;
lodash.toArray = toArray;
+ lodash.unescape = unescape;
lodash.union = union;
lodash.uniq = uniq;
lodash.uniqueId = uniqueId;
@@ -4165,6 +4267,7 @@
lodash.include = contains;
lodash.inject = reduce;
lodash.methods = functions;
+ lodash.omit = drop;
lodash.select = filter;
lodash.tail = rest;
lodash.take = first;
@@ -4195,13 +4298,9 @@
var value = this._wrapped;
func.apply(value, arguments);
- // Firefox < 10, IE compatibility mode, and IE < 9 have buggy Array
- // `shift()` and `splice()` functions that fail to remove the last element,
- // `value[0]`, of array-like objects even though the `length` property is
- // set to `0`. The `shift()` method is buggy in IE 8 compatibility mode,
- // while `splice()` is buggy regardless of mode in IE < 9 and buggy in
- // compatibility mode in IE 9.
- if (value.length === 0) {
+ // avoid array-like object bugs with `Array#shift` and `Array#splice` in
+ // Firefox < 10 and IE < 9
+ if (hasObjectSpliceBug && value.length === 0) {
delete value[0];
}
if (this._chain) {
diff --git a/lodash.min.js b/lodash.min.js
index 3ba864b0f9..797bd38ddf 100644
--- a/lodash.min.js
+++ b/lodash.min.js
@@ -1,41 +1,41 @@
/*!
- Lo-Dash 0.5.2 lodash.com/license
+ Lo-Dash 0.6.0 lodash.com/license
Underscore.js 1.3.3 github.com/documentcloud/underscore/blob/master/LICENSE
*/
-;(function(e,t){"use strict";function s(e){return new o(e)}function o(e){if(e&&e._wrapped)return e;this._wrapped=e}function u(e,t,n){t||(t=0);var r=e.length,i=r-t>=(n||30),s=i?{}:e;if(i)for(var o=t-1;++o-1&&j===j>>>0){"),u.o&&(t+="if(x.call(h)==v){h=h.split('')}"),t+=u.c.d+";while(++gn;n++)t+="g='"+u.p[n]+"';if(","constructor"==u.p[n]&&(t+="!(d&&d.prototype===h)&&"),t+="e.call(h,g)){y=h[g];"+u.m.i+"}"}if(u.c||u.n)t+="}"}return t+=u.e+";return s",Function("D,E,F,I,c,K,e,f,N,P,R,T,U,i,X,Y,k,p,u,v,x","var G=function("+e+"){"+t+"};return G")(Ht,I,M,f,st,Zt,ot,_,C,b,Jt,w,p,d,wt,Ft,dt,at,ft,St,lt)}function f(e,n){var r=e.b,i=n.b,e=e.a,n=n.a;return e===t?1:n===t?-1:en?1:r";var n=it.length;return it[n]="'+__e("+t+")+'"
-,rt+n}function g(e,t,n,i){return i?(e=it.length,it[e]="';"+i+";__p+='",rt+e):t?m(r,t):y(r,n)}function y(e,t){if(e&&V.test(t))return"";var n=it.length;return it[n]="'+((__t=("+t+"))==null?'':__t)+'",rt+n}function b(e){return lt.call(e)==vt}function w(e){return"function"==typeof e}function E(e,t,s,o,u){if(e==r)return e;s&&(t=i),u||(u={d:r}),u.d==r&&(u.d=!(!q.clone&&!U.clone&&!z.clone));if(((s=Ft[typeof e])||u.d)&&e.clone&&w(e.clone))return u.d=r,e.clone(t);if(s){var a=lt.call(e);if(!Bt[a
-]||Lt&&b(e))return e;var f=a==mt,s=f||(a==wt?p(e,n):s)}if(!s||!t)return s?f?ft.call(e):Yt({},e):e;s=e.constructor;switch(a){case gt:return new s(e==n);case yt:return new s(+e);case bt:case St:return new s(e);case Et:return s(e.source,Q.exec(e))}o||(o=[]);for(a=o.length;a--;)if(o[a].c==e)return o[a].d;var a=e.length,l=f?s(a):{};o.push({d:l,c:e});if(f)for(f=-1;++f++u;)if(c=nt[u],ot.call(e,c)&&(!ot.call(t,c)||!S(e[c],t[c],s,o)))return i;return n}function x(e,t,n,r){if(!e)return n;var i=e.length,s=3>arguments.length;r&&(t=d(t,r));if(-1>>0){var o=Ot&<.call(e)==St?e.split(""):e;for(i&&s&&(n=o[--i]);i--;)n=t(n,o[i],i,e);return n}o=rn(e);for((i=o.length)&&s&&(n=e[o[--i]]);i--;)s=o[i],n=t(n,e[s],s,e);return n}function T(e,t,n){if(e)return t==r||n?e[0]:ft.call(e,0,t)}function N(e,t){var n=[];if(!e)return n;for(var r,i=-1,s=e.length
-;++in?Math.max(0,i+n):n)-1}for(;++ri&&(i=e[s]);return i}for(n&&(t=d(t,n));++sr&&(r=n,i=e[s]);return i}function L(e,t,n){return e?ft.call(e,t==r||n?1:t):[]}function A(e,t,n,r){if(!
-e)return 0;var i=0,s=e.length;if(n){r&&(n=M(n,r));for(t=n(t);i>>1,n(e[r])>>1,e[r]C(a,r))a.push(r),s.push(e[o]);return s}function M(e,t){function n(){var o=arguments,u=t;return i||(e=t[r]),s.length&&(o=o.length?s.concat(ft.call(o)):s),this instanceof n?(v.prototype=
-e.prototype,u=new v,(o=e.apply(u,o))&&Ft[typeof o]?o:u):e.apply(u,o)}var r,i=w(e);if(i){if(Dt||ct&&2|{(\/]|\[\D|\b(?:delete|in|instanceof|new|typeof|void)\b/,$=/\b__p\+='';/g,J=/\b(__p\+=)''\+/g,K=/(__e\(.*?\)|\b__t\))\+'';/g,Q=/\w*$/,G=/(?:__e|__t=)\(\s*(?![\d\s"']|this\.)/g,Y=RegExp("^"+(R.valueOf+"").replace(/[.*+?^=!:${}()|[\]\/\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),Z=/__token__(\d+)/g,et=/[&<"']/g
-,tt=/['\n\r\t\u2028\u2029\\]/g,nt="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),rt="__token__",it=[],st=I.concat,ot=R.hasOwnProperty,ut=I.push,at=R.propertyIsEnumerable,ft=I.slice,lt=R.toString,ct=Y.test(ct=ft.bind)&&ct,ht=Y.test(ht=Array.isArray)&&ht,pt=e.isFinite,dt=Y.test(dt=Object.keys)&&dt,vt="[object Arguments]",mt="[object Array]",gt="[object Boolean]",yt="[object Date]",bt="[object Number]",wt="[object Object]",Et="[object RegExp]"
-,St="[object String]",xt=e.clearTimeout,Tt=e.setTimeout,Nt,Ct,kt=n;(function(){function e(){this.x=1}var t=[];e.prototype={valueOf:1,y:1};for(var n in new e)t.push(n);for(n in arguments)kt=!n;Nt=4>(t+"").length,Ct="x"!=t[0]})(1);var Lt=!b(arguments),At="x"!=ft.call("x")[0],Ot="xx"!="x"[0]+Object("x")[0];try{var Mt=("[object Object]",lt.call(e.document||0)==wt)}catch(_t){}var Dt=ct&&/\n|Opera/.test(ct+lt.call(e.opera)),Pt=dt&&/^.+$|true/.test(dt+!!e.attachEvent),Ht={"[object Arguments]":n,"[object Array]"
-:n,"[object Boolean]":i,"[object Date]":i,"[object Function]":i,"[object Number]":i,"[object Object]":i,"[object RegExp]":i,"[object String]":n},Bt={"[object Arguments]":i,"[object Array]":n,"[object Boolean]":n,"[object Date]":n,"[object Function]":i,"[object Number]":n,"[object Object]":n,"[object RegExp]":n,"[object String]":n},jt={"&":"&","<":"<",'"':""","'":"'"},Ft={"boolean":i,"function":n,object:n,number:i,string:i,"undefined":i,unknown:n},It={"\\":"\\","'":"'","\n":"n","\r"
-:"r"," ":"t","\u2028":"u2028","\u2029":"u2029"};s.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""};var qt={a:"b,a,w",j:"b",q:"if(!a)a=f;else if(w)a=i(a,w)",i:"if(a(y,g,b)===false)return s"},Rt={j:"{}",q:"var o;if(typeof a!='function'){var ii=a;a=function(y){return y[ii]}}else if(w)a=i(a,w)",i:"o=a(y,g,b);(e.call(s,o)?s[o]++:s[o]=1)"},Ut={j:"true",i:"if(!a(y,g,b))return!s"},zt={r:i,s:i,a:"l",j:"l",q:"for(var B=1,C=arguments.length;B-1&&j===j>>>0&&T(y.splice)))return!j",i:{l:"return false"}}),rn=dt?function(e){var t=typeof e;return"function"==t&&at.call(e,"prototype")?Kt(e):e&&Ft[t]?dt(e):[]}:Kt,sn=a(zt,{a:"l,ee,O,ff",q:"var J,L,Q,gg,dd=O==U;if(!dd)ff=[];for(var B=1,C=dd?2:arguments.length;B-1"},i:"if(y===hh)return true"}),an=a(qt,Rt),fn=a(qt,Ut),ln=a(qt,Wt),cn=a(qt,Xt,{j:"",i:"if(a(y,g,b))return y"}),hn=a(qt,Xt),pn=a(qt,Rt,{i:"o=a(y,g,b);(e.call(s,o)?s[o]:s[o]=[]).push(y)"
-}),dn=a($t,{a:"b,V",q:"var A=u.call(arguments,2),S=typeof V=='function'",i:{b:"s[g]=(S?V:y[V]).apply(y,A)",l:"s"+(Pt?"[m]=":".push")+"((S?V:y[V]).apply(y,A))"}}),vn=a(qt,$t),mn=a($t,{a:"b,bb",i:{b:"s[g]=y[bb]",l:"s"+(Pt?"[m]=":".push")+"(y[bb])"}}),gn=a({a:"b,a,z,w",j:"z",q:"var W=arguments.length<3;if(w)a=i(a,w)",d:{b:"if(W)s=b[++g]"},i:{b:"s=a(s,y,g,b)",l:"s=W?(W=false,y):a(s,y,g,b)"}}),yn=a(qt,Wt,{i:"!"+Wt.i}),bn=a(qt,Ut,{j:"false",i:Ut.i.replace("!","")}),wn=a(qt,Rt,$t,{i:{b:"s[g]={a:a(y,g,b),b:g,d:y}"
-,l:"s"+(Pt?"[m]=":".push")+"({a:a(y,g,b),b:g,d:y})"},e:"s.sort(I);j=s.length;while(j--)s[j]=s[j].d"}),En=a(Wt,{a:"b,aa",q:"var Z,o,q,r=[];K(aa,function(y,o){r.push(o)});var cc=r.length",i:"for(Z=true,q=0;q1){for(var g=1;ge?t():function(){if(1>--e)return t.apply
-(this,arguments)}},s.bind=M,s.bindAll=Sn,s.chain=function(e){return e=new o(e),e._chain=n,e},s.clone=E,s.compact=function(e){var t=[];if(!e)return t;for(var n=-1,r=e.length;++nC(t,n)&&fn(s,function(e,t){return(o[t]||(o[t]=u(e)))(n)})&&t.push(n);return t},s.invoke=dn,s.isArguments=b,s.isArray=Jt,s.isBoolean=function(e){return e===n||e===i||lt.
-call(e)==gt},s.isElement=function(e){return e?1===e.nodeType:i},s.isEmpty=nn,s.isEqual=S,s.isFinite=function(e){return pt(e)&<.call(e)==bt},s.isFunction=w,s.isNaN=function(e){return lt.call(e)==bt&&e!=+e},s.isNull=function(e){return e===r},s.isObject=function(e){return e?Ft[typeof e]:i},s.isUndefined=function(e){return e===t},s.keys=rn,s.last=function(e,t,n){if(e){var i=e.length;return t==r||n?e[i-1]:ft.call(e,-t||i)}},s.lastIndexOf=function(e,t,n){if(!e)return-1;var r=e.length;for(n&&"number"==typeof
-n&&(r=(0>n?Math.max(0,r+n):Math.min(n,r-1))+1);r--;)if(e[r]===t)return r;return-1},s.map=vn,s.max=k,s.memoize=function(e,t){var n={};return function(){var r=t?t.apply(this,arguments):arguments[0];return ot.call(n,r)?n[r]:n[r]=e.apply(this,arguments)}},s.merge=sn,s.min=function(e,t,n){var r=Infinity,i=r;if(!e)return i;var s=-1,o=e.length;if(!t){for(;++s>>0&&w(e.splice)?n:rn(e).length},s.some=
-bn,s.sortBy=wn,s.sortedIndex=A,s.tap=function(e,t){return t(e),e},s.template=function(e,t,n){n||(n={});var e=e+"",o,u;o=n.escape;var a=n.evaluate,f=n.interpolate,h=s.templateSettings,p=n=n.variable||h.variable;o==r&&(o=h.escape),a==r&&(a=h.evaluate||i),f==r&&(f=h.interpolate),o&&(e=e.replace(o,m)),f&&(e=e.replace(f,y)),a!=P&&(P=a,j=RegExp("|"+(a?"|"+a.source:""),"g")),o=it.length,e=e.replace(j,g),o=o!=it.length,e="__p += '"+e.replace(tt,c).replace(Z,l)+"';",it.
-length=0,p||(n=H||"obj",o?e="with("+n+"){"+e+"}":(n!=H&&(H=n,B=RegExp("(\\(\\s*)"+n+"\\."+n+"\\b","g")),e=e.replace(G,"$&"+n+".").replace(B,"$1__d"))),e=(o?e.replace($,""):e).replace(J,"$1").replace(K,"$1;"),e="function("+n+"){"+(p?"":n+"||("+n+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":(p?"":",__d="+n+"."+n+"||"+n)+";")+e+"return __p}";try{u=Function("_","return "+e)(s)}catch(d){u=function(){throw d}}return t?u(t):(u.source=
-e,u)},s.throttle=function(e,t){function n(){a=new Date,u=r,e.apply(o,i)}var i,s,o,u,a=0;return function(){var r=new Date,f=t-(r-a);return i=arguments,o=this,0>=f?(a=r,s=e.apply(o,i)):u||(u=Tt(n,f)),s}},s.times=function(e,t,n){var r=-1;if(n)for(;++r>>0?(At?lt.call(e)==St:"string"==typeof e)?e.split(""):ft.call(e):on(e)},s.union=function(){for(var e=-1
-,t=[],n=st.apply(t,arguments),r=n.length;++eC(t,n[e])&&t.push(n[e]);return t},s.uniq=O,s.uniqueId=function(e){var t=W++;return e?e+t:t},s.values=on,s.where=En,s.without=function(e){var t=[];if(!e)return t;for(var n=-1,r=e.length,i=u(arguments,1,20);++n=(n||V),s=i?{}:e;if(i)for(var o=t-1;++o-1&&l===l>>>0){"),u.o&&(t+="if(z.call(j)==x){j=j.split('')}"),t+=u.c.d+";while(++in;n++)t+="i='"+u.p[n]+"';if(","constructor"==u.p[n]&&(t+="!(f&&f.prototype===j)&&"),t+="g.call(j,i)){A=j[i];"+u.m.i+"}"}if(u.c||u.n)t+="}"}return t+=u.e+";return u",Function("D,E,F,I,e,K,g,h,N,P,R,T,U,k,X,Y,m,r,w,x,z","var G=function("+e+"){"+t+"};return G")(qt,q,_,f,at,un,ft,D,k,w,tn,E,p,d,xt,Wt,gt,ct,ht,Nt,pt)}function f(e,n){var r=e.b,i=n.b,e=e.a,n=n.a;return e===t?1:n===t?-1:en?1:r";var n=ut.length;return ut[n]="'+__e("+
+t+")+'",ot+n}function g(e,t,n,i){return i?(e=ut.length,ut[e]="';"+i+";__p+='",ot+e):t?m(r,t):y(r,n)}function y(e,t){if(e&&J.test(t))return"";var n=ut.length;return ut[n]="'+((__t=("+t+"))==null?'':__t)+'",ot+n}function b(e){return zt[e]}function w(e){return pt.call(e)==yt}function E(e){return"function"==typeof e}function S(e,t,s,o,u){if(e==r)return e;s&&(t=i),u||(u={d:r}),u.d==r&&(u.d=!(!R.clone&&!z.clone&&!W.clone));if(((s=Wt[typeof e])||u.d)&&e.clone&&E(e.clone))return u.d=r,e.clone(
+t);if(s){var a=pt.call(e);if(!Rt[a]||_t&&w(e))return e;var f=a==bt,s=f||(a==xt?p(e,n):s)}if(!s||!t)return s?f?ht.call(e):on({},e):e;s=e.constructor;switch(a){case wt:return new s(e==n);case Et:return new s(+e);case St:case Nt:return new s(e);case Tt:return s(e.source,Z.exec(e))}o||(o=[]);for(a=o.length;a--;)if(o[a].c==e)return o[a].d;var a=e.length,l=f?s(a):{};o.push({d:l,c:e});if(f)for(f=-1;++f++u;)if(c=st[u],ft.call(e,c)&&(!ft.call(t,c)||!x(e[c],t[c],s,o)))return i;return n}function T(e,t,n,r){if(!e)return n;var i=e.length,s=3>arguments.length;r&&(t=d(t,r));if(-1>>0){var o=Pt&&pt.call(e)==Nt?e.split(""):e;for(i&&s&&(n=o[--i]);i--;)n=t(n,o[i],i,e);return n}o=cn(e);for((i=o.length)&&s&&(n=e[o[--i]]);i--;)s=o[i],n=t(n,e[s],s,e);return n}function N(e,t,n){if(e)return t==r||n?e[0]:ht.call(e,0,t)}function C(e,t){var n=[];if(!
+e)return n;for(var r,i=-1,s=e.length;++in?Math.max(0,i+n):n)-1}for(;++ri&&(i=e[s]);return i}for(n&&(t=d(t,n));++sr&&(r=n,i=e[s]);return i}function A(e,t,n){return e?ht.call(e,t==
+r||n?1:t):[]}function O(e,t,n,r){if(!e)return 0;var i=0,s=e.length;if(n){r&&(n=_(n,r));for(t=n(t);i>>1,n(e[r])>>1,e[r]k(a,r))a.push(r),s.push(e[o]);return s}function _(e,t){function n(){var o=arguments,u=t;return i||(e=t[r]),s.length&&(o=o.length?s.concat(
+ht.call(o)):s),this instanceof n?(v.prototype=e.prototype,u=new v,(o=e.apply(u,o))&&Wt[typeof o]?o:u):e.apply(u,o)}var r,i=E(e);if(i){if(jt||dt&&2|{(\/]|\[\D|\b(?:delete|in|instanceof|new|typeof|void)\b/,K=/&(?:amp|lt|gt|quot|#x27);/g,Q=/\b__p\+='';/g,G=/\b(__p\+=)''\+/g,Y=/(__e\(.*?\)|\b__t\))\+'';/g,Z=/\w*$/,et=/(?:__e|__t=)\(\s*(?![\d\s"']|this\.)/g,tt=RegExp("^"+(U.valueOf+"").replace(/[.*+?^=!:${}()|[\]\/\\]/g
+,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),nt=/__token__(\d+)/g,rt=/[&<>"']/g,it=/['\n\r\t\u2028\u2029\\]/g,st="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),ot="__token__",ut=[],at=q.concat,ft=U.hasOwnProperty,lt=q.push,ct=U.propertyIsEnumerable,ht=q.slice,pt=U.toString,dt=tt.test(dt=ht.bind)&&dt,vt=tt.test(vt=Array.isArray)&&vt,mt=e.isFinite,gt=tt.test(gt=Object.keys)&>,yt="[object Arguments]",bt="[object Array]",wt="[object Boolean]"
+,Et="[object Date]",St="[object Number]",xt="[object Object]",Tt="[object RegExp]",Nt="[object String]",Ct=e.clearTimeout,kt=e.setTimeout,Lt,At,Ot,Mt=n;(function(){function e(){this.x=1}var t={0:1,length:1},n=[];e.prototype={valueOf:1,y:1};for(var r in new e)n.push(r);for(r in arguments)Mt=!r;Lt=4>(n+"").length,Ot="x"!=n[0],At=(n.splice.call(t,0,1),t[0])})(1);var _t=!w(arguments),Dt="x"!=ht.call("x")[0],Pt="xx"!="x"[0]+Object("x")[0];try{var Ht=("[object Object]",pt.call(e.document||0)==xt)}catch(Bt)
+{}var jt=dt&&/\n|Opera/.test(dt+pt.call(e.opera)),Ft=gt&&/^.+$|true/.test(gt+!!e.attachEvent),It=!jt,qt={"[object Arguments]":n,"[object Array]":n,"[object Boolean]":i,"[object Date]":i,"[object Function]":i,"[object Number]":i,"[object Object]":i,"[object RegExp]":i,"[object String]":n},Rt={"[object Arguments]":i,"[object Array]":n,"[object Boolean]":n,"[object Date]":n,"[object Function]":i,"[object Number]":n,"[object Object]":n,"[object RegExp]":n,"[object String]":n},Ut={"&":"&","<":"<"
+,">":">",'"':""","'":"'"},zt={"&":"&","<":"<",">":">",""":'"',"'":"'"},Wt={"boolean":i,"function":n,object:n,number:i,string:i,"undefined":i,unknown:n},Xt={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"};s.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""};var Vt={a:"d,c,y",j:"d",q:"if(!c)c=h;else if(y)c=k(c,y)",i:"if(c(A,i,d)===false)return u"},$t={j:"{}",q:"var q;if(typeof c!='function'){var ii=c;c=function(A){return A[ii]}}else if(y)c=k(c,y)"
+,i:"q=c(A,i,d);(g.call(u,q)?u[q]++:u[q]=1)"},Jt={r:i,a:"n,c,y",j:"{}",q:"var S=typeof c=='function';if(!S){var t=e.apply(E,arguments)}else if(y)c=k(c,y)",i:"if(S?!c(A,i,n):N(t,i)<0)u[i]=A"},Kt={j:"true",i:"if(!c(A,i,d))return!u"},Qt={r:i,s:i,a:"n",j:"n",q:"for(var a=1,b=arguments.length;a-1&&l===l>>>0&&T(A.splice)))return!l"
+,i:{l:"return false"}}),cn=gt?function(e){var t=typeof e;return"function"==t&&ct.call(e,"prototype")?nn(e):e&&Wt[t]?gt(e):[]}:nn,hn=a(Qt,{a:"n,ee,O,ff",q:"var J,L,Q,gg,dd=O==U;if(!dd)ff=[];for(var a=1,b=dd?2:arguments.length;a-1"},i:"if(A===hh)return true"}),mn=a(Vt,$t),gn=a(Vt,Kt),yn=a(Vt,Gt),bn=a(Vt,Yt,{j:"",i:"if(c(A,i,d))return A"}),wn=a(Vt,Yt),En=a(Vt,$t,{i:"q=c(A,i,d);(g.call(u,q)?u[q]:u[q]=[]).push(A)"}),Sn=a(en,{a:"d,V",q:"var C=w.call(arguments,2),S=typeof V=='function'",i:{b:"u[i]=(S?V:A[V]).apply(A,C)",l:"u"+(Ft?"[o]=":".push")+"((S?V:A[V]).apply(A,C))"}}),xn=a(Vt,en),Tn=
+a(en,{a:"d,bb",i:{b:"u[i]=A[bb]",l:"u"+(Ft?"[o]=":".push")+"(A[bb])"}}),Nn=a({a:"d,c,B,y",j:"B",q:"var W=arguments.length<3;if(y)c=k(c,y)",d:{b:"if(W)u=j[++i]"},i:{b:"u=c(u,A,i,d)",l:"u=W?(W=false,A):c(u,A,i,d)"}}),Cn=a(Vt,Gt,{i:"!"+Gt.i}),kn=a(Vt,Kt,{j:"false",i:Kt.i.replace("!","")}),Ln=a(Vt,$t,en,{i:{b:"u[i]={a:c(A,i,d),b:i,d:A}",l:"u"+(Ft?"[o]=":".push")+"({a:c(A,i,d),b:i,d:A})"},e:"u.sort(I);l=u.length;while(l--)u[l]=u[l].d"}),An=a(Gt,{a:"d,aa",q:"var t=[];K(aa,function(A,q){t.push(q)});var cc=t.length"
+,i:"for(var q,Z=true,s=0;s1){for(var i=1;ie?t():function(){if(1>--e)return t.apply(this,arguments)}},s.bind=_,s.bindAll=On,s.chain=function(e){return e=new o(e),e._chain=n,e},s.clone=S,s.compact=function(e){var t=[];if(!e)return t;for(var n=-1,r=e.length;++nk(t,n)){for(var a=1;an?Math.max(0,r+n):Math.min(n,r-1))+1);r--;)if(e[r]===t)return r;return-1},s.map=xn,s.max=L,s.memoize=function(e,t){var n={};return function(){var r=
+t?t.apply(this,arguments):arguments[0];return ft.call(n,r)?n[r]:n[r]=e.apply(this,arguments)}},s.merge=hn,s.min=function(e,t,n){var r=Infinity,i=r;if(!e)return i;var s=-1,o=e.length;if(!t){for(;++s>>0&&E(e.splice)?n:cn(e).length},s.some=kn,s.sortBy=Ln,s.sortedIndex=O,s.tap=function(e,t){return t(e),e},s.template=function(e,t,n){n||(n={});var e=e+"",o,u;o=n.escape;var a=n.evaluate,f=n.interpolate,h=s.templateSettings,p=n=n.variable||h.variable;o==r&&(o=h.escape),a==r&&(a=h.evaluate||i),f==r&&(f=h.interpolate),o&&(e=e.replace
+(o,m)),f&&(e=e.replace(f,y)),a!=H&&(H=a,F=RegExp("|"+(a?"|"+a.source:""),"g")),o=ut.length,e=e.replace(F,g),o=o!=ut.length,e="__p += '"+e.replace(it,c).replace(nt,l)+"';",ut.length=0,p||(n=B||"obj",o?e="with("+n+"){"+e+"}":(n!=B&&(B=n,j=RegExp("(\\(\\s*)"+n+"\\."+n+"\\b","g")),e=e.replace(et,"$&"+n+".").replace(j,"$1__d"))),e=(o?e.replace(Q,""):e).replace(G,"$1").replace(Y,"$1;"),e="function("+n+"){"+(p?"":n+"||("+n+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"
+:(p?"":",__d="+n+"."+n+"||"+n)+";")+e+"return __p}";try{u=Function("_","return "+e)(s)}catch(d){u=function(){throw d}}return t?u(t):(u.source=e,u)},s.throttle=function(e,t){function n(){a=new Date,u=r,e.apply(o,i)}var i,s,o,u,a=0;return function(){var r=new Date,f=t-(r-a);return i=arguments,o=this,0>=f?(a=r,s=e.apply(o,i)):u||(u=kt(n,f)),s}},s.times=function(e,t,n){var r=-1;if(n)for(;++r>>0?(Dt?pt.call(e)==Nt:"string"==typeof e)?e.split(""):ht.call(e):dn(e)},s.unescape=function(e){return e==r?"":(e+"").replace(K,b)},s.union=function(){for(var e=-1,t=[],n=at.apply(t,arguments),r=n.length;++ek(t,n[e])&&t.push(n[e]);return t},s.uniq=M,s.uniqueId=function(e){var t=X++;return e?e+t:t},s.values=dn,s.where=An,s.without=function(e){var t=[];if(!e)return t;for(var n=-1,r=e.length,i=u(arguments,1,20);++n 4 ? 'hasOwnProperty' : 'constructor';
});
- deepEqual(actual.constructor, 1);
- deepEqual(actual.hasOwnProperty, 2);
+ equal(actual.constructor, 1);
+ equal(actual.hasOwnProperty, 2);
});
}());
@@ -336,11 +336,11 @@
QUnit.module('lodash.drop');
(function() {
- var object = { 'a': 1, 'b': 2, 'c': 3 },
+ var object = { 'a': 1, 'b': 2 },
actual = { 'b': 2 };
test('should accept individual property names', function() {
- deepEqual(_.drop(object, 'a', 'c'), actual);
+ deepEqual(_.drop(object, 'a'), actual);
});
test('should accept an array of property names', function() {
@@ -355,7 +355,38 @@
function Foo() {}
Foo.prototype = object;
- deepEqual(_.drop(new Foo, 'a', 'c'), actual);
+ deepEqual(_.drop(new Foo, 'a'), actual);
+ });
+
+ test('should work with a `callback` argument', function() {
+ var actual = _.drop(object, function(value) {
+ return value == 1;
+ });
+
+ deepEqual(actual, { 'b': 2 });
+ });
+
+ test('should pass the correct `callback` arguments', function() {
+ var args,
+ lastKey = _.keys(object).pop();
+
+ var expected = lastKey == 'b'
+ ? [1, 'a', object]
+ : [2, 'b', object];
+
+ _.drop(object, function() {
+ args || (args = slice.call(arguments));
+ });
+
+ deepEqual(args, expected);
+ });
+
+ test('should correct set the `this` binding', function() {
+ var actual = _.drop(object, function(value) {
+ return value == this.a;
+ }, { 'a': 1 });
+
+ deepEqual(actual, { 'b': 2 });
});
}());
@@ -364,15 +395,11 @@
QUnit.module('lodash.escape');
(function() {
- test('should not escape the ">" character', function() {
- equal(_.escape('>'), '>');
- });
-
test('should not escape the "/" character', function() {
equal(_.escape('/'), '/');
});
- test('should return empty string when passed `null` or `undefined`', function() {
+ test('should return an empty string when passed `null` or `undefined`', function() {
equal(_.escape(null), '');
equal(_.escape(undefined), '');
});
@@ -620,7 +647,7 @@
deepEqual(actual, { '4': [4.2], '6': [6.1, 6.4] });
});
- test('should only add elements to own, not inherited, properties', function() {
+ test('should only add values to own, not inherited, properties', function() {
var actual = _.groupBy([4.2, 6.1, 6.4], function(num) {
return Math.floor(num) > 4 ? 'hasOwnProperty' : 'constructor';
});
@@ -1057,11 +1084,11 @@
});
test('should not alter the `this` binding of either function', function() {
- var o = { 'cat': 'nip' },
+ var object = { 'cat': 'nip' },
func = function() { return this.cat; };
- equal(_.partial(_.bind(func, o))(), o.cat);
- equal(_.bind(_.partial(func), o)(), o.cat);
+ equal(_.partial(_.bind(func, object))(), object.cat);
+ equal(_.bind(_.partial(func), object)(), object.cat);
});
}());
@@ -1070,12 +1097,45 @@
QUnit.module('lodash.pick');
(function() {
+ var object = { 'a': 1, 'b': 2 };
+
test('should iterate over inherited properties', function() {
function Foo() {}
- Foo.prototype = { 'a': 1, 'b': 2, 'c': 3 };
+ Foo.prototype = object;
deepEqual(_.pick(new Foo, 'b'), { 'b': 2 });
});
+
+ test('should work with a `callback` argument', function() {
+ var actual = _.pick(object, function(value) {
+ return value == 2;
+ });
+
+ deepEqual(actual, { 'b': 2 });
+ });
+
+ test('should pass the correct `callback` arguments', function() {
+ var args,
+ lastKey = _.keys(object).pop();
+
+ var expected = lastKey == 'b'
+ ? [1, 'a', object]
+ : [2, 'b', object];
+
+ _.pick(object, function() {
+ args || (args = slice.call(arguments));
+ });
+
+ deepEqual(args, expected);
+ });
+
+ test('should correct set the `this` binding', function() {
+ var actual = _.pick(object, function(value) {
+ return value == this.b;
+ }, { 'b': 2 });
+
+ deepEqual(actual, { 'b': 2 });
+ });
}());
/*--------------------------------------------------------------------------*/
@@ -1115,17 +1175,41 @@
/*--------------------------------------------------------------------------*/
+ QUnit.module('lodash.reduce');
+
+ (function() {
+ _.each({
+ 'literal': 'abc',
+ 'object': Object('abc')
+ },
+ function(collection, key) {
+ test('should work with a string ' + key + ' for `collection` (test in IE < 9)', function() {
+ var args;
+
+ var actual = _.reduce(collection, function(accumulator, value) {
+ args || (args = slice.call(arguments));
+ return accumulator + value;
+ });
+
+ deepEqual(args, ['a', 'b', 1, collection]);
+ equal(actual, 'abc');
+ });
+ });
+ }());
+
+ /*--------------------------------------------------------------------------*/
+
QUnit.module('lodash.reduceRight');
(function() {
test('should pass the correct `callback` arguments when iterating an object', function() {
var args,
- object = { 'a': 'A', 'b': 'B' },
+ object = { 'a': 1, 'b': 2 },
lastKey = _.keys(object).pop();
- var expected = lastKey == 'a'
- ? ['A', 'B', 'b', object]
- : ['B', 'A', 'a', object];
+ var expected = lastKey == 'b'
+ ? [2, 1, 'a', object]
+ : [1, 2, 'b', object];
_.reduceRight(object, function() {
args || (args = slice.call(arguments));
@@ -1136,12 +1220,12 @@
test('should treat array-like object with invalid `length` as a regular object', function() {
var args,
- object = { 'a': 'A', 'length': -1 },
+ object = { 'a': 1, 'length': -1 },
lastKey = _.keys(object).pop();
- var expected = lastKey == 'a'
- ? ['A', '-1', 'length', object]
- : [-1, 'A', 'a', object];
+ var expected = lastKey == 'length'
+ ? [-1, 1, 'a', object]
+ : [1, -1, 'length', object];
_.reduceRight(object, function() {
args || (args = slice.call(arguments));
@@ -1452,6 +1536,32 @@
/*--------------------------------------------------------------------------*/
+ QUnit.module('lodash.unescape');
+
+ (function() {
+ var escaped = '<h1>Moe's famous "death by chocolate" brownies & cake<\/h1>',
+ unescaped = '