# @browserpass/url

> Extended URL class with domain analysis

Latest version **1.2.0** (published 2025-07-25) · ISC license · 0 weekly downloads

## Install

```sh
npm install @browserpass/url
pnpm add @browserpass/url
yarn add @browserpass/url
bun add @browserpass/url
```

## Health

**Score 25/100 (F)** — status: maintenance-mode.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2025-07-25 |
| First published | 2019-09-29 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 169.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Maintainers | erayd, maximbaz |

## Links

- npm: https://www.npmjs.com/package/@browserpass/url
- Repository: https://github.com/browserpass/browserpass-url
- Issues: https://github.com/browserpass/browserpass-url/issues
- npm.io page: https://npm.io/package/@browserpass/url

## Dependencies (1)

- [punycode.js](https://npm.io/package/punycode.js.md) ^2.3.1

## Recent versions

- 1.2.0 (latest) — 2025-07-25
- 1.1.6 — 2020-02-15
- 1.1.5 — 2019-10-31
- 1.1.4 — 2019-10-31
- 1.1.3 — 2019-10-12
- 1.1.2 — 2019-09-29
- 1.1.1 — 2019-09-29
- 1.1.0 — 2019-09-29
- 1.0.0 — 2019-09-29

## README

# BrowserpassURL

This package is an extension of the built-in [URL][1] class, which adds some additional properties based on the domain.

The TLD list used by this module is downloaded from [publicsuffix.org][2] when building, if it's older than one day.

[1]: https://developer.mozilla.org/en-US/docs/Web/API/URL
[2]: https://publicsuffix.org/

## Usage

```JS
const BrowserpassURL = require("@browserpass/url");
var url = new BrowserpassURL("http://www.example.com/test");

console.log(url.validDomain); // true
console.log(url.tld); // com
console.log(url.domain); // example.com
console.log(url.subdomain); // www
console.log(url.hostname); // www.example.com

// parse a raw hostname (with optional port), rather than a full URL
var urlDomainOnly = BrowserpassURL.parseHost("www.example.com:8080");
console.log(urlDomainOnly);
/* {
 *    hostname: 'www.example.com',
 *    tld: 'com',
 *    domain: 'example.com',
 *    subdomain: 'www',
 *    validDomain: true,
 *    port: '8080'
 * }
 */
```

## Extra Properties

| Property    | Description                                     |
| ----------- | ----------------------------------------------- |
| validDomain | Whether the URL contains a valid, public domain |
| tld         | The public TLD component of the domain          |
| domain      | The registered domain root                      |
| subdomain   | The subdomain portion of the hostname           |

---
_Source: https://npm.io/package/@browserpass/url · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
