{"name":"@putout/operator-jsx","version":"1.5.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.5.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":"cb02ff903ae906688eb21444aec3d80f6ec4f42c","tarball":"http://registry-npm.ywwl.com/@putout/operator-jsx/download/@putout/operator-jsx-1.5.0.tgz","fileCount":4,"integrity":"sha512-FZ38AMIj+FFmQDcEy0zuSHLelhRTwUCCo/N4iY8LhK5uH83tpeqhGlRf1FrDKj4UFdOjrdrjdXmNG2BxNSQeGA==","signatures":[{"sig":"MEUCIDFqaLMg9ZMYx0fpICKmHqPV5ZecS4AnjQXOCBOUPW8bAiEA1LP9LzUIUvODbpzDuSOnTwrONn2SopWKNzPjki3Fd0U=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":6393,"size":2442,"noattachment":false,"key":"/@putout/operator-jsx/-/@putout/operator-jsx-1.5.0.tgz"},"main":"lib/jsx.js","type":"commonjs","engines":{"node":">=20"},"gitHead":"1b21f71a221b3b0e8e17c6a6bfb954583c15f7be","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":"24.7.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","try-catch":"^3.0.1","@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.5.0_1757520787368_0.4331344116617257","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":1757520787562,"_cnpm_publish_time":1757520787562,"dist-tags":{"latest":"3.1.1"}}