xpath-ts2
Version:
DOM 3 and 4 XPath 1.0 implementation for browser and Node.js environment with support for typescript 5.
17 lines (14 loc) • 411 B
text/typescript
import { XPathContext } from '../xpath-types';
import { BinaryOperation } from './binary-operation';
export class OrOperation extends BinaryOperation {
evaluate(c: XPathContext) {
const b = this.lhs.evaluate(c).bool;
if (b.booleanValue) {
return b;
}
return this.rhs.evaluate(c).bool;
}
toString() {
return '(' + this.lhs.toString() + ' or ' + this.rhs.toString() + ')';
}
}