File tree Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -29,16 +29,29 @@ lib.adjustFormat = function adjustFormat(formatStr) {
2929 return formatStr ;
3030} ;
3131
32- lib . noFormat = function ( value ) { return String ( value ) ; } ;
32+ var seenBadFormats = { } ;
33+ lib . warnBadFormat = function ( f ) {
34+ var key = String ( f ) ;
35+ if ( ! seenBadFormats [ key ] ) {
36+ seenBadFormats [ key ] = 1 ;
37+ lib . warn ( 'encountered bad format: "' + key + '"' ) ;
38+ }
39+ } ;
40+
41+ lib . noFormat = function ( value ) {
42+ return String ( value ) ;
43+ } ;
3344
3445lib . numberFormat = function ( formatStr ) {
46+ var fn ;
3547 try {
36- formatStr = d3Format ( lib . adjustFormat ( formatStr ) ) ;
48+ fn = d3Format ( lib . adjustFormat ( formatStr ) ) ;
3749 } catch ( e ) {
50+ lib . warnBadFormat ( formatStr ) ;
3851 return lib . noFormat ;
3952 }
4053
41- return formatStr ;
54+ return fn ;
4255} ;
4356
4457lib . nestedProperty = require ( './nested_property' ) ;
Original file line number Diff line number Diff line change @@ -709,6 +709,7 @@ function getFormatter(formatObj, separators) {
709709 Lib . adjustFormat ( formatStr )
710710 ) ;
711711 } catch ( e ) {
712+ Lib . warnBadFormat ( formatStr ) ;
712713 return Lib . noFormat ;
713714 }
714715
You can’t perform that action at this time.
0 commit comments