Skip to content

'Converts' a number within a range to it's corresponding value in another range.

License

Notifications You must be signed in to change notification settings

tdous/map-number-to-range

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

map-number-to-range

'Converts' a number within a range to it's corresponding value in another range.

Installing

npm install --save tdous/map-number-to-range

Usage

import { mapNumberToRange } from 'map-number-to-range';

// I have a value, 6, in a linear range of possible values from 0 to 10
const input = 6;

// I need that equivalent proportional value of a range from 100 to 200
const mappedNumber = mapNumberToRange(input, 0, 10, 100, 200);

// mappedNumber === 160

About

'Converts' a number within a range to it's corresponding value in another range.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published