MCPcopy
hub / github.com/microsoft/SandDance / formatSpan

Function formatSpan

docs/app/js/sanddance-app.js:110002–110023  ·  view source on GitHub ↗
(start, stop, count, specifier)

Source from the content-addressed store, hash-verified

110000 } else return format(s);
110001 },
110002 formatSpan (start, stop, count, specifier) {
110003 specifier = (0, _d3Format.formatSpecifier)(specifier == null ? ",f" : specifier);
110004 const step = (0, _d3Array.tickStep)(start, stop, count), value = Math.max(Math.abs(start), Math.abs(stop));
110005 let precision;
110006 if (specifier.precision == null) switch(specifier.type){
110007 case "s":
110008 if (!isNaN(precision = (0, _d3Format.precisionPrefix)(step, value))) specifier.precision = precision;
110009 return formatPrefix(specifier, value);
110010 case "":
110011 case "e":
110012 case "g":
110013 case "p":
110014 case "r":
110015 if (!isNaN(precision = (0, _d3Format.precisionRound)(step, value))) specifier.precision = precision - (specifier.type === "e");
110016 break;
110017 case "f":
110018 case "%":
110019 if (!isNaN(precision = (0, _d3Format.precisionFixed)(step))) specifier.precision = precision - (specifier.type === "%") * 2;
110020 break;
110021 }
110022 return format(specifier);
110023 }
110024 };
110025}
110026let defaultNumberLocale;

Callers

nothing calls this directly

Calls 3

formatPrefixFunction · 0.70
formatFunction · 0.70
maxMethod · 0.45

Tested by

no test coverage detected