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

Function has

packages/svelte/src/internal/client/proxy.js:224–258  ·  view source on GitHub ↗
(target, prop)

Source from the content-addressed store, hash-verified

222 },
223
224 has(target, prop) {
225 if (prop === STATE_SYMBOL) {
226 return true;
227 }
228
229 var s = sources.get(prop);
230 var has = (s !== undefined && s.v !== UNINITIALIZED) || Reflect.has(target, prop);
231
232 if (
233 s !== undefined ||
234 (active_effect !== null && (!has || get_descriptor(target, prop)?.writable))
235 ) {
236 if (s === undefined) {
237 s = with_parent(() => {
238 var p = has ? proxy(target[prop]) : UNINITIALIZED;
239 var s = source(p, stack);
240
241 if (DEV) {
242 tag(s, get_label(path, prop));
243 }
244
245 return s;
246 });
247
248 sources.set(prop, s);
249 }
250
251 var value = get(s);
252 if (value === UNINITIALIZED) {
253 return false;
254 }
255 }
256
257 return has;
258 },
259
260 set(target, prop, value, receiver) {
261 var s = sources.get(prop);

Callers

nothing calls this directly

Calls 9

tagFunction · 0.90
getFunction · 0.90
with_parentFunction · 0.85
proxyFunction · 0.85
sourceFunction · 0.85
get_labelFunction · 0.85
setMethod · 0.65
getMethod · 0.45
hasMethod · 0.45

Tested by

no test coverage detected