File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change 1
1
class Utility {
2
+ LoggerType = {
3
+ 'info' : "Info" ,
4
+ 'warning' : "Warning" ,
5
+ 'error' : "Error" ,
6
+ 'empty' : ""
7
+ }
8
+
2
9
isEmpty = data => {
3
10
switch ( typeof data ) {
4
11
case "array" :
@@ -10,6 +17,11 @@ class Utility {
10
17
}
11
18
}
12
19
20
+ Logger = ( text , type = LoggerType . empty , condition = true ) => {
21
+ const typeFormatted = ( type === LoggerType . empty ) ? `${ type } ` : `${ type } :`
22
+ if ( condition ) console . log ( `${ typeFormatted } ` , text )
23
+ }
24
+
13
25
#isArrayEmpty = ( data = [ ] ) => {
14
26
return ( data === undefined || data . length === 0 ) ? false : true
15
27
}
@@ -21,4 +33,5 @@ class Utility {
21
33
}
22
34
}
23
35
24
- export default new Utility ( )
36
+ export default new Utility ( )
37
+ export const { Logger, LoggerType } = new Utility ( )
You can’t perform that action at this time.
0 commit comments