Socket
Book a DemoInstallSign in
Socket

get-link

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

get-link

Returns a new, absolute URL by parsing the link relative to the base URL. Supports dynamic links. Not vulnerable to Denial-of-Service attacks.

latest
Source
npmnpm
Version
1.0.4
Version published
Weekly downloads
6
-25%
Maintainers
1
Weekly downloads
 
Created
Source

Greenkeeper badge Build Status License npm version npm downloads

Returns an absolute URL relative to another URL. Not vulnerable to Denial-of-Service attacks.

Installation

$ npm install get-link

Usage

getLink(base: string, link:string): string|false

import getLink from "get-link";

getLink("http://example.com", "/foo/bar");
// => http://example.com/foo/bar

getLink("http://example.com", "/foo.php");
// => http://example.com/foo.php

getLink("http://example.com", "http://example.com/foo.html");
// => http://example.com/foo.html

getLink("http://example.com/some/deep/path", "../../styles");
// => http://example.com/some/styles

getLink("http://example.com", "#dynamic-website");
// => http://example.com

getLink("http://example.com", "javascript:void(0)");
// => http://example.com

getLink("http://example.com", "mailto:email@example.com");
// => http://example.com

getLink("http://example.com", "http://domain.com");
// => false

Tests

$ npm test

Keywords

url

FAQs

Package last updated on 05 Oct 2018

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

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.