# @firecamp/url

> URL utility to manage request's url

Latest version **0.0.20** (published 2023-02-10) · Apache-2.0 license · 0 weekly downloads

## Install

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

## Health

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

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

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.20 |
| Published | 2023-02-10 |
| First published | 2022-05-12 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=10 |
| Dependencies | 5 |
| Unpacked size | 77.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 317 |
| Maintainers | nishchit14 |

## Links

- npm: https://www.npmjs.com/package/@firecamp/url
- Repository: https://github.com/firecamp-io/firecamp/packages-misc/url
- npm.io page: https://npm.io/package/@firecamp/url

## Dependencies (5)

- [lodash](https://npm.io/package/lodash.md) ^4.17.21
- [nanoid](https://npm.io/package/nanoid.md) ^3.0.0
- [url-parse](https://npm.io/package/url-parse.md) 1.5.10
- [@firecamp/types](https://npm.io/package/@firecamp/types.md) 0.1.14
- [@firecamp/utils](https://npm.io/package/@firecamp/utils.md) 0.0.13

## Recent versions

- 0.0.20 (latest) — 2023-02-10
- 0.0.19 — 2023-02-02
- 0.0.18 — 2023-01-23
- 0.0.17 — 2022-11-26
- 0.0.16 — 2022-11-25
- 0.0.15 — 2022-11-03
- 0.0.14 — 2022-08-23
- 0.0.13 — 2022-08-17
- 0.0.12 — 2022-08-15
- 0.0.11 — 2022-08-08
- 0.0.10 — 2022-08-08
- 0.0.9 — 2022-08-03
- 0.0.8 — 2022-07-11
- 0.0.7 — 2022-06-24
- 0.0.6 — 2022-06-24
- … 6 more at https://npm.io/package/@firecamp/url/versions

## README

# URL Utility

**<ins>Usage</ins>**

__Update URL on update raw string__

```ts
import _url from '@firecamp/url'

// parse query, path params from raw URL and return URL Object
// with updated params table
state.urlObj = _url.updateByRaw(state.urlObj)
```

__Update URL on update query from table__

```ts
import _url from '@firecamp/url'

// Return URL object by updating query into raw URL from table
const { raw } = _url.updateByQuery(state.urlObj)

// Update raw URL into state
state.urlObj.raw = raw
```

__Parse URL__

```ts
import _url from '@firecamp/url'

// Parse URL string, require at the time of request execution
_url.parse('google.com', ['http', 'https])

// return http://google.com
```

__Replace Path Params value__

```ts
import _url from '@firecamp/url'

// Parse URL string, require at the time of request execution
_url.replacePathParams('http://localhost:3000/:id', [{ key: 'id', value: '1' }])

// return http://localhost:3000/1
```

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