@polygonjs/polygonjs
Version:
node-based WebGL 3D engine https://polygonjs.com
18 lines (17 loc) • 459 B
JavaScript
;
import { isString, isArray } from "./../../../core/Type";
import { BaseMethod } from "./_Base";
export class LenExpression extends BaseMethod {
static requiredArguments() {
return [["array_or_string", "array or string to count elements of"]];
}
async processArguments(args) {
if (args.length == 1) {
const arg = args[0];
if (isString(arg) || isArray(arg)) {
return arg.length;
}
}
return 0;
}
}