UNPKG

@polygonjs/polygonjs

Version:

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

26 lines (25 loc) 557 B
"use strict"; import { _matchArrayLength } from "./_ArrayUtils"; import { NamedFunction1, NamedFunction2 } from "./_Base"; export class lengthVector extends NamedFunction1 { static type() { return "lengthVector"; } func(src) { return src.length(); } } export class lengthVectorArray extends NamedFunction2 { static type() { return "lengthVectorArray"; } func(src, target) { _matchArrayLength(src, target, () => 0); let i = 0; for (let v of src) { target[i] = v.length(); i++; } return target; } }