UNPKG

480 BJavaScriptView Raw
1// default value format (apply autopadding)
2
3// format valueset
4module.exports = function formatValue(v, options, type){
5 // no autopadding ? passthrough
6 if (options.autopadding !== true){
7 return v;
8 }
9
10 // padding
11 function autopadding(value, length){
12 return (options.autopaddingChar + value).slice(-length);
13 }
14
15 switch (type){
16 case 'percentage':
17 return autopadding(v, 3);
18
19 default:
20 return v;
21 }
22}
\No newline at end of file