Remove redundant if statement (#21101)

This commit is contained in:
Erik
2021-03-26 13:50:58 -04:00
committed by GitHub
parent a77dd13ede
commit a5aa9d5253
+15 -17
View File
@@ -243,23 +243,21 @@ export function dehydrate(
: data.constructor.name,
};
if (typeof data[Symbol.iterator]) {
// TRICKY
// Don't use [...spread] syntax for this purpose.
// This project uses @babel/plugin-transform-spread in "loose" mode which only works with Array values.
// Other types (e.g. typed arrays, Sets) will not spread correctly.
Array.from(data).forEach(
(item, i) =>
(unserializableValue[i] = dehydrate(
item,
cleaned,
unserializable,
path.concat([i]),
isPathAllowed,
isPathAllowedCheck ? 1 : level + 1,
)),
);
}
// TRICKY
// Don't use [...spread] syntax for this purpose.
// This project uses @babel/plugin-transform-spread in "loose" mode which only works with Array values.
// Other types (e.g. typed arrays, Sets) will not spread correctly.
Array.from(data).forEach(
(item, i) =>
(unserializableValue[i] = dehydrate(
item,
cleaned,
unserializable,
path.concat([i]),
isPathAllowed,
isPathAllowedCheck ? 1 : level + 1,
)),
);
unserializable.push(path);