diff --git a/README.md b/README.md
index 6d49f3441..a121e2a94 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# lodash v3.3.0
+# lodash v3.3.1
The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash](https://lodash.com/) exported as [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) modules.
@@ -28,7 +28,7 @@ var array = require('lodash/array');
var chunk = require('lodash/array/chunk');
```
-See the [package source](https://github.com/lodash/lodash/tree/3.3.0-npm) for more details.
+See the [package source](https://github.com/lodash/lodash/tree/3.3.1-npm) for more details.
**Note:**
Don’t assign values to the [special variable](http://nodejs.org/api/repl.html#repl_repl_features) `_` when in the REPL.
@@ -39,8 +39,8 @@ Install [n_](https://www.npmjs.com/package/n_) for a REPL that includes lodash b
lodash is also available in a variety of other builds & module formats.
* npm packages for [modern](https://www.npmjs.com/package/lodash), [compatibility](https://www.npmjs.com/package/lodash-compat), & [per method](https://www.npmjs.com/browse/keyword/lodash-modularized) builds
- * AMD modules for [modern](https://github.com/lodash/lodash/tree/3.3.0-amd) & [compatibility](https://github.com/lodash/lodash-compat/tree/3.3.0-amd) builds
- * ES modules for the [modern](https://github.com/lodash/lodash/tree/3.3.0-es) build
+ * AMD modules for [modern](https://github.com/lodash/lodash/tree/3.3.1-amd) & [compatibility](https://github.com/lodash/lodash-compat/tree/3.3.1-amd) builds
+ * ES modules for the [modern](https://github.com/lodash/lodash/tree/3.3.1-es) build
## Further Reading
@@ -74,7 +74,6 @@ lodash is also available in a variety of other builds & module formats.
* [_.forEach](https://lodash.com/docs#forEach) supports exiting early
* [_.forIn](https://lodash.com/docs#forIn) for iterating all enumerable properties
* [_.forOwn](https://lodash.com/docs#forOwn) for iterating own properties
- * [_.includes](https://lodash.com/docs#includes) accepts a `fromIndex`
* [_.inRange](https://lodash.com/docs#inRange) for checking whether a number is within a given range
* [_.isNative](https://lodash.com/docs#isNative) to check for native functions
* [_.isPlainObject](https://lodash.com/docs#isPlainObject) & [_.toPlainObject](https://lodash.com/docs#toPlainObject) to check for & convert to `Object` objects
@@ -111,6 +110,6 @@ lodash is also available in a variety of other builds & module formats.
## Support
-Tested in Chrome 39-40, Firefox 34-35, IE 6-11, Opera 26-27, Safari 5-8, io.js 1.2.0, Node.js 0.8.28, 0.10.36, & 0.12.0, PhantomJS 1.9.8, RingoJS 0.11, & Rhino 1.7RC5.
+Tested in Chrome 39-40, Firefox 34-35, IE 6-11, Opera 26-27, Safari 5-8, io.js 1.3.0, Node.js 0.8.28, 0.10.36, & 0.12.0, PhantomJS 1.9.8, RingoJS 0.11, & Rhino 1.7RC5.
Automated [browser](https://saucelabs.com/u/lodash) & [CI](https://travis-ci.org/lodash/lodash/) test runs are available. Special thanks to [Sauce Labs](https://saucelabs.com/) for providing automated browser testing.
diff --git a/array/findLastIndex.js b/array/findLastIndex.js
index 0acc46df5..a64b8e1f4 100644
--- a/array/findLastIndex.js
+++ b/array/findLastIndex.js
@@ -37,7 +37,7 @@ var baseCallback = require('../internal/baseCallback');
* // => 2
*
* // using the `_.matches` callback shorthand
- * _.findLastIndex(users, { user': 'barney', 'active': true });
+ * _.findLastIndex(users, { 'user': 'barney', 'active': true });
* // => 0
*
* // using the `_.matchesProperty` callback shorthand
diff --git a/array/indexOf.js b/array/indexOf.js
index 3708b79db..35b68cc42 100644
--- a/array/indexOf.js
+++ b/array/indexOf.js
@@ -26,7 +26,7 @@ var nativeMax = Math.max;
* @example
*
* _.indexOf([1, 2, 1, 2], 2);
- * // => 2
+ * // => 1
*
* // using `fromIndex`
* _.indexOf([1, 2, 1, 2], 2, 2);
diff --git a/array/intersection.js b/array/intersection.js
index f074cfadc..ff7cc166e 100644
--- a/array/intersection.js
+++ b/array/intersection.js
@@ -34,7 +34,7 @@ function intersection() {
var value = arguments[argsIndex];
if (isArray(value) || isArguments(value)) {
args.push(value);
- caches.push(isCommon && value.length >= 120 && createCache(argsIndex && value));
+ caches.push((isCommon && value.length >= 120) ? createCache(argsIndex && value) : null);
}
}
argsLength = args.length;
diff --git a/collection/some.js b/collection/some.js
index 56458b8b3..e256773ae 100644
--- a/collection/some.js
+++ b/collection/some.js
@@ -41,7 +41,7 @@ var arraySome = require('../internal/arraySome'),
* ];
*
* // using the `_.matches` callback shorthand
- * _.some(users, { user': 'barney', 'active': false });
+ * _.some(users, { 'user': 'barney', 'active': false });
* // => false
*
* // using the `_.matchesProperty` callback shorthand
diff --git a/function/debounce.js b/function/debounce.js
index 28cfcff09..5fdf7fce6 100644
--- a/function/debounce.js
+++ b/function/debounce.js
@@ -26,7 +26,7 @@ var nativeMax = Math.max;
* @memberOf _
* @category Function
* @param {Function} func The function to debounce.
- * @param {number} wait The number of milliseconds to delay.
+ * @param {number} [wait=0] The number of milliseconds to delay.
* @param {Object} [options] The options object.
* @param {boolean} [options.leading=false] Specify invoking on the leading
* edge of the timeout.
@@ -84,7 +84,7 @@ function debounce(func, wait, options) {
if (typeof func != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
}
- wait = wait < 0 ? 0 : wait;
+ wait = wait < 0 ? 0 : (+wait || 0);
if (options === true) {
var leading = true;
trailing = false;
diff --git a/function/throttle.js b/function/throttle.js
index 10ea74123..7c30e646b 100644
--- a/function/throttle.js
+++ b/function/throttle.js
@@ -30,7 +30,7 @@ var debounceOptions = {
* @memberOf _
* @category Function
* @param {Function} func The function to throttle.
- * @param {number} wait The number of milliseconds to throttle invocations to.
+ * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
* @param {Object} [options] The options object.
* @param {boolean} [options.leading=true] Specify invoking on the leading
* edge of the timeout.
diff --git a/index.js b/index.js
index ab760a0c8..0a5cce92c 100644
--- a/index.js
+++ b/index.js
@@ -1,9 +1,9 @@
/**
* @license
- * lodash 3.3.0 (Custom Build)
+ * lodash 3.3.1 (Custom Build)
* Build: `lodash modern -d -o ./index.js`
* Copyright 2012-2015 The Dojo Foundation
- * Based on Underscore.js 1.7.0
+ * Based on Underscore.js 1.8.2
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
* Available under MIT license
*/
@@ -13,7 +13,7 @@
var undefined;
/** Used as the semantic version number. */
- var VERSION = '3.3.0';
+ var VERSION = '3.3.1';
/** Used to compose bitmasks for wrapper metadata. */
var BIND_FLAG = 1,
@@ -1804,7 +1804,7 @@
var index = -1,
indexOf = getIndexOf(),
isCommon = indexOf == baseIndexOf,
- cache = isCommon && values.length >= 200 && createCache(values),
+ cache = (isCommon && values.length >= 200) ? createCache(values) : null,
valuesLength = values.length;
if (cache) {
@@ -2624,7 +2624,7 @@
length = array.length,
isCommon = indexOf == baseIndexOf,
isLarge = isCommon && length >= 200,
- seen = isLarge && createCache(),
+ seen = isLarge ? createCache() : null,
result = [];
if (seen) {
@@ -3676,8 +3676,11 @@
} else {
prereq = type == 'string' && index in object;
}
- var other = object[index];
- return prereq && (value === value ? value === other : other !== other);
+ if (prereq) {
+ var other = object[index];
+ return value === value ? value === other : other !== other;
+ }
+ return false;
}
/**
@@ -4403,7 +4406,7 @@
* // => 2
*
* // using the `_.matches` callback shorthand
- * _.findLastIndex(users, { user': 'barney', 'active': true });
+ * _.findLastIndex(users, { 'user': 'barney', 'active': true });
* // => 0
*
* // using the `_.matchesProperty` callback shorthand
@@ -4514,7 +4517,7 @@
* @example
*
* _.indexOf([1, 2, 1, 2], 2);
- * // => 2
+ * // => 1
*
* // using `fromIndex`
* _.indexOf([1, 2, 1, 2], 2, 2);
@@ -4587,7 +4590,7 @@
var value = arguments[argsIndex];
if (isArray(value) || isArguments(value)) {
args.push(value);
- caches.push(isCommon && value.length >= 120 && createCache(argsIndex && value));
+ caches.push((isCommon && value.length >= 120) ? createCache(argsIndex && value) : null);
}
}
argsLength = args.length;
@@ -6655,7 +6658,7 @@
* ];
*
* // using the `_.matches` callback shorthand
- * _.some(users, { user': 'barney', 'active': false });
+ * _.some(users, { 'user': 'barney', 'active': false });
* // => false
*
* // using the `_.matchesProperty` callback shorthand
@@ -7191,7 +7194,7 @@
* @memberOf _
* @category Function
* @param {Function} func The function to debounce.
- * @param {number} wait The number of milliseconds to delay.
+ * @param {number} [wait=0] The number of milliseconds to delay.
* @param {Object} [options] The options object.
* @param {boolean} [options.leading=false] Specify invoking on the leading
* edge of the timeout.
@@ -7249,7 +7252,7 @@
if (typeof func != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
}
- wait = wait < 0 ? 0 : wait;
+ wait = wait < 0 ? 0 : (+wait || 0);
if (options === true) {
var leading = true;
trailing = false;
@@ -7770,7 +7773,7 @@
* @memberOf _
* @category Function
* @param {Function} func The function to throttle.
- * @param {number} wait The number of milliseconds to throttle invocations to.
+ * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
* @param {Object} [options] The options object.
* @param {boolean} [options.leading=true] Specify invoking on the leading
* edge of the timeout.
@@ -10087,10 +10090,10 @@
* var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
* compiled.source;
* // => function(data) {
- * var __t, __p = '';
- * __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
- * return __p;
- * }
+ * // var __t, __p = '';
+ * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
+ * // return __p;
+ * // }
*
* // using the `source` property to inline compiled templates for meaningful
* // line numbers in error messages and a stack trace
@@ -11204,15 +11207,13 @@
// Add `LazyWrapper` methods that accept an `iteratee` value.
arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
- var isFilter = index == LAZY_FILTER_FLAG,
- isWhile = index == LAZY_WHILE_FLAG;
+ var isFilter = index == LAZY_FILTER_FLAG || index == LAZY_WHILE_FLAG;
LazyWrapper.prototype[methodName] = function(iteratee, thisArg) {
var result = this.clone(),
- filtered = result.__filtered__,
iteratees = result.__iteratees__ || (result.__iteratees__ = []);
- result.__filtered__ = filtered || isFilter || (isWhile && result.__dir__ < 0);
+ result.__filtered__ = result.__filtered__ || isFilter;
iteratees.push({ 'iteratee': getCallback(iteratee, thisArg, 3), 'type': index });
return result;
};
@@ -11279,9 +11280,14 @@
};
LazyWrapper.prototype.dropWhile = function(predicate, thisArg) {
- var done;
+ var done,
+ lastIndex,
+ isRight = this.__dir__ < 0;
+
predicate = getCallback(predicate, thisArg, 3);
return this.filter(function(value, index, array) {
+ done = done && (isRight ? index < lastIndex : index > lastIndex);
+ lastIndex = index;
return done || (done = !predicate(value, index, array));
});
};
diff --git a/internal/baseDifference.js b/internal/baseDifference.js
index 72d9e909e..ea654f418 100644
--- a/internal/baseDifference.js
+++ b/internal/baseDifference.js
@@ -21,7 +21,7 @@ function baseDifference(array, values) {
var index = -1,
indexOf = baseIndexOf,
isCommon = true,
- cache = isCommon && values.length >= 200 && createCache(values),
+ cache = (isCommon && values.length >= 200) ? createCache(values) : null,
valuesLength = values.length;
if (cache) {
diff --git a/internal/baseUniq.js b/internal/baseUniq.js
index b4e9aeeaf..c0d6d6811 100644
--- a/internal/baseUniq.js
+++ b/internal/baseUniq.js
@@ -17,7 +17,7 @@ function baseUniq(array, iteratee) {
length = array.length,
isCommon = true,
isLarge = isCommon && length >= 200,
- seen = isLarge && createCache(),
+ seen = isLarge ? createCache() : null,
result = [];
if (seen) {
diff --git a/internal/isIterateeCall.js b/internal/isIterateeCall.js
index d8244bb85..05c2acf60 100644
--- a/internal/isIterateeCall.js
+++ b/internal/isIterateeCall.js
@@ -22,8 +22,11 @@ function isIterateeCall(value, index, object) {
} else {
prereq = type == 'string' && index in object;
}
- var other = object[index];
- return prereq && (value === value ? value === other : other !== other);
+ if (prereq) {
+ var other = object[index];
+ return value === value ? value === other : other !== other;
+ }
+ return false;
}
module.exports = isIterateeCall;
diff --git a/package.json b/package.json
index faf0a17a3..f7111ef72 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "lodash",
- "version": "3.3.0",
+ "version": "3.3.1",
"description": "The modern build of lodash modular utilities.",
"homepage": "https://lodash.com/",
"icon": "https://lodash.com/icon.svg",
diff --git a/string/template.js b/string/template.js
index e5e6253ae..38dba4a05 100644
--- a/string/template.js
+++ b/string/template.js
@@ -111,10 +111,10 @@ var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
* var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
* compiled.source;
* // => function(data) {
- * var __t, __p = '';
- * __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
- * return __p;
- * }
+ * // var __t, __p = '';
+ * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
+ * // return __p;
+ * // }
*
* // using the `source` property to inline compiled templates for meaningful
* // line numbers in error messages and a stack trace