pretty3
TypeScript icon, indicating that this package has built-in type declarations

0.4.2 • Public • Published

Version Coverage Minified size Last commit License: MIT

pretty3

Ultimate javascript tree-data logger. With colors, unicode support and word-wrapping. Typesctipt friendly.

🌳 Live demo

Try it online!

Install

npm install pretty3

Basic usage

import { Pretty } from 'pretty3';
Pretty.print(data);

Features roadmap

  • Rich support for all javasctipt types, including TypedArray, Map, Symbol and Error.
  • Colors support for ANSI terminal output.
  • Color support for HTML output.
  • Deeply customizable stackable themes.
  • Collapsable long lists with ellipsis.
  • Gracefull fit and wrap long/multiline data into limited-width console. Tree stucture does not breaks!
  • Word-wrap.
  • Accurate Unicode width calucating for proper word-wrap.
  • Color support for browser console via console.log() styling.
  • Support for circular references.
  • Support for endless iterators.
  • Collapse long leaves with ellipsis.

Advanced usage

const rootKey = 'My georgeous data';
Pretty.print(data, rootKey, options);

javasctipt

const options = {
  renderer: new AutodetectRenderer(),
  logLineCallback: (line) => { console.log(line); },
  maxLevel: 6,
  maxItemsPerLevel: [30, 10],
  maxLineWidth: 80,
  themeStack: [defaultTheme, noSimplestIcon],
};

typescript

type options = {
  renderer?: Renderer;
  logLineCallback?: logLineCallbackT,
  maxLevel?: number,
  maxItemsPerLevel?: number || number[],
  maxLineWidth?: number,
  themeStack?: themeT[],
};

API Documetation

Poorly comented, but actual autogenerated docs (by tsdoc) are hosted here.

Intense documentation with examples is planned after API stabilization.

Contributing

Contributions, issues and feature requests are welcome!

Feel free to check issues page.

Author

Konstantin Barkalov @mail @github

Package Sidebar

Install

npm i pretty3

Weekly Downloads

0

Version

0.4.2

License

MIT

Unpacked Size

198 kB

Total Files

114

Last publish

Collaborators

  • barkalov