MCPcopy Create free account
hub / github.com/scottrogowski/code2flow / makeFormatFunction

Function makeFormatFunction

tests/test_code/js/moment/moment.js:490–513  ·  view source on GitHub ↗
(format)

Source from the content-addressed store, hash-verified

488 }
489
490 function makeFormatFunction(format) {
491 var array = format.match(formattingTokens),
492 i,
493 length;
494
495 for (i = 0, length = array.length; i < length; i++) {
496 if (formatTokenFunctions[array[i]]) {
497 array[i] = formatTokenFunctions[array[i]];
498 } else {
499 array[i] = removeFormattingTokens(array[i]);
500 }
501 }
502
503 return function (mom) {
504 var output = '',
505 i;
506 for (i = 0; i < length; i++) {
507 output += isFunction(array[i])
508 ? array[i].call(mom, format)
509 : array[i];
510 }
511 return output;
512 };
513 }
514
515 // format date using native date object
516 function formatMoment(m, format) {

Callers 1

formatMomentFunction · 0.85

Calls 2

removeFormattingTokensFunction · 0.85
isFunctionFunction · 0.85

Tested by

no test coverage detected