JSONotebook
extends Nodebook
"JSONotebook" is a customized class used for JSON (JavaScript Object Notation) files.
Usage
Setup
const Nodebook = require('nodejs-notebook');
const config = new Nodebook.JSONotebook('config');note(key, value)
Properly notes a key and a value into JSON data. Can also replace existing values.
key:
Represents the key to fetch the value. Can be anything.
value:
The value that key is tied to. Can be anything.
config.note('name', 'Alex');
// Sets "name" to "Alex"
config.note('name', 'Alexander');
// Name isn't "Alex" anymore, it is "Alexander"push(key, newkey)
Pushes a value into an array.
key:
The key that represents the array.
The value tied to the key must be an existing array or it will not work
newkey:
The value to push into the array. Can be anything.
fetch(key)
Fetches a value based on the key.
key:
The key that represents the value you want to get.
erase(key)
Erases an existing value from the JSON file.
key:
The key that represents the value you want erased.
toYML()
Converts the JSON data to YML data.
Last updated
Was this helpful?