1.0.1 • Published 6 years ago

left_join v1.0.1

Weekly downloads
2
License
ISC
Repository
github
Last release
6 years ago

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