MCPcopy
hub / github.com/elysiajs/elysia / get

Function get

src/compose.ts:687–704  ·  view source on GitHub ↗
(name: keyof CookieOptions, defaultValue?: unknown)

Source from the content-addressed store, hash-verified

685
686 if (hasCookie) {
687 const get = (name: keyof CookieOptions, defaultValue?: unknown) => {
688 // @ts-ignore
689 const value = cookieMeta?.[name] ?? defaultValue
690
691 if (value === undefined) return ''
692
693 if (!value)
694 return typeof defaultValue === 'string'
695 ? `${name}:"${defaultValue}",`
696 : `${name}:${defaultValue},`
697
698 if (typeof value === 'string')
699 return `${name}:${JSON.stringify(value)},`
700 if (value instanceof Date)
701 return `${name}: new Date(${value.getTime()}),`
702
703 return `${name}:${value},`
704 }
705
706 const options = cookieMeta
707 ? `{secrets:${

Callers 1

composeHandlerFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected