/javascript-refactoring

A collection of refactoring patterns for improving the design of existing JavaScript code.

JavaScript Refactoring Patterns

A collection of refactoring patterns for improving the design of existing JavaScript code.

This work is greatly motivated by, and many patterns are adapted from, Martin Fowler's excellent book Refactoring - Improving the design of existing code.

Overview of Refactoring Patterns

General Patterns

These refactorings are ported to JavaScript from Martin Fowler's book Refactoring - Improving the design of existing code. Although they are not JavaScript specific they are still great refactorings which can help to improve the design of JavaScript code.

Composing Methods

JavaScript Patterns

These refactorings are JavaScript specific and should help to improve the design of your code. The refactorings are grouped by the ECMAScript version that implements the functionality that they depend on.

ECMAScript 3

ECMAScript 5

ECMAScript 6

  • Replace nested async callbacks with promises
  • Declare block specific variables with let

jQuery