<commit_before>//
//  Decoder.swift
//  FSwift
//
//  Created by <NAME> on 1/15/15.
//  Copyright (c) 2015 Kelton. All rights reserved.
//

import Foundation

public extension Decoder {
    
    public var string: String? {
        return self.val as? String
    }
    
    public var int: Int? {
        return self.val as? Int
    }
    
    public var double: Double? {
        return self.val as? Double
    }
    
    public var float: Float? {
        return self.val as? Float
    }
    
    public var bool: Bool? {
        return self.val as? Bool
    }
    
    public var errorMessage: String? {
        if let err = self.err as NSError? {
            return err.userInfo!["message"] as String?
        }
        return nil
    }
    
}

public struct Decoder {
    
    let notAnArrayError = NSError(domain: "com.optionreader", code: 2, userInfo: [ "message" : "data is not array like" ])
    let notADictionaryError = NSError(domain: "com.optionreader", code: 3, userInfo: [ "message" : "data is not dictionary like" ])
    
    
    private var rawDictionary: [String : AnyObject]?
    private var rawArray: [AnyObject]?
    private var value: AnyObject?
    private var error: NSError?
    let depth: Int
    
    public init(dictionary: [String : AnyObject], depth: Int = 0) {
        self.rawDictionary = dictionary
        self.depth = depth
    }
    
    public init(array: [AnyObject], depth: Int = 0) {
        self.rawArray = array
        self.depth = depth
    }
    
    private init(value: AnyObject, parseType: Bool = false, depth: Int = 0) {
        self.depth = depth
        if !parseType {
            self.value = value
        }
        else {
            if let a = value as? [AnyObject] {
                self.rawArray = a
            }
            else if let d = val as? [String : AnyObject] {
                self.rawDictionary = d
            }
            else {
                self.value = value
            }
        }
    }
    
    private init(error: NSError, depth: Int = 0) {
        self.depth = depth
        self.error = error
    }
    
    public var arr: DecoderArray? {
        if let a = rawArray {
            return DecoderArray(items: a)
        }
        else {
            return nil
        }
    }
    <commit_msg>val to value<commit_after>//
//  Decoder.swift
//  FSwift
//
//  Created by <NAME> on 1/15/15.
//  Copyright (c) 2015 Kelton. All rights reserved.
//

import Foundation

public extension Decoder {
    
    public var string: String? {
        return self.val as? String
    }
    
    public var int: Int? {
        return self.val as? Int
    }
    
    public var double: Double? {
        return self.val as? Double
    }
    
    public var float: Float? {
        return self.val as? Float
    }
    
    public var bool: Bool? {
        return self.val as? Bool
    }
    
    public var errorMessage: String? {
        if let err = self.err as NSError? {
            return err.userInfo!["message"] as String?
        }
        return nil
    }
    
}

public struct Decoder {
    
    let notAnArrayError = NSError(domain: "com.optionreader", code: 2, userInfo: [ "message" : "data is not array like" ])
    let notADictionaryError = NSError(domain: "com.optionreader", code: 3, userInfo: [ "message" : "data is not dictionary like" ])
    
    
    private var rawDictionary: [String : AnyObject]?
    private var rawArray: [AnyObject]?
    private var value: AnyObject?
    private var error: NSError?
    let depth: Int
    
    public init(dictionary: [String : AnyObject], depth: Int = 0) {
        self.rawDictionary = dictionary
        self.depth = depth
    }
    
    public init(array: [AnyObject], depth: Int = 0) {
        self.rawArray = array
        self.depth = depth
    }
    
    private init(value: AnyObject, parseType: Bool = false, depth: Int = 0) {
        self.depth = depth
        if !parseType {
            self.value = value
        }
        else {
            if let a = value as? [AnyObject] {
                self.rawArray = a
            }
            else if let d = value as? [String : AnyObject] {
                self.rawDictionary = d
            }
            else {
                self.value = value
            }
        }
    }
    
    private init(error: NSError, depth: Int = 0) {
        self.depth = depth
        self.error = error
    }
    
    public var arr: DecoderArray? {
        if let a = rawArray {
            return DecoderArray(items: a)
        }
        else {
            return nil
        }
    }
    
{'fraction_non_alphanumeric': 0.09655475093263112, 'fraction_numerical': 0.0065832784726793945, 'mean_word_length': 1.5883021010789324, 'pattern_counts': {'":': 0, '<': 5, '<?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': '1335647', 'n_tokens_mistral': 1409, 'n_tokens_neox': 1354, 'n_words': 416}