Built and signed on GitHub ActionsBuilt and signed on GitHub Actions
Built and signed on GitHub Actions
latest
denoland/stdBasic math utilities
This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers




JSR Score
100%
Published
a month ago (0.0.0)
Math functions such as modulo and clamp.
import { clamp, modulo } from "@std/math"; import { assertEquals } from "@std/assert"; for (let n = -3; n <= 3; ++n) { const val = n * 12 + 5; // 5 o'clock is always 5 o'clock, no matter how many twelve-hour cycles you add or remove assertEquals(modulo(val, 12), 5); assertEquals(clamp(val, 0, 11), n === 0 ? 5 : n > 0 ? 11 : 0); }
Built and signed on
GitHub Actions
Add Package
deno add jsr:@std/math
Import symbol
import * as math from "@std/math";
Import directly with a jsr specifier
import * as math from "jsr:@std/math";
Add Package
pnpm i jsr:@std/math
pnpm dlx jsr add @std/math
Import symbol
import * as math from "@std/math";
Add Package
yarn add jsr:@std/math
yarn dlx jsr add @std/math
Import symbol
import * as math from "@std/math";
Add Package
vlt install jsr:@std/math
Import symbol
import * as math from "@std/math";
Add Package
npx jsr add @std/math
Import symbol
import * as math from "@std/math";
Add Package
bunx jsr add @std/math
Import symbol
import * as math from "@std/math";