onlydata
v1.0.4
Published
official OnlyData parser
Downloads
2
Readme
OnlyData Node Parser
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: [email protected]