function filterFiles(files, exts = []) {
        if (exts.length) {
            const allowNoExts = exts.includes('');
            files = files.filter(f => {
                // include files with no extensions if noExt is true
                if (allowNoExts && !path.extname(f))
                    return true;
                // filter files in exts
                const lc = f.toLowerCase();
                for (const e of exts) {
                    if (e && lc.endsWith(e.toLowerCase())) {
                        return true;
                    }
                }
                return false;
            });
        }
        // Filter out BUILD files that came with the npm package
        return files.filter(file => {
            const basenameUc = path.basename(file).toUpperCase();
            if (basenameUc === '_BUILD' || basenameUc === '_BUILD.BAZEL') {
                return false;
            }
            return true;
        });
    }
/**
     * A filter function for files in an npm package. Comparison is case-insensitive.
     * @param files array of files to filter
     * @param exts list of white listed case-insensitive extensions; if empty, no filter is
     *             done on extensions; '' empty string denotes to allow files with no extensions,
     *             other extensions are listed with '.ext' notation such as '.d.ts'.
     */
A filter function for files in an npm package. Comparison is case-insensitive.
A filter function for files in an npm package . Comparison is case - insensitive .
function filterFiles(files, exts = []) {
        if (exts.length) {
            const allowNoExts = exts.includes('');
            files = files.filter(f => {
                if (allowNoExts && !path.extname(f))
                    return true;
                const lc = f.toLowerCase();
                for (const e of exts) {
                    if (e && lc.endsWith(e.toLowerCase())) {
                        return true;
                    }
                }
                return false;
            });
        }
        return files.filter(file => {
            const basenameUc = path.basename(file).toUpperCase();
            if (basenameUc === '_BUILD' || basenameUc === '_BUILD.BAZEL') {
                return false;
            }
            return true;
        });
    }
function filterFiles ( files , exts = [ ] ) { if ( exts . length ) { const allowNoExts = exts . includes ( '' ) ; files = files . filter ( f => { if ( allowNoExts && ! path . extname ( f ) ) return true ; const lc = f . toLowerCase ( ) ; for ( const e of exts ) { if ( e && lc . endsWith ( e . toLowerCase ( ) ) ) { return true ; } } return false ; } ) ; } return files . filter ( file => { const basenameUc = path . basename ( file ) . toUpperCase ( ) ; if ( basenameUc === '_BUILD' || basenameUc === '_BUILD.BAZEL' ) { return false ; } return true ; } ) ; }
A filter function for files in an npm package.
A filter function for files in an npm package .
// include files with no extensions if noExt is true // filter files in exts // Filter out BUILD files that came with the npm package