* @param {unknown} store * @returns {asserts store is import('../../types/cache-interceptor.d.ts').default.CacheStore}
(store, name = 'CacheStore')
| 681 | * @returns {asserts store is import('../../types/cache-interceptor.d.ts').default.CacheStore} |
| 682 | */ |
| 683 | function assertCacheStore (store, name = 'CacheStore') { |
| 684 | if (typeof store !== 'object' || store === null) { |
| 685 | throw new TypeError(`expected type of ${name} to be a CacheStore, got ${store === null ? 'null' : typeof store}`) |
| 686 | } |
| 687 | |
| 688 | for (const fn of ['get', 'createWriteStream', 'delete']) { |
| 689 | if (typeof store[fn] !== 'function') { |
| 690 | throw new TypeError(`${name} needs to have a \`${fn}()\` function`) |
| 691 | } |
| 692 | } |
| 693 | } |
| 694 | /** |
| 695 | * @param {unknown} methods |
| 696 | * @returns {asserts methods is import('../../types/cache-interceptor.d.ts').default.CacheMethods[]} |