3.0.1 • Published 1 year 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-formatterUsage
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
1 year ago
3.0.0
2 years ago
2.3.3
2 years ago
2.3.2
2 years ago
2.3.1
2 years 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
3 years ago
1.0.5
3 years ago
1.0.4
3 years ago
1.0.3
3 years ago
1.0.2
3 years ago
1.0.1
3 years ago
1.0.0
3 years ago