🐊Putout operator adds ability to check if provided regexp can be converted to string without losing it's sense
npm install @putout/operator-regexp[NPMIMGURL]: https://img.shields.io/npm/v/@putout/operator-regexp.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/operator-regexp "npm"
🐊Putout operator adds ability to determine that provided RegExp can be
converted to String without losing it's sense.
It is used for example in regexp/convert-replace-to-relace-all:
``diff`
-'hello'.replace(/hello/g, 'world');
+'hello'.replaceAll('hello', 'world');
``
npm i putout @putout/operator-regexp
`js
const {operator} = require('putout');
const {isSimpleRegExp} = operator;
isSimpleRegExp(/hello world/);
// returns
true;
isSimpleRegExp(/^hello/);
// returns
false;
`
`js``
transformRegExp('[aab]', {
report,
fix,
traverse,
});
MIT