import { xyObjectCheck } from "./xyObjectCheck.js";
/**
 * Returns all min and max values of an array of points.
 * @param points - array of points {x,y}.
 * @returns object with the 4 extrema.
 */
export function xyObjectMinMaxValues(points) {
    xyObjectCheck(points, { minLength: 1 });
    let minX = points[0].x;
    let maxX = minX;
    let minY = points[0].y;
    let maxY = minY;
    for (const point of points) {
        if (point.x < minX)
            minX = point.x;
        if (point.x > maxX)
            maxX = point.x;
        if (point.y < minY)
            minY = point.y;
        if (point.y > maxY)
            maxY = point.y;
    }
    return { minX, maxX, minY, maxY };
}
//# sourceMappingURL=xyObjectMinMaxValues.js.map