<commit_before>import {Injectable} from "@angular/core";
import {HttpClient} from "@angular/common/http";

@Injectable()
export class UtilsService {

    remote: Electron.Remote;

    constructor(private http: HttpClient) {
        this.remote = window.require("electron").remote;
    }

    /**
     * Return true if the string is a JSON Object.
     * @param {string} JSONString
     * @returns {boolean}
     */
    public static isJSONString(JSONString: string) {
        try {
            JSON.parse(JSONString);
        } catch (e) {
            return false;
        }
        return true;
    }

    /**
     * Return the json of package.json.
     * @returns {Promise<any>}
     */
    public getPackageInformations(): Promise<any> {
        return this.http.get("../package.json").toPromise();
    }

    /**
     * Open a link with the default browser.
     * @param {string} href
     */
    public openExternalLink(href: string) {
        this.remote.shell.openExternal(href);
    }

    /**
     * Close the application.
     */
    public closeApplication() {
        this.remote.getCurrentWindow().close();
    }

    /**
     * Minimize the application.
     */
    public minimizeApplication() {
        this.remote.getCurrentWindow().minimize();
    }

    /**
     * Minimize the application.
     */
    public minimizeApplication() {
        this.remote.getCurrentWindow().minimize();
    }

    /**
     * Maximize the application.
     */
    public maximizeApplication(flag: boolean) {
        this.remote.getCurrentWindow().maximize();
    }

}<commit_msg>[refactor] remove dublicate function<commit_after>import {Injectable} from "@angular/core";
import {HttpClient} from "@angular/common/http";

@Injectable()
export class UtilsService {

    remote: Electron.Remote;

    constructor(private http: HttpClient) {
        this.remote = window.require("electron").remote;
    }

    /**
     * Return true if the string is a JSON Object.
     * @param {string} JSONString
     * @returns {boolean}
     */
    public static isJSONString(JSONString: string) {
        try {
            JSON.parse(JSONString);
        } catch (e) {
            return false;
        }
        return true;
    }

    /**
     * Return the json of package.json.
     * @returns {Promise<any>}
     */
    public getPackageInformations(): Promise<any> {
        return this.http.get("../package.json").toPromise();
    }

    /**
     * Open a link with the default browser.
     * @param {string} href
     */
    public openExternalLink(href: string) {
        this.remote.shell.openExternal(href);
    }

    /**
     * Close the application.
     */
    public closeApplication() {
        this.remote.getCurrentWindow().close();
    }

    /**
     * Minimize the application.
     */
    public minimizeApplication() {
        this.remote.getCurrentWindow().minimize();
    }

    /**
     * Maximize the application.
     */
    public maximizeApplication(flag: boolean) {
        this.remote.getCurrentWindow().maximize();
    }

}
{'fraction_non_alphanumeric': 0.1297208538587849, 'fraction_numerical': 0.0, 'mean_word_length': 2.159751037344398, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '107006', 'n_tokens_mistral': 876, 'n_tokens_neox': 851, 'n_words': 189}