Skip to content

Instantly share code, notes, and snippets.

@devsnek

devsnek/js.js Secret

Created May 14, 2018 14:31
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 devsnek/dd77b256d50a80570541dd4ab74bfc27 to your computer and use it in GitHub Desktop.
Save devsnek/dd77b256d50a80570541dd4ab74bfc27 to your computer and use it in GitHub Desktop.
Is(constructor, value) {
if (constructor == null || value == null) {
return false;
}
let C = value.[[Constructor]];
if (C === undefined) {
return false;
}
do {
if (C === constructor) {
return true;
}
if (C.[[ConstructorKind]] !== 'derived') {
return false;
}
C = C.[[ConstructorParent]];
} while (C);
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment