All files / src/utils getPaths.js

100% Statements 12/12
100% Branches 0/0
100% Functions 4/4
100% Lines 9/9

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 203x   12x 3x   3x 5x 5x 6x     5x             3x  
const getParsedGitignores = require('./getParsedGitignores');
 
const startsWithBang = str => str.startsWith('!');
const removeStartBang = str => str.replace(/^!/, '');
 
const getPaths = config => {
    const parsedPaths = getParsedGitignores(config);
    const syndInclude = parsedPaths.filter(startsWithBang).map(removeStartBang);
    const syndExclude = parsedPaths.filter(s => !startsWithBang(s));
 
    // mixin rules from gitignores
    return {
        ...config,
        include: config.include.concat(syndInclude),
        exclude: config.exclude.concat(syndExclude),
    };
};
 
module.exports = getPaths;