1.2.0 • Published 6 years ago

@speedy/json-extends v1.2.0

Weekly downloads
159
License
ISC
Repository
github
Last release
6 years ago

@speedy/json-extends

CircleCI npm version Dependency Status devDependency Status

Extend a JSON file with one or many existing files.

Installation

npm install @speedy/json-extends --save

Usage

json.read(filePath, namedExtends) ⇒ Promise<T>

Retrieve a JSON file. Supports extends with one or many existing JSON files.

Extends supports also Named Extends paths, as shown in the example.

ParamTypeRequiredDescription
filePathstringtruepath to a JSON file.
namedExtends{[id: string]: string }falseA key value pair of named extends paths

TypeScript

import { json } from "@speedy/json-extends";

const named = {
  "@speedy/commit-msg-hook:latest": "./node_modules/config/config.json"
};

json.read("local-config.json", named)
  .then(content => {
    // json content
  });

JSON file

{
  "extends": [
    "@speedy/commit-msg-hook:latest",
    "./local/config.json"
  ],
  "rules": {
    "no-dash": true
  }
}

json.readSync(filePath, namedExtends) ⇒ T

Synchronous version of json.read().

TypeScript

import { json } from "@speedy/json-extends";

const named = {
  "@speedy/commit-msg-hook:latest": "./node_modules/config/config.json"
};

const content = json.readSync("local-config.json", named);
1.2.0

6 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago