ext-to-regexp
v0.1.0
Published
Convert extname into regexp
Downloads
338
Maintainers
Readme
ext-to-regexp
Convert extname into regexp.
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)$/