JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 67
  • Score
    100M100P100Q60545F
  • License MIT

Convert extname into regexp

Package Exports

  • ext-to-regexp

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ext-to-regexp) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

ext-to-regexp

Convert extname into regexp.

npm github node

Installation

npm install ext-to-regexp

Usage

const extToRegexp = require('ext-to-regexp');

extToRegexp({
  extname: ['js', 'jsx']
});
// /\.(js|jsx)$/

extToRegexp({
  suffix: ['min'],
  extname: ['jpg', 'png']
});
// /\.min\.(jpg|png)$/

const foo = extToRegexp({ extname: ['css'] });
const bar = foo.add('sass', 'scss').add('less');
const baz = bar.remove('sass').remove('scss');

console.log(foo); // /\.css$/
console.log(bar); // /\.(css|less|sass|scss)$/
console.log(baz); // /\.(css|less)$/