# @opentf/std

> The Modern JavaScript Standard Library. A lightweight, high-accuracy, runtime-agnostic collection of essential utilities.

Latest version **0.19.0** (published 2026-09-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install @opentf/std
pnpm add @opentf/std
yarn add @opentf/std
bun add @opentf/std
```

## Health

**Score 75/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score; high quality score.

Warnings: low downloads; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.19.0 |
| Published | 2026-09-11 |
| First published | 2024-03-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=20.0.0 |
| Dependencies | 0 |
| Unpacked size | 2.2 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 13 |
| Maintainers | ganapathy |
| Keywords | collection, js, ts, utils, utility, string, array, object, timers, types, is, stdlib, number, maths, sleep, clone, async, rgb, hex, shallow, deep, case, assert, replace, difference, range, sort, merge, zero, neg, intersperse |

## Links

- npm: https://www.npmjs.com/package/@opentf/std
- Repository: https://github.com/Open-Tech-Foundation/js-std
- Homepage: https://js-std.opentechf.org
- Issues: https://github.com/Open-Tech-Foundation/js-std/issues
- npm.io page: https://npm.io/package/@opentf/std

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 0.19.0 (latest) — 2026-09-11
- 1.0.0-beta.3 (beta) — 2026-05-01
- 0.18.0 — 2026-08-16
- 0.17.0 — 2026-08-12
- 0.16.0 — 2026-07-29
- 0.15.1 — 2026-07-29
- 0.15.0 — 2026-07-29
- 0.14.1 — 2026-07-24
- 0.14.0 — 2026-07-24
- 1.0.0-beta.2 — 2026-04-27
- 1.0.0-beta.1 — 2026-04-26
- 1.0.0-beta.0 — 2026-04-26
- 0.13.0 — 2024-07-08
- 0.12.0 — 2024-04-29
- 0.11.0 — 2024-04-29
- … 15 more at https://npm.io/package/@opentf/std/versions

## README

<div align="center">

# @opentf/std

**The Modern JavaScript Standard Library.**

[**Website**](https://js-std.opentechf.org) | [**Docs**](https://github.com/Open-Tech-Foundation/js-std/blob/main/packages/std/docs/README.md) | [**Playground**](https://js-std.opentechf.org/playground)

</div>

---

> *A lightweight, high-accuracy, runtime-agnostic collection of essential utilities.*

## 📦 Installation

Install `@opentf/std` using your preferred package manager:

```sh
# Bun
bun add @opentf/std

# pnpm
pnpm add @opentf/std

# npm
npm install @opentf/std

# Deno
deno add @opentf/std

# yarn
yarn add @opentf/std
```

## 🚀 Quick Start

Beyond the everyday helpers, `@opentf/std` ships capabilities you'd normally reach for a separate package to get:

```js
import {
  DateTime,
  Decimal,
  color,
  colorContrast,
  formatBytes,
  formatCurrency,
  uuidv7,
  stringWidth,
} from "@opentf/std";

// 🕒 Dates in any IANA zone — no time-zone database, no dependency
const t = new DateTime("2026-03-07T12:00", { timeZone: "America/New_York" });
t.add({ days: 1 }).format("HH:mm ZZ"); //=> "12:00 -04:00"  DST-safe: 23 real hours
t.withTimeZone("Asia/Kolkata").format("EEE d MMM, HH:mm"); //=> "Sat 7 Mar, 22:30"
new DateTime("2028-02-10").endOf("month"); //=> 2028-02-29  leap-year aware

// 🎯 Exact decimal math — no floating-point errors
new Decimal("0.1").add("0.2").toString(); //=> "0.3"

// 🎨 Color parsing, conversion & WCAG accessibility
color({ value: "rebeccapurple", to: "hex" }); //=> "#663399"
colorContrast({ color1: "white", color2: "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
```

## 👉 Next Steps

- 🎮 Try the [Interactive Playground](https://js-std.opentechf.org/playground) — visualize `idleRun`, `paceRun`, `batchRun`, `rateLimitRun` & `retryRun` in real time.
- 🧪 Explore standout utilities: [`DateTime`](https://js-std.opentechf.org/docs/DateTime/DateTime), [`Decimal`](https://js-std.opentechf.org/docs/Maths/Decimal), [`color`](https://js-std.opentechf.org/docs/Colors/color), [`uuidv7`](https://js-std.opentechf.org/docs/Crypto/uuidv7), [`formatCurrency`](https://js-std.opentechf.org/docs/Number/formatCurrency), lazy [`Iterators`](https://js-std.opentechf.org/docs/Iter/mapIter) and [set math](https://js-std.opentechf.org/docs/Maths/isSubsetOf).
- 📚 Browse every utility by category in the [Repository Documentation](https://github.com/Open-Tech-Foundation/js-std/blob/main/packages/std/docs/README.md) (or on the [Website](https://js-std.opentechf.org)).

---

## 📄 License

This project is licensed under the [MIT License](./LICENSE).

---
_Source: https://npm.io/package/@opentf/std · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
