normie

2.0.1 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i normie

Weekly Downloads

2

Version

2.0.1

License

ISC

Unpacked Size

3.17 kB

Total Files

6

Last publish

Collaborators

  • gorhgorh