@@ -59,13 +59,10 @@ const getMapSpec = (mapping, delimiter) =>
5959const normalizeMapping = mapping =>
6060 typeof mapping === 'string' ? { field : mapping } : mapping
6161
62- const getMappingFilter = ( mapping , types ) => {
63- if ( mapping . type ) {
64- if ( Array . isArray ( mapping . type ) ) return compose ( ...mapping . type )
65- if ( typeof mapping . type === 'function' ) return mapping . type
66- if ( Object . prototype . hasOwnProperty . call ( types , mapping . type ) )
67- return types [ mapping . type ]
68- }
62+ const getMappingFilter = ( type , types ) => {
63+ if ( Array . isArray ( type ) ) return compose ( ...type )
64+ if ( typeof type === 'function' ) return type
65+ if ( Object . prototype . hasOwnProperty . call ( types , type ) ) return types [ type ]
6966 return id
7067}
7168
@@ -108,7 +105,7 @@ class Mapper {
108105 assign ( targetField , this . config . objDelimiter ) . bind ( this , accum ) ,
109106 /* End user-land transforms */
110107 ...this . config . postFilters ,
111- getMappingFilter ( mapping , this . config . types ) ,
108+ getMappingFilter ( mapping . type , this . config . types ) ,
112109 ...this . config . preFilters ,
113110 /* Begin user-land transforms */
114111 map ( field => get ( field , this . config . objDelimiter ) ( curr ) )
0 commit comments