@tokens-studio/graph-engine
Version:
An execution engine to handle Token Studios generators and resolvers
24 lines • 765 B
JavaScript
import { AnySchema } from '../../schemas/index.js';
import { Node } from '../../programmatic/node.js';
export default class NodeDefinition extends Node {
static title = 'Assert defined';
static type = 'studio.tokens.typing.assertDefined';
static description = 'Asserts that a value is defined';
constructor(props) {
super(props);
this.addInput('value', {
type: AnySchema
});
this.addOutput('value', {
type: AnySchema
});
}
execute() {
const value = this.inputs.value;
if (value.value === undefined) {
throw new Error('Value is required');
}
this.outputs.value.set(value, value.type);
}
}
//# sourceMappingURL=assertDefined.js.map