From b6bdb23ffdd5bc263f117cf9b43f36e20ebdfcc7 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Tue, 10 Jan 2017 17:44:48 -0800 Subject: [PATCH] Remove `getPrototype`. --- .internal/getPrototype.js | 6 ------ .internal/getSymbolsIn.js | 3 +-- .internal/initCloneObject.js | 3 +-- isPlainObject.js | 3 +-- transform.js | 6 +++--- 5 files changed, 6 insertions(+), 15 deletions(-) delete mode 100644 .internal/getPrototype.js diff --git a/.internal/getPrototype.js b/.internal/getPrototype.js deleted file mode 100644 index a97135931..000000000 --- a/.internal/getPrototype.js +++ /dev/null @@ -1,6 +0,0 @@ -import overArg from './.internal/overArg.js'; - -/** Built-in value references. */ -const getPrototype = overArg(Object.getPrototypeOf, Object); - -export default getPrototype; diff --git a/.internal/getSymbolsIn.js b/.internal/getSymbolsIn.js index 25e0e045f..25360dc46 100644 --- a/.internal/getSymbolsIn.js +++ b/.internal/getSymbolsIn.js @@ -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; }; diff --git a/.internal/initCloneObject.js b/.internal/initCloneObject.js index 1cf500060..aaaaa4cd7 100644 --- a/.internal/initCloneObject.js +++ b/.internal/initCloneObject.js @@ -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)) : {}; } diff --git a/isPlainObject.js b/isPlainObject.js index df2629d20..5352ee434 100644 --- a/isPlainObject.js +++ b/isPlainObject.js @@ -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; } diff --git a/transform.js b/transform.js index c8685e0ca..2262e29d0 100644 --- a/transform.js +++ b/transform.js @@ -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; }