MCPcopy
hub / github.com/sveltejs/svelte / toStore

Function toStore

packages/svelte/src/store/index-server.js:35–49  ·  view source on GitHub ↗
(get, set)

Source from the content-addressed store, hash-verified

33 * @returns {Writable<V> | Readable<V>}
34 */
35export function toStore(get, set) {
36 const store = writable(get());
37
38 if (set) {
39 return {
40 set,
41 update: (fn) => set(fn(get())),
42 subscribe: store.subscribe
43 };
44 }
45
46 return {
47 subscribe: store.subscribe
48 };
49}
50
51/**
52 * @template V

Callers

nothing calls this directly

Calls 4

writableFunction · 0.90
getFunction · 0.90
setFunction · 0.50
fnFunction · 0.50

Tested by

no test coverage detected