@nodescript/pathmatcher
TypeScript icon, indicating that this package has built-in type declarations

1.2.0 • Public • Published

Pathmatcher

Path matching utils for pathname-based routing.

Key features

  • 🔥 Zero dependencies
  • 👗 Very slim — just few hundred bytes gzipped
  • ⚡️ Blazing fast
  • 💻 Works in browser
  • 🗜 Tidy and compact
  • 🌳 Ergonomic
  • 🔬 Strongly typed
  • 💎 Very strict feature set

Usage

import { matchPath } from '@nodescript/pathmatcher';

matchPath('/users/{name}', '/users/joe');   // { name: 'joe' }
matchPath('/users/{name}', '/users/', );    // null — no match
matchPath('/users', '/users');              // {} — match with no parameters
matchPath('/users/', '/users');             // {} — note: trailing slashes are ignored both ways

// Prefix mode — match only the beginning of the path
matchPath('/users', '/users/foo', true);    // {} — match with no parameters

Readme

Keywords

none

Package Sidebar

Install

npm i @nodescript/pathmatcher

Weekly Downloads

79

Version

1.2.0

License

ISC

Unpacked Size

7.78 kB

Total Files

5

Last publish

Collaborators

  • danielolaviobr
  • danilidonbeltran
  • christellevs
  • inca