npm.io
1.0.1 • Published 2 weeks ago

globjoin

Licence
MIT
Version
1.0.1
Deps
0
Size
7 kB
Vulns
0
Weekly
0
Stars
7

globjoin

Join paths and globs.

npm

chart

Install

$ npm install globjoin

API

Like Node's path.join(), which joins all arguments and normalizes the resulting path, globjoin accepts an arbitrary number of paths and/or arrays of globs, joins them together, and handles negative globs.

function globjoin(...globs: Array<string>): string;

function globjoin(...globs: Array<string | string[]>): string[];

Important: Starting with version 1.0.0, negative globs are handled differently. Negative globs are now treated as negations of the corresponding path segments. For example:

globjoin(["src", "!app", "!view"]) => "src/app/view"

While in version 0.1.4, the same input produced:

globjoin(["src", "!app", "!view"]) => "!src/app/view"

This is a breaking behavior change to be aware of when upgrading to version 1.0.0.

Example
import globjoin from "globjoin";

const globs1 = globjoin("src", ["**/*.js", "!**/test*.js"]);

const globs2 = globjoin(
  "test",
  "fixture",
  "app",
  ["views", "!services"],
  ["**/*", "!*.{js,json,coffee,ts}"],
);

Check out test for more examples.

Issues

Issues

Test

$ npm test

Changelog

Changelog

License

MIT

Author

Amobiz

Contributor

StreetStrider

Keywords