{"_id":"data.maybe","_rev":"4179643","name":"data.maybe","description":"A structure for values that may not be available or computations that may fail.","dist-tags":{"latest":"1.2.3"},"maintainers":[{"name":"killdream","email":""},{"name":"robotlolita","email":""}],"time":{"modified":"2026-03-01T21:45:26.000Z","created":"2013-12-25T00:56:22.569Z","1.2.3":"2018-09-04T01:26:34.484Z","1.2.2":"2016-04-08T02:06:10.827Z","1.2.1":"2015-08-05T01:35:35.107Z","1.2.0":"2014-12-13T23:59:33.038Z","1.1.0":"2014-09-21T23:15:07.245Z","1.0.3":"2014-04-10T15:56:33.617Z","1.0.2":"2014-04-06T01:36:40.569Z","1.0.1":"2014-02-27T01:38:13.209Z","1.0.0":"2013-12-25T00:56:22.569Z"},"users":{},"author":{"name":"Quildreen Motta"},"repository":{"type":"git","url":"git+https://github.com/folktale/data.maybe.git"},"versions":{"1.2.3":{"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":{"shasum":"940475f8ccddc10eb218b73125bdfb449d6d9ebc","size":8826,"noattachment":false,"key":"/data.maybe/-/data.maybe-1.2.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/data.maybe/download/data.maybe-1.2.3.tgz"},"maintainers":[{"name":"killdream","email":""},{"name":"robotlolita","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/data.maybe_1.2.3_1536024394338_0.829359792623303"},"_hasShrinkwrap":false,"publish_time":1536024394484,"_cnpm_publish_time":1536024394484,"_cnpmcore_publish_time":"2021-12-18T23:57:26.903Z","deprecated":"This package is no longer supported. Consider switching to fp-ts"},"1.2.2":{"name":"data.maybe","version":"1.2.2","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":"b109f7bd1f0048acb84cbc041cfafa91868f8365","homepage":"https://github.com/folktale/data.maybe#readme","_id":"data.maybe@1.2.2","_shasum":"f955e4b5572b2eb5047eab93d8bb3a1cc76a2dc3","_from":".","_npmVersion":"2.14.12","_nodeVersion":"4.2.4","_npmUser":{"name":"robotlolita","email":"quildreen@gmail.com"},"dist":{"shasum":"f955e4b5572b2eb5047eab93d8bb3a1cc76a2dc3","size":8950,"noattachment":false,"key":"/data.maybe/-/data.maybe-1.2.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/data.maybe/download/data.maybe-1.2.2.tgz"},"maintainers":[{"name":"killdream","email":""},{"name":"robotlolita","email":""}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/data.maybe-1.2.2.tgz_1460081168540_0.7253176518715918"},"directories":{},"publish_time":1460081170827,"_hasShrinkwrap":false,"_cnpm_publish_time":1460081170827,"_cnpmcore_publish_time":"2021-12-18T23:57:27.137Z","deprecated":"This package is no longer supported. Consider switching to fp-ts"},"1.2.1":{"name":"data.maybe","version":"1.2.1","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":"b8df7415ca0517b4743f4f98ebd6d85e1f240408","homepage":"https://github.com/folktale/data.maybe#readme","_id":"data.maybe@1.2.1","_shasum":"98c5df5e058cb067cbee0675eea6d84302ef2f54","_from":".","_npmVersion":"2.10.1","_nodeVersion":"2.1.0","_npmUser":{"name":"killdream","email":"quildreen@gmail.com"},"dist":{"shasum":"98c5df5e058cb067cbee0675eea6d84302ef2f54","size":8893,"noattachment":false,"key":"/data.maybe/-/data.maybe-1.2.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/data.maybe/download/data.maybe-1.2.1.tgz"},"maintainers":[{"name":"killdream","email":""},{"name":"robotlolita","email":""}],"directories":{},"publish_time":1438738535107,"_hasShrinkwrap":false,"_cnpm_publish_time":1438738535107,"_cnpmcore_publish_time":"2021-12-18T23:57:27.355Z","deprecated":"This package is no longer supported. Consider switching to fp-ts"},"1.2.0":{"name":"data.maybe","version":"1.2.0","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":"https://github.com/folktale/data.maybe"},"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","jsdoc":"^3.3.0-alpha5"},"_id":"data.maybe@1.2.0","dist":{"shasum":"98b3b2220516c5837b341f3dc5b8c484e14b0451","size":8893,"noattachment":false,"key":"/data.maybe/-/data.maybe-1.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/data.maybe/download/data.maybe-1.2.0.tgz"},"_from":".","_npmVersion":"1.3.10","_npmUser":{"name":"killdream","email":"quildreen@gmail.com"},"maintainers":[{"name":"killdream","email":""},{"name":"robotlolita","email":""}],"directories":{},"publish_time":1418515173038,"_hasShrinkwrap":false,"_cnpm_publish_time":1418515173038,"_cnpmcore_publish_time":"2021-12-18T23:57:27.574Z","deprecated":"This package is no longer supported. Consider switching to fp-ts"},"1.1.0":{"name":"data.maybe","version":"1.1.0","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":"https://github.com/folktale/data.maybe"},"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","jsdoc":"^3.3.0-alpha5"},"_id":"data.maybe@1.1.0","dist":{"shasum":"dd83d70df2101860357133cade178bf66f168103","size":8613,"noattachment":false,"key":"/data.maybe/-/data.maybe-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/data.maybe/download/data.maybe-1.1.0.tgz"},"_from":".","_npmVersion":"1.3.10","_npmUser":{"name":"killdream","email":"quildreen@gmail.com"},"maintainers":[{"name":"killdream","email":""},{"name":"robotlolita","email":""}],"directories":{},"publish_time":1411341307245,"_hasShrinkwrap":false,"_cnpm_publish_time":1411341307245,"_cnpmcore_publish_time":"2021-12-18T23:57:27.824Z","deprecated":"This package is no longer supported. Consider switching to fp-ts"},"1.0.3":{"name":"data.maybe","version":"1.0.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":"https://github.com/folktale/data.maybe"},"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","jsdoc":"^3.3.0-alpha5"},"homepage":"https://github.com/folktale/data.maybe","_id":"data.maybe@1.0.3","dist":{"shasum":"53a911efaf08818090fe10c341e4224cbde3ea50","size":8419,"noattachment":false,"key":"/data.maybe/-/data.maybe-1.0.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/data.maybe/download/data.maybe-1.0.3.tgz"},"_from":".","_npmVersion":"1.4.3","_npmUser":{"name":"killdream","email":"quildreen@gmail.com"},"maintainers":[{"name":"killdream","email":""},{"name":"robotlolita","email":""}],"directories":{},"publish_time":1397145393617,"_hasShrinkwrap":false,"_cnpm_publish_time":1397145393617,"_cnpmcore_publish_time":"2021-12-18T23:57:28.064Z","deprecated":"This package is no longer supported. Consider switching to fp-ts"},"1.0.2":{"name":"data.maybe","version":"1.0.2","description":"A monad for values that may not be available or computations that may fail.","main":"lib/index.js","scripts":{"test":"make test"},"repository":{"type":"git","url":"https://github.com/folktale/data.maybe"},"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","jsdoc":"^3.3.0-alpha5"},"homepage":"https://github.com/folktale/data.maybe","_id":"data.maybe@1.0.2","dist":{"shasum":"088a7f6557b78b2ee3fcd77af90ada18486bb9ff","size":8335,"noattachment":false,"key":"/data.maybe/-/data.maybe-1.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/data.maybe/download/data.maybe-1.0.2.tgz"},"_from":".","_npmVersion":"1.4.3","_npmUser":{"name":"killdream","email":"quildreen@gmail.com"},"maintainers":[{"name":"killdream","email":""},{"name":"robotlolita","email":""}],"directories":{},"publish_time":1396748200569,"_hasShrinkwrap":false,"_cnpm_publish_time":1396748200569,"_cnpmcore_publish_time":"2021-12-18T23:57:28.262Z","deprecated":"This package is no longer supported. Consider switching to fp-ts"},"1.0.1":{"name":"data.maybe","version":"1.0.1","description":"A monad for values that may not be available or computations that may fail.","main":"lib/index.js","scripts":{"test":"make test","prepublish":"make compile"},"repository":{"type":"git","url":"https://github.com/folktale/data.maybe"},"keywords":["monads","maybe","fantasy-land","option","folktale"],"author":{"name":"Quildreen Motta"},"license":"MIT","bugs":{"url":"https://github.com/folktale/data.maybe/issues"},"devDependencies":{"browserify":"git://github.com/robotlolita/node-browserify","groc":"git://github.com/robotlolita/groc#typography","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"},"homepage":"https://github.com/folktale/data.maybe","_id":"data.maybe@1.0.1","dist":{"shasum":"b2df4042ef31f87ebfb9365ba61539b128c744a5","size":8292,"noattachment":false,"key":"/data.maybe/-/data.maybe-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/data.maybe/download/data.maybe-1.0.1.tgz"},"_from":".","_npmVersion":"1.4.4","_npmUser":{"name":"killdream","email":"quildreen@gmail.com"},"maintainers":[{"name":"killdream","email":""},{"name":"robotlolita","email":""}],"directories":{},"publish_time":1393465093209,"_hasShrinkwrap":false,"_cnpm_publish_time":1393465093209,"_cnpmcore_publish_time":"2021-12-18T23:57:28.488Z","deprecated":"This package is no longer supported. Consider switching to fp-ts"},"1.0.0":{"name":"data.maybe","version":"1.0.0","description":"A monad for values that may not be available or computations that may fail.","main":"lib/index.js","scripts":{"test":"make test","prepublish":"make compile"},"repository":{"type":"git","url":"https://github.com/folktale/data.maybe"},"keywords":["monads","maybe","fantasy-land","option","folktale"],"author":{"name":"Quildreen Motta"},"license":"MIT","bugs":{"url":"https://github.com/folktale/data.maybe/issues"},"dependencies":{"claire":"~0.4.1"},"devDependencies":{"browserify":"git://github.com/robotlolita/node-browserify","groc":"git://github.com/robotlolita/groc#typography","LiveScript":"~1.2.0","hifive-tap":"~0.1.0","hifive":"~0.1.0","uglify-js":"~2.4.3","laws":"~0.2.0"},"readmeFilename":"README.md","homepage":"https://github.com/folktale/data.maybe","_id":"data.maybe@1.0.0","dist":{"shasum":"9d2d999b43f18f42cba197e61fb6429b5a72563c","size":63570,"noattachment":false,"key":"/data.maybe/-/data.maybe-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/data.maybe/download/data.maybe-1.0.0.tgz"},"_from":".","_npmVersion":"1.3.21","_npmUser":{"name":"killdream","email":"quildreen@gmail.com"},"maintainers":[{"name":"killdream","email":""},{"name":"robotlolita","email":""}],"directories":{},"publish_time":1387932982569,"_hasShrinkwrap":false,"_cnpm_publish_time":1387932982569,"_cnpmcore_publish_time":"2021-12-18T23:57:28.805Z","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","_attachments":{},"homepage":"https://github.com/folktale/data.maybe#readme","bugs":{"url":"https://github.com/folktale/data.maybe/issues"},"license":"MIT"}