<commit_before>import React from 'react';

import ObjectStore from '../../stores/object';
import ObjectActions from '../../actions/object';

export default class HeaderComponent extends React.Component {

  constructor(props) {
    super(props);
    this.state = this.getState();
  }

  componentDidMount() {
    this.unsubscribe = ObjectStore.listen((name) => {
      this.onUpdate(name);
    });
  }

  componentWillUnmount() {
    this.unsubscribe();
  }

  onUpdate(data){
    if(data && data.objects){
        this.setState({
          digibord: data.objects.digibord && data.objects.digibord.getValue() !== this.state.digibord ? data.objects.digibord : null,
          naam: data.objects.naam && data.objects.naam.getValue() !== this.state.naam ? data.objects.naam : null
        });
      }
  }

  getState(){
    return {
      digibord: ObjectStore.getObject('digibord'),
      naam: ObjectStore.getObject('naam'),
    };
  }

  render() {
    let name;
    if(this.state.naam && this.state.naam.state !== ''){
      name = <h2>{ this.state.naam.state }</h2>;
    }

    let connectedTo;
    if(this.state.digibord && this.state.digibord.state > 0){
      connectedTo = <h3 className="connected-to">{ this.state.digibord.state }</h3>;
    }

    return(
      <header>
        <h1>CT-3000</h1>
        { name }<commit_msg>Simplify checks.<commit_after>import React from 'react';

import ObjectStore from '../../stores/object';
import ObjectActions from '../../actions/object';

export default class HeaderComponent extends React.Component {

  constructor(props) {
    super(props);
    this.state = this.getState();
  }

  componentDidMount() {
    this.unsubscribe = ObjectStore.listen((name) => {
      this.onUpdate(name);
    });
  }

  componentWillUnmount() {
    this.unsubscribe();
  }

  onUpdate(data){
    if(data && data.objects){
        this.setState({
          digibord: data.objects.digibord,
          naam: data.objects.naam
        });
      }
  }

  getState(){
    return {
      digibord: ObjectStore.getObject('digibord'),
      naam: ObjectStore.getObject('naam'),
    };
  }

  render() {
    let name;
    if(this.state.naam && this.state.naam.state !== ''){
      name = <h2>{ this.state.naam.state }</h2>;
    }

    let connectedTo;
    if(this.state.digibord && this.state.digibord.state > 0){
      connectedTo = <h3 className="connected-to">{ this.state.digibord.state }</h3>;
    }

    return(
      <header>
        <h1>CT-3000</h1>
        { name }
{'fraction_non_alphanumeric': 0.1623246492985972, 'fraction_numerical': 0.008817635270541082, 'mean_word_length': 2.59136690647482, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 21, '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': '4905326', 'n_tokens_mistral': 835, 'n_tokens_neox': 818, 'n_words': 139}