const camelcaseKeys = require ( "camelcase-keys" ) ; const parseDateFields = ( resource , fields = [ "createdAt" , "updatedAt" ] ) => { fields . forEach ( ( key ) => { const val = resource [ key ] ; if ( val ) resource [ key ] = new Date ( val ) ; } ) ; return resource ; } ; const camelCaseFields = ( resource ) => camelcaseKeys ( resource , { deep : true } ) ; function mkPipe ( ... fns ) { return ( initVal ) => fns . reduce ( ( r , f ) => f ( r ) , initVal ) ; } export const defaultParser = mkPipe ( camelCaseFields , parseDateFields ) ;