corebasic 1.0.162 → 1.0.164
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/libs/utils.js +11 -0
- package/package.json +1 -1
package/libs/utils.js
CHANGED
|
@@ -32,12 +32,23 @@ export function isEmpty(str) { // returns true for undefined
|
|
|
32
32
|
return str.match(/\S/) ? false : true // matches a non space character
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
export let GLOBAL_META = { company: "GLOBAL", outlet: "GLOBAL" }
|
|
36
|
+
|
|
35
37
|
export function isEmptyJson(json) {
|
|
36
38
|
for (var i in json)
|
|
37
39
|
return false
|
|
38
40
|
return true
|
|
39
41
|
}
|
|
40
42
|
|
|
43
|
+
export function uniqueObjects(array, key) {
|
|
44
|
+
// remove duplicates from array of objects with key
|
|
45
|
+
return [
|
|
46
|
+
...new Map(
|
|
47
|
+
array.map(item => [item[key], item])
|
|
48
|
+
).values()
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
|
|
41
52
|
// --------------
|
|
42
53
|
// Parse Numbers
|
|
43
54
|
// --------------
|