mirror of
https://github.com/morhetz/gruvbox.git
synced 2025-11-19 00:53:48 -05:00
22 lines
532 B
JavaScript
22 lines
532 B
JavaScript
'use strict'
|
|
|
|
const findUp = require('find-up')
|
|
const fs = require('fs')
|
|
const ignore = require('./lib/dotignore')
|
|
const gitignoreFilename = '.gitignore'
|
|
|
|
class DotGitignore {
|
|
constructor (opts) {
|
|
const gitignorePath = findUp.sync(gitignoreFilename, opts)
|
|
const content = gitignorePath ? fs.readFileSync(gitignorePath, 'utf8') : ''
|
|
this.matcher = ignore.createMatcher(content)
|
|
}
|
|
ignore (name) {
|
|
return this.matcher.shouldIgnore(name)
|
|
}
|
|
}
|
|
|
|
module.exports = function (opts) {
|
|
return new DotGitignore(opts)
|
|
}
|