Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

dhruvdutt/es5-function-to-class-codemod

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

23 Commits

Repository files navigation

Transform ES5 Functions to ES6 Classes πŸ“¦

npm Awesome

Live Demo πŸ’»

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://github.com/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

About

πŸ“¦ Transform ES5 Functions to ES6 Classes

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /