@lukethegenius/toolkit
v0.1.0
Published
Grab-bag of generic utilities: number/date formatting, calendar helpers, CSV export, avatar initials, pagination, in-memory rate limiting, social URL/handle parsing, iTunes cover lookup, Google Sheets export, Next.js API error helpers.
Readme
@lukethegenius/toolkit
Grab-bag of generic, dependency-light utilities: number/date formatting, calendar helpers, CSV export, avatar initials, pagination, in-memory rate limiting, social URL/handle parsing, iTunes cover lookup, Google Sheets export, and Next.js API error helpers.
Install
npm install @lukethegenius/toolkitUsage
import {
formatCompactNumber, monthKey, startOfWeek, addDays, downloadCSV, initialsOf,
fetchAllPaginated, checkRateLimit, extractHandle, normalizeHandle,
findItunesCover, createSheetWithRows, err400, err401, err403, zodError,
} from '@lukethegenius/toolkit'
formatCompactNumber(12500) // "12,5k"
checkRateLimit('user:123', 30, 60_000) // { allowed, remaining, retryAfterSec }
extractHandle('https://www.tiktok.com/@user') // { platform: 'tiktok', handle: 'user', isShortLink: false }err400/err401/err403/zodError return NextResponse (Next.js API routes). createSheetWithRows requires a Google OAuth access token with Sheets scope.
