import { BodyType } from './types' ; export function isFormData ( body ) { return typeof FormData !== 'undefined' && body instanceof FormData ; } export function isArrayBuffer ( value ) { return typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer ; } export function isBlob ( value ) { return typeof Blob !== 'undefined' && value instanceof Blob ; } export function isReadableStream ( value ) { return ( typeof ReadableStream !== 'undefined' && value instanceof ReadableStream ) ; } export function isURLSearchParams ( value ) { return ( typeof URLSearchParams !== 'undefined' && value instanceof URLSearchParams ) ; } export function isValidReader ( reader ) { return [ 'arrayBuffer' , 'blob' , 'formData' , 'json' , 'text' , 'raw' ] . includes ( reader ) ; } export function isValidBody ( content ) { if ( typeof content === 'string' ) { return true ; } if ( isArrayBuffer ( content ) ) { return true ; } if ( isBlob ( content ) ) { return true ; } if ( isFormData ( content ) ) { return true ; } if ( isReadableStream ( content ) ) { return true ; } return isURLSearchParams ( content ) ; }