@putout/operator-regexp
🐊Putout operator adds ability to check if provided regexp can be converted to string without losing it's sense
Last updated 3 months ago by coderaiser .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @putout/operator-regexp 
SYNC missed versions from official npm registry.

@putout/operator-regexp NPM version

????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:

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

transformRegExp(regexp: String, plugin: Traverser)

transformRegExp('[aab]', {
    report,
    fix,
    traverse,
});

License

MIT

Current Tags

  • 4.0.0                                ...           latest (3 months ago)

4 Versions

  • 4.0.0                                ...           3 months ago
  • 3.0.0                                ...           4 months ago
  • 2.0.0                                ...           8 months ago
  • 1.0.0                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 1
Last Month 0
Dependencies (1)
Dev Dependencies (10)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |