{"bugs":{"url":"https://github.com/nvie/lemons.js/issues"},"dist":{"shasum":"1aacf6336c7ffe10ea60d17bc980d42c64a4c06c","tarball":"https://registry.npmjs.org/lemons/-/lemons-1.7.0-beta1.tgz","fileCount":21,"integrity":"sha512-htMP6M8ZAMtuVbkIRE/Xn3xs+SuTxrZrIQ2gfZZHBWQRkOim66X6KHV43cDi8yfg6TxRIKQnDMkso6akWWi2ig==","signatures":[{"sig":"MEYCIQCdio8YBChxXo07WZ8yQjP8kIMt4Z6luZCWp1vDEpOFYgIhAONbJ7M8dB6SYtd9wRJxhQjoGH3wfLxfDx0kNFcTdhIt","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":46925},"main":"./cjs/index.js","name":"lemons","types":"./ts/index.d.ts","author":{"name":"Vincent Driessen"},"module":"./es/index.js","readme":"[![npm](https://img.shields.io/npm/v/lemons.svg)](https://www.npmjs.com/package/lemons)\n[![Build Status](https://github.com/nvie/lemons.js/workflows/test/badge.svg)](https://github.com/nvie/lemons.js/actions)\n[![Coverage Status](https://img.shields.io/coveralls/nvie/lemons.js/master.svg)](https://coveralls.io/github/nvie/lemons.js?branch=master)\n[![Minified Size](https://badgen.net/bundlephobia/minzip/lemons)](https://bundlephobia.com/result?p=lemons)\n\n🍋 Common algebraïc data types for JavaScript, 'cause when life hands you lemons...\n\n## Maybe\n\nPseudo-type:\n\n    type Maybe<T>\n        = Just T\n        | Nothing\n\nUsage example:\n\n```javascript\nimport Maybe, { Just, Nothing } from 'lemons/Maybe';\n// or: import { Maybe, Just, Nothing } from 'lemons';\n\nconst r1: Maybe<number> = Just(42);\nr1.isJust()         // => true\nr1.isNothing()      // => false\nr1.withDefault(99)  // => 42\nr1.unwrap()         // => 42\nr1.expect('Foo')    // => 42\n\nconst r2: Maybe<number> = Nothing();\nr2.isJust()         // => false\nr2.isNothing()      // => true\nr2.withDefault(99)  // => 99\nr2.unwrap()         // throws Error('Cannot unwrap a Nothing')\nr2.expect('Foo')    // throws Error('Foo')\n```\n\n\n## Result\n\nPseudo-type:\n\n    type Result<E, T>\n        = Ok T\n        | Err E\n\nUsage example:\n\n```javascript\nimport Result, { Ok, Err } from 'lemons/Result';\n// or: import { Result, Ok, Err } from 'lemons';\n\nconst r1: Result<string, number> = Ok(42);\nr1.isOk()           // => true\nr1.isErr()          // => false\nr1.withDefault(99)  // => 42\nr1.unwrap()         // => 42\n\nconst r2: Result<string, number> = Err('Oops');\nr2.isOk()           // => false\nr2.isErr()          // => true\nr2.withDefault(99)  // => 99\nr2.unwrap()         // throws 'Oops'\n```\n\n\n## LazyResult\n\nPseudo-type:\n\n    type LazyResult<E, T>\n        = Initial\n        | Loading\n        | Failure E\n        | Success T\n\nUseful for state management that typically has an initial, loading, and\na failure/success outcome state, like page loading, or submitting a form.  The\nfollowing example shows how you would use the LazyResult as part of a React\napp, but since ADTs are simple data structures, they work with any technology.\n\nAnnotated usage example:\n\n![How to use LazyResult in real apps](./lazyresult-example-usage.png)\n","license":"MIT","_npmUser":{"name":"nvie","email":"me@nvie.com"},"homepage":"https://github.com/nvie/lemons.js#readme","githubUrl":"https://github.com/nvie/lemons.js","repository":{"url":"git+https://github.com/nvie/lemons.js.git","type":"git"},"description":"Common algebraïc data types for JavaScript","directories":{},"licenseText":"MIT License\n\nCopyright (c) 2017 Vincent Driessen\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","maintainers":[{"name":"nvie","email":"me@nvie.com"}],"sideEffects":false,"dependencies":{},"_hasShrinkwrap":false,"readmeFilename":"README.md","_npmOperationalInternal":{"tmp":"tmp/lemons_1.7.0-beta1_1635800176605_0.4590798358214623","host":"s3://npm-registry-packages"},"_id":"lemons@1.7.0-beta1","version":"1.7.0-beta1"}