An open API service indexing awesome lists of open source software.

https://github.com/jamiebuilds/babel-plugin-private-underscores

Make _classMembers 'private' using symbols
https://github.com/jamiebuilds/babel-plugin-private-underscores

babel class members methods plugin private properties public

Last synced: about 2 months ago
JSON representation

Make _classMembers 'private' using symbols

Awesome Lists containing this project

README

        

# babel-plugin-private-underscores

> Make _classMembers 'private' using symbols

## Install

```sh
yarn add --dev babel-plugin-private-underscores
```

## Example

**Input**

```js
class Foo {
constructor() {
this._method();
}

_method() {
// ...
}
}
```

**Output**

```js
let _method = Symbol('_method');
class Foo {
constructor() {
this[_method]();
}

[_method]() {
// ...
}
}
```

## Usage

```js
{
"plugins": [
"private-underscores"
]
}
```

> **Note:** This is not *real* private, it just makes it a lot harder for
> people to accidentally use methods with underscores.