<commit_before>var crypto = require('crypto')

module.exports = packagify

function packagify(data) {
  var current_version = data['dist-tags'].latest

  var author_name = data.versions[current_version].author.name ||
    data.maintainers[0].name
  
  var author_email = data.versions[current_version].author.email ||
    data.maintainers[0].email

  return {
      name: data.name
    , description: data.description
    , author: author_name
    , author_email: author_email
    , default_avatar: encodeURIComponent('http://i.imgur.com/QgNMMnd.png')
    , author_avatar: gravatarify(author_email)<commit_msg>better author fallback logic<commit_after>var crypto = require('crypto')

module.exports = packagify

function packagify(data) {
  var current_version = data['dist-tags'].latest

  var author = data.versions[current_version].author || {}

  var author_email = author.email || data.maintainers[0].email
    , author_name = author.name || data.maintainers[0].name

  return {
      name: data.name
    , description: data.description
    , author: author_name
    , author_email: author_email
    , default_avatar: encodeURIComponent('http://i.imgur.com/QgNMMnd.png')
    , author_avatar: gravatarify(author_email)
{'fraction_non_alphanumeric': 0.11783960720130933, 'fraction_numerical': 0.0032733224222585926, 'mean_word_length': 4.317391304347826, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6839294', 'n_tokens_mistral': 387, 'n_tokens_neox': 379, 'n_words': 66}