( obj: TObject | undefined, key: K, defaults: TValue )
| 566 | // If the options object is undefined, it will return the defaults for that property (passed in as the 3rd arg). |
| 567 | // if the options object is defined, and the property exists, then it will return the defaults if the value of the property is undefined or null |
| 568 | const resolveDefaults = < |
| 569 | TObject extends Record<string, unknown>, |
| 570 | K extends keyof TObject, |
| 571 | TValue extends TObject[K], |
| 572 | >( |
| 573 | obj: TObject | undefined, |
| 574 | key: K, |
| 575 | defaults: TValue |
| 576 | ): TValue => { |
| 577 | if (!obj) { |
| 578 | return defaults; |
| 579 | } |
| 580 | |
| 581 | if (obj[key] === undefined || obj[key] === null) { |
| 582 | return defaults; |
| 583 | } |
| 584 | |
| 585 | return obj[key] as TValue; |
| 586 | }; |
| 587 | |
| 588 | const createFetchAttributes = ( |
| 589 | input: RequestInfo | URL, |
no outgoing calls
no test coverage detected
searching dependent graphs…