MCPcopy Create free account
hub / github.com/editablejs/editable / isHistoryStack

Function isHistoryStack

packages/plugins/history/src/history-stack.ts:26–34  ·  view source on GitHub ↗

* Check if a value is a `History` object.

(value: any)

Source from the content-addressed store, hash-verified

24 */
25
26 isHistoryStack(value: any): value is HistoryStack {
27 return (
28 isPlainObject(value) &&
29 Array.isArray(value.redos) &&
30 Array.isArray(value.undos) &&
31 (value.redos.length === 0 || Operation.isOperationList(value.redos[0].operations)) &&
32 (value.undos.length === 0 || Operation.isOperationList(value.undos[0].operations))
33 )
34 },
35
36 set(editor: Editor, stack: HistoryStack = { undos: [], redos: [] }): void {
37 HISTORY_STACK.set(editor, stack)

Callers

nothing calls this directly

Calls 1

isPlainObjectFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…