-
-
Notifications
You must be signed in to change notification settings - Fork 894
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding arguments detection to Object.keys, from https://github.com/lj…
- Loading branch information
Showing
1 changed file
with
19 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -674,10 +674,27 @@ if (!Object.keys) { | |
"propertyIsEnumerable", | ||
"constructor" | ||
], | ||
dontEnumsLength = dontEnums.length; | ||
dontEnumsLength = dontEnums.length, | ||
isFunction = function isFunction(value) { | ||
return _toString(value) === '[object Function]'; | ||
}, | ||
isArguments = function isArguments(value) { | ||
var str = _toString(value); | ||
var isArguments = str === '[object Arguments]'; | ||
if (!isArguments) { | ||
isArguments = !Array.isArray(str) | ||
&& value !== null | ||
&& typeof value === 'object' | ||
&& typeof value.length === 'number' | ||
&& value.length >= 0 | ||
&& isFunction(value.callee); | ||
} | ||
return isArguments; | ||
}; | ||
|
||
Object.keys = function keys(object) { | ||
var isFunction = _toString(object) === '[object Function]', | ||
var isFunction = isFunction(object), | ||
This comment has been minimized.
Sorry, something went wrong. |
||
isArguments = isArguments(object), | ||
This comment has been minimized.
Sorry, something went wrong.
jdalton
Contributor
|
||
isObject = object !== null && typeof object === 'object'; | ||
|
||
if (!isObject && !isFunction) { | ||
|
3 comments
on commit 2dd3abf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why didn't this commit go through the review process?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I directly committed it. I'll fix these issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isFunction = isFunction(...)
is an error.