Skip to content

Commit b0b73fa

Browse files
committed
add get method to CausalArray
1 parent 6f38a7a commit b0b73fa

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/data/collections/causal/CausalArray.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,14 @@ class CausalArray<T> extends BaseCausalCollection<T> implements CausalCollection
381381
return this._hashes[idx];
382382
}
383383

384+
get(hash: Hash): T|undefined {
385+
if (this.hasByHash(hash)) {
386+
return this._elements.get(hash);
387+
} else {
388+
return undefined;
389+
}
390+
}
391+
384392
indexOf(element?: T) {
385393
return this.indexOfByHash(HashedObject.hashElement(element));
386394
}

0 commit comments

Comments
 (0)