mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 06:27:49 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d9fd2bdf9c |
@@ -1,4 +1,4 @@
|
||||
# lodash-es v4.16.2
|
||||
# lodash-es v4.16.3
|
||||
|
||||
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 ./
|
||||
```
|
||||
|
||||
See the [package source](https://github.com/lodash/lodash/tree/4.16.2-es) for more details.
|
||||
See the [package source](https://github.com/lodash/lodash/tree/4.16.3-es) for more details.
|
||||
|
||||
@@ -12,7 +12,7 @@ import eq from './eq.js';
|
||||
*/
|
||||
function assignMergeValue(object, key, value) {
|
||||
if ((value !== undefined && !eq(object[key], value)) ||
|
||||
(typeof key == 'number' && value === undefined && !(key in object))) {
|
||||
(value === undefined && !(key in object))) {
|
||||
baseAssignValue(object, key, value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
/** Built-in value references. */
|
||||
var defineProperty = Object.defineProperty;
|
||||
import defineProperty from './_defineProperty.js';
|
||||
|
||||
/**
|
||||
* The base implementation of `assignValue` and `assignMergeValue` without
|
||||
|
||||
@@ -20,7 +20,7 @@ var baseCreate = (function() {
|
||||
if (objectCreate) {
|
||||
return objectCreate(proto);
|
||||
}
|
||||
object.prototype = prototype;
|
||||
object.prototype = proto;
|
||||
var result = new object;
|
||||
object.prototype = undefined;
|
||||
return result;
|
||||
|
||||
@@ -4,6 +4,7 @@ import equalByTag from './_equalByTag.js';
|
||||
import equalObjects from './_equalObjects.js';
|
||||
import getTag from './_getTag.js';
|
||||
import isArray from './isArray.js';
|
||||
import isBuffer from './isBuffer.js';
|
||||
import isTypedArray from './isTypedArray.js';
|
||||
|
||||
/** Used to compose bitmasks for comparison styles. */
|
||||
@@ -53,6 +54,13 @@ function baseIsEqualDeep(object, other, equalFunc, customizer, bitmask, stack) {
|
||||
othIsObj = othTag == objectTag,
|
||||
isSameTag = objTag == othTag;
|
||||
|
||||
if (isSameTag && isBuffer(object)) {
|
||||
if (!isBuffer(other)) {
|
||||
return false;
|
||||
}
|
||||
objIsArr = true;
|
||||
objIsObj = false;
|
||||
}
|
||||
if (isSameTag && !objIsObj) {
|
||||
stack || (stack = new Stack);
|
||||
return (objIsArr || isTypedArray(object))
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import assignMergeValue from './_assignMergeValue.js';
|
||||
import baseClone from './_baseClone.js';
|
||||
import cloneTypedArray from './_cloneTypedArray.js';
|
||||
import copyArray from './_copyArray.js';
|
||||
import initCloneObject from './_initCloneObject.js';
|
||||
import isArguments from './isArguments.js';
|
||||
import isArray from './isArray.js';
|
||||
import isArrayLikeObject from './isArrayLikeObject.js';
|
||||
@@ -41,29 +42,32 @@ function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, sta
|
||||
var isCommon = newValue === undefined;
|
||||
|
||||
if (isCommon) {
|
||||
var isArr = isArray(srcValue),
|
||||
isTyped = !isArr && isTypedArray(srcValue);
|
||||
|
||||
newValue = srcValue;
|
||||
if (isArray(srcValue) || isTypedArray(srcValue)) {
|
||||
if (isArr || isTyped) {
|
||||
if (isArray(objValue)) {
|
||||
newValue = objValue;
|
||||
}
|
||||
else if (isArrayLikeObject(objValue)) {
|
||||
newValue = copyArray(objValue);
|
||||
}
|
||||
else {
|
||||
else if (isTyped) {
|
||||
isCommon = false;
|
||||
newValue = baseClone(srcValue, true);
|
||||
newValue = cloneTypedArray(srcValue, true);
|
||||
}
|
||||
else {
|
||||
newValue = [];
|
||||
}
|
||||
}
|
||||
else if (isPlainObject(srcValue) || isArguments(srcValue)) {
|
||||
newValue = objValue;
|
||||
if (isArguments(objValue)) {
|
||||
newValue = toPlainObject(objValue);
|
||||
}
|
||||
else if (!isObject(objValue) || (srcIndex && isFunction(objValue))) {
|
||||
isCommon = false;
|
||||
newValue = baseClone(srcValue, true);
|
||||
}
|
||||
else {
|
||||
newValue = objValue;
|
||||
newValue = initCloneObject(srcValue);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import constant from './constant.js';
|
||||
import defineProperty from './_defineProperty.js';
|
||||
import identity from './identity.js';
|
||||
import nativeDefineProperty from './_nativeDefineProperty.js';
|
||||
|
||||
/**
|
||||
* The base implementation of `setToString` without support for hot loop shorting.
|
||||
@@ -10,8 +10,8 @@ import nativeDefineProperty from './_nativeDefineProperty.js';
|
||||
* @param {Function} string The `toString` result.
|
||||
* @returns {Function} Returns `func`.
|
||||
*/
|
||||
var baseSetToString = !nativeDefineProperty ? identity : function(func, string) {
|
||||
return nativeDefineProperty(func, 'toString', {
|
||||
var baseSetToString = !defineProperty ? identity : function(func, string) {
|
||||
return defineProperty(func, 'toString', {
|
||||
'configurable': true,
|
||||
'enumerable': false,
|
||||
'value': constant(string),
|
||||
|
||||
11
_defineProperty.js
Normal file
11
_defineProperty.js
Normal file
@@ -0,0 +1,11 @@
|
||||
import getNative from './_getNative.js';
|
||||
|
||||
var defineProperty = (function() {
|
||||
try {
|
||||
var func = getNative(Object, 'defineProperty');
|
||||
func({}, '', {});
|
||||
return func;
|
||||
} catch (e) {}
|
||||
}());
|
||||
|
||||
export default defineProperty;
|
||||
@@ -1,6 +0,0 @@
|
||||
import getNative from './_getNative.js';
|
||||
|
||||
/* Built-in method references that are verified to be native. */
|
||||
var nativeDefineProperty = getNative(Object, 'defineProperty');
|
||||
|
||||
export default nativeDefineProperty;
|
||||
@@ -2,7 +2,8 @@ import isObject from './isObject.js';
|
||||
|
||||
/** `Object#toString` result references. */
|
||||
var funcTag = '[object Function]',
|
||||
genTag = '[object GeneratorFunction]';
|
||||
genTag = '[object GeneratorFunction]',
|
||||
proxyTag = '[object Proxy]';
|
||||
|
||||
/** Used for built-in method references. */
|
||||
var objectProto = Object.prototype;
|
||||
@@ -35,7 +36,7 @@ function isFunction(value) {
|
||||
// The use of `Object#toString` avoids issues with the `typeof` operator
|
||||
// in Safari 8-9 which returns 'object' for typed array and other constructors.
|
||||
var tag = isObject(value) ? objectToString.call(value) : '';
|
||||
return tag == funcTag || tag == genTag;
|
||||
return tag == funcTag || tag == genTag || tag == proxyTag;
|
||||
}
|
||||
|
||||
export default isFunction;
|
||||
|
||||
@@ -45,7 +45,7 @@ import toInteger from './toInteger.js';
|
||||
import lodash from './wrapperLodash.js';
|
||||
|
||||
/** Used as the semantic version number. */
|
||||
var VERSION = '4.16.2';
|
||||
var VERSION = '4.16.3';
|
||||
|
||||
/** Used to compose bitmasks for function metadata. */
|
||||
var BIND_KEY_FLAG = 2;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "lodash-es",
|
||||
"version": "4.16.2",
|
||||
"version": "4.16.3",
|
||||
"description": "Lodash exported as ES modules.",
|
||||
"keywords": "es6, modules, stdlib, util",
|
||||
"homepage": "https://lodash.com/custom-builds",
|
||||
|
||||
Reference in New Issue
Block a user