File tree Expand file tree Collapse file tree 2 files changed +3
-1
lines changed Expand file tree Collapse file tree 2 files changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ var digitsRE = /(\d{3})(?=\d)/g
61
61
exports . currency = function ( value , currency ) {
62
62
value = parseFloat ( value )
63
63
if ( ! isFinite ( value ) || ( ! value && value !== 0 ) ) return ''
64
- currency = currency || '$'
64
+ currency = currency != null ? currency : '$'
65
65
var stringified = Math . abs ( value ) . toFixed ( 2 )
66
66
var _int = stringified . slice ( 0 , - 3 )
67
67
var i = _int . length % 3
Original file line number Diff line number Diff line change @@ -66,6 +66,8 @@ describe('Filters', function () {
66
66
expect ( filter ( 0.76 ) ) . toBe ( '$0.76' )
67
67
// sign arg
68
68
expect ( filter ( 2134 , '@' ) ) . toBe ( '@2,134.00' )
69
+ // no symbol
70
+ expect ( filter ( 2134 , '' ) ) . toBe ( '2,134.00' )
69
71
// falsy, infinity and 0
70
72
expect ( filter ( 0 ) ) . toBe ( '$0.00' )
71
73
expect ( filter ( false ) ) . toBe ( '' )
You can’t perform that action at this time.
0 commit comments