Skip to content

Instantly share code, notes, and snippets.

@billyeh
Last active April 5, 2022 04:06
Show Gist options
  • Save billyeh/2065af8a117f1a5fe802571ea01ee00b to your computer and use it in GitHub Desktop.
Save billyeh/2065af8a117f1a5fe802571ea01ee00b to your computer and use it in GitHub Desktop.
Sync Google group/email list
const GMAILS_EMAILS = ``.toLowerCase(); // List of emails from GMail to: line.
const GMAIL_EMAILS = GMAILS_EMAILS.split(',\n').map(
email => email.substring(
email.indexOf("<") + 1,
email.lastIndexOf(">")
));
const GROUPS_EMAILS = ``.toLowerCase(); // List of emails from Groups CSV download.
const GROUP_EMAILS = GROUPS_EMAILS.split('\n').map(
row => row.split(',')[0]);
const GROUP_NOT_GMAIL = GROUP_EMAILS.filter(
x => !GMAIL_EMAILS.includes(x));
console.log(`Missing ${GROUP_NOT_GMAIL} from GMail emails.`);
const GMAIL_NOT_GROUP = GMAIL_EMAILS.filter(
x => !GROUP_EMAILS.includes(x));
console.log(`Missing ${GMAIL_NOT_GROUP} from Group emails.`);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment