{"name":"@putout/operator-jsx","version":"3.0.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@3.0.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":"842ae8c1acc39a0f54e59bcde9c126674df86053","tarball":"http://registry-npm.ywwl.com/@putout/operator-jsx/download/@putout/operator-jsx-3.0.0.tgz","fileCount":4,"integrity":"sha512-BtA8xWie6s+OeT6r5pfLozqa2PMiEVpceVMvqvx/6TDGLYGSb9HxCTGsQFxR2qdFi/pTk+XwkOX1GU7riLY1GQ==","signatures":[{"sig":"MEQCIFbYsNmiu8vp56Yh1+lyNA+eo8BWm9o3TcKe4krwtT1hAiBnMLeB1IDG4GtrNwtLLq286b3bPyuENTrgQ8udt3P5ZQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":9073,"size":2857,"noattachment":false,"key":"/@putout/operator-jsx/-/@putout/operator-jsx-3.0.0.tgz"},"main":"lib/jsx.js","type":"module","engines":{"node":">=22"},"gitHead":"43d876985d4e74e39e5ce02aae5fed091f7a2648","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","watch:coverage":"madrun watch:coverage"},"_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":"25.2.1","dependencies":{"@putout/babel":"^5.0.0","@putout/operate":"^15.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"c8":"^10.0.0","eslint":"^10.0.0-alpha.0","madrun":"^12.0.0","montag":"^1.2.1","nodemon":"^3.0.1","supertape":"^11.0.3","try-catch":"^4.0.0","@putout/test":"^15.0.0","eslint-plugin-n":"^17.0.0","eslint-plugin-putout":"^29.0.0"},"peerDependencies":{"putout":">=41"},"_npmOperationalInternal":{"tmp":"tmp/operator-jsx_3.0.0_1767553068032_0.3835473066460846","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":1767553068183,"_cnpm_publish_time":1767553068183,"dist-tags":{"latest":"3.1.1"}}