ConstraintJS - v0.10.2
    Preparing search index...

    Interface ArrayDiff<T>

    An edit script that turns one array into another. Applying removed, then added, then moved (each in order) to the old array produces the new one. See cjs.arrayDiff.

    interface ArrayDiff<T = any> {
        added: { item: T; to: number; to_item: T }[];
        index_changed: {
            from: number;
            from_item: T;
            item: T;
            to: number;
            to_item: T;
        }[];
        moved: {
            from: number
            | undefined;
            insert_at: number;
            item: T;
            move_from: number;
            to: number;
        }[];
        removed: { from: number; from_item: T }[];
    }

    Type Parameters

    • T = any
    Index
    added: { item: T; to: number; to_item: T }[]

    Items to insert after the removals, front to back: insert each item at index to, in order.

    index_changed: { from: number; from_item: T; item: T; to: number; to_item: T }[]

    Every item that is in both arrays, but at a different index.

    moved: {
        from: number | undefined;
        insert_at: number;
        item: T;
        move_from: number;
        to: number;
    }[]

    Items to reposition after the additions, in order: take the item at move_from out of the array, then insert it at insert_at. from and to are the item's indices in the old and new arrays (from is undefined for an item that was just added).

    removed: { from: number; from_item: T }[]

    Items to remove, back to front: remove the item at each from index, in order.