@simpill/number.utils
v1.0.0
Published
Number utilities: clamp, roundTo, toInt/Float, isInRange, lerp, sum, avg (Node and Edge).
Maintainers
Readme
Features: Type-safe · Node & Edge · Tree-shakeable · Lightweight
Installation
From npm
npm install @simpill/number.utilsFrom GitHub
To use this package from the monorepo source:
git clone https://github.com/SkinnnyJay/simpill.git
cd simpill/utils/@simpill-number.utils
npm install && npm run buildIn your project you can then install from the local path:
npm install /path/to/simpill/utils/@simpill-number.utils
or use npm link from the package directory.
Usage
import {
clamp,
roundTo,
toInt,
toFloat,
isInRange,
lerp,
sum,
avg,
isInteger,
isFiniteNumber,
randomInt,
} from "@simpill/number.utils";API Reference
- Clamp / range:
clamp,isInRange(withIsInRangeOptions) - Rounding:
roundTo - Parsing:
toInt,toFloat - Math:
lerp,sum,avg - Guards:
isInteger,isFiniteNumber - Random:
randomInt
Subpath exports: @simpill/number.utils, @simpill/number.utils/client, @simpill/number.utils/server, @simpill/number.utils/shared.
