UNPKG

@tokens-studio/graph-engine

Version:

An execution engine to handle Token Studios generators and resolvers

26 lines 888 B
import { AnySchema, BooleanSchema, createVariadicSchema } from '../../schemas/index.js'; import { Node } from '../../programmatic/node.js'; export default class NodeDefinition extends Node { static title = 'Logical and'; static type = 'studio.tokens.logic.and'; static description = 'AND node allows you to check if all inputs are true.'; constructor(props) { super(props); this.addInput('inputs', { type: { ...createVariadicSchema(AnySchema), default: [] }, variadic: true }); this.addOutput('value', { type: BooleanSchema }); } execute() { const inputs = this.inputs.inputs.value; const output = inputs.reduce((acc, curr) => acc && !!curr, true); this.outputs.value.set(output); } } //# sourceMappingURL=and.js.map