Skip to main content
Home

Built and signed on GitHub Actions

Works with
This package works with DenoIt is unknown whether this package works with Cloudflare Workers, Node.js
It is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Node.js
This package works with Deno
JSR Score94%
Publisheda year ago (0.0.2)

A utility library for working with JSONC files. Doesn't do much more than wrap npm:jsonc-parser, though, so for most people using that library instead would be the move.

class JsoncFormatter

This class implements the JSONC formatter. I'ts just a convenience wrapper around the Microsoft JSONC parser.

Methods

Formats the given JSONC text, returning the formatted text. Doesn't modify the input string.

formatFileSync(
filePath: string,
options?: { write: boolean; },
changed?: string[],
): string

Formats the given JSONC file, returning the formatted text. Modifies the file if write is true and the file contents are actually different from the formatted text.

The changed parameter is an optional way to track which files have been changed. If the file is actually modified, then filePath will be appended to the changed array. Management of this array is left to the caller.

Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@axhxrx/jsonc

Import symbol

import { JsoncFormatter } from "@axhxrx/jsonc";
or

Import directly with a jsr specifier

import { JsoncFormatter } from "jsr:@axhxrx/jsonc";

Add Package

pnpm i jsr:@axhxrx/jsonc
or (using pnpm 10.8 or older)
pnpm dlx jsr add @axhxrx/jsonc

Import symbol

import { JsoncFormatter } from "@axhxrx/jsonc";

Add Package

yarn add jsr:@axhxrx/jsonc
or (using Yarn 4.8 or older)
yarn dlx jsr add @axhxrx/jsonc

Import symbol

import { JsoncFormatter } from "@axhxrx/jsonc";

Add Package

vlt install jsr:@axhxrx/jsonc

Import symbol

import { JsoncFormatter } from "@axhxrx/jsonc";

Add Package

npx jsr add @axhxrx/jsonc

Import symbol

import { JsoncFormatter } from "@axhxrx/jsonc";