# @bbfan/populate-url

> Helps to manage your URL templates and populate parameters to it. Has a TS type validation that shows required template params to be filled.

Latest version **1.0.5** (published 2021-12-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install @bbfan/populate-url
pnpm add @bbfan/populate-url
yarn add @bbfan/populate-url
bun add @bbfan/populate-url
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2021-12-06 |
| First published | 2021-12-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 104 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Bogdan Burdin |
| Maintainers | bbfan |
| Keywords | npm, package, bbfan, populate, URL, link, template |

## Links

- npm: https://www.npmjs.com/package/@bbfan/populate-url
- Repository: https://github.com/burdinbogdan/populateUrl
- Homepage: https://github.com/burdinbogdan/populateUrl#readme
- Issues: https://github.com/burdinbogdan/populateUrl/issues
- npm.io page: https://npm.io/package/@bbfan/populate-url

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 1.0.5 (latest) — 2021-12-06
- 1.0.4 — 2021-12-05
- 1.0.3 — 2021-12-05
- 1.0.2 — 2021-12-05
- 1.0.1 — 2021-12-05
- 1.0.0 — 2021-12-05

## README

# @bbfan/populate-url

Helps to populate your URL with path and query parameters.
Has a TS support, that parse constant templates and shows expected parameters.

## Install

```
$ npm install @bbfan/populate-url
```

## Usage

```js
const ROUTES = {
  testRoute: '/test/:testId/foo/:bar?id=:id',
} as const;

const populatedUrl = populateUrl(ROUTES.testRoute, {
  id: 123,
  bar: 'test',
  testId: null,
});

console.log(populatedUrl); // /test/null/foo/test?id=123
```

### Examples of valid URL formats

```
http://test.com/path/:param1/:param2/?id=:id&test=:test

/test.com/path/:param1/:param2/?id=:id&test=:test

test.com/path/:param1/:param2/?id=:id&test=:test

test.com/path/:param1/:param2?id=:id&test=:test

/path/:param1/:param2?id=:id&test=:test

path/:param1/:param2?id=:id&test=:test

path/:param1/:param2
```

## TS Hints Support

![plot](./assets/ts-type-support.png)

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