<commit_before>var q = require('q');
var depcheck = require('depcheck');
var _ = require('lodash');

function checkUnused(dir){
    var defer = q.defer();

    if (!_.isFunction(depcheck)) {
        console.log('depcheck issues');
        console.log('typeof', typeof depcheck);
        console.log('keys', _.keys(depcheck));
        console.log('obj', depcheck);
        return;
    }

    depcheck(dir || process.cwd(), {}, function(unused) {
        return defer.resolve(unused);
    });
    return defer.promise;
}

module.exports = checkUnused;<commit_msg>workaround for https://github.com/rumpl/depcheck/issues/5<commit_after>var q = require('q');
var depcheck = require('../node_modules/depcheck/index'); //https://github.com/rumpl/depcheck/issues/5
var _ = require('lodash');

function checkUnused(dir){
    var defer = q.defer();

    depcheck(dir || process.cwd(), {}, function(unused) {
        return defer.resolve(unused);
    });
    return defer.promise;
}

module.exports = checkUnused;
{'fraction_non_alphanumeric': 0.17165668662674652, 'fraction_numerical': 0.001996007984031936, 'mean_word_length': 3.518018018018018, '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': '6771945', 'n_tokens_mistral': 322, 'n_tokens_neox': 313, 'n_words': 58}