@frctl/internals
v0.4.2
Published
Core source/parser/api classes for Fractal.
Downloads
11
Keywords
Readme
Internals
Core parser and api builder classes for Fractal.
Installation
npm i @frctl/internals
Parser
Stateless plugin-based data processor.
const Parser = require('@frctl/internals/parser');
const myParser = new Parser();
myParser.addPlugin((data, done) => {
//... manipulate objects in data array
done();
});
myParser.process([/* input data */], function(err, output){
//... do stuff with output
});
ApiBuilder
Programmatic API builder.
const ApiBuilder = require('@frctl/internals/api');
const api = new ApiBuilder();
api.addMethod('logAllData', function(){
console.log(this.data);
});
const myApi = api.generate({
data: { /* data object */ }
});
myApi.logAllData();