Home / Function/ toStore() — svelte Function Reference

toStore() — svelte Function Reference

Architecture documentation for the toStore() function in index-server.js from the svelte codebase.

Entity Profile

Dependency Diagram

graph TD
  9b2c21f2_41ab_1545_33fc_5df63113cb0f["toStore()"]
  2bdbc2e5_a0d9_6f47_66f9_fca27e2bedfd["index-server.js"]
  9b2c21f2_41ab_1545_33fc_5df63113cb0f -->|defined in| 2bdbc2e5_a0d9_6f47_66f9_fca27e2bedfd
  ba16ff3e_8a18_d3c4_15e9_96304b539f51["writable()"]
  9b2c21f2_41ab_1545_33fc_5df63113cb0f -->|calls| ba16ff3e_8a18_d3c4_15e9_96304b539f51
  4cf4c423_76ea_40eb_1692_69aae30c30f1["get()"]
  9b2c21f2_41ab_1545_33fc_5df63113cb0f -->|calls| 4cf4c423_76ea_40eb_1692_69aae30c30f1
  style 9b2c21f2_41ab_1545_33fc_5df63113cb0f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/svelte/src/store/index-server.js lines 35–49

export function toStore(get, set) {
	const store = writable(get());

	if (set) {
		return {
			set,
			update: (fn) => set(fn(get())),
			subscribe: store.subscribe
		};
	}

	return {
		subscribe: store.subscribe
	};
}

Subdomains

Frequently Asked Questions

What does toStore() do?
toStore() is a function in the svelte codebase, defined in packages/svelte/src/store/index-server.js.
Where is toStore() defined?
toStore() is defined in packages/svelte/src/store/index-server.js at line 35.
What does toStore() call?
toStore() calls 2 function(s): get, writable.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free