rtd-core

1.0.1 • Public • Published

rtd-core

A minimalistic route parser for rtd powered by path-to-regexp.

Features

  • Tiny
  • Fast
  • Really easy to use

Install

$ npm install rtd-core

Usage

const rtdCore = require('rtd-core');
 
const route = rtdCore('/route/:id');
const match = route(url);
 
if (match == false) {
  // no match
} else {
  const id = match.id;
}

API

rtdCore(route)

route

Type: string

The route to match.

match(url)

Return false if there was no match or an object with the params if the routes matched.

url

Type: string

The url to match with the route

License

MIT ©

Readme

Keywords

none

Package Sidebar

Install

npm i rtd-core

Weekly Downloads

0

Version

1.0.1

License

MIT

Last publish

Collaborators

  • tobihrbr