reg2str

1.0.2 • Public • Published

reg2str

RegExp to string, the default regexp.toString() will output a different string in nodejs and iojs/chrome.

reg2str - output all RegExp's string like iojs/chrome in all javascript enviroment.

io.js & chrome

new RegExp('/').toString() ==> "/\//"
a  '\\'                  ==> string literal: '\'
a.length                   ==> 1

nodejs

new RegExp('/').toString() ==> "///"
a  '\\'                  ==> string literal: '\\'
a.length                   ==> 1

reg2str

reg2str(new RegExp('/')) ==> "/\//"

Package Sidebar

Install

npm i reg2str

Weekly Downloads

3

Version

1.0.2

License

ISC

Last publish

Collaborators

  • chao2