MCPcopy
hub / github.com/nodejs/undici / assertCacheOrigins

Function assertCacheOrigins

lib/interceptor/cache.js:16–27  ·  view source on GitHub ↗

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

(origins, name)

Source from the content-addressed store, hash-verified

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

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…