<commit_before>import React, {PropTypes} from 'react'
import Component from 'react-pure-render/component'
import './Location.scss'
import Sizes from './card-sizes'
import IconLabel from './IconLabel.jsx'

export default class Location extends Component {
  render() {
    const { location, size, showState = false } = this.props
    const { city, state } = location

    let addressToShow = showState ? `${city}, ${state}` : city

    if (!city || !city.trim()) {
      addressToShow =  '?'
    } else {
      addressToShow =  showState ? `${city}, ${(state || '?')}` : city
    }

    return (
      <IconLabel className="Location" icon="place" size={size}>{addressToShow}</IconLabel>
    )
  }
}

Location.propTypes = {
  location: PropTypes.shape({
    city: PropTypes.string,
    state: PropTypes.string,
    streetAddress: PropTypes.string,
    zip: PropTypes.string
  }),
  //showState: PropTypes.boolean,
  size: PropTypes.oneOf(Object.keys(Sizes)).isRequired
}<commit_msg>setting defaults in location component so it doesn't fail with error when city is undefined<commit_after>import React, {PropTypes} from 'react'
import Component from 'react-pure-render/component'
import './Location.scss'
import Sizes from './card-sizes'
import IconLabel from './IconLabel.jsx'

export default class Location extends Component {
  render() {
    const { location = {city: '', state: ''}, size, showState = false } = this.props
    const { city, state } = location

    let addressToShow = showState ? `${city}, ${state}` : city

    if (!city || !city.trim()) {
      addressToShow =  '?'
    } else {
      addressToShow =  showState ? `${city}, ${(state || '?')}` : city
    }

    return (
      <IconLabel className="Location" icon="place" size={size}>{addressToShow}</IconLabel>
    )
  }
}

Location.propTypes = {
  location: PropTypes.shape({
    city: PropTypes.string,
    state: PropTypes.string,
    streetAddress: PropTypes.string,
    zip: PropTypes.string
  }),
  //showState: PropTypes.boolean,
  size: PropTypes.oneOf(Object.keys(Sizes)).isRequired
}
{'fraction_non_alphanumeric': 0.1469447138700291, 'fraction_numerical': 0.0, 'mean_word_length': 3.5844444444444443, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '3298799', 'n_tokens_mistral': 615, 'n_tokens_neox': 626, 'n_words': 160}