Press n or j to go to the next uncovered block, b, p or k for the previous block.
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 | 14x 14x 14x 13028x 13028x 91196x 594504x 594504x 25558x 25558x 568946x 13028x | const path = require('path'); const BASENAMES_PRECEDENCE = [ /^LICENSE$/, /^LICENSE\-\w+$/, // e.g. LICENSE-MIT /^LICENCE$/, /^LICENCE\-\w+$/, // e.g. LICENCE-MIT /^MIT-LICENSE$/, /^COPYING$/, /^README$/, // TODO: should we really include README? ]; // Find and list license files in the precedence order module.exports = function (dirFiles) { const files = []; BASENAMES_PRECEDENCE.forEach((basenamePattern) => { dirFiles.some((filename) => { const basename = path.basename(filename, path.extname(filename)).toUpperCase(); if (basenamePattern.test(basename)) { files.push(filename); return true; } return false; }); }); return files; }; |