<commit_before>#!/usr/bin/env node

"use strict"

const cmd = require("node-cmd");
const _ = require("lodash");

const utils = {};

utils["execute"] = function(command, environment = ""){
    cmd.run("start " + utils.checkPrefix(command));
};

utils["checkPrefix"] = function(url){
    if(_.startsWith(url, "http://") || _.startsWith(url, "https://"))
        return url;
    else
        return "http://" + url;
};

module.exports = utils;<commit_msg>Adds function in utils.js to verify if the URL is valid<commit_after>#!/usr/bin/env node

"use strict"

const cmd = require("node-cmd");
const _ = require("lodash");

const utils = {};

utils["execute"] = function(command, environment = "") {
    cmd.run("start " + this.checkPrefix(command));
};

utils["checkPrefix"] = function(url) {
    if(this.isValidURL(url))
        return url;
    else
        return "http://" + url;
};

utils["isValidURL"] = function(url) {
    return _.startsWith(url, "http://") || _.startsWith(url, "https://");
}

module.exports = utils;
{'fraction_non_alphanumeric': 0.197845249755142, 'fraction_numerical': 0.0, 'mean_word_length': 3.7534883720930234, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '3532655', 'n_tokens_mistral': 336, 'n_tokens_neox': 342, 'n_words': 73}