Skip to content

Commit 49ce4ae

Browse files
committed
Update utilities.class.js add Logger and LoggerType
1 parent 5c2775b commit 49ce4ae

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/lib/utilities.class.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
class Utility {
2+
LoggerType = {
3+
'info': "Info",
4+
'warning': "Warning",
5+
'error': "Error",
6+
'empty': ""
7+
}
8+
29
isEmpty = data => {
310
switch (typeof data) {
411
case "array":
@@ -10,6 +17,11 @@ class Utility {
1017
}
1118
}
1219

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+
1325
#isArrayEmpty = (data = []) => {
1426
return (data === undefined || data.length === 0) ? false : true
1527
}
@@ -21,4 +33,5 @@ class Utility {
2133
}
2234
}
2335

24-
export default new Utility()
36+
export default new Utility()
37+
export const { Logger, LoggerType } = new Utility()

0 commit comments

Comments
 (0)