Skip to content

The official node.js parser for OnlyData, a human-readable data serialization language.

License

Notifications You must be signed in to change notification settings

imaginate/onlydata-node

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OnlyData Node Parser build status npm version

The official node.js parser for OnlyData, a human-readable data serialization language.

Install

npm install onlydata

API

var onlydata = require('onlydata');

// values
var str = 'a string of OnlyData syntax';
var buff = new Buffer('OnlyData stuff');
var file = 'path/to/file.onlydata';
// or      'path/to/file.only';
// or      'path/to/file.od';

// parse string
obj = onlydata(str);
obj = onlydata.parse(str);
obj = onlydata.parseString(str);

// parse buffer
obj = onlydata(buff);
obj = onlydata.parse(buff);
obj = onlydata.parseBuffer(buff);

// parse file
obj = onlydata(file);
obj = onlydata.parse(file);
obj = onlydata.parseFile(file);

// get config
onlydata.getConfig([ ...prop ]); // prop array
onlydata.getConfig(...prop);     // prop arguments
onlydata.getConfig();            // all props

// set config
onlydata.setConfig(propKey, newVal);
onlydata.setConfig({
  propKey: newVal,
  propKey: newVal
});

// reset config
onlydata.resetConfig([ ...prop ]); // prop array
onlydata.resetConfig(...prop);     // prop arguments
onlydata.resetConfig();            // all props

// make new instance
onlydata = onlydata.construct();
onlydata = onlydata.constructor();

Other Details

contributing: see contributing guide
bugs/improvements: open an issue
questions: imagineadamsmith@gmail.com

About

The official node.js parser for OnlyData, a human-readable data serialization language.

Resources

License

Stars

Watchers

Forks

Packages

No packages published