Link a plain old JavaScript object with a JSON file.
Because I'm tired of seeing and hearing this:
const json = require("./file.json");
json.property = 42;
"Why doesn't the JSON file get updated?"
$ npm install lnjson --save
$ yarn add lnjson
$ git clone https://github.com/cursorsdottsx/lnjson.git node_modules/lnjson
Code:
import lnjson from "lnjson";
const linked = lnjson("linked.json");
linked.property = 42;
Output:
linked.json
:
{
"property": 42
}