Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function parseAbortController(options: ArgsRequestInitCombined): ArgsRequestInitCombined {
const { args, requestInit } = options
/* istanbul ignore else */
// eslint-disable-next-line @typescript-eslint/unbound-method
if (! args.abortController || ! args.abortController.signal || typeof args.abortController.abort !== 'function') {
args.abortController = typeof AbortController === 'function'
? new AbortController()
: new _AbortController()
}
/* istanbul ignore else */
if (args.abortController) {
requestInit.signal = args.abortController.signal
}
return { args, requestInit }
}