Code coverage report for lib/util.js

Statements: 94.74% (18 / 19)      Branches: 80% (8 / 10)      Functions: 100% (2 / 2)      Lines: 94.74% (18 / 19)     

All files » lib/ » util.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 381     1 1   1 24     24 24         24 324 5 5       24 19 1 1   18       1       1  
var fs = require('fs'),
    path = require('path');
 
exports.exists = fs.exists || path.exists;
exports.existsSync = fs.existsSync || path.existsSync;
 
var find = function(dir, file, cb) {
    var files, found,
    next = path.join(dir, '../');
 
    try {
        files = fs.readdirSync(dir);
    } catch (e) {
        files = [];
    }
    
    found = files.some(function(f) {
        if (f === file) {
            cb(null, path.join(dir, f));
            return true;
        }
    });
 
    if (!found) {
        if (dir === next) {
            cb('not found', null);
            return;
        }
        find(next, file, cb);
    }
};
 
exports.find = find;
 
 
 
exports.shifter = path.join(__dirname, '../bin/shifter');