mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-12 06:01:36 -05:00
250acbf33c
Use new import JSDoc syntax for Typescript annotations GitOrigin-RevId: 782456d637fc8f2de6163b5d70fabf06c1d74964
37 lines
623 B
JavaScript
37 lines
623 B
JavaScript
// @ts-check
|
|
|
|
/**
|
|
* @import { CommentOp, DeleteOp, InsertOp, Op, RetainOp } from './types'
|
|
*/
|
|
|
|
/**
|
|
* @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
|
|
}
|