area
The area of a Shape of a size: a circle's radius, a square's or a regular hexagon's side.
area("hexagon", 2)
⧩ 10.392304845413264
import type { Shape } from "#codebase/geo"; export function area(shape: Shape, size: number): number { if (shape === "circle") return Math.PI * size * size; if (shape === "hexagon") return ((3 * Math.sqrt(3)) / 2) * size * size; return size * size; }