Skip to content

Instantly share code, notes, and snippets.

@lagondo
Created June 4, 2018 15:26
Show Gist options
  • Save lagondo/e4edd670dcec0b989459ec1c85081b97 to your computer and use it in GitHub Desktop.
Save lagondo/e4edd670dcec0b989459ec1c85081b97 to your computer and use it in GitHub Desktop.
Sort emails by domain
const email = require("email-addresses")
const getStdin = require('get-stdin')
const R = require('ramda')
getStdin().then(str => {
const lines = str.split('\n')
const sortedLines = R.sortBy(l => email.parseOneAddress(l).parts.domain.tokens, lines)
R.forEach(l => console.log(l), sortedLines)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment