Provides a custom merge strategy when the default one is not sufficient.
Prefer their changes without reading the content of the blob and just returning their object id.
const obBlobMerge: BlobMergeCallback = async ({ theirBlob, ourBlob }) => { if (ourBlob && theirBlob) { return { oid: await theirBlob.oid(), mode: await theirBlob.mode() } } throw new MergeNotSupportedError()}
Prefer their changes with returning their text.
const obBlobMerge: BlobMergeCallback = async ({ theirBlob, ourBlob }) => { if (ourBlob && theirBlob) { const ourContent = await ourBlob.content() const theirContent = await theirBlob.content() const decoder = new TextDecoder() const ourText = decoder.decode(ourContent) const theirText = decoder.decode(theirContent) return { mergedText: theirText, mode: await theirBlob.mode() } } throw new MergeNotSupportedError()}
Please note that those examples are very basic implementations. The actual one could be much more complicated and could include following the logic:
MergeNotSupportedError when merge is not clean.
Generated using TypeDoc
Provides a custom merge strategy when the default one is not sufficient.
Example
Prefer their changes without reading the content of the blob and just returning their object id.
Example
Prefer their changes with returning their text.
Please note that those examples are very basic implementations. The actual one could be much more complicated and could include following the logic:
Throws
MergeNotSupportedError when merge is not clean.