Skip to content

Commit

Permalink
Bring up to date
Browse files Browse the repository at this point in the history
  • Loading branch information
philipahlberg committed Feb 17, 2023
1 parent 754ef4b commit 18b3350
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 35 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# trailblazer
`trailblazer` is a minimalist regular expression-generator for paths with named parameters.
Turn a path such as `/:foo` into a regular expression and extract the keys.
Turn a path such as `/:foo/:bar?` into a regular expression and extract the keys.

## Installation
```console
Expand Down
10 changes: 5 additions & 5 deletions benches/regexparam.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import regexparam from 'regexparam';
import { parse } from 'regexparam';

export default [
['[regexparam] static', () => {
regexparam('/abc');
parse('/abc');
}],
['[regexparam] parameter', () => {
regexparam('/:abc');
parse('/:abc');
}],
['[regexparam] optional', () => {
regexparam('/:abc?');
parse('/:abc?');
}],
['[regexparam] mixed', () => {
regexparam('/abc/:def/:ghi?');
parse('/abc/:def/:ghi?');
}]
];
2 changes: 1 addition & 1 deletion benches/trailblazer.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { compile } from '../dist/index.min.mjs';
import { compile } from '../dist/index.mjs';

export default [
['[trailblazer] static', () => {
Expand Down
17 changes: 1 addition & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"scripts": {
"build": "rollup -c rollup.config.js",
"test": "windtunnel test ./tests/index.mjs",
"bench": "npm run build && node -r esm benches/index.js"
"bench": "npm run build && node benches/index.js"
},
"devDependencies": {
"@rollup/plugin-node-resolve": "^13.0.0",
Expand All @@ -23,11 +23,10 @@
"@windtunnel/assert": "^0.5.1",
"@windtunnel/cli": "^0.5.1",
"benchmark": "^2.1.4",
"esm": "^3.2.25",
"path-to-regexp": "^6.2.0",
"regexparam": "^2.0.0",
"rollup": "^2.53.1",
"tslib": "^2.3.0",
"typescript": "^4.3.5"
}
}
}
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export const compile = (path: string, options: Options): Compile => {
} else if (segment === '*') {
pattern += WILDCARD;
} else {
pattern += '/' + segment;
pattern += `/${segment}`;
}
}

Expand Down
9 changes: 1 addition & 8 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,7 @@
"target": "ES2020",
"module": "ES2020",
"moduleResolution": "node",
"lib": [
"ES2015",
"ES2016",
"ES2017",
"ES2018",
"ES2019",
"ES2020"
],
"lib": ["ES2020"],
"declaration": true,
"strict": true,
"noUnusedLocals": true,
Expand Down

0 comments on commit 18b3350

Please sign in to comment.