$ npm install @putout/operator-regexp
putout
operator adds ability to determine is provided RegExp
can be
converted to String
without loosing it's sence.
It is used for example in regexp/convert-replace-to-relace-all:
-'hello'.replace(/hello/g, 'world');
+'hello'.replaceAll('hello', 'world');
npm i putout @putout/operator-regexp
const {operator} = require('putout');
const {isSimpleRegExp} = operator;
isSimpleRegExp(/hello world/);
// returns
true;
isSimpleRegExp(/^hello/);
// returns
false;
MIT
© 2010 - cnpmjs.org x YWFE | Home | YWFE