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

resolve-url

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

resolve-url

Like Node.js’ `path.resolve`/`url.resolve` for the browser.

  • 0.2.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8.6M
decreased by-17.65%
Maintainers
1
Weekly downloads
 
Created

What is resolve-url?

The resolve-url package is a utility for resolving URLs based on a base URL. It is commonly used to resolve relative paths to absolute URLs in the context of web development.

What are resolve-url's main functionalities?

Resolve relative URL

This feature allows you to resolve a relative URL to an absolute URL using a base URL. In the code sample, '/some/path' is resolved against the base URL 'http://example.com/' to form the absolute URL 'http://example.com/some/path'.

var resolve = require('resolve-url');
var resolvedUrl = resolve('http://example.com/', '/some/path');

Resolve URL with query string

This feature enables resolving a relative URL in the presence of a query string in the base URL. The code sample demonstrates how 'path' is resolved against 'http://example.com/?query=123' to form 'http://example.com/path?query=123'.

var resolve = require('resolve-url');
var resolvedUrl = resolve('http://example.com/?query=123', 'path');

Resolve URL with hash fragment

This feature is used to resolve a relative URL when there is a hash fragment in the base URL. In the code sample, 'path' is resolved against 'http://example.com/#hash' to form 'http://example.com/path#hash'.

var resolve = require('resolve-url');
var resolvedUrl = resolve('http://example.com/#hash', 'path');

Other packages similar to resolve-url

Keywords

FAQs

Package last updated on 25 Feb 2014

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

  • 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