map
ts
function Rect.map(rect: Rect, transform: (rect: Rect) => Partial<Rect>): RectApplies a transformation function to a rectangle, merging the returned partial rectangle with the original.
Example
ts
Rect.map({ left: 10, top: 20, width: 100, height: 50 }, (r) => ({
width: r.width * 2,
}));
// { left: 10, top: 20, width: 200, height: 50 }ts
pipe(
{ left: 10, top: 20, width: 100, height: 50 },
Rect.map((r) => ({ width: r.width * 2 })),
);
// { left: 10, top: 20, width: 200, height: 50 }