• Modify a string

    Type Parameters

    • T

      The type of the value contained in the document

    Parameters

    • doc: Doc<T>

      The document to modify

    • path: Prop[]

      The path to the string to modify

    • index: string | number

      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).

    Returns void