<commit_before>const nest = require('depnest')
const { h, computed } = require('mutant')

exports.gives = nest('about.html.avatar')

exports.needs = nest({
  'about.obs': {
    color: 'first',
    imageUrl: 'first'
  },
  'about.html.link': 'first'
})

exports.create = function (api) {
  return nest('about.html.avatar', avatar)

  function avatar (id, size = 4) {
    const src = api.about.obs.imageUrl(id)
    const color = computed(src, src => src.match(/^http/) ? 'rgba(0,0,0,0)' : api.about.obs.color(id))

    const avatar = api.about.html.link(id,
      h('img', {
        style: { 'background-color': color },
        src
      })
    )
    avatar.classList.add('Avatar')
    avatar.style.setProperty('--avatar-size', Number.isNaN(size) ? size : `${size}rem`)

    return avatar
  }
}<commit_msg>tweak avatar render<commit_after>const nest = require('depnest')
const { h, computed } = require('mutant')

exports.gives = nest('about.html.avatar')

exports.needs = nest({
  'about.obs': {
    color: 'first',
    imageUrl: 'first'
  },
  'about.html.link': 'first'
})

exports.create = function (api) {
  return nest('about.html.avatar', avatar)

  function avatar (id, size = 4) {
    const src = api.about.obs.imageUrl(id)
    const color = computed(src, src => src.match(/^http/) ? 'rgba(0,0,0,0)' : api.about.obs.color(id))

    const avatar = api.about.html.link(id,
      h('img', {
        style: { 'background-color': color },
        src
      })
    )
    avatar.classList.add('Avatar')
    avatar.style.setProperty('--avatar-size', isNaN(size) ? size : `${size}rem`)

    return avatar
  }
}
{'fraction_non_alphanumeric': 0.1858297078931013, 'fraction_numerical': 0.006215040397762586, 'mean_word_length': 3.128205128205128, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '4969650', 'n_tokens_mistral': 589, 'n_tokens_neox': 570, 'n_words': 110}