extends Nodebook
"YMLNotebook" is used for .yml (YAML) files.
.yml
const Nodebook = require('nodejs-notebook'); const main = new Nodebook.YMLNotebook('main');
note(key, value)
Sets the value in a YML file.
string key: The key to represent the value. Must be a string.
key
value: The value that key represents. Can be anything.
value
main.note('InJSON', true); // Records "InJSON: true" main.note('Message', 'Hello!'); // Records "Message: Hello!
toJSON()
Converts the file to a JSON file.
Returns: An Object representing the JSON file.
getValue(key)
Fetch the value in a YML file.
string key: The key that represents the value.
Returns: The YML Value.
Last updated 5 years ago
let mainJSON = main.toJSON(); console.log(mainJSON.InJSON); // Should log "true"
console.log(main.getValue('Message')); // Logs "hello!"