-
-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(transducers-patch): fix #256 replace enum
BREAKING CHANGE: replace Patch enum w/ type alias, update PatchArrayOp/PatchObjOp
- Loading branch information
1 parent
ef7ba74
commit 5086a33
Showing
4 changed files
with
29 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,14 @@ | ||
import type { FnO, Path } from "@thi.ng/api"; | ||
|
||
export enum Patch { | ||
SET, | ||
INSERT, | ||
UPDATE, | ||
DELETE, | ||
} | ||
export type Patch = "set" | "insert" | "update" | "delete"; | ||
|
||
export type PatchArrayOp<T> = | ||
| [Patch.SET, number, T] | ||
| [Patch.INSERT, number, T[]] | ||
| [Patch.UPDATE, number, FnO<T, T>, ...any[]] | ||
| [Patch.DELETE, number]; | ||
| ["set", number, T] | ||
| ["insert", number, T[]] | ||
| ["update", number, FnO<T, T>, ...any[]] | ||
| ["delete", number]; | ||
|
||
export type PatchObjOp = | ||
| [Patch.SET, Path, any] | ||
| [Patch.UPDATE, Path, FnO<any, any>, ...any[]] | ||
| [Patch.DELETE, Path]; | ||
| ["set", Path, any] | ||
| ["update", Path, FnO<any, any>, ...any[]] | ||
| ["delete", Path]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters