UNPKG

@polygonjs/polygonjs

Version:

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

25 lines (24 loc) 611 B
"use strict"; import { isArray } from "../../../core/Type"; import { BaseMethod } from "./_Base"; export class JoinExpression extends BaseMethod { static requiredArguments() { return [ ["array", "array to join the elements of"], ["separator", "separator used to join the elements"] ]; } async processArguments(args) { if (args.length == 1 || args.length == 2) { const arg = args[0]; let separator = args[1]; if (separator == null) { separator = " "; } if (isArray(arg)) { return arg.join(separator); } } return ""; } }