my-dog-likes-cheese
v2.0.1
Published
A Node.JS JSON library that makes JSON easy with minimal dependencies
Downloads
119
Readme
this is a NPM library that allows the creation, manipulation, and logging of JSON files with race condition protection using read and writeFileSync + promises and JSON querying/path setting using @irrelon/path
rewrite coming soon
like the package? star it on github! https://github.com/ferretcode/my-dog-likes-cheese
check out our website! https://my-dog-likes-cheese.glitch.me
have a question or just want to talk? join the discord server! https://discord.gg/r84AeEGJEg
📜 creation and deletion of files
var dog = require("my-dog-likes-cheese");
dog.JSONCreateDB("foo.json");
dog.JSONDeleteDB("foo.json");
📜 logging of values and keys
var dog = require("my-dog-likes-cheese");
dog.JSONLogAllKeys("foo.json");
dog.JSONLogAllValues("foo.json");
📜 adding values and keys
var dog = require("my-dog-likes-cheese");
//add key directly into json file
dog.JSONPushKey("foo.json", "key name").then((result) => console.log(result));
//add value directly into json
dog
.JSONPushValue("foo.json", "key name", "value name", "value")
.then((result) => console.log(result));
//add key into an existing key
dog
.JSONPushKey("foo.json", "key name", "key.path.to.nest.in")
.then((result) => console.log(result));
//add value into an existing key
dog
.JSONPushValue(
"foo.json",
"key name",
"value name",
"value",
"key.path.to.nest.in"
)
.then((result) => console.log(result));
📜 Deleting values and keys
const dog = require("my-dog-likes-cheese");
//delete key directly accessible from json file
dog
.JSONDeleteValue("foo.json", "key name")
.then((result) => console.log(result));
//delete value directly accessible from json file
dog
.JSONDeleteValue("foo.json", "key name", "value name")
.then((result) => console.log(result));
//delete nested key
dog
.JSONDeleteValue("foo.json", "key name", null, "path.to.key")
.then((result) => console.log(result));
//delete nested value
dog
.JSONDeleteValue("foo.json", "key name", "value name", "path.to.value")
.then((result) => console.log(result));
🚫 limitations
limited data returned from promises