npm.io
0.0.1 • Published 9 years ago

pretty.dump

Licence
MIT
Version
0.0.1
Deps
1
Vulns
0
Weekly
0

Pretty Dump

Provides a better dump function to visualize data in the terminal.

TOC

Installation

    npm install pretty.dump

Basic Usage

    let pretty = require("pretty.dump");
    
    let variable = "string";

    pretty.dump(variable); // ==> "string"

Examples

String
    let variable = "string";

    pretty.dump(variable);

string screenshot

Number
    let variable = 123;

    pretty.dump(variable);

int screenshot

Boolean
    let variable = true;

    pretty.dump(variable);

bool screenshot

Null
    let variable = null;

    pretty.dump(variable);

null screenshot

Undefined
    let variable = undefined;

    pretty.dump(variable);

undefined screenshot

Array
    let variable = ["a", "b", ["c", "d"]];

    pretty.dump(variable);

array screenshot

Object
    let variable = {
        name: "PrettyDump",
        status: "active"
    };

    pretty.dump(variable);

object screenshot

Function
    let variable = (a) => {
        return a*a;
    };

    pretty.dump(variable);

function screenshot

Class
    let variable = pretty;

    pretty.dump(variable);

class screenshot

In case of circular relationships, PrettyDump will print [Circular].

Methods

dump()

Prettyfies and dumps the variable to the console.

Example
    let variable = false;

    pretty.dump(variable); // ==> false
dd()

A.k.a. Die and dump. It prettyfies, dumps the variable to the console and exits the process.

Example
    let variable = ["a", "b"];

    pretty.dump(variable); // ==> array:2 [ 0: "a" 1: "b"]

Author