get an equivalent rectangle where the height and width are positive.
height
width
import { assertEquals } from "jsr:@std/assert"const my_rect: Rect = { x: -20, y: 100, width: 50, height: -30 }, my_abs_rect = positiveRect(my_rect)assertEquals(my_abs_rect, { x: -20, y: 70, width: 50, height: 30,}) Copy
import { assertEquals } from "jsr:@std/assert"const my_rect: Rect = { x: -20, y: 100, width: 50, height: -30 }, my_abs_rect = positiveRect(my_rect)assertEquals(my_abs_rect, { x: -20, y: 70, width: 50, height: 30,})
get an equivalent rectangle where the
height
andwidth
are positive.Example