azurite
Version:
An open source Azure Storage API compatible server
34 lines • 892 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
/**
* Represents a typed value which can implement its own comparison logic.
*/
class ValueNode {
constructor(value) {
this.value = value;
}
evaluate(_context) {
return this.value;
}
compare(context, other) {
const thisValue = this.evaluate(context);
const otherValue = other.evaluate(context);
if (thisValue === undefined || otherValue === undefined || otherValue === null) {
return NaN;
}
else if (thisValue < otherValue) {
return -1;
}
else if (thisValue > otherValue) {
return 1;
}
else {
return 0;
}
}
toString() {
return `(${this.name} ${this.value})`;
}
}
exports.default = ValueNode;
//# sourceMappingURL=ValueNode.js.map