Skip to content

Instantly share code, notes, and snippets.

@rigao-alexandre
Last active April 13, 2024 10:55
Show Gist options
  • Select an option

  • Save rigao-alexandre/3b511f02c76bc6f7bf9938509e9ebb7d to your computer and use it in GitHub Desktop.

Select an option

Save rigao-alexandre/3b511f02c76bc6f7bf9938509e9ebb7d to your computer and use it in GitHub Desktop.

Revisions

  1. rigao-alexandre revised this gist Apr 13, 2024. 1 changed file with 876 additions and 0 deletions.
    876 changes: 876 additions & 0 deletions result.json
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,876 @@
    [
    {
    "gift": "Diamond",
    "persons": [
    "Maru",
    "Penny",
    "Evelyn",
    "Gus",
    "Jodi",
    "Krobus",
    "Marnie",
    "Willy"
    ]
    },
    {
    "gift": "Amethyst",
    "persons": [
    "Abigail",
    "Emily",
    "Clint",
    "Dwarf"
    ]
    },
    {
    "gift": "Emerald",
    "persons": [
    "Emily",
    "Penny",
    "Clint",
    "Dwarf"
    ]
    },
    {
    "gift": "Iridium Bar",
    "persons": [
    "Maru",
    "Clint",
    "Krobus",
    "Willy"
    ]
    },
    {
    "gift": "Pink Cake",
    "persons": [
    "Haley",
    "Jas",
    "Marnie",
    "Vincent"
    ]
    },
    {
    "gift": "Aquamarine",
    "persons": [
    "Emily",
    "Clint",
    "Dwarf"
    ]
    },
    {
    "gift": "Cactus Fruit",
    "persons": [
    "Sam",
    "Linus",
    "Pam"
    ]
    },
    {
    "gift": "Chocolate Cake",
    "persons": [
    "Abigail",
    "Evelyn",
    "Jodi"
    ]
    },
    {
    "gift": "Jade",
    "persons": [
    "Emily",
    "Clint",
    "Dwarf"
    ]
    },
    {
    "gift": "Pumpkin",
    "persons": [
    "Abigail",
    "Krobus",
    "Willy"
    ]
    },
    {
    "gift": "Ruby",
    "persons": [
    "Emily",
    "Clint",
    "Dwarf"
    ]
    },
    {
    "gift": "Topaz",
    "persons": [
    "Emily",
    "Clint",
    "Dwarf"
    ]
    },
    {
    "gift": "Vegetable Medley",
    "persons": [
    "Leah",
    "Jodi",
    "Lewis"
    ]
    },
    {
    "gift": "Beer",
    "persons": [
    "Shane",
    "Pam"
    ]
    },
    {
    "gift": "Coconut",
    "persons": [
    "Haley",
    "Linus"
    ]
    },
    {
    "gift": "Duck Feather",
    "persons": [
    "Elliott",
    "Leo"
    ]
    },
    {
    "gift": "Fairy Rose",
    "persons": [
    "Evelyn",
    "Jas"
    ]
    },
    {
    "gift": "Fiddlehead Risotto",
    "persons": [
    "Clint",
    "Kent"
    ]
    },
    {
    "gift": "Fish Taco",
    "persons": [
    "Caroline",
    "Gus"
    ]
    },
    {
    "gift": "Glazed Yams",
    "persons": [
    "Lewis",
    "Pam"
    ]
    },
    {
    "gift": "Goat Cheese",
    "persons": [
    "Leah",
    "Robin"
    ]
    },
    {
    "gift": "Gold Bar",
    "persons": [
    "Maru",
    "Clint"
    ]
    },
    {
    "gift": "Green Tea",
    "persons": [
    "Caroline",
    "Lewis"
    ]
    },
    {
    "gift": "Hot Pepper",
    "persons": [
    "Shane",
    "Lewis"
    ]
    },
    {
    "gift": "Mead",
    "persons": [
    "Pam",
    "Willy"
    ]
    },
    {
    "gift": "Monster Compendium",
    "persons": [
    "Abigail",
    "Krobus"
    ]
    },
    {
    "gift": "Omni Geode",
    "persons": [
    "Clint",
    "Dwarf"
    ]
    },
    {
    "gift": "Pepper Poppers",
    "persons": [
    "Shane",
    "Maru"
    ]
    },
    {
    "gift": "Pizza",
    "persons": [
    "Sam",
    "Shane"
    ]
    },
    {
    "gift": "Poppyseed Muffin",
    "persons": [
    "Leah",
    "Penny"
    ]
    },
    {
    "gift": "Rhubarb Pie",
    "persons": [
    "Maru",
    "Jodi"
    ]
    },
    {
    "gift": "Strawberry",
    "persons": [
    "Maru",
    "Demetrius"
    ]
    },
    {
    "gift": "Tom Kha Soup",
    "persons": [
    "Elliott",
    "Penny"
    ]
    },
    {
    "gift": "Tropical Curry",
    "persons": [
    "Caroline",
    "Gus"
    ]
    },
    {
    "gift": "Void Egg",
    "persons": [
    "Sebastian",
    "Krobus"
    ]
    },
    {
    "gift": "Wine",
    "persons": [
    "Harvey",
    "Leah"
    ]
    },
    {
    "gift": "Artichoke Dip",
    "persons": [
    "Clint"
    ]
    },
    {
    "gift": "Autumn's Bounty",
    "persons": [
    "Lewis"
    ]
    },
    {
    "gift": "Banana Pudding",
    "persons": [
    "Abigail"
    ]
    },
    {
    "gift": "Battery Pack",
    "persons": [
    "Maru"
    ]
    },
    {
    "gift": "Bean Hotpot",
    "persons": [
    "Demetrius"
    ]
    },
    {
    "gift": "Beet",
    "persons": [
    "Evelyn"
    ]
    },
    {
    "gift": "Blackberry Cobbler",
    "persons": [
    "Abigail"
    ]
    },
    {
    "gift": "Blueberry Tart",
    "persons": [
    "Linus"
    ]
    },
    {
    "gift": "Book of Mysteries",
    "persons": [
    "Wizard"
    ]
    },
    {
    "gift": "Catfish",
    "persons": [
    "Willy"
    ]
    },
    {
    "gift": "Cauliflower",
    "persons": [
    "Maru"
    ]
    },
    {
    "gift": "Cheese Cauliflower",
    "persons": [
    "Maru"
    ]
    },
    {
    "gift": "Cloth",
    "persons": [
    "Emily"
    ]
    },
    {
    "gift": "Coffee",
    "persons": [
    "Harvey"
    ]
    },
    {
    "gift": "Complete Breakfast",
    "persons": [
    "Alex"
    ]
    },
    {
    "gift": "Crab Cakes",
    "persons": [
    "Elliott"
    ]
    },
    {
    "gift": "Cranberry Candy",
    "persons": [
    "Vincent"
    ]
    },
    {
    "gift": "Crispy Bass",
    "persons": [
    "Jodi"
    ]
    },
    {
    "gift": "Crocus",
    "persons": [
    "Sandy"
    ]
    },
    {
    "gift": "Daffodil",
    "persons": [
    "Sandy"
    ]
    },
    {
    "gift": "Dish O' The Sea",
    "persons": [
    "Linus"
    ]
    },
    {
    "gift": "Eggplant Parmesan",
    "persons": [
    "Jodi"
    ]
    },
    {
    "gift": "Escargot",
    "persons": [
    "Gus"
    ]
    },
    {
    "gift": "Farmer's Lunch",
    "persons": [
    "Marnie"
    ]
    },
    {
    "gift": "Fried Calamari",
    "persons": [
    "Pierre"
    ]
    },
    {
    "gift": "Fried Eel",
    "persons": [
    "Jodi"
    ]
    },
    {
    "gift": "Fried Mushroom",
    "persons": [
    "George"
    ]
    },
    {
    "gift": "Frozen Tear",
    "persons": [
    "Sebastian"
    ]
    },
    {
    "gift": "Fruit Salad",
    "persons": [
    "Haley"
    ]
    },
    {
    "gift": "Ginger Ale",
    "persons": [
    "Vincent"
    ]
    },
    {
    "gift": "Grape",
    "persons": [
    "Vincent"
    ]
    },
    {
    "gift": "Ice Cream",
    "persons": [
    "Demetrius"
    ]
    },
    {
    "gift": "Jack Be Nimble, Jack Be Thick",
    "persons": [
    "Alex"
    ]
    },
    {
    "gift": "Jewels Of The Sea",
    "persons": [
    "Willy"
    ]
    },
    {
    "gift": "Lava Eel",
    "persons": [
    "Dwarf"
    ]
    },
    {
    "gift": "Leek",
    "persons": [
    "George"
    ]
    },
    {
    "gift": "Lemon Stone",
    "persons": [
    "Dwarf"
    ]
    },
    {
    "gift": "Lobster",
    "persons": [
    "Elliott"
    ]
    },
    {
    "gift": "Mango",
    "persons": [
    "Leo"
    ]
    },
    {
    "gift": "Mango Sticky Rice",
    "persons": [
    "Sandy"
    ]
    },
    {
    "gift": "Maple Bar",
    "persons": [
    "Sam"
    ]
    },
    {
    "gift": "Melon",
    "persons": [
    "Penny"
    ]
    },
    {
    "gift": "Miner's Treat",
    "persons": [
    "Maru"
    ]
    },
    {
    "gift": "Obsidian",
    "persons": [
    "Sebastian"
    ]
    },
    {
    "gift": "Octopus",
    "persons": [
    "Willy"
    ]
    },
    {
    "gift": "Orange",
    "persons": [
    "Gus"
    ]
    },
    {
    "gift": "Ostrich Egg",
    "persons": [
    "Leo"
    ]
    },
    {
    "gift": "Pale Ale",
    "persons": [
    "Pam"
    ]
    },
    {
    "gift": "Pancakes",
    "persons": [
    "Jodi"
    ]
    },
    {
    "gift": "Parsnip",
    "persons": [
    "Pam"
    ]
    },
    {
    "gift": "Parsnip Soup",
    "persons": [
    "Pam"
    ]
    },
    {
    "gift": "Peach",
    "persons": [
    "Robin"
    ]
    },
    {
    "gift": "Pickles",
    "persons": [
    "Harvey"
    ]
    },
    {
    "gift": "Piña Colada",
    "persons": [
    "Pam"
    ]
    },
    {
    "gift": "Plum Pudding",
    "persons": [
    "Jas"
    ]
    },
    {
    "gift": "Poi",
    "persons": [
    "Leo"
    ]
    },
    {
    "gift": "Pomegranate",
    "persons": [
    "Elliott"
    ]
    },
    {
    "gift": "Poppy",
    "persons": [
    "Penny"
    ]
    },
    {
    "gift": "Price Catalogue",
    "persons": [
    "Pierre"
    ]
    },
    {
    "gift": "Pufferfish",
    "persons": [
    "Abigail"
    ]
    },
    {
    "gift": "Pumpkin Pie",
    "persons": [
    "Marnie"
    ]
    },
    {
    "gift": "Pumpkin Soup",
    "persons": [
    "Sebastian"
    ]
    },
    {
    "gift": "Purple Mushroom",
    "persons": [
    "Wizard"
    ]
    },
    {
    "gift": "Radioactive Bar",
    "persons": [
    "Maru"
    ]
    },
    {
    "gift": "Raisins",
    "persons": [
    "Evelyn"
    ]
    },
    {
    "gift": "Red Plate",
    "persons": [
    "Penny"
    ]
    },
    {
    "gift": "Rice Pudding",
    "persons": [
    "Demetrius"
    ]
    },
    {
    "gift": "Roasted Hazelnuts",
    "persons": [
    "Kent"
    ]
    },
    {
    "gift": "Roots Platter",
    "persons": [
    "Penny"
    ]
    },
    {
    "gift": "Salad",
    "persons": [
    "Leah"
    ]
    },
    {
    "gift": "Salmon Dinner",
    "persons": [
    "Alex"
    ]
    },
    {
    "gift": "Sandfish",
    "persons": [
    "Penny"
    ]
    },
    {
    "gift": "Sashimi",
    "persons": [
    "Sebastian"
    ]
    },
    {
    "gift": "Sea Cucumber",
    "persons": [
    "Willy"
    ]
    },
    {
    "gift": "Snail",
    "persons": [
    "Vincent"
    ]
    },
    {
    "gift": "Solar Essence",
    "persons": [
    "Wizard"
    ]
    },
    {
    "gift": "Spaghetti",
    "persons": [
    "Robin"
    ]
    },
    {
    "gift": "Spicy Eel",
    "persons": [
    "Abigail"
    ]
    },
    {
    "gift": "Squid Ink",
    "persons": [
    "Elliott"
    ]
    },
    {
    "gift": "Stir Fry",
    "persons": [
    "Leah"
    ]
    },
    {
    "gift": "Stuffing",
    "persons": [
    "Evelyn"
    ]
    },
    {
    "gift": "Sturgeon",
    "persons": [
    "Willy"
    ]
    },
    {
    "gift": "Summer Spangle",
    "persons": [
    "Caroline"
    ]
    },
    {
    "gift": "Sunflower",
    "persons": [
    "Haley"
    ]
    },
    {
    "gift": "Super Cucumber",
    "persons": [
    "Wizard"
    ]
    },
    {
    "gift": "Super Meal",
    "persons": [
    "Harvey"
    ]
    },
    {
    "gift": "Survival Burger",
    "persons": [
    "Emily"
    ]
    },
    {
    "gift": "Sweet Pea",
    "persons": [
    "Sandy"
    ]
    },
    {
    "gift": "The Alleyway Buffet",
    "persons": [
    "Linus"
    ]
    },
    {
    "gift": "The Art O' Crabbing",
    "persons": [
    "Willy"
    ]
    },
    {
    "gift": "Tigerseye",
    "persons": [
    "Sam"
    ]
    },
    {
    "gift": "Truffle",
    "persons": [
    "Leah"
    ]
    },
    {
    "gift": "Truffle Oil",
    "persons": [
    "Harvey"
    ]
    },
    {
    "gift": "Tulip",
    "persons": [
    "Evelyn"
    ]
    },
    {
    "gift": "Void Essence",
    "persons": [
    "Wizard"
    ]
    },
    {
    "gift": "Void Mayonnaise",
    "persons": [
    "Krobus"
    ]
    },
    {
    "gift": "Wild Horseradish",
    "persons": [
    "Krobus"
    ]
    },
    {
    "gift": "Woody's Secret",
    "persons": [
    "Robin"
    ]
    },
    {
    "gift": "Wool",
    "persons": [
    "Emily"
    ]
    },
    {
    "gift": "Yam",
    "persons": [
    "Linus"
    ]
    }
    ]
  2. rigao-alexandre revised this gist Apr 13, 2024. 2 changed files with 28 additions and 6 deletions.
    21 changes: 21 additions & 0 deletions compare.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    // function compareByQuantity(left, right) {
    // return left.persons.length - right.persons.length
    // }

    // function compareByName(left, right) {
    // return left.gift.localeCompare(right.gift);
    // }

    function compare(left, right) {
    const len = right.persons.length - left.persons.length; // DESC

    if (len === 0) {
    return left.gift.localeCompare(right.gift); // ASC
    }

    return len;
    }

    const giftsByGift = Array.from(tempGiftsByGift, ([key, value]) => ({ gift: key, persons: Array.from(value) }));

    giftsByGift.sort(compare);
    13 changes: 7 additions & 6 deletions parser.js
    Original file line number Diff line number Diff line change
    @@ -10,10 +10,11 @@ for (const [person, gifts] of Object.entries(giftsByPerson)) {
    })
    }

    // const giftsByGift = Array.from(tempGiftsByGift, ([key, value]) => ({ key, value: Array.from(value) }));
    // const giftsByGift = Array.from(tempGiftsByGift);
    // const giftsByGift = Object.fromEntries(tempGiftsByGift.entries());
    const giftsByGift = Array.from(tempGiftsByGift).reduce((prev, [k, v]) => {
    return Object.assign(prev, {
    [k]: Array.from(v),
    })
    }, {})
    // const giftsByGift = Array.from(tempGiftsByGift, ([key, value]) => ({ gift: key, persons: Array.from(value) }));
    // const giftsByGift = Array.from(tempGiftsByGift).reduce((prev, [k, v]) => {
    // return Object.assign(prev, {
    // [k]: Array.from(v),
    // })
    // }, {})
  3. rigao-alexandre revised this gist Apr 13, 2024. 3 changed files with 487 additions and 0 deletions.
    468 changes: 468 additions & 0 deletions gifts-by-gift.json
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,468 @@
    {
    "Complete Breakfast": [
    "Alex"
    ],
    "Jack Be Nimble, Jack Be Thick": [
    "Alex"
    ],
    "Salmon Dinner": [
    "Alex"
    ],
    "Crab Cakes": [
    "Elliott"
    ],
    "Duck Feather": [
    "Elliott",
    "Leo"
    ],
    "Lobster": [
    "Elliott"
    ],
    "Pomegranate": [
    "Elliott"
    ],
    "Squid Ink": [
    "Elliott"
    ],
    "Tom Kha Soup": [
    "Elliott",
    "Penny"
    ],
    "Coffee": [
    "Harvey"
    ],
    "Pickles": [
    "Harvey"
    ],
    "Super Meal": [
    "Harvey"
    ],
    "Truffle Oil": [
    "Harvey"
    ],
    "Wine": [
    "Harvey",
    "Leah"
    ],
    "Cactus Fruit": [
    "Sam",
    "Linus",
    "Pam"
    ],
    "Maple Bar": [
    "Sam"
    ],
    "Pizza": [
    "Sam",
    "Shane"
    ],
    "Tigerseye": [
    "Sam"
    ],
    "Frozen Tear": [
    "Sebastian"
    ],
    "Obsidian": [
    "Sebastian"
    ],
    "Pumpkin Soup": [
    "Sebastian"
    ],
    "Sashimi": [
    "Sebastian"
    ],
    "Void Egg": [
    "Sebastian",
    "Krobus"
    ],
    "Beer": [
    "Shane",
    "Pam"
    ],
    "Hot Pepper": [
    "Shane",
    "Lewis"
    ],
    "Pepper Poppers": [
    "Shane",
    "Maru"
    ],
    "Amethyst": [
    "Abigail",
    "Emily",
    "Clint",
    "Dwarf"
    ],
    "Banana Pudding": [
    "Abigail"
    ],
    "Blackberry Cobbler": [
    "Abigail"
    ],
    "Chocolate Cake": [
    "Abigail",
    "Evelyn",
    "Jodi"
    ],
    "Monster Compendium": [
    "Abigail",
    "Krobus"
    ],
    "Pufferfish": [
    "Abigail"
    ],
    "Pumpkin": [
    "Abigail",
    "Krobus",
    "Willy"
    ],
    "Spicy Eel": [
    "Abigail"
    ],
    "Aquamarine": [
    "Emily",
    "Clint",
    "Dwarf"
    ],
    "Cloth": [
    "Emily"
    ],
    "Emerald": [
    "Emily",
    "Penny",
    "Clint",
    "Dwarf"
    ],
    "Jade": [
    "Emily",
    "Clint",
    "Dwarf"
    ],
    "Ruby": [
    "Emily",
    "Clint",
    "Dwarf"
    ],
    "Survival Burger": [
    "Emily"
    ],
    "Topaz": [
    "Emily",
    "Clint",
    "Dwarf"
    ],
    "Wool": [
    "Emily"
    ],
    "Coconut": [
    "Haley",
    "Linus"
    ],
    "Fruit Salad": [
    "Haley"
    ],
    "Pink Cake": [
    "Haley",
    "Jas",
    "Marnie",
    "Vincent"
    ],
    "Sunflower": [
    "Haley"
    ],
    "Goat Cheese": [
    "Leah",
    "Robin"
    ],
    "Poppyseed Muffin": [
    "Leah",
    "Penny"
    ],
    "Salad": [
    "Leah"
    ],
    "Stir Fry": [
    "Leah"
    ],
    "Truffle": [
    "Leah"
    ],
    "Vegetable Medley": [
    "Leah",
    "Jodi",
    "Lewis"
    ],
    "Battery Pack": [
    "Maru"
    ],
    "Cauliflower": [
    "Maru"
    ],
    "Cheese Cauliflower": [
    "Maru"
    ],
    "Diamond": [
    "Maru",
    "Penny",
    "Evelyn",
    "Gus",
    "Jodi",
    "Krobus",
    "Marnie",
    "Willy"
    ],
    "Gold Bar": [
    "Maru",
    "Clint"
    ],
    "Iridium Bar": [
    "Maru",
    "Clint",
    "Krobus",
    "Willy"
    ],
    "Miner's Treat": [
    "Maru"
    ],
    "Radioactive Bar": [
    "Maru"
    ],
    "Rhubarb Pie": [
    "Maru",
    "Jodi"
    ],
    "Strawberry": [
    "Maru",
    "Demetrius"
    ],
    "Melon": [
    "Penny"
    ],
    "Poppy": [
    "Penny"
    ],
    "Red Plate": [
    "Penny"
    ],
    "Roots Platter": [
    "Penny"
    ],
    "Sandfish": [
    "Penny"
    ],
    "Fish Taco": [
    "Caroline",
    "Gus"
    ],
    "Green Tea": [
    "Caroline",
    "Lewis"
    ],
    "Summer Spangle": [
    "Caroline"
    ],
    "Tropical Curry": [
    "Caroline",
    "Gus"
    ],
    "Artichoke Dip": [
    "Clint"
    ],
    "Fiddlehead Risotto": [
    "Clint",
    "Kent"
    ],
    "Omni Geode": [
    "Clint",
    "Dwarf"
    ],
    "Bean Hotpot": [
    "Demetrius"
    ],
    "Ice Cream": [
    "Demetrius"
    ],
    "Rice Pudding": [
    "Demetrius"
    ],
    "Lava Eel": [
    "Dwarf"
    ],
    "Lemon Stone": [
    "Dwarf"
    ],
    "Beet": [
    "Evelyn"
    ],
    "Fairy Rose": [
    "Evelyn",
    "Jas"
    ],
    "Stuffing": [
    "Evelyn"
    ],
    "Tulip": [
    "Evelyn"
    ],
    "Raisins": [
    "Evelyn"
    ],
    "Fried Mushroom": [
    "George"
    ],
    "Leek": [
    "George"
    ],
    "Escargot": [
    "Gus"
    ],
    "Orange": [
    "Gus"
    ],
    "Plum Pudding": [
    "Jas"
    ],
    "Crispy Bass": [
    "Jodi"
    ],
    "Eggplant Parmesan": [
    "Jodi"
    ],
    "Fried Eel": [
    "Jodi"
    ],
    "Pancakes": [
    "Jodi"
    ],
    "Roasted Hazelnuts": [
    "Kent"
    ],
    "Void Mayonnaise": [
    "Krobus"
    ],
    "Wild Horseradish": [
    "Krobus"
    ],
    "Mango": [
    "Leo"
    ],
    "Ostrich Egg": [
    "Leo"
    ],
    "Poi": [
    "Leo"
    ],
    "Autumn's Bounty": [
    "Lewis"
    ],
    "Glazed Yams": [
    "Lewis",
    "Pam"
    ],
    "Blueberry Tart": [
    "Linus"
    ],
    "Dish O' The Sea": [
    "Linus"
    ],
    "The Alleyway Buffet": [
    "Linus"
    ],
    "Yam": [
    "Linus"
    ],
    "Farmer's Lunch": [
    "Marnie"
    ],
    "Pumpkin Pie": [
    "Marnie"
    ],
    "Mead": [
    "Pam",
    "Willy"
    ],
    "Pale Ale": [
    "Pam"
    ],
    "Parsnip": [
    "Pam"
    ],
    "Parsnip Soup": [
    "Pam"
    ],
    "Piña Colada": [
    "Pam"
    ],
    "Fried Calamari": [
    "Pierre"
    ],
    "Price Catalogue": [
    "Pierre"
    ],
    "Peach": [
    "Robin"
    ],
    "Spaghetti": [
    "Robin"
    ],
    "Woody's Secret": [
    "Robin"
    ],
    "Crocus": [
    "Sandy"
    ],
    "Daffodil": [
    "Sandy"
    ],
    "Mango Sticky Rice": [
    "Sandy"
    ],
    "Sweet Pea": [
    "Sandy"
    ],
    "Cranberry Candy": [
    "Vincent"
    ],
    "Ginger Ale": [
    "Vincent"
    ],
    "Grape": [
    "Vincent"
    ],
    "Snail": [
    "Vincent"
    ],
    "Catfish": [
    "Willy"
    ],
    "Jewels Of The Sea": [
    "Willy"
    ],
    "Octopus": [
    "Willy"
    ],
    "Sea Cucumber": [
    "Willy"
    ],
    "Sturgeon": [
    "Willy"
    ],
    "The Art O' Crabbing": [
    "Willy"
    ],
    "Book of Mysteries": [
    "Wizard"
    ],
    "Purple Mushroom": [
    "Wizard"
    ],
    "Solar Essence": [
    "Wizard"
    ],
    "Super Cucumber": [
    "Wizard"
    ],
    "Void Essence": [
    "Wizard"
    ]
    }
    File renamed without changes.
    19 changes: 19 additions & 0 deletions parser.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    const tempGiftsByGift = new Map();

    for (const [person, gifts] of Object.entries(giftsByPerson)) {
    gifts.forEach(gift => {
    if (!tempGiftsByGift.has(gift)) {
    tempGiftsByGift.set(gift, new Set([person]))
    } else {
    tempGiftsByGift.get(gift)?.add(person)
    }
    })
    }

    // const giftsByGift = Array.from(tempGiftsByGift, ([key, value]) => ({ key, value: Array.from(value) }));
    // const giftsByGift = Object.fromEntries(tempGiftsByGift.entries());
    const giftsByGift = Array.from(tempGiftsByGift).reduce((prev, [k, v]) => {
    return Object.assign(prev, {
    [k]: Array.from(v),
    })
    }, {})
  4. rigao-alexandre created this gist Apr 13, 2024.
    264 changes: 264 additions & 0 deletions loved-gifts.json
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,264 @@
    {
    "Alex": [
    "Complete Breakfast",
    "Jack Be Nimble, Jack Be Thick",
    "Salmon Dinner"
    ],
    "Elliott": [
    "Crab Cakes",
    "Duck Feather",
    "Lobster",
    "Pomegranate",
    "Squid Ink",
    "Tom Kha Soup"
    ],
    "Harvey": [
    "Coffee",
    "Pickles",
    "Super Meal",
    "Truffle Oil",
    "Wine"
    ],
    "Sam": [
    "Cactus Fruit",
    "Maple Bar",
    "Pizza",
    "Tigerseye"
    ],
    "Sebastian": [
    "Frozen Tear",
    "Obsidian",
    "Pumpkin Soup",
    "Sashimi",
    "Void Egg"
    ],
    "Shane": [
    "Beer",
    "Hot Pepper",
    "Pepper Poppers",
    "Pizza"
    ],
    "Abigail": [
    "Amethyst",
    "Banana Pudding",
    "Blackberry Cobbler",
    "Chocolate Cake",
    "Monster Compendium",
    "Pufferfish",
    "Pumpkin",
    "Spicy Eel"
    ],
    "Emily": [
    "Amethyst",
    "Aquamarine",
    "Cloth",
    "Emerald",
    "Jade",
    "Ruby",
    "Survival Burger",
    "Topaz",
    "Wool"
    ],
    "Haley": [
    "Coconut",
    "Fruit Salad",
    "Pink Cake",
    "Sunflower"
    ],
    "Leah": [
    "Goat Cheese",
    "Poppyseed Muffin",
    "Salad",
    "Stir Fry",
    "Truffle",
    "Vegetable Medley",
    "Wine"
    ],
    "Maru": [
    "Battery Pack",
    "Cauliflower",
    "Cheese Cauliflower",
    "Diamond",
    "Gold Bar",
    "Iridium Bar",
    "Miner's Treat",
    "Pepper Poppers",
    "Radioactive Bar",
    "Rhubarb Pie",
    "Strawberry"
    ],
    "Penny": [
    "Diamond",
    "Emerald",
    "Melon",
    "Poppy",
    "Poppyseed Muffin",
    "Red Plate",
    "Roots Platter",
    "Sandfish",
    "Tom Kha Soup"
    ],
    "Caroline": [
    "Fish Taco",
    "Green Tea",
    "Summer Spangle",
    "Tropical Curry"
    ],
    "Clint": [
    "Amethyst",
    "Aquamarine",
    "Artichoke Dip",
    "Emerald",
    "Fiddlehead Risotto",
    "Gold Bar",
    "Iridium Bar",
    "Jade",
    "Omni Geode",
    "Ruby",
    "Topaz"
    ],
    "Demetrius": [
    "Bean Hotpot",
    "Ice Cream",
    "Rice Pudding",
    "Strawberry"
    ],
    "Dwarf": [
    "Amethyst",
    "Aquamarine",
    "Emerald",
    "Jade",
    "Lava Eel",
    "Lemon Stone",
    "Omni Geode",
    "Ruby",
    "Topaz"
    ],
    "Evelyn": [
    "Beet",
    "Chocolate Cake",
    "Diamond",
    "Fairy Rose",
    "Stuffing",
    "Tulip",
    "Raisins"
    ],
    "George": [
    "Fried Mushroom",
    "Leek"
    ],
    "Gus": [
    "Diamond",
    "Escargot",
    "Fish Taco",
    "Orange",
    "Tropical Curry"
    ],
    "Jas": [
    "Fairy Rose",
    "Pink Cake",
    "Plum Pudding"
    ],
    "Jodi": [
    "Chocolate Cake",
    "Crispy Bass",
    "Diamond",
    "Eggplant Parmesan",
    "Fried Eel",
    "Pancakes",
    "Rhubarb Pie",
    "Vegetable Medley"
    ],
    "Kent": [
    "Fiddlehead Risotto",
    "Roasted Hazelnuts"
    ],
    "Krobus": [
    "Diamond",
    "Iridium Bar",
    "Monster Compendium",
    "Pumpkin",
    "Void Egg",
    "Void Mayonnaise",
    "Wild Horseradish"
    ],
    "Leo": [
    "Duck Feather",
    "Mango",
    "Ostrich Egg",
    "Poi"
    ],
    "Lewis": [
    "Autumn's Bounty",
    "Glazed Yams",
    "Green Tea",
    "Hot Pepper",
    "Vegetable Medley"
    ],
    "Linus": [
    "Blueberry Tart",
    "Cactus Fruit",
    "Coconut",
    "Dish O' The Sea",
    "The Alleyway Buffet",
    "Yam"
    ],
    "Marnie": [
    "Diamond",
    "Farmer's Lunch",
    "Pink Cake",
    "Pumpkin Pie"
    ],
    "Pam": [
    "Beer",
    "Cactus Fruit",
    "Glazed Yams",
    "Mead",
    "Pale Ale",
    "Parsnip",
    "Parsnip Soup",
    "Piña Colada"
    ],
    "Pierre": [
    "Fried Calamari",
    "Price Catalogue"
    ],
    "Robin": [
    "Goat Cheese",
    "Peach",
    "Spaghetti",
    "Woody's Secret"
    ],
    "Sandy": [
    "Crocus",
    "Daffodil",
    "Mango Sticky Rice",
    "Sweet Pea"
    ],
    "Vincent": [
    "Cranberry Candy",
    "Ginger Ale",
    "Grape",
    "Pink Cake",
    "Snail"
    ],
    "Willy": [
    "Catfish",
    "Diamond",
    "Iridium Bar",
    "Jewels Of The Sea",
    "Mead",
    "Octopus",
    "Pumpkin",
    "Sea Cucumber",
    "Sturgeon",
    "The Art O' Crabbing"
    ],
    "Wizard": [
    "Book of Mysteries",
    "Purple Mushroom",
    "Solar Essence",
    "Super Cucumber",
    "Void Essence"
    ]
    }