<commit_before>import React from 'react'
import PropTypes from 'prop-types'
import classNames from 'classnames'
import style from './style.scss'

const symbols = new Map()
const files = require.context('./glyphs', false, /.svg$/)
files.keys().forEach((item) => {
  const { id } = files(item).default
  symbols.set(id.replace(/_{2}(.*)/, ''), id)
})

const Icon = ({ name, className, ...props }) => (
  <svg
    {...props}
    className={classNames(
      style.root,
      className,
    )}>
    <use xlinkHref={`#${symbols.get(name)}`} />
  </svg>
)

Icon.propTypes = {
  name: PropTypes.string.isRequired,
}

export default Icon<commit_msg>Update icon component<commit_after>import React from 'react'
import PropTypes from 'prop-types'
import classNames from 'classnames'
import style from './style.scss'

const withMap = r => r.keys().reduce((acc, item) => {
  const { id } = r(item).default
  acc[id.match(/^[^-]*/)[0]] = id
  return acc
}, {})

const map = withMap(require.context('./glyphs', false, /.svg$/))

const Icon = ({ name, className, ...props }) => (
  <svg
    {...props}
    className={classNames(
      style.root,
      className,
    )}>
    <use xlinkHref={`#${map[name]}`} />
  </svg>
)

Icon.propTypes = {
  name: PropTypes.string.isRequired,
}

export default Icon
{'fraction_non_alphanumeric': 0.19332298136645962, 'fraction_numerical': 0.0015527950310559005, 'mean_word_length': 3.414383561643836, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 14, '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': '2202132', 'n_tokens_mistral': 439, 'n_tokens_neox': 441, 'n_words': 103}