overleaf/services/web/frontend/js/utils/operations.ts
Tim Down 01439641ca Merge pull request #15376 from overleaf/td-ide-page-working-editor
React IDE page: working editor

GitOrigin-RevId: 3ba8cb787a6f7f8435686d8962adb7444d09acb5
2023-10-27 08:03:07 +00:00

16 lines
510 B
TypeScript

import {
ChangeOperation,
CommentOperation,
DeleteOperation,
InsertOperation,
Operation,
} from '../../../types/change'
export const isInsertOperation = (op: Operation): op is InsertOperation =>
'i' in op
export const isChangeOperation = (op: Operation): op is ChangeOperation =>
'c' in op && 't' in op
export const isCommentOperation = (op: Operation): op is CommentOperation =>
'c' in op && !('t' in op)
export const isDeleteOperation = (op: Operation): op is DeleteOperation =>
'd' in op