import { JiraAuthor } from "../interfaces/jira" ; import _ from "lodash" ; export const getJiraAuthor = ( ... authors ) : JiraAuthor => { const author = Object . assign ( { } , ... authors ) ; return author . login || author . name ? _ . pickBy ( { avatar : author . avatar_url || author . avatarUrl || ( author . login ? `https://github.com/users/${ author . login }.png` : undefined ) , name : author . name || author . user ?. name || author . login || author . email ?. match ( /^(.*)@/ ) ?. pop ( ) || "unknown" , email : author . email || `${ author . login }@noreply.user.github.com` , url : author . html_url || author . url || author . user ?. url || ( author . login ? `https://github.com/users/${ author . login }` : undefined ) } ) as JiraAuthor : { avatar : "https://github.com/ghost.png" , name : "Deleted User" , email : "deleted@noreply.user.github.com" , url : "https://github.com/ghost" } ; } ; interface Author { avatar_url ? : string ; avatarUrl ? : string ; name ? : string ; login ? : string ; email ? : string ; url ? : string ; html_url ? : string ; user ? : { url ? : string ; } ; }