compose method
Composes this delta with other
and returns new Delta.
It is not required for this and other
delta to represent a document
delta (consisting only of insert operations).
Implementation
Delta compose(Delta other) {
final result = Delta();
final thisIter = DeltaIterator(this);
final otherIter = DeltaIterator(other);
while (thisIter.hasNext || otherIter.hasNext) {
final newOp = _composeOperation(thisIter, otherIter);
if (newOp != null) result.push(newOp);
}
return result..trim();
}