Tabnine Logo For Javascript
minimatch
Code IndexAdd Tabnine to your IDE (free)

How to use minimatch

Best JavaScript code snippets using minimatch(Showing top 15 results out of 315)

origin: mysticatea/eslint-plugin-node

/**
 * Creates the function which checks whether a file path is matched with the given pattern or not.
 *
 * @param {string[]} includePatterns - The glob patterns to include files.
 * @param {string[]} excludePatterns - The glob patterns to exclude files.
 * @returns {function} Created predicate function.
 */
function createMatch(includePatterns, excludePatterns) {
  const include = includePatterns.map(pattern => new Minimatch(pattern))
  const exclude = excludePatterns.map(pattern => new Minimatch(pattern))

  return filePath =>
    include.some(m => m.match(filePath)) &&
    !exclude.some(m => m.match(filePath))
}
origin: mysticatea/eslint-plugin-node

/** @typedef {import("../util/import-target")} ImportTarget */
/**
 * @typedef {Object} DefinitionData
 * @property {string | string[]} name The name to disallow.
 * @property {string} [message] The custom message to show.
 */

/**
 * Check if matched or not.
 * @param {InstanceType<Minimatch>} matcher The matcher.
 * @param {boolean} absolute The flag that the matcher is for absolute paths.
 * @param {ImportTarget} importee The importee information.
 */
function match(matcher, absolute, { filePath, name }) {
  if (absolute) {
    return filePath != null && matcher.match(filePath)
  }
  return matcher.match(name)
}
origin: meboHQ/mebo

it('Should fail if an item inside of the vector does not exist', (done) => {

  (async () => {

   const input = Input.create('input: filePath[]', {exists: true});
   input.setValue([largeFilePath, largeFilePath, 'Fake!']);
   await input.validate();

  })().then((result) => {
   done(new Error('Not Expected'));

  }).catch((err) => {
   done(minimatch(err.code, 'dedf89bc-c57a-4ce7-ab84-f84f49144230') ? null : err);
  });
 });
origin: alibaba/plover

function makeRules(patterns, dirRules, fileRules) {
 const rDir = /\/$/;
 const toRe = pattern => minimatch.makeRe(pattern);
 patterns && patterns.forEach(pattern => {
  if (rDir.test(pattern)) {
   pattern = pattern.replace(rDir, '');
   dirRules.push(toRe(pattern));
  } else {
   fileRules.push(toRe(pattern));
  }
 });
}
origin: redhat-developer-tooling/developer-platform-install

gulp.task('unzip-7zip', function() {
  return gulp.src(zaZip)
   .pipe(unzip({ filter : function(entry) { return minimatch(entry.path, '**/7za.exe'); } }))
   .pipe(gulp.dest(config.buildFolderRoot));
 });
origin: perry-mitchell/webdav-client

function processGlobFilter(files, glob) {
  return files.filter(file => minimatch(file.filename, glob, { matchBase: true }));
}
origin: meboHQ/mebo

it('Should fail when trying to query for a registered reader', () => {
  try{
   Mebo.Handler.registeredReader('EmptyHandler');
  }
  catch(err){
   if (!minimatch(err.message, 'Reader is not registered for handler *!')){
    throw err;
   }
  }
 });
origin: alibaba/plover

rules.map(rule => {
  if (typeof rule === 'string') {
   rule = minimatch.makeRe(rule);
  }
  return rule;
 })
origin: meboHQ/mebo

it("Should fail in setupFrom to set a scalar input based on in a vector input without supplying 'at'", (done) => {

  const inputA = Input.create('input: filePath');
  const inputB = Input.create('input: filePath[]');

  try{
   inputA.setupFrom(inputB);
   done(new Error('Unexpected result'));
  }
  catch(err){
   done(minimatch(err.message, "Target input is not a vector, can't setup from a vector target input without supplying 'at'") ? null : err);
  }

 });
origin: meboHQ/mebo

it('Should not be able to set a value in a read-only input', () => {
  let error = null;

  try{
   const input = new Input('test');
   input.setReadOnly(true);
   input.setValue(10);
  }
  catch(err){
   error = err;
  }

  assert(minimatch(error.message, 'Input * is read only, cannot be modified!'));
 });
origin: meboHQ/mebo

it('Should fail when querying a non-existing property', () => {

  let error = null;
  const input = new Input('inputName');

  try{
   input.property('non-existing');
  }
  catch(err){
   error = err;
  }

  assert(error);
  assert(minimatch(error.message, 'Property * is not registered!'));
 });
origin: meboHQ/mebo

it('Should fail when assigning a non-existing property', () => {

  let error = null;
  const input = new Input('inputName');

  try{
   input.assignProperty('non-existing', 10);
  }
  catch(err){
   error = err;
  }

  assert(error);
  assert(minimatch(error.message, 'Property * is not registered!'));
 });
origin: alibaba/plover

function makeRules(patterns, dirRules, fileRules) {
 const rDir = /\/$/;
 const toRe = pattern => minimatch.makeRe(pattern);
 patterns && patterns.forEach(pattern => {
  if (rDir.test(pattern)) {
   pattern = pattern.replace(rDir, '');
   dirRules.push(toRe(pattern));
  } else {
   fileRules.push(toRe(pattern));
  }
 });
}
origin: alibaba/plover

rules.map(rule => {
  if (typeof rule === 'string') {
   rule = minimatch.makeRe(rule);
  }
  return rule;
 })
origin: meboHQ/mebo

it("Should fail in setupFrom when 'at' is specified from a vector source input to a target vector input", (done) => {

  const inputA = Input.create('input: filePath[]');
  const inputB = Input.create('input: filePath[]');

  try{
   inputA.setupFrom(inputB, 0);
   done(new Error('Unexpected result'));
  }
  catch(err){
   done(minimatch(err.message, "Can't use at, from a source vector input to a target vector input") ? null : err);
  }
 });
minimatch(npm)

JSDoc

a glob matcher in javascript

Most used minimatch functions

  • minimatch
  • makeRe
    Make a regular expression object from the pattern.
  • IMinimatch.match
    Return true if the filename matches the pattern, or false otherwise.
  • Minimatch
  • filter
    Returns a function that tests its supplied argument, suitable for use with Array.filter
  • mm

Popular in JavaScript

  • commander
    the complete solution for node.js command-line programs
  • minimatch
    a glob matcher in javascript
  • postcss
  • aws-sdk
    AWS SDK for JavaScript
  • node-fetch
    A light-weight module that brings window.fetch to node.js
  • lodash
    Lodash modular utilities.
  • redis
    Redis client library
  • cheerio
    Tiny, fast, and elegant implementation of core jQuery designed specifically for the server
  • mime-types
    The ultimate javascript content-type utility.
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJavascript Code Index
Get Tabnine for your IDE now