basb-cli
Version:
Blog as Second Brain!
13 lines (12 loc) • 345 B
JavaScript
export const hasProperty = (inst, prop) => {
return (prop in inst)
}
export const checkType = (obj, type) => {
// type -> "class" || Function || Number ...
if (typeof type === "string") {
return obj.toString().startsWith("class")
|| typeof obj == type
} else {
return (obj instanceof type)
}
}