Hacker News new | ask | show | jobs
by iso-8859-1 3471 days ago
It's not that hard...

    ["email", "phone", "website"].reduce(
      (previous, channel) => previous || !!institution[channel] && !/^\s*$/.test(institution[channel]),
      false
    );
But I'd prefer the more readable:

    const hasNoEmail = /^\s*$/.test(institution.email || '');
    const hasNoPhone = /^\s*$/.test(institution.phone || '');
    const hasNoWebsite = /^\s*$/.test(institution.website || '');
    const hasAny = !(hasNoEmail && hasNoPhone && hasNoWebsite);