short-private-properties
This plugin find in ES6 Classes all methods or properties with start _
and replace them with a short name.
Install
yarn add -D babel-plugin-short-private-properties# or npm i -D babel-plugin-short-private-properties
Input:
{ this_veryLondProppertyNameA = "Test class A"; this_veryLondProppertyNameA2 = "Write A"; } { console; } { super; this_veryLondProppertyNameA2 = "Overwrite B"; this_veryLondProppertyNameB = "Test class B"; } { this; console; console; } ;// Test class A// Test class B// Overwrite B
Output:
{ this_b = "Test class A"; this_c = "Write A"; } { console; } { super; this_c = "Overwrite B"; this_e = "Test class B"; } { this; console; console; } ;// Test class A// Test class B// Overwrite B
Usage
Via .babelrc (Recommended)
Via CLI
$ babel --plugins babel-plugin-short-private-properties script.js
Via Node API
;