1.0.13 β€’ Published 7 months ago

better-groupby v1.0.13

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

better-groupby 🎭

Is your JavaScript groupBy having an existential crisis about types? Does it wake you up at 3 AM screaming "undefined is not a function"? Well, throw away those anxiety meds because this TypeScript-powered groupBy is here to save your sanity!

πŸŽͺ Roll Up, Roll Up!

import { groupBy } from "better-groupby"; // Import happiness

// Your boring data (we'll fix that)
const circus = [
  { performer: "clown", skill: "juggling" },
  { performer: "acrobat", skill: "flying" },
  { performer: "clown", skill: "pratfalls" },
  { performer: "acrobat", skill: "defying death" },
];

// Group your circus performers (no animals were harmed)
const grouped = groupBy(circus, "performer");
// Look ma, no type errors! πŸŽͺ

// For the brave souls who like to live dangerously...
const circusExtravaganza = [
  { star: "Bob", act: { type: "fire-eating", danger: "very yes" } },
  { star: "Alice", act: { type: "lion-taming", danger: "much wow" } },
  { star: "Bob", act: { type: "fire-eating", danger: "still very yes" } },
];

// Group by nested properties like a coding ninja πŸ₯·
const byAct = groupBy(circusExtravaganza, (item) => item.act.type);
// TypeScript: "I got your back, fam" πŸ‘

Why This Is Better Than Your Regular groupBy

  • ✨ Type-safe: Because runtime errors are sooo 2010
  • 🎯 Precise: Like a Swiss watch, but for data grouping
  • πŸ¦Έβ€β™‚οΈ Heroic: Saves you from the villainous undefined
  • πŸ§™β€β™‚οΈ Magical: Works with nested properties without summoning demons Made with ❀️ and probably too much coffee β˜•

Warning: May cause excessive confidence in your TypeScript abilities and spontaneous high-fiving of nearby developers.

1.0.13

7 months ago

1.0.12

7 months ago

1.0.11

8 months ago

1.0.10

9 months ago

1.0.9

10 months ago

1.0.8

10 months ago

1.0.7

10 months ago

1.0.6

10 months ago

1.0.5

10 months ago

1.0.4

10 months ago

1.0.3

10 months ago

1.0.2

10 months ago

1.0.1

10 months ago

1.0.0

10 months ago