Applies fn on x,y & z (if present) fields, returning all other fields as well
fn
const p = {x:1.234, y:4.9};const p2 = Points.apply(p, Math.round);// Yields: {x:1, y:5} Copy
const p = {x:1.234, y:4.9};const p2 = Points.apply(p, Math.round);// Yields: {x:1, y:5}
The name of the field is provided as well. Here we only round the x field:
x
const p = {x:1.234, y:4.9};const p2 = Points.apply(p, (v, field) => { if (field === `x`) return Math.round(v); return v;}); Copy
const p = {x:1.234, y:4.9};const p2 = Points.apply(p, (v, field) => { if (field === `x`) return Math.round(v); return v;});
Applies
fn
on x,y & z (if present) fields, returning all other fields as wellThe name of the field is provided as well. Here we only round the
x
field:Param: pt
Param: fn
Returns