How to use the micromatch.any function in micromatch

To help you get started, we’ve selected a few micromatch 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 electerious / Rosid / src / copy.js View on Github external
const filter = (filePath) => {

		// The filePath is absolute, but should be relative as micromatch will
		// match against the relative path of the routes. Matching against
		// an absolute path requires the use of path.join which causes issues on Windows:
		// https://github.com/micromatch/micromatch/issues/95
		filePath = path.relative(srcPath, filePath)

		const fileName = path.parse(filePath).base

		const isIgnored = mm.any(filePath, ignoredFiles)
		const isJunk = junk.is(fileName)

		// Copy file when it's not ignored or not junk
		const copy = isIgnored === false && isJunk === false

		if (opts.verbose === true) {

			if (copy === false) log(`{cyan:Skipping file: {grey:${ filePath }`)
			if (copy === true) log(`{cyan:Copying file: {grey:${ filePath }`)

		}

		// Return true to include, false to exclude
		return copy

	}
github emedvedev / slackin-extended / lib / index.js View on Github external
app.post('/invite', json(), (req, res) => {
    const { channel, email } = req.body;
    const captchaResponse = req.body['g-recaptcha-response'];
    let errorMessage = null;

    if (channelsFiltered && !channelsFiltered.includes(channel)) {
      errorMessage = 'Not a permitted channel';
    } else if (channelsFiltered && !slack.getChannelId(channel)) {
      errorMessage = `Channel "${channel}" not found`;
    } else if (!email) {
      errorMessage = 'No email provided';
    } else if (recaptcha.secret && (!captchaResponse || !captchaResponse.length)) {
      errorMessage = 'Invalid captcha';
    } else if (!remail().test(email)) {
      errorMessage = 'Invalid email';
    } else if (emails && !match.any(email, acceptedEmails)) {
      errorMessage = 'Your email is not on the accepted list.';
    } else if (coc && Number(req.body.coc) !== 1) {
      errorMessage = 'Agreement to CoC is mandatory';
    }
    if (errorMessage) {
      return res.status(400).json({ msg: errorMessage });
    }

    const captchaData = {
      secret: recaptcha.secret,
      response: captchaResponse,
      remoteip: req.connection.remoteAddress,
    };

    const captchaCallback = (err) => {
      if (err) return res.status(400).send({ msg: err });
github the-couch / slater-cli / index.js View on Github external
function match (p) {
    return mm.any(p, ignoredFiles)
  }
github geut / postcss-copy / src / index.js View on Github external
function ignore(fileMeta, opts) {
    if (typeof opts.ignore === 'function') {
        return opts.ignore(fileMeta, opts);
    }

    if (typeof opts.ignore === 'string' || Array.isArray(opts.ignore)) {
        return micromatch.any(fileMeta.sourceValue, opts.ignore);
    }

    return false;
}
github g-wilson / wrender / lib / request.js View on Github external
    return source => !micromatch.any(url.parse(source).hostname, whitelist);
  }
github inikulin / publish-please / src / utils / npm-audit-package.js View on Github external
filepath &&
        allSensitiveDataPatterns &&
        allSensitiveDataPatterns.ignoredData &&
        globMatching.any(filepath, allSensitiveDataPatterns.ignoredData, {
            matchBase: true,
            nocase: true,
        })
    ) {
        return false;
    }

    if (
        filepath &&
        allSensitiveDataPatterns &&
        allSensitiveDataPatterns.sensitiveData &&
        globMatching.any(filepath, allSensitiveDataPatterns.sensitiveData, {
            matchBase: true,
            nocase: true,
        })
    ) {
        return true;
    }
    return false;
}
github yarnpkg / yarn / src / package-hoister.js View on Github external
_isNohoist = (info: HoistManifest): boolean => {
    if (this._isTopPackage(info)) {
      return false;
    }
    if (info.nohoistList && info.nohoistList.length > 0 && mm.any(this._originalPath(info), info.nohoistList)) {
      return true;
    }
    if (this._config.plugnplayEnabled) {
      return true;
    }
    return false;
  };
  _isRootPackage = (pkg: Manifest): boolean => {
github HubSpot / Singularity / SingularityUI / app / selectors / tasks / filterSelector.es6 View on Github external
let res1 = _.filter(tasks, (task) => {
        return micromatch.any(host.extract(task), filter.filterText + '*');
      });
      let res2 = _.filter(tasks, (task) => {
github inikulin / publish-please / src / utils / npm-audit-package.js View on Github external
function isSensitiveData(filepath, allSensitiveDataPatterns) {
    if (
        filepath &&
        allSensitiveDataPatterns &&
        allSensitiveDataPatterns.ignoredData &&
        globMatching.any(filepath, allSensitiveDataPatterns.ignoredData, {
            matchBase: true,
            nocase: true,
        })
    ) {
        return false;
    }

    if (
        filepath &&
        allSensitiveDataPatterns &&
        allSensitiveDataPatterns.sensitiveData &&
        globMatching.any(filepath, allSensitiveDataPatterns.sensitiveData, {
            matchBase: true,
            nocase: true,
        })
    ) {

micromatch

Glob matching for javascript/node.js. A replacement and faster alternative to minimatch and multimatch.

MIT
Latest version published 2 years ago

Package Health Score

87 / 100
Full package analysis