twitter_cldr_js 2.3.0 → 2.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/History.txt +4 -0
  3. data/lib/assets/javascripts/twitter_cldr/af.js +3 -1
  4. data/lib/assets/javascripts/twitter_cldr/ar.js +3 -1
  5. data/lib/assets/javascripts/twitter_cldr/be.js +3 -1
  6. data/lib/assets/javascripts/twitter_cldr/bg.js +3 -1
  7. data/lib/assets/javascripts/twitter_cldr/bn.js +3 -1
  8. data/lib/assets/javascripts/twitter_cldr/ca.js +3 -1
  9. data/lib/assets/javascripts/twitter_cldr/cs.js +3 -1
  10. data/lib/assets/javascripts/twitter_cldr/cy.js +3 -1
  11. data/lib/assets/javascripts/twitter_cldr/da.js +3 -1
  12. data/lib/assets/javascripts/twitter_cldr/de-CH.js +3 -1
  13. data/lib/assets/javascripts/twitter_cldr/de.js +3 -1
  14. data/lib/assets/javascripts/twitter_cldr/el.js +3 -1
  15. data/lib/assets/javascripts/twitter_cldr/en-150.js +3 -1
  16. data/lib/assets/javascripts/twitter_cldr/en-AU.js +3 -1
  17. data/lib/assets/javascripts/twitter_cldr/en-CA.js +3 -1
  18. data/lib/assets/javascripts/twitter_cldr/en-GB.js +3 -1
  19. data/lib/assets/javascripts/twitter_cldr/en-IE.js +3 -1
  20. data/lib/assets/javascripts/twitter_cldr/en-SG.js +3 -1
  21. data/lib/assets/javascripts/twitter_cldr/en-ZA.js +3 -1
  22. data/lib/assets/javascripts/twitter_cldr/en.js +3 -1
  23. data/lib/assets/javascripts/twitter_cldr/es-419.js +3 -1
  24. data/lib/assets/javascripts/twitter_cldr/es-CO.js +3 -1
  25. data/lib/assets/javascripts/twitter_cldr/es-MX.js +3 -1
  26. data/lib/assets/javascripts/twitter_cldr/es-US.js +3 -1
  27. data/lib/assets/javascripts/twitter_cldr/es.js +3 -1
  28. data/lib/assets/javascripts/twitter_cldr/eu.js +3 -1
  29. data/lib/assets/javascripts/twitter_cldr/fa.js +3 -1
  30. data/lib/assets/javascripts/twitter_cldr/fi.js +3 -1
  31. data/lib/assets/javascripts/twitter_cldr/fil.js +3 -1
  32. data/lib/assets/javascripts/twitter_cldr/fr-BE.js +3 -1
  33. data/lib/assets/javascripts/twitter_cldr/fr-CA.js +3 -1
  34. data/lib/assets/javascripts/twitter_cldr/fr-CH.js +3 -1
  35. data/lib/assets/javascripts/twitter_cldr/fr.js +3 -1
  36. data/lib/assets/javascripts/twitter_cldr/ga.js +3 -1
  37. data/lib/assets/javascripts/twitter_cldr/gl.js +3 -1
  38. data/lib/assets/javascripts/twitter_cldr/he.js +3 -1
  39. data/lib/assets/javascripts/twitter_cldr/hi.js +3 -1
  40. data/lib/assets/javascripts/twitter_cldr/hr.js +3 -1
  41. data/lib/assets/javascripts/twitter_cldr/hu.js +3 -1
  42. data/lib/assets/javascripts/twitter_cldr/id.js +3 -1
  43. data/lib/assets/javascripts/twitter_cldr/is.js +3 -1
  44. data/lib/assets/javascripts/twitter_cldr/it-CH.js +3 -1
  45. data/lib/assets/javascripts/twitter_cldr/it.js +3 -1
  46. data/lib/assets/javascripts/twitter_cldr/ja.js +3 -1
  47. data/lib/assets/javascripts/twitter_cldr/ko.js +3 -1
  48. data/lib/assets/javascripts/twitter_cldr/lv.js +3 -1
  49. data/lib/assets/javascripts/twitter_cldr/msa.js +3 -1
  50. data/lib/assets/javascripts/twitter_cldr/nl.js +3 -1
  51. data/lib/assets/javascripts/twitter_cldr/no.js +3 -1
  52. data/lib/assets/javascripts/twitter_cldr/pl.js +3 -1
  53. data/lib/assets/javascripts/twitter_cldr/pt.js +3 -1
  54. data/lib/assets/javascripts/twitter_cldr/ro.js +3 -1
  55. data/lib/assets/javascripts/twitter_cldr/ru.js +3 -1
  56. data/lib/assets/javascripts/twitter_cldr/sk.js +3 -1
  57. data/lib/assets/javascripts/twitter_cldr/sq.js +3 -1
  58. data/lib/assets/javascripts/twitter_cldr/sr.js +3 -1
  59. data/lib/assets/javascripts/twitter_cldr/sv.js +3 -1
  60. data/lib/assets/javascripts/twitter_cldr/ta.js +3 -1
  61. data/lib/assets/javascripts/twitter_cldr/th.js +3 -1
  62. data/lib/assets/javascripts/twitter_cldr/tr.js +3 -1
  63. data/lib/assets/javascripts/twitter_cldr/uk.js +3 -1
  64. data/lib/assets/javascripts/twitter_cldr/ur.js +3 -1
  65. data/lib/assets/javascripts/twitter_cldr/vi.js +3 -1
  66. data/lib/assets/javascripts/twitter_cldr/zh-cn.js +3 -1
  67. data/lib/assets/javascripts/twitter_cldr/zh-tw.js +3 -1
  68. data/lib/twitter_cldr/js/mustache/numbers/numbers.coffee +2 -1
  69. data/lib/twitter_cldr/js/version.rb +1 -1
  70. data/spec/js/numbers/currency.spec.js +4 -0
  71. data/spec/js/numbers/decimal.spec.js +4 -0
  72. data/spec/js/numbers/percent.spec.js +4 -0
  73. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 670b501bc9099173d458000e6b723d83fd2b1af5
4
- data.tar.gz: 095765a29f80d71b134a87c7c6be6ad1b062da5c
3
+ metadata.gz: d2635c8e25f683d6ab38279e58bafaca8ffb645c
4
+ data.tar.gz: c1234cb0eb4988d3a22057e64284b321560a2218
5
5
  SHA512:
6
- metadata.gz: 1e5a8052a20e233fdae1955e9f59031ae17009655dcd2f181fcc73cbf680bca672bd493d05cf3ea9e184fa55abf33843527e19130536f8bf2c26699e8b344f10
7
- data.tar.gz: 52f8961a8eff10a87885ac592595ace3dbde4e9bdcdd6a1e92277b4cd2349c01d26d810adb6bcac645d2322ab1ad338509b8e2c26148672cb4302c4782d4ff58
6
+ metadata.gz: d2ea718863ed95b17ef712d8fc624882dc88e19132d889efafbe15f7116a0ea822db1ac38983769aae5d32da446e4b67a830c7d46030b42f211108a2668c54bd
7
+ data.tar.gz: 688e08db84c84cc2a755a5c1d2057f5c4f8962079d60f907413334d315390b7ae73e75a926753760ea40ff46956aa651c834d2d6bc4548f98ac13c0e14db511c
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ == 2.3.1
2
+
3
+ * Fixed issue with currency formatting that ignored the precision option when set to zero.
4
+
1
5
  == 2.3.0
2
6
 
3
7
  * Fixed issue affecting additional date/time formats that was causing pattern tokens to be interpreted as plaintext.
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -916,7 +916,9 @@
916
916
  symbol: options.currency
917
917
  };
918
918
  }
919
- options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
919
+ if (options.precision == null) {
920
+ options.precision = this.defaults_for_currency(options.currency).digits;
921
+ }
920
922
  } else {
921
923
  currency = {
922
924
  symbol: this.default_currency_symbol
@@ -106,7 +106,8 @@ class TwitterCldr.CurrencyFormatter extends TwitterCldr.NumberFormatter
106
106
  else
107
107
  currency = symbol: options.currency
108
108
 
109
- options.precision ||= @defaults_for_currency(options.currency).digits
109
+ unless options.precision?
110
+ options.precision = @defaults_for_currency(options.currency).digits
110
111
  else
111
112
  currency = symbol: @default_currency_symbol
112
113
 
@@ -5,6 +5,6 @@
5
5
 
6
6
  module TwitterCldr
7
7
  module Js
8
- VERSION = "2.3.0"
8
+ VERSION = "2.3.1"
9
9
  end
10
10
  end
@@ -35,6 +35,10 @@ describe("CurrencyFormatter", function() {
35
35
  expect(formatter.format(12.345, {currency: "JPY", precision: 1})).toEqual("¥12.3");
36
36
  });
37
37
 
38
+ it("should allow a precision of zero", function() {
39
+ expect(formatter.format(12.3, {currency: "EUR", precision: 0})).toEqual("€12");
40
+ });
41
+
38
42
  it("should use the cldr_symbol for the corresponding currency code if use_cldr_code is specified", function() {
39
43
  TwitterCldr.Currencies.currencies = {
40
44
  "JPY": {symbol: "¥", cldr_symbol: "YEN", currency: "JPY", "name": "Japanese yen"}
@@ -20,5 +20,9 @@ describe("DecimalFormatter", function() {
20
20
  it("should respect the precision option", function() {
21
21
  expect(formatter.format(-12, {precision: 3})).toEqual("-12.000");
22
22
  });
23
+
24
+ it("should allow a precision of zero", function() {
25
+ expect(formatter.format(12.3, {precision: 0})).toEqual("12");
26
+ });
23
27
  });
24
28
  });
@@ -19,4 +19,8 @@ describe("PercentFormatter", function() {
19
19
  it("should respect the precision option", function() {
20
20
  expect(formatter.format(-12, {precision: 3})).toEqual("-12.000%");
21
21
  });
22
+
23
+ it("should allow a precision of zero", function() {
24
+ expect(formatter.format(12.3, {precision: 0})).toEqual("12%");
25
+ });
22
26
  });
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twitter_cldr_js
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cameron Dutro
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-10 00:00:00.000000000 Z
11
+ date: 2014-09-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json