2.0.0 • Published 8 years ago

direct-instance-of v2.0.0

Weekly downloads
4
License
MIT
Repository
github
Last release
8 years ago

direct-instance-of Build Status js-standard-style

Check if a value is a direct instance of a class ( not inherited)

Installation

npm install direct-instance-of

Usage

var directInstanceOf = require('direct-instance-of')

// Cat inherits from Mammal inherits from Animal

directInstanceOf(new Animal(), Animal)    // true
directInstanceOf(new Mammal(), Animal)    // false
directInstanceOf(new Mammal(), Mammal)    // true
directInstanceOf(new Cat('walk'), Animal) // false
directInstanceOf(new Cat('walk'), Mammal) // false
directInstanceOf(new Cat('walk'), Cat)    // true

License

MIT