{"name":"@putout/operator-regexp","version":"2.0.0","keywords":["putout","putout-operator","operator","regexp"],"author":{"url":"https://github.com/coderaiser","name":"coderaiser","email":"mnemonic.enemy@gmail.com"},"license":"MIT","_id":"@putout/operator-regexp@2.0.0","maintainers":[{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"}],"homepage":"https://github.com/coderaiser/putout/tree/master/packages/operator-regexp#readme","bugs":{"url":"https://github.com/coderaiser/putout/issues"},"tag":false,"dist":{"shasum":"fe1a599a8953879dbe8fd1776709450598c9e9e3","tarball":"http://registry-npm.ywwl.com/@putout/operator-regexp/download/@putout/operator-regexp-2.0.0.tgz","fileCount":6,"integrity":"sha512-TbctczJnFTWfvZI9+mPVyKdr5EVc0Q5fwmykPO+VzMcZOvxkD1hXPz9watOk23iQsbrEJMxPTEuyDRicJdXYGA==","signatures":[{"sig":"MEQCIFL7SozPsVqrS/Tga2ZKHXhMmuLSeTjj8/kyehPtVVOuAiBH0yhOHIWNBw3WsJO4KQ7zhoMmv26AXiUUT8AaMUTfpQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":5215,"size":2435,"noattachment":false,"key":"/@putout/operator-regexp/-/@putout/operator-regexp-2.0.0.tgz"},"main":"lib/regexp.js","type":"commonjs","engines":{"node":">=20"},"gitHead":"04ff0f30b63f57cb3ea16ebbb757b24244507bd5","release":false,"scripts":{"lint":"madrun lint","test":"madrun test","report":"madrun report","coverage":"madrun coverage","fix:lint":"madrun fix:lint","fresh:lint":"madrun fresh:lint","lint:fresh":"madrun lint:fresh","watch:test":"madrun watch:test"},"_npmUser":{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"},"changelog":false,"repository":{"url":"git+https://github.com/coderaiser/putout.git","type":"git"},"_npmVersion":"11.4.2","description":"🐊Putout operator adds ability to check if provided regexp can be converted to string without losing it's sense","directories":{},"_nodeVersion":"24.5.0","dependencies":{"regexp-tree":"^0.1.24"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"c8":"^10.0.0","eslint":"^9.0.0","madrun":"^11.0.0","montag":"^1.2.1","nodemon":"^3.0.1","supertape":"^11.0.3","@putout/test":"^14.0.0","eslint-plugin-n":"^17.0.0","@putout/eslint-flat":"^3.0.0","eslint-plugin-putout":"^28.0.0"},"peerDependencies":{"putout":">=40"},"_npmOperationalInternal":{"tmp":"tmp/operator-regexp_2.0.0_1755300826911_0.2504907722981746","host":"s3://npm-registry-packages-npm-production"},"readme":"# @putout/operator-regexp [![NPM version][NPMIMGURL]][NPMURL]\n\n[NPMIMGURL]: https://img.shields.io/npm/v/@putout/operator-regexp.svg?style=flat&longCache=true\n[NPMURL]: https://npmjs.org/package/@putout/operator-regexp \"npm\"\n\n🐊[**Putout**](https://github.com/coderaiser/putout) operator adds ability to determine that provided [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp) can be\nconverted to [`String`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) without losing it's sense.\n\nIt is used for example in [regexp/convert-replace-to-relace-all](https://github.com/coderaiser/putout/tree/master/packages/plugin-regexp#regexpconvert-replace-to-replace-all):\n\n```diff\n-'hello'.replace(/hello/g, 'world');\n+'hello'.replaceAll('hello', 'world');\n```\n\n## Install\n\n```\nnpm i putout @putout/operator-regexp\n```\n\n## API\n\n### isSimpleRegexp(regexp: RegExp)\n\n```js\nconst {operator} = require('putout');\nconst {isSimpleRegExp} = operator;\n\nisSimpleRegExp(/hello world/);\n// returns\ntrue;\n\nisSimpleRegExp(/^hello/);\n// returns\nfalse;\n```\n\n### transformRegExp(regexp: String, plugin: Traverser)\n\n```js\ntransformRegExp('[aab]', {\n    report,\n    fix,\n    traverse,\n});\n```\n\n### getStringFromRegExp(pattern: String)\n\nTo avoid errors like this:\n\n> SyntaxError: Expecting Unicode escape sequence \\uXXXX\n\nconst string = getStringFromRegExp(regexpNode);\n\n## License\n\nMIT\n","publish_time":1755300827117,"_cnpm_publish_time":1755300827117,"dist-tags":{"latest":"5.2.0"}}