Home / Function/ delete() — astro Function Reference

delete() — astro Function Reference

Architecture documentation for the delete() function in cookies.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  334ca8ee_5039_a932_680a_7755acc78324["delete()"]
  28935751_f2b1_4797_d41a_fc616c40e0a8["AstroCookies"]
  334ca8ee_5039_a932_680a_7755acc78324 -->|defined in| 28935751_f2b1_4797_d41a_fc616c40e0a8
  1eca20ec_d5f5_80f3_2ce1_84641921b4ed["set()"]
  334ca8ee_5039_a932_680a_7755acc78324 -->|calls| 1eca20ec_d5f5_80f3_2ce1_84641921b4ed
  style 334ca8ee_5039_a932_680a_7755acc78324 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/core/cookies/cookies.ts lines 84–107

	delete(key: string, options?: AstroCookieDeleteOptions): void {
		/**
		 * The `@ts-expect-error` is necessary because `maxAge` and `expires` properties
		 * must not appear in the AstroCookieDeleteOptions type.
		 */
		const {
			// @ts-expect-error
			maxAge: _ignoredMaxAge,
			// @ts-expect-error
			expires: _ignoredExpires,
			...sanitizedOptions
		} = options || {};
		const serializeOptions: SerializeOptions = {
			expires: DELETED_EXPIRATION,
			...sanitizedOptions,
		};

		// Set-Cookie: token=deleted; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT
		this.#ensureOutgoingMap().set(key, [
			DELETED_VALUE,
			serialize(key, DELETED_VALUE, serializeOptions),
			false,
		]);
	}

Domain

Subdomains

Calls

Frequently Asked Questions

What does delete() do?
delete() is a function in the astro codebase, defined in packages/astro/src/core/cookies/cookies.ts.
Where is delete() defined?
delete() is defined in packages/astro/src/core/cookies/cookies.ts at line 84.
What does delete() call?
delete() calls 1 function(s): set.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free