mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-07 10:07:48 +00:00
Remove getPrototype.
This commit is contained in:
@@ -1,6 +0,0 @@
|
|||||||
import overArg from './.internal/overArg.js';
|
|
||||||
|
|
||||||
/** Built-in value references. */
|
|
||||||
const getPrototype = overArg(Object.getPrototypeOf, Object);
|
|
||||||
|
|
||||||
export default getPrototype;
|
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
import arrayPush from './.internal/arrayPush.js';
|
import arrayPush from './.internal/arrayPush.js';
|
||||||
import getPrototype from './.internal/getPrototype.js';
|
|
||||||
import getSymbols from './.internal/getSymbols.js';
|
import getSymbols from './.internal/getSymbols.js';
|
||||||
import stubArray from './stubArray.js';
|
import stubArray from './stubArray.js';
|
||||||
|
|
||||||
@@ -17,7 +16,7 @@ const getSymbolsIn = !nativeGetSymbols ? stubArray : object => {
|
|||||||
const result = [];
|
const result = [];
|
||||||
while (object) {
|
while (object) {
|
||||||
arrayPush(result, getSymbols(object));
|
arrayPush(result, getSymbols(object));
|
||||||
object = getPrototype(object);
|
object = Object.getPrototypeOf(Object(object));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import baseCreate from './.internal/baseCreate.js';
|
import baseCreate from './.internal/baseCreate.js';
|
||||||
import getPrototype from './.internal/getPrototype.js';
|
|
||||||
import isPrototype from './.internal/isPrototype.js';
|
import isPrototype from './.internal/isPrototype.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -11,7 +10,7 @@ import isPrototype from './.internal/isPrototype.js';
|
|||||||
*/
|
*/
|
||||||
function initCloneObject(object) {
|
function initCloneObject(object) {
|
||||||
return (typeof object.constructor == 'function' && !isPrototype(object))
|
return (typeof object.constructor == 'function' && !isPrototype(object))
|
||||||
? baseCreate(getPrototype(object))
|
? baseCreate(Object.getPrototypeOf(object))
|
||||||
: {};
|
: {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import baseGetTag from './.internal/baseGetTag.js';
|
import baseGetTag from './.internal/baseGetTag.js';
|
||||||
import getPrototype from './.internal/getPrototype.js';
|
|
||||||
import isObjectLike from './isObjectLike.js';
|
import isObjectLike from './isObjectLike.js';
|
||||||
|
|
||||||
/** Used to resolve the decompiled source of functions. */
|
/** Used to resolve the decompiled source of functions. */
|
||||||
@@ -41,7 +40,7 @@ function isPlainObject(value) {
|
|||||||
if (!isObjectLike(value) || baseGetTag(value) != '[object Object]') {
|
if (!isObjectLike(value) || baseGetTag(value) != '[object Object]') {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const proto = getPrototype(value);
|
const proto = Object.getPrototypeOf(value);
|
||||||
if (proto === null) {
|
if (proto === null) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import arrayEach from './.internal/arrayEach.js';
|
import arrayEach from './.internal/arrayEach.js';
|
||||||
import baseCreate from './.internal/baseCreate.js';
|
import baseCreate from './.internal/baseCreate.js';
|
||||||
import baseForOwn from './.internal/baseForOwn.js';
|
import baseForOwn from './.internal/baseForOwn.js';
|
||||||
import getPrototype from './.internal/getPrototype.js';
|
|
||||||
import isBuffer from './isBuffer.js';
|
import isBuffer from './isBuffer.js';
|
||||||
import isFunction from './isFunction.js';
|
import isFunction from './isFunction.js';
|
||||||
import isObject from './isObject.js';
|
import isObject from './isObject.js';
|
||||||
@@ -45,13 +44,14 @@ function transform(object, iteratee, accumulator) {
|
|||||||
accumulator = isArr ? new Ctor : [];
|
accumulator = isArr ? new Ctor : [];
|
||||||
}
|
}
|
||||||
else if (isObject(object)) {
|
else if (isObject(object)) {
|
||||||
accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
|
accumulator = isFunction(Ctor) ? baseCreate(Object.getPrototypeOf(object)) : {};
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
accumulator = {};
|
accumulator = {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(isArrLike ? arrayEach : baseForOwn)(object, (value, index, object) => iteratee(accumulator, value, index, object));
|
(isArrLike ? arrayEach : baseForOwn)(object, (value, index, object) =>
|
||||||
|
iteratee(accumulator, value, index, object));
|
||||||
return accumulator;
|
return accumulator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user