Skip to content

Eloquentia-Studios/commentable-json

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 = stringifyJsonWithComments(objectToBeCommented, commentsForObject);

// Parse the JSON with comments to get the original object
const parsedObject: typeof objectToBeCommented = 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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published