MCPcopy Create free account
hub / github.com/ICBNetwork/web3-Wallet / enqueue

Function enqueue

ses.cjs:2060–2077  ·  view source on GitHub ↗

* @param {any} val * @param {string} [path]

(val, path=  undefined)

Source from the content-addressed store, hash-verified

2058 * @param {string} [path]
2059 */
2060 function enqueue(val, path= undefined) {
2061 if( !isObject(val)) {
2062 // ignore primitives
2063 return;
2064 }
2065 const type= typeof val;
2066 if( type!== 'object'&& type!== 'function') {
2067 // future proof: break until someone figures out what it should do
2068 throw TypeError( `Unexpected typeof: ${type}`);
2069 }
2070 if( weaksetHas(hardened, val)|| setHas(toFreeze, val)) {
2071 // Ignore if this is an exit, or we've already visited it
2072 return;
2073 }
2074 // console.warn(`adding ${val} to toFreeze`, val);
2075 setAdd(toFreeze, val);
2076 weakmapSet(paths, val, path);
2077 }
2078
2079 /**
2080 * @param {any} obj

Callers 2

freezeAndTraverseFunction · 0.70
hardenFunction · 0.70

Calls 1

isObjectFunction · 0.70

Tested by

no test coverage detected