lodash-es
Advanced tools
Comparing version 4.15.0 to 4.16.0
@@ -0,1 +1,2 @@ | ||
import baseAssignValue from './_baseAssignValue.js'; | ||
import eq from './eq.js'; | ||
@@ -15,3 +16,3 @@ | ||
(typeof key == 'number' && value === undefined && !(key in object))) { | ||
object[key] = value; | ||
baseAssignValue(object, key, value); | ||
} | ||
@@ -18,0 +19,0 @@ } |
@@ -0,1 +1,2 @@ | ||
import baseAssignValue from './_baseAssignValue.js'; | ||
import eq from './eq.js'; | ||
@@ -23,3 +24,3 @@ | ||
(value === undefined && !(key in object))) { | ||
object[key] = value; | ||
baseAssignValue(object, key, value); | ||
} | ||
@@ -26,0 +27,0 @@ } |
@@ -15,3 +15,2 @@ import Stack from './_Stack.js'; | ||
import isBuffer from './isBuffer.js'; | ||
import isHostObject from './_isHostObject.js'; | ||
import isObject from './isObject.js'; | ||
@@ -104,5 +103,2 @@ import keys from './keys.js'; | ||
if (tag == objectTag || tag == argsTag || (isFunc && !object)) { | ||
if (isHostObject(value)) { | ||
return object ? value : {}; | ||
} | ||
result = initCloneObject(isFunc ? {} : value); | ||
@@ -109,0 +105,0 @@ if (!isDeep) { |
import baseFindIndex from './_baseFindIndex.js'; | ||
import baseIsNaN from './_baseIsNaN.js'; | ||
import strictIndexOf from './_strictIndexOf.js'; | ||
@@ -14,16 +15,7 @@ /** | ||
function baseIndexOf(array, value, fromIndex) { | ||
if (value !== value) { | ||
return baseFindIndex(array, baseIsNaN, fromIndex); | ||
} | ||
var index = fromIndex - 1, | ||
length = array.length; | ||
while (++index < length) { | ||
if (array[index] === value) { | ||
return index; | ||
} | ||
} | ||
return -1; | ||
return value === value | ||
? strictIndexOf(array, value, fromIndex) | ||
: baseFindIndex(array, baseIsNaN, fromIndex); | ||
} | ||
export default baseIndexOf; |
@@ -7,3 +7,2 @@ import Stack from './_Stack.js'; | ||
import isArray from './isArray.js'; | ||
import isHostObject from './_isHostObject.js'; | ||
import isTypedArray from './isTypedArray.js'; | ||
@@ -54,4 +53,4 @@ | ||
} | ||
var objIsObj = objTag == objectTag && !isHostObject(object), | ||
othIsObj = othTag == objectTag && !isHostObject(other), | ||
var objIsObj = objTag == objectTag, | ||
othIsObj = othTag == objectTag, | ||
isSameTag = objTag == othTag; | ||
@@ -58,0 +57,0 @@ |
import isFunction from './isFunction.js'; | ||
import isHostObject from './_isHostObject.js'; | ||
import isMasked from './_isMasked.js'; | ||
@@ -44,3 +43,3 @@ import isObject from './isObject.js'; | ||
} | ||
var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor; | ||
var pattern = isFunction(value) ? reIsNative : reIsHostCtor; | ||
return pattern.test(toSource(value)); | ||
@@ -47,0 +46,0 @@ } |
@@ -0,1 +1,3 @@ | ||
import baseAssignValue from './_baseAssignValue.js'; | ||
/** | ||
@@ -20,3 +22,3 @@ * The base implementation of `_.pickBy` without support for iteratee shorthands. | ||
if (predicate(value, key)) { | ||
result[key] = value; | ||
baseAssignValue(result, key, value); | ||
} | ||
@@ -23,0 +25,0 @@ } |
@@ -1,6 +0,5 @@ | ||
import apply from './_apply.js'; | ||
import identity from './identity.js'; | ||
import overRest from './_overRest.js'; | ||
import setToString from './_setToString.js'; | ||
/* Built-in method references for those with the same name as other `lodash` methods. */ | ||
var nativeMax = Math.max; | ||
/** | ||
@@ -15,22 +14,5 @@ * The base implementation of `_.rest` which doesn't validate or coerce arguments. | ||
function baseRest(func, start) { | ||
start = nativeMax(start === undefined ? (func.length - 1) : start, 0); | ||
return function() { | ||
var args = arguments, | ||
index = -1, | ||
length = nativeMax(args.length - start, 0), | ||
array = Array(length); | ||
while (++index < length) { | ||
array[index] = args[start + index]; | ||
} | ||
index = -1; | ||
var otherArgs = Array(start + 1); | ||
while (++index < start) { | ||
otherArgs[index] = args[index]; | ||
} | ||
otherArgs[start] = array; | ||
return apply(func, this, otherArgs); | ||
}; | ||
return setToString(overRest(func, start, identity), func + ''); | ||
} | ||
export default baseRest; |
@@ -5,3 +5,3 @@ import identity from './identity.js'; | ||
/** | ||
* The base implementation of `setData` without support for hot loop detection. | ||
* The base implementation of `setData` without support for hot loop shorting. | ||
* | ||
@@ -8,0 +8,0 @@ * @private |
/** | ||
* Checks if a cache value for `key` exists. | ||
* Checks if a `cache` value for `key` exists. | ||
* | ||
@@ -4,0 +4,0 @@ * @private |
import assignValue from './_assignValue.js'; | ||
import baseAssignValue from './_baseAssignValue.js'; | ||
@@ -14,2 +15,3 @@ /** | ||
function copyObject(source, props, object, customizer) { | ||
var isNew = !object; | ||
object || (object = {}); | ||
@@ -27,3 +29,10 @@ | ||
assignValue(object, key, newValue === undefined ? source[key] : newValue); | ||
if (newValue === undefined) { | ||
newValue = source[key]; | ||
} | ||
if (isNew) { | ||
baseAssignValue(object, key, newValue); | ||
} else { | ||
assignValue(object, key, newValue); | ||
} | ||
} | ||
@@ -30,0 +39,0 @@ return object; |
@@ -15,3 +15,3 @@ /** | ||
if (array[length] === placeholder) { | ||
result++; | ||
++result; | ||
} | ||
@@ -18,0 +18,0 @@ } |
import LodashWrapper from './_LodashWrapper.js'; | ||
import baseFlatten from './_baseFlatten.js'; | ||
import baseRest from './_baseRest.js'; | ||
import flatRest from './_flatRest.js'; | ||
import getData from './_getData.js'; | ||
@@ -29,5 +28,3 @@ import getFuncName from './_getFuncName.js'; | ||
function createFlow(fromRight) { | ||
return baseRest(function(funcs) { | ||
funcs = baseFlatten(funcs, 1); | ||
return flatRest(function(funcs) { | ||
var length = funcs.length, | ||
@@ -34,0 +31,0 @@ index = length, |
import apply from './_apply.js'; | ||
import arrayMap from './_arrayMap.js'; | ||
import baseFlatten from './_baseFlatten.js'; | ||
import baseIteratee from './_baseIteratee.js'; | ||
import baseRest from './_baseRest.js'; | ||
import baseUnary from './_baseUnary.js'; | ||
import isArray from './isArray.js'; | ||
import flatRest from './_flatRest.js'; | ||
@@ -17,7 +16,4 @@ /** | ||
function createOver(arrayFunc) { | ||
return baseRest(function(iteratees) { | ||
iteratees = (iteratees.length == 1 && isArray(iteratees[0])) | ||
? arrayMap(iteratees[0], baseUnary(baseIteratee)) | ||
: arrayMap(baseFlatten(iteratees, 1), baseUnary(baseIteratee)); | ||
return flatRest(function(iteratees) { | ||
iteratees = arrayMap(iteratees, baseUnary(baseIteratee)); | ||
return baseRest(function(args) { | ||
@@ -24,0 +20,0 @@ var thisArg = this; |
@@ -58,3 +58,3 @@ import basePropertyOf from './_basePropertyOf.js'; | ||
'\u0152': 'Oe', '\u0153': 'oe', | ||
'\u0149': "'n", '\u017f': 'ss' | ||
'\u0149': "'n", '\u017f': 's' | ||
}; | ||
@@ -61,0 +61,0 @@ |
import SetCache from './_SetCache.js'; | ||
import arraySome from './_arraySome.js'; | ||
import cacheHas from './_cacheHas.js'; | ||
@@ -62,5 +63,5 @@ /** Used to compose bitmasks for comparison styles. */ | ||
if (!arraySome(other, function(othValue, othIndex) { | ||
if (!seen.has(othIndex) && | ||
if (!cacheHas(seen, othIndex) && | ||
(arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) { | ||
return seen.add(othIndex); | ||
return seen.push(othIndex); | ||
} | ||
@@ -67,0 +68,0 @@ })) { |
@@ -9,4 +9,3 @@ import basePropertyOf from './_basePropertyOf.js'; | ||
'"': '"', | ||
"'": ''', | ||
'`': '`' | ||
"'": ''' | ||
}; | ||
@@ -13,0 +12,0 @@ |
@@ -44,4 +44,3 @@ import DataView from './_DataView.js'; | ||
// Fallback for data views, maps, sets, and weak maps in IE 11, | ||
// for data views in Edge < 14, and promises in Node.js. | ||
// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6. | ||
if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || | ||
@@ -48,0 +47,0 @@ (Map && getTag(new Map) != mapTag) || |
@@ -12,4 +12,5 @@ import nativeCreate from './_nativeCreate.js'; | ||
this.__data__ = nativeCreate ? nativeCreate(null) : {}; | ||
this.size = 0; | ||
} | ||
export default hashClear; |
@@ -12,5 +12,7 @@ /** | ||
function hashDelete(key) { | ||
return this.has(key) && delete this.__data__[key]; | ||
var result = this.has(key) && delete this.__data__[key]; | ||
this.size -= result ? 1 : 0; | ||
return result; | ||
} | ||
export default hashDelete; |
@@ -18,2 +18,3 @@ import nativeCreate from './_nativeCreate.js'; | ||
var data = this.__data__; | ||
this.size += this.has(key) ? 0 : 1; | ||
data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; | ||
@@ -20,0 +21,0 @@ return this; |
@@ -21,5 +21,5 @@ import castPath from './_castPath.js'; | ||
var result, | ||
index = -1, | ||
length = path.length; | ||
var index = -1, | ||
length = path.length, | ||
result = false; | ||
@@ -33,6 +33,6 @@ while (++index < length) { | ||
} | ||
if (result) { | ||
if (result || ++index != length) { | ||
return result; | ||
} | ||
var length = object ? object.length : 0; | ||
length = object ? object.length : 0; | ||
return !!length && isLength(length) && isIndex(key, length) && | ||
@@ -39,0 +39,0 @@ (isArray(object) || isArguments(object)); |
@@ -13,5 +13,7 @@ /** Used to match wrap detail comments. */ | ||
function insertWrapDetails(source, details) { | ||
var length = details.length, | ||
lastIndex = length - 1; | ||
var length = details.length; | ||
if (!length) { | ||
return source; | ||
} | ||
var lastIndex = length - 1; | ||
details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex]; | ||
@@ -18,0 +20,0 @@ details = details.join(length > 2 ? ', ' : ' '); |
@@ -10,4 +10,5 @@ /** | ||
this.__data__ = []; | ||
this.size = 0; | ||
} | ||
export default listCacheClear; |
@@ -31,2 +31,3 @@ import assocIndexOf from './_assocIndexOf.js'; | ||
} | ||
--this.size; | ||
return true; | ||
@@ -33,0 +34,0 @@ } |
@@ -18,2 +18,3 @@ import assocIndexOf from './_assocIndexOf.js'; | ||
if (index < 0) { | ||
++this.size; | ||
data.push([key, value]); | ||
@@ -20,0 +21,0 @@ } else { |
@@ -13,2 +13,3 @@ import Hash from './_Hash.js'; | ||
function mapCacheClear() { | ||
this.size = 0; | ||
this.__data__ = { | ||
@@ -15,0 +16,0 @@ 'hash': new Hash, |
@@ -13,5 +13,7 @@ import getMapData from './_getMapData.js'; | ||
function mapCacheDelete(key) { | ||
return getMapData(this, key)['delete'](key); | ||
var result = getMapData(this, key)['delete'](key); | ||
this.size -= result ? 1 : 0; | ||
return result; | ||
} | ||
export default mapCacheDelete; |
@@ -14,3 +14,7 @@ import getMapData from './_getMapData.js'; | ||
function mapCacheSet(key, value) { | ||
getMapData(this, key).set(key, value); | ||
var data = getMapData(this, key), | ||
size = data.size; | ||
data.set(key, value); | ||
this.size += data.size == size ? 0 : 1; | ||
return this; | ||
@@ -17,0 +21,0 @@ } |
import baseSetData from './_baseSetData.js'; | ||
import now from './now.js'; | ||
import shortOut from './_shortOut.js'; | ||
/** Used to detect hot functions by number of calls within a span of milliseconds. */ | ||
var HOT_COUNT = 150, | ||
HOT_SPAN = 16; | ||
/** | ||
@@ -22,22 +18,4 @@ * Sets metadata for `func`. | ||
*/ | ||
var setData = (function() { | ||
var count = 0, | ||
lastCalled = 0; | ||
var setData = shortOut(baseSetData); | ||
return function(key, value) { | ||
var stamp = now(), | ||
remaining = HOT_SPAN - (stamp - lastCalled); | ||
lastCalled = stamp; | ||
if (remaining > 0) { | ||
if (++count >= HOT_COUNT) { | ||
return key; | ||
} | ||
} else { | ||
count = 0; | ||
} | ||
return baseSetData(key, value); | ||
}; | ||
}()); | ||
export default setData; |
@@ -1,6 +0,4 @@ | ||
import constant from './constant.js'; | ||
import defineProperty from './_defineProperty.js'; | ||
import getWrapDetails from './_getWrapDetails.js'; | ||
import identity from './identity.js'; | ||
import insertWrapDetails from './_insertWrapDetails.js'; | ||
import setToString from './_setToString.js'; | ||
import updateWrapDetails from './_updateWrapDetails.js'; | ||
@@ -18,11 +16,7 @@ | ||
*/ | ||
var setWrapToString = !defineProperty ? identity : function(wrapper, reference, bitmask) { | ||
function setWrapToString(wrapper, reference, bitmask) { | ||
var source = (reference + ''); | ||
return defineProperty(wrapper, 'toString', { | ||
'configurable': true, | ||
'enumerable': false, | ||
'value': constant(insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask))) | ||
}); | ||
}; | ||
return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask))); | ||
} | ||
export default setWrapToString; |
@@ -16,3 +16,4 @@ import ListCache from './_ListCache.js'; | ||
function Stack(entries) { | ||
this.__data__ = new ListCache(entries); | ||
var data = this.__data__ = new ListCache(entries); | ||
this.size = data.size; | ||
} | ||
@@ -19,0 +20,0 @@ |
@@ -12,4 +12,5 @@ import ListCache from './_ListCache.js'; | ||
this.__data__ = new ListCache; | ||
this.size = 0; | ||
} | ||
export default stackClear; |
@@ -11,5 +11,9 @@ /** | ||
function stackDelete(key) { | ||
return this.__data__['delete'](key); | ||
var data = this.__data__, | ||
result = data['delete'](key); | ||
this.size = data.size; | ||
return result; | ||
} | ||
export default stackDelete; |
@@ -19,12 +19,14 @@ import ListCache from './_ListCache.js'; | ||
function stackSet(key, value) { | ||
var cache = this.__data__; | ||
if (cache instanceof ListCache) { | ||
var pairs = cache.__data__; | ||
var data = this.__data__; | ||
if (data instanceof ListCache) { | ||
var pairs = data.__data__; | ||
if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) { | ||
pairs.push([key, value]); | ||
this.size = ++data.size; | ||
return this; | ||
} | ||
cache = this.__data__ = new MapCache(pairs); | ||
data = this.__data__ = new MapCache(pairs); | ||
} | ||
cache.set(key, value); | ||
data.set(key, value); | ||
this.size = data.size; | ||
return this; | ||
@@ -31,0 +33,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import memoize from './memoize.js'; | ||
import memoizeCapped from './_memoizeCapped.js'; | ||
import toString from './toString.js'; | ||
@@ -18,3 +18,3 @@ | ||
*/ | ||
var stringToPath = memoize(function(string) { | ||
var stringToPath = memoizeCapped(function(string) { | ||
string = toString(string); | ||
@@ -21,0 +21,0 @@ |
@@ -9,4 +9,3 @@ import basePropertyOf from './_basePropertyOf.js'; | ||
'"': '"', | ||
''': "'", | ||
'`': '`' | ||
''': "'" | ||
}; | ||
@@ -13,0 +12,0 @@ |
@@ -37,3 +37,3 @@ /** Used to compose unicode character classes. */ | ||
while (reUnicode.test(string)) { | ||
result++; | ||
++result; | ||
} | ||
@@ -40,0 +40,0 @@ return result; |
@@ -14,8 +14,2 @@ import assignValue from './_assignValue.js'; | ||
/** Built-in value references. */ | ||
var propertyIsEnumerable = objectProto.propertyIsEnumerable; | ||
/** Detect if properties shadowing those on `Object.prototype` are non-enumerable. */ | ||
var nonEnumShadows = !propertyIsEnumerable.call({ 'valueOf': 1 }, 'valueOf'); | ||
/** | ||
@@ -54,3 +48,3 @@ * Assigns own enumerable string keyed properties of source objects to the | ||
var assign = createAssigner(function(object, source) { | ||
if (nonEnumShadows || isPrototype(source) || isArrayLike(source)) { | ||
if (isPrototype(source) || isArrayLike(source)) { | ||
copyObject(source, keys(source), object); | ||
@@ -57,0 +51,0 @@ return; |
import baseAt from './_baseAt.js'; | ||
import baseFlatten from './_baseFlatten.js'; | ||
import baseRest from './_baseRest.js'; | ||
import flatRest from './_flatRest.js'; | ||
@@ -22,6 +21,4 @@ /** | ||
*/ | ||
var at = baseRest(function(object, paths) { | ||
return baseAt(object, baseFlatten(paths, 1)); | ||
}); | ||
var at = flatRest(baseAt); | ||
export default at; |
import arrayEach from './_arrayEach.js'; | ||
import baseFlatten from './_baseFlatten.js'; | ||
import baseRest from './_baseRest.js'; | ||
import baseAssignValue from './_baseAssignValue.js'; | ||
import bind from './bind.js'; | ||
import flatRest from './_flatRest.js'; | ||
import toKey from './_toKey.js'; | ||
@@ -33,6 +33,6 @@ | ||
*/ | ||
var bindAll = baseRest(function(object, methodNames) { | ||
arrayEach(baseFlatten(methodNames, 1), function(key) { | ||
var bindAll = flatRest(function(object, methodNames) { | ||
arrayEach(methodNames, function(key) { | ||
key = toKey(key); | ||
object[key] = bind(object[key], object); | ||
baseAssignValue(object, key, bind(object[key], object)); | ||
}); | ||
@@ -39,0 +39,0 @@ return object; |
@@ -29,4 +29,7 @@ import arrayPush from './_arrayPush.js'; | ||
function concat() { | ||
var length = arguments.length, | ||
args = Array(length ? length - 1 : 0), | ||
var length = arguments.length; | ||
if (!length) { | ||
return []; | ||
} | ||
var args = Array(length - 1), | ||
array = arguments[0], | ||
@@ -38,7 +41,5 @@ index = length; | ||
} | ||
return length | ||
? arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1)) | ||
: []; | ||
return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1)); | ||
} | ||
export default concat; |
@@ -0,1 +1,2 @@ | ||
import baseAssignValue from './_baseAssignValue.js'; | ||
import createAggregator from './_createAggregator.js'; | ||
@@ -33,5 +34,9 @@ | ||
var countBy = createAggregator(function(result, value, key) { | ||
hasOwnProperty.call(result, key) ? ++result[key] : (result[key] = 1); | ||
if (hasOwnProperty.call(result, key)) { | ||
++result[key]; | ||
} else { | ||
baseAssignValue(result, key, 1); | ||
} | ||
}); | ||
export default countBy; |
@@ -20,3 +20,3 @@ import baseDelay from './_baseDelay.js'; | ||
* }, 'deferred'); | ||
* // => Logs 'deferred' after one or more milliseconds. | ||
* // => Logs 'deferred' after one millisecond. | ||
*/ | ||
@@ -23,0 +23,0 @@ var defer = baseRest(function(func, args) { |
@@ -9,4 +9,4 @@ import baseDifference from './_baseDifference.js'; | ||
* using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) | ||
* for equality comparisons. The order of result values is determined by the | ||
* order they occur in the first array. | ||
* for equality comparisons. The order and references of result values are | ||
* determined by the first array. | ||
* | ||
@@ -13,0 +13,0 @@ * **Note:** Unlike `_.pullAll`, this method returns a new array. |
@@ -11,4 +11,5 @@ import baseDifference from './_baseDifference.js'; | ||
* is invoked for each element of `array` and `values` to generate the criterion | ||
* by which they're compared. Result values are chosen from the first array. | ||
* The iteratee is invoked with one argument: (value). | ||
* by which they're compared. The order and references of result values are | ||
* determined by the first array. The iteratee is invoked with one argument: | ||
* (value). | ||
* | ||
@@ -15,0 +16,0 @@ * **Note:** Unlike `_.pullAllBy`, this method returns a new array. |
@@ -9,5 +9,5 @@ import baseDifference from './_baseDifference.js'; | ||
* This method is like `_.difference` except that it accepts `comparator` | ||
* which is invoked to compare elements of `array` to `values`. Result values | ||
* are chosen from the first array. The comparator is invoked with two arguments: | ||
* (arrVal, othVal). | ||
* which is invoked to compare elements of `array` to `values`. The order and | ||
* references of result values are determined by the first array. The comparator | ||
* is invoked with two arguments: (arrVal, othVal). | ||
* | ||
@@ -14,0 +14,0 @@ * **Note:** Unlike `_.pullAllWith`, this method returns a new array. |
@@ -9,4 +9,4 @@ import escapeHtmlChar from './_escapeHtmlChar.js'; | ||
/** | ||
* Converts the characters "&", "<", ">", '"', "'", and "\`" in `string` to | ||
* their corresponding HTML entities. | ||
* Converts the characters "&", "<", ">", '"', and "'" in `string` to their | ||
* corresponding HTML entities. | ||
* | ||
@@ -22,8 +22,2 @@ * **Note:** No other characters are escaped. To escape additional | ||
* | ||
* Backticks are escaped because in IE < 9, they can break out of | ||
* attribute values or HTML comments. See [#59](https://html5sec.org/#59), | ||
* [#102](https://html5sec.org/#102), [#108](https://html5sec.org/#108), and | ||
* [#133](https://html5sec.org/#133) of the | ||
* [HTML5 Security Cheatsheet](https://html5sec.org/) for more details. | ||
* | ||
* When working with HTML you should always | ||
@@ -30,0 +24,0 @@ * [quote attribute values](http://wonko.com/post/html-escaping) to reduce |
@@ -26,3 +26,3 @@ import arrayEach from './_arrayEach.js'; | ||
* | ||
* _([1, 2]).forEach(function(value) { | ||
* _.forEach([1, 2], function(value) { | ||
* console.log(value); | ||
@@ -29,0 +29,0 @@ * }); |
@@ -0,1 +1,2 @@ | ||
import baseAssignValue from './_baseAssignValue.js'; | ||
import createAggregator from './_createAggregator.js'; | ||
@@ -37,3 +38,3 @@ | ||
} else { | ||
result[key] = [value]; | ||
baseAssignValue(result, key, [value]); | ||
} | ||
@@ -40,0 +41,0 @@ }); |
@@ -9,4 +9,4 @@ import arrayMap from './_arrayMap.js'; | ||
* using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) | ||
* for equality comparisons. The order of result values is determined by the | ||
* order they occur in the first array. | ||
* for equality comparisons. The order and references of result values are | ||
* determined by the first array. | ||
* | ||
@@ -13,0 +13,0 @@ * @static |
@@ -11,4 +11,5 @@ import arrayMap from './_arrayMap.js'; | ||
* which is invoked for each element of each `arrays` to generate the criterion | ||
* by which they're compared. Result values are chosen from the first array. | ||
* The iteratee is invoked with one argument: (value). | ||
* by which they're compared. The order and references of result values are | ||
* determined by the first array. The iteratee is invoked with one argument: | ||
* (value). | ||
* | ||
@@ -15,0 +16,0 @@ * @static |
@@ -9,5 +9,5 @@ import arrayMap from './_arrayMap.js'; | ||
* This method is like `_.intersection` except that it accepts `comparator` | ||
* which is invoked to compare elements of `arrays`. Result values are chosen | ||
* from the first array. The comparator is invoked with two arguments: | ||
* (arrVal, othVal). | ||
* which is invoked to compare elements of `arrays`. The order and references | ||
* of result values are determined by the first array. The comparator is | ||
* invoked with two arguments: (arrVal, othVal). | ||
* | ||
@@ -14,0 +14,0 @@ * @static |
@@ -22,5 +22,5 @@ import isObjectLike from './isObjectLike.js'; | ||
function isElement(value) { | ||
return !!value && value.nodeType === 1 && isObjectLike(value) && !isPlainObject(value); | ||
return value != null && value.nodeType === 1 && isObjectLike(value) && !isPlainObject(value); | ||
} | ||
export default isElement; |
@@ -19,8 +19,2 @@ import getTag from './_getTag.js'; | ||
/** Built-in value references. */ | ||
var propertyIsEnumerable = objectProto.propertyIsEnumerable; | ||
/** Detect if properties shadowing those on `Object.prototype` are non-enumerable. */ | ||
var nonEnumShadows = !propertyIsEnumerable.call({ 'valueOf': 1 }, 'valueOf'); | ||
/** | ||
@@ -69,3 +63,3 @@ * Checks if `value` is an empty object, collection, map, or set. | ||
} | ||
if (nonEnumShadows || isPrototype(value)) { | ||
if (isPrototype(value)) { | ||
return !nativeKeys(value).length; | ||
@@ -72,0 +66,0 @@ } |
@@ -28,5 +28,5 @@ /** | ||
var type = typeof value; | ||
return !!value && (type == 'object' || type == 'function'); | ||
return value != null && (type == 'object' || type == 'function'); | ||
} | ||
export default isObject; |
@@ -26,5 +26,5 @@ /** | ||
function isObjectLike(value) { | ||
return !!value && typeof value == 'object'; | ||
return value != null && typeof value == 'object'; | ||
} | ||
export default isObjectLike; |
import getPrototype from './_getPrototype.js'; | ||
import isHostObject from './_isHostObject.js'; | ||
import isObjectLike from './isObjectLike.js'; | ||
@@ -57,4 +56,3 @@ | ||
function isPlainObject(value) { | ||
if (!isObjectLike(value) || | ||
objectToString.call(value) != objectTag || isHostObject(value)) { | ||
if (!isObjectLike(value) || objectToString.call(value) != objectTag) { | ||
return false; | ||
@@ -61,0 +59,0 @@ } |
@@ -0,1 +1,2 @@ | ||
import baseAssignValue from './_baseAssignValue.js'; | ||
import createAggregator from './_createAggregator.js'; | ||
@@ -33,5 +34,5 @@ | ||
var keyBy = createAggregator(function(result, value, key) { | ||
result[key] = value; | ||
baseAssignValue(result, key, value); | ||
}); | ||
export default keyBy; |
import baseFindIndex from './_baseFindIndex.js'; | ||
import baseIsNaN from './_baseIsNaN.js'; | ||
import strictLastIndexOf from './_strictLastIndexOf.js'; | ||
import toInteger from './toInteger.js'; | ||
@@ -38,19 +39,9 @@ | ||
index = toInteger(fromIndex); | ||
index = ( | ||
index < 0 | ||
? nativeMax(length + index, 0) | ||
: nativeMin(index, length - 1) | ||
) + 1; | ||
index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1); | ||
} | ||
if (value !== value) { | ||
return baseFindIndex(array, baseIsNaN, index - 1, true); | ||
} | ||
while (index--) { | ||
if (array[index] === value) { | ||
return index; | ||
} | ||
} | ||
return -1; | ||
return value === value | ||
? strictLastIndexOf(array, value, index) | ||
: baseFindIndex(array, baseIsNaN, index, true); | ||
} | ||
export default lastIndexOf; |
@@ -48,3 +48,3 @@ /** | ||
/** Used as the semantic version number. */ | ||
var VERSION = '4.15.0'; | ||
var VERSION = '4.16.0'; | ||
@@ -51,0 +51,0 @@ /** Used to compose bitmasks for function metadata. */ |
@@ -0,1 +1,2 @@ | ||
import baseAssignValue from './_baseAssignValue.js'; | ||
import baseForOwn from './_baseForOwn.js'; | ||
@@ -30,3 +31,3 @@ import baseIteratee from './_baseIteratee.js'; | ||
baseForOwn(object, function(value, key, object) { | ||
result[iteratee(value, key, object)] = value; | ||
baseAssignValue(result, iteratee(value, key, object), value); | ||
}); | ||
@@ -33,0 +34,0 @@ return result; |
@@ -0,1 +1,2 @@ | ||
import baseAssignValue from './_baseAssignValue.js'; | ||
import baseForOwn from './_baseForOwn.js'; | ||
@@ -37,3 +38,3 @@ import baseIteratee from './_baseIteratee.js'; | ||
baseForOwn(object, function(value, key, object) { | ||
result[key] = iteratee(value, key, object); | ||
baseAssignValue(result, key, iteratee(value, key, object)); | ||
}); | ||
@@ -40,0 +41,0 @@ return result; |
@@ -63,3 +63,3 @@ import MapCache from './_MapCache.js'; | ||
var result = func.apply(this, args); | ||
memoized.cache = cache.set(key, result); | ||
memoized.cache = cache.set(key, result) || cache; | ||
return result; | ||
@@ -71,5 +71,5 @@ }; | ||
// Assign cache to `_.memoize`. | ||
// Expose `MapCache`. | ||
memoize.Cache = MapCache; | ||
export default memoize; |
@@ -8,3 +8,3 @@ import baseMerge from './_baseMerge.js'; | ||
* properties. If `customizer` returns `undefined`, merging is handled by the | ||
* method instead. The `customizer` is invoked with seven arguments: | ||
* method instead. The `customizer` is invoked with six arguments: | ||
* (objValue, srcValue, key, object, source, stack). | ||
@@ -11,0 +11,0 @@ * |
import arrayMap from './_arrayMap.js'; | ||
import baseDifference from './_baseDifference.js'; | ||
import baseFlatten from './_baseFlatten.js'; | ||
import basePick from './_basePick.js'; | ||
import baseRest from './_baseRest.js'; | ||
import flatRest from './_flatRest.js'; | ||
import getAllKeysIn from './_getAllKeysIn.js'; | ||
@@ -28,7 +27,7 @@ import toKey from './_toKey.js'; | ||
*/ | ||
var omit = baseRest(function(object, props) { | ||
var omit = flatRest(function(object, props) { | ||
if (object == null) { | ||
return {}; | ||
} | ||
props = arrayMap(baseFlatten(props, 1), toKey); | ||
props = arrayMap(props, toKey); | ||
return basePick(object, baseDifference(getAllKeysIn(object), props)); | ||
@@ -35,0 +34,0 @@ }); |
@@ -7,2 +7,3 @@ import apply from './_apply.js'; | ||
import baseUnary from './_baseUnary.js'; | ||
import castRest from './_castRest.js'; | ||
import isArray from './isArray.js'; | ||
@@ -44,3 +45,3 @@ | ||
*/ | ||
var overArgs = baseRest(function(func, transforms) { | ||
var overArgs = castRest(function(func, transforms) { | ||
transforms = (transforms.length == 1 && isArray(transforms[0])) | ||
@@ -47,0 +48,0 @@ ? arrayMap(transforms[0], baseUnary(baseIteratee)) |
{ | ||
"name": "lodash-es", | ||
"version": "4.15.0", | ||
"version": "4.16.0", | ||
"description": "Lodash exported as ES modules.", | ||
@@ -12,2 +12,3 @@ "keywords": "es6, modules, stdlib, util", | ||
"main": "lodash.js", | ||
"module": "lodash.js", | ||
"author": "John-David Dalton <john.david.dalton@gmail.com> (http://allyoucanleet.com/)", | ||
@@ -14,0 +15,0 @@ "contributors": [ |
import root from './_root.js'; | ||
import toString from './toString.js'; | ||
/** Used to match leading and trailing whitespace. */ | ||
var reTrim = /^\s+|\s+$/g; | ||
/** Used to detect hexadecimal string values. */ | ||
var reHasHexPrefix = /^0x/i; | ||
/* Built-in method references for those with the same name as other `lodash` methods. */ | ||
@@ -38,4 +32,2 @@ var nativeParseInt = root.parseInt; | ||
function parseInt(string, radix, guard) { | ||
// Chrome fails to trim leading <BOM> whitespace characters. | ||
// See https://bugs.chromium.org/p/v8/issues/detail?id=3109 for more details. | ||
if (guard || radix == null) { | ||
@@ -46,6 +38,5 @@ radix = 0; | ||
} | ||
string = toString(string).replace(reTrim, ''); | ||
return nativeParseInt(string, radix || (reHasHexPrefix.test(string) ? 16 : 10)); | ||
return nativeParseInt(toString(string), radix || 0); | ||
} | ||
export default parseInt; |
import arrayMap from './_arrayMap.js'; | ||
import baseFlatten from './_baseFlatten.js'; | ||
import basePick from './_basePick.js'; | ||
import baseRest from './_baseRest.js'; | ||
import flatRest from './_flatRest.js'; | ||
import toKey from './_toKey.js'; | ||
@@ -24,6 +23,6 @@ | ||
*/ | ||
var pick = baseRest(function(object, props) { | ||
return object == null ? {} : basePick(object, arrayMap(baseFlatten(props, 1), toKey)); | ||
var pick = flatRest(function(object, props) { | ||
return object == null ? {} : basePick(object, arrayMap(props, toKey)); | ||
}); | ||
export default pick; |
import arrayMap from './_arrayMap.js'; | ||
import baseAt from './_baseAt.js'; | ||
import baseFlatten from './_baseFlatten.js'; | ||
import basePullAt from './_basePullAt.js'; | ||
import baseRest from './_baseRest.js'; | ||
import compareAscending from './_compareAscending.js'; | ||
import flatRest from './_flatRest.js'; | ||
import isIndex from './_isIndex.js'; | ||
@@ -33,5 +32,3 @@ | ||
*/ | ||
var pullAt = baseRest(function(array, indexes) { | ||
indexes = baseFlatten(indexes, 1); | ||
var pullAt = flatRest(function(array, indexes) { | ||
var length = array ? array.length : 0, | ||
@@ -38,0 +35,0 @@ result = baseAt(array, indexes); |
@@ -1,2 +0,2 @@ | ||
# lodash-es v4.15.0 | ||
# lodash-es v4.16.0 | ||
@@ -6,6 +6,6 @@ The [Lodash](https://lodash.com/) library exported as [ES](http://www.ecma-international.org/ecma-262/6.0/) modules. | ||
Generated using [lodash-cli](https://www.npmjs.com/package/lodash-cli): | ||
```bash | ||
```shell | ||
$ lodash modularize exports=es -o ./ | ||
``` | ||
See the [package source](https://github.com/lodash/lodash/tree/4.15.0-es) for more details. | ||
See the [package source](https://github.com/lodash/lodash/tree/4.16.0-es) for more details. |
@@ -1,4 +0,3 @@ | ||
import baseFlatten from './_baseFlatten.js'; | ||
import baseRest from './_baseRest.js'; | ||
import createWrap from './_createWrap.js'; | ||
import flatRest from './_flatRest.js'; | ||
@@ -30,6 +29,6 @@ /** Used to compose bitmasks for function metadata. */ | ||
*/ | ||
var rearg = baseRest(function(func, indexes) { | ||
return createWrap(func, REARG_FLAG, undefined, undefined, undefined, baseFlatten(indexes, 1)); | ||
var rearg = flatRest(function(func, indexes) { | ||
return createWrap(func, REARG_FLAG, undefined, undefined, undefined, indexes); | ||
}); | ||
export default rearg; |
@@ -1,2 +0,2 @@ | ||
import baseRandom from './_baseRandom.js'; | ||
import arraySample from './_arraySample.js'; | ||
import isArrayLike from './isArrayLike.js'; | ||
@@ -20,8 +20,5 @@ import values from './values.js'; | ||
function sample(collection) { | ||
var array = isArrayLike(collection) ? collection : values(collection), | ||
length = array.length; | ||
return length > 0 ? array[baseRandom(0, length - 1)] : undefined; | ||
return arraySample(isArrayLike(collection) ? collection : values(collection)); | ||
} | ||
export default sample; |
@@ -1,6 +0,6 @@ | ||
import baseClamp from './_baseClamp.js'; | ||
import baseRandom from './_baseRandom.js'; | ||
import arraySampleSize from './_arraySampleSize.js'; | ||
import isArrayLike from './isArrayLike.js'; | ||
import isIterateeCall from './_isIterateeCall.js'; | ||
import toArray from './toArray.js'; | ||
import toInteger from './toInteger.js'; | ||
import values from './values.js'; | ||
@@ -28,23 +28,10 @@ /** | ||
function sampleSize(collection, n, guard) { | ||
var index = -1, | ||
result = toArray(collection), | ||
length = result.length, | ||
lastIndex = length - 1; | ||
if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) { | ||
n = 1; | ||
} else { | ||
n = baseClamp(toInteger(n), 0, length); | ||
n = toInteger(n); | ||
} | ||
while (++index < n) { | ||
var rand = baseRandom(index, lastIndex), | ||
value = result[rand]; | ||
result[rand] = result[index]; | ||
result[index] = value; | ||
} | ||
result.length = n; | ||
return result; | ||
return arraySampleSize(isArrayLike(collection) ? collection : values(collection), n); | ||
} | ||
export default sampleSize; |
@@ -1,6 +0,6 @@ | ||
import sampleSize from './sampleSize.js'; | ||
import copyArray from './_copyArray.js'; | ||
import isArrayLike from './isArrayLike.js'; | ||
import shuffleSelf from './_shuffleSelf.js'; | ||
import values from './values.js'; | ||
/** Used as references for the maximum length and index of an array. */ | ||
var MAX_ARRAY_LENGTH = 4294967295; | ||
/** | ||
@@ -22,5 +22,8 @@ * Creates an array of shuffled values, using a version of the | ||
function shuffle(collection) { | ||
return sampleSize(collection, MAX_ARRAY_LENGTH); | ||
return shuffleSelf(isArrayLike(collection) | ||
? copyArray(collection) | ||
: values(collection) | ||
); | ||
} | ||
export default shuffle; |
@@ -29,3 +29,3 @@ import baseFlatten from './_baseFlatten.js'; | ||
* | ||
* _.sortBy(users, function(o) { return o.user; }); | ||
* _.sortBy(users, [function(o) { return o.user; }]); | ||
* // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]] | ||
@@ -35,7 +35,2 @@ * | ||
* // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]] | ||
* | ||
* _.sortBy(users, 'user', function(o) { | ||
* return Math.floor(o.age / 10); | ||
* }); | ||
* // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]] | ||
*/ | ||
@@ -42,0 +37,0 @@ var sortBy = baseRest(function(collection, iteratees) { |
@@ -89,3 +89,4 @@ import assignInDefaults from './_assignInDefaults.js'; | ||
* | ||
* // Use the ES delimiter as an alternative to the default "interpolate" delimiter. | ||
* // Use the ES template literal delimiter as an "interpolate" delimiter. | ||
* // Disable support by replacing the "interpolate" delimiter. | ||
* var compiled = _.template('hello ${ user }!'); | ||
@@ -92,0 +93,0 @@ * compiled({ 'user': 'pebbles' }); |
@@ -10,3 +10,3 @@ import toString from './toString.js'; | ||
* The inverse of `_.escape`; this method converts the HTML entities | ||
* `&`, `<`, `>`, `"`, `'`, and ``` in `string` to | ||
* `&`, `<`, `>`, `"`, and `'` in `string` to | ||
* their corresponding characters. | ||
@@ -13,0 +13,0 @@ * |
@@ -6,4 +6,5 @@ import baseUniq from './_baseUniq.js'; | ||
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) | ||
* for equality comparisons, in which only the first occurrence of each | ||
* element is kept. | ||
* for equality comparisons, in which only the first occurrence of each element | ||
* is kept. The order of result values is determined by the order they occur | ||
* in the array. | ||
* | ||
@@ -10,0 +11,0 @@ * @static |
@@ -7,3 +7,5 @@ import baseIteratee from './_baseIteratee.js'; | ||
* invoked for each element in `array` to generate the criterion by which | ||
* uniqueness is computed. The iteratee is invoked with one argument: (value). | ||
* uniqueness is computed. The order of result values is determined by the | ||
* order they occur in the array. The iteratee is invoked with one argument: | ||
* (value). | ||
* | ||
@@ -10,0 +12,0 @@ * @static |
@@ -5,4 +5,5 @@ import baseUniq from './_baseUniq.js'; | ||
* This method is like `_.uniq` except that it accepts `comparator` which | ||
* is invoked to compare elements of `array`. The comparator is invoked with | ||
* two arguments: (arrVal, othVal). | ||
* is invoked to compare elements of `array`. The order of result values is | ||
* determined by the order they occur in the array.The comparator is invoked | ||
* with two arguments: (arrVal, othVal). | ||
* | ||
@@ -9,0 +10,0 @@ * @static |
import LazyWrapper from './_LazyWrapper.js'; | ||
import LodashWrapper from './_LodashWrapper.js'; | ||
import baseAt from './_baseAt.js'; | ||
import baseFlatten from './_baseFlatten.js'; | ||
import baseRest from './_baseRest.js'; | ||
import flatRest from './_flatRest.js'; | ||
import isIndex from './_isIndex.js'; | ||
@@ -25,4 +24,3 @@ import thru from './thru.js'; | ||
*/ | ||
var wrapperAt = baseRest(function(paths) { | ||
paths = baseFlatten(paths, 1); | ||
var wrapperAt = flatRest(function(paths) { | ||
var length = paths.length, | ||
@@ -29,0 +27,0 @@ start = length ? paths[0] : 0, |
@@ -11,4 +11,5 @@ import arrayFilter from './_arrayFilter.js'; | ||
* invoked for each element of each `arrays` to generate the criterion by | ||
* which by which they're compared. The iteratee is invoked with one argument: | ||
* (value). | ||
* which by which they're compared. The order of result values is determined | ||
* by the order they occur in the arrays. The iteratee is invoked with one | ||
* argument: (value). | ||
* | ||
@@ -15,0 +16,0 @@ * @static |
@@ -9,4 +9,5 @@ import arrayFilter from './_arrayFilter.js'; | ||
* This method is like `_.xor` except that it accepts `comparator` which is | ||
* invoked to compare elements of `arrays`. The comparator is invoked with | ||
* two arguments: (arrVal, othVal). | ||
* invoked to compare elements of `arrays`. The order of result values is | ||
* determined by the order they occur in the arrays. The comparator is invoked | ||
* with two arguments: (arrVal, othVal). | ||
* | ||
@@ -13,0 +14,0 @@ * @static |
618361
635
19337