3.0.0 • Published 2 months ago

monocart-formatter v3.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

Monocart Formatter

npm.io npm.io npm.io

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.0

2 months ago

2.3.3

2 months ago

2.3.2

3 months ago

2.3.1

4 months ago

2.3.0

5 months ago

2.2.1

5 months ago

2.2.0

5 months ago

2.1.0

5 months ago

2.0.0

5 months ago

1.0.8

5 months ago

1.0.7

6 months ago

1.0.6

11 months ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago