Passed
Push — master ( 22096e...9e3aee )
by Oluwatobi
01:32
created

helper/helper.js (4 issues)

1
const props = {
2
3
    checkStorage: function(key){
4
            if (localStorage.getItem(key).length == 0 ) {
0 ignored issues
show
Comparing localStorage.getItem(key).length to 0 using the == operator is not safe. Consider using === instead.
Loading history...
5
                return false; 
6
            }else{
0 ignored issues
show
Comprehensibility introduced by
else is not necessary here since all if branches return, consider removing it to reduce nesting and make code more readable.
Loading history...
7
                return true;
8
            }
9
       },
10
11
       addStorage: function(key, value){
12
            localStorage.setItem(key , value);
13
            return true;         
14
       },
15
16
       getStorage: function(key){
17
            const data = localStorage.getItem(key);
18
            return data;
19
       },
20
       removeStorage: function(key){
0 ignored issues
show
The parameter key is not used and could be removed.

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.

Loading history...
21
            localStorage.removeItem();
22
            return true;
23
       },
24
       clearStorage: function(key){
0 ignored issues
show
The parameter key is not used and could be removed.

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.

Loading history...
25
          localStorage.clear();
26
          return true;
27
       }
28
29
30
31
}
32
33
export default props;