Skip to content

Commit cc97737

Browse files
committed
Merge pull request vuejs#1135 from azamat-sharapov/currency-symbol
Currency symbol
2 parents 9e25f05 + 40282b8 commit cc97737

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,4 @@ The default task (by simply running `grunt`) will do the following: lint -> buil
8181

8282
The unit tests are written with Jasmine and run with Karma. The e2e tests are written for and run with CasperJS.
8383

84-
Note that the unit tests will automatically be run in Chrome, Firefox and Safari. If you are not on a Mac, or don't have one of the browsers installed on your system, you can modify the [karma config in gruntfile.js](https://github.com/yyx990803/vue/blob/dev/gruntfile.js#L42) to only run Karma tests in browsers that are available on your system. Just make sure don’t check in the gruntfile changes for the commit.
84+
Note that the unit tests will automatically be run in Chrome, Firefox and Safari. If you are not on a Mac, or don't have one of the browsers installed on your system, you can modify the [karma config in gruntfile.js](https://github.com/yyx990803/vue/blob/dev/gruntfile.js#L38) to only run Karma tests in browsers that are available on your system. Just make sure don’t check in the gruntfile changes for the commit.

src/filters/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ var digitsRE = /(\d{3})(?=\d)/g
6161
exports.currency = function (value, currency) {
6262
value = parseFloat(value)
6363
if (!isFinite(value) || (!value && value !== 0)) return ''
64-
currency = currency || '$'
64+
currency = currency != null ? currency : '$'
6565
var stringified = Math.abs(value).toFixed(2)
6666
var _int = stringified.slice(0, -3)
6767
var i = _int.length % 3

test/unit/specs/filters/filters_spec.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ describe('Filters', function () {
6666
expect(filter(0.76)).toBe('$0.76')
6767
// sign arg
6868
expect(filter(2134, '@')).toBe('@2,134.00')
69+
// no symbol
70+
expect(filter(2134, '')).toBe('2,134.00')
6971
// falsy, infinity and 0
7072
expect(filter(0)).toBe('$0.00')
7173
expect(filter(false)).toBe('')

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy