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

Method constructor

packages/svelte/src/reactivity/set.js:57–76  ·  view source on GitHub ↗

* @param {Iterable<T> | null | undefined} [value]

(value)

Source from the content-addressed store, hash-verified

55 * @param {Iterable<T> | null | undefined} [value]
56 */
57 constructor(value) {
58 super();
59
60 if (DEV) {
61 // If the value is invalid then the native exception will fire here
62 value = new Set(value);
63
64 tag(this.#version, 'SvelteSet version');
65 tag(this.#size, 'SvelteSet.size');
66 }
67
68 if (value) {
69 for (var element of value) {
70 super.add(element);
71 }
72 this.#size.v = super.size;
73 }
74
75 if (!inited) this.#init();
76 }
77
78 /**
79 * If the source is being created inside the same reaction as the SvelteSet instance,

Callers

nothing calls this directly

Calls 3

#initMethod · 0.95
tagFunction · 0.90
addMethod · 0.45

Tested by

no test coverage detected