@tokens-studio/graph-engine
Version:
An execution engine to handle Token Studios generators and resolvers
29 lines • 943 B
JavaScript
import { AnyArraySchema } from '../../schemas/index.js';
import { Node } from '../../programmatic/node.js';
export default class NodeDefinition extends Node {
static title = 'Concat Array';
static type = 'studio.tokens.array.concat';
static description = 'Performs an array join using a string delimiter';
constructor(props) {
super(props);
this.addInput('a', {
type: AnyArraySchema
});
this.addInput('b', {
type: AnyArraySchema
});
this.addOutput('value', {
type: AnyArraySchema
});
}
execute() {
const a = this.inputs.a;
const b = this.inputs.b;
//Verify types
if (a.type.$id !== b.type.$id)
throw new Error('Array types must match');
const calculated = a.value.concat(b.value);
this.outputs.value.set(calculated, a.type);
}
}
//# sourceMappingURL=concat.js.map