memberof
v1.0.2
Published
Determines whether an object belongs to a specific subclass.
Downloads
9
Readme
memberof
Determines whether an object belongs to a specific subclass.
why memberof
We have typeof and instanceof but these are not precise enough.
So we need memberof.
get start
npm install memberof --save
usage
import memberof from 'memberof'
class MyArray extends Array{
constructor(){
super()
}
}
let arr = new MyArray()
console.log(memberof(arr,MyArray) , arr instanceof MyArray)
// true true
console.log(memberof(arr,Array) , arr instanceof Array);
// false true