YMLNotebook

extends Nodebook

"YMLNotebook" is used for .yml (YAML) files.

Usage

Setup

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.

value: The value that key represents. Can be anything.

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.

let mainJSON = main.toJSON();

console.log(mainJSON.InJSON);
// Should log "true"

getValue(key)

Fetch the value in a YML file.

string key: The key that represents the value.

Returns: The YML Value.

console.log(main.getValue('Message'));
// Logs "hello!"

Last updated