Node.js object array data joins
===

Are there any libraries or efficient techniques to perform array joins in node JS such that,

    A = [ { a: 1, b: 'a' }, { a: 2, b:'b' }, { a: 3, b: 'a' }, { a: 4, b: 'b' } ]
    B = [ { a: 1, c: true }, { a: 2, c: true }, { a: 3, c: false } ]

could be joined such that the following results could be produced:

    # Intersection on a
    C = [ { a: 1, b: 'a', c: true }, { a: 2, b: 'b', c: true }, { a: 3, b: 'a', c: false } ]

    # Union on a
    D = [ { a: 1, b: 'a', c: true }, { a: 2, b: 'b', c: true }, { a: 3, b: 'a', c: false }, { a: 4, b: 'b' } ]


Is array.map the best solution to this problem?


efficiency is paramount here, since it could be handling huge arrays in production