JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 87
  • Score
    100M100P100Q68359F
  • License MIT

determine if any file is gitignored (complete implementation of gitignore rules)

Package Exports

  • gitignore-fs

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (gitignore-fs) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

gitignore-fs

CircleCI Coverage Status semantic-release Commitizen friendly npm version

Determine if any file is gitignored. This is intended to be a complete implementation of the gitignore spec, including $GIT_DIR, $GIT_DIR/info/excludes, and the core.excludesFile configuration variable.

Requires Node >= 8.

Getting started

npm install --save gitignore-fs
const Gitignore = require('gitignore-fs')

const gitignore = new Gitignore()

console.log(gitignore.ignores('node_modules')) // true or false depending on your config

API

class Gitignore

Each instance of this class keeps a separate cache of gitignore rules.

.ignores(path, [stats])

Determines if the given path is gitignored asynchronously.

path (string, required)

The path to test

stats (fs.Stats, optional)

The stats for path. Pass them if you already have them to speed things up.

Returns (Promise<boolean>)

A promise that will resolve to true if path is gitignored, false otherwise

.ignoresSync(path, [stats])

Determines if the given path is gitignored synchronously.

path (string, required)

The path to test

stats (fs.Stats, optional)

The stats for path. Pass them if you already have them to speed things up.

Returns (boolean)

true if path is gitignored, false otherwise

.clearCache()

Clears the entire gitignore rule cache.