Skip to content

Latest commit

 

History

History
30 lines (22 loc) · 1.29 KB

README.md

File metadata and controls

30 lines (22 loc) · 1.29 KB

Transform ES5 Functions to ES6 Classes 📦

npm Awesome

Features 💯

  • Methods on prototype
  • Static Methods on prototype
  • Variables and Literals on prototype
  • Getters, Setters with defineProperty
  • Block-level Variables

Sample Input 🛴 and Output 🚀

input2

Complex example: Multiple functions in same file with one of the functions having same name.

Setup and Run 🏃

npm i -g jscodeshift
git clone --depth=1 https:/dhruvdutt/es5-function-to-class-codemod codemod && cd codemod
jscodeshift -t func-to-class.js example/input.js
Similar project - lebab. It doesn't currently support:
  • Static Methods on prototype
  • Block-level Variables