0.0.1 • Published 8 years ago

value-map v0.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

value-map

Re-maps a number from one range to another.

Install

$ npm install value-map

Documentation

var x = valueMap(value, fromLow, fromHigh, toLow, toHigh)

Re-maps a number from one range to another. That is, a value of fromLow would get mapped to toLow, a value of fromHigh to toHigh, values in-between to values in-between, etc.

Example

var valueMap = require("value-map");

console.log(valueMap(50, 0, 256, 0, 1024));
//=> 200

console.log(valueMap(125, 400, 0, 0, 200));
//=> 137.5

License

This code is licensed under the MIT License.