# pct-encode

> Percent-encode characters in strings matching a regular expression

Latest version **1.0.3** (published 2024-05-13) · BSD-2-Clause license · 0 weekly downloads

## Install

```sh
npm install pct-encode
pnpm add pct-encode
yarn add pct-encode
bun add pct-encode
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2024-05-13 |
| First published | 2013-05-22 |
| Weekly downloads | 0 |
| License | BSD-2-Clause |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 3.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Maintainers | grncdr |
| Keywords | uri, url, pct, encode |

## Links

- npm: https://www.npmjs.com/package/pct-encode
- Repository: https://github.com/grncdr/pct-encode
- Homepage: https://github.com/grncdr/pct-encode#readme
- Issues: https://github.com/grncdr/pct-encode/issues
- npm.io page: https://npm.io/package/pct-encode

## 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.3 (latest) — 2024-05-13
- 1.0.2 — 2015-11-16
- 1.0.1 — 2013-10-24
- 1.0.0 — 2013-05-22

## README

# pct-encode

Create versions of strings where characters that match a regular expression are percent encoded.

## Synopsis

```javascript
var pctEncode = require("pct-encode");

var encode = pctEncode(/\W/g);

console.log(encode("UTF-8 in your URIs: ✓")); // UTF-8%20in%20your%20URIs%3A%20%E2%9C%93
```

## API

### module.exports = function (regexp) -> function encode(string)

Given a regular expression, this returns a function that takes a string and
returns a copy with characters that match `regexp` percent-encoded.

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