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

js-textfield-validation

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

js-textfield-validation - npm Package Compare versions

Comparing version 1.0.6 to 1.0.7

spec/support/chainable_spec.js

3

index.d.ts
declare class Validation {
constructor(value: string);
// Chainable methods
alphanumericOnly(): void;

@@ -13,2 +14,4 @@ dollarValue(): void;

wordOnly(): void;
// Non-chainable methods
validateEmail(email: string): void;

@@ -15,0 +18,0 @@ validateIPAddress(address: string): void;

@@ -6,2 +6,3 @@ export default class Validation {

};
/** Remove all the spaces */

@@ -62,3 +63,3 @@ Validation.prototype.noSpace = function() {

Validation.prototype.ipAddress = function() {
this.value = this.value.replace(/([^0-9.])|(^[.])/, "").replace(/[.]{2}/, ".");
this.value = this.value.replace(/([^0-9.])|(^[.]+)/, "");
return this;

@@ -110,4 +111,15 @@ }

export const validateIPAddress = address => {
let isValid = true;
const regExpTest = RegExp("^\\d{1,3}[.]\\d{1,3}[.]\\d{1,3}[.]\\d{1,3}$");
return (regExpTest.test(address))
isValid = regExpTest.test(address);
if (isValid) {
const values = address.split('.')
for (let i=0; i<4; i++) {
if (values[i] > 255) {
isValid = false;
break;
}
}
}
return isValid;
}

9

package.json
{
"name": "js-textfield-validation",
"version": "1.0.6",
"version": "1.0.7",
"description": "An npm Package to validate textfield value.",

@@ -8,3 +8,3 @@ "main": "index.js",

"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "jasmine"
},

@@ -32,3 +32,6 @@ "repository": {

"author": "Lerh Hwee Lern",
"license": "MIT"
"license": "MIT",
"devDependencies": {
"jasmine": "^3.4.0"
}
}
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