Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ignore-file

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ignore-file

Compile an ignore file (similar to .gitignore) to a Javascript function

  • 1.1.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
18K
increased by55.19%
Maintainers
1
Weekly downloads
 
Created
Source

ignore-file

Compile an ignore file (similar to .gitignore) to a Javascript function that returns true or false given a filename

npm install ignore-file

build status

Usage

Assuming you have a .gitignore file in your current working directory that contains node_modules do

var ignore = require('ignore-file')

ignore('.gitignore', function(err, filter) {
  if (err) throw err
  console.log(filter('index.js'))     // returns false
  console.log(filter('node_modules')) // returns true
})

You can also use ignore.sync(filename) to synchroniously compile an ignore file If the file doesn't exist null is returned. This allows you easily implement fallbacks

var filter = ignore.sync('.npmignore') || ignore.sync('.gitignore') || ignore.compile('node_modules')

The above will use .npmignore if it exists, else .gitignore and finally just ignore all node_modules folders

License

MIT

Keywords

FAQs

Package last updated on 26 Aug 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc