/**
 * Order object of array, x has to be monotone. Ensure x is growing
 * @param data - object of kind {x:[], y:[]}.
 * @returns data with x in ascending order (reversed in-place if descending).
 */
export function xyGrowingX(data) {
    const { x, y } = data;
    if (x.length !== y.length) {
        throw new TypeError('length of x and y must be identical');
    }
    if (x.length < 2 || x[0] < x.at(-1))
        return data;
    return {
        x: x.toReversed(),
        y: y.toReversed(),
    };
}
//# sourceMappingURL=xyGrowingX.js.map