lr-url-parser

1.1.2 • Public • Published

lr-url-parser

Parser that can take placeholders from urls and match them with real urls

Information -
Code coverage Coverage Status
Repo link lr-client-router
Dependencies -
Size (Browserify, Babel and Gzip) 777 bytes
Version 1.0.0
License MIT
Usage guide

Adding the parser to lagoon road

require('lr-main')('client')
  .parser(require('lr-url-parser'));

parser.add(path)

parser.add('blog/:id');

path:string
Add a route including placeholders to the parser, it will use it later for parsing.


parser.parse(path)

parser.parse('blog/1');
// Returns { path : 'blog/:id', parameters : { id : 1 } }

path:string
Parse an incoming route and check if it exists. If it exists it will extract possible parameters and give back the original url. If no match could be made the path is returned in object form like { path : '/original-path' }.


Readme

Keywords

Package Sidebar

Install

npm i lr-url-parser

Weekly Downloads

0

Version

1.1.2

License

MIT

Unpacked Size

9.47 kB

Total Files

5

Last publish

Collaborators

  • braadworst