Skip to content

Instantly share code, notes, and snippets.

View evillegas92's full-sized avatar
💭
Senior Fullstack engineer at Polestar (.Net, React, AWS, GraphQL).

Esteban Villegas evillegas92

💭
Senior Fullstack engineer at Polestar (.Net, React, AWS, GraphQL).
View GitHub Profile
// Pure addToCart() returns a new cart
// It does not mutate the original.
const addToCart = (cart, item, quantity) => {
const newCart = lodash.cloneDeep(cart);
newCart.items.push({
item,
quantity
});
return newCart;
@acgritt
acgritt / JS-LINQ.js
Created June 18, 2020 12:40 — forked from DanDiplo/JS-LINQ.js
JavaScript equivalents of some common C# LINQ methods. To help me remember!
// JS array equivalents to C# LINQ methods - by Dan B.
// Here's a simple array of "person" objects
var people = [
{ name: "John", age: 20 },
{ name: "Mary", age: 35 },
{ name: "Arthur", age: 78 },
{ name: "Mike", age: 27 },
{ name: "Judy", age: 42 },
{ name: "Tim", age: 8 }