react-input-mask
Advanced tools
Comparing version 0.5.1 to 0.5.2
@@ -178,3 +178,3 @@ // https://github.com/sanniassin/react-input-mask | ||
var char = substr.shift(); | ||
if (this.isAllowedChar(char, i, state)) { | ||
if (this.isAllowedChar(char, i, state, true)) { | ||
if (i < value.length) { | ||
@@ -220,3 +220,5 @@ if (maskChar || isFilled) { | ||
var state = arguments.length <= 2 || arguments[2] === undefined ? this.state : arguments[2]; | ||
var allowMaskChar = arguments.length <= 3 || arguments[3] === undefined ? false : arguments[3]; | ||
var mask = state.mask; | ||
var maskChar = state.maskChar; | ||
@@ -228,3 +230,3 @@ if (this.isPermanentChar(pos, state)) { | ||
var charRule = this.charsRules[ruleChar]; | ||
return new RegExp(charRule).test(char || ""); | ||
return new RegExp(charRule).test(char || "") || allowMaskChar && char === maskChar; | ||
}, | ||
@@ -231,0 +233,0 @@ isPermanentChar: function (pos) { |
@@ -160,3 +160,3 @@ // https://github.com/sanniassin/react-input-mask | ||
var char = substr.shift(); | ||
if (this.isAllowedChar(char, i, state)) { | ||
if (this.isAllowedChar(char, i, state, true)) { | ||
if (i < value.length) { | ||
@@ -201,4 +201,4 @@ if (maskChar || isFilled) { | ||
}, | ||
isAllowedChar: function(char, pos, state = this.state) { | ||
var { mask } = state; | ||
isAllowedChar: function(char, pos, state = this.state, allowMaskChar = false) { | ||
var { mask, maskChar } = state; | ||
if (this.isPermanentChar(pos, state)) { | ||
@@ -209,3 +209,3 @@ return mask[pos] === char; | ||
var charRule = this.charsRules[ruleChar]; | ||
return (new RegExp(charRule)).test(char || ""); | ||
return (new RegExp(charRule)).test(char || "") || (allowMaskChar && char === maskChar); | ||
}, | ||
@@ -212,0 +212,0 @@ isPermanentChar: function(pos, state = this.state) { |
{ | ||
"name": "react-input-mask", | ||
"description": "Masked input component for React", | ||
"version": "0.5.1", | ||
"version": "0.5.2", | ||
"homepage": "https://github.com/sanniassin/react-input-mask", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
43736
1145