You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**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.
267
267
268
268
### Working with Tokens
269
269
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:
271
271
272
272
-`tokensToRegexp(tokens, keys?, options?)` Transform an array of tokens into a matching regular expression.
273
273
-`tokensToFunction(tokens)` Transform an array of tokens into a path generator function.
274
274
275
275
#### Token Information
276
276
277
277
-`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. `""`)
282
280
-`pattern` The RegExp used to match this token (`string`)
281
+
-`modifier` The modifier character used for the segment (e.g. `?`)
0 commit comments