mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-01 18:54:09 -05:00
377cd82f20
Add history metadata to updates sent to project-history GitOrigin-RevId: 915beaa01f2bbe48869a40b229397be8e0401852
40 lines
743 B
JavaScript
40 lines
743 B
JavaScript
// @ts-check
|
|
|
|
/**
|
|
* @typedef {import('./types').CommentOp} CommentOp
|
|
* @typedef {import('./types').DeleteOp} DeleteOp
|
|
* @typedef {import('./types').InsertOp} InsertOp
|
|
* @typedef {import('./types').Op} Op
|
|
*/
|
|
|
|
/**
|
|
* Returns true if the op is an insert
|
|
*
|
|
* @param {Op} op
|
|
* @returns {op is InsertOp}
|
|
*/
|
|
function isInsert(op) {
|
|
return 'i' in op && op.i != null
|
|
}
|
|
|
|
/**
|
|
* Returns true if the op is an insert
|
|
*
|
|
* @param {Op} op
|
|
* @returns {op is DeleteOp}
|
|
*/
|
|
function isDelete(op) {
|
|
return 'd' in op && op.d != null
|
|
}
|
|
|
|
/**
|
|
* Returns true if the op is a comment
|
|
*
|
|
* @param {Op} op
|
|
* @returns {op is CommentOp}
|
|
*/
|
|
function isComment(op) {
|
|
return 'c' in op && op.c != null
|
|
}
|
|
|
|
module.exports = { isInsert, isDelete, isComment }
|