Skip to main content

latest

a simple module to dump the contents of javascript objects to console, or return them as a string using dumpStr.

This package works with Node.js, BrowsersIt is unknown whether this package works with Bun, Cloudflare Workers, Deno
JSR Score
100%
Published
3 months ago (0.1.7)

a simple module to dump the contents of javascript objects to console, or return them as a string using dumpStr.

example:

import { dump } from "@console/dump";

class Sample {
    typeTest: Array<any>;
    bufferTest: Buffer;
    u8arrayTest: Uint8Array;
    arrBufferTest: ArrayBuffer;
    dvTest: DataView;

    constructor() {
        this.typeTest = [0, Number.NEGATIVE_INFINITY, true, false, null, undefined];
        this.bufferTest = Buffer.from([0xff]);
        this.u8arrayTest = new Uint8Array(this.bufferTest);
        this.arrBufferTest = this.u8arrayTest.buffer;
        this.dvTest = new DataView(this.arrBufferTest);
    }
}

dump({
    s: new Sample(),
    hello() {
        console.log("Hello, world!");
    },
});

/* prints:
{
    s: {
        typeTest: [0, -Infinity, true, false, null, undefined],
        bufferTest: "FF",
        u8arrayTest: [255],
        arrBufferTest: [255],
        dvTest: [255]
    },
    hello: function hello(...args)
}
*/

Add Package

deno add @console/dump

Import symbol

import * as mod from "@console/dump";

Add Package

npx jsr add @console/dump

Import symbol

import * as mod from "@console/dump";

Add Package

yarn dlx jsr add @console/dump

Import symbol

import * as mod from "@console/dump";

Add Package

pnpm dlx jsr add @console/dump

Import symbol

import * as mod from "@console/dump";

Add Package

bunx jsr add @console/dump

Import symbol

import * as mod from "@console/dump";