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.6.2 to 0.6.3

36

build/InputElement.js

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

lastCaretPos: null,
isAndroidBrowser: function () {
isAndroidBrowser: (function () {
var windows = new RegExp("windows", "i");

@@ -26,3 +26,9 @@ var firefox = new RegExp("firefox", "i");

return !windows.test(ua) && !firefox.test(ua) && android.test(ua);
},
})(),
isWindowsPhoneBrowser: (function () {
var windows = new RegExp("windows", "i");
var phone = new RegExp("phone", "i");
var ua = navigator.userAgent;
return windows.test(ua) && phone.test(ua);
})(),
isDOMElement: function (element) {

@@ -299,3 +305,3 @@ return typeof HTMLElement === "object" ? element instanceof HTMLElement // DOM2

var raf = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function (fn) {
setTimeout(fn, 0);
return setTimeout(fn, 0);
};

@@ -356,3 +362,4 @@

this.mask = mask.mask;
this.permanents = mask.permanents, this.maskChar = "maskChar" in this.props ? this.props.maskChar : this.defaultMaskChar;
this.permanents = mask.permanents;
this.maskChar = "maskChar" in this.props ? this.props.maskChar : this.defaultMaskChar;

@@ -380,3 +387,4 @@ if (this.props.alwaysShowMask || value) {

this.mask = mask.mask;
this.permanents = mask.permanents, this.maskChar = "maskChar" in nextProps ? nextProps.maskChar : this.defaultMaskChar;
this.permanents = mask.permanents;
this.maskChar = "maskChar" in nextProps ? nextProps.maskChar : this.defaultMaskChar;

@@ -469,2 +477,6 @@ var newValue = nextProps.value !== undefined ? this.getStringValue(nextProps.value) : this.state.value;

if (this.isWindowsPhoneBrowser) {
return;
}
var caretPos = this.getCaretPos();

@@ -525,2 +537,3 @@ var selection = this.getSelection();

var prefixLen = this.getPrefix().length;
var clearedValue;

@@ -540,3 +553,3 @@ if (valueLen > oldValueLen) {

var clearedValue = this.clearRange(value, startPos, maskLen - startPos);
clearedValue = this.clearRange(value, startPos, maskLen - startPos);
clearedValue = this.insertRawSubstr(clearedValue, enteredSubstr, caretPos);

@@ -553,3 +566,3 @@

var removedLen = maskLen - valueLen;
var clearedValue = this.clearRange(oldValue, selection.end, removedLen);
clearedValue = this.clearRange(oldValue, selection.end, removedLen);
var substr = value.substr(0, selection.end);

@@ -571,6 +584,7 @@ var clearOnly = substr === oldValue.substr(0, selection.end);

}
var value = this.formatValue(value);
value = this.formatValue(value);
// prevent android autocomplete insertion on backspace
if (!this.isAndroidBrowser()) {
// prevent hanging after first entered character on Windows 10 Mobile
if (!this.isAndroidBrowser && !this.isWindowsPhoneBrowser) {
target.value = value;

@@ -625,3 +639,3 @@ }

onPaste: function (event) {
if (this.isAndroidBrowser()) {
if (this.isAndroidBrowser) {
this.pasteSelection = this.getSelection();

@@ -651,3 +665,3 @@ event.target.value = "";

var textLen = this.getRawSubstrLength(value, text, caretPos);
var value = this.insertRawSubstr(value, text, caretPos);
value = this.insertRawSubstr(value, text, caretPos);
caretPos += textLen;

@@ -654,0 +668,0 @@ caretPos = this.getRightEditablePos(caretPos) || caretPos;

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

lastCaretPos: null,
isAndroidBrowser: function() {
isAndroidBrowser: (function() {
var windows = new RegExp("windows", "i");

@@ -24,3 +24,9 @@ var firefox = new RegExp("firefox", "i");

android.test(ua);
},
})(),
isWindowsPhoneBrowser: (function () {
var windows = new RegExp("windows", "i");
var phone = new RegExp("phone", "i");
var ua = navigator.userAgent;
return windows.test(ua) && phone.test(ua);
})(),
isDOMElement: function(element) {

@@ -289,6 +295,6 @@ return typeof HTMLElement === "object"

||
function(fn) { setTimeout(fn, 0); };
((fn) => setTimeout(fn, 0));
var setPos = this.setSelection.bind(this, pos, 0);
setPos();

@@ -348,3 +354,3 @@ raf(setPos);

this.mask = mask.mask;
this.permanents = mask.permanents,
this.permanents = mask.permanents;
this.maskChar = "maskChar" in this.props ? this.props.maskChar : this.defaultMaskChar;

@@ -372,3 +378,3 @@

this.mask = mask.mask;
this.permanents = mask.permanents,
this.permanents = mask.permanents;
this.maskChar = "maskChar" in nextProps ? nextProps.maskChar : this.defaultMaskChar;

@@ -466,2 +472,6 @@

if (this.isWindowsPhoneBrowser) {
return;
}
var caretPos = this.getCaretPos();

@@ -516,4 +526,5 @@ var selection = this.getSelection();

var valueLen = value.length;
var oldValueLen = oldValue.length
var oldValueLen = oldValue.length;
var prefixLen = this.getPrefix().length;
var clearedValue;

@@ -534,3 +545,3 @@ if (valueLen > oldValueLen) {

var clearedValue = this.clearRange(value, startPos, maskLen - startPos);
clearedValue = this.clearRange(value, startPos, maskLen - startPos);
clearedValue = this.insertRawSubstr(clearedValue, enteredSubstr, caretPos);

@@ -549,3 +560,3 @@

var removedLen = maskLen - valueLen;
var clearedValue = this.clearRange(oldValue, selection.end, removedLen);
clearedValue = this.clearRange(oldValue, selection.end, removedLen);
var substr = value.substr(0, selection.end);

@@ -568,6 +579,7 @@ var clearOnly = substr === oldValue.substr(0, selection.end);

}
var value = this.formatValue(value);
value = this.formatValue(value);
// prevent android autocomplete insertion on backspace
if (!this.isAndroidBrowser()) {
// prevent hanging after first entered character on Windows 10 Mobile
if (!this.isAndroidBrowser && !this.isWindowsPhoneBrowser) {
target.value = value;

@@ -579,3 +591,3 @@ }

});
this.setCaretPos(caretPos);

@@ -624,3 +636,3 @@

onPaste: function(event) {
if (this.isAndroidBrowser()) {
if (this.isAndroidBrowser) {
this.pasteSelection = this.getSelection();

@@ -650,3 +662,3 @@ event.target.value = "";

var textLen = this.getRawSubstrLength(value, text, caretPos);
var value = this.insertRawSubstr(value, text, caretPos);
value = this.insertRawSubstr(value, text, caretPos);
caretPos += textLen;

@@ -653,0 +665,0 @@ caretPos = this.getRightEditablePos(caretPos) || caretPos;

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