Files
skills-here-run-place/node_modules/is-what/dist/isInstanceOf.js
Alejandro Martinez f09af719cf Initial commit
2026-02-12 02:04:10 +01:00

20 lines
557 B
JavaScript

import { getType } from './getType.js';
import { isType } from './isType.js';
export function isInstanceOf(value, classOrClassName) {
if (typeof classOrClassName === 'function') {
for (let p = value; p; p = Object.getPrototypeOf(p)) {
if (isType(p, classOrClassName)) {
return true;
}
}
}
else {
for (let p = value; p; p = Object.getPrototypeOf(p)) {
if (getType(p) === classOrClassName) {
return true;
}
}
}
return false;
}