Skip to content

bengreenier/range-fit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

range-fit Build Status

given a number and two ranges, fit from one range to another. This is basically http://stackoverflow.com/questions/929103/convert-a-number-range-to-another-range-maintaining-ratio for node.

npm install range-fit

API

(value, lowerInitial, upperInitial, lowerNew, upperNew)

Given a value, within range lowerInitial-upperInitial, return a value with the same ratio, between lowerNew-upperNew. If lowerInitial-upperInitial is 0, then we return lowerNew.

Examples

var rangeFit = require('range-fit');

var twenty = rangeFit(10, 0, 100, 0, 200);

see the tests for more.

License

Licensed under the MIT License

About

given a number and two ranges, fit from one range to another

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published