parse-percentage

1.0.5 • Public • Published

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 ]

Readme

Keywords

none

Package Sidebar

Install

npm i parse-percentage

Weekly Downloads

2

Version

1.0.5

License

MIT

Unpacked Size

8.01 kB

Total Files

10

Last publish

Collaborators

  • zhso