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

Function assertCacheOrigins

lib/interceptor/cache.js:17–28  ·  view source on GitHub ↗

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

(origins, name)

Source from the content-addressed store, hash-verified

15 * @param {string} name
16 */
17function assertCacheOrigins (origins, name) {
18 if (origins === undefined) return
19 if (!Array.isArray(origins)) {
20 throw new TypeError(`expected ${name} to be an array or undefined, got ${typeof origins}`)
21 }
22 for (let i = 0; i < origins.length; i++) {
23 const origin = origins[i]
24 if (typeof origin !== 'string' && !(origin instanceof RegExp)) {
25 throw new TypeError(`expected ${name}[${i}] to be a string or RegExp, got ${typeof origin}`)
26 }
27 }
28}
29
30const nop = () => {}
31

Callers 1

cache.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected