import { NodeDefinition, StatelessGraphNode, StatelessNodeDefinition, StatelessNodeType } from '../../types/graph'; /** * An instance of the [[subtract]] node. * See the [[subtract]] documentation to find out more. */ export interface SubtractNode extends StatelessGraphNode<'subtract', SubtractNodeProperties> { } /** * A definition of the [[subtract]] node. * See the [[subtract]] documentation to find out more. */ export interface SubtractNodeDefinition extends StatelessNodeDefinition<'subtract', SubtractNodeProperties> { } export interface SubtractNodeProperties { operands: Array; } /** * The implementation of the [[subtract]] node. * See the [[subtract]] documentation to learn more. */ export declare const SubtractNodeType: StatelessNodeType<'subtract', SubtractNodeProperties>; /** * Creates a new instance of a [[subtract]] node, which is a type of [[NodeDefinition]] used to compute the difference * between multiple number-based [values](_nodes_graph_value_.html#value). * The [[subtract]] node 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 subtraction operation with a single operand. * @returns {SubtractNodeDefinition} * * * @example **Subtract two numbers** * ```js * import muster, { ref, subtract } from '@dws/muster'; * * const app = muster({ * five: 5, * three: 3, * }); * * const result = await app.resolve( * subtract(ref('five'), ref('three')), * ); * // result === 2 * ``` * This example shows how to compute a difference between 5 and 3 with the use of a [[subtract]] node. * * * @example **Subtract five numbers** * ```js * import muster, { add, computed, ref, subtract, 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( * subtract(ref('five'), ref('four'), ref('three'), ref('two'), ref('one')), * // Same as 5-4-3-2-1 in JS * ); * // result === -5 * ``` * This example shows how to subtract 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 subtract(...operands: Array): SubtractNodeDefinition; export declare function isSubtractNodeDefinition(value: NodeDefinition): value is SubtractNodeDefinition;