left_join

1.0.1 • Public • Published

Simple Left Join in JavaScript

Usage

  const customers = [
    { id: 1, name: 'Theo' }, 
    { id: 5, name: 'John'}
  ];
  const orders = [
    { customer_id: 1, order_name: 'Pepperoni Pizza', id: 1 }, 
    { customer_id: 10, order_name: 'Pasta Marinara', id: 2}
  ];
  const results = left_join(orders, customers, 'customer_id');
  /* [
    {
      customer_id: 1,
      id: 1,
      name: "Theo",
      order_name: "Pepperoni Pizza"
    },
    {
     customer_id: 10,
     id: 2, 
     order_name: 'Pasta Marinara' 
    }
  ]
 */
 console.table(results)

results via console.table

Readme

Keywords

none

Package Sidebar

Install

npm i left_join

Weekly Downloads

1

Version

1.0.1

License

ISC

Unpacked Size

31 kB

Total Files

4

Last publish

Collaborators

  • andersontr15