Skip to content

Instantly share code, notes, and snippets.

@mdix
Last active October 16, 2019 11:23
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 mdix/0cfa653419932d5a2f35d19f009ee77d to your computer and use it in GitHub Desktop.
Save mdix/0cfa653419932d5a2f35d19f009ee77d to your computer and use it in GitHub Desktop.
Determine base class (last level before builtin)
function getBaseClass(MaybeClass) {
if (typeof MaybeClass !== 'function') {
return null;
}
const Proto = Reflect.getPrototypeOf(MaybeClass);
return !Proto.name
? MaybeClass
: getBaseClass(Proto);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment