Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "assert/is-prototype-of/docs/types/index.d"

Index

Functions

Functions

Export assignment isPrototypeOf

  • isPrototypeOf(value: any, proto: any): boolean
  • Tests if an object's prototype chain contains a provided prototype.

    throws

    second argument must be an object and not null

    Parameters

    • value: any

      value to test

    • proto: any

      prototype

    Returns boolean

    boolean indicating if a provided prototype exists in a prototype chain

    Example

    var inherit = require( `@stdlib/utils/inherit` );
    
    function Foo() {
        return this;
    }
    
    function Bar() {
        return this;
    }
    inherit( Bar, Foo );
    
    var bar = new Bar();
    
    var bool = isPrototypeOf( bar, Foo.prototype );
    // returns true