MCPcopy Create free account
hub / github.com/ampproject/amphtml / setMergeLocators

Function setMergeLocators

third_party/inputmask/inputmask.js:909–927  ·  view source on GitHub ↗
(targetMatch, altMatch)

Source from the content-addressed store, hash-verified

907 return canMatch;
908 }
909 function setMergeLocators(targetMatch, altMatch) {
910 if (altMatch === undefined || targetMatch.alternation === altMatch.alternation && targetMatch.locator[targetMatch.alternation].toString().indexOf(altMatch.locator[altMatch.alternation]) === -1) {
911 targetMatch.mloc = targetMatch.mloc || {};
912 var locNdx = targetMatch.locator[targetMatch.alternation];
913 if (locNdx === undefined) targetMatch.alternation = undefined; else {
914 if (typeof locNdx === "string") locNdx = locNdx.split(",")[0];
915 if (targetMatch.mloc[locNdx] === undefined) targetMatch.mloc[locNdx] = targetMatch.locator.slice();
916 if (altMatch !== undefined) {
917 for (var ndx in altMatch.mloc) {
918 if (typeof ndx === "string") ndx = ndx.split(",")[0];
919 if (targetMatch.mloc[ndx] === undefined) targetMatch.mloc[ndx] = altMatch.mloc[ndx];
920 }
921 targetMatch.locator[targetMatch.alternation] = Object.keys(targetMatch.mloc).join(",");
922 }
923 return true;
924 }
925 }
926 return false;
927 }
928 if (testPos > 500 && quantifierRecurse !== undefined) {
929 throw "Inputmask: There is probably an error in your mask definition or in the code. Create an issue on github with an example of the mask you are using. " + getMaskSet().mask;
930 }

Callers 1

handleMatchFunction · 0.85

Calls 1

toStringMethod · 0.45

Tested by

no test coverage detected