# @tinkoff/url

> Utilities to work with urls. Based on standard implementation of [URL](https://url.spec.whatwg.org/#url-class) and [URLSearchParams](https://url.spec.whatwg.org/#interface-urlsearchparams), in case environment does not support these object polyfills shoul

Latest version **0.12.4** (published 2026-03-17) · Apache-2.0 license · 0 weekly downloads

## Install

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

## Health

**Score 60/100 (C)** — status: active.

Positive: has types; esm support; no vulnerabilities; high maintenance score.

Warnings: low downloads; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.12.4 |
| Published | 2026-03-17 |
| First published | 2021-09-02 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 16.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 130 |
| Maintainers | tinkoffbank, dmitry-korolev, yeahga, hondasmx, makar_l, rouland, ishivan, ytsareva, shoom3301, waterplea, meskill, marsibarsi, zig-green, super_oleg, dersizes, alexkvak, sradyukov |

## Links

- npm: https://www.npmjs.com/package/@tinkoff/url
- Repository: https://github.com/tramvaijs/tramvai
- Homepage: https://github.com/tramvaijs/tramvai#readme
- Issues: https://github.com/tramvaijs/tramvai/issues
- npm.io page: https://npm.io/package/@tinkoff/url

## Dependencies (2)

- [tslib](https://npm.io/package/tslib.md) ^2.4.0
- [@tinkoff/utils](https://npm.io/package/@tinkoff/utils.md) ^2.1.2

## Recent versions

- 0.12.4 (latest) — 2026-03-17
- 0.13.1 (prerelease) — 2025-12-26
- 0.11.7 (stable-v5.x.x) — 2025-12-26
- 0.12.3 — 2025-12-26
- 0.12.2 — 2025-12-18
- 0.11.6 — 2025-12-18
- 0.11.5 — 2025-11-19
- 0.11.4 — 2025-09-23
- 0.11.3 — 2025-09-16
- 0.12.1 — 2025-09-16
- 0.10.3 — 2024-10-17
- 0.11.2 — 2024-10-02
- 0.10.1 — 2024-04-03
- 0.9.2 — 2023-11-27
- 0.9.1 — 2023-10-24
- … 10 more at https://npm.io/package/@tinkoff/url/versions

## README

# @tinkoff/url

Utilities to work with urls. Based on standard implementation of [URL](https://url.spec.whatwg.org/#url-class) and [URLSearchParams](https://url.spec.whatwg.org/#interface-urlsearchparams), in case environment does not support these object polyfills should be used, [e.g. core-js](https://github.com/zloirock/core-js#url-and-urlsearchparams).

## Api

### parse

Parses url and returns object of class URL with additional property query which represents searchParams as a simple object.

```tsx
import { parse } from '@tinkoff/url';

const url = parse('https://tinkoff.ru/test/?a=1&b=2#abc');

url.protocol; // => :https
url.href; // => https://tinkoff.ru/test/?a=1&b=2#abc
url.origin; // => https://tinkoff.ru
url.pathname; // => /test/
url.hash; // => #abc
url.query; // => { a: '1', b: '2' }
```

### rawParse

Same as [parse](#parse) but instead of returning wrapper for URL returns raw URL object

### resolve

Computes absolute url for relative url of base value

```tsx
import { resolve } from '@tinkoff/url';

resolve('//tinkoff.ru', './test123'); // => http://tinkoff.ru/test123
resolve('//tinkoff.ru/a/b/c/', '../../test'); // => http://tinkoff.ru/a/test
resolve('https://tinkoff.ru/a/b/c/?test=123#abc', '.././test/?me=123#123'); // => https://tinkoff.ru/a/b/test/?me=123#123
```

### resolveUrl

Computes absolute url for relative url of base value. Unlike [resolve](#resolve) can accept string or URL and return URL wrapper

### rawResolveUrl

Same as [resolveUrl](#resolveurl) but instead of returning wrapper for URL returns raw URL object

### isAbsoluteUrl

Checks that passed string is absolute url

### isInvalidUrl

Checks that passed string represents invalid url

```tsx
import { isAbsoluteUrl } from '@tinkoff/url';

isAbsoluteUrl('https://www.exmaple.com'); // true - secure http absolute URL
isAbsoluteUrl('//cdn.example.com/lib.js'); // true - protocol-relative absolute URL
isAbsoluteUrl('/myfolder/test.txt'); // false - relative URL
```

### convertRawUrl

Returns handy wrapper for URL in form of plain object with some additional fields

### rawAssignUrl

Allows to set parameters to passed raw URL object (**passed URL-object will be changed**)

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