From 6dd8c05533ce8d91193cc4fd4b74c14efa6fd6cc Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Thu, 30 Oct 2014 23:43:24 -0700 Subject: [PATCH] Cleanup `_.keysIn`. --- lodash.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lodash.js b/lodash.js index f5cf936a2..3b006d54c 100644 --- a/lodash.js +++ b/lodash.js @@ -8042,25 +8042,23 @@ // attribute of an existing property and the `constructor` property of a // prototype defaults to non-enumerable. for (var key in object) { - if (!(key == 'constructor' && (isProto || (Ctor === proto[key] && !hasOwnProperty.call(object, key)))) && - !(skipProto && key == 'prototype') && + if (!(skipProto && key == 'prototype') && !(skipErrorProps && (key == 'message' || key == 'name')) && - !(skipIndexes && (keyIndex = +key, keyIndex > -1 && keyIndex < length && keyIndex % 1 == 0))) { + !(skipIndexes && (keyIndex = +key, keyIndex > -1 && keyIndex < length && keyIndex % 1 == 0)) && + !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { result.push(key); } } if (support.nonEnumShadows && object !== objectProto) { - index = -1; - length = shadowedProps.length; - var className = object === stringProto ? stringClass : object === errorProto ? errorClass : toString.call(object), nonEnum = nonEnumProps[className] || nonEnumProps[objectClass]; if (className == objectClass) { proto = objectProto; } - while (++index < length) { - key = shadowedProps[index]; + length = shadowedProps.length; + while (length--) { + key = shadowedProps[length]; if (!(isProto && nonEnum[key]) && (key == 'constructor' ? hasOwnProperty.call(object, key) : object[key] !== proto[key])) { result.push(key);