{"name":"@putout/operator-jsx","version":"1.3.0","keywords":["putout","putout-operator","operator","jsx"],"author":{"url":"https://github.com/coderaiser","name":"coderaiser","email":"mnemonic.enemy@gmail.com"},"license":"MIT","_id":"@putout/operator-jsx@1.3.0","maintainers":[{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"}],"homepage":"https://github.com/coderaiser/putout/tree/master/packages/operator-jsx#readme","bugs":{"url":"https://github.com/coderaiser/putout/issues"},"tag":false,"dist":{"shasum":"509d3a7c27255b24911b2acce2c43aba9b5332e0","tarball":"http://registry-npm.ywwl.com/@putout/operator-jsx/download/@putout/operator-jsx-1.3.0.tgz","fileCount":4,"integrity":"sha512-kIQAd9gJXxkIZY8y5uoAM6a06LuLQM4tOTZvj30IvbYTwC3Dqy1vfieLLJDyKxuuoWENJTQGTDvRkkvRuS/J9A==","signatures":[{"sig":"MEYCIQDEVIs2FzPUGG5RGvt9jpS02ioDSb9xy9oQ5/mdsFf/ZQIhAJv2KhmJ2zrIPxhJwmDoTtw0mdjwZ5+RzVY+uZ/sIKCD","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":5236,"size":2226,"noattachment":false,"key":"/@putout/operator-jsx/-/@putout/operator-jsx-1.3.0.tgz"},"main":"lib/jsx.js","type":"commonjs","engines":{"node":">=20"},"gitHead":"fe23c420d12d53bc00613fc692743ba702179ef7","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 methods that simplifies JSX transformations","directories":{},"_nodeVersion":"24.6.0","dependencies":{"@putout/babel":"^4.2.0","@putout/operate":"^14.1.0"},"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","eslint-plugin-putout":"^28.0.0"},"peerDependencies":{"putout":">=40"},"_npmOperationalInternal":{"tmp":"tmp/operator-jsx_1.3.0_1757431065000_0.21582639463063913","host":"s3://npm-registry-packages-npm-production"},"readme":"# @putout/operator-jsx [![NPM version][NPMIMGURL]][NPMURL]\n\n[NPMIMGURL]: https://img.shields.io/npm/v/@putout/operator-jsx.svg?style=flat&longCache=true\n[NPMURL]: https://npmjs.org/package/@putout/operator-jsx \"npm\"\n\n🐊[**Putout**](https://github.com/coderaiser/putout) operator operator adds methods that simplifies JSX transformations.\n\n## Install\n\n```\nnpm i putout @putout/operator-jsx\n```\n\n## API\n\n### hasTagName(path: Path | Node): boolean\n\nCheck `tagName` of given `Path`, for next `jsx`:\n\n```jsx\n<li>hello</li>;\n```\n\nIt will work this way:\n\n```js\nhasTagName(path, 'li');\n// returns\ntrue;\n```\n\n### getAttributePath(path: Path, name: string): Path | null\n\nGet `path` of an `attribute`\n\n```js\nconst classNamePath = getAttributePath(path, 'className');\n```\n\n### getAttributeNode(path: Path|Node, name: string): Node | null\n\nGet `node` of an `attribute`\n\n```js\nconst classNameNode = getAttributeNode(node, 'className');\n```\n\n### getAttributeValue(path: Path | Node, name: string): string\n\nGet `value` of an `attribute`\n\n```js\nconst className = getAttributeValue(node, 'className');\n```\n\n### addAttributeValue(path: Path | Node, name: string, value: string)\n\nAdd `value` to `attribute`\n\n```js\naddAttributeValue(node, 'className', 'hello');\n```\n\n### removeAttributeValue(path: Path | Node, name: string)\n\nRemove `attribute` value:\n\n```js\nremoveAttributeValue(node, 'className', 'hello');\n```\n\nWorks this way:\n\n```diff\n-<section className=\"hello world\"/>\n+<section className=\"world\"/>\n```\n\n### setAttributeValue(path: Path | Node, name: string, value: string)\n\nSet `attribute` value:\n\n```js\nsetAttributeValue(node, 'className', 'hello');\n```\n\nWorks this way:\n\n```diff\n-<section className=\"world\"/>\n+<section className=\"hello\"/>\n```\n\n### addClassName(path: Path | Node, value: string)\n\nAdd `className`:\n\n```js\naddClassName(node, 'hello');\n```\n\nWorks this way:\n\n```diff\n-<section className=\"world\"/>\n+<section className=\"hello\"/>\n```\n\n### removeClassName(path: Path | Node, value: string)\n\nRemove `className`:\n\n```js\nremoveClassName(node, 'hello');\n```\n\nWorks this way:\n\n```diff\n-<section className=\"hello world\"/>\n+<section className=\"world\"/>\n```\n\n### getClassName(path: Path | Node): string\n\nFor next jsx:\n\n```jsx\n<section className=\"world\"/>;\n```\n\nget `className`:\n\n```js\ngetClassName(node);\n// returns\n'world';\n```\n\n### containsClassName(path: Path | Node, name: string): boolean\n\nFor next jsx:\n\n```jsx\n<section className=\"hello world\"/>;\n```\n\ncheck:\n\n```js\ncontainsClassName(node, 'hello');\n// returns\ntrue;\n```\n\n### hasDataName(path: Path | Node, name: string): boolean\n\nFor next jsx:\n\n```jsx\n<section data-name=\"hello\"/>;\n```\n\ncheck:\n\n```js\nhasDataName(node, 'hello');\n// returns\ntrue;\n```\n\n### hasAttributeValue(path: Path | Node, name: string, value: string): boolean\n\nFor next jsx:\n\n```jsx\n<section data-menu-index=\"1\"/>;\n```\n\ncheck:\n\n```js\nhasAttributeValue(node, 'data-menu-index', '1');\n// returns\ntrue;\n```\n\n### addAttribute(path: Path | Node, name: string, value: string)\n\nFor next jsx:\n\n```jsx\n<section/>;\n```\n\ncheck:\n\n```js\naddAttribute(node, 'data-menu-index', '1');\n```\n\nresult is:\n\n```jsx\n<section data-menu-index=\"1\"/>;\n```\n\n## License\n\nMIT\n","publish_time":1757431065192,"_cnpm_publish_time":1757431065192,"dist-tags":{"latest":"3.1.1"}}