MCPcopy Index your code
hub / github.com/nodejs/undici / assertCacheStore

Function assertCacheStore

lib/util/cache.js:344–354  ·  view source on GitHub ↗

* @param {unknown} store * @returns {asserts store is import('../../types/cache-interceptor.d.ts').default.CacheStore}

(store, name = 'CacheStore')

Source from the content-addressed store, hash-verified

342 * @returns {asserts store is import('../../types/cache-interceptor.d.ts').default.CacheStore}
343 */
344function assertCacheStore (store, name = 'CacheStore') {
345 if (typeof store !== 'object' || store === null) {
346 throw new TypeError(`expected type of ${name} to be a CacheStore, got ${store === null ? 'null' : typeof store}`)
347 }
348
349 for (const fn of ['get', 'createWriteStream', 'delete']) {
350 if (typeof store[fn] !== 'function') {
351 throw new TypeError(`${name} needs to have a \`${fn}()\` function`)
352 }
353 }
354}
355/**
356 * @param {unknown} methods
357 * @returns {asserts methods is import('../../types/cache-interceptor.d.ts').default.CacheMethods[]}

Callers 1

cache.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…