Utils
A collection of 47+ small, focused, tree-shakeable utilities for dates, colors, math, DOM operations and more. Built with TypeScript-first APIs and Luxon for date handling.
Categories
- Date & time — formatting, periods, seasons, moon phases, zodiac signs
- Color — conversions between hex, RGB, HSL, HSV
- Math & numbers — formatting, rounding, step calculations, PRNG
- DOM & browser — downloads, view transitions, element checks
- Geo — hemisphere and polygon checks
- Object — prototype chain inspection, property setters
- Function — debounce, waitFor
Reference
Quick example
ts
import { formatDate, hexToRGB, mulberry32 } from '@basmilius/utils';
import { DateTime } from 'luxon';
formatDate(DateTime.now()); // localized date string
hexToRGB('#0070f3'); // [0, 112, 243]
const random = mulberry32(42); // seeded PRNG
random.next(); // deterministic 0..1 value