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

get-urls

Package Overview
Dependencies
Maintainers
2
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

get-urls - npm Package Compare versions

Comparing version 7.2.0 to 8.0.0

25

index.js
'use strict';
const URL = require('url');
const {URL} = require('url');
const urlRegex = require('url-regex');

@@ -8,8 +8,5 @@ const normalizeUrl = require('normalize-url');

const ret = new Set();
const {searchParams} = (new URL(url));
// TODO: Use `(new URL(url)).searchParams` when targeting Node.js 8
const qs = URL.parse(url, true).query;
for (const key of Object.keys(qs)) {
const value = qs[key];
for (const [, value] of searchParams) {
if (urlRegex({exact: true}).test(value)) {

@@ -23,4 +20,6 @@ ret.add(value);

module.exports = (text, options) => {
options = options || {};
module.exports = (text, options = {}) => {
if (typeof options.exclude !== 'undefined' && !Array.isArray(options.exclude)) {
throw new TypeError('The `exclude` option must be an array');
}

@@ -44,3 +43,13 @@ const ret = new Set();

for (const excludedItem of options.exclude || []) {
for (const item of ret) {
const regex = new RegExp(excludedItem);
if (regex.test(item)) {
ret.delete(item);
break;
}
}
}
return ret;
};
{
"name": "get-urls",
"version": "7.2.0",
"description": "Get all URLs in a string",
"license": "MIT",
"repository": "sindresorhus/get-urls",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=4"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"get",
"urls",
"url",
"uri",
"extract",
"find",
"scrape",
"text",
"string"
],
"dependencies": {
"escape-goat": "^1.3.0",
"normalize-url": "^2.0.0",
"url-regex": "^4.0.0"
},
"devDependencies": {
"ava": "*",
"xo": "*"
}
"name": "get-urls",
"version": "8.0.0",
"description": "Get all URLs in a string",
"license": "MIT",
"repository": "sindresorhus/get-urls",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=6"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"get",
"urls",
"url",
"uri",
"extract",
"find",
"scrape",
"text",
"string"
],
"dependencies": {
"normalize-url": "^3.3.0",
"url-regex": "^4.0.0"
},
"devDependencies": {
"ava": "^0.25.0",
"xo": "^0.23.0"
}
}

@@ -48,3 +48,9 @@ # get-urls [![Build Status](https://travis-ci.org/sindresorhus/get-urls.svg?branch=master)](https://travis-ci.org/sindresorhus/get-urls)

#### exclude
Type: `string[]`
Exclude URLs that match URLs in the given array.
## Related

@@ -51,0 +57,0 @@

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