Skip to main content
@gentleduck/libs

The helpers every package shares

cn(), filteredObject, groupArray, parseDate, and the other small utilities gentleduck runs on. Each helper has its own subpath.

  • cn()

    Merges class names with clsx and tailwind-merge. When Tailwind utilities conflict, the last one wins.

  • filteredObject

    Picks or omits object keys with a typed result. A typed stand-in for lodash.pick and omit.

  • groupArray

    Groups a list by key or by function and returns a record of matching items per group.

  • groupDataByNumbers

    Buckets numbers into explicit ranges. Useful for histograms, charts, and ad hoc analytics on number arrays.

  • parseDate

    Turns strings, numbers, or Date inputs into a real Date. Invalid input returns null, so you can return early.

  • Subpath imports

    Every helper has its own entry point, like @gentleduck/libs/cn or /parse-date. No framework dependencies.

Install

Import each helper from its own subpath.

  1. Install

    bun add @gentleduck/libs
  2. Import a helper

    import { cn } from '@gentleduck/libs/cn'

Free & open source

gentleduck is MIT licensed and will always be free and open source. Every package ships with full source access — fork it, modify it, own it.

Become a Sponsor