synopregize
v1.0.12
Published
Sync on predicate and energize.
Downloads
2
Readme
Synopregize
Sync On Predicate "Energize" 🖖
Purpose
Easily chain calls to different services depending on certain conditions. Do these operations in order or in parallel. Designed for ease of use with frontend applications.
WARNING: this library is not ready for production use and is still being worked on.
Sample
const synop = require('synopregize');
const { isGreaterThan } = synop.operations;
const operation = synop.create({
name: 'example',
url: 'http://yourapi.com/v1/endpoint',
predicate: {
key: 'key',
target: isGreaterThan(9000),
success: (data, next, train) => {
console.log(`${data.key} is over 9000!`);
},
miss: (data, next, train) => {
console.log(`${data.key} is below 9000, go ahead Nappa...`);
},
}
});
synop.add(operation);
synop.run();