Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 30 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,42 @@ on:
permissions:
contents: read
jobs:
test:
name: Node.js ${{ matrix.node-version }}
test-node:
name: Node.js (${{ matrix.node-version }})
runs-on: ubuntu-latest
strategy:
matrix:
node-version:
- "16"
- "*"
- "18"
- "latest"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- uses: actions/cache@v2
- uses: oven-sh/setup-bun@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- run: npm ci
- run: npm test
- uses: codecov/codecov-action@v1
bun-version: "1.2.0"
- run: bun install
- run: bun run test # runs tests with Vitest
- uses: codecov/codecov-action@v5
with:
name: Node.js ${{ matrix.node-version }}
name: Node.js (${{ matrix.node-version }})
test-bun:
name: Bun (${{ matrix.bun-version }})
runs-on: ubuntu-latest
strategy:
matrix:
bun-version:
- "1.2.0"
- "latest"
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: ${{ matrix.bun-version }}
- run: bun install
- run: bun run test:bun # runs tests with Bun
- uses: codecov/codecov-action@v5
with:
name: Bun (${{ matrix.bun-version }})
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ node_modules/
coverage/
dist/
dist.es2015/
*.tsbuildinfo
12 changes: 9 additions & 3 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@

## Installation

```
npm install path-to-regexp --save
Install with your choice of package manager: npm, yarn, or bun.

```sh
npm install path-to-regexp
yarn add path-to-regexp
bun add path-to-regexp
```

## Usage
Expand All @@ -26,6 +30,8 @@ const {
} = require("path-to-regexp");
```

This library is compatible and tested with Node.js 16+ and Bun 1.2+.

### Parameters

Parameters match arbitrary strings in a path by matching up to the end of the segment, or up to any proceeding tokens. They are defined by prefixing a colon to the parameter name (`:foo`). Parameter names can use any valid JavaScript identifier, or be double quoted to use other characters (`:"param-name"`).
Expand Down Expand Up @@ -141,7 +147,7 @@ const path = stringify(data); //=> "/:foo"

### Parse

The `parse` function accepts a string and returns `TokenData`, the set of tokens and other metadata parsed from the input string. `TokenData` is can used with `match` and `compile`.
The `parse` function accepts a string and returns `TokenData`, which can be used with `match` and `compile`.

- **path** A string.
- **options** _(optional)_
Expand Down
5 changes: 0 additions & 5 deletions SECURITY.md

This file was deleted.

3 changes: 3 additions & 0 deletions bunfig.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[test]
coverage = true
coverageReporter = ["text", "lcov"]
Loading