-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
The use case is to be able to "join" the rows from a CSV to the rows from another array of objects, using a column of each collection to determine identity.
For example :
const enrichedRows = await withCSV("").columns(["id"]).leftJoin(arrayOfObjects, { on: { left: "id", right: "uid" } })
// Alternative with a callback
const enrichedRows = await withCSV("").columns(["id"]).leftJoinBy(arrayOfObjects, (row, arrayOfObjects) => {
return arrayOfObjects.find(object => object.uid === row.id)
})
// Also innerJoin and rightJoin variants====
Another use case is to be able to map the value of a column to a line from a correspondance table :
const categoryNames = {
FSN: "Fashion",
SPT: "Sport",
RCK: "Rock'n'roll baby"
}
const enrichedRows = await withCSV("").columns(["id", "name", "categoryId"]).mapKey("categoryId", categoryNames)
// Also mapKeyBy variant that takes a callbackReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels