Let's you map a number from a range to another.
Current status: Alpha, API might change until 1.0.0
Returns a scaling function from an input range to an output range.
Ranges are expressed with arrays.
var scaleNumber =var scale = scaleNumbervar number =console // 150
If the value is out of the entry range, it will be mapped to the lowest or greatest value. (this behaviour might be available as an option later)
var scale = scaleNumbervar number =console // 100
This project gets its inspiration from d3 scale.
I needed this functionality as stand alone.
- linear scale
- other type of scales and options like logarithmic, discrete, rounded, etc.