We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
utilities.class.js
1 parent ef14b81 commit 4eee27dCopy full SHA for 4eee27d
src/lib/utilities.class.js
@@ -0,0 +1,21 @@
1
+class Utility {
2
+ isEmpty = data => {
3
+ let result;
4
+ if (typeof data === 'array') result = this.#isArrayEmpty(data)
5
+ if (typeof data === 'object') result = this.#isObjEmpty(data)
6
+
7
+ return result
8
+ }
9
10
+ #isArrayEmpty = (data = []) => {
11
+ return (data === undefined || data.length === 0) ? false : true
12
13
14
+ #isObjEmpty = (data = {}) => {
15
+ for (const prop in data)
16
+ if (Object.hasOwn(data, prop)) return false
17
+ return true
18
19
+}
20
21
+export default new Utility()
0 commit comments