Skip to content

Instantly share code, notes, and snippets.

@emilioriosvz
Created March 14, 2016 22:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save emilioriosvz/d46589c841083fecb734 to your computer and use it in GitHub Desktop.
Save emilioriosvz/d46589c841083fecb734 to your computer and use it in GitHub Desktop.
Get all properties names of an object
var getAllProperties = function (object) {
var properties = []
do {
Object.getOwnPropertyNames(object).forEach((prop) => {
if (!~properties.indexOf(prop)) {
properties.push(prop)
}
})
} while (object = Object.getPrototypeOf(object))
return properties
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment