<commit_before>//
//  UIImage+Export.swift
//  Filestack
//
//  Created by <NAME> on 7/11/19.
//  Copyright © 2019 Filestack. All rights reserved.
//

import UIKit

extension UIImage {
    func exportHEICImage(to destinationURL: URL, quality: Float) -> Bool {
        if let imageData = heicRepresentation(quality: quality) {
            do {
                try imageData.write(to: destinationURL)
                return true
            } catch {
                return false
            }
        }

        return false
    }

    func exportJPGImage(to destinationURL: URL, quality: Float) -> Bool {
        if let imageData = jpegData(compressionQuality: CGFloat(quality)) {
            do {
                try imageData.write(to: destinationURL)
                return true
            } catch {
                return false
            }
        }

        return false
    }
}<commit_msg>Minor refactoring in UIImage+Export extension.<commit_after>//
//  UIImage+Export.swift
//  Filestack
//
//  Created by <NAME> on 7/11/19.
//  Copyright © 2019 Filestack. All rights reserved.
//

import UIKit

extension UIImage {
    func exportHEICImage(to destinationURL: URL, quality: Float) -> Bool {
        guard let imageData = heicRepresentation(quality: quality) else { return false }

        return export(data: imageData, to: destinationURL)
    }

    func exportJPGImage(to destinationURL: URL, quality: Float) -> Bool {
        guard let imageData = jpegData(compressionQuality: CGFloat(quality)) else { return false }

        return export(data: imageData, to: destinationURL)
    }

    // MARK: - Private Functions

    private func export(data: Data, to destinationURL: URL) -> Bool {
        do {
            try data.write(to: destinationURL)
            return true
        } catch {
            return false
        }
    }
}
{'fraction_non_alphanumeric': 0.09258256632376827, 'fraction_numerical': 0.009745533297238766, 'mean_word_length': 1.9426751592356688, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 10, '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': '5702157', 'n_tokens_mistral': 544, 'n_tokens_neox': 503, 'n_words': 148}