babel-plugin-private-underscores

1.0.0 • Public • Published

babel-plugin-private-underscores

Make _classMembers 'private' using symbols

  • {feature1}
  • {feature2}
  • {feature3}

Install

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

Example

Input

class Foo {
  constructor() {
    this._method();
  }
 
  _method() {
    // ...
  }
}

Output

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

Usage

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

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

Package Sidebar

Install

npm i babel-plugin-private-underscores

Weekly Downloads

3

Version

1.0.0

License

MIT

Unpacked Size

3.96 kB

Total Files

4

Last publish

Collaborators

  • thejameskyle