3.0.1 • Published 5 months ago
monocart-formatter v3.0.1
Monocart Formatter
JS/CSS/HTML/JSON formatter
Features
- Base on js-beautify
- Generating mapping after formatted
- Working with web worker in browser
- Working with worker threads in Node.js
- Minifying worker code with gzip
Install
npm i monocart-formatter
Usage
import { format, MappingParser } from 'monocart-formatter';
const text = "var a = 1;";
const type = "js";
// js-beautify options https://github.com/beautify-web/js-beautify
const options = {};
const { content, mapping } = await format(text, type, options);
console.log("formatted content", content);
const mappingParser = new MappingParser(mapping);
// originalPosition = 10
const formattedPosition = mappingParser.originalToFormatted(10);
const originalPosition = mappingParser.formattedToOriginal(formattedPosition);
3.0.1
5 months ago
3.0.0
1 year ago
2.3.3
1 year ago
2.3.2
1 year ago
2.3.1
1 year ago
2.3.0
2 years ago
2.2.1
2 years ago
2.2.0
2 years ago
2.1.0
2 years ago
2.0.0
2 years ago
1.0.8
2 years ago
1.0.7
2 years ago
1.0.6
2 years ago
1.0.5
2 years ago
1.0.4
2 years ago
1.0.3
2 years ago
1.0.2
2 years ago
1.0.1
2 years ago
1.0.0
2 years ago