Skip to content

Commit d4c3acf

Browse files
committed
refactor: reorganize transformInteriorValue
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.
1 parent 42f785e commit d4c3acf

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

src/Adapters/Storage/Mongo/MongoTransform.js

+4-11
Original file line numberDiff line numberDiff line change
@@ -187,17 +187,10 @@ const transformInteriorValue = restValue => {
187187
}
188188
// Handle atomic values
189189
var value = transformInteriorAtom(restValue);
190-
if (value !== CannotTransform) {
191-
if (value && typeof value === 'object') {
192-
if (value instanceof Date) {
193-
return value;
194-
}
195-
if (value instanceof Array) {
196-
value = value.map(transformInteriorValue);
197-
} else {
198-
value = mapValues(value, transformInteriorValue);
199-
}
200-
}
190+
if (value === CannotTransform) {
191+
return value;
192+
}
193+
if (value !== restValue) {
201194
return value;
202195
}
203196

0 commit comments

Comments
 (0)