1.1.2 • Published 6 years ago

lr-url-parser v1.1.2

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

lr-url-parser

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

Information-
Code coverageCoverage Status
Repo linklr-client-router
Dependencies-
Size (Browserify, Babel and Gzip)777 bytes
Version1.0.0
LicenseMIT
Usageguide

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' }.


1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.2

6 years ago

1.0.1

7 years ago

1.0.0

7 years ago