Skip to content

Convert an array argument, percentify each value.

License

Notifications You must be signed in to change notification settings

Envisio/parse-percentage

Repository files navigation

parse-percentage

Convert an array argument, percentify each value.

bitHound Overall Score Inline docs Build Status Coverage Status

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 ]

About

Convert an array argument, percentify each value.

Resources

License

Stars

Watchers

Forks

Packages

No packages published