<commit_before>//
//  GitHubSearchViewReactor.swift
//  GitHubSearch
//
//  Created by <NAME> on 13/05/2017.
//  Copyright © 2017 <NAME>. All rights reserved.
//

import ReactorKit

final class GitHubSearchViewReactor: Reactor {
  enum Action {
  }

  enum Mutation {
  }

  struct State {
  }

  let initialState = State()
}<commit_msg>Implement reactor with dummy data<commit_after>//
//  GitHubSearchViewReactor.swift
//  GitHubSearch
//
//  Created by <NAME> on 13/05/2017.
//  Copyright © 2017 <NAME>. All rights reserved.
//

import ReactorKit
import RxSwift

final class GitHubSearchViewReactor: Reactor {
  enum Action {
    case updateQuery(String?)
  }

  enum Mutation {
    case setRepos([String])
  }

  struct State {
    var repos: [String] = []
  }

  let initialState = State()

  func mutate(action: Action) -> Observable<Mutation> {
    switch action {
    case let .updateQuery(query):
      if let query = query {
        let dummyRepos = ["\(query)1", "\(query)2", "\(query)3"]
        return Observable.just(Mutation.setRepos(dummyRepos))
      } else {
        return Observable.just(Mutation.setRepos([]))
      }
    }
  }

  func reduce(state: State, mutation: Mutation) -> State {
    switch mutation {
    case let .setRepos(repos):
      var newState = state
      newState.repos = repos
      return newState
    }
  }
}
{'fraction_non_alphanumeric': 0.12213175425610659, 'fraction_numerical': 0.01998519615099926, 'mean_word_length': 2.683923705722071, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 10, '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': '4043672', 'n_tokens_mistral': 473, 'n_tokens_neox': 430, 'n_words': 114}