Compare commits

...

1 Commits

Author SHA1 Message Date
John-David Dalton
7af5d55f22 Bump to v4.0.1. 2016-01-24 19:18:05 -08:00
65 changed files with 210 additions and 160 deletions

View File

@@ -1,4 +1,4 @@
# lodash-es v4.0.0 # lodash-es v4.0.1
The [lodash](https://lodash.com/) library exported as [ES](http://www.ecma-international.org/ecma-262/6.0/) modules. The [lodash](https://lodash.com/) library exported as [ES](http://www.ecma-international.org/ecma-262/6.0/) modules.
@@ -7,4 +7,4 @@ Generated using [lodash-cli](https://www.npmjs.com/package/lodash-cli):
$ lodash modularize exports=es -o ./ $ lodash modularize exports=es -o ./
``` ```
See the [package source](https://github.com/lodash/lodash/tree/4.0.0-es) for more details. See the [package source](https://github.com/lodash/lodash/tree/4.0.1-es) for more details.

View File

@@ -29,7 +29,7 @@ import keysIn from './keysIn';
* defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
* // => { 'a': 1, 'b': 2 } * // => { 'a': 1, 'b': 2 }
*/ */
var assignInWith = createAssigner(function(object, source, customizer) { var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
copyObjectWith(source, keysIn(source), object, customizer); copyObjectWith(source, keysIn(source), object, customizer);
}); });

View File

@@ -28,7 +28,7 @@ import keys from './keys';
* defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
* // => { 'a': 1, 'b': 2 } * // => { 'a': 1, 'b': 2 }
*/ */
var assignWith = createAssigner(function(object, source, customizer) { var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
copyObjectWith(source, keys(source), object, customizer); copyObjectWith(source, keys(source), object, customizer);
}); });

View File

@@ -17,7 +17,7 @@ import baseClone from './internal/baseClone';
* } * }
* } * }
* *
* var el = _.cloneDeep(document.body, customizer); * var el = _.cloneDeepWith(document.body, customizer);
* *
* console.log(el === document.body); * console.log(el === document.body);
* // => false * // => false

View File

@@ -4,7 +4,7 @@ import baseClone from './internal/baseClone';
* This method is like `_.clone` except that it accepts `customizer` which * This method is like `_.clone` except that it accepts `customizer` which
* is invoked to produce the cloned value. If `customizer` returns `undefined` * is invoked to produce the cloned value. If `customizer` returns `undefined`
* cloning is handled by the method instead. The `customizer` is invoked with * cloning is handled by the method instead. The `customizer` is invoked with
* up to five arguments; (value [, index|key, object, stack]). * up to four arguments; (value [, index|key, object, stack]).
* *
* @static * @static
* @memberOf _ * @memberOf _
@@ -20,7 +20,7 @@ import baseClone from './internal/baseClone';
* } * }
* } * }
* *
* var el = _.clone(document.body, customizer); * var el = _.cloneWith(document.body, customizer);
* *
* console.log(el === document.body); * console.log(el === document.body);
* // => false * // => false

View File

@@ -25,8 +25,11 @@ import rest from './rest';
* // => [1] * // => [1]
*/ */
var concat = rest(function(array, values) { var concat = rest(function(array, values) {
if (!isArray(array)) {
array = array == null ? [] : [Object(array)];
}
values = baseFlatten(values); values = baseFlatten(values);
return arrayConcat(isArray(array) ? array : [Object(array)], values); return arrayConcat(array, values);
}); });
export default concat; export default concat;

View File

@@ -23,7 +23,7 @@ var FUNC_ERROR_TEXT = 'Expected a function';
* [_.matches({ 'a': 1 }), _.constant('matches A')], * [_.matches({ 'a': 1 }), _.constant('matches A')],
* [_.conforms({ 'b': _.isNumber }), _.constant('matches B')], * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
* [_.constant(true), _.constant('no match')] * [_.constant(true), _.constant('no match')]
* ]) * ]);
* *
* func({ 'a': 1, 'b': 2 }); * func({ 'a': 1, 'b': 2 });
* // => 'matches A' * // => 'matches A'

View File

@@ -16,7 +16,7 @@ var hasOwnProperty = objectProto.hasOwnProperty;
* @memberOf _ * @memberOf _
* @category Collection * @category Collection
* @param {Array|Object} collection The collection to iterate over. * @param {Array|Object} collection The collection to iterate over.
* @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. * @param {Function|Object|string} [iteratee=_.identity] The iteratee to transform keys.
* @returns {Object} Returns the composed aggregate object. * @returns {Object} Returns the composed aggregate object.
* @example * @example
* *

View File

@@ -5,12 +5,16 @@ import toString from './toString';
var reLatin1 = /[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g; var reLatin1 = /[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g;
/** Used to compose unicode character classes. */ /** Used to compose unicode character classes. */
var rsComboRange = '\\u0300-\\u036f\\ufe20-\\ufe23'; var rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23',
rsComboSymbolsRange = '\\u20d0-\\u20f0';
/** Used to compose unicode capture groups. */ /** Used to compose unicode capture groups. */
var rsCombo = '[' + rsComboRange + ']'; var rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']';
/** Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). */ /**
* Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
* [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
*/
var reComboMark = RegExp(rsCombo, 'g'); var reComboMark = RegExp(rsCombo, 'g');
/** /**

1
extend.js Normal file
View File

@@ -0,0 +1 @@
export { default } from './assignIn'

1
extendWith.js Normal file
View File

@@ -0,0 +1 @@
export { default } from './assignInWith'

View File

@@ -1,5 +1,3 @@
import baseSet from './internal/baseSet';
/** /**
* The inverse of `_.toPairs`; this method returns an object composed * The inverse of `_.toPairs`; this method returns an object composed
* from key-value `pairs`. * from key-value `pairs`.
@@ -21,7 +19,7 @@ function fromPairs(pairs) {
while (++index < length) { while (++index < length) {
var pair = pairs[index]; var pair = pairs[index];
baseSet(result, pair[0], pair[1]); result[pair[0]] = pair[1];
} }
return result; return result;
} }

View File

@@ -9,14 +9,14 @@ var hasOwnProperty = objectProto.hasOwnProperty;
/** /**
* Creates an object composed of keys generated from the results of running * Creates an object composed of keys generated from the results of running
* each element of `collection` through `iteratee`. The corresponding value * each element of `collection` through `iteratee`. The corresponding value
* of each key is an array of the elements responsible for generating the key. * of each key is an array of elements responsible for generating the key.
* The iteratee is invoked with one argument: (value). * The iteratee is invoked with one argument: (value).
* *
* @static * @static
* @memberOf _ * @memberOf _
* @category Collection * @category Collection
* @param {Array|Object} collection The collection to iterate over. * @param {Array|Object} collection The collection to iterate over.
* @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. * @param {Function|Object|string} [iteratee=_.identity] The iteratee to transform keys.
* @returns {Object} Returns the composed aggregate object. * @returns {Object} Returns the composed aggregate object.
* @example * @example
* *

View File

@@ -1,6 +1,6 @@
import root from './root'; import root from './root';
/** Built-in value references. */ /** Built-in value references. */
var _Symbol = root.Symbol; var Symbol = root.Symbol;
export default _Symbol; export default Symbol;

View File

@@ -6,14 +6,14 @@
* @param {Array} array The array to iterate over. * @param {Array} array The array to iterate over.
* @param {Function} iteratee The function invoked per iteration. * @param {Function} iteratee The function invoked per iteration.
* @param {*} [accumulator] The initial value. * @param {*} [accumulator] The initial value.
* @param {boolean} [initFromArray] Specify using the first element of `array` as the initial value. * @param {boolean} [initAccum] Specify using the first element of `array` as the initial value.
* @returns {*} Returns the accumulated value. * @returns {*} Returns the accumulated value.
*/ */
function arrayReduce(array, iteratee, accumulator, initFromArray) { function arrayReduce(array, iteratee, accumulator, initAccum) {
var index = -1, var index = -1,
length = array.length; length = array.length;
if (initFromArray && length) { if (initAccum && length) {
accumulator = array[++index]; accumulator = array[++index];
} }
while (++index < length) { while (++index < length) {

View File

@@ -6,12 +6,12 @@
* @param {Array} array The array to iterate over. * @param {Array} array The array to iterate over.
* @param {Function} iteratee The function invoked per iteration. * @param {Function} iteratee The function invoked per iteration.
* @param {*} [accumulator] The initial value. * @param {*} [accumulator] The initial value.
* @param {boolean} [initFromArray] Specify using the last element of `array` as the initial value. * @param {boolean} [initAccum] Specify using the last element of `array` as the initial value.
* @returns {*} Returns the accumulated value. * @returns {*} Returns the accumulated value.
*/ */
function arrayReduceRight(array, iteratee, accumulator, initFromArray) { function arrayReduceRight(array, iteratee, accumulator, initAccum) {
var length = array.length; var length = array.length;
if (initFromArray && length) { if (initAccum && length) {
accumulator = array[--length]; accumulator = array[--length];
} }
while (length--) { while (length--) {

View File

@@ -1,7 +1,7 @@
/** /**
* The base implementation of methods like `_.find` and `_.findKey`, without * The base implementation of methods like `_.find` and `_.findKey`, without
* support for iteratee shorthands, which iterates over `collection` using * support for iteratee shorthands, which iterates over `collection` using
* the provided `eachFunc`. * `eachFunc`.
* *
* @private * @private
* @param {Array|Object} collection The collection to search. * @param {Array|Object} collection The collection to search.

View File

@@ -8,7 +8,6 @@ import parent from './parent';
* The base implementation of `_.invoke` without support for individual * The base implementation of `_.invoke` without support for individual
* method arguments. * method arguments.
* *
*
* @private * @private
* @param {Object} object The object to query. * @param {Object} object The object to query.
* @param {Array|string} path The path of the method to invoke. * @param {Array|string} path The path of the method to invoke.

View File

@@ -47,7 +47,10 @@ function baseIsMatch(object, source, matchData, customizer) {
var stack = new Stack, var stack = new Stack,
result = customizer ? customizer(objValue, srcValue, key, object, source, stack) : undefined; result = customizer ? customizer(objValue, srcValue, key, object, source, stack) : undefined;
if (!(result === undefined ? baseIsEqual(srcValue, objValue, customizer, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG, stack) : result)) { if (!(result === undefined
? baseIsEqual(srcValue, objValue, customizer, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG, stack)
: result
)) {
return false; return false;
} }
} }

View File

@@ -13,10 +13,11 @@ import keysIn from '../keysIn';
* @private * @private
* @param {Object} object The destination object. * @param {Object} object The destination object.
* @param {Object} source The source object. * @param {Object} source The source object.
* @param {number} srcIndex The index of `source`.
* @param {Function} [customizer] The function to customize merged values. * @param {Function} [customizer] The function to customize merged values.
* @param {Object} [stack] Tracks traversed source values and their merged counterparts. * @param {Object} [stack] Tracks traversed source values and their merged counterparts.
*/ */
function baseMerge(object, source, customizer, stack) { function baseMerge(object, source, srcIndex, customizer, stack) {
if (object === source) { if (object === source) {
return; return;
} }
@@ -28,7 +29,7 @@ function baseMerge(object, source, customizer, stack) {
} }
if (isObject(srcValue)) { if (isObject(srcValue)) {
stack || (stack = new Stack); stack || (stack = new Stack);
baseMergeDeep(object, source, key, baseMerge, customizer, stack); baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
} }
else { else {
var newValue = customizer ? customizer(object[key], srcValue, (key + ''), object, source, stack) : undefined; var newValue = customizer ? customizer(object[key], srcValue, (key + ''), object, source, stack) : undefined;

View File

@@ -19,11 +19,12 @@ import toPlainObject from '../toPlainObject';
* @param {Object} object The destination object. * @param {Object} object The destination object.
* @param {Object} source The source object. * @param {Object} source The source object.
* @param {string} key The key of the value to merge. * @param {string} key The key of the value to merge.
* @param {number} srcIndex The index of `source`.
* @param {Function} mergeFunc The function to merge values. * @param {Function} mergeFunc The function to merge values.
* @param {Function} [customizer] The function to customize assigned values. * @param {Function} [customizer] The function to customize assigned values.
* @param {Object} [stack] Tracks traversed source values and their merged counterparts. * @param {Object} [stack] Tracks traversed source values and their merged counterparts.
*/ */
function baseMergeDeep(object, source, key, mergeFunc, customizer, stack) { function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
var objValue = object[key], var objValue = object[key],
srcValue = source[key], srcValue = source[key],
stacked = stack.get(srcValue) || stack.get(objValue); stacked = stack.get(srcValue) || stack.get(objValue);
@@ -38,24 +39,36 @@ function baseMergeDeep(object, source, key, mergeFunc, customizer, stack) {
if (isCommon) { if (isCommon) {
newValue = srcValue; newValue = srcValue;
if (isArray(srcValue) || isTypedArray(srcValue)) { if (isArray(srcValue) || isTypedArray(srcValue)) {
newValue = isArray(objValue) if (isArray(objValue)) {
? objValue newValue = srcIndex ? copyArray(objValue) : objValue;
: ((isArrayLikeObject(objValue)) ? copyArray(objValue) : baseClone(srcValue)); }
else if (isArrayLikeObject(objValue)) {
newValue = copyArray(objValue);
}
else {
newValue = baseClone(srcValue);
}
} }
else if (isPlainObject(srcValue) || isArguments(srcValue)) { else if (isPlainObject(srcValue) || isArguments(srcValue)) {
newValue = isArguments(objValue) if (isArguments(objValue)) {
? toPlainObject(objValue) newValue = toPlainObject(objValue);
: (isObject(objValue) ? objValue : baseClone(srcValue)); }
else if (!isObject(objValue) || (srcIndex && isFunction(objValue))) {
newValue = baseClone(srcValue);
}
else {
newValue = srcIndex ? baseClone(objValue) : objValue;
}
} }
else { else {
isCommon = isFunction(srcValue); isCommon = false;
} }
} }
stack.set(srcValue, newValue); stack.set(srcValue, newValue);
if (isCommon) { if (isCommon) {
// Recursively merge objects and arrays (susceptible to call stack limits). // Recursively merge objects and arrays (susceptible to call stack limits).
mergeFunc(newValue, srcValue, customizer, stack); mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
} }
assignMergeValue(object, key, newValue); assignMergeValue(object, key, newValue);
} }

View File

@@ -11,7 +11,7 @@ import baseForIn from './baseForIn';
function basePickBy(object, predicate) { function basePickBy(object, predicate) {
var result = {}; var result = {};
baseForIn(object, function(value, key) { baseForIn(object, function(value, key) {
if (predicate(value)) { if (predicate(value, key)) {
result[key] = value; result[key] = value;
} }
}); });

View File

@@ -1,20 +1,19 @@
/** /**
* The base implementation of `_.reduce` and `_.reduceRight`, without support * The base implementation of `_.reduce` and `_.reduceRight`, without support
* for iteratee shorthands, which iterates over `collection` using the provided * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
* `eachFunc`.
* *
* @private * @private
* @param {Array|Object} collection The collection to iterate over. * @param {Array|Object} collection The collection to iterate over.
* @param {Function} iteratee The function invoked per iteration. * @param {Function} iteratee The function invoked per iteration.
* @param {*} accumulator The initial value. * @param {*} accumulator The initial value.
* @param {boolean} initFromCollection Specify using the first or last element of `collection` as the initial value. * @param {boolean} initAccum Specify using the first or last element of `collection` as the initial value.
* @param {Function} eachFunc The function to iterate over `collection`. * @param {Function} eachFunc The function to iterate over `collection`.
* @returns {*} Returns the accumulated value. * @returns {*} Returns the accumulated value.
*/ */
function baseReduce(collection, iteratee, accumulator, initFromCollection, eachFunc) { function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
eachFunc(collection, function(value, index, collection) { eachFunc(collection, function(value, index, collection) {
accumulator = initFromCollection accumulator = initAccum
? (initFromCollection = false, value) ? (initAccum = false, value)
: iteratee(accumulator, value, index, collection); : iteratee(accumulator, value, index, collection);
}); });
return accumulator; return accumulator;

View File

@@ -1,8 +1,8 @@
import _Symbol from './_Symbol'; import Symbol from './Symbol';
/** Used to convert symbols to primitives and strings. */ /** Used to convert symbols to primitives and strings. */
var symbolProto = _Symbol ? _Symbol.prototype : undefined, var symbolProto = Symbol ? Symbol.prototype : undefined,
symbolValueOf = _Symbol ? symbolProto.valueOf : undefined; symbolValueOf = Symbol ? symbolProto.valueOf : undefined;
/** /**
* Creates a clone of the `symbol` object. * Creates a clone of the `symbol` object.
@@ -12,7 +12,7 @@ var symbolProto = _Symbol ? _Symbol.prototype : undefined,
* @returns {Object} Returns the cloned symbol object. * @returns {Object} Returns the cloned symbol object.
*/ */
function cloneSymbol(symbol) { function cloneSymbol(symbol) {
return _Symbol ? Object(symbolValueOf.call(symbol)) : {}; return Symbol ? Object(symbolValueOf.call(symbol)) : {};
} }
export default cloneSymbol; export default cloneSymbol;

View File

@@ -24,7 +24,7 @@ function createAssigner(assigner) {
while (++index < length) { while (++index < length) {
var source = sources[index]; var source = sources[index];
if (source) { if (source) {
assigner(object, source, customizer); assigner(object, source, index, customizer);
} }
} }
return object; return object;

View File

@@ -3,14 +3,15 @@ import toString from '../toString';
/** Used to compose unicode character classes. */ /** Used to compose unicode character classes. */
var rsAstralRange = '\\ud800-\\udfff', var rsAstralRange = '\\ud800-\\udfff',
rsComboRange = '\\u0300-\\u036f\\ufe20-\\ufe23', rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23',
rsComboSymbolsRange = '\\u20d0-\\u20f0',
rsVarRange = '\\ufe0e\\ufe0f'; rsVarRange = '\\ufe0e\\ufe0f';
/** Used to compose unicode capture groups. */ /** Used to compose unicode capture groups. */
var rsZWJ = '\\u200d'; var rsZWJ = '\\u200d';
/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */ /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
var reHasComplexSymbol = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']'); var reHasComplexSymbol = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']');
/** /**
* Creates a function like `_.lowerFirst`. * Creates a function like `_.lowerFirst`.

View File

@@ -5,14 +5,15 @@ import toInteger from '../toInteger';
/** Used to compose unicode character classes. */ /** Used to compose unicode character classes. */
var rsAstralRange = '\\ud800-\\udfff', var rsAstralRange = '\\ud800-\\udfff',
rsComboRange = '\\u0300-\\u036f\\ufe20-\\ufe23', rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23',
rsComboSymbolsRange = '\\u20d0-\\u20f0',
rsVarRange = '\\ufe0e\\ufe0f'; rsVarRange = '\\ufe0e\\ufe0f';
/** Used to compose unicode capture groups. */ /** Used to compose unicode capture groups. */
var rsZWJ = '\\u200d'; var rsZWJ = '\\u200d';
/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */ /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
var reHasComplexSymbol = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']'); var reHasComplexSymbol = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']');
/* Built-in method references for those with the same name as other `lodash` methods. */ /* Built-in method references for those with the same name as other `lodash` methods. */
var nativeCeil = Math.ceil; var nativeCeil = Math.ceil;

View File

@@ -1,5 +1,5 @@
import Symbol from './Symbol';
import Uint8Array from './Uint8Array'; import Uint8Array from './Uint8Array';
import _Symbol from './_Symbol';
import mapToArray from './mapToArray'; import mapToArray from './mapToArray';
import setToArray from './setToArray'; import setToArray from './setToArray';
@@ -21,8 +21,8 @@ var boolTag = '[object Boolean]',
var arrayBufferTag = '[object ArrayBuffer]'; var arrayBufferTag = '[object ArrayBuffer]';
/** Used to convert symbols to primitives and strings. */ /** Used to convert symbols to primitives and strings. */
var symbolProto = _Symbol ? _Symbol.prototype : undefined, var symbolProto = Symbol ? Symbol.prototype : undefined,
symbolValueOf = _Symbol ? symbolProto.valueOf : undefined; symbolValueOf = Symbol ? symbolProto.valueOf : undefined;
/** /**
* A specialized version of `baseIsEqualDeep` for comparing objects of * A specialized version of `baseIsEqualDeep` for comparing objects of
@@ -80,7 +80,7 @@ function equalByTag(object, other, tag, equalFunc, customizer, bitmask) {
equalFunc(convert(object), convert(other), customizer, bitmask | UNORDERED_COMPARE_FLAG); equalFunc(convert(object), convert(other), customizer, bitmask | UNORDERED_COMPARE_FLAG);
case symbolTag: case symbolTag:
return !!_Symbol && (symbolValueOf.call(object) == symbolValueOf.call(other)); return !!Symbol && (symbolValueOf.call(object) == symbolValueOf.call(other));
} }
return false; return false;
} }

View File

@@ -2,8 +2,7 @@ import baseHas from './baseHas';
import keys from '../keys'; import keys from '../keys';
/** Used to compose bitmasks for comparison styles. */ /** Used to compose bitmasks for comparison styles. */
var UNORDERED_COMPARE_FLAG = 1, var PARTIAL_COMPARE_FLAG = 2;
PARTIAL_COMPARE_FLAG = 2;
/** /**
* A specialized version of `baseIsEqualDeep` for objects with support for * A specialized version of `baseIsEqualDeep` for objects with support for
@@ -20,7 +19,6 @@ var UNORDERED_COMPARE_FLAG = 1,
*/ */
function equalObjects(object, other, equalFunc, customizer, bitmask, stack) { function equalObjects(object, other, equalFunc, customizer, bitmask, stack) {
var isPartial = bitmask & PARTIAL_COMPARE_FLAG, var isPartial = bitmask & PARTIAL_COMPARE_FLAG,
isUnordered = bitmask & UNORDERED_COMPARE_FLAG,
objProps = keys(object), objProps = keys(object),
objLength = objProps.length, objLength = objProps.length,
othProps = keys(other), othProps = keys(other),
@@ -32,8 +30,7 @@ function equalObjects(object, other, equalFunc, customizer, bitmask, stack) {
var index = objLength; var index = objLength;
while (index--) { while (index--) {
var key = objProps[index]; var key = objProps[index];
if (!(isPartial ? key in other : baseHas(other, key)) || if (!(isPartial ? key in other : baseHas(other, key))) {
!(isUnordered || key == othProps[index])) {
return false; return false;
} }
} }

View File

@@ -1,5 +1,11 @@
import realNames from './realNames'; import realNames from './realNames';
/** Used for built-in method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/** /**
* Gets the name of `func`. * Gets the name of `func`.
* *
@@ -10,7 +16,7 @@ import realNames from './realNames';
function getFuncName(func) { function getFuncName(func) {
var result = (func.name + ''), var result = (func.name + ''),
array = realNames[result], array = realNames[result],
length = array ? array.length : 0; length = hasOwnProperty.call(realNames, result) ? array.length : 0;
while (length--) { while (length--) {
var data = array[length], var data = array[length],

View File

@@ -1,4 +1,3 @@
import baseClone from './baseClone';
import baseMerge from './baseMerge'; import baseMerge from './baseMerge';
import isObject from '../isObject'; import isObject from '../isObject';
@@ -17,9 +16,9 @@ import isObject from '../isObject';
function mergeDefaults(objValue, srcValue, key, object, source, stack) { function mergeDefaults(objValue, srcValue, key, object, source, stack) {
if (isObject(objValue) && isObject(srcValue)) { if (isObject(objValue) && isObject(srcValue)) {
stack.set(srcValue, objValue); stack.set(srcValue, objValue);
baseMerge(objValue, srcValue, mergeDefaults, stack); baseMerge(objValue, srcValue, undefined, mergeDefaults, stack);
} }
return objValue === undefined ? baseClone(srcValue) : objValue; return objValue;
} }
export default mergeDefaults; export default mergeDefaults;

View File

@@ -1,12 +1,14 @@
/** Used to compose unicode character classes. */ /** Used to compose unicode character classes. */
var rsAstralRange = '\\ud800-\\udfff', var rsAstralRange = '\\ud800-\\udfff',
rsComboRange = '\\u0300-\\u036f\\ufe20-\\ufe23', rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23',
rsComboSymbolsRange = '\\u20d0-\\u20f0',
rsVarRange = '\\ufe0e\\ufe0f'; rsVarRange = '\\ufe0e\\ufe0f';
/** Used to compose unicode capture groups. */ /** Used to compose unicode capture groups. */
var rsAstral = '[' + rsAstralRange + ']', var rsAstral = '[' + rsAstralRange + ']',
rsCombo = '[' + rsComboRange + ']', rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']',
rsModifier = '(?:\\ud83c[\\udffb-\\udfff])', rsFitz = '\\ud83c[\\udffb-\\udfff]',
rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
rsNonAstral = '[^' + rsAstralRange + ']', rsNonAstral = '[^' + rsAstralRange + ']',
rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}', rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]', rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
@@ -20,14 +22,15 @@ var reOptMod = rsModifier + '?',
rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')'; rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */ /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
var reComplexSymbol = RegExp(rsSymbol + rsSeq, 'g'); var reComplexSymbol = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */ /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
var reHasComplexSymbol = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']'); var reHasComplexSymbol = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']');
/** /**
* Gets the number of symbols in `string`. * Gets the number of symbols in `string`.
* *
* @private
* @param {string} string The string to inspect. * @param {string} string The string to inspect.
* @returns {number} Returns the string size. * @returns {number} Returns the string size.
*/ */

View File

@@ -1,12 +1,14 @@
/** Used to compose unicode character classes. */ /** Used to compose unicode character classes. */
var rsAstralRange = '\\ud800-\\udfff', var rsAstralRange = '\\ud800-\\udfff',
rsComboRange = '\\u0300-\\u036f\\ufe20-\\ufe23', rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23',
rsComboSymbolsRange = '\\u20d0-\\u20f0',
rsVarRange = '\\ufe0e\\ufe0f'; rsVarRange = '\\ufe0e\\ufe0f';
/** Used to compose unicode capture groups. */ /** Used to compose unicode capture groups. */
var rsAstral = '[' + rsAstralRange + ']', var rsAstral = '[' + rsAstralRange + ']',
rsCombo = '[' + rsComboRange + ']', rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']',
rsModifier = '(?:\\ud83c[\\udffb-\\udfff])', rsFitz = '\\ud83c[\\udffb-\\udfff]',
rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
rsNonAstral = '[^' + rsAstralRange + ']', rsNonAstral = '[^' + rsAstralRange + ']',
rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}', rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]', rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
@@ -20,7 +22,7 @@ var reOptMod = rsModifier + '?',
rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')'; rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */ /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
var reComplexSymbol = RegExp(rsSymbol + rsSeq, 'g'); var reComplexSymbol = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
/** /**
* Converts `string` to an array. * Converts `string` to an array.

View File

@@ -14,6 +14,7 @@ import toArrayLikeObject from './internal/toArrayLikeObject';
* @param {...Array} [arrays] The arrays to inspect. * @param {...Array} [arrays] The arrays to inspect.
* @returns {Array} Returns the new array of shared values. * @returns {Array} Returns the new array of shared values.
* @example * @example
*
* _.intersection([2, 1], [4, 2], [1, 2]); * _.intersection([2, 1], [4, 2], [1, 2]);
* // => [2] * // => [2]
*/ */

View File

@@ -3,7 +3,7 @@ import baseIsEqual from './internal/baseIsEqual';
/** /**
* This method is like `_.isEqual` except that it accepts `customizer` which is * This method is like `_.isEqual` except that it accepts `customizer` which is
* invoked to compare values. If `customizer` returns `undefined` comparisons are * invoked to compare values. If `customizer` returns `undefined` comparisons are
* handled by the method instead. The `customizer` is invoked with up to seven arguments: * handled by the method instead. The `customizer` is invoked with up to six arguments:
* (objValue, othValue [, index|key, object, other, stack]). * (objValue, othValue [, index|key, object, other, stack]).
* *
* @static * @static

View File

@@ -4,7 +4,7 @@ import getMatchData from './internal/getMatchData';
/** /**
* This method is like `_.isMatch` except that it accepts `customizer` which * This method is like `_.isMatch` except that it accepts `customizer` which
* is invoked to compare values. If `customizer` returns `undefined` comparisons * is invoked to compare values. If `customizer` returns `undefined` comparisons
* are handled by the method instead. The `customizer` is invoked with three * are handled by the method instead. The `customizer` is invoked with five
* arguments: (objValue, srcValue, index|key, object, source). * arguments: (objValue, srcValue, index|key, object, source).
* *
* @static * @static

View File

@@ -10,7 +10,7 @@ import createAggregator from './internal/createAggregator';
* @memberOf _ * @memberOf _
* @category Collection * @category Collection
* @param {Array|Object} collection The collection to iterate over. * @param {Array|Object} collection The collection to iterate over.
* @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. * @param {Function|Object|string} [iteratee=_.identity] The iteratee to transform keys.
* @returns {Object} Returns the composed aggregate object. * @returns {Object} Returns the composed aggregate object.
* @example * @example
* *
@@ -19,13 +19,13 @@ import createAggregator from './internal/createAggregator';
* { 'dir': 'right', 'code': 100 } * { 'dir': 'right', 'code': 100 }
* ]; * ];
* *
* _.keyBy(keyData, 'dir');
* // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
*
* _.keyBy(keyData, function(o) { * _.keyBy(keyData, function(o) {
* return String.fromCharCode(o.code); * return String.fromCharCode(o.code);
* }); * });
* // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } } * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
*
* _.keyBy(keyData, 'dir');
* // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
*/ */
var keyBy = createAggregator(function(result, value, key) { var keyBy = createAggregator(function(result, value, key) {
result[key] = value; result[key] = value;

View File

@@ -1,6 +1,6 @@
/** /**
* @license * @license
* lodash 4.0.0 (Custom Build) <https://lodash.com/> * lodash 4.0.1 (Custom Build) <https://lodash.com/>
* Build: `lodash modularize exports="es" -o ./` * Build: `lodash modularize exports="es" -o ./`
* Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/> * Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
@@ -20,7 +20,7 @@ import string from './string';
import util from './util'; import util from './util';
import LazyWrapper from './internal/LazyWrapper'; import LazyWrapper from './internal/LazyWrapper';
import LodashWrapper from './internal/LodashWrapper'; import LodashWrapper from './internal/LodashWrapper';
import _Symbol from './internal/_Symbol'; import Symbol from './internal/Symbol';
import arrayEach from './internal/arrayEach'; import arrayEach from './internal/arrayEach';
import arrayPush from './internal/arrayPush'; import arrayPush from './internal/arrayPush';
import baseForOwn from './internal/baseForOwn'; import baseForOwn from './internal/baseForOwn';
@@ -44,7 +44,7 @@ import toInteger from './toInteger';
import lodash from './wrapperLodash'; import lodash from './wrapperLodash';
/** Used as the semantic version number. */ /** Used as the semantic version number. */
var VERSION = '4.0.0'; var VERSION = '4.0.1';
/** Used to compose bitmasks for wrapper metadata. */ /** Used to compose bitmasks for wrapper metadata. */
var BIND_KEY_FLAG = 2; var BIND_KEY_FLAG = 2;
@@ -64,7 +64,7 @@ var arrayProto = Array.prototype,
var hasOwnProperty = objectProto.hasOwnProperty; var hasOwnProperty = objectProto.hasOwnProperty;
/** Built-in value references. */ /** Built-in value references. */
var iteratorSymbol = typeof (iteratorSymbol = _Symbol && _Symbol.iterator) == 'symbol' ? iteratorSymbol : undefined; var iteratorSymbol = typeof (iteratorSymbol = Symbol && Symbol.iterator) == 'symbol' ? iteratorSymbol : undefined;
/* Built-in method references for those with the same name as other `lodash` methods. */ /* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMax = Math.max, var nativeMax = Math.max,
@@ -231,8 +231,6 @@ lodash.zipObject = array.zipObject;
lodash.zipWith = array.zipWith; lodash.zipWith = array.zipWith;
// Add aliases. // Add aliases.
lodash.each = collection.forEach;
lodash.eachRight = collection.forEachRight;
lodash.extend = object.assignIn; lodash.extend = object.assignIn;
lodash.extendWith = object.assignInWith; lodash.extendWith = object.assignInWith;
@@ -371,6 +369,8 @@ lodash.upperCase = string.upperCase;
lodash.upperFirst = string.upperFirst; lodash.upperFirst = string.upperFirst;
// Add aliases. // Add aliases.
lodash.each = collection.forEach;
lodash.eachRight = collection.forEachRight;
lodash.first = array.head; lodash.first = array.head;
mixin(lodash, (function() { mixin(lodash, (function() {

View File

@@ -1,6 +1,6 @@
/** /**
* @license * @license
* lodash 4.0.0 (Custom Build) <https://lodash.com/> * lodash 4.0.1 (Custom Build) <https://lodash.com/>
* Build: `lodash modularize exports="es" -o ./` * Build: `lodash modularize exports="es" -o ./`
* Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/> * Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
@@ -60,6 +60,8 @@ export { default as eq } from './eq';
export { default as escape } from './escape'; export { default as escape } from './escape';
export { default as escapeRegExp } from './escapeRegExp'; export { default as escapeRegExp } from './escapeRegExp';
export { default as every } from './every'; export { default as every } from './every';
export { default as extend } from './extend';
export { default as extendWith } from './extendWith';
export { default as fill } from './fill'; export { default as fill } from './fill';
export { default as filter } from './filter'; export { default as filter } from './filter';
export { default as find } from './find'; export { default as find } from './find';
@@ -285,6 +287,7 @@ export { default as wrapperAt } from './wrapperAt';
export { default as wrapperChain } from './wrapperChain'; export { default as wrapperChain } from './wrapperChain';
export { default as wrapperCommit } from './commit'; export { default as wrapperCommit } from './commit';
export { default as wrapperFlatMap } from './wrapperFlatMap'; export { default as wrapperFlatMap } from './wrapperFlatMap';
export { default as wrapperLodash } from './wrapperLodash';
export { default as wrapperNext } from './next'; export { default as wrapperNext } from './next';
export { default as wrapperPlant } from './plant'; export { default as wrapperPlant } from './plant';
export { default as wrapperReverse } from './wrapperReverse'; export { default as wrapperReverse } from './wrapperReverse';

8
map.js
View File

@@ -29,11 +29,11 @@ import isArray from './isArray';
* return n * n; * return n * n;
* } * }
* *
* _.map([1, 2], square); * _.map([4, 8], square);
* // => [3, 6] * // => [16, 64]
* *
* _.map({ 'a': 1, 'b': 2 }, square); * _.map({ 'a': 4, 'b': 8 }, square);
* // => [3, 6] (iteration order is not guaranteed) * // => [16, 64] (iteration order is not guaranteed)
* *
* var users = [ * var users = [
* { 'user': 'barney' }, * { 'user': 'barney' },

View File

@@ -17,7 +17,7 @@ import gt from './gt';
* *
* var objects = [{ 'n': 1 }, { 'n': 2 }]; * var objects = [{ 'n': 1 }, { 'n': 2 }];
* *
* _.maxBy(objects, function(o) { return o.a; }); * _.maxBy(objects, function(o) { return o.n; });
* // => { 'n': 2 } * // => { 'n': 2 }
* *
* // using the `_.property` iteratee shorthand * // using the `_.property` iteratee shorthand

View File

@@ -30,8 +30,8 @@ import createAssigner from './internal/createAssigner';
* _.merge(users, ages); * _.merge(users, ages);
* // => { 'data': [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 40 }] } * // => { 'data': [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 40 }] }
*/ */
var merge = createAssigner(function(object, source) { var merge = createAssigner(function(object, source, srcIndex) {
baseMerge(object, source); baseMerge(object, source, srcIndex);
}); });
export default merge; export default merge;

View File

@@ -36,8 +36,8 @@ import createAssigner from './internal/createAssigner';
* _.mergeWith(object, other, customizer); * _.mergeWith(object, other, customizer);
* // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot'] } * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot'] }
*/ */
var mergeWith = createAssigner(function(object, source, customizer) { var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
baseMerge(object, source, customizer); baseMerge(object, source, srcIndex, customizer);
}); });
export default mergeWith; export default mergeWith;

View File

@@ -17,7 +17,7 @@ import lt from './lt';
* *
* var objects = [{ 'n': 1 }, { 'n': 2 }]; * var objects = [{ 'n': 1 }, { 'n': 2 }];
* *
* _.minBy(objects, function(o) { return o.a; }); * _.minBy(objects, function(o) { return o.n; });
* // => { 'n': 1 } * // => { 'n': 1 }
* *
* // using the `_.property` iteratee shorthand * // using the `_.property` iteratee shorthand

View File

@@ -5,6 +5,8 @@ import assignWith from './assignWith';
import create from './create'; import create from './create';
import defaults from './defaults'; import defaults from './defaults';
import defaultsDeep from './defaultsDeep'; import defaultsDeep from './defaultsDeep';
import extend from './extend';
import extendWith from './extendWith';
import findKey from './findKey'; import findKey from './findKey';
import findLastKey from './findLastKey'; import findLastKey from './findLastKey';
import forIn from './forIn'; import forIn from './forIn';
@@ -40,11 +42,12 @@ import valuesIn from './valuesIn';
export default { export default {
assign, assignIn, assignInWith, assignWith, create, assign, assignIn, assignInWith, assignWith, create,
defaults, defaultsDeep, findKey, findLastKey, forIn, defaults, defaultsDeep, extend, extendWith, findKey,
forInRight, forOwn, forOwnRight, functions, functionsIn, findLastKey, forIn, forInRight, forOwn, forOwnRight,
get, has, hasIn, invert, invoke, functions, functionsIn, get, has, hasIn,
keys, keysIn, mapKeys, mapValues, merge, invert, invoke, keys, keysIn, mapKeys,
mergeWith, omit, omitBy, pick, pickBy, mapValues, merge, mergeWith, omit, omitBy,
result, set, setWith, toPairs, toPairsIn, pick, pickBy, result, set, setWith,
transform, unset, values, valuesIn toPairs, toPairsIn, transform, unset, values,
valuesIn
}; };

View File

@@ -5,6 +5,8 @@ export { default as assignWith } from './assignWith';
export { default as create } from './create'; export { default as create } from './create';
export { default as defaults } from './defaults'; export { default as defaults } from './defaults';
export { default as defaultsDeep } from './defaultsDeep'; export { default as defaultsDeep } from './defaultsDeep';
export { default as extend } from './extend';
export { default as extendWith } from './extendWith';
export { default as findKey } from './findKey'; export { default as findKey } from './findKey';
export { default as findLastKey } from './findLastKey'; export { default as findLastKey } from './findLastKey';
export { default as forIn } from './forIn'; export { default as forIn } from './forIn';

View File

@@ -20,9 +20,9 @@ import basePickBy from './internal/basePickBy';
* // => { 'b': '2' } * // => { 'b': '2' }
*/ */
function omitBy(object, predicate) { function omitBy(object, predicate) {
predicate = baseIteratee(predicate); predicate = baseIteratee(predicate, 2);
return basePickBy(object, function(value) { return basePickBy(object, function(value, key) {
return !predicate(value); return !predicate(value, key);
}); });
} }

View File

@@ -1,6 +1,6 @@
{ {
"name": "lodash-es", "name": "lodash-es",
"version": "4.0.0", "version": "4.0.1",
"description": "Lodash exported as ES modules.", "description": "Lodash exported as ES modules.",
"homepage": "https://lodash.com/custom-builds", "homepage": "https://lodash.com/custom-builds",
"license": "MIT", "license": "MIT",

View File

@@ -15,7 +15,7 @@ var nativeParseInt = root.parseInt;
* `undefined` or `0`, a `radix` of `10` is used unless `value` is a hexadecimal, * `undefined` or `0`, a `radix` of `10` is used unless `value` is a hexadecimal,
* in which case a `radix` of `16` is used. * in which case a `radix` of `16` is used.
* *
* **Note:** This method aligns with the [ES5 implementation](https://es5.github.io/#E) * **Note:** This method aligns with the [ES5 implementation](https://es5.github.io/#x15.1.2.2)
* of `parseInt`. * of `parseInt`.
* *
* @static * @static

View File

@@ -2,9 +2,9 @@ import createAggregator from './internal/createAggregator';
/** /**
* Creates an array of elements split into two groups, the first of which * Creates an array of elements split into two groups, the first of which
* contains elements `predicate` returns truthy for, while the second of which * contains elements `predicate` returns truthy for, the second of which
* contains elements `predicate` returns falsey for. The predicate is invoked * contains elements `predicate` returns falsey for. The predicate is
* with three arguments: (value, index|key, collection). * invoked with one argument: (value).
* *
* @static * @static
* @memberOf _ * @memberOf _

View File

@@ -19,7 +19,7 @@ import basePickBy from './internal/basePickBy';
* // => { 'a': 1, 'c': 3 } * // => { 'a': 1, 'c': 3 }
*/ */
function pickBy(object, predicate) { function pickBy(object, predicate) {
return object == null ? {} : basePickBy(object, baseIteratee(predicate)); return object == null ? {} : basePickBy(object, baseIteratee(predicate, 2));
} }
export default pickBy; export default pickBy;

View File

@@ -15,7 +15,7 @@ import basePullAll from './internal/basePullAll';
* *
* var array = [1, 2, 3, 1, 2, 3]; * var array = [1, 2, 3, 1, 2, 3];
* *
* _.pull(array, [2, 3]); * _.pullAll(array, [2, 3]);
* console.log(array); * console.log(array);
* // => [1, 1] * // => [1, 1]
*/ */

View File

@@ -4,8 +4,7 @@ import createRange from './internal/createRange';
* Creates an array of numbers (positive and/or negative) progressing from * Creates an array of numbers (positive and/or negative) progressing from
* `start` up to, but not including, `end`. A step of `-1` is used if a negative * `start` up to, but not including, `end`. A step of `-1` is used if a negative
* `start` is specified without an `end` or `step`. If `end` is not specified * `start` is specified without an `end` or `step`. If `end` is not specified
* it's set to `start` with `start` then set to `0`. If `end` is less than * it's set to `start` with `start` then set to `0`.
* `start` a zero-length range is created unless a negative `step` is specified.
* *
* **Note:** JavaScript follows the IEEE-754 standard for resolving * **Note:** JavaScript follows the IEEE-754 standard for resolving
* floating-point values which can produce unexpected results. * floating-point values which can produce unexpected results.

View File

@@ -41,9 +41,9 @@ import isArray from './isArray';
*/ */
function reduce(collection, iteratee, accumulator) { function reduce(collection, iteratee, accumulator) {
var func = isArray(collection) ? arrayReduce : baseReduce, var func = isArray(collection) ? arrayReduce : baseReduce,
initFromCollection = arguments.length < 3; initAccum = arguments.length < 3;
return func(collection, baseIteratee(iteratee, 4), accumulator, initFromCollection, baseEach); return func(collection, baseIteratee(iteratee, 4), accumulator, initAccum, baseEach);
} }
export default reduce; export default reduce;

View File

@@ -26,9 +26,9 @@ import isArray from './isArray';
*/ */
function reduceRight(collection, iteratee, accumulator) { function reduceRight(collection, iteratee, accumulator) {
var func = isArray(collection) ? arrayReduceRight : baseReduce, var func = isArray(collection) ? arrayReduceRight : baseReduce,
initFromCollection = arguments.length < 3; initAccum = arguments.length < 3;
return func(collection, baseIteratee(iteratee, 4), accumulator, initFromCollection, baseEachRight); return func(collection, baseIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
} }
export default reduceRight; export default reduceRight;

View File

@@ -11,6 +11,7 @@ var nativeReverse = arrayProto.reverse;
* **Note:** This method mutates `array` and is based on * **Note:** This method mutates `array` and is based on
* [`Array#reverse`](https://mdn.io/Array/reverse). * [`Array#reverse`](https://mdn.io/Array/reverse).
* *
* @static
* @memberOf _ * @memberOf _
* @category Array * @category Array
* @returns {Array} Returns `array`. * @returns {Array} Returns `array`.

View File

@@ -4,7 +4,8 @@ import toArray from './toArray';
import toInteger from './toInteger'; import toInteger from './toInteger';
/** /**
* Gets `n` random elements from `collection`. * Gets `n` random elements at unique keys from `collection` up to the
* size of `collection`.
* *
* @static * @static
* @memberOf _ * @memberOf _
@@ -14,8 +15,11 @@ import toInteger from './toInteger';
* @returns {Array} Returns the random elements. * @returns {Array} Returns the random elements.
* @example * @example
* *
* _.sampleSize([1, 2, 3, 4], 2); * _.sampleSize([1, 2, 3], 2);
* // => [3, 1] * // => [3, 1]
*
* _.sampleSize([1, 2, 3], 4);
* // => [2, 3, 1]
*/ */
function sampleSize(collection, n) { function sampleSize(collection, n) {
var index = -1, var index = -1,

View File

@@ -1,4 +1,4 @@
import _Symbol from './internal/_Symbol'; import Symbol from './internal/Symbol';
import copyArray from './internal/copyArray'; import copyArray from './internal/copyArray';
import getTag from './internal/getTag'; import getTag from './internal/getTag';
import isArrayLike from './isArrayLike'; import isArrayLike from './isArrayLike';
@@ -14,7 +14,7 @@ var mapTag = '[object Map]',
setTag = '[object Set]'; setTag = '[object Set]';
/** Built-in value references. */ /** Built-in value references. */
var iteratorSymbol = typeof (iteratorSymbol = _Symbol && _Symbol.iterator) == 'symbol' ? iteratorSymbol : undefined; var iteratorSymbol = typeof (iteratorSymbol = Symbol && Symbol.iterator) == 'symbol' ? iteratorSymbol : undefined;
/** /**
* Converts `value` to an array. * Converts `value` to an array.

View File

@@ -14,7 +14,7 @@ var MAX_ARRAY_LENGTH = 4294967295;
* @memberOf _ * @memberOf _
* @category Lang * @category Lang
* @param {*} value The value to convert. * @param {*} value The value to convert.
* @return {number} Returns the converted integer. * @returns {number} Returns the converted integer.
* @example * @example
* *
* _.toLength(3); * _.toLength(3);

View File

@@ -1,12 +1,12 @@
import _Symbol from './internal/_Symbol'; import Symbol from './internal/Symbol';
import isSymbol from './isSymbol'; import isSymbol from './isSymbol';
/** Used as references for various `Number` constants. */ /** Used as references for various `Number` constants. */
var INFINITY = 1 / 0; var INFINITY = 1 / 0;
/** Used to convert symbols to primitives and strings. */ /** Used to convert symbols to primitives and strings. */
var symbolProto = _Symbol ? _Symbol.prototype : undefined, var symbolProto = Symbol ? Symbol.prototype : undefined,
symbolToString = _Symbol ? symbolProto.toString : undefined; symbolToString = Symbol ? symbolProto.toString : undefined;
/** /**
* Converts `value` to a string if it's not one. An empty string is returned * Converts `value` to a string if it's not one. An empty string is returned
@@ -37,7 +37,7 @@ function toString(value) {
return ''; return '';
} }
if (isSymbol(value)) { if (isSymbol(value)) {
return _Symbol ? symbolToString.call(value) : ''; return Symbol ? symbolToString.call(value) : '';
} }
var result = (value + ''); var result = (value + '');
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;

View File

@@ -14,14 +14,15 @@ var reFlags = /\w*$/;
/** Used to compose unicode character classes. */ /** Used to compose unicode character classes. */
var rsAstralRange = '\\ud800-\\udfff', var rsAstralRange = '\\ud800-\\udfff',
rsComboRange = '\\u0300-\\u036f\\ufe20-\\ufe23', rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23',
rsComboSymbolsRange = '\\u20d0-\\u20f0',
rsVarRange = '\\ufe0e\\ufe0f'; rsVarRange = '\\ufe0e\\ufe0f';
/** Used to compose unicode capture groups. */ /** Used to compose unicode capture groups. */
var rsZWJ = '\\u200d'; var rsZWJ = '\\u200d';
/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */ /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
var reHasComplexSymbol = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']'); var reHasComplexSymbol = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']');
/** /**
* Truncates `string` if it's longer than the given maximum string length. * Truncates `string` if it's longer than the given maximum string length.

View File

@@ -2,6 +2,8 @@ import toString from './toString';
/** Used to compose unicode character classes. */ /** Used to compose unicode character classes. */
var rsAstralRange = '\\ud800-\\udfff', var rsAstralRange = '\\ud800-\\udfff',
rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23',
rsComboSymbolsRange = '\\u20d0-\\u20f0',
rsDingbatRange = '\\u2700-\\u27bf', rsDingbatRange = '\\u2700-\\u27bf',
rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff', rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
rsMathOpRange = '\\xac\\xb1\\xd7\\xf7', rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
@@ -14,11 +16,13 @@ var rsAstralRange = '\\ud800-\\udfff',
/** Used to compose unicode capture groups. */ /** Used to compose unicode capture groups. */
var rsBreak = '[' + rsBreakRange + ']', var rsBreak = '[' + rsBreakRange + ']',
rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']',
rsDigits = '\\d+', rsDigits = '\\d+',
rsDingbat = '[' + rsDingbatRange + ']', rsDingbat = '[' + rsDingbatRange + ']',
rsLower = '[' + rsLowerRange + ']', rsLower = '[' + rsLowerRange + ']',
rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']', rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
rsModifier = '(?:\\ud83c[\\udffb-\\udfff])', rsFitz = '\\ud83c[\\udffb-\\udfff]',
rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
rsNonAstral = '[^' + rsAstralRange + ']', rsNonAstral = '[^' + rsAstralRange + ']',
rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}', rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]', rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
@@ -42,7 +46,8 @@ var reComplexWord = RegExp([
rsUpper + '?' + rsLower + '+(?=' + [rsBreak, rsUpper, '$'].join('|') + ')', rsUpper + '?' + rsLower + '+(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
rsUpperMisc + '+(?=' + [rsBreak, rsUpper + rsLowerMisc, '$'].join('|') + ')', rsUpperMisc + '+(?=' + [rsBreak, rsUpper + rsLowerMisc, '$'].join('|') + ')',
rsUpper + '?' + rsLowerMisc + '+', rsUpper + '?' + rsLowerMisc + '+',
rsDigits + '(?:' + rsLowerMisc + '+)?', rsUpper + '+',
rsDigits,
rsEmoji rsEmoji
].join('|'), 'g'); ].join('|'), 'g');

View File

@@ -1,7 +1,7 @@
/** /**
* This method is the wrapper version of `_.flatMap`. * This method is the wrapper version of `_.flatMap`.
* *
* @static * @name flatMap
* @memberOf _ * @memberOf _
* @category Seq * @category Seq
* @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration. * @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration.

View File

@@ -52,13 +52,12 @@ var hasOwnProperty = objectProto.hasOwnProperty;
* The chainable wrapper methods are: * The chainable wrapper methods are:
* `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`,
* `at`, `before`, `bind`, `bindAll`, `bindKey`, `chain`, `chunk`, `commit`, * `at`, `before`, `bind`, `bindAll`, `bindKey`, `chain`, `chunk`, `commit`,
* `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`, `curry`, * `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`, `curry`,
* `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`, `difference`, * `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`, `difference`,
* `differenceBy`, `differenceWith`, `drop`, `dropRight`, `dropRightWhile`, * `differenceBy`, `differenceWith`, `drop`, `dropRight`, `dropRightWhile`,
* `dropWhile`, `fill`, `filter`, `flatten`, `flattenDeep`, `flip`, `flow`, * `dropWhile`, `fill`, `filter`, `flatten`, `flattenDeep`, `flip`, `flow`,
* `flowRight`, `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`, * `flowRight`, `fromPairs`, `functions`, `functionsIn`, `groupBy`, `initial`,
* `forOwnRight`, `fromPairs`, `functions`, `functionsIn`, `groupBy`, `initial`, * `intersection`, `intersectionBy`, `intersectionWith`, `invert`, `invokeMap`,
* `intersection`, `intersectionBy`, `intersectionWith`, invert`, `invokeMap`,
* `iteratee`, `keyBy`, `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, * `iteratee`, `keyBy`, `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`,
* `matches`, `matchesProperty`, `memoize`, `merge`, `mergeWith`, `method`, * `matches`, `matchesProperty`, `memoize`, `merge`, `mergeWith`, `method`,
* `methodOf`, `mixin`, `negate`, `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, * `methodOf`, `mixin`, `negate`, `nthArg`, `omit`, `omitBy`, `once`, `orderBy`,
@@ -77,22 +76,23 @@ var hasOwnProperty = objectProto.hasOwnProperty;
* `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`, * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
* `cloneDeep`, `cloneDeepWith`, `cloneWith`, `deburr`, `endsWith`, `eq`, * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `deburr`, `endsWith`, `eq`,
* `escape`, `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, * `escape`, `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`,
* `findLast`, `findLastIndex`, `findLastKey`, `floor`, `get`, `gt`, `gte`, * `findLast`, `findLastIndex`, `findLastKey`, `floor`, `forEach`, `forEachRight`,
* `has`, `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
* `invoke`, `isArguments`, `isArray`, `isArrayLike`, `isArrayLikeObject`, * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
* `isBoolean`, `isDate`, `isElement`, `isEmpty`, `isEqual`, `isEqualWith`, * `isArguments`, `isArray`, `isArrayLike`, `isArrayLikeObject`, `isBoolean`,
* `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`, `isMatch`, * `isDate`, `isElement`, `isEmpty`, `isEqual`, `isEqualWith`, `isError`,
* `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`, `isNumber`, * `isFinite`, `isFunction`, `isInteger`, `isLength`, `isMatch`, `isMatchWith`,
* `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`, `isSafeInteger`, * `isNaN`, `isNative`, `isNil`, `isNull`, `isNumber`, `isObject`, `isObjectLike`,
* `isString`, `isUndefined`, `isTypedArray`, `join`, `kebabCase`, `last`, * `isPlainObject`, `isRegExp`, `isSafeInteger`, `isString`, `isUndefined`,
* `lastIndexOf`, `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, * `isTypedArray`, `join`, `kebabCase`, `last`, `lastIndexOf`, `lowerCase`,
* `mean`, `min`, `minBy`, `noConflict`, `noop`, `now`, `pad`, `padEnd`, * `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `min`, `minBy`,
* `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`, `repeat`, * `noConflict`, `noop`, `now`, `pad`, `padEnd`, `padStart`, `parseInt`,
* `result`, `round`, `runInContext`, `sample`, `shift`, `size`, `snakeCase`, * `pop`, `random`, `reduce`, `reduceRight`, `repeat`, `result`, `round`,
* `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`, `sortedLastIndexBy`, * `runInContext`, `sample`, `shift`, `size`, `snakeCase`, `some`, `sortedIndex`,
* `startCase`, `startsWith`, `subtract`, `sum`, sumBy`, `template`, `times`, * `sortedIndexBy`, `sortedLastIndex`, `sortedLastIndexBy`, `startCase`,
* `toLower`, `toInteger`, `toLength`, `toNumber`, `toSafeInteger`, toString`, * `startsWith`, `subtract`, `sum`, `sumBy`, `template`, `times`, `toLower`,
* `toUpper`, `trim`, `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, * `toInteger`, `toLength`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`,
* `trim`, `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`,
* `upperCase`, `upperFirst`, `value`, and `words` * `upperCase`, `upperFirst`, `value`, and `words`
* *
* @name _ * @name _

View File

@@ -5,7 +5,7 @@ import baseWrapperValue from './internal/baseWrapperValue';
* *
* @name value * @name value
* @memberOf _ * @memberOf _
* @alias run, toJSON, valueOf * @alias toJSON, valueOf
* @category Seq * @category Seq
* @returns {*} Returns the resolved unwrapped value. * @returns {*} Returns the resolved unwrapped value.
* @example * @example