Skip to content

Commit f1676af

Browse files
negate if conditions
1 parent 75ddc40 commit f1676af

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

packages/cloudflare/src/cli/build/patches/to-investigate/wrangler-deps.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,18 +107,22 @@ function patchRequireReactDomServerEdge(config: Config) {
107107
const parameterName = p[0]!.getName();
108108
const bodyChildren = arrowFunction.getBody().getChildren();
109109
if (
110-
bodyChildren.length !== 3 ||
111-
bodyChildren[0]!.getFullText() !== "{" ||
112-
bodyChildren[2]!.getFullText() !== "}"
110+
!(
111+
bodyChildren.length === 3 &&
112+
bodyChildren[0]!.getFullText() === "{" &&
113+
bodyChildren[2]!.getFullText() === "}"
114+
)
113115
) {
114116
return;
115117
}
116118
const bodyStatements = bodyChildren[1]?.getChildren();
117119

118120
// the function has only two statements: "use strict" and e.exports=require("react-dom/server.edge")
119121
if (
120-
bodyStatements?.length !== 2 ||
121-
bodyStatements.some((statement) => !statement.isKind(ts.SyntaxKind.ExpressionStatement))
122+
!(
123+
bodyStatements?.length === 2 &&
124+
bodyStatements.every((statement) => statement.isKind(ts.SyntaxKind.ExpressionStatement))
125+
)
122126
) {
123127
return;
124128
}

0 commit comments

Comments
 (0)