From 59028dd4046ad0715d80be8d1ed0031f20f05b7a Mon Sep 17 00:00:00 2001 From: stonedDiscord Date: Wed, 20 Sep 2023 12:57:45 +0200 Subject: mostly whitespaces, please don't break --- webAO/utils/getCookie.ts | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'webAO/utils/getCookie.ts') diff --git a/webAO/utils/getCookie.ts b/webAO/utils/getCookie.ts index f5b9679..638dcb7 100644 --- a/webAO/utils/getCookie.ts +++ b/webAO/utils/getCookie.ts @@ -2,25 +2,25 @@ * read a cookie from storage * got this from w3schools * https://www.w3schools.com/js/js_cookies.asp - * @param {String} cname The name of the cookie to return + * @param {string} cname The name of the cookie to return */ -const getCookie = (cname: String) => { - try { - const name = `${cname}=`; - const decodedCookie = decodeURIComponent(document.cookie); - const ca = decodedCookie.split(';'); - for (let i = 0; i < ca.length; i++) { - let c = ca[i]; - while (c.charAt(0) === ' ') { - c = c.substring(1); - } - if (c.indexOf(name) === 0) { - return c.substring(name.length, c.length); - } +const getCookie = (cname: string) => { + try { + const name = `${cname}=`; + const decodedCookie = decodeURIComponent(document.cookie); + const ca = decodedCookie.split(';'); + for (let i = 0; i < ca.length; i++) { + let c = ca[i]; + while (c.charAt(0) === ' ') { + c = c.substring(1); + } + if (c.indexOf(name) === 0) { + return c.substring(name.length, c.length); + } + } + return ''; + } catch (error) { + return ''; } - return ''; - } catch (error) { - return ''; - } }; export default getCookie; -- cgit