Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for linking to multiple records #5

Open
pjsier opened this issue Nov 7, 2020 · 0 comments
Open

Allow for linking to multiple records #5

pjsier opened this issue Nov 7, 2020 · 0 comments
Labels
enhancement New feature or request hacktoberfest help wanted Extra attention is needed

Comments

@pjsier
Copy link
Owner

pjsier commented Nov 7, 2020

This should be doable by updating createJoinKeyMap to generate an array of matching records instead of a single record in the call to reduce at the end:

// Create a mapping of join key values to record IDs
export const createJoinKeyMap = (records, fieldIds, caseSensitive, joinOnAll) =>
records
.map((record) =>
createJoinKeys(record, fieldIds, caseSensitive, joinOnAll).map((key) => ({
key,
record,
}))
)
.flat()
.filter(({ key }) => key.length > 0)
.reduce(
(obj, { record, key }) => ({
...obj,
[key]: record,
}),
{}
)

@pjsier pjsier added enhancement New feature or request help wanted Extra attention is needed labels Nov 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request hacktoberfest help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant