normalized-number
v1.1.0
Published
Rescales a number (min-max normalization)
Downloads
5
Maintainers
Readme
normalized-number
Rescales a number (min-max normalization). Read more on wikipedia
Features
- works in browser and nodejs
- ts support
- super tiny
- dependencies free
Installation
npm i normalized-number
Usage
normalizedNumber({
sourceValue: 50,
sourceRange: [0, 100],
targetRange: [0, 1],
}); // 0.5
normalizedNumber({
sourceValue: 2,
sourceRange: [1, 3],
targetRange: [4, 6],
}); // 5
License
MIT