New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

restricted-input

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

restricted-input - npm Package Compare versions

Comparing version 3.0.3 to 3.0.4

4

CHANGELOG.md
# Restricted Input - Release Notes
## 3.0.4
- Fix issue where some Mac OS input sources would not format correctly in Safari
## 3.0.3

@@ -4,0 +8,0 @@

4

dist/lib/device.js

@@ -9,3 +9,3 @@ "use strict";

// TODO remove this when browser detection is converted to typescript
/* eslint-disable @typescript-eslint/ban-ts-ignore */
/* eslint-disable @typescript-eslint/ban-ts-comment */
// @ts-ignore

@@ -23,3 +23,3 @@ var isAndroid = require("@braintree/browser-detection/is-android");

exports.isIE9 = isIE9;
/* eslint-enable @typescript-eslint/ban-ts-ignore */
/* eslint-enable @typescript-eslint/ban-ts-comment */
// Old Android Webviews used specific versions of Chrome with 0.0.0 as their version suffix

@@ -26,0 +26,0 @@ // https://developer.chrome.com/multidevice/user-agent#webview_user_agent

@@ -6,6 +6,8 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);

@@ -34,9 +36,2 @@ function __() { this.constructor = d; }

});
// 'keypress' is not fired with some Android keyboards (see #23)
this.inputElement.addEventListener("keypress", function (event) {
if (key_cannot_mutate_value_1.keyCannotMutateValue(event)) {
return;
}
_this.unformatInput();
});
this.inputElement.addEventListener("keyup", function () {

@@ -43,0 +38,0 @@ _this.reformatInput();

@@ -13,2 +13,3 @@ import { StrategyInterface, StrategyOptions } from "./strategy-interface";

private onPasteEvent?;
private hasKeypressEvent;
protected stateToFormat?: FormatMetadata;

@@ -29,2 +30,3 @@ constructor(options: StrategyOptions);

protected getStateToFormat(): FormatMetadata;
private onKeypress;
}

@@ -6,6 +6,8 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);

@@ -34,2 +36,3 @@ function __() { this.constructor = d; }

var _this = _super.call(this, options) || this;
_this.hasKeypressEvent = false;
_this.formatter = new formatter_1.PatternFormatter(options.pattern);

@@ -76,10 +79,4 @@ _this.onPasteEvent = options.onPasteEvent;

this.inputElement.addEventListener("keypress", function (e) {
var event = e;
if (isSimulatedEvent(event)) {
_this.isFormatted = false;
}
if (key_cannot_mutate_value_1.keyCannotMutateValue(event)) {
return;
}
_this.unformatInput();
_this.hasKeypressEvent = true;
_this.onKeypress(e);
});

@@ -89,3 +86,13 @@ this.inputElement.addEventListener("keyup", function () {

});
this.inputElement.addEventListener("input", function (event) {
this.inputElement.addEventListener("input", function (e) {
var event = e;
// Some input sources on Mac OS prevent
// the keypress event from being fired,
// so if we can't detect that the keypress
// event fired, we simulate the event
// here before the handler for the input
// event
if (!_this.hasKeypressEvent) {
_this.onKeypress(e);
}
// Safari AutoFill fires CustomEvents

@@ -197,4 +204,13 @@ // LastPass sends an `isTrusted: false` property

};
BaseStrategy.prototype.onKeypress = function (event) {
if (isSimulatedEvent(event)) {
this.isFormatted = false;
}
if (key_cannot_mutate_value_1.keyCannotMutateValue(event)) {
return;
}
this.unformatInput();
};
return BaseStrategy;
}(strategy_interface_1.StrategyInterface));
exports.BaseStrategy = BaseStrategy;

@@ -6,6 +6,8 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);

@@ -12,0 +14,0 @@ function __() { this.constructor = d; }

@@ -6,6 +6,8 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);

@@ -12,0 +14,0 @@ function __() { this.constructor = d; }

@@ -12,6 +12,8 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);

@@ -18,0 +20,0 @@ function __() { this.constructor = d; }

@@ -6,6 +6,8 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);

@@ -12,0 +14,0 @@ function __() { this.constructor = d; }

{
"name": "restricted-input",
"version": "3.0.3",
"version": "3.0.4",
"description": "Restrict inputs to certain valid characters (e.g. formatting phone or card numbers)",

@@ -48,30 +48,31 @@ "author": "Braintree <code@getbraintree.com> (https://www.braintreepayments.com/)",

"dependencies": {
"@braintree/browser-detection": "^1.10.0"
"@braintree/browser-detection": "^1.12.0"
},
"devDependencies": {
"@types/jest": "^26.0.9",
"@wdio/browserstack-service": "^6.4.0",
"@wdio/cli": "^6.4.0",
"@wdio/local-runner": "^6.4.0",
"@wdio/mocha-framework": "^6.4.0",
"@wdio/spec-reporter": "^6.4.0",
"@wdio/sync": "^6.4.0",
"browserify": "^16.5.2",
"browserstack-local": "^1.4.5",
"chai": "^4.2.0",
"@types/jest": "^26.0.23",
"@wdio/browserstack-service": "^7.7.4",
"@wdio/cli": "^7.7.4",
"@wdio/local-runner": "^7.7.4",
"@wdio/mocha-framework": "^7.7.4",
"@wdio/spec-reporter": "^7.7.3",
"@wdio/sync": "^7.7.4",
"browserify": "^17.0.0",
"browserstack-local": "^1.4.8",
"chai": "^4.3.4",
"chokidar-cli": "^2.1.0",
"dotenv": "^8.2.0",
"eslint": "^7.6.0",
"eslint-config-braintree": "^5.0.0-typescript-prep-rc.17",
"dotenv": "^10.0.0",
"eslint": "^7.29.0",
"eslint-config-braintree": "^5.0.0-typescript-prep-rc.18",
"express": "^4.17.1",
"jest": "^26.3.0",
"jsdoc": "^3.6.5",
"prettier": "^2.0.5",
"ts-jest": "^26.1.4",
"tsify": "^5.0.0",
"typescript": "^3.9.7",
"uuid": "^8.3.0",
"webdriverio": "^6.4.0"
"jest": "^27.0.5",
"jsdoc": "^3.6.7",
"prettier": "^2.3.1",
"ts-jest": "^27.0.3",
"tsify": "^5.0.4",
"typescript": "^4.3.4",
"uuid": "^8.3.2",
"webdriverio": "^7.7.4"
},
"jest": {
"testEnvironment": "jsdom",
"preset": "ts-jest",

@@ -78,0 +79,0 @@ "setupFilesAfterEnv": [

# Restricted Input
[![BrowserStack Status](https://automate.browserstack.com/badge.svg?badge_key=UUlSMGtaQWNkL3lEdlZ2NmFzcnh4OWcvNGFkQjZjcExhQmFPb1cydlJEOD0tLVNlQ3JSUDgzR20ySUs4SFc4L2x1TXc9PQ==--7e53bf426e69647ff4cda6a50460759494986d49)](https://automate.browserstack.com/public-build/UUlSMGtaQWNkL3lEdlZ2NmFzcnh4OWcvNGFkQjZjcExhQmFPb1cydlJEOD0tLVNlQ3JSUDgzR20ySUs4SFc4L2x1TXc9PQ==--7e53bf426e69647ff4cda6a50460759494986d49)
[![Build Status](https://github.com/braintree/restricted-input/workflows/Unit%20Tests/badge.svg)](https://github.com/braintree/restricted-input/actions?query=workflow%3A%22Unit+Tests%22) [![Build Status](https://github.com/braintree/restricted-input/workflows/Integration%20Tests/badge.svg)](https://github.com/braintree/restricted-input/actions?query=workflow%3A%22Integration+Tests%22)
[![npm version](https://badge.fury.io/js/restricted-input.svg)](http://badge.fury.io/js/restricted-input)

@@ -5,0 +6,0 @@ Allow restricted character sets in `input` elements.

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