Total Complexity | 6 |
Complexity/F | 1.2 |
Lines of Code | 32 |
Function Count | 5 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | /* globals Cookies */ |
||
3 | import 'file-loader?name=vendor/js-cookie.js!js-cookie/src/js.cookie' |
||
4 | |||
5 | export function getOptions (optionContainer) { |
||
|
|||
6 | return { |
||
7 | expireDays: 7, |
||
8 | cookieName: 'cookies_accepted' |
||
9 | } |
||
10 | } |
||
11 | |||
12 | export function acceptCookies ($container, cookieName, expireDays) { |
||
13 | return function (e) { |
||
14 | Cookies.set(cookieName, true, { |
||
15 | expires: expireDays |
||
16 | }) |
||
17 | |||
18 | $container.remove() |
||
19 | } |
||
20 | } |
||
21 | |||
22 | export function checkCookies ($container, cookieName) { |
||
23 | const cookiesAccepted = getCookieValue(cookieName) |
||
24 | |||
25 | if (!cookiesAccepted) { |
||
26 | $container.addClass('cookieNotification-isVisible') |
||
27 | } else { |
||
28 | $container.remove() |
||
29 | } |
||
30 | } |
||
31 | |||
32 | function getCookieValue (cookieName) { |
||
33 | return Cookies.get(cookieName) |
||
34 | } |
||
35 |
This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.