slash-to-regexp
v0.1.0
Published
Convert path with slash into regexp
Downloads
312
Maintainers
Readme
slash-to-regexp
Convert path with slash into regexp.
Installation
npm install slash-to-regexp
Usage
const slashToRegexp = require('slash-to-regexp');
slashToRegexp('node_modules/core-js');
// output /node_modules[\\/]core-js/
slashToRegexp('node_modules\\\\core-js', 'g');
// output /node_modules[\\/]core-js/g
slashToRegexp('/node_modules/decimal.js/');
// output /[\\/]node_modules[\\/]decimal\.js[\\/]/