one
Version:
One is a new React Framework that makes Vite serve both native and web.
8 lines (7 loc) • 341 B
text/typescript
// for some reason instanceof isnt working reliably
export function isResponse(res: any): res is Response {
// fast path: most responses are instances
if (res instanceof Response) return true
// fallback: duck-type check for response-like objects
return res != null && typeof res.status === 'number' && typeof res.ok === 'boolean'
}