Remove nativeKeys and nativeKeysIn.

This commit is contained in:
John-David Dalton
2017-03-21 22:23:03 -07:00
parent f3e0cbe5bf
commit f7a6cddc9e
4 changed files with 9 additions and 40 deletions

View File

@@ -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)