Skip to content

Pre-Release: Adding a merger function for merge type joins

Pre-release
Pre-release

Choose a tag to compare

@mtraynham mtraynham released this 17 Jul 01:55
· 71 commits to master since this release

The merger function offers an alternative to handling merge type joins (outer/inner/left-outer/right-outer). Instead of using lodash's _.assign to create a new row, users can now provide a function that will create a merged row.

function defaultMerger (left: LeftType, right: RightType): LeftType & RightType {
     return Object.assign({}, left, right);
}

function leftRightMerger (left: LeftType, right: RightType): {left: LeftType, right: RightType} {
     return {left, right};
}

The merge function will be called for all records of the output array, including rows that are not merged. In those cases, either the left or right record will be null.