【文件属性】:
文件名称:ratio-to-percentages:一个非常小的NPM模块,用于将多值比率转换为百分比数组
文件大小:3KB
文件格式:ZIP
更新时间:2021-05-20 23:26:17
JavaScript
比例
一个非常小的NPM模块,用于将多值比率转换为百分比数组。
var rtp = require ( "ratio-to-percentages" ) ;
rtp ( [ 100 , 50 , 50 ] ) ;
// [ 50, 25, 25 ]
rtp ( [ 1 , 2 ] ) ;
// [ 33.33333333333333, 66.66666666666666 ]
// You can also parse in functions to be run on each value
rtp ( [ 1 , 2 ] , Math . round ) ;
// [ 33, 67 ]
rtp ( [ 1 , 2 ] , Math . floor ) ;
// [ 33, 66 ]
【文件预览】:
ratio-to-percentages-master
----.travis.yml(120B)
----index.js(418B)
----test.js(575B)
----package.json(559B)
----LICENSE(1KB)
----.gitignore(13B)
----README.md(677B)