1.0.2 • Published 1 year ago

@eloquentiastudios/commentable-json v1.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

commentable-json

Quick Start

Installation

# Using npm
$ npm install @eloquentiastudios/commentable-json

# Using yarn
$ yarn add @eloquentiastudios/commentable-json

# Using pnpm
$ pnpm i @eloquentiastudios/commentable-json

Example Usage

import { parseJsonWithComments, stringifyJsonWithComments } from '@eloquentiastudios/commentable-json';

const objectToBeCommented = {
  foo: 'bar',
  baz: 'qux',
};

const commentsForObject = {
  _: 'This is a comment for the entire object',
  foo: 'This is a comment for the foo property',
  baz: 'This is a comment for the baz property',
}

const jsonWithComments: typeof objectToBeCommented = stringifyJsonWithComments(objectToBeCommented, commentsForObject);

// Parse the JSON with comments to get the original object
const parsedObject = parseJsonWithComments(jsonWithComments);

Supported Node.js Versions

Should work on any Node.js version that supports ESM modules (i.e. type="module" in package.json).

License

Uses the MIT license.

See LICENSE for more information.

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago