@zept/path-regexp
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

@zept/path-regexp

convert path to regexp

import { pathToRegexp } from '@zept/path-regexp';

pathToRegexp('/'); // { params: [], pattern: /^\/\/?$/i }
pathToRegexp('/hello'); // { params: [], pattern: /^\/hello\/?$/i }
pathToRegexp('/user/:user'); // { params: [ 'user' ], pattern: /^\/([^/]+?)\/?$/i }

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i @zept/path-regexp

Weekly Downloads

5

Version

0.0.1

License

none

Unpacked Size

4.28 kB

Total Files

6

Last publish

Collaborators

  • do4ng