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

@mapbox/link-to-location

Package Overview
Dependencies
Maintainers
164
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mapbox/link-to-location

Convert a link (HTMLAnchorElement or URL) to an abbreviated Location object.

  • 1.0.0
  • latest
  • npm
  • Socket score

Version published
Maintainers
164
Created
Source

Convert a link (HTMLAnchorElement or URL) to an object with pathname, hash, and search properties. Uses the browser's native link parsing to avoid unnecessary code.

Installation

npm install @mapbox/link-to-location

API

linkToLocation

linkToLocation(input)

Returns an object with three properties with string values: pathname, hash, and search.

input

Type: HTMLAnchorElement | string.

Either the DOM element itself or a URL.

Example

const linkToLocation = require('link-to-location');

linkToLocation('http://user:pw@foo.bar.baz/qux?quux=grault#fred');
/*
  {
    pathname: 'foo.bar.baz/qux',
    hash: '#fred',
    search: '?quux=grault'
  }
*/

FAQs

Package last updated on 08 Sep 2017

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