Skip to content

Commit

Permalink
refactor: reorganize transformInteriorValue
Browse files Browse the repository at this point in the history
This code was checking a constantly true condition value !== CannotTransform,
that's why the code was not properly handling nested structure properly,
The code introduced by #8446 fixed this logic, by introducing another
duplicated piece of code.

This commit simplifies the logic here to reflect the original purpose.
  • Loading branch information
kassiansun committed Jan 22, 2025
1 parent 42f785e commit 0994f6a
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions src/Adapters/Storage/Mongo/MongoTransform.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,17 +187,7 @@ const transformInteriorValue = restValue => {
}
// Handle atomic values
var value = transformInteriorAtom(restValue);
if (value !== CannotTransform) {
if (value && typeof value === 'object') {
if (value instanceof Date) {
return value;
}
if (value instanceof Array) {
value = value.map(transformInteriorValue);
} else {
value = mapValues(value, transformInteriorValue);
}
}
if (value === CannotTransform) {
return value;
}

Expand Down

0 comments on commit 0994f6a

Please sign in to comment.