@talosjs/utils is a collection of tiny, single-purpose helper functions you reach for again and again: case converters, time formatters, random ID generators, a string parser, a minimal translator, and a few odds and ends. Each helper is exported from its own subpath so you only pull in what you use.
Installation
Add the package with Bun.Usage
Every helper is imported from a dedicated subpath (@talosjs/utils/<name>).
String and case helpers
Convert strings between cases, capitalize a single word, split a string into words, or trim arbitrary characters.Parsing helpers
parseString coerces a string into its natural type (number, boolean, null, array, or JSON). parseEnvVars runs the same coercion over an env object while camel-casing the keys.
Time helpers
Format durations for display, or pause an async flow withsleep.
Numbers and IDs
Format large numbers compactly and generate random identifiers (backed bynanoid).
Translations
trans resolves a dotted key from a nested dictionary, with locale fallback, pluralization (_zero / _plural), and {{ param }} interpolation. It returns a tagged result so you can branch on misses.
Browser helper
dataURLtoFile turns a base64 data URL (e.g. from a canvas or file reader) into a File instance.
What’s in the grab-bag
Most of these are the small jobs that come up everywhere. Case conversion (toCamelCase, toKebabCase, and the rest) keeps keys, slugs, identifiers, and class names consistent. parseString coerces string config or query values into real types, and parseEnvVars does the same across an env object. There are duration and large-number formatters for the UI, a quick await sleep(ms) for async flows, short URL-safe random IDs that don’t pull in a full UUID library, and a dependency-free translation lookup with plurals and interpolation instead of a heavy i18n framework.
Once you’re doing heavy text processing or full internationalization, these helpers run out, and a dedicated i18n or NLP library is the better call.