azurite
Version:
An open source Azure Storage API compatible server
38 lines • 1.6 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 not equal operation between two nodes (the `ne` query operator).
*
* This is used in queries which resemble the following:
*
* RowKey ne 'bar'
*
* In this case, the `NotEqualsNode` would be the root node, with the left and right nodes
* corresponding to the identifier `RowKey` and the constant `bar`, respectively.
*
* NOTE: This operation includes backwards compatibility for the `guid` type hint, since
* earlier versions of Azurite stored guid values in their raw string format.
*/
class NotEqualsNode extends BinaryOperatorNode_1.default {
get name() {
return `ne`;
}
evaluate(context) {
if (this.left instanceof ValueNode_1.default) {
const compareResult = this.left.compare(context, this.right);
return compareResult !== 0 && !isNaN(compareResult);
}
if (this.right instanceof ValueNode_1.default) {
const compareResult = this.right.compare(context, this.left);
return compareResult !== 0 && !isNaN(compareResult);
}
const left = this.left.evaluate(context);
const right = this.right.evaluate(context);
return left !== right && left !== undefined && right !== undefined;
}
}
exports.default = NotEqualsNode;
//# sourceMappingURL=NotEqualsNode.js.map
;