A lightweight, high-accuracy, runtime-agnostic collection of essential utilities.
Install @opentf/std using your preferred package manager:
# Bun
bun add @opentf/std
# pnpm
pnpm add @opentf/std
# npm
npm install @opentf/std
# Deno
deno add @opentf/std
# yarn
yarn add @opentf/stdBeyond the everyday helpers, @opentf/std ships capabilities you'd normally reach for a separate package to get:
import {
Decimal,
color,
colorContrast,
formatBytes,
formatCurrency,
uuidv7,
stringWidth,
} from "@opentf/std";
// 🎯 Exact decimal math — no floating-point errors
new Decimal("0.1").add("0.2").toString(); //=> "0.3"
// 🎨 Color parsing, conversion & WCAG accessibility
color("rebeccapurple", "hex"); //=> "#663399"
colorContrast("white", "black"); //=> 21 (WCAG ratio)
// 💾 Human-readable, locale-aware formatting
formatBytes(1234567); //=> "1.18 MiB"
formatCurrency(1200, "EUR", { locale: "de-DE" }); //=> "1.200,00 €"
// 🆔 Time-sortable UUID via runtime-agnostic crypto
uuidv7(); //=> "0195e2a4-8c3d-7000-…"
// 📏 Emoji & CJK aware string width (terminal-safe)
stringWidth("🔥こんにちは"); //=> 12- 🎮 Try the Interactive Playground — visualize
idleRun,paceRun,batchRun,rateLimitRun&retryRunin real time. - 🧪 Explore standout utilities:
Decimal,color,uuidv7,formatCurrency, lazyIteratorsand set math. - 📚 Browse every utility by category in the Repository Documentation (or on the Website).
This project is licensed under the MIT License.