Coder Social home page Coder Social logo

speedy-json-extends's Introduction

@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);

speedy-json-extends's People

Contributors

alan-agius4 avatar renovate-bot avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

speedy-json-extends's Issues

Help files

packages/ngtools/webpack/src/paths-plugin.ts

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
});
{
"extends": [
"@speedy/commit-msg-hook:latest",
"./local/config.json"
],
"rules": {
"no-dash": true
}
}
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);
828224

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.