@cognigy/rest-api-client
Version:
Cognigy REST-Client
33 lines • 979 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.NumberRange = void 0;
/* Constants */
const constants_1 = require("../../constants");
class NumberRange {
constructor(data) {
this.$gte = 0;
this.$lte = constants_1.MAX_INT32;
this.type = "NumberRange";
const { $gte = 0, $lte = constants_1.MAX_INT32 } = data;
this.$gte = $gte;
this.$lte = $lte;
}
toString() {
return `[${this.$gte},${this.$lte}]`;
}
toMongoQuery() {
return {
$gte: this.$gte,
$lte: this.$lte,
};
}
static isNumberRange(variable) {
return (typeof variable === "object" &&
variable.hasOwnProperty("$gte") &&
typeof variable.$gte === "number" &&
variable.hasOwnProperty("$lte") &&
typeof variable.$lte === "number");
}
}
exports.NumberRange = NumberRange;
//# sourceMappingURL=NumberRange.js.map