{"name":"@putout/operator-jsx","version":"3.1.1","type":"module","author":{"name":"coderaiser","email":"mnemonic.enemy@gmail.com","url":"https://github.com/coderaiser"},"description":"🐊Putout operator adds methods that simplifies JSX transformations","homepage":"https://github.com/coderaiser/putout/tree/master/packages/operator-jsx#readme","main":"lib/jsx.js","release":false,"tag":false,"changelog":false,"repository":{"type":"git","url":"git+https://github.com/coderaiser/putout.git"},"scripts":{"test":"madrun test","test:dts":"madrun test:dts","watch:test":"madrun watch:test","watch:coverage":"madrun watch:coverage","lint":"madrun lint","fresh:lint":"madrun fresh:lint","lint:fresh":"madrun lint:fresh","fix:lint":"madrun fix:lint","coverage":"madrun coverage","report":"madrun report"},"dependencies":{"@putout/babel":"^5.0.0","@putout/operate":"^15.0.0"},"keywords":["putout","putout-operator","operator","jsx"],"devDependencies":{"@putout/test":"^15.0.0","check-dts":"^1.0.0","eslint":"^10.0.0","eslint-plugin-putout":"^31.0.0","madrun":"^13.0.0","montag":"^2.0.0","nodemon":"^3.0.1","superc8":"^12.0.0","supertape":"^13.0.0","try-catch":"^4.0.0"},"peerDependencies":{"putout":">=41"},"license":"MIT","engines":{"node":">=22"},"publishConfig":{"access":"public"},"_id":"@putout/operator-jsx@3.1.1","gitHead":"84649e2e9853a60d263687afb993f404a23f3de3","types":"./lib/jsx.d.ts","bugs":{"url":"https://github.com/coderaiser/putout/issues"},"_nodeVersion":"26.3.1","_npmVersion":"11.4.2","dist":{"integrity":"sha512-YmYP1twG2WZ+WH8jIaJdXNwk90YT+u8Ka4/Oerhlkmyy8D1V9tO1iSw5JWfjUIsyXkIwQgdYbu8ZivWSbBDbDQ==","shasum":"a27e423d0121e5c17ec9d97dbb7d82f46a85211a","tarball":"http://registry-npm.ywwl.com/@putout/operator-jsx/download/@putout/operator-jsx-3.1.1.tgz","fileCount":5,"unpackedSize":10265,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDwukAG3zO8W1Gx7wU1ocAXoNU3z49V0FfhfmK3TQ+CZQIgNk8gcdT/7Gexp1aDXpCXyln2VtnsY6huBA55ZI9bvUc="}],"size":3062,"noattachment":false,"key":"/@putout/operator-jsx/-/@putout/operator-jsx-3.1.1.tgz"},"_npmUser":{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"},"directories":{},"maintainers":[{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/operator-jsx_3.1.1_1782070984234_0.7991081301298817"},"_hasShrinkwrap":false,"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":1782070984367,"_cnpm_publish_time":1782070984367,"dist-tags":{"latest":"3.1.1"}}