Created
October 26, 2019 06:04
-
-
Save alex-cory/188c360f77139445e356af3a988262b1 to your computer and use it in GitHub Desktop.
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 classToObject = theClass => { | |
const originalClass = theClass || {} | |
const keys = Object.getOwnPropertyNames(Object.getPrototypeOf(originalClass)) | |
return keys.reduce((classAsObj, key) => { | |
classAsObj[key] = originalClass[key] | |
return classAsObj | |
}, {}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment