@schukai/monster 3.50.0 → 3.51.1
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/package.json
CHANGED
package/source/dom/updater.mjs
CHANGED
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
ATTRIBUTE_UPDATER_REMOVE,
|
|
19
19
|
ATTRIBUTE_UPDATER_REPLACE,
|
|
20
20
|
ATTRIBUTE_UPDATER_SELECT_THIS,
|
|
21
|
-
} from "
|
|
21
|
+
} from "./constants.mjs";
|
|
22
22
|
|
|
23
23
|
import { Base } from "../types/base.mjs";
|
|
24
24
|
import { isArray, isInstance, isIterable } from "../types/is.mjs";
|
|
@@ -22,7 +22,7 @@ function extractKeys(obj, keyPrefix = "", keySeparator = "-", valueSeparator = "
|
|
|
22
22
|
|
|
23
23
|
function helper(currentObj, currentKeyPrefix, currentValuePrefix) {
|
|
24
24
|
for (const key in currentObj) {
|
|
25
|
-
if (typeof currentObj[key] === "object" && !Array.isArray(currentObj[key])) {
|
|
25
|
+
if (currentObj[key] !== null && typeof currentObj[key] === "object" && !Array.isArray(currentObj[key])) {
|
|
26
26
|
const newKeyPrefix = currentKeyPrefix
|
|
27
27
|
? currentKeyPrefix + keySeparator + key.toLowerCase()
|
|
28
28
|
: key.toLowerCase();
|
|
@@ -41,3 +41,4 @@ function extractKeys(obj, keyPrefix = "", keySeparator = "-", valueSeparator = "
|
|
|
41
41
|
helper(obj, keyPrefix, keyPrefix);
|
|
42
42
|
return resultMap;
|
|
43
43
|
}
|
|
44
|
+
|
|
@@ -59,10 +59,6 @@ class ProxyObserver extends Base {
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
/**
|
|
62
|
-
* Get the real object
|
|
63
|
-
*
|
|
64
|
-
* Changes to this object are not noticed by the observers, so you can make a large number of changes and inform the observers later.
|
|
65
|
-
*
|
|
66
62
|
* @returns {object}
|
|
67
63
|
*/
|
|
68
64
|
getSubject() {
|
|
@@ -86,8 +82,10 @@ class ProxyObserver extends Base {
|
|
|
86
82
|
}
|
|
87
83
|
|
|
88
84
|
/**
|
|
89
|
-
*
|
|
85
|
+
* Get the real object
|
|
90
86
|
*
|
|
87
|
+
* Changes to this object are not noticed by the observers, so you can make a large number of changes and inform the observers later.
|
|
88
|
+
*
|
|
91
89
|
* @returns {object}
|
|
92
90
|
*/
|
|
93
91
|
getRealSubject() {
|
package/source/types/version.mjs
CHANGED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import {expect} from 'chai';
|
|
2
|
+
import {extractKeys} from "../../../../../application/source/dom/util/extract-keys.mjs";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
describe('extractKeys', () => {
|
|
6
|
+
it('should extract keys from the given object', () => {
|
|
7
|
+
const obj = {
|
|
8
|
+
firstName: 'John',
|
|
9
|
+
lastName: 'Doe',
|
|
10
|
+
address: {
|
|
11
|
+
street: '123 Main St',
|
|
12
|
+
city: 'New York',
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const expected = new Map([
|
|
17
|
+
['firstname', 'firstName'],
|
|
18
|
+
['lastname', 'lastName'],
|
|
19
|
+
['address-street', 'address.street'],
|
|
20
|
+
['address-city', 'address.city'],
|
|
21
|
+
]);
|
|
22
|
+
|
|
23
|
+
const result = extractKeys(obj);
|
|
24
|
+
|
|
25
|
+
expect(JSON.stringify(Array.from(result))).to.equal(JSON.stringify(Array.from(expected)));
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it('should use custom key and value separators', () => {
|
|
29
|
+
const obj = {
|
|
30
|
+
firstName: 'John',
|
|
31
|
+
lastName: 'Doe',
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const expected = new Map([
|
|
35
|
+
['prefix+firstname', 'prefix+firstName'],
|
|
36
|
+
['prefix+lastname', 'prefix+lastName'],
|
|
37
|
+
]);
|
|
38
|
+
|
|
39
|
+
const result = extractKeys(obj, 'prefix', '+', '+');
|
|
40
|
+
|
|
41
|
+
expect(JSON.stringify(Array.from(result))).to.equal(JSON.stringify(Array.from(expected)));
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it('check if value is null', () => {
|
|
45
|
+
const obj = {
|
|
46
|
+
firstName: 'John',
|
|
47
|
+
lastName: 'Doe',
|
|
48
|
+
address: null,
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const expected = new Map([
|
|
52
|
+
['firstname', 'firstName'],
|
|
53
|
+
['lastname', 'lastName'],
|
|
54
|
+
['address', 'address'],
|
|
55
|
+
|
|
56
|
+
]);
|
|
57
|
+
|
|
58
|
+
const result = extractKeys(obj);
|
|
59
|
+
|
|
60
|
+
expect(JSON.stringify(Array.from(result))).to.equal(JSON.stringify(Array.from(expected)));
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
// Add more test cases as needed
|
|
64
|
+
});
|
package/test/cases/monster.mjs
CHANGED