mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-02 08:07:50 +00:00
Bump to v4.14.2.
This commit is contained in:
31
keysIn.js
31
keysIn.js
@@ -1,13 +1,6 @@
|
||||
var baseKeysIn = require('./_baseKeysIn'),
|
||||
indexKeys = require('./_indexKeys'),
|
||||
isIndex = require('./_isIndex'),
|
||||
isPrototype = require('./_isPrototype');
|
||||
|
||||
/** Used for built-in method references. */
|
||||
var objectProto = Object.prototype;
|
||||
|
||||
/** Used to check objects for own properties. */
|
||||
var hasOwnProperty = objectProto.hasOwnProperty;
|
||||
var arrayLikeKeys = require('./_arrayLikeKeys'),
|
||||
baseKeysIn = require('./_baseKeysIn'),
|
||||
isArrayLike = require('./isArrayLike');
|
||||
|
||||
/**
|
||||
* Creates an array of the own and inherited enumerable property names of `object`.
|
||||
@@ -33,23 +26,7 @@ var hasOwnProperty = objectProto.hasOwnProperty;
|
||||
* // => ['a', 'b', 'c'] (iteration order is not guaranteed)
|
||||
*/
|
||||
function keysIn(object) {
|
||||
var index = -1,
|
||||
isProto = isPrototype(object),
|
||||
props = baseKeysIn(object),
|
||||
propsLength = props.length,
|
||||
indexes = indexKeys(object),
|
||||
skipIndexes = !!indexes,
|
||||
result = indexes || [],
|
||||
length = result.length;
|
||||
|
||||
while (++index < propsLength) {
|
||||
var key = props[index];
|
||||
if (!(skipIndexes && (key == 'length' || isIndex(key, length))) &&
|
||||
!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
|
||||
result.push(key);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
|
||||
}
|
||||
|
||||
module.exports = keysIn;
|
||||
|
||||
Reference in New Issue
Block a user