memberof

1.0.2 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i memberof

Weekly Downloads

1

Version

1.0.2

License

ISC

Unpacked Size

6.72 kB

Total Files

7

Last publish

Collaborators

  • panshanshan