# reverend

> Merge an express-style path string with data to create a valid path.

Latest version **0.3.1** (published 2015-05-12) · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

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

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.3.1 |
| Published | 2015-05-12 |
| First published | 2014-03-11 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Erik Toth |
| Maintainers | totherik, jasisk |
| Keywords | express, path, merge, reverse |

## Links

- npm: https://www.npmjs.com/package/reverend
- Repository: https://github.com/krakenjs/reverend
- Issues: https://github.com/krakenjs/reverend/issues
- npm.io page: https://npm.io/package/reverend

## Dependencies (1)

- [path-to-regexp](https://npm.io/package/path-to-regexp.md) ^1.0.1

## 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

- 0.3.1 (latest) — 2015-05-12
- 0.3.0 — 2014-06-16
- 0.2.0 — 2014-03-27
- 0.1.0 — 2014-03-11

## README

**DEPRECATED**: `Reverend` has been deprecated and will no longer see updates. The underlying module used to create regular expressions from routes—[path-to-regexp](https://github.com/pillarjs/path-to-regexp)—has added reverse-routing functionality. Please favor it over `Reverend`. An api-compatible shim can be seen in the [shim](../shim/index.js) branch.

reverend
========

Lead Maintainer: [Jean-Charles Sisk](https://github.com/jasisk)  

[![Build Status](https://travis-ci.org/krakenjs/reverend.svg?branch=master)](https://travis-ci.org/krakenjs/reverend)  

Merge an express-style path string with data to create a valid path. Version 0.3.x adds support for
[Custom Match](https://github.com/component/path-to-regexp#custom-match-parameters) and
[Unnamed](https://github.com/component/path-to-regexp#unnamed-parameters) parameters as provided by path-to-regexp ^0.2.0.
To ensure compatibility, use the version of reverend compatible with path-to-regexp which most closely matches the
version your application uses.


## Usage
```javascript
var reverend = require('reverend');
```

### reverend(path, object);
* `path`  (*String|Array*) - An express-style path, or an array of paths, of which only the first element will be used.
* `object` (*Object*) - An object with keys matching the tokens to be replaced in the route.

```javascript
'use strict';

var reverend = require('reverend');


var path;

// Path params
path = reverend('/user/:id', { id: 5 });
// '/user/5';

// Optional path params
path = reverend('/user/:id/:operation?', { id: 5 });
// '/user/5/';

// Multiple path params
path = reverend('/user/:id/:operation', { id: 5, operation: address });
// '/user/5/address';

// Custom match parameters
path = reverend('/posts/:id(\\d+)', { id: 5 });
// '/post/5'

path = reverend('/posts/:id(\\d+)', { id: 'foo' }); // throws

// Unnamed params
path = reverend('/:foo/(.*)', { foo: 'foo', 0: 'bar' });
// '/foo/bar'

```

## License
MIT

## Tests, Coverage, Linting
```javascript
$ npm test
```
```javascript
$ npm run cover
```
```javascript
$ npm run lint
```

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