$ npm install json-function
import { innerJoin } from 'json-function';
const data = [
{
id: 1,
userId: 1,
title: "delectus aut autem",
},
{
id: 2,
userId: 2,
title: "quis ut nam facilis et officia qui",
}
];
const data2 = [
{
id: 1,
firstName: "John"
},
{
id: 2,
firstName: "Mike"
}
];
innerJoin(data, data2, "userId", "id");
// innerJoin([data, [otherData, [dataField, [otherDataField]]]])
[
{
id: 1,
userId: 1,
title: "delectus aut autem",
firstName: "John"
},
{
id: 2,
userId: 2,
title: "quis ut nam facilis et officia qui",
firstName: "Mike"
}
];