<commit_before>import React from 'react'
import { Popup, Icon } from 'semantic-ui-react'

interface Props {
  children: string
  maxLength?: number
  withPopup?: boolean
}

function Ellipsis({ children, maxLength, withPopup }: Props): React.ReactElement {
  if (children.length <= maxLength) {
    return <span title={children}>{children}</span>
  }
  return (
    <span title={children}>
      {children.substr(0, maxLength)}{' '}
      {withPopup ? (
        <Popup content={children} trigger={<Icon name="ellipsis horizontal" size="small" />} wide="very" />
      ) : (
        <Icon name="ellipsis horizontal" size="small" />
      )}
    </span>
  )
}

Ellipsis.defaultProps = {
  maxLength: 60,
  withPopup: false,
}

export default Ellipsis<commit_msg>Fix: Ensure that children is a string before calling substr<commit_after>import React from 'react'
import { Popup, Icon } from 'semantic-ui-react'

interface Props {
  children: string
  maxLength?: number
  withPopup?: boolean
}

function Ellipsis({ children, maxLength, withPopup }: Props): React.ReactElement {
  if (children.length <= maxLength || typeof children !== 'string') {
    return <span title={children}>{children}</span>
  }
  return (
    <span title={children}>
      {children.substr(0, maxLength)}{' '}
      {withPopup ? (
        <Popup content={children} trigger={<Icon name="ellipsis horizontal" size="small" />} wide="very" />
      ) : (
        <Icon name="ellipsis horizontal" size="small" />
      )}
    </span>
  )
}

Ellipsis.defaultProps = {
  maxLength: 60,
  withPopup: false,
}

export default Ellipsis
{'fraction_non_alphanumeric': 0.14661654135338345, 'fraction_numerical': 0.0037593984962406013, 'mean_word_length': 3.628985507246377, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 17, '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': '5648831', 'n_tokens_mistral': 505, 'n_tokens_neox': 509, 'n_words': 123}