<commit_before>/* @flow */

import React, { Component } from 'react';
import { connect } from 'react-redux';
import { actions } from 'react-redux-form';
import _get from 'lodash.get';
import RowComponent from './RowComponent';
import Readonly from './Readonly';

type Props = {
  label: string,
  type?: string,
  values: ?Array<string>,
  readonly?: boolean,
  onChange: (index: number, value: string) => void,
  onAddItemRequested: (value: string) => void,
  onRemoveItemRequested: (index: number) => void,
};

export function asArray(value) {
  if (value == null) return [];
  if (Array.isArray(value)) return value;
  return [value];
}

export class MultiInputComponent extends Component {
  constructor(props: Props) {
    super(props);

    this.state = {
      text: '',
    };
  }

  state: {
    text: string,
  };

  props: Props;

  render() {
    const {<commit_msg>(refs #519) Add flow annotation to MultiInput.asArray<commit_after>/* @flow */

import React, { Component } from 'react';
import { connect } from 'react-redux';
import { actions } from 'react-redux-form';
import _get from 'lodash.get';
import RowComponent from './RowComponent';
import Readonly from './Readonly';

type Props = {
  label: string,
  type?: string,
  values: ?Array<string>,
  readonly?: boolean,
  onChange: (index: number, value: string) => void,
  onAddItemRequested: (value: string) => void,
  onRemoveItemRequested: (index: number) => void,
};

export function asArray(value: any): Array<any> {
  if (value == null) return [];
  if (Array.isArray(value)) return value;
  return [value];
}

export class MultiInputComponent extends Component {
  constructor(props: Props) {
    super(props);

    this.state = {
      text: '',
    };
  }

  state: {
    text: string,
  };

  props: Props;

  render() {
    const {
{'fraction_non_alphanumeric': 0.14892443463872035, 'fraction_numerical': 0.001654715940430226, 'mean_word_length': 3.74869109947644, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 12, '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': '4216262', 'n_tokens_mistral': 589, 'n_tokens_neox': 578, 'n_words': 170}