Skip to content

Commit

Permalink
feat(core): add logic to run preMapArray if available when invoking m…
Browse files Browse the repository at this point in the history
…apArray
  • Loading branch information
nartc committed Jan 31, 2021
1 parent c9fd9f3 commit f1f97f3
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/core/src/lib/create-mapper/create-mapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,17 @@ export function createMapper<TKey = unknown>({
);
},
mapArray(sourceArr, destination, source, options) {
// default runPreMap to true
const { runPreMap = true } = options || {};
let adjustedSourceArr = sourceArr;

// run preMapArray if available
if (runPreMap && plugin.preMapArray) {
adjustedSourceArr = plugin.preMapArray(source, adjustedSourceArr);
}

return mapArray(
sourceArr,
adjustedSourceArr,
destination,
source,
options,
Expand Down

0 comments on commit f1f97f3

Please sign in to comment.