{"_id":"option","_rev":"10-8fe8a5582327bd1b1951d798168f7f58","name":"option","description":"The option type, also known as the maybe type, for JavaScript","dist-tags":{"latest":"0.2.4"},"versions":{"0.2.0":{"name":"option","version":"0.2.0","dependencies":{},"devDependencies":{"nodeunit":"latest"},"keywords":["option","maybe"],"_id":"option@0.2.0","description":"An implementation of the option type, sometimes known as the maybe type.","dist":{"shasum":"c35a43a6f580ca775bf913fad7f2ccd36ed21c65","tarball":"https://registry.npmjs.org/option/-/option-0.2.0.tgz","integrity":"sha512-xtJIEi7xK0s0VSWoNtlLQQlGy/CA0ljivk7vA3FO7mLDsvFRKWsvKBmWjxRqaLdm3BMleozSPdevEU+zWNRkqQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDKvnrjqX6UBCX2yaJ2rPZfNqukO44AKMYpfpYb+bOCygIhAM2WTT7n4LbCv70vZYymBf338mKMCffuspkqIkY/Seb0"}]},"maintainers":[{"name":"mwilliamson","email":"mike@zwobble.org"}]},"0.2.1":{"name":"option","version":"0.2.1","author":{"name":"Michael Williamson","email":"mike@zwobble.org"},"description":"The option type, also known as the maybe type, for JavaScript","license":"BSD","repository":{"type":"git","url":"https://github.com/mwilliamson/node-options.git"},"dependencies":{},"devDependencies":{"nodeunit":"latest"},"keywords":["option","maybe"],"_id":"option@0.2.1","dist":{"shasum":"7d65ced92bd052cefe50b20d9461898dd7f17ec0","tarball":"https://registry.npmjs.org/option/-/option-0.2.1.tgz","integrity":"sha512-d22AyUJW8esxhF1FBJ9a5NIzBOYD8A9Hx/pCI2AlP1/pBndnjW71g1TaDLzmqnZe+TVgWAT3lC4YJzaMnOtZAw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICQZvV1LaT6jKMSMNyuwjhnQge3zGhcaEOWTw1w2e2K5AiAbHfe4An5p1QRUXxhYa7jEdyqipF50xiF1SQ/SV+7N0Q=="}]},"_from":".","_npmVersion":"1.2.14","_npmUser":{"name":"mwilliamson","email":"mike@zwobble.org"},"maintainers":[{"name":"mwilliamson","email":"mike@zwobble.org"}]},"0.2.2":{"name":"option","version":"0.2.2","author":{"name":"Michael Williamson","email":"mike@zwobble.org"},"description":"The option type, also known as the maybe type, for JavaScript","license":"BSD","scripts":{"test":"nodeunit test"},"repository":{"type":"git","url":"https://github.com/mwilliamson/node-options.git"},"dependencies":{},"devDependencies":{"nodeunit":"latest"},"keywords":["option","maybe"],"bugs":{"url":"https://github.com/mwilliamson/node-options/issues"},"homepage":"https://github.com/mwilliamson/node-options","_id":"option@0.2.2","dist":{"shasum":"95d0a962814d52a84787c77aae3ebd9b5e7d3f78","tarball":"https://registry.npmjs.org/option/-/option-0.2.2.tgz","integrity":"sha512-XrskAkRPM9I9wg/N4j4rmcMY6UAfh2175bP0g3ooi9mp0mryY/DFeivGmEW6paVgjtle652OZr/OuaoPtiJdeQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDGfEoTyDfNN4wb0mBskhX+bSVnJKEJTX68HCOUx4tBDwIhAI8LFGzAuRUh5plU9fmSNx/dKO1gYHaTWDlNGV7j36bg"}]},"_from":".","_npmVersion":"1.4.3","_npmUser":{"name":"mwilliamson","email":"mike@zwobble.org"},"maintainers":[{"name":"mwilliamson","email":"mike@zwobble.org"}]},"0.2.3":{"name":"option","version":"0.2.3","author":{"name":"Michael Williamson","email":"mike@zwobble.org"},"description":"The option type, also known as the maybe type, for JavaScript","license":"BSD","scripts":{"test":"nodeunit test"},"repository":{"type":"git","url":"https://github.com/mwilliamson/node-options.git"},"dependencies":{},"devDependencies":{"nodeunit":"latest"},"keywords":["option","maybe"],"bugs":{"url":"https://github.com/mwilliamson/node-options/issues"},"homepage":"https://github.com/mwilliamson/node-options","_id":"option@0.2.3","dist":{"shasum":"605ea40fb982522cf3fb132a6c6d9bd147cd0db4","tarball":"https://registry.npmjs.org/option/-/option-0.2.3.tgz","integrity":"sha512-HMDnpChJOMp5zG9BbKd7ZtvTLZnM/ied9SaBVdYCRlgw29by1dZJH5fB0vSI7W3WH+Tnxo96qoinH53Z/x9o1g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDL7fevTm0C9cRnMZPcn9qg/vlWKP96Ld4AEJmPHRab+AiAjw3dZVNTCSlNbSX2AVglJ0F61N3Wp5DIqBVMUnq/kGw=="}]},"_from":".","_npmVersion":"1.4.3","_npmUser":{"name":"mwilliamson","email":"mike@zwobble.org"},"maintainers":[{"name":"mwilliamson","email":"mike@zwobble.org"}],"_npmOperationalInternal":{"host":"packages-9-west.internal.npmjs.com","tmp":"tmp/option-0.2.3.tgz_1456426869491_0.7838449715636671"}},"0.2.4":{"name":"option","version":"0.2.4","author":{"name":"Michael Williamson","email":"mike@zwobble.org"},"description":"The option type, also known as the maybe type, for JavaScript","license":"BSD-2-Clause","scripts":{"test":"nodeunit test"},"repository":{"type":"git","url":"https://github.com/mwilliamson/node-options.git"},"dependencies":{},"devDependencies":{"nodeunit":"latest"},"keywords":["option","maybe"],"bugs":{"url":"https://github.com/mwilliamson/node-options/issues"},"homepage":"https://github.com/mwilliamson/node-options","_id":"option@0.2.4","dist":{"shasum":"fd475cdf98dcabb3cb397a3ba5284feb45edbfe4","tarball":"https://registry.npmjs.org/option/-/option-0.2.4.tgz","integrity":"sha512-pkEqbDyl8ou5cpq+VsnQbe/WlEy5qS7xPzMS1U55OCG9KPvwFD46zDbxQIj3egJSFc3D+XhYOPUzz49zQAVy7A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDe++AxEI9NtjwTrmDIS5DdYC7iuPO+S3E7i70sGXzf9gIgTTNitsRHlldnid5Y0w3U02MqvB0W3Sx0ng1MZJpCM0A="}]},"_from":".","_npmVersion":"1.4.3","_npmUser":{"name":"mwilliamson","email":"mike@zwobble.org"},"maintainers":[{"name":"mwilliamson","email":"mike@zwobble.org"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/option-0.2.4.tgz_1498212241831_0.6175427781417966"}}},"readme":"# options for node.js\n\nAn implementation of the option type, sometimes known as the maybe type.\n\nAn instance of an option type is an optional value. Either it's `none`, or an\ninstance of `Some`:\n\n```javascript\nvar option = require(\"option\");\n\nvar some = option.some(\"Bob\");\nvar none = option.none;\n``` \n\nA function that returns an optional string isn't that different from a function\nthat returns a string or `null`. The advantage over null is that options\nprovide a number of functions that help with manipulating optional values.\n\n```javascript\n function greet(user) {\n return \"Hello \" + user.name().valueOrElse(\"Anonymous\");\n }\n```\n\n## Methods\n\n### isNone() and isSome()\n\n* `some(value).isNone()` returns `false`\n* `some(value).isSome()` returns `true`\n* `none.isNone()` returns `true`\n* `none.isSome()` returns `false`\n\n### value()\n\n* `some(value).value()` returns `value`\n* `none.value()` throws an error\n\n### map(*func*)\n\n* `some(value).map(func)` returns `some(func(value))`\n* `none.map(func)` returns `none`\n\n### flatMap(*func*)\n\nConventionally used when `func` returns another option.\n\n* `some(value).flatMap(func)` returns `func(value)`\n* `none.flatMap(func)` returns `none`\n\n### filter(*predicate*)\n\n* `some(value).filter(predicate)` returns:\n * `some(value)` if `predicate(value) === true`\n * `none` if `predicate(value) === false`\n* `none.filter(predicate)` returns `none`\n\n### toArray()\n\n* `some(value).toArray()` returns `[some]`\n* `none.toArray()` returns `[]`\n\n### orElse(*other*)\n\nIf `other` is a function (`other` conventionally returning another option):\n\n* `some(value).orElse(other)` returns `some(value)`\n* `none.orElse(other)` returns `other()`\n\nIf `other` is not a function (`other` conventionally being another option):\n\n* `some(value).orElse(other)` returns `some(value)`\n* `none.orElse(other)` returns `other`\n\n### valueOrElse(*other*)\n\nIf `other` is a function:\n\n* `some(value).valueOrElse(other)` returns `value`\n* `none.valueOrElse(other)` returns `other()`\n\nIf `other` is not a function:\n\n* `some(value).valueOrElse(other)` returns `value`\n* `none.valueOrElse(other)` returns `other`\n\n## Functions\n\n### option.isOption(*value*)\n\n* `option.isOption(value)` returns `true` if `value` is `option.none` or `option.some(x)`.\n\n### option.fromNullable(*value*)\n\n* If `value` is `null` or `undefined`, `option.fromNullable(value)` returns `option.none`.\n* Otherwise, returns `option.some(value)`.\n For instance, `option.fromNullable(5)` returns `option.some(5)`.\n\n## Installation\n\n npm install option\n","maintainers":[{"name":"mwilliamson","email":"mike@zwobble.org"}],"time":{"modified":"2022-06-23T01:17:15.449Z","created":"2012-08-25T21:39:32.511Z","0.2.0":"2012-08-25T21:39:34.536Z","0.2.1":"2013-04-14T11:36:32.149Z","0.2.2":"2015-06-12T21:34:16.507Z","0.2.3":"2016-02-25T19:01:12.216Z","0.2.4":"2017-06-23T10:04:02.764Z"},"author":{"name":"Michael Williamson","email":"mike@zwobble.org"},"repository":{"type":"git","url":"https://github.com/mwilliamson/node-options.git"},"homepage":"https://github.com/mwilliamson/node-options","keywords":["option","maybe"],"bugs":{"url":"https://github.com/mwilliamson/node-options/issues"},"license":"BSD-2-Clause","readmeFilename":"README.md"}