regex-slash
v1.0.1
Published
Convert regex pattern strings for Windows backslash paths to Unix paths
Downloads
2
Readme
regex-slash
Convert regex pattern strings for Windows backslash paths to Unix paths:
path\\\\to\\\\file.js
➔path/to/file.js
Inspired by slash.
Install
$ npm install --save regex-slash
or with yarn
$ yarn add regex-slash
Usage
const rslash = require('regex-slash');
const windowsPattern = 'path\\\\to\\\\file.js';
const unixPattern = 'path/to/file.js';
rslash(windowsPattern); // => 'path/to/file.js'
rslash(unixPattern); // => 'path/to/file.js'
API
rslash(path)
Type: string
Accepts a Windows backslash path regex pattern string and returns a Unix path regex pattern string
License
MIT © Scott Ranger