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

Method has

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

@param {T} value

(value)

Source from the content-addressed store, hash-verified

117
118 /** @param {T} value */
119 has(value) {
120 var has = super.has(value);
121 var sources = this.#sources;
122 var s = sources.get(value);
123
124 if (s === undefined) {
125 if (!has) {
126 // If the value doesn't exist, track the version in case it's added later
127 // but don't create sources willy-nilly to track all possible values
128 get(this.#version);
129 return false;
130 }
131
132 s = this.#source(true);
133
134 if (DEV) {
135 tag(s, `SvelteSet has(${label(value)})`);
136 }
137
138 sources.set(value, s);
139 }
140
141 get(s);
142 return has;
143 }
144
145 /** @param {T} value */
146 add(value) {

Callers 1

addMethod · 0.45

Calls 6

#sourceMethod · 0.95
getFunction · 0.90
tagFunction · 0.90
labelFunction · 0.90
setMethod · 0.65
getMethod · 0.45

Tested by

no test coverage detected