mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-07 08:09:01 +02:00
6d216d4738
Handle tracked changes during resyncs GitOrigin-RevId: 1d5b16a4cb17226da184a5430ebbcfc79ad9c7ce
42 lines
789 B
JavaScript
42 lines
789 B
JavaScript
// @ts-check
|
|
|
|
/**
|
|
* @typedef {import('./types').CommentOp} CommentOp
|
|
* @typedef {import('./types').DeleteOp} DeleteOp
|
|
* @typedef {import('./types').InsertOp} InsertOp
|
|
* @typedef {import('./types').Op} Op
|
|
* @typedef {import('./types').RetainOp} RetainOp
|
|
*/
|
|
|
|
/**
|
|
* @param {Op} op
|
|
* @returns {op is InsertOp}
|
|
*/
|
|
export function isInsert(op) {
|
|
return 'i' in op && op.i != null
|
|
}
|
|
|
|
/**
|
|
* @param {Op} op
|
|
* @returns {op is RetainOp}
|
|
*/
|
|
export function isRetain(op) {
|
|
return 'r' in op && op.r != null
|
|
}
|
|
|
|
/**
|
|
* @param {Op} op
|
|
* @returns {op is DeleteOp}
|
|
*/
|
|
export function isDelete(op) {
|
|
return 'd' in op && op.d != null
|
|
}
|
|
|
|
/**
|
|
* @param {Op} op
|
|
* @returns {op is CommentOp}
|
|
*/
|
|
export function isComment(op) {
|
|
return 'c' in op && op.c != null && 't' in op && op.t != null
|
|
}
|