mirror of
https://github.com/labs42io/clean-code-typescript.git
synced 2024-11-23 05:34:04 +00:00
Updated README.md to improve readability (#53)
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
66a0d8cd0b
|
@ -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…
Reference in a new issue