tiny-math-kit
v1.0.2
Published
Basic math functions for JavaScript.
Maintainers
Readme
tiny-math-kit
A simple and lightweight JavaScript math utility library designed to provide useful and fast math helper functions for everyday development.
It is easy to install, dependency-free, and works in any Node.js project.
Installation and Usages
npm install tiny-math-kit;
---
const math = require("tiny-math-kit");
console.log(math.clamp(15, 0, 10)); // 10
console.log(math.percent(50, 200)); // 25
console.log(math.lerp(0, 100, 0.5)); // 50
console.log(math.normalize(5, 0, 10)); // 0.5
console.log(math.map(5, 0, 10, 0, 100)); // 50
console.log(math.randomRange(1, 10)); // random number