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

Function parseMask

docs/app/js/sanddance-app.js:50836–50860  ·  view source on GitHub ↗
(mask, formatChars)

Source from the content-addressed store, hash-verified

50834 "*": /[a-zA-Z0-9]/
50835};
50836function parseMask(mask, formatChars) {
50837 if (formatChars === void 0) formatChars = DEFAULT_MASK_FORMAT_CHARS;
50838 if (!mask) return [];
50839 var maskCharData = [];
50840 // Count the escape characters in the mask string.
50841 var escapedChars = 0;
50842 for(var i = 0; i + escapedChars < mask.length; i++){
50843 var maskChar = mask.charAt(i + escapedChars);
50844 if (maskChar === "\\") escapedChars++;
50845 else {
50846 // Check if the maskChar is a format character.
50847 var maskFormat = formatChars[maskChar];
50848 if (maskFormat) maskCharData.push({
50849 /**
50850 * Do not add escapedChars to the displayIndex.
50851 * The index refers to a position in the mask's displayValue.
50852 * Since the backslashes don't appear in the displayValue,
50853 * we do not add them to the charData displayIndex.
50854 */ displayIndex: i,
50855 format: maskFormat
50856 });
50857 }
50858 }
50859 return maskCharData;
50860}
50861function getMaskDisplay(mask, maskCharData, maskChar) {
50862 var maskDisplay = mask;
50863 if (!maskDisplay) return "";

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected