@10xly/is-instance-of
check if somethings an instance of something else. p]
Instawation
npm install @10xly/is-instance-of
Usage
const isInstanceOf = require("@10xly/is-instance-of")
class Animal {}
class Dog extends Animal {}
const pet = new Dog()
isInstanceOf(pet, Dog)
isInstanceOf(pet, Animal)
isInstanceOf(pet, "Dog")
isInstanceOf(pet, ["Cat", "Dog"])
Why you might use this seriously
This is a version of is-instance-of by lamansky that resolves a vulnerability in lodash.set. However, it is a little overengineered, but this actually has a practical purpose. see the readme of is-instance-of for more info