space-lift
Advanced tools
Comparing version 0.8.0 to 0.8.1
@@ -56,2 +56,6 @@ import { Wrapper, ArrayOps } from '../lift'; | ||
/** | ||
* Returns whether this option is a Some with a value satisfying the predicate. | ||
*/ | ||
exists(predicate: (a: A) => boolean): boolean; | ||
/** | ||
* Converts this Option to an Array. | ||
@@ -58,0 +62,0 @@ */ |
@@ -37,2 +37,3 @@ "use strict"; | ||
self.getOrElse = function (alt) { return alt; }; | ||
self.exists = function () { return false; }; | ||
self.toArray = function () { return lift_1["default"]([]); }; | ||
@@ -76,2 +77,5 @@ self.toResult = function (ifNone) { return result_1.Err(ifNone()); }; | ||
}, | ||
exists: function (predicate) { | ||
return predicate(this.value); | ||
}, | ||
toArray: function () { | ||
@@ -78,0 +82,0 @@ return lift_1["default"]([this.value]); |
@@ -56,2 +56,6 @@ import { Wrapper, ArrayOps } from '../lift'; | ||
/** | ||
* Returns whether this option is a Some with a value satisfying the predicate. | ||
*/ | ||
exists(predicate: (a: A) => boolean): boolean; | ||
/** | ||
* Converts this Option to an Array. | ||
@@ -58,0 +62,0 @@ */ |
@@ -35,2 +35,3 @@ import lift, { getValue } from '../lift'; | ||
self.getOrElse = function (alt) { return alt; }; | ||
self.exists = function () { return false; }; | ||
self.toArray = function () { return lift([]); }; | ||
@@ -74,2 +75,5 @@ self.toResult = function (ifNone) { return Err(ifNone()); }; | ||
}, | ||
exists: function (predicate) { | ||
return predicate(this.value); | ||
}, | ||
toArray: function () { | ||
@@ -76,0 +80,0 @@ return lift([this.value]); |
{ | ||
"name": "space-lift", | ||
"version": "0.8.0", | ||
"version": "0.8.1", | ||
"description": "Idiomatic TS array, object utils, Option, Result monads", | ||
@@ -26,7 +26,7 @@ | ||
"dependencies": { | ||
"immupdate": "1.2.0" | ||
"immupdate": "1.2.3" | ||
}, | ||
"devDependencies": { | ||
"typescript": "2.9.2", | ||
"typescript": "3.1.1", | ||
"mocha": "3.0.2", | ||
@@ -33,0 +33,0 @@ "expect": "1.8.0" |
@@ -235,2 +235,3 @@ **space-lift** | ||
* [forEach](#option.forEach) | ||
* [exists](#option.exists) | ||
* [toArray](#option.toArray) | ||
@@ -408,6 +409,13 @@ | ||
<a name="option.exists"></a> | ||
#### exists | ||
Returns whether this option is a Some with a value satisfying the predicate. | ||
```ts | ||
Option(30).exists(n => n > 10) // true | ||
``` | ||
<a name="api.result"></a> | ||
@@ -414,0 +422,0 @@ ## Result |
163290
4318
544
+ Addedimmupdate@1.2.3(transitive)
- Removedimmupdate@1.2.0(transitive)
Updatedimmupdate@1.2.3