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

Function casing

third_party/inputmask/inputmask.js:1173–1200  ·  view source on GitHub ↗
(elem, test, pos)

Source from the content-addressed store, hash-verified

1171 }
1172 }
1173 function casing(elem, test, pos) {
1174 switch (opts.casing || test.casing) {
1175 case "upper":
1176 elem = elem.toUpperCase();
1177 break;
1178
1179 case "lower":
1180 elem = elem.toLowerCase();
1181 break;
1182
1183 case "title":
1184 var posBefore = getMaskSet().validPositions[pos - 1];
1185 if (pos === 0 || posBefore && posBefore.input === String.fromCharCode(Inputmask.keyCode.SPACE)) {
1186 elem = elem.toUpperCase();
1187 } else {
1188 elem = elem.toLowerCase();
1189 }
1190 break;
1191
1192 default:
1193 if ($.isFunction(opts.casing)) {
1194 var args = Array.prototype.slice.call(arguments);
1195 args.push(getMaskSet().validPositions);
1196 elem = opts.casing.apply(this, args);
1197 }
1198 }
1199 return elem;
1200 }
1201 function checkAlternationMatch(altArr1, altArr2, na) {
1202 var altArrC = opts.greedy ? altArr2 : altArr2.slice(0, 1), isMatch = false, naArr = na !== undefined ? na.split(",") : [], naNdx;
1203 for (var i = 0; i < naArr.length; i++) {

Callers 1

_isValidFunction · 0.85

Calls 3

getMaskSetFunction · 0.85
applyMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected