New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@karinjs/geturls

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@karinjs/geturls

Get all URLs in a string

latest
Source
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

GetUrls

Get all URLs in a string

The URLs will be normalized.

Do not use this for any kind of security-related validation.

Please note the known limitation. You can work around this by setting requireSchemeOrWww to true.

Install

npm install @karinjs/geturls

Usage

import GetUrls from '@karinjs/geturls';

const text = 'Lorem ipsum dolor sit amet, //sindresorhus.com consectetuer adipiscing http://yeoman.io elit.';

GetUrls.getUrls(text);
//=> ['http://sindresorhus.com', 'http://yeoman.io']

API

text

Type: string

options

Type: object

All the normalize-url options in addition to:

extractFromQueryString

Type: boolean
Default: false

Extract URLs that appear as query parameters in the found URLs.

exclude

Type: string[]
Default: []

Exclude URLs that match URLs in the given array.

requireSchemeOrWww

Type: boolean
Default: false

Require URLs to have a scheme or leading www. to be considered an URL. When false, matches against a list of valid TLDs, so it will match URLs like unicorn.education.

Does not affect URLs in query parameters if using the extractFromQueryString option.

  • get-urls-cli - CLI for this module
  • linkify-urls - Linkify URLs in text

Keywords

get

FAQs

Package last updated on 22 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts