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
- Host: GitHub
- URL: https://github.com/jamiebuilds/babel-plugin-private-underscores
- Owner: jamiebuilds
- License: mit
- Created: 2018-06-06T00:03:05.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-06-06T00:11:28.000Z (almost 7 years ago)
- Last Synced: 2025-03-12T21:02:36.150Z (about 2 months ago)
- Topics: babel, class, members, methods, plugin, private, properties, public
- Language: JavaScript
- Size: 27.3 KB
- Stars: 39
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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.