# path-match

> wrapper around path-to-regexp for easy route parameters

Latest version **1.2.4** (published 2016-02-27) · MIT license · 0 weekly downloads

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

## Install

```sh
npm install path-match
pnpm add path-match
yarn add path-match
bun add path-match
```

## Health

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

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.2.4 |
| Published | 2016-02-27 |
| First published | 2014-04-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 136 |
| Author | Jonathan Ong |
| Maintainers | jongleberry, mscdex, dougwilson, fishrock123, defunctzombie |
| Keywords | route, router, routing, path, regex, regexp, param, params |

## Links

- npm: https://www.npmjs.com/package/path-match
- Repository: https://github.com/pillarjs/path-match
- Homepage: https://github.com/pillarjs/path-match#readme
- Issues: https://github.com/pillarjs/path-match/issues
- npm.io page: https://npm.io/package/path-match

## Dependencies (2)

- [http-errors](https://npm.io/package/http-errors.md) ~1.4.0
- [path-to-regexp](https://npm.io/package/path-to-regexp.md) ^1.0.0

## Alternatives

- [express-promise-router](https://npm.io/package/express-promise-router.md) — 736.1K weekly downloads
- [next-usequerystate](https://npm.io/package/next-usequerystate.md) — 29.8K weekly downloads
- [@bitkyc08/opencodex](https://npm.io/package/@bitkyc08/opencodex.md) — 4.6K weekly downloads
- [lynkr](https://npm.io/package/lynkr.md) — 575 weekly downloads
- [baremetal.js](https://npm.io/package/baremetal.js.md) — 42 weekly downloads

## Recent versions

- 1.2.4 (latest) — 2016-02-27
- 1.2.3 — 2015-07-02
- 1.2.2 — 2014-09-10
- 1.2.1 — 2014-09-10
- 1.2.0 — 2014-08-17
- 1.1.1 — 2014-06-11
- 1.1.0 — 2014-04-17
- 1.0.0 — 2014-04-05

## README

# path match

[![NPM version][npm-image]][npm-url]
[![Build status][travis-image]][travis-url]
[![Test coverage][coveralls-image]][coveralls-url]
[![Dependency Status][david-image]][david-url]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url]

Thin wrapper around [path-to-regexp](https://github.com/component/path-to-regexp) to make extracting the param names easier.

```js
var route = require('path-match')({
  // path-to-regexp options
  sensitive: false,
  strict: false,
  end: false,
});

// create a match function from a route
var match = route('/post/:id');

// match a route
var parse = require('url').parse;
require('http').createServer(function (req, res) {
  var params = match(parse(req.url).pathname);

  // no match
  if (params === false) {
    res.statusCode = 404;
    res.end();
    return;
  }

  // the matched id
  var id = params.id;

  // do stuff with the ID
})
```

[npm-image]: https://img.shields.io/npm/v/path-match.svg?style=flat-square
[npm-url]: https://npmjs.org/package/path-match
[github-tag]: http://img.shields.io/github/tag/pillarjs/path-match.svg?style=flat-square
[github-url]: https://github.com/pillarjs/path-match/tags
[travis-image]: https://img.shields.io/travis/pillarjs/path-match.svg?style=flat-square
[travis-url]: https://travis-ci.org/pillarjs/path-match
[coveralls-image]: https://img.shields.io/coveralls/pillarjs/path-match.svg?style=flat-square
[coveralls-url]: https://coveralls.io/r/pillarjs/path-match?branch=master
[david-image]: http://img.shields.io/david/pillarjs/path-match.svg?style=flat-square
[david-url]: https://david-dm.org/pillarjs/path-match
[license-image]: http://img.shields.io/npm/l/path-match.svg?style=flat-square
[license-url]: LICENSE.md
[downloads-image]: http://img.shields.io/npm/dm/path-match.svg?style=flat-square
[downloads-url]: https://npmjs.org/package/path-match

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