Comparing version 4.1.1 to 5.0.0
15
index.js
@@ -5,11 +5,14 @@ 'use strict'; | ||
module.exports = opts => { | ||
opts = Object.assign({strict: true}, opts); | ||
module.exports = options => { | ||
options = { | ||
strict: true, | ||
...options | ||
}; | ||
const protocol = `(?:(?:[a-z]+:)?//)${opts.strict ? '' : '?'}`; | ||
const protocol = `(?:(?:[a-z]+:)?//)${options.strict ? '' : '?'}`; | ||
const auth = '(?:\\S+(?::\\S*)?@)?'; | ||
const ip = ipRegex.v4().source; | ||
const host = '(?:(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)'; | ||
const host = '(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)'; | ||
const domain = '(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*'; | ||
const tld = `(?:\\.${opts.strict ? '(?:[a-z\\u00a1-\\uffff]{2,})' : `(?:${tlds.sort((a, b) => b.length - a.length).join('|')})`})\\.?`; | ||
const tld = `(?:\\.${options.strict ? '(?:[a-z\\u00a1-\\uffff]{2,})' : `(?:${tlds.sort((a, b) => b.length - a.length).join('|')})`})\\.?`; | ||
const port = '(?::\\d{2,5})?'; | ||
@@ -19,3 +22,3 @@ const path = '(?:[/?#][^\\s"]*)?'; | ||
return opts.exact ? new RegExp(`(?:^${regex}$)`, 'i') : new RegExp(regex, 'ig'); | ||
return options.exact ? new RegExp(`(?:^${regex}$)`, 'i') : new RegExp(regex, 'ig'); | ||
}; |
{ | ||
"name": "url-regex", | ||
"version": "4.1.1", | ||
"description": "Regular expression for matching URLs", | ||
"license": "MIT", | ||
"repository": "kevva/url-regex", | ||
"author": { | ||
"name": "Kevin Mårtensson", | ||
"email": "kevinmartensson@gmail.com", | ||
"url": "https://github.com/kevva" | ||
}, | ||
"engines": { | ||
"node": ">=4" | ||
}, | ||
"scripts": { | ||
"test": "xo && ava" | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"keywords": [ | ||
"regex", | ||
"string", | ||
"url" | ||
], | ||
"dependencies": { | ||
"ip-regex": "^1.0.1", | ||
"tlds": "^1.187.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "*", | ||
"xo": "*" | ||
}, | ||
"xo": { | ||
"esnext": true | ||
} | ||
"name": "url-regex", | ||
"version": "5.0.0", | ||
"description": "Regular expression for matching URLs", | ||
"license": "MIT", | ||
"repository": "kevva/url-regex", | ||
"author": { | ||
"name": "Kevin Mårtensson", | ||
"email": "kevinmartensson@gmail.com", | ||
"url": "https://github.com/kevva" | ||
}, | ||
"engines": { | ||
"node": ">=8" | ||
}, | ||
"scripts": { | ||
"test": "xo && ava && tsd" | ||
}, | ||
"files": [ | ||
"index.js", | ||
"index.d.ts" | ||
], | ||
"keywords": [ | ||
"regex", | ||
"string", | ||
"url" | ||
], | ||
"dependencies": { | ||
"ip-regex": "^4.1.0", | ||
"tlds": "^1.203.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "^1.4.1", | ||
"tsd": "^0.7.2", | ||
"xo": "^0.24.0" | ||
} | ||
} |
@@ -11,3 +11,3 @@ # url-regex [![Build Status](http://img.shields.io/travis/kevva/url-regex.svg?style=flat)](https://travis-ci.org/kevva/url-regex) | ||
``` | ||
$ npm install --save url-regex | ||
$ npm install url-regex | ||
``` | ||
@@ -46,5 +46,5 @@ | ||
### urlRegex(options) | ||
### urlRegex([options]) | ||
Returns a regex for matching URLs. | ||
Returns a `RegExp` for matching URLs. | ||
@@ -51,0 +51,0 @@ #### options |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5263
5
56
3
1
+ Addedip-regex@4.3.0(transitive)
- Removedip-regex@1.0.3(transitive)
Updatedip-regex@^4.1.0
Updatedtlds@^1.203.0