Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
Loading items

Target

Select target project
  • oss/libraries/javascript/monster
1 result
Select Git revision
Loading items
Show changes

Commits on Source 4

<a name="v3.51.1"></a>
## [v3.51.1] - 2023-06-19
### Bug Fixes
- issue [#121](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/121) bug in extractKeys
<a name="v3.51.0"></a>
## [v3.51.0] - 2023-06-15
### Changes
......@@ -650,6 +656,7 @@
<a name="1.8.0"></a>
## 1.8.0 - 2021-08-15
[v3.51.1]: https://gitlab.schukai.com/oss/libraries/javascript/monster/compare/v3.51.0...v3.51.1
[v3.51.0]: https://gitlab.schukai.com/oss/libraries/javascript/monster/compare/v3.50.0...v3.51.0
[v3.50.0]: https://gitlab.schukai.com/oss/libraries/javascript/monster/compare/v3.49.0...v3.50.0
[v3.49.0]: https://gitlab.schukai.com/oss/libraries/javascript/monster/compare/v3.48.0...v3.49.0
......
{
"name": "@schukai/monster",
"version": "3.50.0",
"version": "3.51.0",
"description": "Monster is a simple library for creating fast, robust and lightweight websites.",
"keywords": [
"framework",
......
......@@ -22,7 +22,7 @@ function extractKeys(obj, keyPrefix = "", keySeparator = "-", valueSeparator = "
function helper(currentObj, currentKeyPrefix, currentValuePrefix) {
for (const key in currentObj) {
if (typeof currentObj[key] === "object" && !Array.isArray(currentObj[key])) {
if (currentObj[key] !== null && typeof currentObj[key] === "object" && !Array.isArray(currentObj[key])) {
const newKeyPrefix = currentKeyPrefix
? currentKeyPrefix + keySeparator + key.toLowerCase()
: key.toLowerCase();
......@@ -41,3 +41,4 @@ function extractKeys(obj, keyPrefix = "", keySeparator = "-", valueSeparator = "
helper(obj, keyPrefix, keyPrefix);
return resultMap;
}
......@@ -142,7 +142,7 @@ function getMonsterVersion() {
}
/** don't touch, replaced by make with package.json version */
monsterVersion = new Version("3.50.0");
monsterVersion = new Version("3.51.0");
return monsterVersion;
}
{
"name": "monster",
"version": "3.50.0",
"version": "3.51.0",
"description": "monster",
"repository": {
"type": "git",
......
import {expect} from 'chai';
import {extractKeys} from "../../../../../application/source/dom/util/extract-keys.mjs";
describe('extractKeys', () => {
it('should extract keys from the given object', () => {
const obj = {
firstName: 'John',
lastName: 'Doe',
address: {
street: '123 Main St',
city: 'New York',
},
};
const expected = new Map([
['firstname', 'firstName'],
['lastname', 'lastName'],
['address-street', 'address.street'],
['address-city', 'address.city'],
]);
const result = extractKeys(obj);
expect(JSON.stringify(Array.from(result))).to.equal(JSON.stringify(Array.from(expected)));
});
it('should use custom key and value separators', () => {
const obj = {
firstName: 'John',
lastName: 'Doe',
};
const expected = new Map([
['prefix+firstname', 'prefix+firstName'],
['prefix+lastname', 'prefix+lastName'],
]);
const result = extractKeys(obj, 'prefix', '+', '+');
expect(JSON.stringify(Array.from(result))).to.equal(JSON.stringify(Array.from(expected)));
});
it('check if value is null', () => {
const obj = {
firstName: 'John',
lastName: 'Doe',
address: null,
};
const expected = new Map([
['firstname', 'firstName'],
['lastname', 'lastName'],
['address', 'address'],
]);
const result = extractKeys(obj);
expect(JSON.stringify(Array.from(result))).to.equal(JSON.stringify(Array.from(expected)));
});
// Add more test cases as needed
});
......@@ -7,7 +7,7 @@ describe('Monster', function () {
let monsterVersion
/** don´t touch, replaced by make with package.json version */
monsterVersion = new Version("3.50.0")
monsterVersion = new Version("3.51.0")
let m = getMonsterVersion();
......
{"version":"3.51.0"}
{"version":"3.51.1"}