Skip to content
This repository was archived by the owner on Apr 10, 2025. It is now read-only.

alan-agius4/speedy-json-extends

Repository files navigation

@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.

Param Type Required Description
filePath string true path to a JSON file.
namedExtends {[id: string]: string } false A 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);

About

Extend a JSON file with one or many existing files

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •