Skip to content

gulujs/pathname-store

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@gulujs/pathname-store

Installation

npm install @gulujs/pathname-store

Usage

import { PathnameStore } from '@gulujs/pathname-store';

const s = new PathnameStore();
s.add('/users', {});
s.add('/user/:name', {});

let r = s.find('/users');
console.log(r);
// output: { found: true, box: { store: {}, pnames: [] }, params: [] }

Pattern Rule

Syntax Description
:name named param
* match-all param
:name* named match-all param
  • Named parameters match anything until the next '/' or the path end.
  • Match-all param match anything until the path end.

Path matching order

  • Static
  • Param
  • Match all

Inspired by

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published