Reducer for Patch based array edits. Only numeric indices are supported (i.e. NO nested edits, use patchObj for that purpose).
Unless immutable is false (default: true), all edits are performed in a non-destructive manner.
immutable
The following patch types are supported:
// direct invocation patchArray( true, [1, 2, 3], [ [Patch.SET, 0, 42], [Patch.UPDATE, 1, (x, n) => x * n, 10], [Patch.INSERT, 2, [10, 11]], [Patch.DELETE, 3] ] ); // [ 42, 20, 10, 3 ]
Generated using TypeDoc
Reducer for Patch based array edits. Only numeric indices are supported (i.e. NO nested edits, use patchObj for that purpose).
Unless
immutable
is false (default: true), all edits are performed in a non-destructive manner.The following patch types are supported:
// direct invocation patchArray( true, [1, 2, 3], [ [Patch.SET, 0, 42], [Patch.UPDATE, 1, (x, n) => x * n, 10], [Patch.INSERT, 2, [10, 11]], [Patch.DELETE, 3] ] ); // [ 42, 20, 10, 3 ]