lib/isFileOfType.js
async function isFileOfType(filename, condition){
    try{
        // get stats
        const stats = await _fs.stat(filename);

        // is directory ?
        return condition(stats);
    }catch(e){
        // file not found error ?
        if (e.code === 'ENOENT'){
            return false;
        }else{
            throw e;
        }
    }
}
async function isFileOfType(filename, condition){
    try{
        // get stats
        const stats = await _fs.stat(filename);

        // is directory ?
        return condition(stats);
    }catch(e){
        // file not found error ?
        if (e.code === 'ENOENT'){
            return false;
        }else{
            throw e;
        }
    }
}
async function isFileOfType ( filename , condition ) { try { // get stats const stats = await _fs . stat ( filename ) ; // is directory ? return condition ( stats ) ; } catch ( e ) { // file not found error ? if ( e . code === 'ENOENT' ) { return false ; } else { throw e ; } } }
check if node is of specific type
check if node is of specific type