@tokens-studio/graph-engine
Version:
An execution engine to handle Token Studios generators and resolvers
27 lines • 848 B
JavaScript
import { Node } from '../../programmatic/node.js';
import { NumberSchema } from '../../schemas/index.js';
export default class NodeDefinition extends Node {
static title = 'Power';
static type = 'studio.tokens.math.pow';
static description = 'Power node allows you to Raises a base number to the power of an exponent.';
constructor(props) {
super(props);
this.addInput('base', {
type: NumberSchema
});
this.addInput('exponent', {
type: {
...NumberSchema,
default: 2
}
});
this.addOutput('value', {
type: NumberSchema
});
}
execute() {
const { base, exponent } = this.getAllInputs();
this.outputs.value.set(Math.pow(base, exponent));
}
}
//# sourceMappingURL=pow.js.map