1
0
Fork 0
forked from TWS/kalkutago
kalkutago/client/src/util.ts

8 lines
322 B
TypeScript

export function getCookie(key: string): string | null {
const start = document.cookie.indexOf(key + '=')
if(start === -1) return null
let end: number | undefined = document.cookie.indexOf(';', start)
if(end === -1)
end = undefined
return document.cookie.substring(start + key.length + 1, end)
}