UNPKG

@polygonjs/polygonjs

Version:

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

24 lines (23 loc) 627 B
"use strict"; import { BaseMethod } from "./_Base"; export class StrIndexExpression extends BaseMethod { // str_chars_count('bla') => 3 static requiredArguments() { return [ ["string", "string to get index from"], ["string", "char to find index of"] ]; } // findDependency(index_or_path: number | string): null { // return null // // return this.createDependencyFromIndexOrPath(index_or_path) // } async processArguments(args) { if (args.length == 2) { const string = args[0]; const sub_string = args[1]; return string.indexOf(sub_string); } return -1; } }