# @xylabs/url

[![npm][npm-badge]][npm-link]
[![license][license-badge]][license-link]

> Base functionality used throughout XY Labs TypeScript/JavaScript libraries

## Install

Using npm:

```sh
npm install {{name}}
```

Using yarn:

```sh
yarn add {{name}}
```

Using pnpm:

```sh
pnpm add {{name}}
```

Using bun:

```sh
bun add {{name}}
```


## License

See the [LICENSE](LICENSE) file for license rights and limitations (LGPL-3.0-only).

## Reference

### packages

  ### url

    ### .temp-typedoc

      ### index-browser

        ### functions

          ### <a id="isLocalhost"></a>isLocalhost

[**@xylabs/url**](#../../README)

***

```ts
function isLocalhost(hostname): boolean;
```

Checks whether a hostname refers to the local machine (localhost, 127.0.0.1, ::1, or *.localhost).

## Parameters

### hostname

`string`

The hostname to check

## Returns

`boolean`

`true` if the hostname is a localhost address

        ### variables

          ### <a id="URL"></a>URL

[**@xylabs/url**](#../../README)

***

```ts
const URL: (url, base?) => URL;
```

Browser-specific URL class, aliased from the global `URL`.

## Parameters

### url

`string` \| `URL`

### base?

`string` \| `URL`

## Returns

`URL`

      ### index-neutral

        ### variables

          ### <a id="URL"></a>URL

[**@xylabs/url**](#../../README)

***

```ts
const URL: (url, base?) => URL;
```

Platform-neutral URL class, aliased from the global `URL`.

## Parameters

### url

`string` \| `URL`

### base?

`string` \| `URL`

## Returns

`URL`

      ### index-node

        ### variables

          ### <a id="URL"></a>URL

[**@xylabs/url**](#../../README)

***

```ts
const URL: (url, base?) => URL;
```

Node.js-specific URL class, imported from the `node:url` module.

## Parameters

### url

`string` \| `URL`

### base?

`string` \| `URL`

## Returns

`URL`


[npm-badge]: https://img.shields.io/npm/v/@xylabs/url.svg
[npm-link]: https://www.npmjs.com/package/@xylabs/url
[license-badge]: https://img.shields.io/npm/l/@xylabs/url.svg
[license-link]: https://github.com/xylabs/sdk-js/blob/main/LICENSE
