1
0
mirror of https://github.com/thangisme/notes.git synced 2024-11-01 03:27:29 -04:00
notes/node_modules/stylelint/lib/utils/getIsFileIgnored.js
Patrick Marsceill b7b0d0d7bf
Initial commit
2017-03-09 13:16:08 -05:00

18 lines
565 B
JavaScript

"use strict"
const ignore = require("ignore")
const micromatch = require("micromatch")
const path = require("path")
module.exports = function getIsFileIgnored(
ignorePatterns/*: Array<string>*/,
ignoreFiles/*: string | Array<string>*/
)/*: Function */ {
const ignorePatternsFilter = ignore().add(ignorePatterns).createFilter()
return file => {
const filepathRelativeToCwd = path.relative(process.cwd(), file)
return ignorePatternsFilter && !ignorePatternsFilter(filepathRelativeToCwd) || ignoreFiles && micromatch(file, ignoreFiles).length
}
}