<commit_before>//
//  JSONDecoder.swift
//  MeeSeeks
//
//  Created by <NAME> on 9/23/15.
//  Copyright © 2015 <NAME>. All rights reserved.
//

import Foundation

/// Provides an API for decoding JSONDecodable types.
public struct JSONDecoder<T: JSONDecodable> {
    
    /// Decode a JSON object
    public static func decode(json: AnyObject) -> T? {
        return T.decode(json)
    }
    /// Decode an array of JSON objects
    public static func decodeArray(json: [AnyObject]) -> [T]? {
        var results = [T]()
        
        for j in json {
            if let result = T.decode(j) {
                results.append(result)
            } else {
                return nil<commit_msg>avoid returning in `decodeArray` after failing to decode an item in the array<commit_after>//
//  JSONDecoder.swift
//  MeeSeeks
//
//  Created by <NAME> on 9/23/15.
//  Copyright © 2015 <NAME>. All rights reserved.
//

import Foundation

/// Provides an API for decoding JSONDecodable types.
public struct JSONDecoder<T: JSONDecodable> {
    
    /// Decode a JSON object
    public static func decode(json: AnyObject) -> T? {
        return T.decode(json)
    }
    /// Decode an array of JSON objects
    public static func decodeArray(json: [AnyObject]) -> [T]? {
        var results = [T]()
        
        for j in json {
            if let result = T.decode(j) {
                results.append(result)
{'fraction_non_alphanumeric': 0.11412268188302425, 'fraction_numerical': 0.012838801711840228, 'mean_word_length': 2.023706896551724, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 13, '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': '1531799', 'n_tokens_mistral': 437, 'n_tokens_neox': 414, 'n_words': 142}