Created
September 19, 2010 01:22
-
-
Save robotlolita/586251 to your computer and use it in GitHub Desktop.
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
/** | |
* Object.keys(object) -> Array of String | |
* | |
* List the keys that belongs only to the given object. | |
**/ | |
(function() { | |
function list_keys(object) { | |
var prop | |
, keys = []; | |
for (prop in object) { | |
object.hasOwnProperty(prop) && keys.push(prop); | |
} | |
return keys; | |
} | |
Object.keys || (Object.keys = list_keys) | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment