# burla

> URL manipulation library

Latest version **0.7.0** (published 2026-10-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install burla
pnpm add burla
yarn add burla
bun add burla
```

## Health

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

Positive: esm support; no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; no types; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.7.0 |
| Published | 2026-10-24 |
| First published | 2019-06-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 9.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 11 |
| Author | Francisco Presencia |
| Maintainers | franciscop |
| Keywords | url, manipulation, history, library, redirect, replace, browser, js |

## Links

- npm: https://www.npmjs.com/package/burla
- Repository: https://github.com/franciscop/burla
- Homepage: https://github.com/franciscop/burla#readme
- Issues: https://github.com/franciscop/burla/issues
- Funding: https://www.paypal.me/franciscopresencia/19
- npm.io page: https://npm.io/package/burla

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 0.7.0 (latest) — 2026-10-24
- 0.6.0 — 2019-09-05
- 0.5.0 — 2019-09-05
- 0.4.0 — 2019-09-01
- 0.3.0 — 2019-07-22
- 0.2.1 — 2019-07-20
- 0.2.0 — 2019-07-16
- 0.1.0 — 2019-06-08

## README

# burla - better url abstraction [![npm install burla](https://img.shields.io/badge/npm%20install-burla-blue.svg)](https://www.npmjs.com/package/burla) [![tests](https://github.com/franciscop/burla/workflows/tests/badge.svg)](https://github.com/franciscop/burla/actions) [![gzip size](https://img.badgesize.io/franciscop/burla/master/index.js.svg?compression=gzip)](https://github.com/franciscop/burla/blob/master/index.js)

A URL manipulation library using the History API:

```js
// https://example.com/users
import url from 'burla';

url.path = '/hello/world'; // No refresh here
// https://example.com/hello/world
```

Can change queries easily even when there's already a search query:

```js
// https://example.com/?language=es
import url from 'burla';

// Change a single query while maintaining the rest:
url.query.text = 'hello';
// https://example.com/?language=es&text=hello

// Works with query arrays:
url.query.language = ['en', 'es'];
// https://example.com/?language[]=en&language[]=es&text=hello

// Remove a single query:
delete url.query.language;
// https://example.com/?text=hello
```

The default export will manipulate the `window.location`, effectively changing the current browser URL and adding a new page to the history. You can also [manipulate url strings without changing the browser](#manipulate-local-urls).



## API

### `.path` (or `.pathname`)

Change the full path in the browser:

```js
// Path - redirect to the url without refresh
// https://example.com/users
import url from 'burla';

url.path = '/hello/world';
// https://example.com/hello/world
```

Redirect a React Router page without worries:

```js
import url from 'burla';

export default () => {
  const login = () => {
    // do something fancy here

    url.path = '/user';
  };
  return <div onClick={login}>Login!</div>;
};
```


### `.query`

Modify parameters from the query string independently:

```js
// https://example.com/?code=123
import url from 'burla';

const code = url.query.code;
delete url.query.code;
// https://example.com/

url.query.logged = true;
// https://example.com/?logged=true

console.log(typeof url.query.logged);
// string
```

They are always casted to strings and url entities are escapped, as standard with search strings.

If you want to modify several parameters at once without triggering different history events, you can call `.query = { ... }` with the parameters. This will accept **all** the new parameters, ignoring previous ones:

```js
// https://example.com/?code=a1b2
import url from 'burla';

// To maintain the previous parameters with the function, add them manually:
url.query = { ...url.query, user: 'franciscop' };
// https://example.com/?code=a1b2&user=franciscop

// Otherwise the previous parameters will be removed:
url.query = { logged: true };
// https://example.com/?logged=true
```



### `.hash`

Read the hash (without the `#` symbol) and modify it:

```js
// https://example.com/#better-section
import url from 'burla';

url.hash = 'abc';
// https://example.com/#abc
```



### URL()

This can be imported in two ways:

```js
import burla, { URL } from 'burla';

console.log(burla.URL('http://localhost/'));  // Method 1
console.log(URL('http://localhost/'));  // Method 2
```

You can create and manipulate URLs without affecting the `window.location`:

```js
import burla from 'burla';

// Create a new url that is detached from `window.location`:
const url = URL('https://example.com/');
url.query.code = '123456';  // <- no redirects
console.log(url.href);
// https://example.com/?code=123456
```

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