Skip to content

Instantly share code, notes, and snippets.

@alex-cory
Created October 26, 2019 06:04
Show Gist options
  • Save alex-cory/188c360f77139445e356af3a988262b1 to your computer and use it in GitHub Desktop.
Save alex-cory/188c360f77139445e356af3a988262b1 to your computer and use it in GitHub Desktop.
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