From bbec03c4d5920e324202c78eb85b5ac59fe936bf Mon Sep 17 00:00:00 2001 From: jdalton Date: Mon, 26 Jan 2015 20:44:45 -0800 Subject: [PATCH] Bump to v3.0.1. --- README.md | 8 +++--- chain/wrapperReverse.js | 3 +++ collection/forEach.js | 2 +- function/memoize.js | 2 +- index.js | 53 +++++++++++++++++++++++---------------- internal/baseCallback.js | 3 +-- internal/baseMergeDeep.js | 3 +++ internal/baseSlice.js | 3 ++- internal/createPad.js | 5 ++-- internal/equalByTag.js | 4 +-- internal/lazyReverse.js | 13 ++++++---- internal/lazyValue.js | 8 +++--- package.json | 2 +- string/kebabCase.js | 2 +- 14 files changed, 64 insertions(+), 47 deletions(-) diff --git a/README.md b/README.md index 33aa285e0..85d5edf6d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# lodash v3.0.0 +# lodash v3.0.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.0.0-npm) for more details. +See the [package source](https://github.com/lodash/lodash/tree/3.0.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.0.0-amd) & [compatibility](https://github.com/lodash/lodash-compat/tree/3.0.0-amd) builds - * ES modules for the [modern](https://github.com/lodash/lodash/tree/3.0.0-es) build + * AMD modules for [modern](https://github.com/lodash/lodash/tree/3.0.1-amd) & [compatibility](https://github.com/lodash/lodash-compat/tree/3.0.1-amd) builds + * ES modules for the [modern](https://github.com/lodash/lodash/tree/3.0.1-es) build ## Further Reading diff --git a/chain/wrapperReverse.js b/chain/wrapperReverse.js index ffa73c48f..bf8f811bd 100644 --- a/chain/wrapperReverse.js +++ b/chain/wrapperReverse.js @@ -25,6 +25,9 @@ var LazyWrapper = require('../internal/LazyWrapper'), function wrapperReverse() { var value = this.__wrapped__; if (value instanceof LazyWrapper) { + if (this.__actions__.length) { + value = new LazyWrapper(this); + } return new LodashWrapper(value.reverse()); } return this.thru(function(value) { diff --git a/collection/forEach.js b/collection/forEach.js index 5a5d3765b..929407205 100644 --- a/collection/forEach.js +++ b/collection/forEach.js @@ -23,7 +23,7 @@ var arrayEach = require('../internal/arrayEach'), * @returns {Array|Object|string} Returns `collection`. * @example * - * _([1, 2, 3]).forEach(function(n) { console.log(n); }); + * _([1, 2, 3]).forEach(function(n) { console.log(n); }).value(); * // => logs each value from left to right and returns the array * * _.forEach({ 'one': 1, 'two': 2, 'three': 3 }, function(n, key) { console.log(n, key); }); diff --git a/function/memoize.js b/function/memoize.js index 76564d415..2cbebd0f8 100644 --- a/function/memoize.js +++ b/function/memoize.js @@ -35,7 +35,7 @@ var FUNC_ERROR_TEXT = 'Expected a function'; * // => 'FRED' * * // modifying the result cache - * upperCase.cache.set('fred, 'BARNEY'); + * upperCase.cache.set('fred', 'BARNEY'); * upperCase('fred'); * // => 'BARNEY' * diff --git a/index.js b/index.js index 1c691105c..02c735279 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,6 @@ /** * @license - * lodash 3.0.0 (Custom Build) + * lodash 3.0.1 (Custom Build) * Build: `lodash modern -d -o ./index.js` * Copyright 2012-2015 The Dojo Foundation * Based on Underscore.js 1.7.0 @@ -13,7 +13,7 @@ var undefined; /** Used as the semantic version number. */ - var VERSION = '3.0.0'; + var VERSION = '3.0.1'; /** Used to compose bitmasks for wrapper metadata. */ var BIND_FLAG = 1, @@ -1060,11 +1060,14 @@ * @returns {Object} Returns the new reversed `LazyWrapper` object. */ function lazyReverse() { - var filtered = this.filtered, - result = filtered ? new LazyWrapper(this) : this.clone(); - - result.dir = this.dir * -1; - result.filtered = filtered; + if (this.filtered) { + var result = new LazyWrapper(this); + result.dir = -1; + result.filtered = true; + } else { + result = this.clone(); + result.dir *= -1; + } return result; } @@ -1083,12 +1086,12 @@ } var dir = this.dir, isRight = dir < 0, - length = array.length, - view = getView(0, length, this.views), + view = getView(0, array.length, this.views), start = view.start, end = view.end, + length = end - start, dropCount = this.dropCount, - takeCount = nativeMin(end - start, this.takeCount - dropCount), + takeCount = nativeMin(length, this.takeCount - dropCount), index = isRight ? end : start - 1, iteratees = this.iteratees, iterLength = iteratees ? iteratees.length : 0, @@ -1124,7 +1127,7 @@ result[resIndex++] = value; } } - return isRight ? result.reverse() : result; + return result; } /*------------------------------------------------------------------------*/ @@ -1645,7 +1648,7 @@ // Handle "_.property" and "_.matches" style callback shorthands. return type == 'object' ? baseMatches(func, !argCount) - : baseProperty(argCount ? baseToString(func) : func); + : baseProperty(func + ''); } /** @@ -2375,6 +2378,9 @@ ? toPlainObject(value) : (isPlainObject(value) ? value : {}); } + else { + isCommon = false; + } } // Add the source value to the stack of traversed objects and associate // it with its merged value. @@ -2496,7 +2502,8 @@ if (end < 0) { end += length; } - length = start > end ? 0 : (end - start); + length = start > end ? 0 : (end - start) >>> 0; + start >>>= 0; var result = Array(length); while (++index < length) { @@ -3103,7 +3110,7 @@ return ''; } var padLength = length - strLength; - chars = chars == null ? ' ' : baseToString(chars); + chars = chars == null ? ' ' : (chars + ''); return repeat(chars, ceil(padLength / chars.length)).slice(0, padLength); } @@ -3296,7 +3303,7 @@ case stringTag: // Coerce regexes to strings and treat strings primitives and string // objects as equal. See https://es5.github.io/#x15.10.6.4 for more details. - return object == baseToString(other); + return object == (other + ''); } return false; } @@ -5314,6 +5321,9 @@ function wrapperReverse() { var value = this.__wrapped__; if (value instanceof LazyWrapper) { + if (this.__actions__.length) { + value = new LazyWrapper(this); + } return new LodashWrapper(value.reverse()); } return this.thru(function(value) { @@ -5689,7 +5699,7 @@ * @returns {Array|Object|string} Returns `collection`. * @example * - * _([1, 2, 3]).forEach(function(n) { console.log(n); }); + * _([1, 2, 3]).forEach(function(n) { console.log(n); }).value(); * // => logs each value from left to right and returns the array * * _.forEach({ 'one': 1, 'two': 2, 'three': 3 }, function(n, key) { console.log(n, key); }); @@ -7105,7 +7115,7 @@ * // => 'FRED' * * // modifying the result cache - * upperCase.cache.set('fred, 'BARNEY'); + * upperCase.cache.set('fred', 'BARNEY'); * upperCase('fred'); * // => 'BARNEY' * @@ -9193,7 +9203,7 @@ /** * Converts `string` to kebab case (a.k.a. spinal case). - * See [Wikipedia](https://en.wikipedia.org/wiki/Letter_case#Computers) for + * See [Wikipedia](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles) for * more details. * * @static @@ -10677,7 +10687,8 @@ // Add `LazyWrapper` methods to `lodash.prototype`. baseForOwn(LazyWrapper.prototype, function(func, methodName) { - var retUnwrapped = /^(?:first|last)$/.test(methodName); + var lodashFunc = lodash[methodName], + retUnwrapped = /^(?:first|last)$/.test(methodName); lodash.prototype[methodName] = function() { var value = this.__wrapped__, @@ -10690,12 +10701,12 @@ if (retUnwrapped && !chainAll) { return onlyLazy ? func.call(value) - : lodash[methodName](this.value()); + : lodashFunc.call(lodash, this.value()); } var interceptor = function(value) { var otherArgs = [value]; push.apply(otherArgs, args); - return lodash[methodName].apply(lodash, otherArgs); + return lodashFunc.apply(lodash, otherArgs); }; if (isLazy || isArray(value)) { var wrapper = onlyLazy ? value : new LazyWrapper(this), diff --git a/internal/baseCallback.js b/internal/baseCallback.js index ae09e2d8c..8868828d6 100644 --- a/internal/baseCallback.js +++ b/internal/baseCallback.js @@ -1,6 +1,5 @@ var baseMatches = require('./baseMatches'), baseProperty = require('./baseProperty'), - baseToString = require('./baseToString'), bindCallback = require('./bindCallback'), identity = require('../utility/identity'), isBindable = require('./isBindable'); @@ -28,7 +27,7 @@ function baseCallback(func, thisArg, argCount) { // Handle "_.property" and "_.matches" style callback shorthands. return type == 'object' ? baseMatches(func, !argCount) - : baseProperty(argCount ? baseToString(func) : func); + : baseProperty(func + ''); } module.exports = baseCallback; diff --git a/internal/baseMergeDeep.js b/internal/baseMergeDeep.js index 69593c9f9..2595dd796 100644 --- a/internal/baseMergeDeep.js +++ b/internal/baseMergeDeep.js @@ -47,6 +47,9 @@ function baseMergeDeep(object, source, key, mergeFunc, customizer, stackA, stack ? toPlainObject(value) : (isPlainObject(value) ? value : {}); } + else { + isCommon = false; + } } // Add the source value to the stack of traversed objects and associate // it with its merged value. diff --git a/internal/baseSlice.js b/internal/baseSlice.js index 656b6e999..78001a8f4 100644 --- a/internal/baseSlice.js +++ b/internal/baseSlice.js @@ -19,7 +19,8 @@ function baseSlice(array, start, end) { if (end < 0) { end += length; } - length = start > end ? 0 : (end - start); + length = start > end ? 0 : (end - start) >>> 0; + start >>>= 0; var result = Array(length); while (++index < length) { diff --git a/internal/createPad.js b/internal/createPad.js index 017ba0fc1..1c700c9bd 100644 --- a/internal/createPad.js +++ b/internal/createPad.js @@ -1,5 +1,4 @@ -var baseToString = require('./baseToString'), - repeat = require('../string/repeat'); +var repeat = require('../string/repeat'); /** Native method references. */ var ceil = Math.ceil; @@ -26,7 +25,7 @@ function createPad(string, length, chars) { return ''; } var padLength = length - strLength; - chars = chars == null ? ' ' : baseToString(chars); + chars = chars == null ? ' ' : (chars + ''); return repeat(chars, ceil(padLength / chars.length)).slice(0, padLength); } diff --git a/internal/equalByTag.js b/internal/equalByTag.js index 12c706a9d..37513d04b 100644 --- a/internal/equalByTag.js +++ b/internal/equalByTag.js @@ -1,5 +1,3 @@ -var baseToString = require('./baseToString'); - /** `Object#toString` result references. */ var boolTag = '[object Boolean]', dateTag = '[object Date]', @@ -43,7 +41,7 @@ function equalByTag(object, other, tag) { case stringTag: // Coerce regexes to strings and treat strings primitives and string // objects as equal. See https://es5.github.io/#x15.10.6.4 for more details. - return object == baseToString(other); + return object == (other + ''); } return false; } diff --git a/internal/lazyReverse.js b/internal/lazyReverse.js index da6d9e3dc..95481d2d9 100644 --- a/internal/lazyReverse.js +++ b/internal/lazyReverse.js @@ -9,11 +9,14 @@ var LazyWrapper = require('./LazyWrapper'); * @returns {Object} Returns the new reversed `LazyWrapper` object. */ function lazyReverse() { - var filtered = this.filtered, - result = filtered ? new LazyWrapper(this) : this.clone(); - - result.dir = this.dir * -1; - result.filtered = filtered; + if (this.filtered) { + var result = new LazyWrapper(this); + result.dir = -1; + result.filtered = true; + } else { + result = this.clone(); + result.dir *= -1; + } return result; } diff --git a/internal/lazyValue.js b/internal/lazyValue.js index 9ec5d4e93..fb1a15b4e 100644 --- a/internal/lazyValue.js +++ b/internal/lazyValue.js @@ -24,12 +24,12 @@ function lazyValue() { } var dir = this.dir, isRight = dir < 0, - length = array.length, - view = getView(0, length, this.views), + view = getView(0, array.length, this.views), start = view.start, end = view.end, + length = end - start, dropCount = this.dropCount, - takeCount = nativeMin(end - start, this.takeCount - dropCount), + takeCount = nativeMin(length, this.takeCount - dropCount), index = isRight ? end : start - 1, iteratees = this.iteratees, iterLength = iteratees ? iteratees.length : 0, @@ -65,7 +65,7 @@ function lazyValue() { result[resIndex++] = value; } } - return isRight ? result.reverse() : result; + return result; } module.exports = lazyValue; diff --git a/package.json b/package.json index 04caf02ed..831969a03 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lodash", - "version": "3.0.0", + "version": "3.0.1", "description": "The modern build of lodash modular utilities.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", diff --git a/string/kebabCase.js b/string/kebabCase.js index e2c1fe041..82bbd3d46 100644 --- a/string/kebabCase.js +++ b/string/kebabCase.js @@ -2,7 +2,7 @@ var createCompounder = require('../internal/createCompounder'); /** * Converts `string` to kebab case (a.k.a. spinal case). - * See [Wikipedia](https://en.wikipedia.org/wiki/Letter_case#Computers) for + * See [Wikipedia](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles) for * more details. * * @static