3.1.0 • Published 5 years ago

@marvinh/path-to-regexp v3.1.0

Weekly downloads
951
License
MIT
Repository
-
Last release
5 years ago

Fast Path To RegExp

Ultra small and super fast library for converting paths to RegExp. Only implements a subset of path-to-regexp.

:myparam -> named parameters, f.ex. /bar/:foo
* -> wildcard catchall, f.ex. /bar/*/foo

Usage

Installation:

# via npm
npm install --save @marvinh/path-to-regexp

# via yarn
yarn add @marvinh/path-to-regexp
import { PathRegExp } from "@marvinh/path-to-regexp";

const Path = new PathRegExp("foo/:bar/*/bob");

// Returns params on match
Path.match("foo/asd/a/");
// -> {
//  matched: "", // The remaining part if any
//  params: { bar: "asd" }
// }

License

MIT, see License file.

3.1.0

5 years ago

3.0.0

6 years ago

2.0.0

6 years ago

1.0.2

6 years ago

1.0.1

7 years ago

1.0.0

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago