📅 You're Invited: Meet the Socket team at RSAC (April 28 – May 1).RSVP
Socket
Sign inDemoInstall
Socket

resolve-relative-url

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

resolve-relative-url

Resolve a possibly relative URL agains a source URL

1.0.0
latest
Source
npm
Version published
Weekly downloads
7.2K
7.31%
Maintainers
1
Weekly downloads
 
Created
Source

resolve-relative-url

Build Status npm version Dependency Status devDependency Status

Introduction:

Resolve a possibly relative URL agains a source URL. If the URL is not relative, return it unchanged.

Resolve a possibly relative URL

Arguments

  • link - A possibly relative URL.
  • source - Source URL.

Example

var resolveRelative = require('resolve-relative-url');

var resolvedURL = resolveRelative('/banner.img', 'http://www.somedomain.com');
// http://www.somedomain.com/banner.img
var resolvedURL = resolveRelative('https://www.otherdomain.com/banner.img', 'http://www.somedomain.com');
// https://www.otherdomain.com/banner.img
var resolvedURL = resolveRelative('', 'http://www.somedomain.com');
// https://www.somedomain.com

Keywords

resolve

FAQs

Package last updated on 14 Feb 2015

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