local-gitignore
ignore
is a tool which implements in pure JavaScript the .gitignore spec.
upsearch
is a tool for finding files in parent directories.
Together a micro utility library is born.
Usage
.DS_Store
._*
.cache
.project
node_modules
old/
*-old/
var ig = require('local-gitignore')
local-gitignore provides all the methods provided by the ignore library.
Filter the given paths
var paths = [
'.DS_STORE',
'node_modules/bixby/index.js',
'index.js'
]
ig.filter(paths)
Generate a filter function
paths.filter(ig.createFilter());
Use as a quick boolean value returning test function
ig.ignores('.DS_Store')
ig.ignores('project/index.js')
Why such a small library?
I was looking for exactly this functionality when I came across the excellent ignore library. So, I'm publishing what past me was looking for in the first place.