Created
December 7, 2016 18:06
-
-
Save heron2014/488013dcac2d6f25bca45bbf271be0dc to your computer and use it in GitHub Desktop.
Getting all inherited property names of an object
This file contains hidden or 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
const getAllInheritedPropNames = (obj) => { | |
let props = []; | |
do { | |
props = props.concat(Object.getOwnPropertyNames(obj)); | |
} while (obj = Object.getPrototypeOf(obj)); | |
return props; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment