@cognigy/rest-api-client
Version:
Cognigy REST-Client
29 lines • 817 B
JavaScript
/* Constants */
import { MAX_INT32 } from "../../constants";
export class NumberRange {
constructor(data) {
this.$gte = 0;
this.$lte = MAX_INT32;
this.type = "NumberRange";
const { $gte = 0, $lte = 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");
}
}
//# sourceMappingURL=NumberRange.js.map