Nodebook
  • Introduction
  • Methods
  • Default Classes
    • Nodebook
  • JS
    • JSONotebook
    • JSNotebook
    • TSNotebook
  • Java
    • JavaNotebook
  • C/C++
    • CPPNotebook
    • CNotebook
    • HeaderNotebook
  • Text
    • TXTNotebook
    • MDNotebook
    • PlainNotebook
  • Web
    • HTMLNotebook
    • CSSNotebook
      • CSSStyle
  • Other
    • YMLNotebook
    • BashNotebook
  • Python
    • PYNotebook
Powered by GitBook
On this page
  • Usage
  • Setup

Was this helpful?

  1. Other

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!"
PreviousCSSStyleNextBashNotebook

Last updated 4 years ago

Was this helpful?