onlydata

1.0.4 • Public • Published

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: adam@imaginate.life

Readme

Keywords

none

Package Sidebar

Install

npm i onlydata

Weekly Downloads

1

Version

1.0.4

License

Apache-2.0

Last publish

Collaborators

  • imaginate