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:
Luís Guilherme Ferreira 2022-04-08 15:50:29 +01:00 committed by GitHub
parent 14e3a9d711
commit caaa383b13
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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);
}