* Implement transform for nullish-coalescing operator * Update example output * Switch from BinaryExpression to LogicalExpression * Address review comments - Use generateUidIdentifierBasedOnNode - Inline "??" - Clone ref node - Move "??" to LogicalExpression in babel-types * Fix reference to @babel/helper-plugin-test-runner * Fix reference to @babel/plugin-syntax-nullish-coalescing-operator * Don't use parent scope * Remove .vscode from .gitignore, change 'lib/index.js' to 'lib' * Ensure `document.all ?? 0 === document.all` * Fix note and copy to an inline comment
36 lines
549 B
Markdown
36 lines
549 B
Markdown
# @babel/plugin-syntax-nullish-coalescing-operator
|
|
|
|
> Allow parsing of the nullish-coalescing operator.
|
|
|
|
## Installation
|
|
|
|
```sh
|
|
npm install --save-dev @babel/plugin-syntax-nullish-coalescing-operator
|
|
```
|
|
|
|
## Usage
|
|
|
|
### Via `.babelrc` (Recommended)
|
|
|
|
**.babelrc**
|
|
|
|
```json
|
|
{
|
|
"plugins": ["syntax-nullish-coalescing-operator"]
|
|
}
|
|
```
|
|
|
|
### Via CLI
|
|
|
|
```sh
|
|
babel --plugins syntax-nullish-coalescing-operator script.js
|
|
```
|
|
|
|
### Via Node API
|
|
|
|
```javascript
|
|
require("babel-core").transform("code", {
|
|
plugins: ["syntax-nullish-coalescing-operator"]
|
|
});
|
|
```
|