{"_id":"@putout/plugin-apply-maybe","_rev":"4159271","name":"@putout/plugin-apply-maybe","description":"🐊Putout plugin applies Maybe monad","dist-tags":{"latest":"1.2.1"},"maintainers":[{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"}],"time":{"modified":"2026-03-01T20:34:38.000Z","created":"2023-02-04T19:52:58.156Z","1.2.1":"2023-03-07T09:09:24.056Z","1.2.0":"2023-03-05T21:58:03.316Z","1.1.0":"2023-02-04T20:41:44.053Z","1.0.0":"2023-02-04T19:52:58.156Z"},"users":{},"author":{"name":"coderaiser","email":"mnemonic.enemy@gmail.com","url":"https://github.com/coderaiser"},"repository":{"type":"git","url":"git://github.com/coderaiser/apply-maybe.git"},"versions":{"1.2.1":{"name":"@putout/plugin-apply-maybe","version":"1.2.1","type":"commonjs","author":{"name":"coderaiser","email":"mnemonic.enemy@gmail.com","url":"https://github.com/coderaiser"},"description":"🐊Putout plugin applies Maybe monad","homepage":"https://github.com/coderaiser/apply-maybe/tree/v28.19.2/packages/plugin-apply-maybe#readme","main":"lib/index.js","commitType":"colon","release":false,"tag":false,"changelog":false,"repository":{"type":"git","url":"git://github.com/coderaiser/apply-maybe.git"},"scripts":{"wisdom":"madrun wisdom","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","apply-maybe-plugin","plugin","apply-maybe"],"devDependencies":{"@putout/test":"^5.0.0","c8":"^7.5.0","eslint":"^8.0.1","eslint-plugin-n":"^15.2.4","eslint-plugin-putout":"^16.0.0","lerna":"^6.0.1","madrun":"^9.0.0","montag":"^1.2.1","nodemon":"^2.0.1"},"peerDependencies":{"putout":">=28"},"license":"MIT","engines":{"node":">=16"},"publishConfig":{"access":"public"},"gitHead":"8445191757211bba1451166b5e454a4fdc2467b0","bugs":{"url":"https://github.com/coderaiser/apply-maybe/issues"},"_id":"@putout/plugin-apply-maybe@1.2.1","_nodeVersion":"18.14.2","_npmVersion":"9.1.3","dist":{"shasum":"cf57f1083b667909149fa389211e047800579c75","size":2323,"noattachment":false,"key":"/@putout/plugin-apply-maybe/-/@putout/plugin-apply-maybe-1.2.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/@putout/plugin-apply-maybe/download/@putout/plugin-apply-maybe-1.2.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","tmp":"tmp/plugin-apply-maybe_1.2.1_1678180163916_0.3497037955961142"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-03-07T09:09:24.056Z","publish_time":1678180164056,"_cnpm_publish_time":1678180164056},"1.2.0":{"name":"@putout/plugin-apply-maybe","version":"1.2.0","type":"commonjs","author":{"name":"coderaiser","email":"mnemonic.enemy@gmail.com","url":"https://github.com/coderaiser"},"description":"🐊Putout plugin applies Maybe monad","homepage":"https://github.com/coderaiser/apply-maybe/tree/master/packages/plugin-apply-maybe#readme","main":"lib/index.js","commitType":"colon","release":false,"tag":false,"changelog":false,"repository":{"type":"git","url":"git://github.com/coderaiser/apply-maybe.git"},"scripts":{"wisdom":"madrun wisdom","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","apply-maybe-plugin","plugin","apply-maybe"],"devDependencies":{"@putout/test":"^5.0.0","c8":"^7.5.0","eslint":"^8.0.1","eslint-plugin-n":"^15.2.4","eslint-plugin-putout":"^16.0.0","lerna":"^6.0.1","madrun":"^9.0.0","montag":"^1.2.1","nodemon":"^2.0.1"},"peerDependencies":{"putout":">=28"},"license":"MIT","engines":{"node":">=16"},"publishConfig":{"access":"public"},"gitHead":"4ef9391ab01e6131143c1dbbf6a7e7248925038c","bugs":{"url":"https://github.com/coderaiser/apply-maybe/issues"},"_id":"@putout/plugin-apply-maybe@1.2.0","_nodeVersion":"18.14.2","_npmVersion":"9.1.3","dist":{"shasum":"ddc110fa517cec7028b7e09a439ee114d322edc2","size":2297,"noattachment":false,"key":"/@putout/plugin-apply-maybe/-/@putout/plugin-apply-maybe-1.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/@putout/plugin-apply-maybe/download/@putout/plugin-apply-maybe-1.2.0.tgz"},"_npmUser":{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"},"directories":{},"maintainers":[{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/plugin-apply-maybe_1.2.0_1678053483140_0.27372073200575064"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-03-05T21:58:03.316Z","publish_time":1678053483316,"_cnpm_publish_time":1678053483316},"1.1.0":{"name":"@putout/plugin-apply-maybe","version":"1.1.0","type":"commonjs","author":{"name":"coderaiser","email":"mnemonic.enemy@gmail.com","url":"https://github.com/coderaiser"},"description":"🐊Putout plugin applies Maybe monad","homepage":"https://github.com/coderaiser/apply-maybe/tree/master/packages/plugin-apply-maybe#readme","main":"lib/index.js","commitType":"colon","release":false,"tag":false,"changelog":false,"repository":{"type":"git","url":"git://github.com/coderaiser/apply-maybe.git"},"scripts":{"wisdom":"madrun wisdom","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","apply-maybe-plugin","plugin","apply-maybe"],"devDependencies":{"@putout/test":"^5.0.0","c8":"^7.5.0","eslint":"^8.0.1","eslint-plugin-n":"^15.2.4","eslint-plugin-putout":"^16.0.0","lerna":"^6.0.1","madrun":"^9.0.0","montag":"^1.2.1","nodemon":"^2.0.1"},"peerDependencies":{"putout":">=28"},"license":"MIT","engines":{"node":">=16"},"publishConfig":{"access":"public"},"gitHead":"383dac0d2fa0a244c7d877481b908765275b36a4","bugs":{"url":"https://github.com/coderaiser/apply-maybe/issues"},"_id":"@putout/plugin-apply-maybe@1.1.0","_nodeVersion":"18.13.0","_npmVersion":"9.1.3","dist":{"shasum":"86a82f43d226c1392c398f85e11cee6b5ae07d29","size":2296,"noattachment":false,"key":"/@putout/plugin-apply-maybe/-/@putout/plugin-apply-maybe-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/@putout/plugin-apply-maybe/download/@putout/plugin-apply-maybe-1.1.0.tgz"},"_npmUser":{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"},"directories":{},"maintainers":[{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/plugin-apply-maybe_1.1.0_1675543303908_0.14186578658222548"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-02-04T20:41:44.053Z","publish_time":1675543304053,"_cnpm_publish_time":1675543304053},"1.0.0":{"name":"@putout/plugin-apply-maybe","version":"1.0.0","type":"commonjs","author":{"name":"coderaiser","email":"mnemonic.enemy@gmail.com","url":"https://github.com/coderaiser"},"description":"🐊Putout plugin applies Maybe monad","homepage":"https://github.com/coderaiser/apply-maybe/tree/master/packages/plugin-apply-maybe#readme","main":"lib/index.js","commitType":"colon","release":false,"tag":false,"changelog":false,"repository":{"type":"git","url":"git://github.com/coderaiser/apply-maybe.git"},"scripts":{"wisdom":"madrun wisdom","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","apply-maybe-plugin","plugin","apply-maybe"],"devDependencies":{"@putout/test":"^5.0.0","c8":"^7.5.0","eslint":"^8.0.1","eslint-plugin-n":"^15.2.4","eslint-plugin-putout":"^16.0.0","lerna":"^6.0.1","madrun":"^9.0.0","montag":"^1.2.1","nodemon":"^2.0.1"},"peerDependencies":{"putout":">=28"},"license":"MIT","engines":{"node":">=16"},"publishConfig":{"access":"public"},"gitHead":"ef563eb91c46fb3697f72aa61490d9ad6738aac7","bugs":{"url":"https://github.com/coderaiser/apply-maybe/issues"},"_id":"@putout/plugin-apply-maybe@1.0.0","_nodeVersion":"18.13.0","_npmVersion":"9.1.3","dist":{"shasum":"ece4681b72a897ee36cb3d1d9cefc5925c4fa919","size":2082,"noattachment":false,"key":"/@putout/plugin-apply-maybe/-/@putout/plugin-apply-maybe-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/@putout/plugin-apply-maybe/download/@putout/plugin-apply-maybe-1.0.0.tgz"},"_npmUser":{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"},"directories":{},"maintainers":[{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/plugin-apply-maybe_1.0.0_1675540377970_0.6305117103193258"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-02-04T19:52:58.156Z","publish_time":1675540378156,"_cnpm_publish_time":1675540378156}},"readme":"# @putout/plugin-apply-maybe [![NPM version][NPMIMGURL]][NPMURL]\n\n[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-apply-maybe.svg?style=flat&longCache=true\n[NPMURL]: https://npmjs.org/package/@putout/plugin-apply-maybe\"npm\"\n\n????[**Putout**](https://github.com/coderaiser/putout) plugin helps with `maybe` monad. Depends on [`@putout/declare`](https://github.com/coderaiser/putout/tree/master/packages/plugin-declare#readme). Renamed to [`@putout/plugin-maybe`](https://www.npmjs.com/package/@putout/maybe).\n\n## Install\n\n```\nnpm i @putout/plugin-apply-maybe -D\n```\n\n## Rules\n\n```json\n{\n    \"rules\": {\n        \"apply-maybe/array\": \"on\",\n        \"apply-maybe/empty-array\": \"on\",\n        \"apply-maybe/fn\": \"on\"\n    }\n}\n```\n\n## array\n\n### ❌ Example of incorrect code\n\n```js\nconst array = isArray(a) ? a : [a];\n```\n\n### ✅ Example of correct code\n\n```js\nconst maybeArray = (a) => isArray(a) ? a : [a];\nconst array = maybeArray(a);\n```\n\n## empty-array\n\n### ❌ Example of incorrect code\n\n```js\nconst array = !a ? [] : a;\n```\n\n### ✅ Example of correct code\n\n```js\nconst maybeArray = (a) => !a ? [] : a;\nconst array = maybeEmptyArray(a);\n```\n\n## fn\n\n### ❌ Example of incorrect code\n\n```js\nconst fn = isFn(a) ? a : () => {};\n```\n\n### ✅ Example of correct code\n\n```js\nconst noop = () => {};\nconst maybeFn = isFn(a) ? a : noop;\nconst fn = maybeFn(a);\n```\n\n## noop\n\n### ❌ Example of incorrect code\n\n```js\nconst fn = f || (() => {});\n```\n\n### ✅ Example of correct code\n\n```js\nconst noop = () => {};\nconst fn = fn || noop;\n```\n\n## License\n\nMIT\n","_attachments":{},"homepage":"https://github.com/coderaiser/apply-maybe/tree/v28.19.2/packages/plugin-apply-maybe#readme","bugs":{"url":"https://github.com/coderaiser/apply-maybe/issues"},"license":"MIT"}