-
Notifications
You must be signed in to change notification settings - Fork 463
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
small simplifications #7141
small simplifications #7141
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great!
Left some comments for more potential optimizations.
@@ -7,7 +7,7 @@ function shouldHandleNullableValues() { | |||
let tUndefined = undefined; | |||
let tValue = "hello"; | |||
let tmp; | |||
tmp = tNull === null || tNull === undefined ? tNull === null : false; | |||
tmp = (tNull == null) ? tNull === null : false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could be simplified to tNull === null
.
@@ -18,7 +18,7 @@ function shouldHandleNullableValues() { | |||
"Should handle null" | |||
], tmp, (prim0, prim1) => prim0 === prim1, true); | |||
let tmp$1; | |||
tmp$1 = (tUndefined === null || tUndefined === undefined) && tUndefined !== null; | |||
tmp$1 = (tUndefined == null) && tUndefined !== null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could be simplified to tUndefined === undefined
.
@@ -29,7 +29,7 @@ function shouldHandleNullableValues() { | |||
"Should handle undefined" | |||
], tmp$1, (prim0, prim1) => prim0 === prim1, true); | |||
let tmp$2; | |||
tmp$2 = tValue === null || tValue === undefined ? false : tValue === "hello"; | |||
tmp$2 = (tValue == null) ? false : tValue === "hello"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could be simplified to tValue === "hello"
.
Can you move them to a separate issue? |
|
x === null || x === undefined
-->x == null
[(typeof x === "string") && (x === "abc")]
-->[x === "abc"]
[(typeof x === "number") && (x === 123)]
-->[x === 123]