mirror of
https://github.com/labs42io/clean-code-typescript.git
synced 2025-04-18 15:13:34 +00:00
Updated README.md to improve readability
At Functions should do one thing, the function emailClients is only emailing activeClients, thus the suggestion to make its name explicit for reliability purposes.
This commit is contained in:
parent
14e3a9d711
commit
caaa383b13
1 changed files with 2 additions and 2 deletions
|
@ -372,7 +372,7 @@ This is by far the most important rule in software engineering. When functions d
|
|||
**Bad:**
|
||||
|
||||
```ts
|
||||
function emailClients(clients: Client[]) {
|
||||
function emailActiveClients(clients: Client[]) {
|
||||
clients.forEach((client) => {
|
||||
const clientRecord = database.lookup(client);
|
||||
if (clientRecord.isActive()) {
|
||||
|
@ -385,7 +385,7 @@ function emailClients(clients: Client[]) {
|
|||
**Good:**
|
||||
|
||||
```ts
|
||||
function emailClients(clients: Client[]) {
|
||||
function emailActiveClients(clients: Client[]) {
|
||||
clients.filter(isActiveClient).forEach(email);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue