1.12.1 • Published 5 years ago
harbbor-sort v1.12.1
Installation
You can download harbbor-sort
from NPM
$ npm install harbbor-sort
then in your project require harbbor-sort
const harbborsort = require('harbbor-sort');
or GitHub
$ git clone https://github.com/leonardofurnielis1/harbbor-sort.git
Guide
const harbborsort = require('harbbor-sort');
// The addresses should be sorted
const addresses = ['/foo/bar', 'GET /foo', '/foo/bar/baz', 'foo'];
harbborsort(addresses);
// output
['GET /foo', 'foo', '/foo/bar', '/foo/bar/baz'];
Definition of a "route address"
This algorithm, a route address is a string containing:
- An optional HTTP verb prefix, followed by a space, followed by:
- 1 or more path components, where each path component is:
- A forward slash
/
, followed by: - A colon
:
followed by any combination of letters and numbers (a "param"), OR - A star
*
(a "wildcard"), OR - Any combination of letters and numbers
authenticate
- A forward slash
1.12.1
5 years ago