"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.numericSortComparer = void 0;
const sortDirectionNumber_enum_1 = require("../enums/sortDirectionNumber.enum");
const numericSortComparer = (value1, value2, sortDirection = sortDirectionNumber_enum_1.SortDirectionNumber.neutral, sortColumn, gridOptions) => {
    const checkForUndefinedValues = sortColumn?.valueCouldBeUndefined ?? gridOptions?.cellValueCouldBeUndefined ?? false;
    const x = (isNaN(value1) || value1 === '' || value1 === null || (checkForUndefinedValues && value1 === undefined)) ? -Infinity : parseFloat(value1);
    const y = (isNaN(value2) || value2 === '' || value2 === null || (checkForUndefinedValues && value2 === undefined)) ? -Infinity : parseFloat(value2);
    return sortDirection * (x === y ? 0 : (x > y ? 1 : -1));
};
exports.numericSortComparer = numericSortComparer;
//# sourceMappingURL=numericSortComparer.js.map