token

import { token } from "jsr:@ende/http/unstable-structured-fields";

function ยท experimental

function token(value: string): Extract<BareItem, { type: "token" }>

Creates a token Bare Item.

value: string

The token value. Must start with ALPHA or '*' and contain only token characters; validated during serialization.

Returns

A Bare Item of type token.

Example: Usage

import { token } from "@ende/http/unstable-structured-fields";
import { assertEquals } from "@ende/assert";

assertEquals(token("foo"), { type: "token", value: "foo" });

Source