Created
June 4, 2018 15:26
-
-
Save lagondo/e4edd670dcec0b989459ec1c85081b97 to your computer and use it in GitHub Desktop.
Sort emails by domain
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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