{"name":"@putout/plugin-apply-optional-chaining","version":"6.0.1","type":"commonjs","author":{"name":"coderaiser","email":"mnemonic.enemy@gmail.com","url":"https://github.com/coderaiser"},"description":"🐊Putout plugin adds ability apply optional chaining","homepage":"https://github.com/coderaiser/putout/tree/v36.18.0/packages/plugin-apply-optional-chaining#readme","main":"lib/index.js","release":false,"tag":false,"changelog":false,"repository":{"type":"git","url":"git://github.com/coderaiser/putout.git"},"scripts":{"test":"madrun test","watch:test":"madrun watch:test","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":{},"keywords":["putout","putout-plugin","plugin","optional-chaining"],"devDependencies":{"@putout/test":"^10.0.0","c8":"^9.0.0","eslint":"^9.0.0","eslint-plugin-n":"^17.0.0","eslint-plugin-putout":"^22.0.0","lerna":"^6.0.1","madrun":"^10.0.0","nodemon":"^3.0.1"},"peerDependencies":{"putout":">=35"},"license":"MIT","engines":{"node":">=18"},"publishConfig":{"access":"public"},"_id":"@putout/plugin-apply-optional-chaining@6.0.1","gitHead":"a794532f81ae89b6e8afc312994ca4618838f448","bugs":{"url":"https://github.com/coderaiser/putout/issues"},"_nodeVersion":"22.11.0","_npmVersion":"10.9.0","dist":{"integrity":"sha512-3Q3XV2jm68/XhxzRy/pVDUwGPIsKk6Ng0vpR186w9+/+HEBF7f2NTrGeAd63AFztPFzyWXXHr34xUetrC6EW6A==","shasum":"b06cf7562a5f216fcebe1f56b9c04cbf59870d3a","tarball":"http://registry-npm.ywwl.com/@putout/plugin-apply-optional-chaining/download/@putout/plugin-apply-optional-chaining-6.0.1.tgz","fileCount":6,"unpackedSize":6497,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDCr3IPgMbf75OZSME8EdDofDYpnYBX27O1VebDG6lF7AiBiUtP3AcgxEyCRc1bU5/8IKjw8G8DnZDENAcBXXVlTZA=="}],"size":2920,"noattachment":false,"key":"/@putout/plugin-apply-optional-chaining/-/@putout/plugin-apply-optional-chaining-6.0.1.tgz"},"_npmUser":{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/plugin-apply-optional-chaining_6.0.1_1734091802815_0.408008117247155"},"_hasShrinkwrap":false,"readme":"# @putout/plugin-apply-optional-chaining [![NPM version][NPMIMGURL]][NPMURL]\n\n[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-apply-optional-chaining.svg?style=flat&longCache=true\n[NPMURL]: https://npmjs.org/package/@putout/plugin-apply-optional-chaining \"npm\"\n\n> The **optional chaining operator** (`?.`) enables you to read the value of a property located deep within a chain of connected objects without having to check that each reference in the chain is valid.\n>\n> The `?.` operator is like the `.` chaining operator, except that instead of causing an error if a reference is nullish (`null` or `undefined`), the expression short-circuits with a return value of `undefined`. When used with function calls, it returns `undefined` if the given function does not exist.\n>\n> This results in shorter and simpler expressions when accessing chained properties when the possibility exists that a reference may be missing. It can also be helpful while exploring the content of an object when there's no known guarantee as to which properties are required.\n>\n> (c) [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining)\n\n🐊[**Putout**](https://github.com/coderaiser/putout) plugin applies **optional chaining**. Backward to [`convert-optional-to-logical`](https://github.com/coderaiser/putout/tree/master/packages/plugin-convert-optional-to-logical#readme). Merged to [`@putout/plugin-optional-chaining`](https://www.npmjs.com/package/@putout/plugin-optional-chaining).\n\n## Install\n\n```\nnpm i @putout/plugin-apply-optional-chaining\n```\n\n## Rule\n\n```json\n{\n    \"rules\": {\n        \"apply-optional-chaining/use\": \"on\",\n        \"apply-optional-chaining/assign\": \"off\"\n    }\n}\n```\n\n## use\n\nCheckout out in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/d308302b95800920d324b799f1a948e3/99d03cb297d17446885829e8583b3cc7777367c5).\n\n### ❌ Example of incorrect code\n\n```js\nconst result = hello && hello.world;\n\nif (typeof a === 'function' && a(1, 2))\n    alert();\n```\n\n### ✅ Example of correct code\n\n```js\nconst result = hello?.world;\n\nif (a?.(1, 2))\n    alert();\n```\n\n## assign\n\n> Proposal to add support for optional chaining on the left of assignment operators: `a?.b = c`.\n>\n> (c) [Proposal of Optional Chaining Assignment](https://github.com/tc39/proposal-optional-chaining-assignment)\n\nDisabled by default. Checkout out in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/74bde454f909b7f9d13e80da10e12a15/d31bd20ca18fefe474bb8ab73f963e47dffb89e7).\n\n### ❌ Example of incorrect code\n\n```js\nif (a) {\n    a.b = 5;\n}\n\nif (a)\n    a.b = 5;\n\na && (a.b = 5);\n```\n\n### ✅ Example of correct code\n\n```js\na?.b = 5;\n```\n\n## License\n\nMIT\n","publish_time":1734091802979,"maintainers":[{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"}],"_cnpm_publish_time":1734091802979,"dist-tags":{"latest":"6.0.1"}}