validate-promise
Advanced tools
Comparing version 3.4.0 to 3.4.1
@@ -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'); |
{ | ||
"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; |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
1133512
188
2948
1