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

validate-promise

Package Overview
Dependencies
Maintainers
5
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

validate-promise - npm Package Compare versions

Comparing version 3.4.0 to 3.4.1

.nyc_output/16691467-bc77-40b4-9b24-13aed8af16c8.json

3

dist/rules/url.js

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

}
if (value === '') {
return Promise.resolve();
}
const urlRegex = '^(?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})))(?::\d{2,5})?(?:[/?#]\S*)?$';

@@ -9,0 +12,0 @@ const regex = new RegExp(urlRegex, 'g');

2

package.json
{
"name": "validate-promise",
"version": "3.4.0",
"version": "3.4.1",
"description": "Promised based validation library",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -16,2 +16,6 @@ import { ValidationPromise } from '../';

if (value === '') {
return Promise.resolve();
}
const urlRegex = '^(?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})))(?::\d{2,5})?(?:[/?#]\S*)?$';

@@ -18,0 +22,0 @@ const regex = new RegExp(urlRegex, 'g');

@@ -39,2 +39,23 @@ import { expect } from 'chai';

describe('url success when empty', () => {
let res;
beforeEach(done => {
let data = {
string: ''
};
validate(contract, data)
.then(data => {
res = data;
done();
})
.catch(done);
});
it('should validate when empty', () => {
expect(res).to.equal(true);
})
})
describe('url fail', () => {

@@ -41,0 +62,0 @@ let res;

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