mmm.js
function getExistsSync(path, exts) {
    for (var i=0,len=exts.length; i<len; i++) {
        if (fs.existsSync(path + exts[i])) {
            return path + exts[i];
        }
    }
    return false;
}
function getExistsSync(path, exts) {
    for (var i=0,len=exts.length; i<len; i++) {
        if (fs.existsSync(path + exts[i])) {
            return path + exts[i];
        }
    }
    return false;
}
function getExistsSync ( path , exts ) { for ( var i = 0 , len = exts . length ; i < len ; i ++ ) { if ( fs . existsSync ( path + exts [ i ] ) ) { return path + exts [ i ] ; } } return false ; }
Takes a path and array of file extensions
and returns the first path + extension that exists
or returns false.
Takes a path and array of file extensions and returns the first path + extension that exists or returns false .