A JS/CSS/HTML/JSON formatter based on js-beautify, version 3.0.1. It provides formatted output with a mapping index to track changes between original and formatted positions. Supports Web Worker in browsers and Worker Threads in Node.js. Ships TypeScript types. Release cadence is irregular; key differentiator is the content mapping feature for source-to-formatted position tracking.
npm install monocart-formatterNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Formats JS code with indentation and demonstrates mapping from original to formatted position.
Use import syntax instead of require(). If using Node.js <12, upgrade to >=12 or use dynamic import().
Remove the worker option; set useWorker: true/false explicitly if needed.
Always check for -1 in your code before using the result as an index.
Add 'type': 'module' to your package.json or rename file to .mjs.
Use named import: import { format } from 'monocart-formatter'.Install js-beautify: npm install js-beautify