UNPKG
@paydirt/fmt
Version:
latest (0.3.1)
next (0.4.0-rc.0)
0.4.0-rc.0
0.3.1
0.3.0
0.2.2
0.2.1
0.2.1-rc.3
String formating using commonly used standards
github.com/carlcalderon/fmt
carlcalderon/fmt
@paydirt/fmt
/
lib
/
bundle
/
replacers
/
float.js
10 lines
(9 loc)
•
302 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
import
stringReplacer
from
'./string'
;
export
default
function
(
_, mods, value
) {
var
result =
String
(value);
var
sign = (mods.
sign
&& value >=
0
) ?
'+'
:
''
;
if
(mods.
precision
) { result = value.
toFixed
(mods.
precision
); }
return
stringReplacer
(
's'
, mods, sign + result); }