@sweet-monads/maybe
Advanced tools
Comparing version 2.0.0 to 2.1.0
{ | ||
"name": "@sweet-monads/maybe", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "", | ||
@@ -19,3 +19,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"@sweet-monads/interfaces": "^1.2.0" | ||
"@sweet-monads/interfaces": "^1.3.0" | ||
}, | ||
@@ -22,0 +22,0 @@ "author": "", |
@@ -42,2 +42,3 @@ # @sweet-monads/maybe | ||
- [`Maybe#isJust`](#maybeisjust) | ||
- [`Maybe#or`](#maybeor) | ||
- [`Maybe#join`](#maybejoin) | ||
@@ -150,2 +151,24 @@ - [`Maybe#map`](#maybemap) | ||
#### `Maybe#or` | ||
```typescript | ||
function or<T>(x: Maybe<T>): Maybe<T>; | ||
``` | ||
- Returns `Maybe<T>`. If state of `this` is `Just` then `this` will be returned otherwise `x` argument will be returned | ||
Example: | ||
```typescript | ||
const v1 = just(2); | ||
const v2 = none(); | ||
const v3 = none(); | ||
const v4 = none(); | ||
v1.or(v2) // v1 will be returned | ||
v2.or(v1) // v1 will be returned | ||
v2.or(v3) // v3 will be returned | ||
v1.or(v4) // v1 will be returned | ||
v2.or(v3).or(v1) // v1 will be returned | ||
v2.or(v1).or(v3) // v1 will be returned | ||
v1.or(v2).or(v3) // v1 will be returned | ||
``` | ||
#### `Maybe#join` | ||
@@ -152,0 +175,0 @@ ```typescript |
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
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
20011
5
223
309
1