@putout/operator-regexp

1.0.0 • Public • Published

@putout/operator-regexp NPM version Dependency Status

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');

Install

npm i putout @putout/operator-regexp

API

isSimpleRegexp(regexp: RegExp)

const {operator} = require('putout');
const {isSimpleRegExp} = operator;

isSimpleRegExp(/hello world/);
// returns
true;

isSimpleRegExp(/^hello/);
// returns
false;

License

MIT

Package Sidebar

Install

npm i @putout/operator-regexp

Weekly Downloads

3,543

Version

1.0.0

License

MIT

Unpacked Size

4.57 kB

Total Files

5

Last publish

Collaborators

  • coderaiser