# link-to-location **Repository Path**: mirrors_mapbox/link-to-location ## Basic Information - **Project Name**: link-to-location - **Description**: Convert a link (HTMLAnchorElement or URL) to an abbreviated Location object. - **Primary Language**: Unknown - **License**: ISC - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-08-09 - **Last Updated**: 2025-09-27 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # @mapbox/link-to-location 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 ```js 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' } */ ```