Browse Source

enhance unmasking fix #786

Robin Herbots 10 years ago
parent
commit
d558785fc4

+ 6 - 2
.eslintrc

@@ -1,7 +1,8 @@
 {
   "rules": {
     "consistent-return": [1],
-    "curly": [1, "multi"],
+    "curly": [2, "multi-line"],
+    "eol-last": [0],
     "eqeqeq": [2, "smart"],
     "indent": [
       1,
@@ -19,7 +20,10 @@
     "no-empty": [0],
     "no-loop-func": [0],
     "no-underscore-dangle": [0],
-    "no-unused-vars": [1],
+    "no-unused-vars": [2, {
+      "vars": "all",
+      "args": "none"
+    }],
     "no-use-before-define": [
       2,
       "nofunc"

+ 1 - 1
bower.json

@@ -1,6 +1,6 @@
 {
   "name": "jquery.inputmask",
-  "version": "3.1.64-150",
+  "version": "3.1.64-153",
   "main": [
     "./dist/inputmask/jquery.inputmask.js",
     "./dist/inputmask/inputmask.js",

+ 1 - 1
component.json

@@ -2,7 +2,7 @@
     "name": "jquery_inputmask",
     "repository": "robinherbots/jquery.inputmask",
     "description": "jquery.inputmask is a jquery plugin which create an input mask.",
-    "version": "3.1.64-150",
+    "version": "3.1.64-153",
     "keywords": [ "jquery", "plugins", "input", "form", "inputmask", "mask" ],
     "main": "./dist/jquery.inputmask.bundle.js",
     "scripts": [

+ 1 - 1
composer.json

@@ -1,7 +1,7 @@
 {
     "name": "robinherbots/jquery.inputmask",
     "description": "jquery.inputmask is a jquery plugin which create an input mask.",
-	"version": "3.1.64-150",
+	"version": "3.1.64-153",
     "type": "library",
     "keywords": ["jquery", "plugins", "input", "form", "inputmask", "mask"],
     "homepage": "http://robinherbots.github.io/jquery.inputmask",

+ 18 - 18
dist/inputmask/inputmask.date.extensions.js

@@ -3,7 +3,7 @@
 * http://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2015 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.1.64-150
+* Version: 3.1.64-153
 */
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "jquery", "./inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery"), require("./inputmask")) : factory(jQuery);
@@ -94,14 +94,14 @@
             },
             onKeyDown: function(e, buffer, caretPos, opts) {
                 var $input = $(this);
-                if (e.ctrlKey && e.keyCode == Inputmask.keyCode.RIGHT) {
+                if (e.ctrlKey && e.keyCode === Inputmask.keyCode.RIGHT) {
                     var today = new Date();
                     $input.val(today.getDate().toString() + (today.getMonth() + 1).toString() + today.getFullYear().toString()), 
                     $input.triggerHandler("setvalue.inputmask");
                 }
             },
             getFrontValue: function(mask, buffer, opts) {
-                for (var start = 0, length = 0, i = 0; i < mask.length && "2" != mask.charAt(i); i++) {
+                for (var start = 0, length = 0, i = 0; i < mask.length && "2" !== mask.charAt(i); i++) {
                     var definition = opts.definitions[mask.charAt(i)];
                     definition ? (start += length, length = definition.cardinality) : length++;
                 }
@@ -111,7 +111,7 @@
                 "1": {
                     validator: function(chrs, maskset, pos, strict, opts) {
                         var isValid = opts.regex.val1.test(chrs);
-                        return strict || isValid || chrs.charAt(1) != opts.separator && -1 == "-./".indexOf(chrs.charAt(1)) || !(isValid = opts.regex.val1.test("0" + chrs.charAt(0))) ? isValid : (maskset.buffer[pos - 1] = "0", 
+                        return strict || isValid || chrs.charAt(1) !== opts.separator && -1 === "-./".indexOf(chrs.charAt(1)) || !(isValid = opts.regex.val1.test("0" + chrs.charAt(0))) ? isValid : (maskset.buffer[pos - 1] = "0", 
                         {
                             refreshFromBuffer: {
                                 start: pos - 1,
@@ -126,7 +126,7 @@
                         validator: function(chrs, maskset, pos, strict, opts) {
                             var pchrs = chrs;
                             isNaN(maskset.buffer[pos + 1]) || (pchrs += maskset.buffer[pos + 1]);
-                            var isValid = 1 == pchrs.length ? opts.regex.val1pre.test(pchrs) : opts.regex.val1.test(pchrs);
+                            var isValid = 1 === pchrs.length ? opts.regex.val1pre.test(pchrs) : opts.regex.val1.test(pchrs);
                             if (!strict && !isValid) {
                                 if (isValid = opts.regex.val1.test(chrs + "0")) return maskset.buffer[pos] = chrs, 
                                 maskset.buffer[++pos] = "0", {
@@ -146,9 +146,9 @@
                 "2": {
                     validator: function(chrs, maskset, pos, strict, opts) {
                         var frontValue = opts.getFrontValue(maskset.mask, maskset.buffer, opts);
-                        -1 != frontValue.indexOf(opts.placeholder[0]) && (frontValue = "01" + opts.separator);
+                        -1 !== frontValue.indexOf(opts.placeholder[0]) && (frontValue = "01" + opts.separator);
                         var isValid = opts.regex.val2(opts.separator).test(frontValue + chrs);
-                        if (!strict && !isValid && (chrs.charAt(1) == opts.separator || -1 != "-./".indexOf(chrs.charAt(1))) && (isValid = opts.regex.val2(opts.separator).test(frontValue + "0" + chrs.charAt(0)))) return maskset.buffer[pos - 1] = "0", 
+                        if (!strict && !isValid && (chrs.charAt(1) === opts.separator || -1 !== "-./".indexOf(chrs.charAt(1))) && (isValid = opts.regex.val2(opts.separator).test(frontValue + "0" + chrs.charAt(0)))) return maskset.buffer[pos - 1] = "0", 
                         {
                             refreshFromBuffer: {
                                 start: pos - 1,
@@ -157,9 +157,9 @@
                             pos: pos,
                             c: chrs.charAt(0)
                         };
-                        if (opts.mask.indexOf("2") == opts.mask.length - 1 && isValid) {
+                        if (opts.mask.indexOf("2") === opts.mask.length - 1 && isValid) {
                             var dayMonthValue = maskset.buffer.join("").substr(4, 4) + chrs;
-                            if (dayMonthValue != opts.leapday) return !0;
+                            if (dayMonthValue !== opts.leapday) return !0;
                             var year = parseInt(maskset.buffer.join("").substr(0, 4), 10);
                             return year % 4 === 0 ? year % 100 === 0 ? year % 400 === 0 ? !0 : !1 : !0 : !1;
                         }
@@ -170,8 +170,8 @@
                         validator: function(chrs, maskset, pos, strict, opts) {
                             isNaN(maskset.buffer[pos + 1]) || (chrs += maskset.buffer[pos + 1]);
                             var frontValue = opts.getFrontValue(maskset.mask, maskset.buffer, opts);
-                            -1 != frontValue.indexOf(opts.placeholder[0]) && (frontValue = "01" + opts.separator);
-                            var isValid = 1 == chrs.length ? opts.regex.val2pre(opts.separator).test(frontValue + chrs) : opts.regex.val2(opts.separator).test(frontValue + chrs);
+                            -1 !== frontValue.indexOf(opts.placeholder[0]) && (frontValue = "01" + opts.separator);
+                            var isValid = 1 === chrs.length ? opts.regex.val2pre(opts.separator).test(frontValue + chrs) : opts.regex.val2(opts.separator).test(frontValue + chrs);
                             return strict || isValid || !(isValid = opts.regex.val2(opts.separator).test(frontValue + "0" + chrs)) ? isValid : (maskset.buffer[pos] = "0", 
                             pos++, {
                                 pos: pos
@@ -184,7 +184,7 @@
                     validator: function(chrs, maskset, pos, strict, opts) {
                         if (opts.isInYearRange(chrs, opts.yearrange.minyear, opts.yearrange.maxyear)) {
                             var dayMonthValue = maskset.buffer.join("").substr(0, 6);
-                            if (dayMonthValue != opts.leapday) return !0;
+                            if (dayMonthValue !== opts.leapday) return !0;
                             var year = parseInt(chrs, 10);
                             return year % 4 === 0 ? year % 100 === 0 ? year % 400 === 0 ? !0 : !1 : !0 : !1;
                         }
@@ -221,7 +221,7 @@
                                 if (yearPrefix = opts.determinebaseyear(opts.yearrange.minyear, opts.yearrange.maxyear, chrs).toString().slice(0, 2), 
                                 opts.isInYearRange(yearPrefix + chrs, opts.yearrange.minyear, opts.yearrange.maxyear)) {
                                     var dayMonthValue = maskset.buffer.join("").substr(0, 6);
-                                    if (dayMonthValue != opts.leapday) isValid = !0; else {
+                                    if (dayMonthValue !== opts.leapday) isValid = !0; else {
                                         var year = parseInt(chrs, 10);
                                         isValid = year % 4 === 0 ? year % 100 === 0 ? year % 400 === 0 ? !0 : !1 : !0 : !1;
                                     }
@@ -267,7 +267,7 @@
             leapday: "02/29/",
             onKeyDown: function(e, buffer, caretPos, opts) {
                 var $input = $(this);
-                if (e.ctrlKey && e.keyCode == Inputmask.keyCode.RIGHT) {
+                if (e.ctrlKey && e.keyCode === Inputmask.keyCode.RIGHT) {
                     var today = new Date();
                     $input.val((today.getMonth() + 1).toString() + today.getDate().toString() + today.getFullYear().toString()), 
                     $input.triggerHandler("setvalue.inputmask");
@@ -281,7 +281,7 @@
             leapday: "/02/29",
             onKeyDown: function(e, buffer, caretPos, opts) {
                 var $input = $(this);
-                if (e.ctrlKey && e.keyCode == Inputmask.keyCode.RIGHT) {
+                if (e.ctrlKey && e.keyCode === Inputmask.keyCode.RIGHT) {
                     var today = new Date();
                     $input.val(today.getFullYear().toString() + (today.getMonth() + 1).toString() + today.getDate().toString()), 
                     $input.triggerHandler("setvalue.inputmask");
@@ -347,7 +347,7 @@
             definitions: {
                 h: {
                     validator: function(chrs, maskset, pos, strict, opts) {
-                        if ("24" == opts.hourFormat && 24 == parseInt(chrs, 10)) return maskset.buffer[pos - 1] = "0", 
+                        if ("24" === opts.hourFormat && 24 === parseInt(chrs, 10)) return maskset.buffer[pos - 1] = "0", 
                         maskset.buffer[pos] = "0", {
                             refreshFromBuffer: {
                                 start: pos - 1,
@@ -356,7 +356,7 @@
                             c: "0"
                         };
                         var isValid = opts.regex.hrs.test(chrs);
-                        if (!strict && !isValid && (chrs.charAt(1) == opts.timeseparator || -1 != "-.:".indexOf(chrs.charAt(1))) && (isValid = opts.regex.hrs.test("0" + chrs.charAt(0)))) return maskset.buffer[pos - 1] = "0", 
+                        if (!strict && !isValid && (chrs.charAt(1) === opts.timeseparator || -1 !== "-.:".indexOf(chrs.charAt(1))) && (isValid = opts.regex.hrs.test("0" + chrs.charAt(0)))) return maskset.buffer[pos - 1] = "0", 
                         maskset.buffer[pos] = chrs.charAt(0), pos++, {
                             refreshFromBuffer: {
                                 start: pos - 2,
@@ -367,7 +367,7 @@
                         };
                         if (isValid && "24" !== opts.hourFormat && opts.regex.hrs24.test(chrs)) {
                             var tmp = parseInt(chrs, 10);
-                            return 24 == tmp ? (maskset.buffer[pos + 5] = "a", maskset.buffer[pos + 6] = "m") : (maskset.buffer[pos + 5] = "p", 
+                            return 24 === tmp ? (maskset.buffer[pos + 5] = "a", maskset.buffer[pos + 6] = "m") : (maskset.buffer[pos + 5] = "p", 
                             maskset.buffer[pos + 6] = "m"), tmp -= 12, 10 > tmp ? (maskset.buffer[pos] = tmp.toString(), 
                             maskset.buffer[pos - 1] = "0") : (maskset.buffer[pos] = tmp.toString().charAt(1), 
                             maskset.buffer[pos - 1] = tmp.toString().charAt(0)), {

File diff suppressed because it is too large
+ 2 - 2
dist/inputmask/inputmask.date.extensions.min.js


+ 3 - 3
dist/inputmask/inputmask.extensions.js

@@ -3,7 +3,7 @@
 * http://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2015 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.1.64-150
+* Version: 3.1.64-153
 */
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "jquery", "./inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery"), require("./inputmask")) : factory(jQuery);
@@ -86,8 +86,8 @@
             definitions: {
                 i: {
                     validator: function(chrs, maskset, pos, strict, opts) {
-                        return pos - 1 > -1 && "." != maskset.buffer[pos - 1] ? (chrs = maskset.buffer[pos - 1] + chrs, 
-                        chrs = pos - 2 > -1 && "." != maskset.buffer[pos - 2] ? maskset.buffer[pos - 2] + chrs : "0" + chrs) : chrs = "00" + chrs, 
+                        return pos - 1 > -1 && "." !== maskset.buffer[pos - 1] ? (chrs = maskset.buffer[pos - 1] + chrs, 
+                        chrs = pos - 2 > -1 && "." !== maskset.buffer[pos - 2] ? maskset.buffer[pos - 2] + chrs : "0" + chrs) : chrs = "00" + chrs, 
                         new RegExp("25[0-5]|2[0-4][0-9]|[01][0-9][0-9]").test(chrs);
                     },
                     cardinality: 1

File diff suppressed because it is too large
+ 2 - 2
dist/inputmask/inputmask.extensions.min.js


+ 61 - 69
dist/inputmask/inputmask.js

@@ -3,7 +3,7 @@
 * http://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2015 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.1.64-150
+* Version: 3.1.64-153
 */
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "jquery" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery")) : factory(jQuery);
@@ -336,12 +336,12 @@
                     }), !0;
                     if (void 0 !== match.matches) {
                         if (match.isGroup && quantifierRecurse !== match) {
-                            if (match = handleMatch(maskToken.matches[tndx + 1], loopNdx)) return !0;
+                            if (match = handleMatch(maskToken.matches[$.inArray(match, maskToken.matches) + 1], loopNdx)) return !0;
                         } else if (match.isOptional) {
                             var optionalToken = match;
                             if (match = resolveTestFromToken(match, ndxInitializer, loopNdx, quantifierRecurse)) {
-                                var latestMatch = matches[matches.length - 1].match, isFirstMatch = 0 === $.inArray(latestMatch, optionalToken.matches);
-                                if (!isFirstMatch) return !0;
+                                if (latestMatch = matches[matches.length - 1].match, isFirstMatch = 0 === $.inArray(latestMatch, optionalToken.matches), 
+                                !isFirstMatch) return !0;
                                 insertStop = !0, testPos = pos;
                             }
                         } else if (match.isAlternator) {
@@ -390,10 +390,8 @@
                         } else if (match.isQuantifier && quantifierRecurse !== maskToken.matches[$.inArray(match, maskToken.matches) - 1]) for (var qt = match, qndx = ndxInitializer.length > 0 ? ndxInitializer.shift() : 0; qndx < (isNaN(qt.quantifier.max) ? qndx + 1 : qt.quantifier.max) && pos >= testPos; qndx++) {
                             var tokenGroup = maskToken.matches[$.inArray(qt, maskToken.matches) - 1];
                             if (match = handleMatch(tokenGroup, [ qndx ].concat(loopNdx), tokenGroup)) {
-                                var latestMatch = matches[matches.length - 1].match;
-                                latestMatch.optionalQuantifier = qndx > qt.quantifier.min - 1;
-                                var isFirstMatch = 0 === $.inArray(latestMatch, tokenGroup.matches);
-                                if (isFirstMatch) {
+                                if (latestMatch = matches[matches.length - 1].match, latestMatch.optionalQuantifier = qndx > qt.quantifier.min - 1, 
+                                isFirstMatch = 0 === $.inArray(latestMatch, tokenGroup.matches)) {
                                     if (qndx > qt.quantifier.min - 1) {
                                         insertStop = !0, testPos = pos;
                                         break;
@@ -411,7 +409,7 @@
                     if (testPos > pos) break;
                 }
             }
-            var maskTokens = getMaskSet().maskToken, testPos = ndxIntlzr ? tstPs : 0, ndxInitializer = ndxIntlzr || [ 0 ], matches = [], insertStop = !1;
+            var latestMatch, isFirstMatch, maskTokens = getMaskSet().maskToken, testPos = ndxIntlzr ? tstPs : 0, ndxInitializer = ndxIntlzr || [ 0 ], matches = [], insertStop = !1;
             if (cacheable === !0 && getMaskSet().tests[pos]) return getMaskSet().tests[pos];
             if (void 0 === ndxIntlzr) {
                 for (var test, previousPos = pos - 1; void 0 === (test = getMaskSet().validPositions[previousPos]) && previousPos > -1 && (!getMaskSet().tests[previousPos] || void 0 === (test = getMaskSet().tests[previousPos][0])); ) previousPos--;
@@ -441,10 +439,11 @@
             getMaskSet().buffer;
         }
         function refreshFromBuffer(start, end, buffer) {
+            var i;
             if (buffer = buffer || getBuffer().slice(), start === !0) resetMaskSet(), start = 0, 
-            end = buffer.length; else for (var i = start; end > i; i++) delete getMaskSet().validPositions[i], 
+            end = buffer.length; else for (i = start; end > i; i++) delete getMaskSet().validPositions[i], 
             delete getMaskSet().tests[i];
-            for (var i = start; end > i; i++) buffer[i] !== opts.skipOptionalPartCharacter && isValid(i, buffer[i], !0, !0);
+            for (i = start; end > i; i++) buffer[i] !== opts.skipOptionalPartCharacter && isValid(i, buffer[i], !0, !0);
         }
         function casing(elem, test) {
             switch (test.casing) {
@@ -458,7 +457,7 @@
             return elem;
         }
         function checkAlternationMatch(altArr1, altArr2) {
-            for (var altArrC = opts.greedy ? altArr2 : altArr2.slice(0, 1), isMatch = !1, alndx = 0; alndx < altArr1.length; alndx++) if (-1 != $.inArray(altArr1[alndx], altArrC)) {
+            for (var altArrC = opts.greedy ? altArr2 : altArr2.slice(0, 1), isMatch = !1, alndx = 0; alndx < altArr1.length; alndx++) if (-1 !== $.inArray(altArr1[alndx], altArrC)) {
                 isMatch = !0;
                 break;
             }
@@ -469,19 +468,19 @@
                 var rslt = !1;
                 return $.each(getTests(position), function(ndx, tst) {
                     for (var test = tst.match, loopend = c ? 1 : 0, chrs = "", i = (getBuffer(), test.cardinality); i > loopend; i--) chrs += getBufferElement(position - (i - 1));
-                    if (c && (chrs += c), rslt = null != test.fn ? test.fn.test(chrs, getMaskSet(), position, strict, opts) : c != test.def && c != opts.skipOptionalPartCharacter || "" == test.def ? !1 : {
+                    if (c && (chrs += c), rslt = null != test.fn ? test.fn.test(chrs, getMaskSet(), position, strict, opts) : c !== test.def && c !== opts.skipOptionalPartCharacter || "" === test.def ? !1 : {
                         c: test.def,
                         pos: position
                     }, rslt !== !1) {
-                        var elem = void 0 != rslt.c ? rslt.c : c;
-                        elem = elem == opts.skipOptionalPartCharacter && null === test.fn ? test.def : elem;
+                        var elem = void 0 !== rslt.c ? rslt.c : c;
+                        elem = elem === opts.skipOptionalPartCharacter && null === test.fn ? test.def : elem;
                         var validatedPos = position, possibleModifiedBuffer = getBuffer();
-                        if (void 0 != rslt.remove && ($.isArray(rslt.remove) || (rslt.remove = [ rslt.remove ]), 
+                        if (void 0 !== rslt.remove && ($.isArray(rslt.remove) || (rslt.remove = [ rslt.remove ]), 
                         $.each(rslt.remove.sort(function(a, b) {
                             return b - a;
                         }), function(ndx, lmnt) {
                             stripValidPositions(lmnt, lmnt + 1, !0);
-                        })), void 0 != rslt.insert && ($.isArray(rslt.insert) || (rslt.insert = [ rslt.insert ]), 
+                        })), void 0 !== rslt.insert && ($.isArray(rslt.insert) || (rslt.insert = [ rslt.insert ]), 
                         $.each(rslt.insert.sort(function(a, b) {
                             return a - b;
                         }), function(ndx, lmnt) {
@@ -491,7 +490,7 @@
                             if (strict = !0, refreshFromBuffer(refresh === !0 ? refresh : refresh.start, refresh.end, possibleModifiedBuffer), 
                             void 0 === rslt.pos && void 0 === rslt.c) return rslt.pos = getLastValidPosition(), 
                             !1;
-                            if (validatedPos = void 0 !== rslt.pos ? rslt.pos : position, validatedPos != position) return rslt = $.extend(rslt, isValid(validatedPos, elem, !0)), 
+                            if (validatedPos = void 0 !== rslt.pos ? rslt.pos : position, validatedPos !== position) return rslt = $.extend(rslt, isValid(validatedPos, elem, !0)), 
                             !1;
                         } else if (rslt !== !0 && void 0 !== rslt.pos && rslt.pos !== position && (validatedPos = rslt.pos, 
                         refreshFromBuffer(position, validatedPos), validatedPos !== position)) return rslt = $.extend(rslt, isValid(validatedPos, elem, !0)), 
@@ -504,7 +503,7 @@
                 }), rslt;
             }
             function alternate(pos, c, strict, fromSetValid) {
-                for (var lastAlt, alternation, isValidRslt, altPos, validPsClone = $.extend(!0, {}, getMaskSet().validPositions), lAlt = getLastValidPosition(); lAlt >= 0 && (altPos = getMaskSet().validPositions[lAlt], 
+                for (var lastAlt, alternation, isValidRslt, altPos, i, validPos, validPsClone = $.extend(!0, {}, getMaskSet().validPositions), lAlt = getLastValidPosition(); lAlt >= 0 && (altPos = getMaskSet().validPositions[lAlt], 
                 !altPos || void 0 === altPos.alternation || (lastAlt = lAlt, alternation = getMaskSet().validPositions[lastAlt].alternation, 
                 getTestTemplate(lastAlt).locator[altPos.alternation] === altPos.locator[altPos.alternation])); lAlt--) ;
                 if (void 0 !== alternation) {
@@ -520,21 +519,19 @@
                                 break;
                             }
                             if (decisionTaker !== possibilityPos.locator[alternation]) {
-                                for (var validInputs = [], staticInputsBeforePos = 0, i = decisionPos + 1; i < getLastValidPosition() + 1; i++) {
-                                    var validPos = getMaskSet().validPositions[i];
-                                    validPos && (null != validPos.match.fn ? validInputs.push(validPos.input) : pos > i && staticInputsBeforePos++), 
-                                    delete getMaskSet().validPositions[i], delete getMaskSet().tests[i];
-                                }
+                                var validInputs = [], staticInputsBeforePos = 0;
+                                for (i = decisionPos + 1; i < getLastValidPosition() + 1; i++) validPos = getMaskSet().validPositions[i], 
+                                validPos && (null != validPos.match.fn ? validInputs.push(validPos.input) : pos > i && staticInputsBeforePos++), 
+                                delete getMaskSet().validPositions[i], delete getMaskSet().tests[i];
                                 for (resetMaskSet(!0), opts.keepStatic = !opts.keepStatic, isValidRslt = !0; validInputs.length > 0; ) {
                                     var input = validInputs.shift();
                                     if (input !== opts.skipOptionalPartCharacter && !(isValidRslt = isValid(getLastValidPosition() + 1, input, !1, !0))) break;
                                 }
                                 if (possibilityPos.alternation = alternation, possibilityPos.locator[alternation] = possibilities, 
                                 isValidRslt) {
-                                    for (var targetLvp = getLastValidPosition(pos) + 1, staticInputsBeforePosAlternate = 0, i = decisionPos + 1; i < getLastValidPosition() + 1; i++) {
-                                        var validPos = getMaskSet().validPositions[i];
-                                        validPos && null == validPos.match.fn && pos > i && staticInputsBeforePosAlternate++;
-                                    }
+                                    var targetLvp = getLastValidPosition(pos) + 1, staticInputsBeforePosAlternate = 0;
+                                    for (i = decisionPos + 1; i < getLastValidPosition() + 1; i++) validPos = getMaskSet().validPositions[i], 
+                                    validPos && null == validPos.match.fn && pos > i && staticInputsBeforePosAlternate++;
                                     pos += staticInputsBeforePosAlternate - staticInputsBeforePos, isValidRslt = isValid(pos > targetLvp ? targetLvp : pos, c, strict, fromSetValid);
                                 }
                                 if (opts.keepStatic = !opts.keepStatic, isValidRslt) return isValidRslt;
@@ -693,9 +690,12 @@
             if ($input[0].inputmask && !$input.hasClass("hasDatepicker")) {
                 var umValue = [], vps = getMaskSet().validPositions;
                 for (var pndx in vps) vps[pndx].match && null != vps[pndx].match.fn && umValue.push(vps[pndx].input);
-                var unmaskedValue = (isRTL ? umValue.reverse() : umValue).join(""), bufferValue = (isRTL ? getBuffer().slice().reverse() : getBuffer()).join("");
-                return $.isFunction(opts.onUnMask) && (unmaskedValue = opts.onUnMask.call($input, bufferValue, unmaskedValue, opts) || unmaskedValue), 
-                unmaskedValue;
+                var unmaskedValue = 0 === umValue.length ? null : (isRTL ? umValue.reverse() : umValue).join("");
+                if (null !== unmaskedValue) {
+                    var bufferValue = (isRTL ? getBuffer().slice().reverse() : getBuffer()).join("");
+                    $.isFunction(opts.onUnMask) && (unmaskedValue = opts.onUnMask.call($input, bufferValue, unmaskedValue, opts) || unmaskedValue);
+                }
+                return unmaskedValue;
             }
             return $input[0].inputmask._valueGet();
         }
@@ -720,7 +720,7 @@
             if (begin = translatePosition(begin), end = translatePosition(end), end = "number" == typeof end ? end : begin, 
             $(npt).is(":visible")) {
                 var scrollCalc = $(npt).css("font-size").replace("px", "") * end;
-                if (npt.scrollLeft = scrollCalc > npt.scrollWidth ? scrollCalc : 0, androidchrome || 0 != opts.insertMode || begin != end || end++, 
+                if (npt.scrollLeft = scrollCalc > npt.scrollWidth ? scrollCalc : 0, androidchrome || opts.insertMode !== !1 || begin !== end || end++, 
                 npt.setSelectionRange) npt.selectionStart = begin, npt.selectionEnd = end; else if (window.getSelection) {
                     if (range = document.createRange(), void 0 === npt.firstChild) {
                         var textNode = document.createTextNode("");
@@ -908,17 +908,17 @@
                 pos.end = pos.begin, pos.begin = pend;
             }
             k === Inputmask.keyCode.BACKSPACE && (pos.end - pos.begin < 1 || opts.insertMode === !1) ? (pos.begin = seekPrevious(pos.begin), 
-            void 0 === getMaskSet().validPositions[pos.begin] || getMaskSet().validPositions[pos.begin].input !== opts.groupSeparator && getMaskSet().validPositions[pos.begin].input !== opts.radixPoint || pos.begin--) : k == Inputmask.keyCode.DELETE && pos.begin == pos.end && (pos.end = isMask(pos.end) ? pos.end + 1 : seekNext(pos.end) + 1, 
-            void 0 == getMaskSet().validPositions[pos.begin] || getMaskSet().validPositions[pos.begin].input != opts.groupSeparator && getMaskSet().validPositions[pos.begin].input != opts.radixPoint || pos.end++), 
+            void 0 === getMaskSet().validPositions[pos.begin] || getMaskSet().validPositions[pos.begin].input !== opts.groupSeparator && getMaskSet().validPositions[pos.begin].input !== opts.radixPoint || pos.begin--) : k === Inputmask.keyCode.DELETE && pos.begin === pos.end && (pos.end = isMask(pos.end) ? pos.end + 1 : seekNext(pos.end) + 1, 
+            void 0 === getMaskSet().validPositions[pos.begin] || getMaskSet().validPositions[pos.begin].input !== opts.groupSeparator && getMaskSet().validPositions[pos.begin].input !== opts.radixPoint || pos.end++), 
             stripValidPositions(pos.begin, pos.end, !1, strict), strict !== !0 && generalize();
             var lvp = getLastValidPosition(pos.begin);
-            lvp < pos.begin ? (-1 == lvp && resetMaskSet(), getMaskSet().p = seekNext(lvp)) : strict !== !0 && (getMaskSet().p = pos.begin);
+            lvp < pos.begin ? (-1 === lvp && resetMaskSet(), getMaskSet().p = seekNext(lvp)) : strict !== !0 && (getMaskSet().p = pos.begin);
         }
         function keydownEvent(e) {
             var input = this, $input = $(input), k = e.keyCode, pos = caret(input);
             k === Inputmask.keyCode.BACKSPACE || k === Inputmask.keyCode.DELETE || iphone && 127 === k || e.ctrlKey && 88 === k && !isInputEventSupported("cut") ? (e.preventDefault(), 
-            88 == k && (undoValue = getBuffer().join("")), handleRemove(input, k, pos), writeBuffer(input, getBuffer(), getMaskSet().p, e, undoValue != getBuffer().join("")), 
-            input.inputmask._valueGet() == getBufferTemplate().join("") ? $input.trigger("cleared") : isComplete(getBuffer()) === !0 && $input.trigger("complete"), 
+            88 === k && (undoValue = getBuffer().join("")), handleRemove(input, k, pos), writeBuffer(input, getBuffer(), getMaskSet().p, e, undoValue !== getBuffer().join("")), 
+            input.inputmask._valueGet() === getBufferTemplate().join("") ? $input.trigger("cleared") : isComplete(getBuffer()) === !0 && $input.trigger("complete"), 
             opts.showTooltip && $input.prop("title", getMaskSet().mask)) : k === Inputmask.keyCode.END || k === Inputmask.keyCode.PAGE_DOWN ? setTimeout(function() {
                 var caretPos = seekNext(getLastValidPosition());
                 opts.insertMode || caretPos !== getMaskLength() || e.shiftKey || caretPos--, caret(input, e.shiftKey ? pos.begin : caretPos, caretPos);
@@ -984,11 +984,11 @@
         }
         function pasteEvent(e) {
             var input = this, $input = $(input), inputValue = input.inputmask._valueGet(!0), caretPos = caret(input);
-            if ("propertychange" == e.type && input.inputmask._valueGet().length <= getMaskLength()) return !0;
-            if ("paste" == e.type) {
+            if ("propertychange" === e.type && input.inputmask._valueGet().length <= getMaskLength()) return !0;
+            if ("paste" === e.type) {
                 var valueBeforeCaret = inputValue.substr(0, caretPos.begin), valueAfterCaret = inputValue.substr(caretPos.end, inputValue.length);
-                valueBeforeCaret == getBufferTemplate().slice(0, caretPos.begin).join("") && (valueBeforeCaret = ""), 
-                valueAfterCaret == getBufferTemplate().slice(caretPos.end).join("") && (valueAfterCaret = ""), 
+                valueBeforeCaret === getBufferTemplate().slice(0, caretPos.begin).join("") && (valueBeforeCaret = ""), 
+                valueAfterCaret === getBufferTemplate().slice(caretPos.end).join("") && (valueAfterCaret = ""), 
                 window.clipboardData && window.clipboardData.getData ? inputValue = valueBeforeCaret + window.clipboardData.getData("Text") + valueAfterCaret : e.originalEvent && e.originalEvent.clipboardData && e.originalEvent.clipboardData.getData && (inputValue = valueBeforeCaret + e.originalEvent.clipboardData.getData("text/plain") + valueAfterCaret);
             }
             var pasteValue = inputValue;
@@ -1053,7 +1053,7 @@
                 }
             }).bind("focus.inputmask", function(e) {
                 var input = ($(this), this), nptValue = input.inputmask._valueGet();
-                opts.showMaskOnFocus && (!opts.showMaskOnHover || opts.showMaskOnHover && "" == nptValue) ? input.inputmask._valueGet() != getBuffer().join("") && writeBuffer(input, getBuffer(), seekNext(getLastValidPosition())) : mouseEnter === !1 && caret(input, seekNext(getLastValidPosition())), 
+                opts.showMaskOnFocus && (!opts.showMaskOnHover || opts.showMaskOnHover && "" === nptValue) ? input.inputmask._valueGet() !== getBuffer().join("") && writeBuffer(input, getBuffer(), seekNext(getLastValidPosition())) : mouseEnter === !1 && caret(input, seekNext(getLastValidPosition())), 
                 opts.positionCaretOnTab === !0 && setTimeout(function() {
                     caret(input, seekNext(getLastValidPosition()));
                 }, 0), undoValue = getBuffer().join("");
@@ -1061,14 +1061,14 @@
                 var $input = $(this), input = this;
                 if (mouseEnter = !1, opts.clearMaskOnLostFocus) {
                     var buffer = getBuffer().slice(), nptValue = input.inputmask._valueGet();
-                    $input.is(":focus") || nptValue == $input.attr("placeholder") || "" == nptValue || (-1 === getLastValidPosition() && nptValue === getBufferTemplate().join("") ? buffer = [] : clearOptionalTail(buffer), 
+                    $input.is(":focus") || nptValue === $input.attr("placeholder") || "" === nptValue || (-1 === getLastValidPosition() && nptValue === getBufferTemplate().join("") ? buffer = [] : clearOptionalTail(buffer), 
                     writeBuffer(input, buffer));
                 }
             }).bind("click.inputmask", function() {
                 var $input = $(this), input = this;
                 if ($input.is(":focus")) {
                     var selectedCaret = caret(input);
-                    if (selectedCaret.begin === selectedCaret.end) if (opts.radixFocus && "" != opts.radixPoint && -1 != $.inArray(opts.radixPoint, getBuffer()) && (firstClick || getBuffer().join("") == getBufferTemplate().join(""))) caret(input, $.inArray(opts.radixPoint, getBuffer())), 
+                    if (selectedCaret.begin === selectedCaret.end) if (opts.radixFocus && "" !== opts.radixPoint && -1 !== $.inArray(opts.radixPoint, getBuffer()) && (firstClick || getBuffer().join("") === getBufferTemplate().join(""))) caret(input, $.inArray(opts.radixPoint, getBuffer())), 
                     firstClick = !1; else {
                         var clickPosition = selectedCaret.begin, lastPosition = seekNext(getLastValidPosition(clickPosition));
                         lastPosition > clickPosition ? caret(input, isMask(clickPosition) ? clickPosition : seekNext(clickPosition)) : caret(input, opts.numericInput ? 0 : lastPosition);
@@ -1086,8 +1086,8 @@
                     var clipboardData = window.clipboardData || e.originalEvent.clipboardData, clipData = clipboardData.getData("text").split("").reverse().join("");
                     clipboardData.setData("text", clipData);
                 }
-                handleRemove(input, Inputmask.keyCode.DELETE, pos), writeBuffer(input, getBuffer(), getMaskSet().p, e, undoValue != getBuffer().join("")), 
-                input.inputmask._valueGet() == getBufferTemplate().join("") && $input.trigger("cleared"), 
+                handleRemove(input, Inputmask.keyCode.DELETE, pos), writeBuffer(input, getBuffer(), getMaskSet().p, e, undoValue !== getBuffer().join("")), 
+                input.inputmask._valueGet() === getBufferTemplate().join("") && $input.trigger("cleared"), 
                 opts.showTooltip && $input.prop("title", getMaskSet().mask);
             }).bind("complete.inputmask", opts.oncomplete).bind("incomplete.inputmask", opts.onincomplete).bind("cleared.inputmask", opts.oncleared), 
             $el.bind("keydown.inputmask", keydownEvent).bind("keypress.inputmask", keypressEvent), 
@@ -1096,7 +1096,7 @@
             $el.bind("setvalue.inputmask", function() {
                 var input = this, value = input.inputmask._valueGet();
                 input.inputmask._valueSet($.isFunction(opts.onBeforeMask) ? opts.onBeforeMask.call(input, value, opts) || value : value), 
-                checkVal(input, !0, !1), undoValue = getBuffer().join(""), (opts.clearMaskOnLostFocus || opts.clearIncomplete) && input.inputmask._valueGet() == getBufferTemplate().join("") && input.inputmask._valueSet("");
+                checkVal(input, !0, !1), undoValue = getBuffer().join(""), (opts.clearMaskOnLostFocus || opts.clearIncomplete) && input.inputmask._valueGet() === getBufferTemplate().join("") && input.inputmask._valueSet("");
             }), patchValueProperty(el);
             var initialValue = $.isFunction(opts.onBeforeMask) ? opts.onBeforeMask.call(el, el.inputmask._valueGet(), opts) || el.inputmask._valueGet() : el.inputmask._valueGet();
             checkVal(el, !0, !1, initialValue.split(""));
@@ -1106,25 +1106,22 @@
             try {
                 activeElement = document.activeElement;
             } catch (e) {}
-            isComplete(buffer) === !1 && opts.clearIncomplete && resetMaskSet(), opts.clearMaskOnLostFocus && (buffer.join("") == getBufferTemplate().join("") ? buffer = [] : clearOptionalTail(buffer)), 
+            isComplete(buffer) === !1 && opts.clearIncomplete && resetMaskSet(), opts.clearMaskOnLostFocus && (buffer.join("") === getBufferTemplate().join("") ? buffer = [] : clearOptionalTail(buffer)), 
             writeBuffer(el, buffer), activeElement === el && caret(el, seekNext(getLastValidPosition())), 
             installEventRuler(el);
         }
-        var undoValue, compositionCaretPos, compositionData, el, $el, maxLength, isRTL = !1, skipKeyPressEvent = !1, skipInputEvent = !1, ignorable = !1, firstClick = !0, mouseEnter = !0;
+        var undoValue, compositionCaretPos, compositionData, el, $el, maxLength, valueBuffer, isRTL = !1, skipKeyPressEvent = !1, skipInputEvent = !1, ignorable = !1, firstClick = !0, mouseEnter = !0;
         if (void 0 !== actionObj) switch (actionObj.action) {
           case "isComplete":
             return el = actionObj.el, $el = $(el), maskset = el.inputmask.maskset, opts = el.inputmask.opts, 
             isComplete(actionObj.buffer);
 
           case "unmaskedvalue":
-            if (el = actionObj.el, void 0 === el) {
-                $el = $({}), el = $el[0], el.inputmask = new Inputmask(), el.inputmask.opts = opts, 
-                el.inputmask.el = el, el.inputmask.maskset = maskset, el.inputmask.isRTL = opts.numericInput, 
-                opts.numericInput && (isRTL = !0);
-                var valueBuffer = ($.isFunction(opts.onBeforeMask) ? opts.onBeforeMask.call($el, actionObj.value, opts) || actionObj.value : actionObj.value).split("");
-                checkVal($el, !1, !1, isRTL ? valueBuffer.reverse() : valueBuffer), $.isFunction(opts.onBeforeWrite) && opts.onBeforeWrite.call(this, void 0, getBuffer(), 0, opts);
-            } else $el = $(el);
-            return maskset = el.inputmask.maskset, opts = el.inputmask.opts, isRTL = el.inputmask.isRTL, 
+            return el = actionObj.el, void 0 === el ? ($el = $({}), el = $el[0], el.inputmask = new Inputmask(), 
+            el.inputmask.opts = opts, el.inputmask.el = el, el.inputmask.maskset = maskset, 
+            el.inputmask.isRTL = opts.numericInput, opts.numericInput && (isRTL = !0), valueBuffer = ($.isFunction(opts.onBeforeMask) ? opts.onBeforeMask.call($el, actionObj.value, opts) || actionObj.value : actionObj.value).split(""), 
+            checkVal($el, !1, !1, isRTL ? valueBuffer.reverse() : valueBuffer), $.isFunction(opts.onBeforeWrite) && opts.onBeforeWrite.call(this, void 0, getBuffer(), 0, opts)) : $el = $(el), 
+            maskset = el.inputmask.maskset, opts = el.inputmask.opts, isRTL = el.inputmask.isRTL, 
             unmaskedvalue($el);
 
           case "mask":
@@ -1132,11 +1129,10 @@
             break;
 
           case "format":
-            $el = $({}), $el[0].inputmask = new Inputmask(), $el[0].inputmask.opts = opts, $el[0].inputmask.el = $el[0], 
-            $el[0].inputmask.maskset = maskset, $el[0].inputmask.isRTL = opts.numericInput, 
-            opts.numericInput && (isRTL = !0);
-            var valueBuffer = ($.isFunction(opts.onBeforeMask) ? opts.onBeforeMask.call($el, actionObj.value, opts) || actionObj.value : actionObj.value).split("");
-            return checkVal($el, !1, !1, isRTL ? valueBuffer.reverse() : valueBuffer), $.isFunction(opts.onBeforeWrite) && opts.onBeforeWrite.call(this, void 0, getBuffer(), 0, opts), 
+            return $el = $({}), $el[0].inputmask = new Inputmask(), $el[0].inputmask.opts = opts, 
+            $el[0].inputmask.el = $el[0], $el[0].inputmask.maskset = maskset, $el[0].inputmask.isRTL = opts.numericInput, 
+            opts.numericInput && (isRTL = !0), valueBuffer = ($.isFunction(opts.onBeforeMask) ? opts.onBeforeMask.call($el, actionObj.value, opts) || actionObj.value : actionObj.value).split(""), 
+            checkVal($el, !1, !1, isRTL ? valueBuffer.reverse() : valueBuffer), $.isFunction(opts.onBeforeWrite) && opts.onBeforeWrite.call(this, void 0, getBuffer(), 0, opts), 
             actionObj.metadata ? {
                 value: isRTL ? getBuffer().slice().reverse().join("") : getBuffer().join(""),
                 metadata: $el.inputmask("getmetadata")
@@ -1145,11 +1141,9 @@
           case "isValid":
             $el = $({}), $el[0].inputmask = new Inputmask(), $el[0].inputmask.opts = opts, $el[0].inputmask.el = $el[0], 
             $el[0].inputmask.maskset = maskset, $el[0].inputmask.isRTL = opts.numericInput, 
-            opts.numericInput && (isRTL = !0);
-            var valueBuffer = actionObj.value.split("");
-            checkVal($el, !1, !0, isRTL ? valueBuffer.reverse() : valueBuffer);
+            opts.numericInput && (isRTL = !0), valueBuffer = actionObj.value.split(""), checkVal($el, !1, !0, isRTL ? valueBuffer.reverse() : valueBuffer);
             for (var buffer = getBuffer(), rl = determineLastRequiredPosition(), lmib = buffer.length - 1; lmib > rl && !isMask(lmib); lmib--) ;
-            return buffer.splice(rl, lmib + 1 - rl), isComplete(buffer) && actionObj.value == buffer.join("");
+            return buffer.splice(rl, lmib + 1 - rl), isComplete(buffer) && actionObj.value === buffer.join("");
 
           case "getemptymask":
             return el = actionObj.el, $el = $(el), maskset = el.inputmask.maskset, opts = el.inputmask.opts, 
@@ -1360,8 +1354,6 @@
         UP: 38,
         WINDOWS: 91
     };
-    var ua = navigator.userAgent, iphone = null !== ua.match(new RegExp("iphone", "i")), androidchrome = (null !== ua.match(new RegExp("android.*safari.*", "i")), 
-    null !== ua.match(new RegExp("android.*chrome.*", "i"))), androidfirefox = null !== ua.match(new RegExp("android.*firefox.*", "i")), PasteEventType = (/Kindle/i.test(ua) || /Silk/i.test(ua) || /KFTT/i.test(ua) || /KFOT/i.test(ua) || /KFJWA/i.test(ua) || /KFJWI/i.test(ua) || /KFSOWI/i.test(ua) || /KFTHWA/i.test(ua) || /KFTHWI/i.test(ua) || /KFAPWA/i.test(ua) || /KFAPWI/i.test(ua), 
-    isInputEventSupported("paste") ? "paste" : isInputEventSupported("input") ? "input" : "propertychange");
+    var ua = navigator.userAgent, iphone = null !== ua.match(new RegExp("iphone", "i")), androidchrome = null !== ua.match(new RegExp("android.*chrome.*", "i")), androidfirefox = null !== ua.match(new RegExp("android.*firefox.*", "i")), PasteEventType = isInputEventSupported("paste") ? "paste" : isInputEventSupported("input") ? "input" : "propertychange";
     return window.Inputmask = Inputmask, Inputmask;
 });

File diff suppressed because it is too large
+ 3 - 3
dist/inputmask/inputmask.min.js


+ 1 - 1
dist/inputmask/inputmask.numeric.extensions.js

@@ -3,7 +3,7 @@
 * http://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2015 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.1.64-150
+* Version: 3.1.64-153
 */
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "jquery", "./inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery"), require("./inputmask")) : factory(jQuery);

File diff suppressed because it is too large
+ 1 - 1
dist/inputmask/inputmask.numeric.extensions.min.js


+ 2 - 2
dist/inputmask/inputmask.phone.extensions.js

@@ -3,7 +3,7 @@
 * http://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2015 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.1.64-150
+* Version: 3.1.64-153
 */
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "jquery", "./inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery"), require("./inputmask")) : factory(jQuery);
@@ -34,7 +34,7 @@
             nojumpsThreshold: 1,
             onBeforeMask: function(value, opts) {
                 var processedValue = value.replace(/^0/g, "");
-                return (processedValue.indexOf(opts.countrycode) > 1 || -1 == processedValue.indexOf(opts.countrycode)) && (processedValue = "+" + opts.countrycode + processedValue), 
+                return (processedValue.indexOf(opts.countrycode) > 1 || -1 === processedValue.indexOf(opts.countrycode)) && (processedValue = "+" + opts.countrycode + processedValue), 
                 processedValue;
             }
         },

File diff suppressed because it is too large
+ 2 - 2
dist/inputmask/inputmask.phone.extensions.min.js


+ 18 - 27
dist/inputmask/inputmask.regex.extensions.js

@@ -3,7 +3,7 @@
 * http://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2015 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.1.64-150
+* Version: 3.1.64-153
 */
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "jquery", "./inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery"), require("./inputmask")) : factory(jQuery);
@@ -23,7 +23,7 @@
             definitions: {
                 r: {
                     validator: function(chrs, maskset, pos, strict, opts) {
-                        function regexToken(isGroup, isQuantifier) {
+                        function RegexToken(isGroup, isQuantifier) {
                             this.matches = [], this.isGroup = isGroup || !1, this.isQuantifier = isQuantifier || !1, 
                             this.quantifier = {
                                 min: 1,
@@ -31,41 +31,33 @@
                             }, this.repeaterPart = void 0;
                         }
                         function analyseRegex() {
-                            var match, m, currentToken = new regexToken(), opengroups = [];
+                            var match, m, currentToken = new RegexToken(), opengroups = [];
                             for (opts.regexTokens = []; match = opts.tokenizer.exec(opts.regex); ) switch (m = match[0], 
                             m.charAt(0)) {
                               case "(":
-                                opengroups.push(new regexToken(!0));
+                                opengroups.push(new RegexToken(!0));
                                 break;
 
                               case ")":
-                                var groupToken = opengroups.pop();
-                                opengroups.length > 0 ? opengroups[opengroups.length - 1].matches.push(groupToken) : currentToken.matches.push(groupToken);
+                                groupToken = opengroups.pop(), opengroups.length > 0 ? opengroups[opengroups.length - 1].matches.push(groupToken) : currentToken.matches.push(groupToken);
                                 break;
 
                               case "{":
                               case "+":
                               case "*":
-                                var quantifierToken = new regexToken(!1, !0);
+                                var quantifierToken = new RegexToken(!1, !0);
                                 m = m.replace(/[{}]/g, "");
-                                var mq = m.split(","), mq0 = isNaN(mq[0]) ? mq[0] : parseInt(mq[0]), mq1 = 1 == mq.length ? mq0 : isNaN(mq[1]) ? mq[1] : parseInt(mq[1]);
+                                var mq = m.split(","), mq0 = isNaN(mq[0]) ? mq[0] : parseInt(mq[0]), mq1 = 1 === mq.length ? mq0 : isNaN(mq[1]) ? mq[1] : parseInt(mq[1]);
                                 if (quantifierToken.quantifier = {
                                     min: mq0,
                                     max: mq1
                                 }, opengroups.length > 0) {
                                     var matches = opengroups[opengroups.length - 1].matches;
-                                    if (match = matches.pop(), !match.isGroup) {
-                                        var groupToken = new regexToken(!0);
-                                        groupToken.matches.push(match), match = groupToken;
-                                    }
-                                    matches.push(match), matches.push(quantifierToken);
-                                } else {
-                                    if (match = currentToken.matches.pop(), !match.isGroup) {
-                                        var groupToken = new regexToken(!0);
-                                        groupToken.matches.push(match), match = groupToken;
-                                    }
-                                    currentToken.matches.push(match), currentToken.matches.push(quantifierToken);
-                                }
+                                    match = matches.pop(), match.isGroup || (groupToken = new RegexToken(!0), groupToken.matches.push(match), 
+                                    match = groupToken), matches.push(match), matches.push(quantifierToken);
+                                } else match = currentToken.matches.pop(), match.isGroup || (groupToken = new RegexToken(!0), 
+                                groupToken.matches.push(match), match = groupToken), currentToken.matches.push(match), 
+                                currentToken.matches.push(quantifierToken);
                                 break;
 
                               default:
@@ -78,24 +70,24 @@
                             fromGroup && (regexPart += "(", openGroupCount++);
                             for (var mndx = 0; mndx < token.matches.length; mndx++) {
                                 var matchToken = token.matches[mndx];
-                                if (1 == matchToken.isGroup) isvalid = validateRegexToken(matchToken, !0); else if (1 == matchToken.isQuantifier) {
+                                if (matchToken.isGroup === !0) isvalid = validateRegexToken(matchToken, !0); else if (matchToken.isQuantifier === !0) {
                                     var crrntndx = $.inArray(matchToken, token.matches), matchGroup = token.matches[crrntndx - 1], regexPartBak = regexPart;
                                     if (isNaN(matchToken.quantifier.max)) {
-                                        for (;matchToken.repeaterPart && matchToken.repeaterPart != regexPart && matchToken.repeaterPart.length > regexPart.length && !(isvalid = validateRegexToken(matchGroup, !0)); ) ;
+                                        for (;matchToken.repeaterPart && matchToken.repeaterPart !== regexPart && matchToken.repeaterPart.length > regexPart.length && !(isvalid = validateRegexToken(matchGroup, !0)); ) ;
                                         isvalid = isvalid || validateRegexToken(matchGroup, !0), isvalid && (matchToken.repeaterPart = regexPart), 
                                         regexPart = regexPartBak + matchToken.quantifier.max;
                                     } else {
                                         for (var i = 0, qm = matchToken.quantifier.max - 1; qm > i && !(isvalid = validateRegexToken(matchGroup, !0)); i++) ;
                                         regexPart = regexPartBak + "{" + matchToken.quantifier.min + "," + matchToken.quantifier.max + "}";
                                     }
-                                } else if (void 0 != matchToken.matches) for (var k = 0; k < matchToken.length && !(isvalid = validateRegexToken(matchToken[k], fromGroup)); k++) ; else {
+                                } else if (void 0 !== matchToken.matches) for (var k = 0; k < matchToken.length && !(isvalid = validateRegexToken(matchToken[k], fromGroup)); k++) ; else {
                                     var testExp;
                                     if ("[" == matchToken.charAt(0)) {
                                         testExp = regexPart, testExp += matchToken;
                                         for (var j = 0; openGroupCount > j; j++) testExp += ")";
                                         var exp = new RegExp("^(" + testExp + ")$");
                                         isvalid = exp.test(bufferStr);
-                                    } else for (var l = 0, tl = matchToken.length; tl > l; l++) if ("\\" != matchToken.charAt(l)) {
+                                    } else for (var l = 0, tl = matchToken.length; tl > l; l++) if ("\\" !== matchToken.charAt(l)) {
                                         testExp = regexPart, testExp += matchToken.substr(0, l + 1), testExp = testExp.replace(/\|$/, "");
                                         for (var j = 0; openGroupCount > j; j++) testExp += ")";
                                         var exp = new RegExp("^(" + testExp + ")$");
@@ -107,9 +99,8 @@
                             }
                             return fromGroup && (regexPart += ")", openGroupCount--), isvalid;
                         }
-                        null == opts.regexTokens && analyseRegex();
-                        var cbuffer = maskset.buffer.slice(), regexPart = "", isValid = !1, openGroupCount = 0;
-                        cbuffer.splice(pos, 0, chrs);
+                        var groupToken, cbuffer = maskset.buffer.slice(), regexPart = "", isValid = !1, openGroupCount = 0;
+                        null === opts.regexTokens && analyseRegex(), cbuffer.splice(pos, 0, chrs);
                         for (var bufferStr = cbuffer.join(""), i = 0; i < opts.regexTokens.length; i++) {
                             var regexToken = opts.regexTokens[i];
                             if (isValid = validateRegexToken(regexToken, regexToken.isGroup)) break;

File diff suppressed because it is too large
+ 2 - 2
dist/inputmask/inputmask.regex.extensions.min.js


+ 1 - 1
dist/inputmask/jquery.inputmask.js

@@ -3,7 +3,7 @@
 * http://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2015 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.1.64-150
+* Version: 3.1.64-153
 */
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "jquery", "./inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery"), require("./inputmask")) : factory(jQuery);

File diff suppressed because it is too large
+ 1 - 1
dist/inputmask/jquery.inputmask.min.js


+ 98 - 115
dist/jquery.inputmask.bundle.js

@@ -3,7 +3,7 @@
 * http://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2015 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.1.64-150
+* Version: 3.1.64-153
 */
 !function($) {
     function Inputmask(options) {
@@ -334,12 +334,12 @@
                     }), !0;
                     if (void 0 !== match.matches) {
                         if (match.isGroup && quantifierRecurse !== match) {
-                            if (match = handleMatch(maskToken.matches[tndx + 1], loopNdx)) return !0;
+                            if (match = handleMatch(maskToken.matches[$.inArray(match, maskToken.matches) + 1], loopNdx)) return !0;
                         } else if (match.isOptional) {
                             var optionalToken = match;
                             if (match = resolveTestFromToken(match, ndxInitializer, loopNdx, quantifierRecurse)) {
-                                var latestMatch = matches[matches.length - 1].match, isFirstMatch = 0 === $.inArray(latestMatch, optionalToken.matches);
-                                if (!isFirstMatch) return !0;
+                                if (latestMatch = matches[matches.length - 1].match, isFirstMatch = 0 === $.inArray(latestMatch, optionalToken.matches), 
+                                !isFirstMatch) return !0;
                                 insertStop = !0, testPos = pos;
                             }
                         } else if (match.isAlternator) {
@@ -388,10 +388,8 @@
                         } else if (match.isQuantifier && quantifierRecurse !== maskToken.matches[$.inArray(match, maskToken.matches) - 1]) for (var qt = match, qndx = ndxInitializer.length > 0 ? ndxInitializer.shift() : 0; qndx < (isNaN(qt.quantifier.max) ? qndx + 1 : qt.quantifier.max) && pos >= testPos; qndx++) {
                             var tokenGroup = maskToken.matches[$.inArray(qt, maskToken.matches) - 1];
                             if (match = handleMatch(tokenGroup, [ qndx ].concat(loopNdx), tokenGroup)) {
-                                var latestMatch = matches[matches.length - 1].match;
-                                latestMatch.optionalQuantifier = qndx > qt.quantifier.min - 1;
-                                var isFirstMatch = 0 === $.inArray(latestMatch, tokenGroup.matches);
-                                if (isFirstMatch) {
+                                if (latestMatch = matches[matches.length - 1].match, latestMatch.optionalQuantifier = qndx > qt.quantifier.min - 1, 
+                                isFirstMatch = 0 === $.inArray(latestMatch, tokenGroup.matches)) {
                                     if (qndx > qt.quantifier.min - 1) {
                                         insertStop = !0, testPos = pos;
                                         break;
@@ -409,7 +407,7 @@
                     if (testPos > pos) break;
                 }
             }
-            var maskTokens = getMaskSet().maskToken, testPos = ndxIntlzr ? tstPs : 0, ndxInitializer = ndxIntlzr || [ 0 ], matches = [], insertStop = !1;
+            var latestMatch, isFirstMatch, maskTokens = getMaskSet().maskToken, testPos = ndxIntlzr ? tstPs : 0, ndxInitializer = ndxIntlzr || [ 0 ], matches = [], insertStop = !1;
             if (cacheable === !0 && getMaskSet().tests[pos]) return getMaskSet().tests[pos];
             if (void 0 === ndxIntlzr) {
                 for (var test, previousPos = pos - 1; void 0 === (test = getMaskSet().validPositions[previousPos]) && previousPos > -1 && (!getMaskSet().tests[previousPos] || void 0 === (test = getMaskSet().tests[previousPos][0])); ) previousPos--;
@@ -439,10 +437,11 @@
             getMaskSet().buffer;
         }
         function refreshFromBuffer(start, end, buffer) {
+            var i;
             if (buffer = buffer || getBuffer().slice(), start === !0) resetMaskSet(), start = 0, 
-            end = buffer.length; else for (var i = start; end > i; i++) delete getMaskSet().validPositions[i], 
+            end = buffer.length; else for (i = start; end > i; i++) delete getMaskSet().validPositions[i], 
             delete getMaskSet().tests[i];
-            for (var i = start; end > i; i++) buffer[i] !== opts.skipOptionalPartCharacter && isValid(i, buffer[i], !0, !0);
+            for (i = start; end > i; i++) buffer[i] !== opts.skipOptionalPartCharacter && isValid(i, buffer[i], !0, !0);
         }
         function casing(elem, test) {
             switch (test.casing) {
@@ -456,7 +455,7 @@
             return elem;
         }
         function checkAlternationMatch(altArr1, altArr2) {
-            for (var altArrC = opts.greedy ? altArr2 : altArr2.slice(0, 1), isMatch = !1, alndx = 0; alndx < altArr1.length; alndx++) if (-1 != $.inArray(altArr1[alndx], altArrC)) {
+            for (var altArrC = opts.greedy ? altArr2 : altArr2.slice(0, 1), isMatch = !1, alndx = 0; alndx < altArr1.length; alndx++) if (-1 !== $.inArray(altArr1[alndx], altArrC)) {
                 isMatch = !0;
                 break;
             }
@@ -467,19 +466,19 @@
                 var rslt = !1;
                 return $.each(getTests(position), function(ndx, tst) {
                     for (var test = tst.match, loopend = c ? 1 : 0, chrs = "", i = (getBuffer(), test.cardinality); i > loopend; i--) chrs += getBufferElement(position - (i - 1));
-                    if (c && (chrs += c), rslt = null != test.fn ? test.fn.test(chrs, getMaskSet(), position, strict, opts) : c != test.def && c != opts.skipOptionalPartCharacter || "" == test.def ? !1 : {
+                    if (c && (chrs += c), rslt = null != test.fn ? test.fn.test(chrs, getMaskSet(), position, strict, opts) : c !== test.def && c !== opts.skipOptionalPartCharacter || "" === test.def ? !1 : {
                         c: test.def,
                         pos: position
                     }, rslt !== !1) {
-                        var elem = void 0 != rslt.c ? rslt.c : c;
-                        elem = elem == opts.skipOptionalPartCharacter && null === test.fn ? test.def : elem;
+                        var elem = void 0 !== rslt.c ? rslt.c : c;
+                        elem = elem === opts.skipOptionalPartCharacter && null === test.fn ? test.def : elem;
                         var validatedPos = position, possibleModifiedBuffer = getBuffer();
-                        if (void 0 != rslt.remove && ($.isArray(rslt.remove) || (rslt.remove = [ rslt.remove ]), 
+                        if (void 0 !== rslt.remove && ($.isArray(rslt.remove) || (rslt.remove = [ rslt.remove ]), 
                         $.each(rslt.remove.sort(function(a, b) {
                             return b - a;
                         }), function(ndx, lmnt) {
                             stripValidPositions(lmnt, lmnt + 1, !0);
-                        })), void 0 != rslt.insert && ($.isArray(rslt.insert) || (rslt.insert = [ rslt.insert ]), 
+                        })), void 0 !== rslt.insert && ($.isArray(rslt.insert) || (rslt.insert = [ rslt.insert ]), 
                         $.each(rslt.insert.sort(function(a, b) {
                             return a - b;
                         }), function(ndx, lmnt) {
@@ -489,7 +488,7 @@
                             if (strict = !0, refreshFromBuffer(refresh === !0 ? refresh : refresh.start, refresh.end, possibleModifiedBuffer), 
                             void 0 === rslt.pos && void 0 === rslt.c) return rslt.pos = getLastValidPosition(), 
                             !1;
-                            if (validatedPos = void 0 !== rslt.pos ? rslt.pos : position, validatedPos != position) return rslt = $.extend(rslt, isValid(validatedPos, elem, !0)), 
+                            if (validatedPos = void 0 !== rslt.pos ? rslt.pos : position, validatedPos !== position) return rslt = $.extend(rslt, isValid(validatedPos, elem, !0)), 
                             !1;
                         } else if (rslt !== !0 && void 0 !== rslt.pos && rslt.pos !== position && (validatedPos = rslt.pos, 
                         refreshFromBuffer(position, validatedPos), validatedPos !== position)) return rslt = $.extend(rslt, isValid(validatedPos, elem, !0)), 
@@ -502,7 +501,7 @@
                 }), rslt;
             }
             function alternate(pos, c, strict, fromSetValid) {
-                for (var lastAlt, alternation, isValidRslt, altPos, validPsClone = $.extend(!0, {}, getMaskSet().validPositions), lAlt = getLastValidPosition(); lAlt >= 0 && (altPos = getMaskSet().validPositions[lAlt], 
+                for (var lastAlt, alternation, isValidRslt, altPos, i, validPos, validPsClone = $.extend(!0, {}, getMaskSet().validPositions), lAlt = getLastValidPosition(); lAlt >= 0 && (altPos = getMaskSet().validPositions[lAlt], 
                 !altPos || void 0 === altPos.alternation || (lastAlt = lAlt, alternation = getMaskSet().validPositions[lastAlt].alternation, 
                 getTestTemplate(lastAlt).locator[altPos.alternation] === altPos.locator[altPos.alternation])); lAlt--) ;
                 if (void 0 !== alternation) {
@@ -518,21 +517,19 @@
                                 break;
                             }
                             if (decisionTaker !== possibilityPos.locator[alternation]) {
-                                for (var validInputs = [], staticInputsBeforePos = 0, i = decisionPos + 1; i < getLastValidPosition() + 1; i++) {
-                                    var validPos = getMaskSet().validPositions[i];
-                                    validPos && (null != validPos.match.fn ? validInputs.push(validPos.input) : pos > i && staticInputsBeforePos++), 
-                                    delete getMaskSet().validPositions[i], delete getMaskSet().tests[i];
-                                }
+                                var validInputs = [], staticInputsBeforePos = 0;
+                                for (i = decisionPos + 1; i < getLastValidPosition() + 1; i++) validPos = getMaskSet().validPositions[i], 
+                                validPos && (null != validPos.match.fn ? validInputs.push(validPos.input) : pos > i && staticInputsBeforePos++), 
+                                delete getMaskSet().validPositions[i], delete getMaskSet().tests[i];
                                 for (resetMaskSet(!0), opts.keepStatic = !opts.keepStatic, isValidRslt = !0; validInputs.length > 0; ) {
                                     var input = validInputs.shift();
                                     if (input !== opts.skipOptionalPartCharacter && !(isValidRslt = isValid(getLastValidPosition() + 1, input, !1, !0))) break;
                                 }
                                 if (possibilityPos.alternation = alternation, possibilityPos.locator[alternation] = possibilities, 
                                 isValidRslt) {
-                                    for (var targetLvp = getLastValidPosition(pos) + 1, staticInputsBeforePosAlternate = 0, i = decisionPos + 1; i < getLastValidPosition() + 1; i++) {
-                                        var validPos = getMaskSet().validPositions[i];
-                                        validPos && null == validPos.match.fn && pos > i && staticInputsBeforePosAlternate++;
-                                    }
+                                    var targetLvp = getLastValidPosition(pos) + 1, staticInputsBeforePosAlternate = 0;
+                                    for (i = decisionPos + 1; i < getLastValidPosition() + 1; i++) validPos = getMaskSet().validPositions[i], 
+                                    validPos && null == validPos.match.fn && pos > i && staticInputsBeforePosAlternate++;
                                     pos += staticInputsBeforePosAlternate - staticInputsBeforePos, isValidRslt = isValid(pos > targetLvp ? targetLvp : pos, c, strict, fromSetValid);
                                 }
                                 if (opts.keepStatic = !opts.keepStatic, isValidRslt) return isValidRslt;
@@ -691,9 +688,12 @@
             if ($input[0].inputmask && !$input.hasClass("hasDatepicker")) {
                 var umValue = [], vps = getMaskSet().validPositions;
                 for (var pndx in vps) vps[pndx].match && null != vps[pndx].match.fn && umValue.push(vps[pndx].input);
-                var unmaskedValue = (isRTL ? umValue.reverse() : umValue).join(""), bufferValue = (isRTL ? getBuffer().slice().reverse() : getBuffer()).join("");
-                return $.isFunction(opts.onUnMask) && (unmaskedValue = opts.onUnMask.call($input, bufferValue, unmaskedValue, opts) || unmaskedValue), 
-                unmaskedValue;
+                var unmaskedValue = 0 === umValue.length ? null : (isRTL ? umValue.reverse() : umValue).join("");
+                if (null !== unmaskedValue) {
+                    var bufferValue = (isRTL ? getBuffer().slice().reverse() : getBuffer()).join("");
+                    $.isFunction(opts.onUnMask) && (unmaskedValue = opts.onUnMask.call($input, bufferValue, unmaskedValue, opts) || unmaskedValue);
+                }
+                return unmaskedValue;
             }
             return $input[0].inputmask._valueGet();
         }
@@ -718,7 +718,7 @@
             if (begin = translatePosition(begin), end = translatePosition(end), end = "number" == typeof end ? end : begin, 
             $(npt).is(":visible")) {
                 var scrollCalc = $(npt).css("font-size").replace("px", "") * end;
-                if (npt.scrollLeft = scrollCalc > npt.scrollWidth ? scrollCalc : 0, androidchrome || 0 != opts.insertMode || begin != end || end++, 
+                if (npt.scrollLeft = scrollCalc > npt.scrollWidth ? scrollCalc : 0, androidchrome || opts.insertMode !== !1 || begin !== end || end++, 
                 npt.setSelectionRange) npt.selectionStart = begin, npt.selectionEnd = end; else if (window.getSelection) {
                     if (range = document.createRange(), void 0 === npt.firstChild) {
                         var textNode = document.createTextNode("");
@@ -906,17 +906,17 @@
                 pos.end = pos.begin, pos.begin = pend;
             }
             k === Inputmask.keyCode.BACKSPACE && (pos.end - pos.begin < 1 || opts.insertMode === !1) ? (pos.begin = seekPrevious(pos.begin), 
-            void 0 === getMaskSet().validPositions[pos.begin] || getMaskSet().validPositions[pos.begin].input !== opts.groupSeparator && getMaskSet().validPositions[pos.begin].input !== opts.radixPoint || pos.begin--) : k == Inputmask.keyCode.DELETE && pos.begin == pos.end && (pos.end = isMask(pos.end) ? pos.end + 1 : seekNext(pos.end) + 1, 
-            void 0 == getMaskSet().validPositions[pos.begin] || getMaskSet().validPositions[pos.begin].input != opts.groupSeparator && getMaskSet().validPositions[pos.begin].input != opts.radixPoint || pos.end++), 
+            void 0 === getMaskSet().validPositions[pos.begin] || getMaskSet().validPositions[pos.begin].input !== opts.groupSeparator && getMaskSet().validPositions[pos.begin].input !== opts.radixPoint || pos.begin--) : k === Inputmask.keyCode.DELETE && pos.begin === pos.end && (pos.end = isMask(pos.end) ? pos.end + 1 : seekNext(pos.end) + 1, 
+            void 0 === getMaskSet().validPositions[pos.begin] || getMaskSet().validPositions[pos.begin].input !== opts.groupSeparator && getMaskSet().validPositions[pos.begin].input !== opts.radixPoint || pos.end++), 
             stripValidPositions(pos.begin, pos.end, !1, strict), strict !== !0 && generalize();
             var lvp = getLastValidPosition(pos.begin);
-            lvp < pos.begin ? (-1 == lvp && resetMaskSet(), getMaskSet().p = seekNext(lvp)) : strict !== !0 && (getMaskSet().p = pos.begin);
+            lvp < pos.begin ? (-1 === lvp && resetMaskSet(), getMaskSet().p = seekNext(lvp)) : strict !== !0 && (getMaskSet().p = pos.begin);
         }
         function keydownEvent(e) {
             var input = this, $input = $(input), k = e.keyCode, pos = caret(input);
             k === Inputmask.keyCode.BACKSPACE || k === Inputmask.keyCode.DELETE || iphone && 127 === k || e.ctrlKey && 88 === k && !isInputEventSupported("cut") ? (e.preventDefault(), 
-            88 == k && (undoValue = getBuffer().join("")), handleRemove(input, k, pos), writeBuffer(input, getBuffer(), getMaskSet().p, e, undoValue != getBuffer().join("")), 
-            input.inputmask._valueGet() == getBufferTemplate().join("") ? $input.trigger("cleared") : isComplete(getBuffer()) === !0 && $input.trigger("complete"), 
+            88 === k && (undoValue = getBuffer().join("")), handleRemove(input, k, pos), writeBuffer(input, getBuffer(), getMaskSet().p, e, undoValue !== getBuffer().join("")), 
+            input.inputmask._valueGet() === getBufferTemplate().join("") ? $input.trigger("cleared") : isComplete(getBuffer()) === !0 && $input.trigger("complete"), 
             opts.showTooltip && $input.prop("title", getMaskSet().mask)) : k === Inputmask.keyCode.END || k === Inputmask.keyCode.PAGE_DOWN ? setTimeout(function() {
                 var caretPos = seekNext(getLastValidPosition());
                 opts.insertMode || caretPos !== getMaskLength() || e.shiftKey || caretPos--, caret(input, e.shiftKey ? pos.begin : caretPos, caretPos);
@@ -982,11 +982,11 @@
         }
         function pasteEvent(e) {
             var input = this, $input = $(input), inputValue = input.inputmask._valueGet(!0), caretPos = caret(input);
-            if ("propertychange" == e.type && input.inputmask._valueGet().length <= getMaskLength()) return !0;
-            if ("paste" == e.type) {
+            if ("propertychange" === e.type && input.inputmask._valueGet().length <= getMaskLength()) return !0;
+            if ("paste" === e.type) {
                 var valueBeforeCaret = inputValue.substr(0, caretPos.begin), valueAfterCaret = inputValue.substr(caretPos.end, inputValue.length);
-                valueBeforeCaret == getBufferTemplate().slice(0, caretPos.begin).join("") && (valueBeforeCaret = ""), 
-                valueAfterCaret == getBufferTemplate().slice(caretPos.end).join("") && (valueAfterCaret = ""), 
+                valueBeforeCaret === getBufferTemplate().slice(0, caretPos.begin).join("") && (valueBeforeCaret = ""), 
+                valueAfterCaret === getBufferTemplate().slice(caretPos.end).join("") && (valueAfterCaret = ""), 
                 window.clipboardData && window.clipboardData.getData ? inputValue = valueBeforeCaret + window.clipboardData.getData("Text") + valueAfterCaret : e.originalEvent && e.originalEvent.clipboardData && e.originalEvent.clipboardData.getData && (inputValue = valueBeforeCaret + e.originalEvent.clipboardData.getData("text/plain") + valueAfterCaret);
             }
             var pasteValue = inputValue;
@@ -1051,7 +1051,7 @@
                 }
             }).bind("focus.inputmask", function(e) {
                 var input = ($(this), this), nptValue = input.inputmask._valueGet();
-                opts.showMaskOnFocus && (!opts.showMaskOnHover || opts.showMaskOnHover && "" == nptValue) ? input.inputmask._valueGet() != getBuffer().join("") && writeBuffer(input, getBuffer(), seekNext(getLastValidPosition())) : mouseEnter === !1 && caret(input, seekNext(getLastValidPosition())), 
+                opts.showMaskOnFocus && (!opts.showMaskOnHover || opts.showMaskOnHover && "" === nptValue) ? input.inputmask._valueGet() !== getBuffer().join("") && writeBuffer(input, getBuffer(), seekNext(getLastValidPosition())) : mouseEnter === !1 && caret(input, seekNext(getLastValidPosition())), 
                 opts.positionCaretOnTab === !0 && setTimeout(function() {
                     caret(input, seekNext(getLastValidPosition()));
                 }, 0), undoValue = getBuffer().join("");
@@ -1059,14 +1059,14 @@
                 var $input = $(this), input = this;
                 if (mouseEnter = !1, opts.clearMaskOnLostFocus) {
                     var buffer = getBuffer().slice(), nptValue = input.inputmask._valueGet();
-                    $input.is(":focus") || nptValue == $input.attr("placeholder") || "" == nptValue || (-1 === getLastValidPosition() && nptValue === getBufferTemplate().join("") ? buffer = [] : clearOptionalTail(buffer), 
+                    $input.is(":focus") || nptValue === $input.attr("placeholder") || "" === nptValue || (-1 === getLastValidPosition() && nptValue === getBufferTemplate().join("") ? buffer = [] : clearOptionalTail(buffer), 
                     writeBuffer(input, buffer));
                 }
             }).bind("click.inputmask", function() {
                 var $input = $(this), input = this;
                 if ($input.is(":focus")) {
                     var selectedCaret = caret(input);
-                    if (selectedCaret.begin === selectedCaret.end) if (opts.radixFocus && "" != opts.radixPoint && -1 != $.inArray(opts.radixPoint, getBuffer()) && (firstClick || getBuffer().join("") == getBufferTemplate().join(""))) caret(input, $.inArray(opts.radixPoint, getBuffer())), 
+                    if (selectedCaret.begin === selectedCaret.end) if (opts.radixFocus && "" !== opts.radixPoint && -1 !== $.inArray(opts.radixPoint, getBuffer()) && (firstClick || getBuffer().join("") === getBufferTemplate().join(""))) caret(input, $.inArray(opts.radixPoint, getBuffer())), 
                     firstClick = !1; else {
                         var clickPosition = selectedCaret.begin, lastPosition = seekNext(getLastValidPosition(clickPosition));
                         lastPosition > clickPosition ? caret(input, isMask(clickPosition) ? clickPosition : seekNext(clickPosition)) : caret(input, opts.numericInput ? 0 : lastPosition);
@@ -1084,8 +1084,8 @@
                     var clipboardData = window.clipboardData || e.originalEvent.clipboardData, clipData = clipboardData.getData("text").split("").reverse().join("");
                     clipboardData.setData("text", clipData);
                 }
-                handleRemove(input, Inputmask.keyCode.DELETE, pos), writeBuffer(input, getBuffer(), getMaskSet().p, e, undoValue != getBuffer().join("")), 
-                input.inputmask._valueGet() == getBufferTemplate().join("") && $input.trigger("cleared"), 
+                handleRemove(input, Inputmask.keyCode.DELETE, pos), writeBuffer(input, getBuffer(), getMaskSet().p, e, undoValue !== getBuffer().join("")), 
+                input.inputmask._valueGet() === getBufferTemplate().join("") && $input.trigger("cleared"), 
                 opts.showTooltip && $input.prop("title", getMaskSet().mask);
             }).bind("complete.inputmask", opts.oncomplete).bind("incomplete.inputmask", opts.onincomplete).bind("cleared.inputmask", opts.oncleared), 
             $el.bind("keydown.inputmask", keydownEvent).bind("keypress.inputmask", keypressEvent), 
@@ -1094,7 +1094,7 @@
             $el.bind("setvalue.inputmask", function() {
                 var input = this, value = input.inputmask._valueGet();
                 input.inputmask._valueSet($.isFunction(opts.onBeforeMask) ? opts.onBeforeMask.call(input, value, opts) || value : value), 
-                checkVal(input, !0, !1), undoValue = getBuffer().join(""), (opts.clearMaskOnLostFocus || opts.clearIncomplete) && input.inputmask._valueGet() == getBufferTemplate().join("") && input.inputmask._valueSet("");
+                checkVal(input, !0, !1), undoValue = getBuffer().join(""), (opts.clearMaskOnLostFocus || opts.clearIncomplete) && input.inputmask._valueGet() === getBufferTemplate().join("") && input.inputmask._valueSet("");
             }), patchValueProperty(el);
             var initialValue = $.isFunction(opts.onBeforeMask) ? opts.onBeforeMask.call(el, el.inputmask._valueGet(), opts) || el.inputmask._valueGet() : el.inputmask._valueGet();
             checkVal(el, !0, !1, initialValue.split(""));
@@ -1104,25 +1104,22 @@
             try {
                 activeElement = document.activeElement;
             } catch (e) {}
-            isComplete(buffer) === !1 && opts.clearIncomplete && resetMaskSet(), opts.clearMaskOnLostFocus && (buffer.join("") == getBufferTemplate().join("") ? buffer = [] : clearOptionalTail(buffer)), 
+            isComplete(buffer) === !1 && opts.clearIncomplete && resetMaskSet(), opts.clearMaskOnLostFocus && (buffer.join("") === getBufferTemplate().join("") ? buffer = [] : clearOptionalTail(buffer)), 
             writeBuffer(el, buffer), activeElement === el && caret(el, seekNext(getLastValidPosition())), 
             installEventRuler(el);
         }
-        var undoValue, compositionCaretPos, compositionData, el, $el, maxLength, isRTL = !1, skipKeyPressEvent = !1, skipInputEvent = !1, ignorable = !1, firstClick = !0, mouseEnter = !0;
+        var undoValue, compositionCaretPos, compositionData, el, $el, maxLength, valueBuffer, isRTL = !1, skipKeyPressEvent = !1, skipInputEvent = !1, ignorable = !1, firstClick = !0, mouseEnter = !0;
         if (void 0 !== actionObj) switch (actionObj.action) {
           case "isComplete":
             return el = actionObj.el, $el = $(el), maskset = el.inputmask.maskset, opts = el.inputmask.opts, 
             isComplete(actionObj.buffer);
 
           case "unmaskedvalue":
-            if (el = actionObj.el, void 0 === el) {
-                $el = $({}), el = $el[0], el.inputmask = new Inputmask(), el.inputmask.opts = opts, 
-                el.inputmask.el = el, el.inputmask.maskset = maskset, el.inputmask.isRTL = opts.numericInput, 
-                opts.numericInput && (isRTL = !0);
-                var valueBuffer = ($.isFunction(opts.onBeforeMask) ? opts.onBeforeMask.call($el, actionObj.value, opts) || actionObj.value : actionObj.value).split("");
-                checkVal($el, !1, !1, isRTL ? valueBuffer.reverse() : valueBuffer), $.isFunction(opts.onBeforeWrite) && opts.onBeforeWrite.call(this, void 0, getBuffer(), 0, opts);
-            } else $el = $(el);
-            return maskset = el.inputmask.maskset, opts = el.inputmask.opts, isRTL = el.inputmask.isRTL, 
+            return el = actionObj.el, void 0 === el ? ($el = $({}), el = $el[0], el.inputmask = new Inputmask(), 
+            el.inputmask.opts = opts, el.inputmask.el = el, el.inputmask.maskset = maskset, 
+            el.inputmask.isRTL = opts.numericInput, opts.numericInput && (isRTL = !0), valueBuffer = ($.isFunction(opts.onBeforeMask) ? opts.onBeforeMask.call($el, actionObj.value, opts) || actionObj.value : actionObj.value).split(""), 
+            checkVal($el, !1, !1, isRTL ? valueBuffer.reverse() : valueBuffer), $.isFunction(opts.onBeforeWrite) && opts.onBeforeWrite.call(this, void 0, getBuffer(), 0, opts)) : $el = $(el), 
+            maskset = el.inputmask.maskset, opts = el.inputmask.opts, isRTL = el.inputmask.isRTL, 
             unmaskedvalue($el);
 
           case "mask":
@@ -1130,11 +1127,10 @@
             break;
 
           case "format":
-            $el = $({}), $el[0].inputmask = new Inputmask(), $el[0].inputmask.opts = opts, $el[0].inputmask.el = $el[0], 
-            $el[0].inputmask.maskset = maskset, $el[0].inputmask.isRTL = opts.numericInput, 
-            opts.numericInput && (isRTL = !0);
-            var valueBuffer = ($.isFunction(opts.onBeforeMask) ? opts.onBeforeMask.call($el, actionObj.value, opts) || actionObj.value : actionObj.value).split("");
-            return checkVal($el, !1, !1, isRTL ? valueBuffer.reverse() : valueBuffer), $.isFunction(opts.onBeforeWrite) && opts.onBeforeWrite.call(this, void 0, getBuffer(), 0, opts), 
+            return $el = $({}), $el[0].inputmask = new Inputmask(), $el[0].inputmask.opts = opts, 
+            $el[0].inputmask.el = $el[0], $el[0].inputmask.maskset = maskset, $el[0].inputmask.isRTL = opts.numericInput, 
+            opts.numericInput && (isRTL = !0), valueBuffer = ($.isFunction(opts.onBeforeMask) ? opts.onBeforeMask.call($el, actionObj.value, opts) || actionObj.value : actionObj.value).split(""), 
+            checkVal($el, !1, !1, isRTL ? valueBuffer.reverse() : valueBuffer), $.isFunction(opts.onBeforeWrite) && opts.onBeforeWrite.call(this, void 0, getBuffer(), 0, opts), 
             actionObj.metadata ? {
                 value: isRTL ? getBuffer().slice().reverse().join("") : getBuffer().join(""),
                 metadata: $el.inputmask("getmetadata")
@@ -1143,11 +1139,9 @@
           case "isValid":
             $el = $({}), $el[0].inputmask = new Inputmask(), $el[0].inputmask.opts = opts, $el[0].inputmask.el = $el[0], 
             $el[0].inputmask.maskset = maskset, $el[0].inputmask.isRTL = opts.numericInput, 
-            opts.numericInput && (isRTL = !0);
-            var valueBuffer = actionObj.value.split("");
-            checkVal($el, !1, !0, isRTL ? valueBuffer.reverse() : valueBuffer);
+            opts.numericInput && (isRTL = !0), valueBuffer = actionObj.value.split(""), checkVal($el, !1, !0, isRTL ? valueBuffer.reverse() : valueBuffer);
             for (var buffer = getBuffer(), rl = determineLastRequiredPosition(), lmib = buffer.length - 1; lmib > rl && !isMask(lmib); lmib--) ;
-            return buffer.splice(rl, lmib + 1 - rl), isComplete(buffer) && actionObj.value == buffer.join("");
+            return buffer.splice(rl, lmib + 1 - rl), isComplete(buffer) && actionObj.value === buffer.join("");
 
           case "getemptymask":
             return el = actionObj.el, $el = $(el), maskset = el.inputmask.maskset, opts = el.inputmask.opts, 
@@ -1358,9 +1352,7 @@
         UP: 38,
         WINDOWS: 91
     };
-    var ua = navigator.userAgent, iphone = null !== ua.match(new RegExp("iphone", "i")), androidchrome = (null !== ua.match(new RegExp("android.*safari.*", "i")), 
-    null !== ua.match(new RegExp("android.*chrome.*", "i"))), androidfirefox = null !== ua.match(new RegExp("android.*firefox.*", "i")), PasteEventType = (/Kindle/i.test(ua) || /Silk/i.test(ua) || /KFTT/i.test(ua) || /KFOT/i.test(ua) || /KFJWA/i.test(ua) || /KFJWI/i.test(ua) || /KFSOWI/i.test(ua) || /KFTHWA/i.test(ua) || /KFTHWI/i.test(ua) || /KFAPWA/i.test(ua) || /KFAPWI/i.test(ua), 
-    isInputEventSupported("paste") ? "paste" : isInputEventSupported("input") ? "input" : "propertychange");
+    var ua = navigator.userAgent, iphone = null !== ua.match(new RegExp("iphone", "i")), androidchrome = null !== ua.match(new RegExp("android.*chrome.*", "i")), androidfirefox = null !== ua.match(new RegExp("android.*firefox.*", "i")), PasteEventType = isInputEventSupported("paste") ? "paste" : isInputEventSupported("input") ? "input" : "propertychange";
     return window.Inputmask = Inputmask, Inputmask;
 }(jQuery), function($) {
     return void 0 === $.fn.inputmask && ($.fn.inputmask = function(fn, options) {
@@ -1496,14 +1488,14 @@
             },
             onKeyDown: function(e, buffer, caretPos, opts) {
                 var $input = $(this);
-                if (e.ctrlKey && e.keyCode == Inputmask.keyCode.RIGHT) {
+                if (e.ctrlKey && e.keyCode === Inputmask.keyCode.RIGHT) {
                     var today = new Date();
                     $input.val(today.getDate().toString() + (today.getMonth() + 1).toString() + today.getFullYear().toString()), 
                     $input.triggerHandler("setvalue.inputmask");
                 }
             },
             getFrontValue: function(mask, buffer, opts) {
-                for (var start = 0, length = 0, i = 0; i < mask.length && "2" != mask.charAt(i); i++) {
+                for (var start = 0, length = 0, i = 0; i < mask.length && "2" !== mask.charAt(i); i++) {
                     var definition = opts.definitions[mask.charAt(i)];
                     definition ? (start += length, length = definition.cardinality) : length++;
                 }
@@ -1513,7 +1505,7 @@
                 "1": {
                     validator: function(chrs, maskset, pos, strict, opts) {
                         var isValid = opts.regex.val1.test(chrs);
-                        return strict || isValid || chrs.charAt(1) != opts.separator && -1 == "-./".indexOf(chrs.charAt(1)) || !(isValid = opts.regex.val1.test("0" + chrs.charAt(0))) ? isValid : (maskset.buffer[pos - 1] = "0", 
+                        return strict || isValid || chrs.charAt(1) !== opts.separator && -1 === "-./".indexOf(chrs.charAt(1)) || !(isValid = opts.regex.val1.test("0" + chrs.charAt(0))) ? isValid : (maskset.buffer[pos - 1] = "0", 
                         {
                             refreshFromBuffer: {
                                 start: pos - 1,
@@ -1528,7 +1520,7 @@
                         validator: function(chrs, maskset, pos, strict, opts) {
                             var pchrs = chrs;
                             isNaN(maskset.buffer[pos + 1]) || (pchrs += maskset.buffer[pos + 1]);
-                            var isValid = 1 == pchrs.length ? opts.regex.val1pre.test(pchrs) : opts.regex.val1.test(pchrs);
+                            var isValid = 1 === pchrs.length ? opts.regex.val1pre.test(pchrs) : opts.regex.val1.test(pchrs);
                             if (!strict && !isValid) {
                                 if (isValid = opts.regex.val1.test(chrs + "0")) return maskset.buffer[pos] = chrs, 
                                 maskset.buffer[++pos] = "0", {
@@ -1548,9 +1540,9 @@
                 "2": {
                     validator: function(chrs, maskset, pos, strict, opts) {
                         var frontValue = opts.getFrontValue(maskset.mask, maskset.buffer, opts);
-                        -1 != frontValue.indexOf(opts.placeholder[0]) && (frontValue = "01" + opts.separator);
+                        -1 !== frontValue.indexOf(opts.placeholder[0]) && (frontValue = "01" + opts.separator);
                         var isValid = opts.regex.val2(opts.separator).test(frontValue + chrs);
-                        if (!strict && !isValid && (chrs.charAt(1) == opts.separator || -1 != "-./".indexOf(chrs.charAt(1))) && (isValid = opts.regex.val2(opts.separator).test(frontValue + "0" + chrs.charAt(0)))) return maskset.buffer[pos - 1] = "0", 
+                        if (!strict && !isValid && (chrs.charAt(1) === opts.separator || -1 !== "-./".indexOf(chrs.charAt(1))) && (isValid = opts.regex.val2(opts.separator).test(frontValue + "0" + chrs.charAt(0)))) return maskset.buffer[pos - 1] = "0", 
                         {
                             refreshFromBuffer: {
                                 start: pos - 1,
@@ -1559,9 +1551,9 @@
                             pos: pos,
                             c: chrs.charAt(0)
                         };
-                        if (opts.mask.indexOf("2") == opts.mask.length - 1 && isValid) {
+                        if (opts.mask.indexOf("2") === opts.mask.length - 1 && isValid) {
                             var dayMonthValue = maskset.buffer.join("").substr(4, 4) + chrs;
-                            if (dayMonthValue != opts.leapday) return !0;
+                            if (dayMonthValue !== opts.leapday) return !0;
                             var year = parseInt(maskset.buffer.join("").substr(0, 4), 10);
                             return year % 4 === 0 ? year % 100 === 0 ? year % 400 === 0 ? !0 : !1 : !0 : !1;
                         }
@@ -1572,8 +1564,8 @@
                         validator: function(chrs, maskset, pos, strict, opts) {
                             isNaN(maskset.buffer[pos + 1]) || (chrs += maskset.buffer[pos + 1]);
                             var frontValue = opts.getFrontValue(maskset.mask, maskset.buffer, opts);
-                            -1 != frontValue.indexOf(opts.placeholder[0]) && (frontValue = "01" + opts.separator);
-                            var isValid = 1 == chrs.length ? opts.regex.val2pre(opts.separator).test(frontValue + chrs) : opts.regex.val2(opts.separator).test(frontValue + chrs);
+                            -1 !== frontValue.indexOf(opts.placeholder[0]) && (frontValue = "01" + opts.separator);
+                            var isValid = 1 === chrs.length ? opts.regex.val2pre(opts.separator).test(frontValue + chrs) : opts.regex.val2(opts.separator).test(frontValue + chrs);
                             return strict || isValid || !(isValid = opts.regex.val2(opts.separator).test(frontValue + "0" + chrs)) ? isValid : (maskset.buffer[pos] = "0", 
                             pos++, {
                                 pos: pos
@@ -1586,7 +1578,7 @@
                     validator: function(chrs, maskset, pos, strict, opts) {
                         if (opts.isInYearRange(chrs, opts.yearrange.minyear, opts.yearrange.maxyear)) {
                             var dayMonthValue = maskset.buffer.join("").substr(0, 6);
-                            if (dayMonthValue != opts.leapday) return !0;
+                            if (dayMonthValue !== opts.leapday) return !0;
                             var year = parseInt(chrs, 10);
                             return year % 4 === 0 ? year % 100 === 0 ? year % 400 === 0 ? !0 : !1 : !0 : !1;
                         }
@@ -1623,7 +1615,7 @@
                                 if (yearPrefix = opts.determinebaseyear(opts.yearrange.minyear, opts.yearrange.maxyear, chrs).toString().slice(0, 2), 
                                 opts.isInYearRange(yearPrefix + chrs, opts.yearrange.minyear, opts.yearrange.maxyear)) {
                                     var dayMonthValue = maskset.buffer.join("").substr(0, 6);
-                                    if (dayMonthValue != opts.leapday) isValid = !0; else {
+                                    if (dayMonthValue !== opts.leapday) isValid = !0; else {
                                         var year = parseInt(chrs, 10);
                                         isValid = year % 4 === 0 ? year % 100 === 0 ? year % 400 === 0 ? !0 : !1 : !0 : !1;
                                     }
@@ -1669,7 +1661,7 @@
             leapday: "02/29/",
             onKeyDown: function(e, buffer, caretPos, opts) {
                 var $input = $(this);
-                if (e.ctrlKey && e.keyCode == Inputmask.keyCode.RIGHT) {
+                if (e.ctrlKey && e.keyCode === Inputmask.keyCode.RIGHT) {
                     var today = new Date();
                     $input.val((today.getMonth() + 1).toString() + today.getDate().toString() + today.getFullYear().toString()), 
                     $input.triggerHandler("setvalue.inputmask");
@@ -1683,7 +1675,7 @@
             leapday: "/02/29",
             onKeyDown: function(e, buffer, caretPos, opts) {
                 var $input = $(this);
-                if (e.ctrlKey && e.keyCode == Inputmask.keyCode.RIGHT) {
+                if (e.ctrlKey && e.keyCode === Inputmask.keyCode.RIGHT) {
                     var today = new Date();
                     $input.val(today.getFullYear().toString() + (today.getMonth() + 1).toString() + today.getDate().toString()), 
                     $input.triggerHandler("setvalue.inputmask");
@@ -1749,7 +1741,7 @@
             definitions: {
                 h: {
                     validator: function(chrs, maskset, pos, strict, opts) {
-                        if ("24" == opts.hourFormat && 24 == parseInt(chrs, 10)) return maskset.buffer[pos - 1] = "0", 
+                        if ("24" === opts.hourFormat && 24 === parseInt(chrs, 10)) return maskset.buffer[pos - 1] = "0", 
                         maskset.buffer[pos] = "0", {
                             refreshFromBuffer: {
                                 start: pos - 1,
@@ -1758,7 +1750,7 @@
                             c: "0"
                         };
                         var isValid = opts.regex.hrs.test(chrs);
-                        if (!strict && !isValid && (chrs.charAt(1) == opts.timeseparator || -1 != "-.:".indexOf(chrs.charAt(1))) && (isValid = opts.regex.hrs.test("0" + chrs.charAt(0)))) return maskset.buffer[pos - 1] = "0", 
+                        if (!strict && !isValid && (chrs.charAt(1) === opts.timeseparator || -1 !== "-.:".indexOf(chrs.charAt(1))) && (isValid = opts.regex.hrs.test("0" + chrs.charAt(0)))) return maskset.buffer[pos - 1] = "0", 
                         maskset.buffer[pos] = chrs.charAt(0), pos++, {
                             refreshFromBuffer: {
                                 start: pos - 2,
@@ -1769,7 +1761,7 @@
                         };
                         if (isValid && "24" !== opts.hourFormat && opts.regex.hrs24.test(chrs)) {
                             var tmp = parseInt(chrs, 10);
-                            return 24 == tmp ? (maskset.buffer[pos + 5] = "a", maskset.buffer[pos + 6] = "m") : (maskset.buffer[pos + 5] = "p", 
+                            return 24 === tmp ? (maskset.buffer[pos + 5] = "a", maskset.buffer[pos + 6] = "m") : (maskset.buffer[pos + 5] = "p", 
                             maskset.buffer[pos + 6] = "m"), tmp -= 12, 10 > tmp ? (maskset.buffer[pos] = tmp.toString(), 
                             maskset.buffer[pos - 1] = "0") : (maskset.buffer[pos] = tmp.toString().charAt(1), 
                             maskset.buffer[pos - 1] = tmp.toString().charAt(0)), {
@@ -1962,8 +1954,8 @@
             definitions: {
                 i: {
                     validator: function(chrs, maskset, pos, strict, opts) {
-                        return pos - 1 > -1 && "." != maskset.buffer[pos - 1] ? (chrs = maskset.buffer[pos - 1] + chrs, 
-                        chrs = pos - 2 > -1 && "." != maskset.buffer[pos - 2] ? maskset.buffer[pos - 2] + chrs : "0" + chrs) : chrs = "00" + chrs, 
+                        return pos - 1 > -1 && "." !== maskset.buffer[pos - 1] ? (chrs = maskset.buffer[pos - 1] + chrs, 
+                        chrs = pos - 2 > -1 && "." !== maskset.buffer[pos - 2] ? maskset.buffer[pos - 2] + chrs : "0" + chrs) : chrs = "00" + chrs, 
                         new RegExp("25[0-5]|2[0-4][0-9]|[01][0-9][0-9]").test(chrs);
                     },
                     cardinality: 1
@@ -2430,7 +2422,7 @@
             nojumpsThreshold: 1,
             onBeforeMask: function(value, opts) {
                 var processedValue = value.replace(/^0/g, "");
-                return (processedValue.indexOf(opts.countrycode) > 1 || -1 == processedValue.indexOf(opts.countrycode)) && (processedValue = "+" + opts.countrycode + processedValue), 
+                return (processedValue.indexOf(opts.countrycode) > 1 || -1 === processedValue.indexOf(opts.countrycode)) && (processedValue = "+" + opts.countrycode + processedValue), 
                 processedValue;
             }
         },
@@ -2457,7 +2449,7 @@
             definitions: {
                 r: {
                     validator: function(chrs, maskset, pos, strict, opts) {
-                        function regexToken(isGroup, isQuantifier) {
+                        function RegexToken(isGroup, isQuantifier) {
                             this.matches = [], this.isGroup = isGroup || !1, this.isQuantifier = isQuantifier || !1, 
                             this.quantifier = {
                                 min: 1,
@@ -2465,41 +2457,33 @@
                             }, this.repeaterPart = void 0;
                         }
                         function analyseRegex() {
-                            var match, m, currentToken = new regexToken(), opengroups = [];
+                            var match, m, currentToken = new RegexToken(), opengroups = [];
                             for (opts.regexTokens = []; match = opts.tokenizer.exec(opts.regex); ) switch (m = match[0], 
                             m.charAt(0)) {
                               case "(":
-                                opengroups.push(new regexToken(!0));
+                                opengroups.push(new RegexToken(!0));
                                 break;
 
                               case ")":
-                                var groupToken = opengroups.pop();
-                                opengroups.length > 0 ? opengroups[opengroups.length - 1].matches.push(groupToken) : currentToken.matches.push(groupToken);
+                                groupToken = opengroups.pop(), opengroups.length > 0 ? opengroups[opengroups.length - 1].matches.push(groupToken) : currentToken.matches.push(groupToken);
                                 break;
 
                               case "{":
                               case "+":
                               case "*":
-                                var quantifierToken = new regexToken(!1, !0);
+                                var quantifierToken = new RegexToken(!1, !0);
                                 m = m.replace(/[{}]/g, "");
-                                var mq = m.split(","), mq0 = isNaN(mq[0]) ? mq[0] : parseInt(mq[0]), mq1 = 1 == mq.length ? mq0 : isNaN(mq[1]) ? mq[1] : parseInt(mq[1]);
+                                var mq = m.split(","), mq0 = isNaN(mq[0]) ? mq[0] : parseInt(mq[0]), mq1 = 1 === mq.length ? mq0 : isNaN(mq[1]) ? mq[1] : parseInt(mq[1]);
                                 if (quantifierToken.quantifier = {
                                     min: mq0,
                                     max: mq1
                                 }, opengroups.length > 0) {
                                     var matches = opengroups[opengroups.length - 1].matches;
-                                    if (match = matches.pop(), !match.isGroup) {
-                                        var groupToken = new regexToken(!0);
-                                        groupToken.matches.push(match), match = groupToken;
-                                    }
-                                    matches.push(match), matches.push(quantifierToken);
-                                } else {
-                                    if (match = currentToken.matches.pop(), !match.isGroup) {
-                                        var groupToken = new regexToken(!0);
-                                        groupToken.matches.push(match), match = groupToken;
-                                    }
-                                    currentToken.matches.push(match), currentToken.matches.push(quantifierToken);
-                                }
+                                    match = matches.pop(), match.isGroup || (groupToken = new RegexToken(!0), groupToken.matches.push(match), 
+                                    match = groupToken), matches.push(match), matches.push(quantifierToken);
+                                } else match = currentToken.matches.pop(), match.isGroup || (groupToken = new RegexToken(!0), 
+                                groupToken.matches.push(match), match = groupToken), currentToken.matches.push(match), 
+                                currentToken.matches.push(quantifierToken);
                                 break;
 
                               default:
@@ -2512,24 +2496,24 @@
                             fromGroup && (regexPart += "(", openGroupCount++);
                             for (var mndx = 0; mndx < token.matches.length; mndx++) {
                                 var matchToken = token.matches[mndx];
-                                if (1 == matchToken.isGroup) isvalid = validateRegexToken(matchToken, !0); else if (1 == matchToken.isQuantifier) {
+                                if (matchToken.isGroup === !0) isvalid = validateRegexToken(matchToken, !0); else if (matchToken.isQuantifier === !0) {
                                     var crrntndx = $.inArray(matchToken, token.matches), matchGroup = token.matches[crrntndx - 1], regexPartBak = regexPart;
                                     if (isNaN(matchToken.quantifier.max)) {
-                                        for (;matchToken.repeaterPart && matchToken.repeaterPart != regexPart && matchToken.repeaterPart.length > regexPart.length && !(isvalid = validateRegexToken(matchGroup, !0)); ) ;
+                                        for (;matchToken.repeaterPart && matchToken.repeaterPart !== regexPart && matchToken.repeaterPart.length > regexPart.length && !(isvalid = validateRegexToken(matchGroup, !0)); ) ;
                                         isvalid = isvalid || validateRegexToken(matchGroup, !0), isvalid && (matchToken.repeaterPart = regexPart), 
                                         regexPart = regexPartBak + matchToken.quantifier.max;
                                     } else {
                                         for (var i = 0, qm = matchToken.quantifier.max - 1; qm > i && !(isvalid = validateRegexToken(matchGroup, !0)); i++) ;
                                         regexPart = regexPartBak + "{" + matchToken.quantifier.min + "," + matchToken.quantifier.max + "}";
                                     }
-                                } else if (void 0 != matchToken.matches) for (var k = 0; k < matchToken.length && !(isvalid = validateRegexToken(matchToken[k], fromGroup)); k++) ; else {
+                                } else if (void 0 !== matchToken.matches) for (var k = 0; k < matchToken.length && !(isvalid = validateRegexToken(matchToken[k], fromGroup)); k++) ; else {
                                     var testExp;
                                     if ("[" == matchToken.charAt(0)) {
                                         testExp = regexPart, testExp += matchToken;
                                         for (var j = 0; openGroupCount > j; j++) testExp += ")";
                                         var exp = new RegExp("^(" + testExp + ")$");
                                         isvalid = exp.test(bufferStr);
-                                    } else for (var l = 0, tl = matchToken.length; tl > l; l++) if ("\\" != matchToken.charAt(l)) {
+                                    } else for (var l = 0, tl = matchToken.length; tl > l; l++) if ("\\" !== matchToken.charAt(l)) {
                                         testExp = regexPart, testExp += matchToken.substr(0, l + 1), testExp = testExp.replace(/\|$/, "");
                                         for (var j = 0; openGroupCount > j; j++) testExp += ")";
                                         var exp = new RegExp("^(" + testExp + ")$");
@@ -2541,9 +2525,8 @@
                             }
                             return fromGroup && (regexPart += ")", openGroupCount--), isvalid;
                         }
-                        null == opts.regexTokens && analyseRegex();
-                        var cbuffer = maskset.buffer.slice(), regexPart = "", isValid = !1, openGroupCount = 0;
-                        cbuffer.splice(pos, 0, chrs);
+                        var groupToken, cbuffer = maskset.buffer.slice(), regexPart = "", isValid = !1, openGroupCount = 0;
+                        null === opts.regexTokens && analyseRegex(), cbuffer.splice(pos, 0, chrs);
                         for (var bufferStr = cbuffer.join(""), i = 0; i < opts.regexTokens.length; i++) {
                             var regexToken = opts.regexTokens[i];
                             if (isValid = validateRegexToken(regexToken, regexToken.isGroup)) break;

File diff suppressed because it is too large
+ 4 - 4
dist/jquery.inputmask.bundle.min.js


File diff suppressed because it is too large
+ 600 - 596
js/inputmask.date.extensions.js


+ 126 - 126
js/inputmask.extensions.js

@@ -8,130 +8,130 @@ Version: 0.0.0-dev
 Optional extensions on the jquery.inputmask base
 */
 (function($) {
-  //extra definitions
-  Inputmask.extendDefinitions({
-    'A': {
-      validator: "[A-Za-z\u0410-\u044F\u0401\u0451\u00C0-\u00FF\u00B5]",
-      cardinality: 1,
-      casing: "upper" //auto uppercasing
-    },
-    '&': { //alfanumeric uppercasing
-      validator: "[0-9A-Za-z\u0410-\u044F\u0401\u0451\u00C0-\u00FF\u00B5]",
-      cardinality: 1,
-      casing: "upper"
-    },
-    '#': { //hexadecimal
-      validator: "[0-9A-Fa-f]",
-      cardinality: 1,
-      casing: "upper"
-    }
-  });
-  Inputmask.extendAliases({
-    'url': {
-      mask: "ir",
-      placeholder: "",
-      separator: "",
-      defaultPrefix: "http://",
-      regex: {
-        urlpre1: new RegExp("[fh]"),
-        urlpre2: new RegExp("(ft|ht)"),
-        urlpre3: new RegExp("(ftp|htt)"),
-        urlpre4: new RegExp("(ftp:|http|ftps)"),
-        urlpre5: new RegExp("(ftp:/|ftps:|http:|https)"),
-        urlpre6: new RegExp("(ftp://|ftps:/|http:/|https:)"),
-        urlpre7: new RegExp("(ftp://|ftps://|http://|https:/)"),
-        urlpre8: new RegExp("(ftp://|ftps://|http://|https://)")
-      },
-      definitions: {
-        'i': {
-          validator: function(chrs, maskset, pos, strict, opts) {
-            return true;
-          },
-          cardinality: 8,
-          prevalidator: (function() {
-            var result = [],
-              prefixLimit = 8;
-            for (var i = 0; i < prefixLimit; i++) {
-              result[i] = (function() {
-                var j = i;
-                return {
-                  validator: function(chrs, maskset, pos, strict, opts) {
-                    if (opts.regex["urlpre" + (j + 1)]) {
-                      var tmp = chrs,
-                        k;
-                      if (((j + 1) - chrs.length) > 0) {
-                        tmp = maskset.buffer.join('').substring(0, ((j + 1) - chrs.length)) + "" + tmp;
-                      }
-                      var isValid = opts.regex["urlpre" + (j + 1)].test(tmp);
-                      if (!strict && !isValid) {
-                        pos = pos - j;
-                        for (k = 0; k < opts.defaultPrefix.length; k++) {
-                          maskset.buffer[pos] = opts.defaultPrefix[k];
-                          pos++;
-                        }
-                        for (k = 0; k < tmp.length - 1; k++) {
-                          maskset.buffer[pos] = tmp[k];
-                          pos++;
-                        }
-                        return {
-                          "pos": pos
-                        };
-                      }
-                      return isValid;
-                    } else {
-                      return false;
-                    }
-                  },
-                  cardinality: j
-                };
-              })();
-            }
-            return result;
-          })()
-        },
-        "r": {
-          validator: ".",
-          cardinality: 50
-        }
-      },
-      insertMode: false,
-      autoUnmask: false
-    },
-    "ip": { //ip-address mask
-      mask: "i[i[i]].i[i[i]].i[i[i]].i[i[i]]",
-      definitions: {
-        'i': {
-          validator: function(chrs, maskset, pos, strict, opts) {
-            if (pos - 1 > -1 && maskset.buffer[pos - 1] != ".") {
-              chrs = maskset.buffer[pos - 1] + chrs;
-              if (pos - 2 > -1 && maskset.buffer[pos - 2] != ".") {
-                chrs = maskset.buffer[pos - 2] + chrs;
-              } else chrs = "0" + chrs;
-            } else chrs = "00" + chrs;
-            return new RegExp("25[0-5]|2[0-4][0-9]|[01][0-9][0-9]").test(chrs);
-          },
-          cardinality: 1
-        }
-      }
-    },
-    "email": {
-      mask: "*{1,64}[.*{1,64}][.*{1,64}][.*{1,64}]@*{1,64}[.*{2,64}][.*{2,6}][.*{1,2}]",
-      greedy: false,
-      onBeforePaste: function(pastedValue, opts) {
-        pastedValue = pastedValue.toLowerCase();
-        return pastedValue.replace("mailto:", "");
-      },
-      definitions: {
-        '*': {
-          validator: "[0-9A-Za-z!#$%&'*+/=?^_`{|}~\-]",
-          cardinality: 1,
-          casing: "lower"
-        }
-      }
-    },
-    "mac": {
-      mask: "##:##:##:##:##:##"
-    }
-  });
-  return Inputmask;
+	//extra definitions
+	Inputmask.extendDefinitions({
+		"A": {
+			validator: "[A-Za-z\u0410-\u044F\u0401\u0451\u00C0-\u00FF\u00B5]",
+			cardinality: 1,
+			casing: "upper" //auto uppercasing
+		},
+		"&": { //alfanumeric uppercasing
+			validator: "[0-9A-Za-z\u0410-\u044F\u0401\u0451\u00C0-\u00FF\u00B5]",
+			cardinality: 1,
+			casing: "upper"
+		},
+		"#": { //hexadecimal
+			validator: "[0-9A-Fa-f]",
+			cardinality: 1,
+			casing: "upper"
+		}
+	});
+	Inputmask.extendAliases({
+		"url": {
+			mask: "ir",
+			placeholder: "",
+			separator: "",
+			defaultPrefix: "http://",
+			regex: {
+				urlpre1: new RegExp("[fh]"),
+				urlpre2: new RegExp("(ft|ht)"),
+				urlpre3: new RegExp("(ftp|htt)"),
+				urlpre4: new RegExp("(ftp:|http|ftps)"),
+				urlpre5: new RegExp("(ftp:/|ftps:|http:|https)"),
+				urlpre6: new RegExp("(ftp://|ftps:/|http:/|https:)"),
+				urlpre7: new RegExp("(ftp://|ftps://|http://|https:/)"),
+				urlpre8: new RegExp("(ftp://|ftps://|http://|https://)")
+			},
+			definitions: {
+				"i": {
+					validator: function(chrs, maskset, pos, strict, opts) {
+						return true;
+					},
+					cardinality: 8,
+					prevalidator: (function() {
+						var result = [],
+							prefixLimit = 8;
+						for (var i = 0; i < prefixLimit; i++) {
+							result[i] = (function() {
+								var j = i;
+								return {
+									validator: function(chrs, maskset, pos, strict, opts) {
+										if (opts.regex["urlpre" + (j + 1)]) {
+											var tmp = chrs,
+												k;
+											if (((j + 1) - chrs.length) > 0) {
+												tmp = maskset.buffer.join('').substring(0, ((j + 1) - chrs.length)) + "" + tmp;
+											}
+											var isValid = opts.regex["urlpre" + (j + 1)].test(tmp);
+											if (!strict && !isValid) {
+												pos = pos - j;
+												for (k = 0; k < opts.defaultPrefix.length; k++) {
+													maskset.buffer[pos] = opts.defaultPrefix[k];
+													pos++;
+												}
+												for (k = 0; k < tmp.length - 1; k++) {
+													maskset.buffer[pos] = tmp[k];
+													pos++;
+												}
+												return {
+													"pos": pos
+												};
+											}
+											return isValid;
+										} else {
+											return false;
+										}
+									},
+									cardinality: j
+								};
+							})();
+						}
+						return result;
+					})()
+				},
+				"r": {
+					validator: ".",
+					cardinality: 50
+				}
+			},
+			insertMode: false,
+			autoUnmask: false
+		},
+		"ip": { //ip-address mask
+			mask: "i[i[i]].i[i[i]].i[i[i]].i[i[i]]",
+			definitions: {
+				"i": {
+					validator: function(chrs, maskset, pos, strict, opts) {
+						if (pos - 1 > -1 && maskset.buffer[pos - 1] !== ".") {
+							chrs = maskset.buffer[pos - 1] + chrs;
+							if (pos - 2 > -1 && maskset.buffer[pos - 2] !== ".") {
+								chrs = maskset.buffer[pos - 2] + chrs;
+							} else chrs = "0" + chrs;
+						} else chrs = "00" + chrs;
+						return new RegExp("25[0-5]|2[0-4][0-9]|[01][0-9][0-9]").test(chrs);
+					},
+					cardinality: 1
+				}
+			}
+		},
+		"email": {
+			mask: "*{1,64}[.*{1,64}][.*{1,64}][.*{1,64}]@*{1,64}[.*{2,64}][.*{2,6}][.*{1,2}]",
+			greedy: false,
+			onBeforePaste: function(pastedValue, opts) {
+				pastedValue = pastedValue.toLowerCase();
+				return pastedValue.replace("mailto:", "");
+			},
+			definitions: {
+				"*": {
+					validator: "[0-9A-Za-z!#$%&'*+/=?^_`{|}~\-]",
+					cardinality: 1,
+					casing: "lower"
+				}
+			}
+		},
+		"mac": {
+			mask: "##:##:##:##:##:##"
+		}
+	});
+	return Inputmask;
 })(jQuery);

+ 80 - 71
js/inputmask.js

@@ -117,11 +117,12 @@
 			return el;
 		},
 		unmaskedvalue: function() {
-			if (this.el)
+			if (this.el) {
 				return maskScope({
 					"action": "unmaskedvalue",
 					"el": this.el
 				});
+			}
 		},
 		remove: function() {
 			if (this.el) {
@@ -134,29 +135,32 @@
 			}
 		},
 		getemptymask: function() { //return the default (empty) mask value, usefull for setting the default value in validation
-			if (this.el)
+			if (this.el) {
 				return maskScope({
 					"action": "getemptymask",
 					"el": this.el
 				});
+			}
 		},
 		hasMaskedValue: function() { //check wheter the returned value is masked or not; currently only works reliable when using jquery.val fn to retrieve the value
 			return !this.opts.autoUnmask;
 		},
 		isComplete: function() {
-			if (this.el)
+			if (this.el) {
 				return maskScope({
 					"action": "isComplete",
 					"buffer": this.el.inputmask._valueGet().split(""),
 					"el": this.el
 				});
+			}
 		},
 		getmetadata: function() { //return mask metadata if exists
-			if (this.el)
+			if (this.el) {
 				return maskScope({
 					"action": "getmetadata",
 					"el": this.el
 				});
+			}
 		}
 	};
 
@@ -267,9 +271,9 @@
 			$.extend(true, opts, options); //reapply extra given options
 			return true;
 		} else //alias not found - try as mask
-		if (opts.mask === undefined)
+		if (opts.mask === undefined) {
 			opts.mask = aliasStr;
-
+		}
 
 		return false;
 	}
@@ -286,12 +290,11 @@
 					userOptions[option] = optionData.replace(/[\s[\]]/g, "").split(",");
 					userOptions[option][0] = userOptions[option][0].replace("'", "");
 					userOptions[option][userOptions[option].length - 1] = userOptions[option][userOptions[option].length - 1].replace("'", "");
-				} else
-					userOptions[option] = optionData;
+				} else userOptions[option] = optionData;
 			}
 		}
 
-		if (attrOptions && attrOptions !== "")
+		if (attrOptions && attrOptions !== "") {
 			try {
 				attrOptions = attrOptions.replace(new RegExp("'", "g"), '"');
 				var dataoptions = $.parseJSON("{" + attrOptions + "}");
@@ -299,7 +302,7 @@
 			} catch (ex) {
 
 			} //need a more relax parseJSON
-
+		}
 		for (var option in opts) {
 			importOption(option);
 		}
@@ -659,11 +662,11 @@
 
 	var ua = navigator.userAgent,
 		iphone = ua.match(new RegExp("iphone", "i")) !== null,
-		android = ua.match(new RegExp("android.*safari.*", "i")) !== null,
+		// android = ua.match(new RegExp("android.*safari.*", "i")) !== null,
 		androidchrome = ua.match(new RegExp("android.*chrome.*", "i")) !== null,
 		androidfirefox = ua.match(new RegExp("android.*firefox.*", "i")) !== null,
-		kindle = /Kindle/i.test(ua) || /Silk/i.test(ua) || /KFTT/i.test(ua) || /KFOT/i.test(ua) || /KFJWA/i.test(ua) || /KFJWI/i.test(ua) || /KFSOWI/i.test(ua) || /KFTHWA/i.test(ua) || /KFTHWI/i.test(ua) || /KFAPWA/i.test(ua) || /KFAPWI/i.test(ua),
-		PasteEventType = isInputEventSupported('paste') ? 'paste' : isInputEventSupported('input') ? 'input' : "propertychange";
+		// kindle = /Kindle/i.test(ua) || /Silk/i.test(ua) || /KFTT/i.test(ua) || /KFOT/i.test(ua) || /KFJWA/i.test(ua) || /KFJWI/i.test(ua) || /KFSOWI/i.test(ua) || /KFTHWA/i.test(ua) || /KFTHWI/i.test(ua) || /KFAPWA/i.test(ua) || /KFAPWI/i.test(ua),
+		PasteEventType = isInputEventSupported("paste") ? "paste" : isInputEventSupported("input") ? "input" : "propertychange";
 
 	//if (androidchrome) {
 	//		var browser = navigator.userAgent.match(new RegExp("chrome.*", "i")),
@@ -881,7 +884,8 @@
 				testPos = ndxIntlzr ? tstPs : 0,
 				ndxInitializer = ndxIntlzr || [0],
 				matches = [],
-				insertStop = false;
+				insertStop = false,
+				latestMatch, isFirstMatch;
 
 			function resolveTestFromToken(maskToken, ndxInitializer, loopNdx, quantifierRecurse) { //ndxInitilizer contains a set of indexes to speedup searches in the mtokens
 				function handleMatch(match, loopNdx, quantifierRecurse) {
@@ -897,14 +901,14 @@
 						return true;
 					} else if (match.matches !== undefined) {
 						if (match.isGroup && quantifierRecurse !== match) { //when a group pass along to the quantifier
-							match = handleMatch(maskToken.matches[tndx + 1], loopNdx);
+							match = handleMatch(maskToken.matches[$.inArray(match, maskToken.matches) + 1], loopNdx);
 							if (match) return true;
 						} else if (match.isOptional) {
 							var optionalToken = match;
 							match = resolveTestFromToken(match, ndxInitializer, loopNdx, quantifierRecurse);
 							if (match) {
-								var latestMatch = matches[matches.length - 1].match;
-								var isFirstMatch = $.inArray(latestMatch, optionalToken.matches) === 0;
+								latestMatch = matches[matches.length - 1].match;
+								isFirstMatch = $.inArray(latestMatch, optionalToken.matches) === 0;
 								if (isFirstMatch) {
 									insertStop = true; //insert a stop
 									testPos = pos; //match the position after the group
@@ -1005,9 +1009,9 @@
 								match = handleMatch(tokenGroup, [qndx].concat(loopNdx), tokenGroup); //set the tokenGroup as quantifierRecurse marker
 								if (match) {
 									//get latest match
-									var latestMatch = matches[matches.length - 1].match;
+									latestMatch = matches[matches.length - 1].match;
 									latestMatch.optionalQuantifier = qndx > (qt.quantifier.min - 1);
-									var isFirstMatch = $.inArray(latestMatch, tokenGroup.matches) === 0;
+									isFirstMatch = $.inArray(latestMatch, tokenGroup.matches) === 0;
 
 									if (isFirstMatch) { //search for next possible match
 										if (qndx > (qt.quantifier.min - 1)) {
@@ -1097,19 +1101,20 @@
 		}
 
 		function refreshFromBuffer(start, end, buffer) {
+			var i;
 			buffer = buffer || getBuffer().slice(); //pass or work on clone
 			if (start === true) {
 				resetMaskSet();
 				start = 0;
 				end = buffer.length;
 			} else {
-				for (var i = start; i < end; i++) {
+				for (i = start; i < end; i++) {
 					delete getMaskSet().validPositions[i];
 					delete getMaskSet().tests[i];
 				}
 			}
 
-			for (var i = start; i < end; i++) {
+			for (i = start; i < end; i++) {
 				if (buffer[i] !== opts.skipOptionalPartCharacter) {
 					isValid(i, buffer[i], true, true);
 				}
@@ -1133,7 +1138,7 @@
 			var altArrC = opts.greedy ? altArr2 : altArr2.slice(0, 1),
 				isMatch = false;
 			for (var alndx = 0; alndx < altArr1.length; alndx++) {
-				if ($.inArray(altArr1[alndx], altArrC) != -1) {
+				if ($.inArray(altArr1[alndx], altArrC) !== -1) {
 					isMatch = true;
 					break;
 				}
@@ -1161,28 +1166,28 @@
 
 					//return is false or a json object => { pos: ??, c: ??} or true
 					rslt = test.fn != null ?
-						test.fn.test(chrs, getMaskSet(), position, strict, opts) : (c == test.def || c == opts.skipOptionalPartCharacter) && test.def != "" ? //non mask
+						test.fn.test(chrs, getMaskSet(), position, strict, opts) : (c === test.def || c === opts.skipOptionalPartCharacter) && test.def !== "" ? //non mask
 						{
 							c: test.def,
 							pos: position
 						} : false;
 
 					if (rslt !== false) {
-						var elem = rslt.c != undefined ? rslt.c : c;
-						elem = (elem == opts.skipOptionalPartCharacter && test.fn === null) ? test.def : elem;
+						var elem = rslt.c !== undefined ? rslt.c : c;
+						elem = (elem === opts.skipOptionalPartCharacter && test.fn === null) ? test.def : elem;
 
 						var validatedPos = position,
 							possibleModifiedBuffer = getBuffer();
 
-						if (rslt["remove"] != undefined) { //remove position(s)
-							if (!$.isArray(rslt["remove"])) rslt["remove"] = [rslt["remove"]];
-							$.each(rslt["remove"].sort(function(a, b) {
+						if (rslt.remove !== undefined) { //remove position(s)
+							if (!$.isArray(rslt.remove)) rslt.remove = [rslt.remove];
+							$.each(rslt.remove.sort(function(a, b) {
 								return b - a;
 							}), function(ndx, lmnt) {
 								stripValidPositions(lmnt, lmnt + 1, true);
 							});
 						}
-						if (rslt.insert != undefined) { //insert position(s)
+						if (rslt.insert !== undefined) { //insert position(s)
 							if (!$.isArray(rslt.insert)) rslt.insert = [rslt.insert];
 							$.each(rslt.insert.sort(function(a, b) {
 								return a - b;
@@ -1200,7 +1205,7 @@
 								return false; //breakout if refreshFromBuffer && nothing to insert
 							}
 							validatedPos = rslt.pos !== undefined ? rslt.pos : position;
-							if (validatedPos != position) {
+							if (validatedPos !== position) {
 								rslt = $.extend(rslt, isValid(validatedPos, elem, true)); //revalidate new position strict
 								return false;
 							}
@@ -1238,7 +1243,7 @@
 					lastAlt,
 					alternation,
 					isValidRslt,
-					altPos;
+					altPos, i, validPos;
 				//find last modified alternation
 				for (var lAlt = getLastValidPosition(); lAlt >= 0; lAlt--) {
 					altPos = getMaskSet().validPositions[lAlt];
@@ -1278,8 +1283,8 @@
 									if (decisionTaker !== possibilityPos.locator[alternation]) {
 										var validInputs = [],
 											staticInputsBeforePos = 0;
-										for (var i = decisionPos + 1; i < getLastValidPosition() + 1; i++) {
-											var validPos = getMaskSet().validPositions[i];
+										for (i = decisionPos + 1; i < getLastValidPosition() + 1; i++) {
+											validPos = getMaskSet().validPositions[i];
 											if (validPos) {
 												if (validPos.match.fn != null) {
 													validInputs.push(validPos.input);
@@ -1306,8 +1311,8 @@
 										if (isValidRslt) {
 											var targetLvp = getLastValidPosition(pos) + 1;
 											var staticInputsBeforePosAlternate = 0;
-											for (var i = decisionPos + 1; i < getLastValidPosition() + 1; i++) {
-												var validPos = getMaskSet().validPositions[i];
+											for (i = decisionPos + 1; i < getLastValidPosition() + 1; i++) {
+												validPos = getMaskSet().validPositions[i];
 												if (validPos && validPos.match.fn == null && i < pos)
 													staticInputsBeforePosAlternate++;
 											}
@@ -1534,9 +1539,13 @@
 		}
 
 		function checkVal(input, writeOut, strict, nptvl) {
+			var inputValue = nptvl !== undefined ? nptvl.slice() : input.inputmask._valueGet().split(''),
+				charCodes = "",
+				initialNdx = 0;
+
 			function isTemplateMatch() {
 				var isMatch = false;
-				var charCodeNdx = getBufferTemplate().slice(initialNdx, seekNext(initialNdx)).join('').indexOf(charCodes);
+				var charCodeNdx = getBufferTemplate().slice(initialNdx, seekNext(initialNdx)).join("").indexOf(charCodes);
 				if (charCodeNdx !== -1 && !isMask(initialNdx)) {
 					isMatch = true;
 					var bufferTemplateArr = getBufferTemplate().slice(initialNdx, initialNdx + charCodeNdx);
@@ -1550,9 +1559,6 @@
 
 				return isMatch;
 			}
-			var inputValue = nptvl !== undefined ? nptvl.slice() : input.inputmask._valueGet().split(''),
-				charCodes = "",
-				initialNdx = 0;
 			resetMaskSet();
 			getMaskSet().p = seekNext(-1);
 			if (writeOut) input.inputmask._valueSet(""); //initial clear
@@ -1601,10 +1607,12 @@
 						umValue.push(vps[pndx].input);
 					}
 				}
-				var unmaskedValue = (isRTL ? umValue.reverse() : umValue).join('');
-				var bufferValue = (isRTL ? getBuffer().slice().reverse() : getBuffer()).join('');
-				if ($.isFunction(opts.onUnMask)) {
-					unmaskedValue = (opts.onUnMask.call($input, bufferValue, unmaskedValue, opts) || unmaskedValue);
+				var unmaskedValue = umValue.length === 0 ? null : (isRTL ? umValue.reverse() : umValue).join("");
+				if (unmaskedValue !== null) {
+					var bufferValue = (isRTL ? getBuffer().slice().reverse() : getBuffer()).join("");
+					if ($.isFunction(opts.onUnMask)) {
+						unmaskedValue = (opts.onUnMask.call($input, bufferValue, unmaskedValue, opts) || unmaskedValue);
+					}
 				}
 				return unmaskedValue;
 			} else {
@@ -1632,7 +1640,7 @@
 
 				var scrollCalc = $(npt).css("font-size").replace("px", "") * end;
 				npt.scrollLeft = scrollCalc > npt.scrollWidth ? scrollCalc : 0;
-				if (!androidchrome && opts.insertMode == false && begin == end) end++; //set visualization for insert/overwrite mode
+				if (!androidchrome && opts.insertMode === false && begin === end) end++; //set visualization for insert/overwrite mode
 				if (npt.setSelectionRange) {
 					npt.selectionStart = begin;
 					npt.selectionEnd = end;
@@ -1978,9 +1986,9 @@
 				if (getMaskSet().validPositions[pos.begin] !== undefined && (getMaskSet().validPositions[pos.begin].input === opts.groupSeparator || getMaskSet().validPositions[pos.begin].input === opts.radixPoint)) {
 					pos.begin--;
 				}
-			} else if (k == Inputmask.keyCode.DELETE && pos.begin == pos.end) {
+			} else if (k === Inputmask.keyCode.DELETE && pos.begin === pos.end) {
 				pos.end = isMask(pos.end) ? pos.end + 1 : seekNext(pos.end) + 1;
-				if (getMaskSet().validPositions[pos.begin] != undefined && (getMaskSet().validPositions[pos.begin].input == opts.groupSeparator || getMaskSet().validPositions[pos.begin].input == opts.radixPoint)) {
+				if (getMaskSet().validPositions[pos.begin] !== undefined && (getMaskSet().validPositions[pos.begin].input === opts.groupSeparator || getMaskSet().validPositions[pos.begin].input === opts.radixPoint)) {
 					pos.end++;
 				}
 			}
@@ -1991,7 +1999,7 @@
 
 			var lvp = getLastValidPosition(pos.begin);
 			if (lvp < pos.begin) {
-				if (lvp == -1) resetMaskSet();
+				if (lvp === -1) resetMaskSet();
 				getMaskSet().p = seekNext(lvp);
 			} else if (strict !== true) {
 				getMaskSet().p = pos.begin;
@@ -2007,10 +2015,10 @@
 			//backspace, delete, and escape get special treatment
 			if (k === Inputmask.keyCode.BACKSPACE || k === Inputmask.keyCode.DELETE || (iphone && k === 127) || (e.ctrlKey && k === 88 && !isInputEventSupported("cut"))) { //backspace/delete
 				e.preventDefault(); //stop default action but allow propagation
-				if (k == 88) undoValue = getBuffer().join('');
+				if (k === 88) undoValue = getBuffer().join('');
 				handleRemove(input, k, pos);
-				writeBuffer(input, getBuffer(), getMaskSet().p, e, undoValue != getBuffer().join(''));
-				if (input.inputmask._valueGet() == getBufferTemplate().join(''))
+				writeBuffer(input, getBuffer(), getMaskSet().p, e, undoValue !== getBuffer().join(''));
+				if (input.inputmask._valueGet() === getBufferTemplate().join(''))
 					$input.trigger('cleared');
 				else if (isComplete(getBuffer()) === true)
 					$input.trigger("complete");
@@ -2174,14 +2182,14 @@
 				inputValue = input.inputmask._valueGet(true),
 				caretPos = caret(input);
 			//paste event for IE8 and lower I guess ;-)
-			if (e.type == "propertychange" && input.inputmask._valueGet().length <= getMaskLength()) {
+			if (e.type === "propertychange" && input.inputmask._valueGet().length <= getMaskLength()) {
 				return true;
-			} else if (e.type == "paste") {
+			} else if (e.type === "paste") {
 				var valueBeforeCaret = inputValue.substr(0, caretPos.begin),
 					valueAfterCaret = inputValue.substr(caretPos.end, inputValue.length);
 
-				if (valueBeforeCaret == getBufferTemplate().slice(0, caretPos.begin).join('')) valueBeforeCaret = "";
-				if (valueAfterCaret == getBufferTemplate().slice(caretPos.end).join('')) valueAfterCaret = "";
+				if (valueBeforeCaret === getBufferTemplate().slice(0, caretPos.begin).join("")) valueBeforeCaret = "";
+				if (valueAfterCaret === getBufferTemplate().slice(caretPos.end).join("")) valueAfterCaret = "";
 
 				if (window.clipboardData && window.clipboardData.getData) { // IE
 					inputValue = valueBeforeCaret + window.clipboardData.getData('Text') + valueAfterCaret;
@@ -2339,8 +2347,8 @@
 					var $input = $(this),
 						input = this,
 						nptValue = input.inputmask._valueGet();
-					if (opts.showMaskOnFocus && (!opts.showMaskOnHover || (opts.showMaskOnHover && nptValue == ''))) {
-						if (input.inputmask._valueGet() != getBuffer().join('')) {
+					if (opts.showMaskOnFocus && (!opts.showMaskOnHover || (opts.showMaskOnHover && nptValue === ""))) {
+						if (input.inputmask._valueGet() !== getBuffer().join("")) {
 							writeBuffer(input, getBuffer(), seekNext(getLastValidPosition()));
 						}
 					} else if (mouseEnter === false) { //only executed on focus without mouseenter
@@ -2359,8 +2367,8 @@
 					if (opts.clearMaskOnLostFocus) {
 						var buffer = getBuffer().slice(),
 							nptValue = input.inputmask._valueGet();
-						if (!$input.is(":focus") && nptValue != $input.attr("placeholder") && nptValue != '') {
-							if (getLastValidPosition() === -1 && nptValue === getBufferTemplate().join(''))
+						if (!$input.is(":focus") && nptValue !== $input.attr("placeholder") && nptValue !== "") {
+							if (getLastValidPosition() === -1 && nptValue === getBufferTemplate().join(""))
 								buffer = [];
 							else { //clearout optional tail of the mask
 								clearOptionalTail(buffer);
@@ -2374,7 +2382,7 @@
 					if ($input.is(":focus")) {
 						var selectedCaret = caret(input);
 						if (selectedCaret.begin === selectedCaret.end) {
-							if (opts.radixFocus && opts.radixPoint != "" && $.inArray(opts.radixPoint, getBuffer()) != -1 && (firstClick || getBuffer().join('') == getBufferTemplate().join(''))) {
+							if (opts.radixFocus && opts.radixPoint !== "" && $.inArray(opts.radixPoint, getBuffer()) !== -1 && (firstClick || getBuffer().join("") === getBufferTemplate().join(""))) {
 								caret(input, $.inArray(opts.radixPoint, getBuffer()));
 								firstClick = false;
 							} else {
@@ -2407,9 +2415,9 @@
 						clipboardData.setData("text", clipData);
 					}
 					handleRemove(input, Inputmask.keyCode.DELETE, pos);
-					writeBuffer(input, getBuffer(), getMaskSet().p, e, undoValue != getBuffer().join(''));
+					writeBuffer(input, getBuffer(), getMaskSet().p, e, undoValue !== getBuffer().join(""));
 
-					if (input.inputmask._valueGet() == getBufferTemplate().join(''))
+					if (input.inputmask._valueGet() === getBufferTemplate().join(''))
 						$input.trigger("cleared");
 
 					if (opts.showTooltip) { //update tooltip
@@ -2438,7 +2446,7 @@
 				input.inputmask._valueSet($.isFunction(opts.onBeforeMask) ? (opts.onBeforeMask.call(input, value, opts) || value) : value);
 				checkVal(input, true, false);
 				undoValue = getBuffer().join('');
-				if ((opts.clearMaskOnLostFocus || opts.clearIncomplete) && input.inputmask._valueGet() == getBufferTemplate().join(''))
+				if ((opts.clearMaskOnLostFocus || opts.clearIncomplete) && input.inputmask._valueGet() === getBufferTemplate().join(''))
 					input.inputmask._valueSet('');
 			});
 
@@ -2459,7 +2467,7 @@
 					resetMaskSet();
 			}
 			if (opts.clearMaskOnLostFocus) {
-				if (buffer.join('') == getBufferTemplate().join('')) {
+				if (buffer.join("") === getBufferTemplate().join("")) {
 					buffer = [];
 				} else {
 					clearOptionalTail(buffer);
@@ -2474,8 +2482,9 @@
 		}
 
 		//action object
+		var valueBuffer;
 		if (actionObj !== undefined) {
-			switch (actionObj["action"]) {
+			switch (actionObj.action) {
 				case "isComplete":
 					el = actionObj.el;
 					$el = $(el);
@@ -2498,9 +2507,9 @@
 						if (opts.numericInput) {
 							isRTL = true;
 						}
-						var valueBuffer = ($.isFunction(opts.onBeforeMask) ? (opts.onBeforeMask.call($el, actionObj.value, opts) || actionObj.value) : actionObj.value).split('');
+						valueBuffer = ($.isFunction(opts.onBeforeMask) ? (opts.onBeforeMask.call($el, actionObj.value, opts) || actionObj.value) : actionObj.value).split('');
 						checkVal($el, false, false, isRTL ? valueBuffer.reverse() : valueBuffer);
-						$.isFunction(opts.onBeforeWrite) && opts.onBeforeWrite.call(this, undefined, getBuffer(), 0, opts);
+						if ($.isFunction(opts.onBeforeWrite)) opts.onBeforeWrite.call(this, undefined, getBuffer(), 0, opts);
 					} else $el = $(el);
 					maskset = el.inputmask.maskset;
 					opts = el.inputmask.opts;
@@ -2522,15 +2531,15 @@
 					if (opts.numericInput) {
 						isRTL = true;
 					}
-					var valueBuffer = ($.isFunction(opts.onBeforeMask) ? (opts.onBeforeMask.call($el, actionObj.value, opts) || actionObj.value) : actionObj.value).split('');
+					valueBuffer = ($.isFunction(opts.onBeforeMask) ? (opts.onBeforeMask.call($el, actionObj.value, opts) || actionObj.value) : actionObj.value).split('');
 					checkVal($el, false, false, isRTL ? valueBuffer.reverse() : valueBuffer);
-					$.isFunction(opts.onBeforeWrite) && opts.onBeforeWrite.call(this, undefined, getBuffer(), 0, opts);
+					if ($.isFunction(opts.onBeforeWrite)) opts.onBeforeWrite.call(this, undefined, getBuffer(), 0, opts);
 
 					if (actionObj.metadata) {
 						return {
 							value: isRTL ? getBuffer().slice().reverse().join('') : getBuffer().join(''),
 							metadata: $el.inputmask("getmetadata")
-						}
+						};
 					}
 
 					return isRTL ? getBuffer().slice().reverse().join("") : getBuffer().join("");
@@ -2546,7 +2555,7 @@
 					if (opts.numericInput) {
 						isRTL = true;
 					}
-					var valueBuffer = actionObj.value.split('');
+					valueBuffer = actionObj.value.split('');
 					checkVal($el, false, true, isRTL ? valueBuffer.reverse() : valueBuffer);
 					var buffer = getBuffer();
 					var rl = determineLastRequiredPosition(),
@@ -2556,7 +2565,7 @@
 					}
 					buffer.splice(rl, lmib + 1 - rl);
 
-					return isComplete(buffer) && actionObj.value == buffer.join('');
+					return isComplete(buffer) && actionObj.value === buffer.join('');
 				case "getemptymask":
 					el = actionObj.el;
 					$el = $(el);

+ 6 - 5
js/inputmask.numeric.extensions.js

@@ -24,11 +24,11 @@ Optional extensions on the jquery.inputmask base
 				}
 				opts.repeat = 0;
 				if (opts.groupSeparator === opts.radixPoint) { //treat equal separator and radixpoint
-					if (opts.radixPoint === ".")
+					if (opts.radixPoint === ".") {
 						opts.groupSeparator = ",";
-					else if (opts.radixPoint === ",")
+					} else if (opts.radixPoint === ",") {
 						opts.groupSeparator = ".";
-					else opts.groupSeparator = "";
+					} else opts.groupSeparator = "";
 				}
 				if (opts.groupSeparator === " ") { //prevent conflict with default skipOptionalPartCharacter
 					opts.skipOptionalPartCharacter = undefined;
@@ -47,8 +47,9 @@ Optional extensions on the jquery.inputmask base
 				}
 
 				//enforce placeholder to single
-				if (opts.placeholder.length > 1)
+				if (opts.placeholder.length > 1) {
 					opts.placeholder = opts.placeholder.charAt(0);
+				}
 				//only allow radixfocus when placeholder = 0  ???? why was this needed????
 				// opts.radixFocus = opts.radixFocus && opts.placeholder == "0";
 
@@ -177,7 +178,7 @@ Optional extensions on the jquery.inputmask base
 						buffer.push(opts.suffix.charAt(i));
 					}
 				}
-				//console.log("formatted " + buffer + " refresh " + needsRefresh);
+				// console.log("formatted " + buffer + " refresh " + needsRefresh);
 				return {
 					pos: (opts.numericInput && isFinite(pos)) ? buffer.join('').length - newPos - 1 : newPos,
 					"refreshFromBuffer": needsRefresh,

+ 6 - 7
js/inputmask.phone.extensions.js

@@ -19,16 +19,16 @@ When using this extension make sure you specify the correct url to get the masks
 */
 (function($) {
 	Inputmask.extendAliases({
-		'phone': {
+		"phone": {
 			url: "phone-codes/phone-codes.js",
 			countrycode: "",
 			mask: function(opts) {
-				opts.definitions['#'] = opts.definitions['9'];
+				opts.definitions["#"] = opts.definitions["9"];
 				var maskList = [];
 				$.ajax({
 					url: opts.url,
 					async: false,
-					dataType: 'json',
+					dataType: "json",
 					success: function(response) {
 						maskList = response;
 					},
@@ -38,7 +38,7 @@ When using this extension make sure you specify the correct url to get the masks
 				});
 
 				maskList = maskList.sort(function(a, b) {
-					return (a["mask"] || a) < (b["mask"] || b) ? -1 : 1;
+					return (a.mask || a) < (b.mask || b) ? -1 : 1;
 				});
 
 				return maskList;
@@ -48,14 +48,13 @@ When using this extension make sure you specify the correct url to get the masks
 			nojumpsThreshold: 1,
 			onBeforeMask: function(value, opts) {
 				var processedValue = value.replace(/^0/g, "");
-				if (processedValue.indexOf(opts.countrycode) > 1 || processedValue.indexOf(opts.countrycode) == -1) {
+				if (processedValue.indexOf(opts.countrycode) > 1 || processedValue.indexOf(opts.countrycode) === -1)
 					processedValue = "+" + opts.countrycode + processedValue;
-				}
 
 				return processedValue;
 			}
 		},
-		'phonebe': {
+		"phonebe": {
 			alias: "phone",
 			url: "phone-codes/phone-be.js",
 			countrycode: "32",

+ 40 - 39
js/inputmask.regex.extensions.js

@@ -10,7 +10,7 @@ Allows for using regular expressions as a mask
 */
 (function($) {
 	Inputmask.extendAliases({ // $(selector).inputmask("Regex", { regex: "[0-9]*"}
-		'Regex': {
+		"Regex": {
 			mask: "r",
 			greedy: false,
 			repeat: "*",
@@ -20,12 +20,18 @@ Allows for using regular expressions as a mask
 			tokenizer: /\[\^?]?(?:[^\\\]]+|\\[\S\s]?)*]?|\\(?:0(?:[0-3][0-7]{0,2}|[4-7][0-7]?)?|[1-9][0-9]*|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|c[A-Za-z]|[\S\s]?)|\((?:\?[:=!]?)?|(?:[?*+]|\{[0-9]+(?:,[0-9]*)?\})\??|[^.?*+^${[()|\\]+|./g,
 			quantifierFilter: /[0-9]+[^,]/,
 			isComplete: function(buffer, opts) {
-				return new RegExp(opts.regex).test(buffer.join(''));
+				return new RegExp(opts.regex).test(buffer.join(""));
 			},
 			definitions: {
-				'r': {
+				"r": {
 					validator: function(chrs, maskset, pos, strict, opts) {
-						function regexToken(isGroup, isQuantifier) {
+						var cbuffer = maskset.buffer.slice(),
+							regexPart = "",
+							isValid = false,
+							openGroupCount = 0,
+							groupToken;
+
+						function RegexToken(isGroup, isQuantifier) {
 							this.matches = [];
 							this.isGroup = isGroup || false;
 							this.isQuantifier = isQuantifier || false;
@@ -37,7 +43,7 @@ Allows for using regular expressions as a mask
 						}
 
 						function analyseRegex() {
-							var currentToken = new regexToken(),
+							var currentToken = new RegexToken(),
 								match, m, opengroups = [];
 
 							opts.regexTokens = [];
@@ -47,33 +53,33 @@ Allows for using regular expressions as a mask
 								m = match[0];
 								switch (m.charAt(0)) {
 									case "(": // Group opening
-										opengroups.push(new regexToken(true));
+										opengroups.push(new RegexToken(true));
 										break;
 									case ")": // Group closing
-										var groupToken = opengroups.pop();
-										if (opengroups.length > 0) {
-											opengroups[opengroups.length - 1]["matches"].push(groupToken);
-										} else {
+										groupToken = opengroups.pop();
+										if (opengroups.length > 0)
+											opengroups[opengroups.length - 1].matches.push(groupToken);
+										else
 											currentToken.matches.push(groupToken);
-										}
+
 										break;
 									case "{":
 									case "+":
 									case "*": //Quantifier
-										var quantifierToken = new regexToken(false, true);
+										var quantifierToken = new RegexToken(false, true);
 										m = m.replace(/[{}]/g, "");
 										var mq = m.split(","),
 											mq0 = isNaN(mq[0]) ? mq[0] : parseInt(mq[0]),
-											mq1 = mq.length == 1 ? mq0 : (isNaN(mq[1]) ? mq[1] : parseInt(mq[1]));
+											mq1 = mq.length === 1 ? mq0 : (isNaN(mq[1]) ? mq[1] : parseInt(mq[1]));
 										quantifierToken.quantifier = {
 											min: mq0,
 											max: mq1
 										};
 										if (opengroups.length > 0) {
-											var matches = opengroups[opengroups.length - 1]["matches"];
+											var matches = opengroups[opengroups.length - 1].matches;
 											match = matches.pop();
-											if (!match["isGroup"]) {
-												var groupToken = new regexToken(true);
+											if (!match.isGroup) {
+												groupToken = new RegexToken(true);
 												groupToken.matches.push(match);
 												match = groupToken;
 											}
@@ -81,8 +87,8 @@ Allows for using regular expressions as a mask
 											matches.push(quantifierToken);
 										} else {
 											match = currentToken.matches.pop();
-											if (!match["isGroup"]) {
-												var groupToken = new regexToken(true);
+											if (!match.isGroup) {
+												groupToken = new RegexToken(true);
 												groupToken.matches.push(match);
 												match = groupToken;
 											}
@@ -92,7 +98,7 @@ Allows for using regular expressions as a mask
 										break;
 									default:
 										if (opengroups.length > 0) {
-											opengroups[opengroups.length - 1]["matches"].push(m);
+											opengroups[opengroups.length - 1].matches.push(m);
 										} else {
 											currentToken.matches.push(m);
 										}
@@ -102,7 +108,7 @@ Allows for using regular expressions as a mask
 
 							if (currentToken.matches.length > 0)
 								opts.regexTokens.push(currentToken);
-						};
+						}
 
 						function validateRegexToken(token, fromGroup) {
 							var isvalid = false;
@@ -110,21 +116,21 @@ Allows for using regular expressions as a mask
 								regexPart += "(";
 								openGroupCount++;
 							}
-							for (var mndx = 0; mndx < token["matches"].length; mndx++) {
-								var matchToken = token["matches"][mndx];
-								if (matchToken["isGroup"] == true) {
+							for (var mndx = 0; mndx < token.matches.length; mndx++) {
+								var matchToken = token.matches[mndx];
+								if (matchToken.isGroup === true) {
 									isvalid = validateRegexToken(matchToken, true);
-								} else if (matchToken["isQuantifier"] == true) {
-									var crrntndx = $.inArray(matchToken, token["matches"]),
-										matchGroup = token["matches"][crrntndx - 1];
+								} else if (matchToken.isQuantifier === true) {
+									var crrntndx = $.inArray(matchToken, token.matches),
+										matchGroup = token.matches[crrntndx - 1];
 									var regexPartBak = regexPart;
 									if (isNaN(matchToken.quantifier.max)) {
-										while (matchToken["repeaterPart"] && matchToken["repeaterPart"] != regexPart && matchToken["repeaterPart"].length > regexPart.length) {
+										while (matchToken.repeaterPart && matchToken.repeaterPart !== regexPart && matchToken.repeaterPart.length > regexPart.length) {
 											isvalid = validateRegexToken(matchGroup, true);
 											if (isvalid) break;
 										}
 										isvalid = isvalid || validateRegexToken(matchGroup, true);
-										if (isvalid) matchToken["repeaterPart"] = regexPart;
+										if (isvalid) matchToken.repeaterPart = regexPart;
 										regexPart = regexPartBak + matchToken.quantifier.max;
 									} else {
 										for (var i = 0, qm = matchToken.quantifier.max - 1; i < qm; i++) {
@@ -133,7 +139,7 @@ Allows for using regular expressions as a mask
 										}
 										regexPart = regexPartBak + "{" + matchToken.quantifier.min + "," + matchToken.quantifier.max + "}";
 									}
-								} else if (matchToken["matches"] != undefined) {
+								} else if (matchToken.matches !== undefined) {
 									for (var k = 0; k < matchToken.length; k++) {
 										isvalid = validateRegexToken(matchToken[k], fromGroup);
 										if (isvalid) break;
@@ -150,7 +156,7 @@ Allows for using regular expressions as a mask
 										isvalid = exp.test(bufferStr);
 									} else {
 										for (var l = 0, tl = matchToken.length; l < tl; l++) {
-											if (matchToken.charAt(l) == "\\") continue;
+											if (matchToken.charAt(l) === "\\") continue;
 											testExp = regexPart;
 											testExp += matchToken.substr(0, l + 1);
 											testExp = testExp.replace(/\|$/, "");
@@ -175,20 +181,15 @@ Allows for using regular expressions as a mask
 							return isvalid;
 						}
 
-
-						if (opts.regexTokens == null) {
+						if (opts.regexTokens === null)
 							analyseRegex();
-						}
 
-						var cbuffer = maskset.buffer.slice(),
-							regexPart = "",
-							isValid = false,
-							openGroupCount = 0;
+
 						cbuffer.splice(pos, 0, chrs);
-						var bufferStr = cbuffer.join('');
+						var bufferStr = cbuffer.join("");
 						for (var i = 0; i < opts.regexTokens.length; i++) {
 							var regexToken = opts.regexTokens[i];
-							isValid = validateRegexToken(regexToken, regexToken["isGroup"]);
+							isValid = validateRegexToken(regexToken, regexToken.isGroup);
 							if (isValid) break;
 						}
 

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "jquery.inputmask",
-  "version": "3.1.64-150",
+  "version": "3.1.64-153",
   "description": "jquery.inputmask is a jquery plugin which create an input mask.",
   "main": "./dist/inputmask/jquery.inputmask.js",
   "files": [