Skip to content

Commit e9b473f

Browse files
Merge pull request ryanmcdermott#60 from rodu/minor-naming-improvement
Improvement on email client function
2 parents 576f4ef + 5d882d9 commit e9b473f

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

README.md

+3-9
Original file line numberDiff line numberDiff line change
@@ -274,15 +274,9 @@ function emailClients(clients) {
274274
**Good**:
275275
```javascript
276276
function emailClients(clients) {
277-
clients.forEach(client => {
278-
emailClientIfNeeded(client);
279-
});
280-
}
281-
282-
function emailClientIfNeeded(client) {
283-
if (isClientActive(client)) {
284-
email(client);
285-
}
277+
clients
278+
.filter(isClientActive)
279+
.forEach(email);
286280
}
287281

288282
function isClientActive(client) {

0 commit comments

Comments
 (0)