AstroCookie Class — astro Architecture
Architecture documentation for the AstroCookie class in cookies.ts from the astro codebase.
Entity Profile
Dependency Diagram
graph TD 9019ce5c_5105_281b_be6c_cc494b6e05a2["AstroCookie"] b5fc2880_5111_4957_5d79_b9e1839f86d6["cookies.ts"] 9019ce5c_5105_281b_be6c_cc494b6e05a2 -->|defined in| b5fc2880_5111_4957_5d79_b9e1839f86d6 a92f219d_7eb4_76a2_efa0_ba02f05284dc["constructor()"] 9019ce5c_5105_281b_be6c_cc494b6e05a2 -->|method| a92f219d_7eb4_76a2_efa0_ba02f05284dc bbea8104_7939_af5c_ec51_0bf2a721e9a1["json()"] 9019ce5c_5105_281b_be6c_cc494b6e05a2 -->|method| bbea8104_7939_af5c_ec51_0bf2a721e9a1 7031c308_97c9_af65_d05d_231f7d56b541["number()"] 9019ce5c_5105_281b_be6c_cc494b6e05a2 -->|method| 7031c308_97c9_af65_d05d_231f7d56b541 b77f89dc_f4cd_30df_ea6b_24947b56725f["boolean()"] 9019ce5c_5105_281b_be6c_cc494b6e05a2 -->|method| b77f89dc_f4cd_30df_ea6b_24947b56725f
Relationship Graph
Source Code
packages/astro/src/core/cookies/cookies.ts lines 48–64
class AstroCookie implements AstroCookieInterface {
constructor(public value: string) {}
json() {
if (this.value === undefined) {
throw new Error(`Cannot convert undefined to an object.`);
}
return JSON.parse(this.value);
}
number() {
return Number(this.value);
}
boolean() {
if (this.value === 'false') return false;
if (this.value === '0') return false;
return Boolean(this.value);
}
}
Domain
Defined In
Source
Frequently Asked Questions
What is the AstroCookie class?
AstroCookie is a class in the astro codebase, defined in packages/astro/src/core/cookies/cookies.ts.
Where is AstroCookie defined?
AstroCookie is defined in packages/astro/src/core/cookies/cookies.ts at line 48.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free