Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: third_party/pkg/angular/lib/formatter/number.dart

Issue 256553002: Revert "Update all Angular libs (run update_all.sh)." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 part of angular.formatter_internal;
2
3 /**
4 * Formats a number as text.
5 *
6 * If the input is not a number an empty string is returned.
7 *
8 *
9 * Usage:
10 *
11 * {{ number_expression | number[:fractionSize] }}
12 *
13 */
14 @Formatter(name:'number')
15 class Number {
16
17 var _nfs = new Map<String, Map<num, NumberFormat>>();
18
19 /**
20 * [value]: the value to format
21 *
22 * [fractionSize]: Number of decimal places to round the number to. If this
23 * is not provided then the fraction size is computed from the current
24 * locale's number formatting pattern. In the case of the default locale,
25 * it will be 3.
26 */
27 call(value, [fractionSize = null]) {
28 if (value is String) value = double.parse(value);
29 if (!(value is num)) return value;
30 if (value.isNaN) return '';
31 var verifiedLocale = Intl.verifiedLocale(Intl.getCurrentLocale(), NumberForm at.localeExists);
32 _nfs.putIfAbsent(verifiedLocale, () => new Map<num, NumberFormat>());
33 var nf = _nfs[verifiedLocale][fractionSize];
34 if (nf == null) {
35 nf = new NumberFormat()..maximumIntegerDigits = 9;
36 if (fractionSize != null) {
37 nf.minimumFractionDigits = fractionSize;
38 nf.maximumFractionDigits = fractionSize;
39 }
40 _nfs[verifiedLocale][fractionSize] = nf;
41 }
42 return nf.format(value);
43 }
44 }
OLDNEW
« no previous file with comments | « third_party/pkg/angular/lib/formatter/module_internal.dart ('k') | third_party/pkg/angular/lib/formatter/order_by.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698