@speedy/json-extends

Extend a JSON file with one or many existing files.
Installation
npm install @speedy/json-extends --save
Usage
read(filePath, extendsMap) ⇒ Promise.<T>
Retrieve a JSON file. Supports extends
with one or many existing JSON files.
Extends supports also aliased paths, as shown in the example.
filePath | string | true | path to a JSON file. |
extendsMap | {[id: string]: string } | false | A key value pair of maps for JSON files. |
import { json } from "@speedy/json-extends";
const maps = {
"@speedy/commit-msg-hook:latest": "./node_modules/config/config.json"
};
json.read("local-config.json", maps)
.then(content => {
});
JSON file
{
"extends": [
"@speedy/commit-msg-hook:latest",
"./local/config.json"
],
"rules": {
"no-dash": true
}
}