MCPcopy
hub / github.com/williamngan/pts / map

Method map

src/LinearAlgebra.ts:200–205  ·  view source on GitHub ↗

* Given a mapping function, update `a`'s value in each dimension. * @returns vector `a`

( a:PtLike, fn:(n:number, index:number, arr) => number )

Source from the content-addressed store, hash-verified

198 * @returns vector `a`
199 */
200 static map( a:PtLike, fn:(n:number, index:number, arr) => number ):PtLike {
201 for (let i=0, len=a.length; i<len; i++) {
202 a[i] = fn( a[i], i, a );
203 }
204 return a;
205 }
206
207}
208

Callers 15

lFunction · 0.80
rFunction · 0.80
sound_visual.jsFile · 0.80
op_bspline_2.jsFile · 0.80
getting_started.jsFile · 0.80
op_intersect.jsFile · 0.80
group_segments.jsFile · 0.80
colorizeFunction · 0.80
op_closest_2.jsFile · 0.80
sound_time.jsFile · 0.80

Calls 1

fnFunction · 0.85

Tested by

no test coverage detected