* @param {unknown} store * @returns {asserts store is import('../../types/cache-interceptor.d.ts').default.CacheStore}
(store, name = 'CacheStore')
| 641 | * @returns {asserts store is import('../../types/cache-interceptor.d.ts').default.CacheStore} |
| 642 | */ |
| 643 | function assertCacheStore (store, name = 'CacheStore') { |
| 644 | if (typeof store !== 'object' || store === null) { |
| 645 | throw new TypeError(`expected type of ${name} to be a CacheStore, got ${store === null ? 'null' : typeof store}`) |
| 646 | } |
| 647 | |
| 648 | for (const fn of ['get', 'createWriteStream', 'delete']) { |
| 649 | if (typeof store[fn] !== 'function') { |
| 650 | throw new TypeError(`${name} needs to have a \`${fn}()\` function`) |
| 651 | } |
| 652 | } |
| 653 | } |
| 654 | /** |
| 655 | * @param {unknown} methods |
| 656 | * @returns {asserts methods is import('../../types/cache-interceptor.d.ts').default.CacheMethods[]} |