Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-input-mask

Package Overview
Dependencies
Maintainers
1
Versions
90
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-input-mask - npm Package Compare versions

Comparing version 0.1.3 to 0.1.4

33

build/InputElement.js

@@ -43,4 +43,5 @@ "use strict";

getFilledLength: function getFilledLength() {
var value = arguments[0] === undefined ? this.state.value : arguments[0];
var i;
var value = this.state.value;
var maskChar = this.state.maskChar;

@@ -155,3 +156,7 @@

if (i < value.length) {
value = this.replaceSubstr(value, char, i);
if (maskChar) {
value = this.replaceSubstr(value, char, i);
} else {
value = this.formatValue(value.substr(0, i) + char + value.substr(i), newState);
}
} else if (!maskChar) {

@@ -171,2 +176,21 @@ value += char;

},
getRawSubstrLength: function getRawSubstrLength(value, substr, pos, newState) {
var _ref3 = newState || this.state;
var mask = _ref3.mask;
var maskChar = _ref3.maskChar;
substr = substr.split("");
for (var i = pos; i < mask.length && substr.length;) {
if (!this.isPermanentChar(i, newState) || mask[i] === substr[0]) {
var char = substr.shift();
if (this.isAllowedChar(char, i, newState)) {
++i;
}
} else {
++i;
}
}
return i - pos;
},
isAllowedChar: function isAllowedChar(char, pos, newState) {

@@ -510,3 +534,6 @@ var mask = newState ? newState.mask : this.state.mask;

var caretPos = this.getCaretPos();
var textLen = this.getRawSubstrLength(this.state.value, text, caretPos);
var value = this.insertRawSubstr(this.state.value, text, caretPos);
caretPos += textLen;
caretPos = this.getRightEditablePos(caretPos) || caretPos;
if (value !== this.state.value) {

@@ -521,3 +548,3 @@ event.target.value = value;

}
this.setCaretPos(i);
this.setCaretPos(caretPos);
}

@@ -524,0 +551,0 @@ event.preventDefault();

@@ -37,5 +37,4 @@ // https://github.com/sanniassin/react-input-mask

},
getFilledLength: function() {
getFilledLength: function(value = this.state.value) {
var i;
var value = this.state.value;
var maskChar = this.state.maskChar;

@@ -142,3 +141,8 @@

if (i < value.length) {
value = this.replaceSubstr(value, char, i);
if (maskChar) {
value = this.replaceSubstr(value, char, i);
}
else {
value = this.formatValue(value.substr(0, i) + char + value.substr(i), newState);
}
}

@@ -160,2 +164,18 @@ else if (!maskChar) {

},
getRawSubstrLength: function(value, substr, pos, newState) {
var { mask, maskChar } = newState || this.state;
substr = substr.split("");
for (var i = pos; i < mask.length && substr.length; ) {
if (!this.isPermanentChar(i, newState) || mask[i] === substr[0]) {
var char = substr.shift();
if (this.isAllowedChar(char, i, newState)) {
++i;
}
}
else {
++i;
}
}
return i - pos;
},
isAllowedChar: function(char, pos, newState) {

@@ -509,3 +529,6 @@ var mask = newState ? newState.mask : this.state.mask;

var caretPos = this.getCaretPos();
var textLen = this.getRawSubstrLength(this.state.value, text, caretPos);
var value = this.insertRawSubstr(this.state.value, text, caretPos);
caretPos += textLen;
caretPos = this.getRightEditablePos(caretPos) || caretPos;
if (value !== this.state.value) {

@@ -520,3 +543,3 @@ event.target.value = value;

}
this.setCaretPos(i);
this.setCaretPos(caretPos);
}

@@ -523,0 +546,0 @@ event.preventDefault();

2

package.json
{
"name": "react-input-mask",
"description": "Masked input component for React",
"version": "0.1.3",
"version": "0.1.4",
"homepage": "https://github.com/sanniassin/react-input-mask",

@@ -6,0 +6,0 @@ "license": "MIT",

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc