Skip to content

Commit 72b5f44

Browse files
committed
Update documentation on tokens
1 parent c0e071a commit 72b5f44

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

Readme.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -263,23 +263,22 @@ toPathRegexp({ id: "abc" }); //=> Throws `TypeError`.
263263
toPathRegexp({ id: "abc" }, { validate: false }); //=> "/user/abc"
264264
```
265265

266-
**Note:** The generated function will throw on invalid input. It will do all necessary checks to ensure the generated path is valid. This method only works with strings.
266+
**Note:** The generated function will throw on invalid input.
267267

268268
### Working with Tokens
269269

270-
Path-To-RegExp exposes the two functions used internally that accept an array of tokens.
270+
Path-To-RegExp exposes the two functions used internally that accept an array of tokens:
271271

272272
- `tokensToRegexp(tokens, keys?, options?)` Transform an array of tokens into a matching regular expression.
273273
- `tokensToFunction(tokens)` Transform an array of tokens into a path generator function.
274274

275275
#### Token Information
276276

277277
- `name` The name of the token (`string` for named or `number` for unnamed index)
278-
- `prefix` The prefix character for the segment (e.g. `/`)
279-
- `delimiter` The delimiter for the segment (same as prefix or default delimiter)
280-
- `optional` Indicates the token is optional (`boolean`)
281-
- `repeat` Indicates the token is repeated (`boolean`)
278+
- `prefix` The prefix string for the segment (e.g. `"/"`)
279+
- `suffix` The suffix string for the segment (e.g. `""`)
282280
- `pattern` The RegExp used to match this token (`string`)
281+
- `modifier` The modifier character used for the segment (e.g. `?`)
283282

284283
## Compatibility with Express <= 4.x
285284

0 commit comments

Comments
 (0)