parse-percentage
v1.0.6
Published
Convert an array of number to percentaged value.
Downloads
11
Readme
parse-percentage
Convert an array argument, percentify each value.
Examples
Basic
import percentify from 'parse-percentage';
const arr = [ 0.7, 0.15, 0.05, 0 ];
const newArr = percentify(arr);
console.log(newArr);
[ 0.78, 0.17, 0.05, 0 ]
Specify Precision
import percentify from 'parse-percentage';
const arr = [ 70, 15, 5, 0 ];
const newArr = percentify(arr, 3);
console.log(newArr);
[ 0.778, 0.167, 0.055, 0 ]