UNPKG

@polygonjs/polygonjs

Version:

node-based WebGL 3D engine https://polygonjs.com

35 lines (34 loc) 944 B
"use strict"; import { BaseMethod } from "./_Base"; import { stringTailDigits } from "../../../core/String"; export class OpdigitsExpression extends BaseMethod { static requiredArguments() { return [["string", "path to node"]]; } findDependency(args) { const { indexOrPath } = args; if (indexOrPath == null) { return null; } const graph_node = this.findReferencedGraphNode(indexOrPath); if (graph_node) { const node = graph_node; if (node.nameController) { const nameNode = node.nameController.graphNode(); return this.createDependency(nameNode, { indexOrPath }); } } return null; } async processArguments(args) { if (args.length == 1) { const index_or_path = args[0]; const node = this.getReferencedNode(index_or_path); if (node) { const name = node.name(); return stringTailDigits(name); } } return 0; } }