This commit is contained in:
Jon Staab
2025-04-09 11:35:09 -07:00
parent 5f3624b8f3
commit 728ad1fba0
37 changed files with 1039 additions and 2183 deletions
-16
View File
@@ -121,22 +121,6 @@ export const custom = <T>(
}
}
// Simple adapter
export const adapter = <Source, Target>({
store,
forward,
backward,
}: {
store: Writable<Source>
forward: (x: Source) => Target
backward: (x: Target) => Source
}) => ({
...derived(store, forward),
set: (x: Target) => store.set(backward(x)),
update: (f: (x: Target) => Target) => store.update((x: Source) => backward(f(forward(x)))),
})
// Event related stores
export type DeriveEventsMappedOptions<T> = {