example export default ( records ) => records . reduce ( ( values , record ) => { Object . keys ( record ) . forEach ( fieldName => { if ( ! values [ fieldName ] ) { values [ fieldName ] = [ ] ; } if ( record [ fieldName ] != null ) { const value = Array . isArray ( record [ fieldName ] ) ? [ record [ fieldName ] ] : record [ fieldName ] ; values [ fieldName ] = values [ fieldName ] . concat ( value ) ; } } ) ; return values ; } , { } ) ;