Have ideas to improve npm?Join in the discussion! »

    direct-instance-of

    2.0.0 • Public • Published

    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

    Install

    npm i direct-instance-of

    DownloadsWeekly Downloads

    4

    Version

    2.0.0

    License

    MIT

    Last publish

    Collaborators

    • avatar