Socket
Socket
Sign inDemoInstall

inputmask

Package Overview
Dependencies
Maintainers
1
Versions
189
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

inputmask - npm Package Compare versions

Comparing version 5.0.8-beta.47 to 5.0.8-beta.70

lib/polyfills/Object.entries.js

5

bundle.js

@@ -0,1 +1,6 @@

import "./lib/polyfills/Object.getPrototypeOf";
import "./lib/polyfills/Array.includes";
import "./lib/polyfills/Object.entries";
import "./lib/polyfills/String.includes";
import "./lib/extensions/inputmask.extensions";

@@ -2,0 +7,0 @@ import "./lib/extensions/inputmask.date.extensions";

3

lib/defaults.js

@@ -82,3 +82,4 @@ import {keys} from "./keycode.js";

keys.F12,
keys.KEY_229,
keys.Process,
keys.Unidentified,
keys.Shift,

@@ -85,0 +86,0 @@ keys.Control,

import window from "./global/window";
const ua = (window.navigator && window.navigator.userAgent) || "",
ie = (ua.indexOf("MSIE ") > 0) || (ua.indexOf("Trident/") > 0),
mobile = (window.navigator && window.navigator.maxTouchPoints) || "ontouchstart" in window, //not entirely correct but will currently do
iemobile = /iemobile/i.test(ua),
iphone = /iphone/i.test(ua) && !iemobile;
ie = (ua.indexOf("MSIE ") > 0) || (ua.indexOf("Trident/") > 0),
mobile = (navigator.userAgentData && navigator.userAgentData.mobile) || (window.navigator && window.navigator.maxTouchPoints) || "ontouchstart" in window, //not entirely correct but will currently do
iphone = /iphone/i.test(ua);
export {ie, mobile, iemobile, iphone};
export {ie, mobile, iphone};

@@ -10,4 +10,4 @@ import {

} from "./positioning";
import {keyCode, keys} from "./keycode.js";
import {iemobile, iphone} from "./environment";
import {keys} from "./keycode.js";
import {iphone} from "./environment";
import {handleRemove, isComplete, isSelection, isValid} from "./validation";

@@ -95,2 +95,3 @@ import {applyInputValue, checkVal, clearOptionalTail, HandleNativePlaceholder, writeBuffer} from "./inputHandling";

inputmask.isComposing = (c == keys.Process || c == keys.Unidentified);
inputmask.ignorable = opts.ignorables.includes(c);

@@ -108,8 +109,11 @@ return EventHandlers.keypressEvent.call(this, e, checkval, writeOut, strict, ndx);

if (checkval !== true && (!(e.ctrlKey && e.altKey) && (e.ctrlKey || e.metaKey || inputmask.ignorable))) {
if (c === keys.Enter && inputmask.undoValue !== inputmask._valueGet(true)) {
inputmask.undoValue = inputmask._valueGet(true);
// e.preventDefault();
setTimeout(function () {
$input.trigger("change");
}, 0);
if (c === keys.Enter) {
if (inputmask.undoValue !== inputmask._valueGet(true)) {
inputmask.undoValue = inputmask._valueGet(true);
// e.preventDefault();
setTimeout(function () {
$input.trigger("change");
}, 0);
}
}

@@ -157,10 +161,2 @@ //inputmask.skipInputEvent = true; //skip the input as otherwise the skipped char could be picked up for validation by the inputfallback

},
keyupEvent: function (e) {
const inputmask = this.inputmask;
if (inputmask.isComposing) {
if (e.keyCode === keyCode.KEY_229 || e.key === keys.Enter)
inputmask.$el.trigger("input");
}
},
pasteEvent: function (e) {

@@ -218,14 +214,2 @@ const inputmask = this.inputmask, opts = inputmask.opts;

function ieMobileHandler(input, inputValue, caretPos) {
if (iemobile) { //iemobile just sets the character at the end althought the caret position is correctly set
var inputChar = inputValue.replace(getBuffer.call(inputmask).join(""), "");
if (inputChar.length === 1) {
var iv = inputValue.split("");
iv.splice(caretPos.begin, 0, inputChar);
inputValue = iv.join("");
}
}
return inputValue;
}
function analyseChanges(inputValue, buffer, caretPos) {

@@ -316,10 +300,7 @@ var frontPart = inputValue.substr(0, caretPos.begin).split(""),

buffer = (inputmask.isRTL ? getBuffer.call(inputmask).slice().reverse() : getBuffer.call(inputmask)).join(""),
caretPos = caret.call(inputmask, input, undefined, undefined, true);
caretPos = caret.call(inputmask, input, undefined, undefined, true),
changes;
if (buffer !== inputValue) {
inputValue = ieMobileHandler(input, inputValue, caretPos);
var changes = analyseChanges(inputValue, buffer, caretPos);
// console.log(JSON.stringify(changes));
changes = analyseChanges(inputValue, buffer, caretPos);
if ((input.inputmask.shadowRoot || input.ownerDocument).activeElement !== input) {

@@ -330,2 +311,13 @@ input.focus();

caret.call(inputmask, input, caretPos.begin, caretPos.end, true);
// Japanese IME hack #2662
if (inputmask.skipNextInsert && e.inputType === "insertText" && changes.action === "insertText" && inputmask.isComposing) {
return false;
}
if (e.inputType === "insertCompositionText" && changes.action === "insertText" && inputmask.isComposing) {
inputmask.skipNextInsert = true;
} else {
inputmask.skipNextInsert = false;
}
switch (changes.action) {

@@ -351,2 +343,3 @@ case "insertText":

applyInputValue(input, inputValue);
caret.call(inputmask, input, caretPos.begin, caretPos.end, true);
break;

@@ -358,8 +351,2 @@ }

},
compositionendEvent: function (e) {
const inputmask = this.inputmask;
inputmask.isComposing = false;
inputmask.$el.trigger("input");
},
setValueEvent: function (e) {

@@ -440,3 +427,3 @@ const inputmask = this.inputmask;

const inputmask = this.inputmask, opts = inputmask.opts, $ = inputmask.dependencyLib;
inputmask.clicked=0;
inputmask.clicked = 0;

@@ -484,3 +471,3 @@ var $input = $(this),

mouseenterEvent: function () {
const inputmask = this.inputmask, opts = inputmask.opts;
const inputmask = this.inputmask, {showMaskOnHover} = inputmask.opts;

@@ -491,6 +478,3 @@ var input = this;

var bufferTemplate = (inputmask.isRTL ? getBufferTemplate.call(inputmask).slice().reverse() : getBufferTemplate.call(inputmask)).join("");
if (inputmask.placeholder !== bufferTemplate && input.placeholder !== inputmask.originalPlaceholder) {
inputmask.originalPlaceholder = input.placeholder;
}
if (opts.showMaskOnHover) {
if (showMaskOnHover) {
HandleNativePlaceholder(input, bufferTemplate);

@@ -497,0 +481,0 @@ }

@@ -30,3 +30,3 @@ import Inputmask from "./inputmask";

case "input":
if (inputmask.skipInputEvent === true || (e.inputType && e.inputType === "insertCompositionText")) {
if (inputmask.skipInputEvent === true) {
inputmask.skipInputEvent = false;

@@ -45,8 +45,2 @@ return e.preventDefault();

break;
case "keyup":
case "compositionend":
if (inputmask.isComposing) {
inputmask.skipInputEvent = false;
}
break;
case "click":

@@ -53,0 +47,0 @@ case "focus":

@@ -583,2 +583,3 @@ /*

insertMode: false,
insertModeVisual: false,
shiftPositions: false,

@@ -585,0 +586,0 @@ keepStatic: false,

@@ -75,12 +75,11 @@ /*

//should be extended with the toplevel domains at the end
mask: function (opts) {
mask: function ({separator, quantifier}) {
var emailMask = "*{1,64}[.*{1,64}][.*{1,64}][.*{1,63}]@-{1,63}.-{1,63}[.-{1,63}][.-{1,63}]";
var mask = emailMask;
if (opts.separator) {
for (let i = 0; i < opts.quantifier; i++) {
mask += `[${opts.separator}${emailMask}]`;
if (separator) {
for (let i = 0; i < quantifier; i++) {
mask += `[${separator}${emailMask}]`;
}
}
return mask;
return opts.separator ? `${emailMask}(${opts.separator}${emailMask}){*}` : emailMask;
},

@@ -87,0 +86,0 @@ greedy: false,

@@ -7,4 +7,2 @@ /*

*/
import "./polyfills/Object.getPrototypeOf";
import "./polyfills/Array.includes";

@@ -11,0 +9,0 @@ import {mask} from "./mask";

@@ -32,3 +32,4 @@ export {keyCode, toKey, toKeyCode, keys};

"ContextMenu": 93,
"KEY_229": 229,
"Process": 229,
"Unidentified": 229,
"F1": 112,

@@ -48,3 +49,3 @@ "F2": 113,

const keyCodeRev = Object.entries(keyCode).reduce((acc, [key, value]) => (acc[value] = key, acc), {});
const keyCodeRev = Object.entries(keyCode).reduce((acc, [key, value]) => (acc[value] = acc[value] === undefined ? key : acc[value] , acc), {});
const keys = Object.entries(keyCode).reduce((acc, [key, value]) => (acc[key] = key === "Space" ? " " : key, acc), {});

@@ -51,0 +52,0 @@

@@ -11,8 +11,8 @@ import $ from "./dependencyLibs/inputmask.dependencyLib";

function preProcessMask(mask, opts) {
if (opts.repeat > 0 || opts.repeat === "*" || opts.repeat === "+") {
var repeatStart = opts.repeat === "*" ? 0 : (opts.repeat === "+" ? 1 : opts.repeat);
mask = opts.groupmarker[0] + mask + opts.groupmarker[1] + opts.quantifiermarker[0] + repeatStart + "," + opts.repeat + opts.quantifiermarker[1];
function preProcessMask(mask, {repeat, groupmarker, quantifiermarker, keepStatic}) {
if (repeat > 0 || repeat === "*" || repeat === "+") {
var repeatStart = repeat === "*" ? 0 : (repeat === "+" ? 1 : repeat);
mask = groupmarker[0] + mask + groupmarker[1] + quantifiermarker[0] + repeatStart + "," + repeat + quantifiermarker[1];
}
if (opts.keepStatic === true) {
if (keepStatic === true) {
let optionalRegex = "(.)\\[([^\\]]*)\\]", // "(?<p1>.)\\[(?<p2>[^\\]]*)\\]", remove named capture group @2428

@@ -358,13 +358,8 @@ maskMatches = mask.match(new RegExp(optionalRegex, "g"));

break;
case "(?:": //non capturing group
case "(?=": //lookahead
// openenings.push(new MaskToken(true));
break;
case "(?!": //negative lookahead
// openenings.push(new MaskToken(true));
break;
case "(?<=": //lookbehind
// openenings.push(new MaskToken(true));
break;
case "(?<!": //negative lookbehind
// openenings.push(new MaskToken(true));
// treat as group
break;

@@ -371,0 +366,0 @@ }

@@ -209,4 +209,2 @@ import {keys} from "./keycode.js";

EventRuler.on(el, "keydown", EventHandlers.keyEvent);
// EventRuler.on(el, "keypress", EventHandlers.keypressEvent);
EventRuler.on(el, "keyup", EventHandlers.keyupEvent);
}

@@ -217,3 +215,2 @@ if (mobile || opts.inputEventOnly) {

EventRuler.on(el, "input", EventHandlers.inputFallBackEvent);
EventRuler.on(el, "compositionend", EventHandlers.compositionendEvent);
// EventRuler.on(el, "beforeinput", EventHandlers.beforeInputEvent); //https://github.com/w3c/input-events - to implement

@@ -220,0 +217,0 @@ }

@@ -110,5 +110,3 @@ import {

function determineLastRequiredPosition(returnDefinition) {
const inputmask = this,
maskset = this.maskset,
$ = this.dependencyLib;
const inputmask = this, {maskset, dependencyLib: $} = inputmask;

@@ -156,5 +154,3 @@ var buffer = getMaskTemplate.call(inputmask, true, getLastValidPosition.call(inputmask), true, true),

function determineNewCaretPosition(selectedCaret, tabbed, positionCaretOnClick) {
const inputmask = this,
maskset = this.maskset,
opts = this.opts;
const inputmask = this, {maskset, opts} = inputmask;

@@ -235,3 +231,3 @@ function doRadixFocus(clickPos) {

function getBuffer(noCache) {
const inputmask = this, maskset = this.maskset;
const inputmask = this, {maskset} = inputmask;

@@ -238,0 +234,0 @@ if (maskset.buffer === undefined || noCache === true) {

@@ -322,187 +322,204 @@ export {

if (testPos > (pos + opts._maxTestPos)) {
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. " + maskset.mask;
function handleGroup() {
match = handleMatch(maskToken.matches[maskToken.matches.indexOf(match) + 1], loopNdx, quantifierRecurse);
if (match) return true;
}
if (testPos === pos && match.matches === undefined) {
matches.push({
"match": match,
"locator": loopNdx.reverse(),
"cd": cacheDependency,
"mloc": {}
});
if (match.optionality && quantifierRecurse === undefined &&
((opts.definitions && opts.definitions[match.nativeDef] && opts.definitions[match.nativeDef].optional) ||
(Inputmask.prototype.definitions[match.nativeDef] && Inputmask.prototype.definitions[match.nativeDef].optional))) { //prevent loop see #698
insertStop = true; //insert a stop
testPos = pos; //match the position after the group
} else {
return true;
function handleOptional() {
var optionalToken = match, mtchsNdx = matches.length;
match = resolveTestFromToken(match, ndxInitializer, loopNdx, quantifierRecurse);
if (matches.length > 0) { //check on matches.length instead of match to handle quantifier in a recursive call
//mark optionality in matches
matches.forEach(function (mtch, ndx) {
if (ndx >= mtchsNdx) {
mtch.match.optionality = mtch.match.optionality ? mtch.match.optionality + 1 : 1;
}
});
latestMatch = matches[matches.length - 1].match;
if (quantifierRecurse === undefined && isFirstMatch(latestMatch, optionalToken)) { //prevent loop see #698
insertStop = true; //insert a stop
testPos = pos; //match the position after the group
} else {
return match; //make the loop continue when it is deliberately by a quantifier
}
}
} else if (match.matches !== undefined) {
if (match.isGroup && quantifierRecurse !== match) { //when a group pass along to the quantifier
match = handleMatch(maskToken.matches[maskToken.matches.indexOf(match) + 1], loopNdx, quantifierRecurse);
if (match) return true;
} else if (match.isOptional) {
var optionalToken = match, mtchsNdx = matches.length;
match = resolveTestFromToken(match, ndxInitializer, loopNdx, quantifierRecurse);
if (match) {
//mark optionality in matches
matches.forEach(function (mtch, ndx) {
if (ndx >= mtchsNdx) {
mtch.match.optionality = mtch.match.optionality ? mtch.match.optionality + 1 : 1;
}
});
latestMatch = matches[matches.length - 1].match;
}
if (quantifierRecurse === undefined && isFirstMatch(latestMatch, optionalToken)) { //prevent loop see #698
insertStop = true; //insert a stop
testPos = pos; //match the position after the group
} else {
return true;
function handleAlternator() {
var alternateToken = match,
malternateMatches = [],
maltMatches,
currentMatches = matches.slice(),
loopNdxCnt = loopNdx.length,
unMatchedAlternation = false;
var altIndex = ndxInitializer.length > 0 ? ndxInitializer.shift() : -1;
if (altIndex === -1 || typeof altIndex === "string") {
var currentPos = testPos,
ndxInitializerClone = ndxInitializer.slice(),
altIndexArr = [],
amndx;
if (typeof altIndex == "string") {
altIndexArr = altIndex.split(",");
} else {
for (amndx = 0; amndx < alternateToken.matches.length; amndx++) {
altIndexArr.push(amndx.toString());
}
}
} else if (match.isAlternator) {
var alternateToken = match,
malternateMatches = [],
maltMatches,
currentMatches = matches.slice(),
loopNdxCnt = loopNdx.length,
unMatchedAlternation = false;
var altIndex = ndxInitializer.length > 0 ? ndxInitializer.shift() : -1;
if (altIndex === -1 || typeof altIndex === "string") {
var currentPos = testPos,
ndxInitializerClone = ndxInitializer.slice(),
altIndexArr = [],
amndx;
if (typeof altIndex == "string") {
altIndexArr = altIndex.split(",");
} else {
for (amndx = 0; amndx < alternateToken.matches.length; amndx++) {
altIndexArr.push(amndx.toString());
if (maskset.excludes[pos] !== undefined) {
var altIndexArrClone = altIndexArr.slice();
for (var i = 0, exl = maskset.excludes[pos].length; i < exl; i++) {
var excludeSet = maskset.excludes[pos][i].toString().split(":");
if (loopNdx.length == excludeSet[1]) {
altIndexArr.splice(altIndexArr.indexOf(excludeSet[0]), 1);
}
}
if (maskset.excludes[pos] !== undefined) {
var altIndexArrClone = altIndexArr.slice();
for (var i = 0, exl = maskset.excludes[pos].length; i < exl; i++) {
var excludeSet = maskset.excludes[pos][i].toString().split(":");
if (loopNdx.length == excludeSet[1]) {
altIndexArr.splice(altIndexArr.indexOf(excludeSet[0]), 1);
}
if (altIndexArr.length === 0) { //fully alternated => reset
delete maskset.excludes[pos];
altIndexArr = altIndexArrClone;
}
}
if (opts.keepStatic === true || (isFinite(parseInt(opts.keepStatic)) && currentPos >= opts.keepStatic)) altIndexArr = altIndexArr.slice(0, 1);
for (var ndx = 0; ndx < altIndexArr.length; ndx++) {
amndx = parseInt(altIndexArr[ndx]);
matches = [];
//set the correct ndxInitializer
ndxInitializer = typeof altIndex === "string" ? resolveNdxInitializer(testPos, amndx, loopNdxCnt) || ndxInitializerClone.slice() : ndxInitializerClone.slice();
var tokenMatch = alternateToken.matches[amndx];
if (tokenMatch && handleMatch(tokenMatch, [amndx].concat(loopNdx), quantifierRecurse)) {
match = true;
} else {
if (ndx === 0) {
unMatchedAlternation = true;
}
if (altIndexArr.length === 0) { //fully alternated => reset
delete maskset.excludes[pos];
altIndexArr = altIndexArrClone;
if (tokenMatch && tokenMatch.matches && tokenMatch.matches.length > alternateToken.matches[0].matches.length) {
break;
}
}
if (opts.keepStatic === true || (isFinite(parseInt(opts.keepStatic)) && currentPos >= opts.keepStatic)) altIndexArr = altIndexArr.slice(0, 1);
for (var ndx = 0; ndx < altIndexArr.length; ndx++) {
amndx = parseInt(altIndexArr[ndx]);
matches = [];
//set the correct ndxInitializer
ndxInitializer = typeof altIndex === "string" ? resolveNdxInitializer(testPos, amndx, loopNdxCnt) || ndxInitializerClone.slice() : ndxInitializerClone.slice();
var tokenMatch = alternateToken.matches[amndx];
if (tokenMatch && handleMatch(tokenMatch, [amndx].concat(loopNdx), quantifierRecurse)) {
match = true;
} else {
if (ndx === 0) {
unMatchedAlternation = true;
}
if (tokenMatch && tokenMatch.matches && tokenMatch.matches.length > alternateToken.matches[0].matches.length) {
break;
}
}
maltMatches = matches.slice();
testPos = currentPos;
matches = [];
maltMatches = matches.slice();
testPos = currentPos;
matches = [];
//fuzzy merge matches
for (var ndx1 = 0; ndx1 < maltMatches.length; ndx1++) {
var altMatch = maltMatches[ndx1],
dropMatch = false;
altMatch.match.jit = altMatch.match.jit || unMatchedAlternation; //mark jit when there are unmatched alternations ex: mask: "(a|aa)"
altMatch.alternation = altMatch.alternation || loopNdxCnt;
setMergeLocators(altMatch);
for (var ndx2 = 0; ndx2 < malternateMatches.length; ndx2++) {
var altMatch2 = malternateMatches[ndx2];
if (typeof altIndex !== "string" || (altMatch.alternation !== undefined && altIndexArr.includes(altMatch.locator[altMatch.alternation].toString()))) {
if (altMatch.match.nativeDef === altMatch2.match.nativeDef) {
//fuzzy merge matches
for (var ndx1 = 0; ndx1 < maltMatches.length; ndx1++) {
var altMatch = maltMatches[ndx1],
dropMatch = false;
altMatch.match.jit = altMatch.match.jit || unMatchedAlternation; //mark jit when there are unmatched alternations ex: mask: "(a|aa)"
altMatch.alternation = altMatch.alternation || loopNdxCnt;
setMergeLocators(altMatch);
for (var ndx2 = 0; ndx2 < malternateMatches.length; ndx2++) {
var altMatch2 = malternateMatches[ndx2];
if (typeof altIndex !== "string" || (altMatch.alternation !== undefined && altIndexArr.includes(altMatch.locator[altMatch.alternation].toString()))) {
if (altMatch.match.nativeDef === altMatch2.match.nativeDef) {
dropMatch = true;
setMergeLocators(altMatch2, altMatch);
break;
} else if (isSubsetOf(altMatch, altMatch2, opts)) {
if (setMergeLocators(altMatch, altMatch2)) {
dropMatch = true;
setMergeLocators(altMatch2, altMatch);
break;
} else if (isSubsetOf(altMatch, altMatch2, opts)) {
if (setMergeLocators(altMatch, altMatch2)) {
dropMatch = true;
malternateMatches.splice(malternateMatches.indexOf(altMatch2), 0, altMatch);
}
break;
} else if (isSubsetOf(altMatch2, altMatch, opts)) {
setMergeLocators(altMatch2, altMatch);
break;
} else if (staticCanMatchDefinition(altMatch, altMatch2)) {
if (!isSameLevel(altMatch, altMatch2) && el.inputmask.userOptions.keepStatic === undefined) {
opts.keepStatic = true;
} else if (setMergeLocators(altMatch, altMatch2)) {
//insert match above general match
dropMatch = true;
malternateMatches.splice(malternateMatches.indexOf(altMatch2), 0, altMatch);
}
break;
malternateMatches.splice(malternateMatches.indexOf(altMatch2), 0, altMatch);
}
break;
} else if (isSubsetOf(altMatch2, altMatch, opts)) {
setMergeLocators(altMatch2, altMatch);
break;
} else if (staticCanMatchDefinition(altMatch, altMatch2)) {
if (!isSameLevel(altMatch, altMatch2) && el.inputmask.userOptions.keepStatic === undefined) {
opts.keepStatic = true;
} else if (setMergeLocators(altMatch, altMatch2)) {
//insert match above general match
dropMatch = true;
malternateMatches.splice(malternateMatches.indexOf(altMatch2), 0, altMatch);
}
break;
}
}
if (!dropMatch) {
malternateMatches.push(altMatch);
}
}
if (!dropMatch) {
malternateMatches.push(altMatch);
}
}
}
matches = currentMatches.concat(malternateMatches);
testPos = pos;
insertStop = matches.length > 0; //insert a stopelemnt when there is an alternate - needed for non-greedy option
match = malternateMatches.length > 0; //set correct match state
matches = currentMatches.concat(malternateMatches);
testPos = pos;
insertStop = matches.length > 0; //insert a stopelemnt when there is an alternate - needed for non-greedy option
match = malternateMatches.length > 0; //set correct match state
//cloneback
ndxInitializer = ndxInitializerClone.slice();
} else {
match = handleMatch(alternateToken.matches[altIndex] || maskToken.matches[altIndex], [altIndex].concat(loopNdx), quantifierRecurse);
}
if (match) return true;
} else if (match.isQuantifier && quantifierRecurse !== maskToken.matches[maskToken.matches.indexOf(match) - 1]) {
var qt = match, breakloop = false;
for (var qndx = (ndxInitializer.length > 0) ? ndxInitializer.shift() : 0; (qndx < (isNaN(qt.quantifier.max) ? qndx + 1 : qt.quantifier.max)) && testPos <= pos; qndx++) {
var tokenGroup = maskToken.matches[maskToken.matches.indexOf(qt) - 1];
match = handleMatch(tokenGroup, [qndx].concat(loopNdx), tokenGroup); //set the tokenGroup as quantifierRecurse marker
if (match) {
matches.forEach(function (mtch, ndx) {
if (IsMatchOf(tokenGroup, mtch.match))
latestMatch = mtch.match;
else latestMatch = matches[matches.length - 1].match;
//cloneback
ndxInitializer = ndxInitializerClone.slice();
} else {
match = handleMatch(alternateToken.matches[altIndex] || maskToken.matches[altIndex], [altIndex].concat(loopNdx), quantifierRecurse);
}
if (match) return true;
}
//mark optionality
//TODO FIX RECURSIVE QUANTIFIERS
latestMatch.optionalQuantifier = qndx >= qt.quantifier.min;
// console.log(pos + " " + qt.quantifier.min + " " + latestMatch.optionalQuantifier);
//qndx + 1 as the index starts from 0
latestMatch.jit = (qndx + 1) * (tokenGroup.matches.indexOf(latestMatch) + 1) > qt.quantifier.jit;
if (latestMatch.optionalQuantifier && isFirstMatch(latestMatch, tokenGroup)) {
insertStop = true;
testPos = pos; //match the position after the group
if (opts.greedy && maskset.validPositions[pos - 1] == undefined && qndx > qt.quantifier.min && ["*", "+"].indexOf(qt.quantifier.max) != -1) {
matches.pop();
cacheDependency = undefined;
}
breakloop = true; //stop quantifierloop && search for next possible match
function handleQuantifier() {
var qt = match, breakloop = false;
for (var qndx = (ndxInitializer.length > 0) ? ndxInitializer.shift() : 0; (qndx < (isNaN(qt.quantifier.max) ? qndx + 1 : qt.quantifier.max)) && testPos <= pos; qndx++) {
var tokenGroup = maskToken.matches[maskToken.matches.indexOf(qt) - 1];
match = handleMatch(tokenGroup, [qndx].concat(loopNdx), tokenGroup); //set the tokenGroup as quantifierRecurse marker
if (match) {
matches.forEach(function (mtch, ndx) {
if (IsMatchOf(tokenGroup, mtch.match))
latestMatch = mtch.match;
else latestMatch = matches[matches.length - 1].match;
//mark optionality
//TODO FIX RECURSIVE QUANTIFIERS
latestMatch.optionalQuantifier = qndx >= qt.quantifier.min;
// console.log(pos + " " + qt.quantifier.min + " " + latestMatch.optionalQuantifier);
//qndx + 1 as the index starts from 0
latestMatch.jit = (qndx + 1) * (tokenGroup.matches.indexOf(latestMatch) + 1) > qt.quantifier.jit;
if (latestMatch.optionalQuantifier && isFirstMatch(latestMatch, tokenGroup)) {
insertStop = true;
testPos = pos; //match the position after the group
if (opts.greedy && maskset.validPositions[pos - 1] == undefined && qndx > qt.quantifier.min && ["*", "+"].indexOf(qt.quantifier.max) != -1) {
matches.pop();
cacheDependency = undefined;
}
if (!breakloop && latestMatch.jit /*&& !latestMatch.optionalQuantifier*/) {
//always set jitOffset, isvalid checks when to apply
maskset.jitOffset[pos] = tokenGroup.matches.length - tokenGroup.matches.indexOf(latestMatch);
}
});
if (breakloop) break;
return true;
}
breakloop = true; //stop quantifierloop && search for next possible match
match = false; //mark match to false to make sure the loop in optionals continues
}
if (!breakloop && latestMatch.jit /*&& !latestMatch.optionalQuantifier*/) {
//always set jitOffset, isvalid checks when to apply
maskset.jitOffset[pos] = tokenGroup.matches.length - tokenGroup.matches.indexOf(latestMatch);
}
});
if (breakloop) break; // search for next possible match
return true;
}
}
}
if (testPos > (pos + opts._maxTestPos)) {
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. " + maskset.mask;
}
if (testPos === pos && match.matches === undefined) {
matches.push({
"match": match,
"locator": loopNdx.reverse(),
"cd": cacheDependency,
"mloc": {}
});
if (match.optionality && quantifierRecurse === undefined &&
((opts.definitions && opts.definitions[match.nativeDef] && opts.definitions[match.nativeDef].optional) ||
(Inputmask.prototype.definitions[match.nativeDef] && Inputmask.prototype.definitions[match.nativeDef].optional))) { //prevent loop see #698
insertStop = true; //insert a stop
testPos = pos; //match the position after the group
} else {
return true;
}
} else if (match.matches !== undefined) {
if (match.isGroup && quantifierRecurse !== match) { //when a group pass along to the quantifier
return handleGroup();
} else if (match.isOptional) {
return handleOptional();
} else if (match.isAlternator) {
return handleAlternator();
} else if (match.isQuantifier && quantifierRecurse !== maskToken.matches[maskToken.matches.indexOf(match) - 1]) {
return handleQuantifier();
} else {
match = resolveTestFromToken(match, ndxInitializer, loopNdx, quantifierRecurse);

@@ -509,0 +526,0 @@ if (match) return true;

{
"name": "inputmask",
"version": "5.0.8-beta.47",
"version": "5.0.8-beta.70",
"description": "Inputmask is a javascript library which creates an input mask. Inputmask can run against vanilla javascript, jQuery and jqlite.",

@@ -39,12 +39,12 @@ "main": "dist/inputmask.js",

"devDependencies": {
"@babel/core": "^7.17.2",
"@babel/plugin-transform-modules-commonjs": "^7.16.8",
"@babel/preset-env": "^7.16.11",
"@babel/preset-typescript": "^7.16.7",
"@babel/core": "^7.20.5",
"@babel/plugin-transform-modules-commonjs": "^7.19.6",
"@babel/preset-env": "^7.20.2",
"@babel/preset-typescript": "^7.18.6",
"@robinherbots/grunt-available-tasks": "^0.6.4",
"@robinherbots/grunt-nuget": "^0.3.2",
"babel-loader": "^8.2.3",
"grunt": "^1.4.1",
"@robinherbots/grunt-nuget": "^0.3.3",
"babel-loader": "^9.1.0",
"grunt": "^1.5.3",
"grunt-bump": "^0.8.0",
"grunt-contrib-clean": "^2.0.0",
"grunt-contrib-clean": "^2.0.1",
"grunt-contrib-copy": "^1.0.0",

@@ -55,13 +55,13 @@ "grunt-eslint": "^24.0.0",

"grunt-webpack": "^5.0.0",
"jquery": "^3.6.0",
"karma": "^6.3.16",
"jquery": "^3.6.1",
"karma": "^6.4.1",
"karma-browserstack-launcher": "^1.6.0",
"karma-chrome-launcher": "^3.1.0",
"karma-chrome-launcher": "^3.1.1",
"karma-qunit": "^4.1.2",
"load-grunt-tasks": "^5.1.0",
"lodash": "^4.17.21",
"qunit": "^2.17.2",
"webpack": "^5.68.0",
"webpack-cli": "^4.9.2"
"qunit": "^2.19.3",
"webpack": "^5.75.0",
"webpack-cli": "^5.0.0"
}
}
# Inputmask
Copyright (c) 2010 - 2021 Robin Herbots Licensed under the MIT license (<https://opensource.org/licenses/MIT>)
Copyright (c) 2010 - 2022 Robin Herbots Licensed under the MIT license (<https://opensource.org/licenses/MIT>)

@@ -41,3 +41,3 @@ The Inputmask has a very permissive license and this will stay that way. But when you use the Inputmask in a commercial setting, be so honest to make a small donation.

<a href="https://www.jetbrains.com/?from=inputmask">
<img src="https://upload.wikimedia.org/wikipedia/commons/1/1a/JetBrains_Logo_2016.svg" alt="Jetbrains">
<img src="https://resources.jetbrains.com/storage/products/company/brand/logos/jb_beam.svg" alt="Jetbrains" width="100">
</a>

@@ -44,0 +44,0 @@

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc