Skip to content

About

Display javascript objects in tree form in the console

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

58 Commits

Folders and files

Repository files navigation

console[prototype]

This module expands the original console object and gains a [prototype] property. If you call this property over the console object and pass a javascript object as a parameter, it displays the object's prototype chain as a tree on the terminal.The purpose of the module is to be able to view object chains as in browsers.

install

    npm i console-prototype

usage

require('console-prototype') 

class AClass{
    constructor(){
        this.aProp = 'aProp'
    }

    getAprop(){
        return this.aProp
    }
}

class BClass extends AClass{
    constructor(){
        super()
        this.bProp = 'bProp'
    }

    getBprop(){
        return this.bProp
    }
}

class CClass extends BClass{
    constructor(){
        super()
        this.cProp = 'cProp'
    }

    getCprop(){
        return this.cProp
    }
}

class DClass extends CClass{
    constructor(){
        super()
        this.dProp = 'dProp'
    }

    getDprop(){
        return this.dProp
    }
}

const o = new DClass()
console.prototype(o)

out

alt text

usage 2

const consoleProto =require('console-prototype') 
const o = new DClass()
consoleProto(o)

About

Display javascript objects in tree form in the console

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages