Utils
Shared TypeScript utilities for browser applications. The package focuses on value guards, formatting, locale metadata, Luxon date helpers, serialization, and small DOM/browser actions that are reused across projects.
The package is tree-shakeable and exposes named exports from the root entry point, so application code can import only the utilities it uses.
Categories
- Values — nullability, empty-value, type guard, string, and optional mapping helpers.
- Locale — language metadata for supported locales.
- Date and time — Luxon-based date, time, duration, and comparison helpers.
- Numbers — number, currency, percentage, Celsius, and Fahrenheit formatting.
- Browser and DOM — clipboard, document setup, scrolling, reload, theme, locale, and zoom helpers.
- Control flow — promise-based waiting and small function wrappers for before/after hooks.
- Serialization — string conversion helpers for primitives and selected built-in object types.
- Types — shared nullability, array, promise, and DOM target type aliases.
- Constants — typography and temperature-unit display constants.
Dependencies
luxonand@types/luxon— direct dependencies, used by the date, time, duration, and touch timing helpers. Luxon ships no types of its own, so both are needed.- Browser APIs — required by DOM-specific helpers such as
setDarkTheme,reload, anddisableZoom.
Quick example
ts
import { DateTime } from 'luxon';
import { formatDate, setWebsiteLocale } from '@almighty-shogun/utils';
setWebsiteLocale('nl');
const date = formatDate(DateTime.now(), 'nl');Continue with installation or jump to a category from the sidebar.