normie
v2.0.1
Published
normalise value between 2 ranges
Downloads
1
Readme
normie
normalise value btw 2 ranges, yay
breaking change !
if you were using v1, order of the argument changed, as V2 provide currying value and ranges have swapped
usage
normie takes up to three argument and return either a result or a normalisation function
| Name | Type | Attributes | Description | |---|---|---|---| | r1 | Array of numbers | | range of the initial value | | r2 | Array of numbers | | range of the initial scale | | value | number | optional | value to convert |
if you provide 3 argument normie will give you a normalised result
const n = require('normie')
console.log(n([-1, 1], [0,180], 0)) // will give 90
if you provide only 2 argument normie will give you a function that will take a single argument, and output a normalised value
const n = require('normie')
const toDeg = n([-1, 1], [0,180])
console.log(toDeg(0)) // will give 90