<commit_before>import React from 'react';
import TuiGrid from 'tui-grid';

const reactivePropSetterMap = {
  data: 'setData',
  columns: 'setColumns',
  bodyHeight: 'setBodyHeight',
  frozenColumnCount: 'setFrozenColumnCount'
};

export default class Grid extends React.Component {
  rootEl = React.createRef();

  gridInst = null;

  componentDidMount() {
    this.gridInst = new TuiGrid({
      el: this.rootEl.current,
      ...this.props
    });

    this.useAddons();
    this.bindEventHandlers();
  }

  useAddons() {
    const {addon} = this.props;

    if (addon) {
      Object.keys(addon).forEach((addonName) => {
        this.gridInst.use(addonName, addon[addonName]);
      });
    }
  }

  bindEventHandlers() {
    Object.keys(this.props)
      .filter((key) => /on[A-Z][a-z0-9]+/.test(key))
      .forEach((key) => {
        const eventName = key[2].toLowerCase() + key.slice(3);
        this.gridInst.on(eventName, this.props[key]);
      });
  }

  getGridInstance() {
    return this.gridInst;
  }

  getRootElement() {
    return this.rootEl.current;
  }<commit_msg>fix: regexp for onXXX handler<commit_after>import React from 'react';
import TuiGrid from 'tui-grid';

const reactivePropSetterMap = {
  data: 'setData',
  columns: 'setColumns',
  bodyHeight: 'setBodyHeight',
  frozenColumnCount: 'setFrozenColumnCount'
};

export default class Grid extends React.Component {
  rootEl = React.createRef();

  gridInst = null;

  componentDidMount() {
    this.gridInst = new TuiGrid({
      el: this.rootEl.current,
      ...this.props
    });

    this.useAddons();
    this.bindEventHandlers();
  }

  useAddons() {
    const {addon} = this.props;

    if (addon) {
      Object.keys(addon).forEach((addonName) => {
        this.gridInst.use(addonName, addon[addonName]);
      });
    }
  }

  bindEventHandlers() {
    Object.keys(this.props)
      .filter((key) => /on[A-Z][a-zA-Z]+/.test(key))
      .forEach((key) => {
        const eventName = key[2].toLowerCase() + key.slice(3);
        this.gridInst.on(eventName, this.props[key]);
      });
  }

  getGridInstance() {
    return this.gridInst;
  }

  getRootElement() {
    return this.rootEl.current;
  }
{'fraction_non_alphanumeric': 0.15599268069533395, 'fraction_numerical': 0.0027447392497712718, 'mean_word_length': 2.9405405405405407, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '7308290', 'n_tokens_mistral': 773, 'n_tokens_neox': 755, 'n_words': 130}