Playground
Try out the P42 codemods in the browser, without installing anything. You can copy & paste your own code.
Use Arrow Functions
Arrow functions are a concise syntax that can often replace the regular function syntax.
Use Blocked Scoped Variables
'Let' and 'const' are block-scope variable declarations that can replace 'var' declarations in many cases.
Use Default Parameters
Default parameters allow providing default values for function parameters.
Use Spread Syntax (...) instead of '.apply'
The spread syntax (...) allows iterables like array expressions to be expanded in place where arguments are expected.
Use Template Literals
Template literals are string templates that can include variables and expressions.
Split Multi-Variable Declarations
Convert variable declarations with multiple variables into separate declarations that declare one variable each.