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

props.removeStorage   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
c 0
b 0
f 0
nc 1
dl 0
loc 4
rs 10
nop 1
1
const props = {
2
3
    checkStorage: function(key){
4
            if (localStorage.getItem(key).length == 0 ) {
0 ignored issues
show
Bug introduced by oluwatobi shokunbi
The variable localStorage seems to be never declared. If this is a global, consider adding a /** global: localStorage */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
Best Practice introduced by oluwatobi shokunbi
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 oluwatobi shokunbi
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);
0 ignored issues
show
Bug introduced by oluwatobi shokunbi
The variable localStorage seems to be never declared. If this is a global, consider adding a /** global: localStorage */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
13
            return true;         
14
       },
15
16
       getStorage: function(key){
17
            const data = localStorage.getItem(key);
0 ignored issues
show
Bug introduced by oluwatobi shokunbi
The variable localStorage seems to be never declared. If this is a global, consider adding a /** global: localStorage */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
18
            return data;
19
       },
20
       removeStorage: function(key){
0 ignored issues
show
Unused Code introduced by oluwatobi shokunbi
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();
0 ignored issues
show
Bug introduced by oluwatobi shokunbi
The variable localStorage seems to be never declared. If this is a global, consider adding a /** global: localStorage */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
22
            return true;
23
       },
24
       clearStorage: function(key){
0 ignored issues
show
Unused Code introduced by oluwatobi shokunbi
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();
0 ignored issues
show
Bug introduced by oluwatobi shokunbi
The variable localStorage seems to be never declared. If this is a global, consider adding a /** global: localStorage */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
26
          return true;
27
       }
28
29
30
31
}
32
33
export default props;