Registry / devops / node-formatter

node-formatter

JSON →
library0.0.1jsnpmunverified

NodeJS Code Formatter is a lightweight Node.js package for formatting JSON and JavaScript code. Version 0.0.1 is the initial release with basic formatting capabilities. It offers a simple API for beautifying code, but lacks advanced features or customization options compared to established formatters like Prettier. The package has very low adoption and no release cadence.

npm install node-formatter
INSTALL
IMPORT
SIG · NODE-FORMATTER
N
node-formatter
devopsjavascriptv0.0.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

format
import { format } from 'node-formatter';
const format = require('node-formatter').format;
Package is ESM-only from v0.0.1; no CommonJS support.
default
import formatter from 'node-formatter';
const formatter = require('node-formatter');
Default export is the format function; named export also works.
formatCode
import { formatCode } from 'node-formatter';
Exported as format in v0.0.1; formatCode is not an export.

Demonstrates basic formatting of JSON string using the format function from node-formatter.

import { format } from 'node-formatter'; const code = '{ "name": "John" }'; const formatted = format(code); console.log(formatted); // Expected output: // { // "name": "John" // }
Debug
Known issues
gotchaPackage is ESM-only; require() will throw a Module not found error.
fix
Use import syntax or set type: module in package.json.
affects: 0.0.1
breakingNo named export 'formatCode' exists; using it will cause undefined or error.
fix
Import 'format' instead.
affects: 0.0.1
gotchaPackage does not support CommonJS; cannot be required.
fix
Use dynamic import() in CommonJS.
affects: 0.0.1
deprecatedNo deprecation warnings as version is 0.0.1.
fix
N/A
affects: 0.0.1
Errors
Common errors & fixes
SyntaxError: Cannot use import statement outside a module
ESM import used without proper module setup.
fix
Add "type": "module" to package.json or use .mjs extension.
TypeError: require is not a function
Using require() in an ESM context.
fix
Use import or switch to CommonJS with dynamic import: const { format } = await import('node-formatter');
Upgrade
Version history
0.0.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
node-formatter — npm install node-formatter · libregistry