UNPKG

ts-flex-query

Version:
33 lines 1.2 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.comparison = void 0; const utils_1 = require("../helpers/utils"); exports.comparison = { equal(v1, v2) { if (v1 instanceof Date && v2 instanceof Date) { return v1.getTime() === v2.getTime(); } return v1 === v2; }, notEqual(v1, v2) { return v1 !== v2; }, greater(v1, v2) { return (0, utils_1.isDefined)(v1) && (0, utils_1.isDefined)(v2) && v1 > v2; }, greaterOrEqual(v1, v2) { return (0, utils_1.isDefined)(v1) && (0, utils_1.isDefined)(v2) && v1 >= v2; }, lower(v1, v2) { return (0, utils_1.isDefined)(v1) && (0, utils_1.isDefined)(v2) && v1 < v2; }, lowerOrEqual(v1, v2) { return (0, utils_1.isDefined)(v1) && (0, utils_1.isDefined)(v2) && v1 <= v2; }, has(v1, v2) { return (0, utils_1.isDefined)(v1) && (0, utils_1.isDefined)(v2) && ((typeof v1 === 'string' && typeof v2 === 'string' && v1.split(/\s*,\s*/).includes(v2)) || (typeof v1 === 'number' && typeof v2 === 'number' && (v1 & v2) === v2)); } }; //# sourceMappingURL=comparison.js.map