We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bf2c888 commit 35e0839Copy full SHA for 35e0839
token.ts
@@ -64,6 +64,9 @@ export type Tchar =
64
*/
65
const reToken = /^[\w!#$%&'*+.^`|~-]+$/;
66
67
+/** Representation of [token](https://www.rfc-editor.org/rfc/rfc9110.html#section-5.6.2-2). */
68
+export type Token = `${Tchar}${string}`;
69
+
70
/** Whether the input is [token](https://www.rfc-editor.org/rfc/rfc9110.html#section-5.6.2-2) or not.
71
*
72
* @example
@@ -79,7 +82,7 @@ const reToken = /^[\w!#$%&'*+.^`|~-]+$/;
79
82
* assertFalse(isToken(""));
80
83
* ```
81
84
-export function isToken(input: string): input is `${Tchar}${string}` {
85
+export function isToken(input: string): input is Token {
86
return reToken.test(input);
87
}
88
0 commit comments