@polygonjs/polygonjs
Version:
node-based WebGL 3D engine https://polygonjs.com
14 lines (13 loc) • 356 B
JavaScript
;
import { BaseMethod } from "./_Base";
export class PadzeroExpression extends BaseMethod {
static requiredArguments() {
return [["string", "number"]];
}
async processArguments(args) {
const pad = args[0] || 2;
const srcNumber = args[1] || 0;
const unpadded = `${srcNumber}`;
return unpadded.padStart(pad, "0");
}
}