<commit_before>//
//  SubredditListing.swift
//  Reddit
//
//  Created by <NAME> on 27/04/16.
//  Copyright © 2016 Faber Ventures. All rights reserved.
//

import Foundation
import ObjectMapper

struct SubredditListing: Mappable, Listing {

  // MARK: Listing
  var before: String?
  var after: String?

  // MARK: SubredditListing
  var subreddits: [Subreddit]?

  // MARK: JSON
  init?(_ map: Map) { }

  mutating func mapping(map: Map) {
    mappingListing(map)
    subreddits <- map["data.children"]
  }

}<commit_msg>Performing JSON check on failable initializer on SubredditListing<commit_after>//
//  SubredditListing.swift
//  Reddit
//
//  Created by <NAME> on 27/04/16.
//  Copyright © 2016 Faber Ventures. All rights reserved.
//

import Foundation
import ObjectMapper

struct SubredditListing: Mappable, Listing {

  // MARK: Listing
  var before: String?
  var after: String?

  // MARK: SubredditListing
  var subreddits: [Subreddit]?

  // MARK: JSON
  init?(_ map: Map) {
    // Fail if no data is found
    guard let _ = map.JSONDictionary["data"] else { return nil }
  }

  mutating func mapping(map: Map) {
    mappingListing(map)
    subreddits <- map["data.children"]
  }

}
{'fraction_non_alphanumeric': 0.1205020920502092, 'fraction_numerical': 0.016736401673640166, 'mean_word_length': 3.0405405405405403, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, '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': '3381177', 'n_tokens_mistral': 433, 'n_tokens_neox': 409, 'n_words': 117}