How to use the nanomatch.match function in nanomatch

To help you get started, we’ve selected a few nanomatch examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sjbarag / brs / src / stdlib / File.ts View on Github external
impl: (interpreter: Interpreter, pathArg: BrsString, patternIn: BrsString) => {
        let volume = getVolumeByPath(interpreter, pathArg.value);
        if (volume == null) {
            // TODO: replace with RoList when that's implemented
            return new RoArray([]);
        }

        let localPath = path.join(interpreter.options.root, getPath(pathArg.value));
        try {
            let knownFiles = fs.readdirSync(localPath, "utf8");
            let matchedFiles = nanomatch.match(knownFiles, patternIn.value, {
                nocase: true,
                nodupes: true,
                noglobstar: true,
                nonegate: true,
            });

            matchedFiles = (matchedFiles || []).map((match: string) => new BrsString(match));

            // TODO: replace with RoList when that's implemented
            return new RoArray(matchedFiles);
        } catch (err) {
            // TODO: replace with RoList when that's implemented
            return new RoArray([]);
        }
    },
});
github micromatch / picomatch / bench / code / match / nanomatch.js View on Github external
module.exports = function(files, pattern) {
  return nanomatch.match(files, pattern);
};

nanomatch

Fast, minimal glob matcher for node.js. Similar to micromatch, minimatch and multimatch, but complete Bash 4.3 wildcard support only (no support for exglobs, posix brackets or braces)

MIT
Latest version published 6 years ago

Package Health Score

71 / 100
Full package analysis