MCPcopy Create free account
hub / github.com/feiyu563/PrometheusAlert / addFormatToken

Function addFormatToken

static/plugins/chart.js/Chart.bundle.js:15266–15286  ·  view source on GitHub ↗
(token, padded, ordinal, callback)

Source from the content-addressed store, hash-verified

15264 // ordinal: 'Mo'
15265 // callback: function () { this.month() + 1 }
15266 function addFormatToken (token, padded, ordinal, callback) {
15267 var func = callback;
15268 if (typeof callback === 'string') {
15269 func = function () {
15270 return this[callback]();
15271 };
15272 }
15273 if (token) {
15274 formatTokenFunctions[token] = func;
15275 }
15276 if (padded) {
15277 formatTokenFunctions[padded[0]] = function () {
15278 return zeroFill(func.apply(this, arguments), padded[1], padded[2]);
15279 };
15280 }
15281 if (ordinal) {
15282 formatTokenFunctions[ordinal] = function () {
15283 return this.localeData().ordinal(func.apply(this, arguments), token);
15284 };
15285 }
15286 }
15287
15288 function removeFormattingTokens(input) {
15289 if (input.match(/\[[\s\S]/)) {

Callers 4

Chart.bundle.jsFile · 0.85
meridiemFunction · 0.85
offsetFunction · 0.85
addWeekYearFormatTokenFunction · 0.85

Calls 1

zeroFillFunction · 0.85

Tested by

no test coverage detected