<commit_before>//
//  NSDateExtension.swift
//  NGAFramework
//
//  Created by <NAME> on 3/14/16.
//  Copyright © 2016 NextGen Apps LLC. All rights reserved.
//

import Foundation

public extension Date {
    public static var defaultDateFormat = "yyyy-MM-dd HH:mm:ss.SSS Z"
    
    public static func date(from dateString:String?, withFormat formatString:String) -> Date?{
        guard let dateString = dateString else {return nil}
        let dateFormatter = DateFormatter()
        dateFormatter.dateFormat = formatString
        return dateFormatter.date(from: dateString)
    }
    
    
    public func toString(format:String? = nil) -> String? {
//        if format == nil {return description}
        let dateFormatter = DateFormatter()
        dateFormatter.dateFormat = format ?? Date.defaultDateFormat
        return dateFormatter.string(from: self)
    }
    
    public func toStyledString(dateStyle ds:DateFormatter.Style = .medium, timeStyle ts:DateFormatter.Style = .medium) -> String? {
        return DateFormatter.localizedString(from: self, dateStyle: ds, timeStyle: ts)
    }
    
}

<commit_msg>Added API methods<commit_after>//
//  NSDateExtension.swift
//  NGAFramework
//
//  Created by <NAME> on 3/14/16.
//  Copyright © 2016 NextGen Apps LLC. All rights reserved.
//

import Foundation

public extension Date {
    public static var defaultDateFormat = "yyyy-MM-dd HH:mm:ss.SSS Z"
    
    public static func date(from dateString:String?, withFormat formatString:String) -> Date?{
        guard let dateString = dateString else {return nil}
        let dateFormatter = DateFormatter()
        dateFormatter.dateFormat = formatString
        return dateFormatter.date(from: dateString)
    }
    
    
    public func toString(format:String? = nil) -> String? {
        let dateFormatter = DateFormatter()
        dateFormatter.dateFormat = format ?? Date.defaultDateFormat
        return dateFormatter.string(from: self)
    }
    
    public func toStyledString(dateStyle ds:DateFormatter.Style = .medium, timeStyle ts:DateFormatter.Style = .medium) -> String? {
        return DateFormatter.localizedString(from: self, dateStyle: ds, timeStyle: ts)
    }
    
    public func unixTimestamp() -> Int {
        return self.timeIntervalSince1970.toInt()
    }
    
}


{'fraction_non_alphanumeric': 0.09843205574912892, 'fraction_numerical': 0.009581881533101045, 'mean_word_length': 2.9064625850340136, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 12, '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': '5205998', 'n_tokens_mistral': 668, 'n_tokens_neox': 643, 'n_words': 177}