@bit2byte/nano-json
v0.1.1
Published
A Nano Tool for Reading and Writing JSON.
Downloads
1
Readme
nano-json
A Nano Tool for Reading
and Writing
JSON.
install
pnpm i @bit2byte/nano-json
usage
import path from "path";
import { PackageJson } from "type-fest";
import NanoJson from "@bit2byte/nano-json";
const pkg = new NanoJson<PackageJson>(path.join(__dirname, "./package.json"));
// read
await pkg.r();
if (pkg.d) {
// edit
pkg.d.version = "1.0.0";
}
// write
await pkg.w();
Inspired by @srzorro/file-json