Node Scaler
Simple class for scaling array of numerical values
Usage
Example
const NodeScaler = ; // define our data we want to scaleconst values = 1 2 3 4 5 6 7 8 9 10; // create new instance of NodeScaler classconst scaler = ; // scale all values between 0 and 1const scaledValues = scaler; console; // [ 0, 0.11, 0.22, 0.33, 0.44, 0.55, 0.66, 0.77, 0.88, 1 ] // unscale scaled values back to their original valueconst unscaledValues = scaledValues; console; // [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]
Methods
scaleValues
Accepts an array of numerical values and returns the following object:
unscaleValues
Method parameters:
values: number // array of scaled valuesminDomain: number // min value in domainmaxDomain: number // max value in domainoutputRangeMin: number // min output range valueoutputRangeMax: number // max output range value
Returns an array of numerical unscaled values