@bluedot-innovation/models 6.0.1 → 6.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bluedot-innovation/models",
3
- "version": "6.0.1",
3
+ "version": "6.0.2",
4
4
  "main": "Models.js",
5
5
  "scripts": {
6
6
  "lint": "./node_modules/.bin/eslint -c .eslintrc.js ./models/*.js ./__tests__/**/*.js ./__tests__/**/**/*.js ./schemas/*.js",
@@ -1,12 +1,4 @@
1
- const { URL } = require('url');
1
+ const URL_REGEX = new RegExp("^(https?|ftp)://[^\\s/$.?#].[^\\s]*$", "i")
2
2
  exports.validateUrl = function(url) {
3
- try {
4
- const myUrl = new URL(url); // Check is valid.
5
- const protocol = myUrl.protocol.toLowerCase();
6
- if( protocol != 'http:' && protocol != 'https:' )
7
- return false;
8
- return true;
9
- } catch (err) {
10
- return false;
11
- }
3
+ return URL_REGEX.test(url)
12
4
  }