@babel/plugin-proposal-nullish-coalescing-operator
In
Out
var _object$foo;
var foo =
(_object$foo = object.foo) !== null && _object$foo !== void 0
? _object$foo
: "default";
npm install --save-dev @babel/plugin-proposal-nullish-coalescing-operator
require("@babel/core").transformSync("code", {
plugins: ["@babel/plugin-proposal-nullish-coalescing-operator"],
});
boolean
, defaults to .
When true
, this transform will pretend document.all
does not exist, and perform loose equality checks with null
instead of strict equality checks against both null
and undefined
.
Example
In
var foo = object.foo ?? "default";
Out
var _object$foo;