2.0.0 • Published 10 years ago
normalize-to-range v2.0.0
normalize-to-range
Normalize an array of numbers or object property values to a specified range.
Installation
$ npm install normalize-to-rangeUsage
import normalize from 'normalize-to-range';Array of numbers:
normalize([0, 1, 7, 9, 10], 0, 300);
// [0, 30, 210, 270, 300]Array of objects:
normalize([{ height: 12 }, { height: 40 }], 0, 1000, 'height');
// [{ height: 300 }, { height: 1000 }]By default normalizes between 0 and 1:
normalize([0, 1, 6, 10]);
// [0, 0.1, 0.6, 1]Standalone
Generate a standalone build in dist (for use with <script> tags and AMD module loaders):
$ npm run build:standaloneTest
Tests are done with tape by running:
$ npm test2.0.0
10 years ago
1.4.0
10 years ago
1.3.7
10 years ago
1.3.6
10 years ago
1.3.2
10 years ago
1.3.1
10 years ago
1.3.0
10 years ago
1.2.3
11 years ago
1.2.2
11 years ago
1.2.1
11 years ago
1.2.0
11 years ago
1.1.13
12 years ago
1.1.12
12 years ago
1.1.11
12 years ago
1.1.10
12 years ago
1.1.9
12 years ago
1.1.8
12 years ago
1.1.7
12 years ago
1.1.6
12 years ago
1.1.5
12 years ago
1.1.4
12 years ago
1.1.3
12 years ago
1.1.2
12 years ago
1.1.1
12 years ago
1.0.0
12 years ago