import { curry } from '@typed/lambda' ; import { isRefreshingSuccess } from './isRefreshingSuccess' ; import { isSuccess } from './isSuccess' ; import { RefreshingSuccess } from './RefreshingSuccess' ; import { RemoteData } from './RemoteData' ; import { Success } from './Success' ; name export const map = curry ( __map ) as { < A , B , C > ( f , data ) : RemoteData < A , C > ; < A , B , C > ( f ) : ( data : RemoteData < A , B > ) => RemoteData < A , C > ; } ; function __map < A , B , C > ( f , data ) { if ( isRefreshingSuccess ( data ) ) { return RefreshingSuccess . of ( f ( data . value , true ) ) ; } return isSuccess ( data ) ? Success . of ( f ( data . value , false ) ) : data ; }