goturl
TypeScript icon, indicating that this package has built-in type declarations

3.6.19 • Public • Published

goturl

NPM version NPM downloads Fastify

goturl - the library that tries to do its best to extract urls from strings.

Installation

yarn add goturl

Usage

import { extractUrl } from 'goturl';

extractUrl("Visit https://example.com for more info");
// => https://example.com

extractUrl("Website: another-one.com");
// => another-one.com

extractUrl("Don't forget about this.com/thing?query=string", { fallbackProtocol: 'https' });
// => https://this.com/thing?query=string

extractUrl("Check out our promotions: http://promotion.com http://promotion.com/real/offer", { getLongestUrl: true });
// => http://promotion.com/real/offer

extractUrl("Quick reminder, check out our websitehttps://hurry.com/mistake", { tryFixProtocol: true });
// => https://hurry.com/mistake

Testing

yarn test

Package Sidebar

Install

npm i goturl

Weekly Downloads

47

Version

3.6.19

License

MIT

Unpacked Size

4.38 kB

Total Files

5

Last publish

Collaborators

  • gamote