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

local-gitignore

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

local-gitignore

Filter filepaths with local .gitignore

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

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

# OS or Editor folders
.DS_Store
._*
.cache
.project

# Directories
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',    // filtered out
  'node_modules/bixby/index.js',    // filtered out
  'index.js'   // included
]

ig.filter(paths)  // ['index.js']

Generate a filter function

paths.filter(ig.createFilter()); // ['index.js']

Use as a quick boolean value returning test function

ig.ignores('.DS_Store') // true
ig.ignores('project/index.js') // false

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.

FAQs

Package last updated on 19 Dec 2016

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