Socket
Socket
Sign inDemoInstall

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.4 to 0.2.0

19

build/InputElement.js

@@ -78,5 +78,7 @@ "use strict";

},
isEmpty: function isEmpty(value) {
isEmpty: function isEmpty() {
var _this = this;
var value = arguments[0] === undefined ? this.state.value : arguments[0];
return !value.split("").some(function (char, i) {

@@ -86,2 +88,7 @@ return !_this.isPermanentChar(i) && _this.isAllowedChar(char, i);

},
isFilled: function isFilled() {
var value = arguments[0] === undefined ? this.state.value : arguments[0];
return this.getFilledLength(value) === this.state.mask.length;
},
createFilledArray: function createFilledArray(length, val) {

@@ -151,2 +158,3 @@ var array = [];

var isFilled = this.isFilled(value);
substr = substr.split("");

@@ -158,3 +166,3 @@ for (var i = pos; i < mask.length && substr.length;) {

if (i < value.length) {
if (maskChar) {
if (maskChar || isFilled) {
value = this.replaceSubstr(value, char, i);

@@ -449,8 +457,3 @@ } else {

if (editablePos !== null && this.isAllowedChar(key, editablePos)) {
if (!maskChar && value.length < mask.length) {
value = value.slice(0, editablePos) + key + value.slice(editablePos);
value = this.insertRawSubstr("", value, 0);
} else {
value = this.insertRawSubstr(value, key, caretPos);
}
value = this.insertRawSubstr(value, key, caretPos);
caretPos = editablePos + 1;

@@ -457,0 +460,0 @@ }

@@ -71,3 +71,3 @@ // https://github.com/sanniassin/react-input-mask

},
isEmpty: function(value) {
isEmpty: function(value = this.state.value) {
return !value.split("").some((char, i) =>

@@ -77,2 +77,5 @@ !this.isPermanentChar(i) && this.isAllowedChar(char, i)

},
isFilled: function(value = this.state.value) {
return this.getFilledLength(value) === this.state.mask.length;
},
createFilledArray: function(length, val) {

@@ -136,2 +139,3 @@ var array = [];

var { mask, maskChar } = newState || this.state;
var isFilled = this.isFilled(value);
substr = substr.split("");

@@ -143,3 +147,3 @@ for (var i = pos; i < mask.length && substr.length; ) {

if (i < value.length) {
if (maskChar) {
if (maskChar || isFilled) {
value = this.replaceSubstr(value, char, i);

@@ -442,9 +446,3 @@ }

if (editablePos !== null && this.isAllowedChar(key, editablePos)) {
if (!maskChar && value.length < mask.length) {
value = value.slice(0, editablePos) + key + value.slice(editablePos);
value = this.insertRawSubstr("", value, 0);
}
else {
value = this.insertRawSubstr(value, key, caretPos);
}
value = this.insertRawSubstr(value, key, caretPos);
caretPos = editablePos + 1;

@@ -451,0 +449,0 @@ }

{
"name": "react-input-mask",
"description": "Masked input component for React",
"version": "0.1.4",
"version": "0.2.0",
"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