2.0.1 • Published 5 years ago

normie v2.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
5 years ago

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

NameTypeAttributesDescription
r1Array of numbersrange of the initial value
r2Array of numbersrange of the initial scale
valuenumberoptionalvalue 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
2.0.1

5 years ago

2.0.0

5 years ago

1.0.1

7 years ago

1.0.0

7 years ago