import { NodeDefinition, StatelessGraphNode, StatelessNodeDefinition, StatelessNodeType } from '../../types/graph'; /** * An instance of the [[add]] node. * See the [[add]] documentation to find out more. */ export interface AddNode extends StatelessGraphNode<'add', AddNodeProperties> { } /** * A definition of the [[add]] node. * See the [[add] documentation to find out more. */ export interface AddNodeDefinition extends StatelessNodeDefinition<'add', AddNodeProperties> { } export interface AddNodeProperties { operands: Array; } /** * The implementation of the [[add]] node. * See the [[add]] documentation to learn more. */ export declare const AddNodeType: StatelessNodeType<'add', AddNodeProperties>; /** * Creates a new instance of an [[add]] which is a type of [[NodeDefinition]] used to compute * the sum of multiple number-based [values](_nodes_graph_value_.html#value). * The [[add]] takes any number of operands. It will throw an error if the number of operands * is below 2 as it doesn't make sense to do the sum operation with a single operand. * @returns {AddNodeDefinition} * * @example **Add two numbers** * ```js * import muster, { add, ref } from '@dws/muster'; * * const app = muster({ * five: 5, * three: 3, * }); * * const result = await app.resolve( * add(ref('five'), ref('three')), * ); * // result === 8 * ``` * This example shows how to compute a sum of 5 and 3 with the use of an [[add]]. * * * @example **Add five numbers** * ```js * import muster, { add, computed, ref, variable } from '@dws/muster'; * * const app = muster({ * five: 5, * four: computed([], () => 4), * three: variable(3), * two: add(ref('one'), ref('one')), * one: 1, * }); * * const result = await app.resolve( * add(ref('five'), ref('four'), ref('three'), ref('two'), ref('one')), * // Same as 5+4+3+2+1 in JS * ); * // result === 15 * ``` * This example shows how to add five differently computed numbers. As mentioned in the * description above, this node can handle any number of operands as long as they * resolve to a numeric [value](_nodes_graph_value_.html#value). */ export declare function add(...operands: Array): AddNodeDefinition; export declare function isAddNodeDefinition(value: NodeDefinition): value is AddNodeDefinition;