diff options
Diffstat (limited to 'server/sonar-web/src/main/js/helpers/cookies.ts')
-rw-r--r-- | server/sonar-web/src/main/js/helpers/cookies.ts | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/server/sonar-web/src/main/js/helpers/cookies.ts b/server/sonar-web/src/main/js/helpers/cookies.ts index 9d6dabbe266..3c37516c6fd 100644 --- a/server/sonar-web/src/main/js/helpers/cookies.ts +++ b/server/sonar-web/src/main/js/helpers/cookies.ts @@ -19,15 +19,17 @@ */ import { memoize } from 'lodash'; -const parseCookies = memoize((documentCookie: string): { [key: string]: string } => { - const rawCookies = documentCookie.split('; '); - const cookies: { [key: string]: string } = {}; - rawCookies.forEach(candidate => { - const [key, value] = candidate.split('='); - cookies[key] = value; - }); - return cookies; -}); +const parseCookies = memoize( + (documentCookie: string): { [key: string]: string } => { + const rawCookies = documentCookie.split('; '); + const cookies: { [key: string]: string } = {}; + rawCookies.forEach(candidate => { + const [key, value] = candidate.split('='); + cookies[key] = value; + }); + return cookies; + } +); export function getCookie(name: string): string | undefined { return parseCookies(document.cookie)[name]; |