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