1.0.2 • Published 2 years ago

json-extend-reader v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

USAGE

Install

npm i json-extend-reader

Code

import { jsonExtendReader } from "json-extend-reader";
// common
const { jsonExtendReader } = requie('json-extend-reader')

const res = jsonExtendReader(path.join(__dirname, "a.json"));
// a.json
{
  "extend": "./b.json",
  "id": "33",
  "value": "corry"
}
// b.json
{
  "id": "34",
  "value": "corry2",
  "size": 100,
  "file": {
    "extend": "./a.json"
  }
}

// res will return
{
  "id": "33",
  "value": "corry",
  "size": 100,
  "file": {
    "extend": "./a.json"
  }
}

extend key must be in top-level, otherwise, it is invalid to load anther json file

Extend Type: string | string[]

extend allow to use type of string or string array

{
  "extend": ["./b.json"],
  "id": "33",
  "value": "corry"
}
1.0.2

2 years ago

1.0.1-beta4

2 years ago

1.0.1-beta3

2 years ago

1.0.1-beta2

2 years ago

1.0.1-beta

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago