Skip to content

Use explanatory function names #200

@marzelin

Description

@marzelin

Here

function emailClients(clients) {
  clients
    .filter(isClientActive)
    .forEach(email);
}

function isClientActive(client) {
  const clientRecord = database.lookup(client);
  return clientRecord.isActive();
}

the function name suggests that all client will be emailed. I'd rather do

function emailActiveClients(clients) {
  clients
    .filter(isActive)
    .forEach(email);
}

function isActive(client) {
  const clientRecord = database.lookup(client);
  return clientRecord.isActive();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions