MCPcopy Create free account
hub / github.com/microsoft/SandDance / formatSpecifier

Function formatSpecifier

docs/app/js/sanddance-app.js:15470–15485  ·  view source on GitHub ↗
(specifier)

Source from the content-addressed store, hash-verified

15468// [[fill]align][sign][symbol][0][width][,][.precision][~][type]
15469var re = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
15470function formatSpecifier(specifier) {
15471 if (!(match = re.exec(specifier))) throw new Error("invalid format: " + specifier);
15472 var match;
15473 return new FormatSpecifier({
15474 fill: match[1],
15475 align: match[2],
15476 sign: match[3],
15477 symbol: match[4],
15478 zero: match[5],
15479 width: match[6],
15480 comma: match[7],
15481 precision: match[8] && match[8].slice(1),
15482 trim: match[9],
15483 type: match[10]
15484 });
15485}
15486exports.default = formatSpecifier;
15487formatSpecifier.prototype = FormatSpecifier.prototype; // instanceof
15488function FormatSpecifier(specifier) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected