@@ -90,19 +90,26 @@ class Mapper {
9090 Maybe . of ( mapping . field )
9191 . chain ( getMapSpec ( this . config . mapDelimiter ) )
9292 . chain ( ( [ sourceField , targetField ] ) =>
93- compose (
94- maybe ( accum ) (
95- assign ( targetField , this . config . objDelimiter ) . bind ( this , accum )
96- ) ,
97- Maybe . of ,
98- /* End user-land transforms */
99- ...this . config . postFilters ,
100- getMappingFilter ( mapping . type , this . config . types ) ,
101- ...this . config . preFilters ,
102- /* Begin user-land transforms */
103- map ( field => get ( field , this . config . objDelimiter ) ( curr ) )
104- /* Fields passed to user functions */
105- ) ( sourceField , mapping , this . config , curr , accum )
93+ Either . of ( sourceField )
94+ . map ( map ( field => get ( field , this . config . objDelimiter ) ( curr ) ) )
95+ . map ( _ =>
96+ compose (
97+ /* End user-land transforms */
98+ ...this . config . postFilters ,
99+ getMappingFilter ( mapping . type , this . config . types ) ,
100+ ...this . config . preFilters
101+ /* Begin user-land transforms */
102+ ) ( _ , mapping , this . config , curr , accum )
103+ )
104+ . map ( Maybe . of )
105+ . chain (
106+ maybe ( accum ) (
107+ assign ( targetField , this . config . objDelimiter ) . bind (
108+ this ,
109+ accum
110+ )
111+ )
112+ )
106113 ) ,
107114 next
108115 )
0 commit comments