@gg-software/utils
v1.0.1
Published
GG Software utility library: lightweight, tree-shakeable helpers for strings, numbers, dates, arrays, objects, validation, async control flow, and IDs.
Readme
@gg-software/utils
Lightweight, tree-shakeable TypeScript utilities — helpers for strings, numbers, dates, arrays, objects, validation, async control flow, and IDs. Zero runtime dependencies.
Installation
pnpm add @gg-software/utils
# or: npm install @gg-software/utilsNo peer dependencies. Ships as ESM with full TypeScript types. Because every helper is individually exported, bundlers tree-shake away anything you don't import.
Usage
import { formatCurrency, slugify, groupBy, debounce } from "@gg-software/utils";
formatCurrency(1234.5, "USD"); // "$1,234.50"
slugify("Hello, World!"); // "hello-world"
groupBy(users, (u) => u.role); // { admin: [...], user: [...] }
const search = debounce((q: string) => fetchResults(q), 300);API
- String —
capitalize,truncate,slugify,camelCase,kebabCase,snakeCase,titleCase,pluralize,maskString,randomString - Number —
numberToString,formatNumber,formatCurrency,formatPercent,formatBytes,clamp,round - Date —
formatDate,formatDateRange,formatRelativeTime,parseDate,addDays,addMonths,isToday,isSameDay - Array —
groupBy,sortBy,uniqueBy,chunk,partition,range,sum,average,move - Object —
pick,omit,get,set,deepMerge,deepClone,isEmpty - Validation —
isEmail,isUrl,isPhone,isStrongPassword - Async —
debounce,throttle,sleep,retry,memoize - ID —
uuid,generateId - Misc —
cx(className builder),copyToClipboard,downloadFile,parseQueryString,buildUrl,noop
License
MIT © GG Software
