0.0.2 • Published 4 years ago
@amilas/std.api v0.0.2
@amilas-std
presentation
This library aim is to offer general operators for the amilas-engine client.
available operators
Here, the new nodes introduced by the library:
constant
The constant node represents a value wich never change during the evaluation cycle
import {AmilasPricer} from "@amilas/core"
import amilasStdLib from "@amilas-std/api"
const context = new AmilasPricer();
const {constant} = new amilasStdLib(context);
// A constant is added to the context
const myConstant = constant(42);
variable
The variable node represents a modifiable entrypoint
import {AmilasPricer} from "@amilas/core"
import amilasStdLib from "@amilas-std/api"
const context = new AmilasPricer();
const {variable} = new amilasStdLib(context);
// A variable is added to the context
const myVariable = variable();
merge
The merge node is an aggregator, it waiting for all children to evaluate and return an ordonanced array of those values
import {AmilasPricer} from "@amilas/core"
import AmilasStdLib from "@amilas-std/api"
const context = new AmilasPricer();
const {constant, variable, merge} = new AmilasStdLib(context);
const myConstant = constant(42);
const myVariable = variable();
// merge node is added to the context
const merged = merge([myConstant, myVariable]);
// the merged evals to [42, *variableValue*]
error
This node throw the given message
import {AmilasPricer} from "@amilas/core"
import AmilasStdLib from "@amilas-std/api"
const context = new AmilasPricer();
const {error} = new AmilasStdLib(context);
const errorNode = error('This node throws an exception');