<commit_before>const fs = require('fs'),
    json = require('json-file');

var projects = atom.workspace.project.getPaths(),
    composer = null;

/**
 * Return the version
 *
 * @param {String} name
 * @return {String}
 */
module.exports = (name) => {
    for (var i = 0; i < projects.length; i++) {
        var composerPath = projects[i]+'/composer.lock';
        if (fs.existsSync(composerPath) && !composer) {
            composer = json.read(composerPath);
        }
    }

    if (composer) {
        var packages = composer.data.packages;
        for (var c = 0; c < packages.length; c++) {
            if (packages[c].name == name) {
                var version = packages[c].version.split('.');
                // lets just return a stupidly large integer if its dev-master
                if (version[0] == 'dev-master') {
                  return 9999;
                }
                // return only the major and minor version
                return version[0]+'.'+version[1];
            }
        }
    }
};<commit_msg>Potential fix to #5<commit_after>const fs = require('fs'),
    json = require('json-file');

var projects = atom.workspace.project.getPaths(),
    packages = null;

/**
 * Return the version
 *
 * @param {String} name
 * @return {String}
 */
module.exports = (name) => {
    for (var i = 0; i < projects.length; i++) {
        var composer = projects[i] + '/composer.lock';
        if (fs.existsSync(composer) && !packages) {
            packages = json.read(composer).data.packages;
        }
    }

    if (packages) {
        for (var c = 0; c < packages.length; c++) {
            if (packages[c].name == name) {
                var version = packages[c].version.split('.');
                for (var v = 0; v < 2; v++) {
                    if(version[v] == null) {
                        version[v] =  0;
                    } else if (version[v].indexOf('dev') > -1) {
                        // lets just return a stupidly large integer if its dev-master
                        version[v] = 9999;
                    }
                }
                // return only the major and minor version
                return version[0] + '.' + version[1];
            }
        }
    }
};
{'fraction_non_alphanumeric': 0.14645103324348607, 'fraction_numerical': 0.009883198562443846, 'mean_word_length': 1.586527293844367, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 6, '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': '7609036', 'n_tokens_mistral': 665, 'n_tokens_neox': 634, 'n_words': 168}