@tokens-studio/graph-engine
Version:
An execution engine to handle Token Studios generators and resolvers
26 lines • 885 B
JavaScript
import { AnySchema, BooleanSchema, createVariadicSchema } from '../../schemas/index.js';
import { Node } from '../../programmatic/node.js';
export default class NodeDefinition extends Node {
static title = 'Logical or';
static type = 'studio.tokens.logic.or';
static description = 'OR 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, false);
this.outputs.value.set(output);
}
}
//# sourceMappingURL=or.js.map