<commit_before>//
//  Observable+MoyaObjectMapper.swift
//
//  Created by <NAME> on 09/12/15.
//  Copyright © 2015 <NAME>. All rights reserved.
//

import Foundation
import RxSwift
import Moya
import ObjectMapper

/// Extension for processing Responses into Mappable objects through ObjectMapper
public extension ObservableType where E == Response {

  /// Maps data received from the signal into an object
  /// which implements the Mappable protocol and returns the result back
  /// If the conversion fails, the signal errors.
  public func mapObject<T: Mappable>(type: T.Type) -> Observable<T> {
    return flatMap { response -> Observable<T> in
        return Observable.just(try response.mapObject(T))
      }
  }

  /// Maps data received from the signal into an array of objects
  /// which implement the Mappable protocol and returns the result back
  /// If the conversion fails, the signal errors.
  public func mapArray<T: Mappable>(type: T.Type) -> Observable<[T]> {
    return flatMap { response -> Observable<[T]> in
        return Observable.just(try response.mapArray(T))
      }
  }
}<commit_msg>Use BaseMappable as the expected protocol<commit_after>//
//  Observable+MoyaObjectMapper.swift
//
//  Created by <NAME> on 09/12/15.
//  Copyright © 2015 <NAME>. All rights reserved.
//

import Foundation
import RxSwift
import Moya
import ObjectMapper

/// Extension for processing Responses into Mappable objects through ObjectMapper
public extension ObservableType where E == Response {

  /// Maps data received from the signal into an object
  /// which implements the Mappable protocol and returns the result back
  /// If the conversion fails, the signal errors.
  public func mapObject<T: BaseMappable>(type: T.Type) -> Observable<T> {
    return flatMap { response -> Observable<T> in
        return Observable.just(try response.mapObject(T))
      }
  }

  /// Maps data received from the signal into an array of objects
  /// which implement the Mappable protocol and returns the result back
  /// If the conversion fails, the signal errors.
  public func mapArray<T: BaseMappable>(type: T.Type) -> Observable<[T]> {
    return flatMap { response -> Observable<[T]> in
        return Observable.just(try response.mapArray(T))
      }
  }
}
{'fraction_non_alphanumeric': 0.09717314487632508, 'fraction_numerical': 0.0088339222614841, 'mean_word_length': 3.322519083969466, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 27, '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': '6805409', 'n_tokens_mistral': 639, 'n_tokens_neox': 603, 'n_words': 243}