Skip to content

Commit 35e0839

Browse files
committed
feat(token): export related types
1 parent bf2c888 commit 35e0839

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

token.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ export type Tchar =
6464
*/
6565
const reToken = /^[\w!#$%&'*+.^`|~-]+$/;
6666

67+
/** Representation of [token](https://www.rfc-editor.org/rfc/rfc9110.html#section-5.6.2-2). */
68+
export type Token = `${Tchar}${string}`;
69+
6770
/** Whether the input is [token](https://www.rfc-editor.org/rfc/rfc9110.html#section-5.6.2-2) or not.
6871
*
6972
* @example
@@ -79,7 +82,7 @@ const reToken = /^[\w!#$%&'*+.^`|~-]+$/;
7982
* assertFalse(isToken(""));
8083
* ```
8184
*/
82-
export function isToken(input: string): input is `${Tchar}${string}` {
85+
export function isToken(input: string): input is Token {
8386
return reToken.test(input);
8487
}
8588

0 commit comments

Comments
 (0)