99re热这里只有精品视频,7777色鬼xxxx欧美色妇,国产成人精品一区二三区在线观看,内射爽无广熟女亚洲,精品人妻av一区二区三区

@babel/plugin-proposal-nullish-coalescing-operator

2023-06-08 16:20 更新
NOTE: This plugin is included in @babel/preset-env, in ES2020

Example?

In

JavaScript

var foo = object.foo ?? "default";

Out

JavaScript

var _object$foo;

var foo =
(_object$foo = object.foo) !== null && _object$foo !== void 0
? _object$foo
: "default";
NOTE: We cannot use != null here because document.all == null and document.all has been deemed not "nullish".

Installation?

  • npm
  • Yarn
  • pnpm
pnpm add --save-dev @babel/plugin-proposal-nullish-coalescing-operator

Usage?

With a configuration file (Recommended)?

babel.config.json

{
"plugins": ["@babel/plugin-proposal-nullish-coalescing-operator"]
}

Via CLI?

Shell

babel --plugins @babel/plugin-proposal-nullish-coalescing-operator script.js

Via Node API?

JavaScript

require("@babel/core").transformSync("code", {
plugins: ["@babel/plugin-proposal-nullish-coalescing-operator"],
});

Options?

loose?

boolean, defaults to false.

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.

?? Consider migrating to the top level noDocumentAll assumption.

babel.config.json

{
"assumptions": {
"noDocumentAll": true
}
}

Example?

In

JavaScript

var foo = object.foo ?? "default";

Out

JavaScript

var _object$foo;

var foo = (_object$foo = object.foo) != null ? _object$foo : "default";
You can read more about configuring plugin options here

References?


以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)