"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.deduplicateArray = exports.toArray = exports.isNotNullOrUndefined = exports.sortNumeric = exports.coerceArray = void 0;
const tslib_1 = require("tslib");
const is_1 = tslib_1.__importDefault(require("@sindresorhus/is"));
function coerceArray(input) {
    if (is_1.default.array(input)) {
        return input;
    }
    return [];
}
exports.coerceArray = coerceArray;
function sortNumeric(a, b) {
    return a - b;
}
exports.sortNumeric = sortNumeric;
// Useful for filtering an array so that it includes values that are not null or
// undefined. This predicate acts as a type guard so that the resulting type for
// `values.filter(isNotNullOrUndefined)` is `T[]`.
function isNotNullOrUndefined(value) {
    return !is_1.default.nullOrUndefined(value);
}
exports.isNotNullOrUndefined = isNotNullOrUndefined;
/**
 * Converts a single value or an array of values to an array of values.
 * @param value a single value or an array of values
 * @returns array of values
 */
function toArray(value) {
    return is_1.default.array(value) ? value : [value];
}
exports.toArray = toArray;
function deduplicateArray(array) {
    return Array.from(new Set(array));
}
exports.deduplicateArray = deduplicateArray;
//# sourceMappingURL=array.js.map