23

GitHub - zeeshanu/dumper.js: A better and pretty variable inspector for your Nod...

 6 years ago
source link: https://github.com/zeeshanu/dumper.js
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

README.md

Dumper.js - Dumps information about a variable
Dumper.js

Build Status Codecov Software License

dumper.js is a better and pretty variable inspector for your Node.js applications.

Installation

npm install --save dumper.js
# or you may use yarn
yarn add dumper.js

Usage

dd() Dump and Die

Calling dd() prints the output and kills the process

const dd = require('dumper.js');

const users = [
    { user: 'barney', age: 36, active: true, createdAt: new Date(), getAge: () => this.age },
    { user: 'fred', age: 40, active: false, createdAt: new Date(), getAge: () => this.age },
    { user: 'pebbles', age: 1, active: true, createdAt: new Date(), getAge: () => this.age }
];

dd(users);

// Above variable will be printed
console.log('this will never be called');

Will output below result and kill the process

dd

dump() Dump and Continue

Calling dump() prints the output and continues with the processing

const dump = require('dumper.js/src/dump');

const users = [
    { user: 'barney', age: 36, active: true, createdAt: new Date(), getAge: () => this.age },
    { user: 'fred', age: 40, active: false, createdAt: new Date(), getAge: () => this.age },
    { user: 'pebbles', age: 1, active: true, createdAt: new Date(), getAge: () => this.age }
];

dump(users);

// Above variable will be printed and process will continue
console.log('this will be called');

Will output below result and continue processing

dump

Contributions

Feel free to submit pull requests, create issues or spread the word.

License

MIT © Zeeshan Ahmed


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK