UNPKG

@tokens-studio/graph-engine

Version:

An execution engine to handle Token Studios generators and resolvers

29 lines 928 B
import { AnyArraySchema, NumberSchema } from '../../schemas/index.js'; import { Node } from '../../programmatic/node.js'; export default class NodeDefinition extends Node { static title = 'Slice Array'; static type = 'studio.tokens.array.slice'; static description = 'Slices an input array'; constructor(props) { super(props); this.addInput('array', { type: AnyArraySchema }); this.addInput('start', { type: NumberSchema }); this.addInput('end', { type: NumberSchema }); this.addOutput('value', { type: AnyArraySchema }); } execute() { const { start, end } = this.getAllInputs(); const array = this.inputs.array; const calculated = array.value.slice(start, end); this.outputs.value.set(calculated, array.type); } } //# sourceMappingURL=slice.js.map