Skip to main content
Module

x/automerge/next.ts>splice

A JSON-like data structure (a CRDT) that can be modified concurrently by different users, and merged again automatically.
Go to Latest
function splice
import { splice } from "https://deno.land/x/automerge@2.2.0/next.ts";

Modify a string

Parameters

doc: Doc<T>
  • The document to modify
path: stable.Prop[]
  • The path to the string to modify
index: number | Cursor
  • The position (as a Cursor or index) to edit. If a cursor is used then the edit happens such that the cursor will now point to the end of the newText, so you can continue to reuse the same cursor for multiple calls to splice.
del: number
  • The number of code units to delete, a positive number deletes N characters after the cursor, a negative number deletes N characters before the cursor.
optional
newText: string
  • The string to insert (if any).