How to use node-modules-regexp - 1 common examples

To help you get started, we’ve selected a few node-modules-regexp 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 ariporad / pirates / src / index.js View on Github external
function shouldCompile(filename, exts, matcher, ignoreNodeModules) {
  if (typeof filename !== 'string') {
    return false;
  if (exts.indexOf(path.extname(filename)) === -1) {
    return false;

  const resolvedFilename = path.resolve(filename);

  if (ignoreNodeModules && nodeModulesRegex.test(resolvedFilename)) {
    return false;
  if (matcher && typeof matcher === 'function') {
    return !!matcher(resolvedFilename);

  return true;


A regular expression for file paths that contain a `node_modules` folder.

Latest version published 8 years ago

Package Health Score

65 / 100
Full package analysis

Popular node-modules-regexp functions