<commit_before># Routable

[![Build Status](https://travis-ci.org/3rd-Eden/routable.png)](https://travis-ci.org/3rd-Eden/routable)

Routable is a lightweight route parser for Node.js. It's primary focus is to
parse routes, and that's it. It's modeled against the RegExp instance so it's
usage feels really natural to developers.

### Installation

Installation is done through `npm`:

```
npm instal --save routable
```

### Getting Started

Include module in your application:

```js
var Route = require('routable');
```

Create a new `Route` instance with an URL we need to match against:

```js
var route = new Route('/foo');
```

To learn more about the API, please visit the API documentation:

- https://github.com/3rd-Eden/routable/blob/master/docs/README.md

## License

MIT<commit_msg>[doc] Improving documentation<commit_after># Routable

[![Build Status](https://travis-ci.org/3rd-Eden/routable.png)](https://travis-ci.org/3rd-Eden/routable)

Routable is a lightweight regular expression inspired HTTP route parser for
Node.js. It only has one goal and that is to match and parse URL's for
frameworks.

### Installation

The module is released in the `npm` registry as `routable`:

```
npm install --save routable
```

The `--save` automatically adds the routable module to your package.json.

### Getting started

All the examples in this getting started assume that you have included the
module in your code and exposed it as a `Routable` variable:

```js
'use strict';

var Routable = require('routable');
```

To create a new route simply construct a new `Routable` instance with an URL
pattern:

```js
var foo = new Routable('/foo');
```

There are different patterns that can be used for testing against URL's.
Routable supports testing against strings, Regular Expressions and even xRegExp
based expressions. See [patterns](#patterns) for more details.

Now that you've created your first `Routable` instance you can use it to test
against URL's. To see if a URL matches the your `Routable` instance you can use
the `Routable#test` method:

#### Routable.test(url)

Just like the `RegularExpression.test` method, it returns a boolean indicating
if the given string matches the expression or not. The same is true for
`Routable` but instead of testing a Regular Express you're testing your pattern.

```js
var foo = new Routable('/foo');

foo.test('/bar');   // false;
foo.test('/foo');   // true;
foo.test('/fooo');  // false;
```

While quickly testing an URL is useful sometimes you also want to parse out the
information from the URL. If you have a capturing or named Regular Expression or
string you can use the `routable#exec`

### Patterns

- Regular Expressions `/\/foo/`.
- Capturing Regular Expressions `/\/(foo|bar)\/bar/`.
- Capturing strings `/foo/:bar/1/:baz`.
- Plain strings `/foo/bar`

## License

MIT
{'fraction_non_alphanumeric': 0.11358024691358025, 'fraction_numerical': 0.0021164021164021165, 'mean_word_length': 4.310861423220974, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 5, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1104347', 'n_tokens_mistral': 881, 'n_tokens_neox': 821, 'n_words': 358}