MCPcopy Create free account
hub / github.com/nodejs/undici / assertCacheOrigins

Function assertCacheOrigins

lib/interceptor/cache.js:26–37  ·  view source on GitHub ↗

* @param {(string | RegExp)[] | undefined} origins * @param {string} name

(origins, name)

Source from the content-addressed store, hash-verified

24 * @param {string} name
25 */
26function assertCacheOrigins (origins, name) {
27 if (origins === undefined) return
28 if (!Array.isArray(origins)) {
29 throw new TypeError(`expected ${name} to be an array or undefined, got ${typeof origins}`)
30 }
31 for (let i = 0; i < origins.length; i++) {
32 const origin = origins[i]
33 if (typeof origin !== 'string' && !(origin instanceof RegExp)) {
34 throw new TypeError(`expected ${name}[${i}] to be a string or RegExp, got ${typeof origin}`)
35 }
36 }
37}
38
39const nop = () => {}
40

Callers 1

cache.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected