azurite
Version:
An open source Azure Storage API compatible server
31 lines • 1.2 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const BinaryOperatorNode_1 = tslib_1.__importDefault(require("./BinaryOperatorNode"));
const ValueNode_1 = tslib_1.__importDefault(require("./ValueNode"));
/**
* Represents a logical less than or equal operation between two nodes (the `le` query operator).
*
* This is used in queries which resemble the following:
*
* RowKey le 'bar'
*
* In this case, the `LessThanEqualNode` would be the root node, with the left and right nodes
* corresponding to the identifier `RowKey` and the constant `bar`, respectively.
*/
class LessThanEqualNode extends BinaryOperatorNode_1.default {
get name() {
return `le`;
}
evaluate(context) {
if (this.left instanceof ValueNode_1.default) {
return this.left.compare(context, this.right) <= 0;
}
if (this.right instanceof ValueNode_1.default) {
return this.right.compare(context, this.left) >= 0;
}
return this.left.evaluate(context) <= this.right.evaluate(context);
}
}
exports.default = LessThanEqualNode;
//# sourceMappingURL=LessThanEqualNode.js.map
;