diff --git a/.internal/baseKeys.js b/.internal/baseKeys.js index 677b855b6..7e4e2a5db 100644 --- a/.internal/baseKeys.js +++ b/.internal/baseKeys.js @@ -1,5 +1,4 @@ import isPrototype from './isPrototype.js' -import nativeKeys from './nativeKeys.js' /** Used to check objects for own properties. */ const hasOwnProperty = Object.prototype.hasOwnProperty @@ -13,7 +12,7 @@ const hasOwnProperty = Object.prototype.hasOwnProperty */ function baseKeys(object) { if (!isPrototype(object)) { - return nativeKeys(object) + return Object.keys(Object(object)) } const result = [] for (const key in Object(object)) { diff --git a/.internal/baseKeysIn.js b/.internal/baseKeysIn.js index e0de1b968..60bc2f210 100644 --- a/.internal/baseKeysIn.js +++ b/.internal/baseKeysIn.js @@ -1,6 +1,5 @@ import isObject from '../isObject.js' import isPrototype from './isPrototype.js' -import nativeKeysIn from './nativeKeysIn.js' /** Used to check objects for own properties. */ const hasOwnProperty = Object.prototype.hasOwnProperty @@ -13,12 +12,17 @@ const hasOwnProperty = Object.prototype.hasOwnProperty * @returns {Array} Returns the array of property names. */ function baseKeysIn(object) { + const result = [] + if (object == null) { + return result + } if (!isObject(object)) { - return nativeKeysIn(object) + for (const key in Object(object)) { + result.push(key) + } + return result } const isProto = isPrototype(object) - const result = [] - for (const key in object) { if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { result.push(key) diff --git a/.internal/nativeKeys.js b/.internal/nativeKeys.js deleted file mode 100644 index 24bc7c64c..000000000 --- a/.internal/nativeKeys.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This function is a thin wrapper around - * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) - * which ensures non-object values are coerced to objects beforehand. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - */ -function nativeKeys(object) { - return Object.keys(Object(object)) -} - -export default nativeKeys diff --git a/.internal/nativeKeysIn.js b/.internal/nativeKeysIn.js deleted file mode 100644 index 7ab18a1bc..000000000 --- a/.internal/nativeKeysIn.js +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This function is like - * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) - * except that it includes inherited enumerable properties. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - */ -function nativeKeysIn(object) { - const result = [] - if (object != null) { - for (const key in Object(object)) { - result.push(key) - } - } - return result -} - -export default nativeKeysIn