refactor: change undefined to void 0
This commit is contained in:
committed by
Justin Ridgewell
parent
3faca62a77
commit
a9d8040c0f
@@ -1,5 +1,5 @@
|
||||
export default function ({ types: t }) {
|
||||
const nilIdentifier = t.identifier("undefined");
|
||||
const nilIdentifier = t.unaryExpression("void", t.numericLiteral(0));
|
||||
|
||||
function setOptionalTransformed(node) {
|
||||
t.assertMemberExpression(node); // Dev
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
var _temp;
|
||||
|
||||
if (((_temp = a) != null ? _temp.b : undefined) != undefined) {
|
||||
if (((_temp = a) != null ? _temp.b : void 0) != void 0) {
|
||||
a.b = 42;
|
||||
}
|
||||
|
||||
if (((_temp = a.b.c) != null ? _temp.d : undefined) != undefined) {
|
||||
if (((_temp = a.b.c) != null ? _temp.d : void 0) != void 0) {
|
||||
a.b.c.d = 42;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
var _temp;
|
||||
|
||||
if (((_temp = a) != null ? _temp.b : undefined) != undefined) {
|
||||
if (((_temp = a) != null ? _temp.b : void 0) != void 0) {
|
||||
delete a.b;
|
||||
}
|
||||
|
||||
if (((_temp = ((_temp = a) != null ? _temp.b : undefined).c) != null ? _temp.d : undefined) != undefined) {
|
||||
delete ((_temp = a.b) != null ? _temp.c : undefined).d;
|
||||
}
|
||||
if (((_temp = ((_temp = a) != null ? _temp.b : void 0).c) != null ? _temp.d : void 0) != void 0) {
|
||||
delete ((_temp = a.b) != null ? _temp.c : void 0).d;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
var _temp;
|
||||
|
||||
((_temp = foo) != null ? _temp.bar : Function())();
|
||||
((_temp = foo) != null ? _temp.bar : Function())();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
var _temp;
|
||||
|
||||
(_temp = foo) != null ? _temp.bar : undefined;
|
||||
(_temp = foo) != null ? _temp.bar : void 0;
|
||||
|
||||
((_temp = ((_temp = a) != null ? _temp.b : undefined).c) != null ? _temp.d : undefined).e;
|
||||
((_temp = ((_temp = a) != null ? _temp.b : void 0).c) != null ? _temp.d : void 0).e;
|
||||
|
||||
Reference in New Issue
Block a user