@mapomodule/utils 1.0.0-alpha.34 → 1.0.0-alpha.40
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/CHANGELOG.md +16 -0
- package/helpers/cssVariables.js +12 -0
- package/helpers/objHelpers.js +14 -9
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [1.0.0-alpha.40](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.39...v1.0.0-alpha.40) (2022-12-20)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* rewritten and more precise diffObjs function ([3e79775](https://github.com/lotrekagency/mapo/commit/3e797756d0dc48142febcdb806390552ea522b30))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* style scrollbars ([48e4c7b](https://github.com/lotrekagency/mapo/commit/48e4c7b047a1062464d823ddeebdc60b96ea11a8))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
# [1.0.0-alpha.34](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.33...v1.0.0-alpha.34) (2022-11-11)
|
|
7
23
|
|
|
8
24
|
|
package/helpers/objHelpers.js
CHANGED
|
@@ -57,7 +57,7 @@ function findPropPaths(obj, predicate) {
|
|
|
57
57
|
const path = [];
|
|
58
58
|
const results = [];
|
|
59
59
|
if (!obj && (typeof obj !== "object" || Array.isArray(obj))) {
|
|
60
|
-
throw new TypeError("First argument of
|
|
60
|
+
throw new TypeError("First argument of findPropPaths is not the correct type Object");
|
|
61
61
|
}
|
|
62
62
|
if (typeof predicate !== "function") {
|
|
63
63
|
throw new TypeError("Predicate is not a function");
|
|
@@ -83,17 +83,22 @@ function findPropPaths(obj, predicate) {
|
|
|
83
83
|
return results;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
function diffObjs(obj1, obj2) {
|
|
87
|
-
const a =
|
|
88
|
-
const b =
|
|
86
|
+
function diffObjs(obj1, obj2, clone=deepClone) {
|
|
87
|
+
const a = obj1 && clone(obj1) || obj2 && obj2.__proto__.constructor();
|
|
88
|
+
const b = obj2 && clone(obj2) || obj1 && obj1.__proto__.constructor();
|
|
89
89
|
for (const i in b) {
|
|
90
90
|
if (JSON.stringify(a[i]) === JSON.stringify(b[i])) {
|
|
91
|
-
delete b[i]
|
|
92
|
-
} else if (!Array.isArray(b[i]) && typeof b[i] == 'object') {
|
|
93
|
-
|
|
94
|
-
|
|
91
|
+
delete b[i];
|
|
92
|
+
} else if (b[i] && !Array.isArray(b[i]) && typeof b[i] == 'object') {
|
|
93
|
+
const diff = diffObjs(a[i], b[i], (v) => v);
|
|
94
|
+
if (diff !== undefined){
|
|
95
|
+
b[i] = diff;
|
|
96
|
+
} else {
|
|
97
|
+
delete b[i];
|
|
98
|
+
};
|
|
99
|
+
};
|
|
95
100
|
}
|
|
96
|
-
return b;
|
|
101
|
+
return b && Object.keys(b).length ? b : undefined;
|
|
97
102
|
}
|
|
98
103
|
|
|
99
104
|
module.exports = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mapomodule/utils",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.40",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "This is part of Mapo nuxt module. Provides a set of utils for the project.",
|
|
6
6
|
"author": "bnznamco <gabriele.baldi.01@gmail.com>",
|
|
@@ -9,5 +9,5 @@
|
|
|
9
9
|
"publishConfig": {
|
|
10
10
|
"access": "public"
|
|
11
11
|
},
|
|
12
|
-
"gitHead": "
|
|
12
|
+
"gitHead": "918d8d3ed9a6edc9be25e082f9917866e8c73c57"
|
|
13
13
|
}
|