pretty3
v0.4.2
Published
Ultimate javascript tree-data logger. With colors, unicode support and word-wrapping. Typesctipt friendly.
Downloads
33
Maintainers
Readme
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
- [x] Rich support for all javasctipt types, including
TypedArray
,Map
,Symbol
andError
. - [x] Colors support for ANSI terminal output.
- [x] Color support for HTML output.
- [x] Deeply customizable stackable themes.
- [x] Collapsable long lists with ellipsis.
- [x] 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.