<commit_before># path-parser

A small utility to parse and build paths.

## Usage

```javascript
var Path = require('path-parser');
// Defining a new path
var p = new Path('/users/profile/:id');
// Matching
p.match("users/profile/00123")               // => {id: "00123"}
p.partialMatch("users/profile/00123/orders") // => {id: "00123"}
p.partialMatch("profile/00123/orders")       // => false
// Building
p.build({id: '00123'})                       // => "users/profile/00123"
```

## Defining parameters

- `:param`: for URL parameters
- `*splat`: for parameters spanning over multiple segments. Handle with care
- `?param1&param2` or `?:param1&:param2`: for query parameters. Colons `:` are optional

## Related modules

- [url-pattern](https://github.com/snd/url-pattern)
- [route-parser](https://github.com/rcs/route-parser)<commit_msg>docs: update README<commit_after># path-parser

A small utility to parse and build paths. It can be used to partially or fully
match paths against a defined pattern.

Partial match allows to determine if a given path starts with the defined pattern.

## Usage

```javascript
var Path = require('path-parser');
// Defining a new path
var p = new Path('/users/profile/:id');
// Matching
p.match("users/profile/00123")               // => {id: "00123"}
// Partial matching: does this path
// starts with that pattern?
p.partialMatch("users/profile/00123/orders") // => {id: "00123"}
p.partialMatch("profile/00123/orders")       // => false
// Building
p.build({id: '00123'})                       // => "users/profile/00123"
```

## Defining parameters

- `:param`: for URL parameters
- `*splat`: for parameters spanning over multiple segments. Handle with care
- `?param1&param2` or `?:param1&:param2`: for query parameters. Colons `:` are optional

## Related modules

- [route-parser](https://github.com/rcs/route-parser)
- [url-pattern](https://github.com/snd/url-pattern)
{'fraction_non_alphanumeric': 0.16553524804177547, 'fraction_numerical': 0.04073107049608355, 'mean_word_length': 3.4662004662004664, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 4, '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': '5460631', 'n_tokens_mistral': 639, 'n_tokens_neox': 581, 'n_words': 168}