enny
Generate Engine compositions from human-readable inputs.
Installation
$ npm i --save enny
Example
// Dependenciesvar Enny = ; // Initialize Enny in memoryvar e = ; // Add two instancesvar aIns = e bIns = e ; aIns; aIns; console;// =>// {// "A": {// "flow": {// "someEvent": {// "data": [// [// "|*eventToEmit",// {// "to": "B"// }// ],// [// ".myInstance/myDataHandler",// {// "some": "data"// }// ],// "|*myStreamHandler"// ],// "error": "errorEvent",// "end": "endEvent"// }// },// "name": "A"// },// "B": {// "flow": {},// "name": "B"// }// }
Documentation
Enny()
Create a new Enny instance
Return
- Enny The
Enny
instance.
toObject()
Converts the internal composition into an object.
Return
- Object The modified composition.
renameInstance(oldName, newName, cb)
Renames the specified instance. This will update the instance references in the entire app.
Params
- String
oldName
: The old instance name. - String
newName
: The new instance name. - Function
cb
: The callback function.
toJSON()
This function is called internally when JSON.stringify
-ing the things.
Return
- Object The object that should be stringified.
addInstance(ins)
Adds a new instance.
Params
- Object
ins
: The Engine instance you want to add.
Return
- Instance The instance object.
toObject()
Converts the internal data into an raw-json object that can be written back to disk/database.
Return
- Object An object containing the instance names as fields and the instance content as values.
How to contribute
Have an idea? Found a bug? See how to contribute.
Where is this library used?
If you are using this library in one of your projects, add it in this list. ✨
engine-parser
by jillix