Skip to main content

Built and signed on GitHub Actions

A collection of utility functions

This package works with Bun, Cloudflare Workers, Node.js, Deno, Browsers
JSR Score
88%
Published
4 months ago (0.2.2)
function number.clamp

Examples

Example 1

clamp(5, 1, 10); // 5
clamp(0, 1, 10); // 1
clamp(15, 1, 10); // 10

Parameters

Return Type

the clamped number

Add Package

deno add @modules/utils

Import symbol

import { number } from "@modules/utils";
const { clamp } = number;

Add Package

npx jsr add @modules/utils

Import symbol

import { number } from "@modules/utils";
const { clamp } = number;

Add Package

yarn dlx jsr add @modules/utils

Import symbol

import { number } from "@modules/utils";
const { clamp } = number;

Add Package

pnpm dlx jsr add @modules/utils

Import symbol

import { number } from "@modules/utils";
const { clamp } = number;

Add Package

bunx jsr add @modules/utils

Import symbol

import { number } from "@modules/utils";
const { clamp } = number;