<commit_before>/* @flow */
import type { Action } from '../actions/types'
import type { Message } from 'types'

export type MessagesState = Array<Message>

const initialState = []

export default function reducer (state: MessagesState = initialState, action: Action) {
  switch (action.type) {
    case 'RECEIVE_MESSAGE':
      const isMessageInState = state.findIndex(message => message.key === action.message.key) !== -1
      return (!isMessageInState ? state.concat(action.message) : state)
    default:
      return state
  }
}<commit_msg>changed ternary to if statement, saved refined action.message type to variable.<commit_after>/* @flow */
import type { Action } from '../actions/types'
import type { Message } from 'types'

export type MessagesState = Array<Message>

const initialState = []

export default function reducer (state: MessagesState = initialState, action: Action) {
  switch (action.type) {
    case 'RECEIVE_MESSAGE':
      const message = action.message
      const isMessageInState = state.findIndex(el => el.key === message.key) !== -1
      if (!isMessageInState) {
        return state.concat(message)
      }
      return state
    default:
      return state
  }
}
{'fraction_non_alphanumeric': 0.1161236424394319, 'fraction_numerical': 0.001670843776106934, 'mean_word_length': 3.572519083969466, 'pattern_counts': {'":': 0, '<': 5, '<?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': '2099355', 'n_tokens_mistral': 339, 'n_tokens_neox': 335, 'n_words': 103}