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

url-regex

Package Overview
Dependencies
Maintainers
2
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

url-regex - npm Package Compare versions

Comparing version 4.1.1 to 5.0.0

index.d.ts

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');
};

69

package.json
{
"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

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