Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

memberof

panshanshan17ISC1.0.2

Determines whether an object belongs to a specific subclass.

memberof, classof, typeof

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