All files / src/utils file-filter.js

100% Statements 4/4
100% Branches 2/2
100% Functions 3/3
100% Lines 4/4

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 33 34 35 36                    9x                 5x                 4x     3x        
/**
 * @file Utility functions for filtering files consistently across the codebase
 */
 
/**
 * Checks if a file is a Markdown file (ends with .md)
 * @param {string} filename - The filename to check
 * @returns {boolean} - True if the file is a Markdown file, false otherwise
 */
function isMarkdownFile(filename) {
    return filename.endsWith('.md');
}
 
/**
 * Checks if a file is hidden/excluded (starts with underscore)
 * @param {string} filename - The filename to check
 * @returns {boolean} - True if the file is hidden/excluded, false otherwise
 */
function isNotHiddenFile(filename) {
    return !filename.startsWith('_');
}
 
/**
 * Checks if a file should be processed (is a Markdown file and not hidden)
 * @param {string} filename - The filename to check
 * @returns {boolean} - True if the file should be processed, false otherwise
 */
function shouldProcessFile(filename) {
    return isMarkdownFile(filename) && isNotHiddenFile(filename);
}
 
module.exports = {
    isMarkdownFile,
    isNotHiddenFile,
    shouldProcessFile
};