Last active
August 24, 2025 02:08
-
-
Save mcsee/4fe4708741bc558dda3818181a7a04a7 to your computer and use it in GitHub Desktop.
This gist belongs to Clean Code Cookbook http://cleancodecookbook.com By Maximiliano Contieri http://maximilianocontieri.com
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User { | |
public email; | |
private name; | |
// Step 1: Choose consistent indentation (2 spaces) | |
// Step 4: Public methods before private ones | |
constructor(name, email) { | |
this.name = name; | |
this.email = email; | |
} | |
public getName() { | |
return this.name; | |
} | |
// Step 3: Standardize spacing around operators | |
public setName(newName) { | |
this.name = newName; | |
} | |
// Step 2: Apply uniform brace placement | |
private validateEmail() { | |
return this.email.includes('@'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment