import { isArray , isUndefined } from '../helpers/is' ; import { AxiosRequestData , AxiosRequestFormData , AxiosResponseHeaders , } from './Axios' ; export interface AxiosTransformer { ( data ? , headers ? ) : AxiosRequestData | AxiosRequestFormData ; } export function transformData ( data ? , headers ? , transforms ? ) { if ( isUndefined ( transforms ) ) { return data ; } if ( ! isArray ( transforms ) ) { transforms = [ transforms ] ; } transforms . forEach ( ( transform ) => { data = transform ( data , headers ) ; } ) ; return data ; }