A stringify tool to javascript object
- A substitute for JSON.stringify
- ES2015 syntax
$ npm install xbrief
import { deco } from 'xbrief'
const objects = {
boolean: true,
string: 'Shakespeare',
number: 128,
null: null,
undefined: undefined,
one_row_matrix: [ [1, 1, 2, 3, 5, 8, 13, 21] ],
simple_set: new Set([1, 1, 1, 2, 2, 3, 3, 3]),
simple_matrix: Array.from({ length: 3 }, (_, x) =>
Array.from({ length: 8 }, (_, y) => x + y + 1)),
simple_map: new Map([['Lagos', 861], ['Dhaka', 8906], ['Lima', 9174], ['Ankara', 5271], ['Nagpur', 2405]]),
simple_lambda: (x) => `${x}`,
}
console.log(deco(objects))
Copyright (c) 2019-present, Haoyang (Vincent) Wang