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

gglobby

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

gglobby

a .gitignore-compatible file globber

  • 0.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

globby

globby is a .gitignore-style file globber for JavaScript. It's not a general replacement for glob, but it is potentially a better choice if you're globbing a large js project and applying a long list of exclusion patterns.

not to be confused with the other globby. sadlol story here (i thought i had learned my lesson after the i18nline/i18nliner fiasco, but apparently not).

Installation

npm install gglobby

Usage

var Globby = require('gglobby');

// all files matched by the rules
Globby.select(rules).files;

// all other files
Globby.reject(rules).files;

// ooh chaining!
Globby.select(rules).reject(other_rules).files;

An example:

 > var rules = fs.readFileSync('.gitignore').split(/\n/)
=> ["/node_modules", "/tmp", "/build"]

 > Globby.select(rules).result
=> [
  "node_modules/browserify/.npmignore",
  "node_modules/browserify/.travis.yml",
  ...
  "tmp/test/extractors/translate_call_test.js",
  "tmp/test/extractors/translation_hash_test.js"
]

Why on earth would I ever use this?

  • You're curious what is getting .gitignore'd and/or you want to do something with those files.
  • You're writing a library/tool that will have its own list of ignored/tracked files. My use case is for an I18n library that extracts strings from js/hbs files... I need to provide users a nice configurable way to blacklist given files/directories/patterns.

Compatibility Notes

globby is compatible with .gitignore rules; it respects negated patterns, and ignores comments or empty patterns. That said, it supports some things that may or may not work in your version of git. These platform-dependent .gitignore behaviors are platform independent in globby and can always be used:

  • Recursive wildcards à la ant/zsh/node-glob. ** matches directories recursively.
  • Basic glob(7)-style bracket expressions, i.e. character classes, ranges, and complementation. Named character classes, collating symbols, and equivalence class expressions are not yet supported. Note that the syntax for some of these is slightly different than what you would find in regular expressions. Refer to the documentation for more info.

License

Copyright (c) 2015 Jon Jensen, released under the MIT license

FAQs

Package last updated on 31 Mar 2015

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