• Make an immutable view of an automerge document as at heads

    Type Parameters

    • T

      The type of the value contained in the document

    Parameters

    • doc: Doc<T>

      The document to create a view of

    • heads: Heads

      The hashes of the heads to create a view at

    Returns Doc<T>

    Remarks

    The document returned from this function cannot be passed to change. This is because it shares the same underlying memory as doc, but it is consequently a very cheap copy.

    Note that this function will throw an error if any of the hashes in heads are not in the document.