normalize-glob

Normalize a glob pattern by expanding braces, making it absolute and resolving parent directories '..'.

Usage no npm install needed!

<script type="module">
  import normalizeGlob from 'https://cdn.skypack.dev/normalize-glob';
</script>

README

normalize-glob

Normalize a glob pattern by expanding braces, making it absolute and resolving parent directories '..'.

Usage

import {normalizeGlob} from 'normalize-glob';

// using iteration protocol
for (const pattern of normalizeGlob('../foo/*', process.cwd())) {
    // use 'pattern'
}

// converting the result to an array
Array.from(normalizeGlob('../foo/*', process.cwd()));

Note that glob patterns are supposed to use forward slashes as directory separator. The cwd parameter may use backslashes as directory separator on windows.