@groupp/json-with-extends
TypeScript icon, indicating that this package has built-in type declarations

1.0.0-next.1 • Public • Published

JSON that can extend each other

How often did you think about code repetition in your configuration files? How great would it be to extend it in a manner similar to “tsconfig.json” does it? So, let’s do it.

Example

// base.json
{
  "ship": "Enterprise"
}

// kirk.json
{
  "extends": "./base.json",
  "name": "Kirk"
}

// spok.json
{
  "extends": "./base.json",
  "name": "Spok"
}
const kirk = await parseJson('./kirk.json');
/*
`kirk` will be:
{
  "ship": "Enterprise",
  "name": "Kirk"
}
*/

const spok = await parseJson('./spok.json');
/*
`spok` will be:
{
  "ship": "Enterprise",
  "name": "Spok"
}
*/

Feel free to place your jsons in different directories, override properties and use comments inside it.

Feedback and stars are highly appreciated 😊

Readme

Keywords

Package Sidebar

Install

npm i @groupp/json-with-extends

Weekly Downloads

0

Version

1.0.0-next.1

License

MIT

Unpacked Size

4.41 kB

Total Files

8

Last publish

Collaborators

  • groupp