caub's notebooks

  • Untitled - /caub/nodejs-contributors-email-domains
    Last edited 6 years ago
    const fetch = require('node-fetch'); fetch('https://cdn.rawgit.com/nodejs/node/master/AUTHORS').then(r => r.text()) .then(text => { const emails = text.match(/<\S+@\S+\.\S+>$/gm); const map = new Map(); // domain => user emails.forEach(email => { const [user, domain] = email.slice(1, -1).split('@'); map.set(domain, (map.get(domain)||[]).concat(user)); }) const entries = [...map].sort((a, b) => b[1].length - a[1].length) entries.slice(0, 15).forEach(([domain, users], i) => { console.log(`#${i+1} ${domain}: ${users.length}`); }) })