How to use nanomatch - 10 common examples

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 kura52 / sushi-browser / src / init.js View on Github external
if(props.srcURL) info.srcUrl = props.srcURL
        if(props.pageURL) info.pageUrl = props.pageURL
        info.menuItemId = menuItemId

        const item = {
          label: properties.title,
          click(){
            ipcMain.emit('chrome-context-menus-clicked',null, extensionId, webContents.id, info)}
        }
        if(menuItemId) item.menuItemId = menuItemId
        if(properties.checked !== void 0) item.checked = properties.checked
        if(properties.enabled !== void 0) item.enabled = properties.enabled
        if(properties.documentUrlPatterns !== void 0){
          const url = props.pageURL || props.frameURL
          // console.log('documentUrlPatterns',url,properties.documentUrlPatterns)
          if(url && !nm.some(url, properties.documentUrlPatterns.map(x=>x=='' ? "**" : x.replace(/\*/,'**')))){
            item.hide = true
          }
        }
        if(properties.targetUrlPatterns !== void 0){
          const url = props.linkURL
          // console.log('targetUrlPatterns',url,properties.targetUrlPatterns.map(x=>x=='' ? "**" : x.replace(/\*/,'**')))
          if(url && !nm.some(url, properties.targetUrlPatterns.map(x=>x=='' ? "**" : x.replace(/\*/,'**')))){
            item.hide = true
          }
        }
        if(!item.hide){
          const addItem = properties.type == "separator" ? {type: 'separator'} : item
          let parent
          if(properties.parentId && (parent = menuList.find(m=>m.menuItemId == properties.parentId))){
            if(properties.icons && extensionInfos[extensionId] && extensionInfos[extensionId].base_path) addItem.icon = path.join(extensionInfos[extensionId].base_path,Object.values(properties.icons)[0].replace(/\.svg$/,'.png'))
            if(parent.submenu === void 0){
github kura52 / sushi-browser / src / init.js View on Github external
ipcMain.emit('chrome-context-menus-clicked',null, extensionId, webContents.id, info)}
        }
        if(menuItemId) item.menuItemId = menuItemId
        if(properties.checked !== void 0) item.checked = properties.checked
        if(properties.enabled !== void 0) item.enabled = properties.enabled
        if(properties.documentUrlPatterns !== void 0){
          const url = props.pageURL || props.frameURL
          // console.log('documentUrlPatterns',url,properties.documentUrlPatterns)
          if(url && !nm.some(url, properties.documentUrlPatterns.map(x=>x=='' ? "**" : x.replace(/\*/,'**')))){
            item.hide = true
          }
        }
        if(properties.targetUrlPatterns !== void 0){
          const url = props.linkURL
          // console.log('targetUrlPatterns',url,properties.targetUrlPatterns.map(x=>x=='' ? "**" : x.replace(/\*/,'**')))
          if(url && !nm.some(url, properties.targetUrlPatterns.map(x=>x=='' ? "**" : x.replace(/\*/,'**')))){
            item.hide = true
          }
        }
        if(!item.hide){
          const addItem = properties.type == "separator" ? {type: 'separator'} : item
          let parent
          if(properties.parentId && (parent = menuList.find(m=>m.menuItemId == properties.parentId))){
            if(properties.icons && extensionInfos[extensionId] && extensionInfos[extensionId].base_path) addItem.icon = path.join(extensionInfos[extensionId].base_path,Object.values(properties.icons)[0].replace(/\.svg$/,'.png'))
            if(parent.submenu === void 0){
              parent.submenu = [addItem]
            }
            else{
              parent.submenu.push(addItem)
            }
          }
          else{
github steelbrain / pundle / packages / pundle-transformer-coffee / src / index.js View on Github external
      if (exclude.some(item => nanomatch.isMatch(file.filePath, item))) {
        // Excluded
github steelbrain / pundle / packages / pundle-transformer-babel / src / index.js View on Github external
      if (exclude.some(item => nanomatch.isMatch(file.filePath, item))) {
        // Excluded
github steelbrain / pundle / packages / pundle-transformer-typescript / src / index.js View on Github external
      if (exclude.some(item => nanomatch.isMatch(file.filePath, item))) {
        // Excluded
github steelbrain / pundle / packages / pundle-transformer-typescript / src / index.js View on Github external
      if (exclude.some(item => nanomatch.isMatch(file.filePath, item))) {
        // Excluded
github ifgyong / demo / React-native / Helloword / node_modules / metro-bundler / node_modules / sane / node_modules / micromatch / lib / compilers.js View on Github external
module.exports = function (snapdragon) {
    var compilers = snapdragon.compiler.compilers;
    var opts = snapdragon.options;

    // register nanomatch compilers
    snapdragon.use(nanomatch.compilers);

    // get references to some specific nanomatch compilers before they
    // are overridden by the extglob and/or custom compilers
    var escape = compilers.escape;
    var qmark = compilers.qmark;
    var slash = compilers.slash;
    var star = compilers.star;
    var text = compilers.text;
    var plus = compilers.plus;
    var dot = compilers.dot;

    // register extglob compilers or escape exglobs if disabled
    if (opts.extglob === false || opts.noext === true) {
        snapdragon.compiler.use(escapeExtglobs);
    } else {
        snapdragon.use(extglob.compilers);
github micromatch / micromatch / lib / compilers.js View on Github external
module.exports = function(snapdragon) {
  var compilers = snapdragon.compiler.compilers;
  var opts = snapdragon.options;

  // register nanomatch compilers
  snapdragon.use(nanomatch.compilers);

  // get references to some specific nanomatch compilers before they
  // are overridden by the extglob and/or custom compilers
  var escape = compilers.escape;
  var qmark = compilers.qmark;
  var slash = compilers.slash;
  var star = compilers.star;
  var text = compilers.text;
  var plus = compilers.plus;
  var dot = compilers.dot;

  // register extglob compilers or escape exglobs if disabled
  if (opts.extglob === false || opts.noext === true) {
    snapdragon.compiler.use(escapeExtglobs);
  } else {
    snapdragon.use(extglob.compilers);
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 ifgyong / demo / React-native / Helloword / node_modules / metro-bundler / node_modules / sane / node_modules / micromatch / lib / parsers.js View on Github external
module.exports = function (snapdragon) {
    var parsers = snapdragon.parser.parsers;

    // register nanomatch parsers
    snapdragon.use(nanomatch.parsers);

    // get references to some specific nanomatch parsers before they
    // are overridden by the extglob and/or parsers
    var escape = parsers.escape;
    var slash = parsers.slash;
    var qmark = parsers.qmark;
    var plus = parsers.plus;
    var star = parsers.star;
    var dot = parsers.dot;

    // register extglob parsers
    snapdragon.use(extglob.parsers);

    // custom micromatch parsers
    snapdragon.parser
        .use(function () {

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