diff options
Diffstat (limited to 'tools/eslint/node_modules/lodash/_baseKeys.js')
-rw-r--r-- | tools/eslint/node_modules/lodash/_baseKeys.js | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/tools/eslint/node_modules/lodash/_baseKeys.js b/tools/eslint/node_modules/lodash/_baseKeys.js index 2a27d55546..45e9e6f39f 100644 --- a/tools/eslint/node_modules/lodash/_baseKeys.js +++ b/tools/eslint/node_modules/lodash/_baseKeys.js @@ -1,16 +1,30 @@ -var overArg = require('./_overArg'); +var isPrototype = require('./_isPrototype'), + nativeKeys = require('./_nativeKeys'); -/* Built-in method references for those with the same name as other `lodash` methods. */ -var nativeKeys = Object.keys; +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; /** - * The base implementation of `_.keys` which doesn't skip the constructor - * property of prototypes or treat sparse arrays as dense. + * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. */ -var baseKeys = overArg(nativeKeys, Object); +function baseKeys(object) { + if (!isPrototype(object)) { + return nativeKeys(object); + } + var result = []; + for (var key in Object(object)) { + if (hasOwnProperty.call(object, key) && key != 'constructor') { + result.push(key); + } + } + return result; +} module.exports = baseKeys; |