/expressive-glob

💡 Write glob patterns in super expressive and an easy way!

Primary LanguageTypeScriptMIT LicenseMIT

💡expressive-glob

All Contributors License Last Commit Stars Forks

Philosophy

This package uses the fluent builder pattern. Its main goal is to make the somewhat cryptic vocabulary of glob patterns easy to understand!

Usage

const glob = new ExpressiveGlob();
const globString1 = glob.capture.anyChar
  .string(".jpg")
  .anyChar.upto(2)
  .from("ABCDE")
  .end.toGlob();
glob.flush();
const globString2 = glob.capture.anyChar
  .string(".png")
  .anyChar.from(2, 5)
  .invert.end.toGlob();
expect(globString1).toBe("*.jpg??[ABCDE]");
expect(globString2).toBe("*.png*[!2-5]");

Installation

yarn add expressive-glob or npm i expressive-glob

Inspiration

This project is inspired by super-expressive!

🎉 Contributing

Contributions are welcome! Whether it is a small documentation change or a breaking feature, we welcome it!

Please note: All contributions are taken under the MIT license

👥 Contributors