mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 18:37:50 +00:00
Only check indexes for arrays in _.keysIn dense array support.
This commit is contained in:
18
lodash.js
18
lodash.js
@@ -6544,23 +6544,23 @@
|
|||||||
if (!isObject(object)) {
|
if (!isObject(object)) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
var length = object.length;
|
var isArr,
|
||||||
|
keyIndex,
|
||||||
|
length = object.length;
|
||||||
|
|
||||||
length = (typeof length == 'number' && length > 0 &&
|
length = (typeof length == 'number' && length > 0 &&
|
||||||
(isArray(object) || (support.nonEnumStrings && isString(object)) ||
|
((isArr = isArray(object)) || (support.nonEnumStrings && isString(object)) ||
|
||||||
(support.nonEnumArgs && isArguments(object))) && length) >>> 0;
|
(support.nonEnumArgs && isArguments(object))) && length) >>> 0;
|
||||||
|
|
||||||
var keyIndex,
|
var index = -1,
|
||||||
maxIndex = length - 1,
|
maxIndex = length - 1,
|
||||||
result = Array(length),
|
result = Array(length),
|
||||||
skipIndexes = length > 0,
|
skipIndexes = isArr && length > 0,
|
||||||
skipErrorProps = support.enumErrorProps && (object === errorProto || object instanceof Error),
|
skipErrorProps = support.enumErrorProps && (object === errorProto || object instanceof Error),
|
||||||
skipProto = support.enumPrototypes && typeof object == 'function';
|
skipProto = support.enumPrototypes && typeof object == 'function';
|
||||||
|
|
||||||
if (skipIndexes) {
|
while (++index < length) {
|
||||||
var index = -1;
|
result[index] = String(index);
|
||||||
while (++index < length) {
|
|
||||||
result[index] = String(index);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
for (var key in object) {
|
for (var key in object) {
|
||||||
if (!(skipProto && key == 'prototype') &&
|
if (!(skipProto && key == 'prototype') &&
|
||||||
|
|||||||
Reference in New Issue
Block a user