Cloud Defense Logo

Products

Solutions

Company

Book A Live Demo

Top 10 Examples of "matcher in functional component" in JavaScript

Dive into secure and efficient coding practices with our curated list of the top 10 examples showcasing 'matcher' in functional components in JavaScript. Our advanced machine learning engine meticulously scans each line of code, cross-referencing millions of open source libraries to ensure your implementation is not just functional, but also robust and secure. Elevate your React applications to new heights by mastering the art of handling side effects, API calls, and asynchronous operations with confidence and precision.

return domain_white_list.some(rule => {

    // Check whether we've got '*' as a wild character symbol
    if (rule.includes('*')) {
      return matcher.isMatch(domain, rule);
    }
    // If domain is an absolute path such as `http://...`
    // We can directly check whether it directly equals to `domain`
    // And we don't need to cope with `endWith`.
    return domain === rule || hostname.endsWith(rule);
  });
};
webhooks.forEach(webhook => {
		if (webhook.isDisabled === true) {
			logger.log.debug(`Skipping a [${webhook.relativePath}] webhook because it's disabled`);
			return;
		}

		// checking is webhook matches a target resource
		const opts = {
			caseSensitive: os.platform() !== 'win32'
		};
		if (matcher.isMatch(target.relativePath, webhook.relativePath, opts)) {
			postWebhook(webhook, target);
		} else {
			logger.log.debug(`The [${webhook.relativePath}] webhook doesn't match to [${target.relativePath}] resource`);
		}
	});
	return Promise.resolve();
function isWhitelisted(url, parentUrl, type)
{
  // Ignore fragment identifier
  var index = url.indexOf("#");
  if (index >= 0)
    url = url.substring(0, index);

  var result = defaultMatcher.matchesAny(url, type || "DOCUMENT", extractHostFromURL(parentUrl || url), false);
  return (result instanceof WhitelistFilter ? result : null);
}
if (sender.tab)
      {
        tabId = sender.tab.id;
        frameId = getFrameId(tabId, request.documentUrl);
      }

      if (isFrameWhitelisted(tabId, frameId, "DOCUMENT"))
      {
        sendResponse(false);
        break;
      }

      var requestHost = extractHostFromURL(request.url);
      var documentHost = extractHostFromURL(request.documentUrl);
      var thirdParty = isThirdParty(requestHost, documentHost);
      var filter = defaultMatcher.matchesAny(request.url, request.type, documentHost, thirdParty);
      if (filter instanceof BlockingFilter)
      {
        var collapse = filter.collapse;
        if (collapse == null)
          collapse = (localStorage.hidePlaceholders != "false");
        sendResponse(collapse);
      }
      else
        sendResponse(false);
      break;
    case "get-domain-enabled-state":
      // Returns whether this domain is in the exclusion list.
      // The page action popup asks us this.
      if(sender.tab)
      {
        sendResponse({enabled: !isWhitelisted(sender.tab.url)});
}
      }

      sendResponse(selectors);
      break;
    case "should-collapse":
      if (isFrameWhitelisted(sender.page, sender.frame, "DOCUMENT"))
      {
        sendResponse(false);
        break;
      }

      var requestHost = extractHostFromURL(msg.url);
      var documentHost = extractHostFromFrame(sender.frame);
      var thirdParty = isThirdParty(requestHost, documentHost);
      var filter = defaultMatcher.matchesAny(msg.url, msg.mediatype, documentHost, thirdParty);
      if (filter instanceof BlockingFilter)
      {
        var collapse = filter.collapse;
        if (collapse == null)
          collapse = Prefs.hidePlaceholders;
        sendResponse(collapse);
      }
      else
        sendResponse(false);
      break;
    case "get-domain-enabled-state":
      // Returns whether this domain is in the exclusion list.
      // The browser action popup asks us this.
      if(sender.page)
      {
        sendResponse({enabled: !isWhitelisted(sender.page.url)});
with(require("filterClasses"))
{
  this.Filter = Filter;
  this.RegExpFilter = RegExpFilter;
  this.BlockingFilter = BlockingFilter;
  this.WhitelistFilter = WhitelistFilter;
}
with(require("subscriptionClasses"))
{
  this.Subscription = Subscription;
  this.DownloadableSubscription = DownloadableSubscription;
}
var FilterStorage = require("filterStorage").FilterStorage;
var ElemHide = require("elemHide").ElemHide;
var defaultMatcher = require("matcher").defaultMatcher;
var Prefs = require("prefs").Prefs;
var Synchronizer = require("synchronizer").Synchronizer;
var Utils = require("utils").Utils;
var Notification = require("notification").Notification;

// Some types cannot be distinguished
RegExpFilter.typeMap.OBJECT_SUBREQUEST = RegExpFilter.typeMap.OBJECT;
RegExpFilter.typeMap.MEDIA = RegExpFilter.typeMap.FONT = RegExpFilter.typeMap.OTHER;

var isFirstRun = false;
var seenDataCorruption = false;
require("filterNotifier").FilterNotifier.addListener(function(action)
{
  if (action == "load")
  {
    importOldData();
with(require("filterClasses")) {
    this.Filter = Filter;
    this.RegExpFilter = RegExpFilter;
    this.BlockingFilter = BlockingFilter;
    this.WhitelistFilter = WhitelistFilter;
  }

  with(require("subscriptionClasses")) {
    this.Subscription = Subscription;
    //this.DownloadableSubscription = DownloadableSubscription;
  }

  this.FilterStorage = require("filterStorage").FilterStorage;

  this.defaultMatcher = require("matcher").defaultMatcher;

  // https://github.com/adblockplus/adblockpluschrome/blob/master/webrequest.js

  var self = this;

  var frames = {};

  function recordFrame(tabId, frameId, parentFrameId, frameUrl) {
    if (!(tabId in frames))
      frames[tabId] = {};
    frames[tabId][frameId] = {url: frameUrl, parent: parentFrameId};
  }

  function getFrameData(tabId, frameId) {
    if (tabId in frames && frameId in frames[tabId])
      return frames[tabId][frameId];
}
with(require("subscriptionClasses"))
{
  this.Subscription = Subscription;
  this.DownloadableSubscription = DownloadableSubscription;
  this.SpecialSubscription = SpecialSubscription;
}
with(require("whitelisting"))
{
  this.isWhitelisted = isWhitelisted;
  this.isFrameWhitelisted = isFrameWhitelisted;
  this.processKeyException = processKeyException;
}
var FilterStorage = require("filterStorage").FilterStorage;
var ElemHide = require("elemHide").ElemHide;
var defaultMatcher = require("matcher").defaultMatcher;
var Prefs = require("prefs").Prefs;
var Synchronizer = require("synchronizer").Synchronizer;
var Utils = require("utils").Utils;
var Notification = require("notification").Notification;
var initAntiAdblockNotification = require("antiadblockInit").initAntiAdblockNotification;

// Some types cannot be distinguished
RegExpFilter.typeMap.OBJECT_SUBREQUEST = RegExpFilter.typeMap.OBJECT;
RegExpFilter.typeMap.MEDIA = RegExpFilter.typeMap.FONT = RegExpFilter.typeMap.OTHER;

// Chrome on Linux does not fully support chrome.notifications until version 35
// https://code.google.com/p/chromium/issues/detail?id=291485
var canUseChromeNotifications = require("info").platform == "chromium"
  && "notifications" in chrome
  && (navigator.platform.indexOf("Linux") == -1 || parseInt(require("info").applicationVersion) > 34);
function walk(value, path) {
    let curr = path[path.length - 1]

    if(value === null) {
      return null
    }

    ///// Restricted $refs

    if(curr === "$ref") {
      let refBlacklist = getRefPatternBlacklist(path) || []
      let matches = match([value], refBlacklist)

      let humanFriendlyRefBlacklist = refBlacklist
        .map(val => `"${val}"`)
        .join(", ")

      if(refBlacklist && refBlacklist.length && matches.length) {
        // Assertation 1
        errors.push({
          path,
          message: `${path[path.length - 2]} $refs cannot match any of the following: ${humanFriendlyRefBlacklist}`
        })
      }
    }

    if(typeof value !== "object") {
      return null
{
            try
            {
              host = Services.io.newURI(url, null, null).host;
            }
            catch (e)
            {
              // Ignore, an exception is expected for about: and similar schemes
              host = "";
            }
          }
          let exception = defaultMatcher.matchesAny(url, RegExpFilter.typeMap.DOCUMENT, host, false, null);
          if (exception instanceof WhitelistFilter)
            continue;

          let matcher = new Matcher();
          for (let urlFilter of notification.urlFilters)
            matcher.add(Filter.fromText(urlFilter));
          if (!matcher.matchesAny(url, RegExpFilter.typeMap.DOCUMENT, host, false, null))
            continue;
        }
        else
          continue;
      }

      if (notification.targets instanceof Array)
      {
        let match = false;
        for (let target of notification.targets)
        {
          if (checkTarget(target, "extension", addonName, addonVersion) &&
              checkTarget(target, "application", application, applicationVersion) &&

Is your System Free of Underlying Vulnerabilities?
Find Out Now