@sweet-monads/maybe
Advanced tools
Comparing version 2.3.0 to 2.3.1
@@ -34,3 +34,3 @@ import type { Monad, Alternative } from "@sweet-monads/interfaces"; | ||
static fromNullable<T>(v: T): Maybe<Exclude<T, null | undefined>>; | ||
static none<T>(): Maybe<T>; | ||
static none<T = never>(): Maybe<T>; | ||
static just<T>(v: T): Maybe<T>; | ||
@@ -37,0 +37,0 @@ private constructor(); |
@@ -21,11 +21,11 @@ "use strict"; | ||
static merge(maybies) { | ||
return maybies.reduce((res, v) => v.chain(v => res.map(res => res.concat([v]))), MaybeConstructor.just([])); | ||
return maybies.reduce((res, v) => res.chain(res => v.map(v => res.concat([v]))), MaybeConstructor.just([])); | ||
} | ||
static from(v) { | ||
return this.just(v); | ||
return MaybeConstructor.just(v); | ||
} | ||
static fromNullable(v) { | ||
return v !== null && v !== undefined | ||
? this.just(v) | ||
: this.none(); | ||
? MaybeConstructor.just(v) | ||
: MaybeConstructor.none(); | ||
} | ||
@@ -32,0 +32,0 @@ static none() { |
@@ -34,3 +34,3 @@ import type { Monad, Alternative } from "@sweet-monads/interfaces"; | ||
static fromNullable<T>(v: T): Maybe<Exclude<T, null | undefined>>; | ||
static none<T>(): Maybe<T>; | ||
static none<T = never>(): Maybe<T>; | ||
static just<T>(v: T): Maybe<T>; | ||
@@ -37,0 +37,0 @@ private constructor(); |
@@ -18,11 +18,11 @@ var MaybeState; | ||
static merge(maybies) { | ||
return maybies.reduce((res, v) => v.chain(v => res.map(res => res.concat([v]))), MaybeConstructor.just([])); | ||
return maybies.reduce((res, v) => res.chain(res => v.map(v => res.concat([v]))), MaybeConstructor.just([])); | ||
} | ||
static from(v) { | ||
return this.just(v); | ||
return MaybeConstructor.just(v); | ||
} | ||
static fromNullable(v) { | ||
return v !== null && v !== undefined | ||
? this.just(v) | ||
: this.none(); | ||
? MaybeConstructor.just(v) | ||
: MaybeConstructor.none(); | ||
} | ||
@@ -29,0 +29,0 @@ static none() { |
@@ -34,3 +34,3 @@ import type { Monad, Alternative } from "@sweet-monads/interfaces"; | ||
static fromNullable<T>(v: T): Maybe<Exclude<T, null | undefined>>; | ||
static none<T>(): Maybe<T>; | ||
static none<T = never>(): Maybe<T>; | ||
static just<T>(v: T): Maybe<T>; | ||
@@ -37,0 +37,0 @@ private constructor(); |
{ | ||
"name": "@sweet-monads/maybe", | ||
"version": "2.3.0", | ||
"version": "2.3.1", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "./cjs/index.js", |
@@ -12,6 +12,6 @@ # @sweet-monads/maybe | ||
- Check out all libraries: | ||
[either](https://github.com/JSMonk/sweet-monads/tree/master/either), | ||
[either](https://github.com/JSMonk/sweet-monads/tree/master/either), | ||
[iterator](https://github.com/JSMonk/sweet-monads/tree/master/iterator), | ||
[interfaces](https://github.com/JSMonk/sweet-monads/tree/master/interfaces), | ||
[maybe](https://github.com/JSMonk/sweet-monads/tree/master/maybe), | ||
[maybe](https://github.com/JSMonk/sweet-monads/tree/master/maybe) | ||
@@ -109,3 +109,3 @@ ## Usage | ||
```typescript | ||
const v1 = none(); // Maybe<unknown>.None | ||
const v1 = none(); // Maybe<never>.None | ||
const v2 = none<number>(); // Maybe<number>.None | ||
@@ -112,0 +112,0 @@ ``` |
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
28435
0