monads.maybe
Advanced tools
Comparing version 0.2.1 to 0.3.0
@@ -23,6 +23,2 @@ // Generated by LiveScript 1.2.0 | ||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
* | ||
* + module: monads.maybe | ||
* + author: Quildreen Motta | ||
* + exports: Maybe | ||
*/ | ||
@@ -29,0 +25,0 @@ (function(){ |
{ | ||
"name": "monads.maybe", | ||
"version": "0.2.1", | ||
"version": "0.3.0", | ||
"description": "A monad for values that may not be available or computations that may fail.", | ||
@@ -28,4 +28,4 @@ "main": "lib/index.js", | ||
"devDependencies": { | ||
"browserify": "~2.35.4", | ||
"groc": "git://github.com/killdream/groc#patch-livescript", | ||
"browserify": "git://github.com/robotlolita/node-browserify", | ||
"groc": "git://github.com/robotlolita/groc#typography", | ||
"LiveScript": "~1.2.0", | ||
@@ -32,0 +32,0 @@ "hifive-tap": "~0.1.0", |
@@ -39,3 +39,4 @@ Monads: Maybe | ||
// Call a function only if both a and b have values (sequencing) | ||
// Call a function only if both a and b | ||
// have values (sequencing) | ||
a.chain(function(x) { | ||
@@ -48,8 +49,12 @@ return b.chain(function(y) { | ||
// Transform values only if they're available: | ||
a.map(function(x){ return x + 1 }) // Maybe.Nothing | ||
b.map(function(x){ return x + 1 }) // Maybe.Just(1) | ||
a.map(function(x){ return x + 1 }) | ||
// => Maybe.Nothing | ||
b.map(function(x){ return x + 1 }) | ||
// => Maybe.Just(1) | ||
// Use a default value if no value is present | ||
a.orElse(function(){ return Maybe.Just(-1) }) // Maybe.Just(-1) | ||
b.orElse(function(){ return Maybe.Just(-1) }) // Maybe.Just(0) | ||
a.orElse(function(){ return Maybe.Just(-1) }) | ||
// => Maybe.Just(-1) | ||
b.orElse(function(){ return Maybe.Just(-1) }) | ||
// => Maybe.Just(0) | ||
``` | ||
@@ -61,3 +66,3 @@ | ||
The easiest way is to grab it from NPM. If you're running in a Browser | ||
environment, you can use [Browserify][] | ||
environment, you can use [Browserify][]: | ||
@@ -92,3 +97,3 @@ $ npm install monads.maybe | ||
[Download the latest release][release], and load the `monads.maybe.umd.js` | ||
file. The properties are exposed in the global `Maybe` object: | ||
file. The properties are exposed in the global `folktale.monads.Maybe` object: | ||
@@ -109,7 +114,7 @@ ```html | ||
$ make bundle | ||
This will generate the `dist/monads.maybe.umd.js` file, which you can load in | ||
any JavaScript environment. | ||
## Documentation | ||
@@ -142,3 +147,3 @@ | ||
[Browserify]: http://browserify.org/ | ||
[release]: https://github.com/folktale/monads.maybe/releases/download/v0.2.1/monads.maybe-0.2.1.tar.gz | ||
[release]: https://github.com/folktale/monads.maybe/releases/download/v0.3.0/monads.maybe-0.3.0.tar.gz | ||
[Git]: http://git-scm.com/ | ||
@@ -145,0 +150,0 @@ [Make]: http://www.gnu.org/software/make/ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
21
148
0
226171
1794