ebv property

bool get ebv

Computes the Effective Boolean Value (EBV) of the sequence.

Implementation

bool get ebv {
  final iterator = this.iterator;
  if (!iterator.moveNext()) return false;
  final item = iterator.current;
  if (item is XmlNode) return true;
  if (!iterator.moveNext()) {
    if (item is bool) return item;
    if (item is num) return item != 0 && !item.isNaN;
    if (item is String) return item.isNotEmpty;
    throw XPathEvaluationException(
      'Invalid type for EBV: ${item.runtimeType}',
    );
  }
  throw XPathEvaluationException('Invalid EBV for sequence of length > 1');
}