Skip to content

Commit 66b527a

Browse files
committed
fixed mapper
(sucrose properties not working bug)
1 parent 9a51cb0 commit 66b527a

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

js/mapper.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
function mapAndApply(fromObject, toObject, mapper) {
22
for (const [inputKey, inputValue] of Object.entries(fromObject)) {
3-
const mapEntry = mapper.properties[inputKey];
3+
let mapEntry = mapper.properties[inputKey];
44
if (!mapEntry)
5-
if (!mapper.mapUndefined)
5+
if (mapper.mapUndefined)
6+
mapEntry = {};
7+
else
68
continue;
79

810
const destinationKey = mapEntry.key || inputKey;
@@ -12,8 +14,8 @@ function mapAndApply(fromObject, toObject, mapper) {
1214
const convertedValue = conversionFunc(inputValue);
1315

1416
const valuesAreEqual = Array.isArray(toObject[destinationKey]) && Array.isArray(convertedValue)
15-
? arraysAreEqual(toObject[destinationKey], convertedValue)
16-
: toObject[destinationKey] === convertedValue;
17+
? arraysAreEqual(toObject[destinationKey], convertedValue)
18+
: toObject[destinationKey] === convertedValue;
1719

1820
if (!valuesAreEqual) {
1921
debugger;

0 commit comments

Comments
 (0)