1.0.2 • Published 1 year ago

jprettify v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

A 0.5kb library to pretty print json objects for users

Nice things

  • 0.5kb
  • 0 dependencies

The gist of it

const jPrettify = require("jprettify").default;
import jPrettify from "jprettify";

const result = jPrettify({
    a: {
        b: "c",
        d: [1, 2],
    },
});

console.log(result);
// a:
//   b:
//     - c
//   d:
//     - 1
//     - 2

API

export default function jPrettify(input: Input, spaces = 2): string;
// spaces: the amount of whitespace to add to every layer