{"name":"data.maybe","version":"1.2.3","description":"A structure for values that may not be available or computations that may fail.","main":"lib/index.js","scripts":{"test":"make test"},"repository":{"type":"git","url":"git+https://github.com/folktale/data.maybe.git"},"keywords":["monads","maybe","fantasy-land","option","folktale"],"author":{"name":"Quildreen Motta"},"license":"MIT","bugs":{"url":"https://github.com/folktale/data.maybe/issues"},"dependencies":{},"devDependencies":{"browserify":"^3.38.0","LiveScript":"~1.2.0","hifive-tap":"~0.1.0","hifive":"~0.1.0","uglify-js":"~2.4.3","laws":"~0.2.0","claire":"~0.4.1","ink-docstrap":"git://github.com/robotlolita/docstrap.git","jsdoc":"^3.3.0-alpha5"},"gitHead":"bcfc8a235eac0199af4108a0c74ad9bc09e272ff","homepage":"https://github.com/folktale/data.maybe#readme","_id":"data.maybe@1.2.3","_npmVersion":"6.4.1","_nodeVersion":"8.11.3","_npmUser":{"name":"robotlolita","email":"quildreen@gmail.com"},"dist":{"integrity":"sha512-iiw1TvVqHTOpnIwueo9jE3a2UFqblSHobzYTzvbvabNRnZq+D/tFi8J4olZ0viqbWkm7zKcPtu1/EzGhEyTH8A==","shasum":"940475f8ccddc10eb218b73125bdfb449d6d9ebc","tarball":"http://registry-npm.ywwl.com/data.maybe/download/data.maybe-1.2.3.tgz","fileCount":16,"unpackedSize":31754,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbjd9KCRA9TVsSAnZWagAAXfwP/j/l0XpbmiKsJQmcjMUO\nD3U/hC8/+z4wfAf3AG7/HKSy1xPHs0Q8t4t9R1KWCgb5F8eJTQ7n0aGWOdRf\n5hBwAdPR6T98c/RMIM+WSPqyqTH/sVaymbho7Hn8xrOwDLoOH8tylLwelgTd\n840lLR0QBrN4dvQmo27bGbQ/K4fA9ogki3XWsTAubNxNOYGso9bi/Jn4ugJg\nrHWV/kCvMwlohPpySMUd3806eKwaY5+1ZSbJktqu7Dy5EquncVfCX9KAzSW7\nfCHNA/6wyWGtgscZPVpIb9wuiOZprb9o7JWyxUVIkMZxrqr/I8GcfBL8Azrm\n9s+0pN5R7DLPhEIBE0WonOAOgLJXkOFGjG5hBhWV9608nMSq0sd4qevs5cKy\nOZxzmsCsfKWUnkeDTxOir/OKLLrK8YQ79WXmZU4f15OXtCBV8hQqzaC4vO99\n3j0W0cTJGM6EBrK0TxF9MpmPu1qeMB6XyunHYgSCDMdQeh+4XfPc3uHJOuDd\ntrHBSqIRzkM0Se7meFNTOlNOEzQm6KeKgu+6jWwumQLoBSN2Es47vdB113N4\n1l8ejy6NDViAHr8rYCDHXcanwJ56HCc0CUzhlK/uU8/h1mz0j1i9RqA7S1gU\n+wzCNOq/XcbzzbHp1tYJ9asHPq3iulLKTukid9r9jgQpKa4MX8w97gSArTas\nV9in\r\n=rnfp\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD0Yt+cjsB7KOq+epugeNdvmYwhVi2cmo4l/HKiuTHo8gIgAtoVcUsUK654tE3ck57Nxe3iMAKLPPy+MQpiMj/GurY="}],"size":8826,"noattachment":false,"key":"/data.maybe/-/data.maybe-1.2.3.tgz"},"maintainers":[{"email":"queen@robotlolita.me","name":"killdream"},{"email":"quildreen@gmail.com","name":"robotlolita"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/data.maybe_1.2.3_1536024394338_0.829359792623303"},"_hasShrinkwrap":false,"deprecated":"This package is no longer supported. Consider switching to fp-ts","readme":"Data.Maybe\n==========\n\n[![Build Status](https://secure.travis-ci.org/folktale/data.maybe.png?branch=master)](https://travis-ci.org/folktale/data.maybe)\n[![NPM version](https://badge.fury.io/js/data.maybe.png)](http://badge.fury.io/js/data.maybe)\n[![Dependencies Status](https://david-dm.org/folktale/data.maybe.png)](https://david-dm.org/folktale/data.maybe)\n[![stable](http://hughsk.github.io/stability-badges/dist/stable.svg)](http://github.com/hughsk/stability-badges)\n\n\nA structure for values that may not be present, or computations that may\nfail. `Maybe(a)` explicitly models the effects that implicit in `Nullable`\ntypes, thus has none of the problems associated with using `null` or\n`undefined` — like `NullPointerException` or `TypeError`.\n\nFurthermore, being a Monad, `Maybe(a)` can be composed in manners similar to\nother monads, by using the generic sequencing and composition operations\nprovided for the common interface in\n[Fantasy Land](https://github.com/fantasyland/fantasy-land).\n\n\n## Example\n\n```js\nvar Maybe = require('data.maybe')\n\n// :: [a], (a -> Bool) -> Maybe(a)\nfunction find(collection, predicate) {\n  for (var i = 0; i < collection.length; ++i) {\n    var item = collection[i]\n    if (predicate(item))  return Maybe.Just(item)\n  }\n  return Maybe.Nothing()\n}\n\nvar numbers = [-2, -1, 0, 1, 2]\nvar a = find(numbers, function(a){ return a > 5 })\nvar b = find(numbers, function(a){ return a === 0 })\n\n// Call a function only if both a and b\n// have values (sequencing)\na.chain(function(x) {\n  return b.chain(function(y) {\n    doSomething(x, y)\n  })\n})\n\n// Transform values only if they're available:\na.map(function(x){ return x + 1 })\n// => Maybe.Nothing\nb.map(function(x){ return x + 1 })\n// => Maybe.Just(1)\n\n// Use a default value if no value is present\na.orElse(function(){ return Maybe.Just(-1) })\n// => Maybe.Just(-1)\nb.orElse(function(){ return Maybe.Just(-1) })\n// => Maybe.Just(0)\n```\n\n\n## Installing\n\nThe easiest way is to grab it from NPM. If you're running in a Browser\nenvironment, you can use [Browserify][]:\n\n    $ npm install data.maybe\n\n\n### Using with CommonJS\n\nIf you're not using NPM, [Download the latest release][release], and require\nthe `data.maybe.umd.js` file:\n\n```js\nvar Maybe = require('data.maybe')\n```\n\n\n### Using with AMD\n\n[Download the latest release][release], and require the `data.maybe.umd.js`\nfile:\n\n```js\nrequire(['data.maybe'], function(Maybe) {\n  ( ... )\n})\n```\n\n\n### Using without modules\n\n[Download the latest release][release], and load the `data.maybe.umd.js`\nfile. The properties are exposed in the global `folktale.data.Maybe` object:\n\n```html\n<script src=\"/path/to/data.maybe.umd.js\"></script>\n```\n\n\n### Compiling from source\n\nIf you want to compile this library from the source, you'll need [Git][],\n[Make][], [Node.js][], and run the following commands:\n\n    $ git clone git://github.com/folktale/data.maybe.git\n    $ cd data.maybe\n    $ npm install\n    $ make bundle\n\nThis will generate the `dist/data.maybe.umd.js` file, which you can load in\nany JavaScript environment.\n\n\n## Documentation\n\nYou can [read the documentation online][docs] or build it yourself:\n\n    $ git clone git://github.com/folktale/data.maybe.git\n    $ cd data.maybe\n    $ npm install\n    $ make documentation\n\nThen open the file `docs/index.html` in your browser.\n\n\n## Platform support\n\nThis library assumes an ES5 environment, but can be easily supported in ES3\nplatforms by the use of shims. Just include [es5-shim][] :)\n\n\n## Licence\n\nCopyright (c) 2013 Quildreen Motta.\n\nReleased under the [MIT licence](https://github.com/folktale/data.maybe/blob/master/LICENCE).\n\n<!-- links -->\n[Fantasy Land]: https://github.com/fantasyland/fantasy-land\n[Browserify]: http://browserify.org/\n[Git]: http://git-scm.com/\n[Make]: http://www.gnu.org/software/make/\n[Node.js]: http://nodejs.org/\n[es5-shim]: https://github.com/kriskowal/es5-shim\n[docs]: http://folktalegithubio.readthedocs.io/en/latest/api/data/maybe/index.html\n<!-- [release: https://github.com/folktale/data.maybe/releases/download/v$VERSION/data.maybe-$VERSION.tar.gz] -->\n[release]: https://github.com/folktale/data.maybe/releases/download/v1.2.1/data.maybe-1.2.1.tar.gz\n<!-- [/release] -->\n","publish_time":1536024394484,"_cnpm_publish_time":1536024394484,"dist-tags":{"latest":"1.2.3"}}