(config)
| 616 | const seedCache = new Map(); |
| 617 | |
| 618 | export const getFetch = (config) => { |
| 619 | let env = (config && config.env) || {}; |
| 620 | const { fetch, Request, Response } = env; |
| 621 | const seeds = [Request, Response, fetch]; |
| 622 | |
| 623 | let len = seeds.length, |
| 624 | i = len, |
| 625 | seed, |
| 626 | target, |
| 627 | map = seedCache; |
| 628 | |
| 629 | while (i--) { |
| 630 | seed = seeds[i]; |
| 631 | target = map.get(seed); |
| 632 | |
| 633 | target === undefined && map.set(seed, (target = i ? new Map() : factory(env))); |
| 634 | |
| 635 | map = target; |
| 636 | } |
| 637 | |
| 638 | return target; |
| 639 | }; |
| 640 | |
| 641 | const adapter = getFetch(); |
| 642 |
no test coverage detected