# fast-decode-uri-component

> Fast and safe decodeURIComponent

Latest version **1.0.1** (published 2019-03-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install fast-decode-uri-component
pnpm add fast-decode-uri-component
yarn add fast-decode-uri-component
bun add fast-decode-uri-component
```

## Health

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

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

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2019-03-15 |
| First published | 2018-03-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/fast-decode-uri-component) |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 30 |
| Author | Tomas Della Vedova - @delvedor |
| Maintainers | delvedor |
| Keywords | decode, uri, component, fast, safe |

## Links

- npm: https://www.npmjs.com/package/fast-decode-uri-component
- Repository: https://github.com/delvedor/fast-decode-uri-component
- Homepage: https://github.com/delvedor/fast-decode-uri-component#readme
- Issues: https://github.com/delvedor/fast-decode-uri-component/issues
- npm.io page: https://npm.io/package/fast-decode-uri-component

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2019-03-15
- 1.0.0 — 2018-03-19

## README

# fast-decode-uri-component

[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](http://standardjs.com/)  [![Build Status](https://travis-ci.org/delvedor/fast-decode-uri-component.svg?branch=master)](https://travis-ci.org/delvedor/fast-decode-uri-component)

Decodes strings encoded by `encodeURI` and `encodeURIComponent`, without throwing errors on invalid escapes, instead, it returns `null`.


## Installation
```
npm install fast-decode-uri-component
```

## Usage
```js
const fastDecode = require('fast-decode-uri-component')

console.log(fastDecode('test')) // 'test'
console.log(fastDecode('%25')) // '%'
console.log(fastDecode('/test/hel%2Flo')) // '/test/hel/lo'

console.log(fastDecode('/test/hel%"Flo')) // null
console.log(fastDecode('%7B%ab%7C%de%7D')) // null
console.log(fastDecode('%ab')) // null
```

## Benchmarks
You can find the benchmark file [here](https://github.com/delvedor/fast-decode-uri-component/blob/master/bench.js).
```
# fast-decode-uri-component
ok ~539 ms (0 s + 539114308 ns)

# decodeURIComponent
ok ~6.06 s (6 s + 62305153 ns)
```

## Acknowledgements
This project has been forked from [`jridgewell/safe-decode-uri-component`](https://github.com/jridgewell/safe-decode-uri-component) because I wanted to change the behaviour of the library on invalid inputs, plus change some internals.<br>
All the credits before the commit [`53000fe`](https://github.com/delvedor/fast-decode-uri-component/commit/53000feb8c268eec7a24620fd440fdd540be32b7) goes to the `jridgewell/safe-decode-uri-component` project [contributors](https://github.com/delvedor/fast-decode-uri-component/graphs/contributors).<br>
Since the commit [`9673ab7`](https://github.com/delvedor/fast-decode-uri-component/commit/9673ab7820ef92081206a9f4fd158ffe9a352861) the project will be maintained by [**@delvedor**](https://github.com/delvedor).

## License

Licensed under [MIT](./LICENSE).

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