Comparing version 1.3.3 to 1.3.4
@@ -35,7 +35,7 @@ import { Either, EitherPatterns } from './Either'; | ||
/** Given two functions, maps the value that the Promise inside `this` resolves to using the first if it is `Left` or using the second one if it is `Right` */ | ||
bimap<L2, R2>(f: (value: L) => L2, g: (value: R) => R2): EitherAsync<L2, R2>; | ||
bimap<L2, R2>(f: (value: L) => L2, g: (value: R) => R2): EitherAsync<Awaited<L2>, Awaited<R2>>; | ||
/** Transforms the `Right` value of `this` with a given function. If the `EitherAsync` that is being mapped resolves to a Left then the mapping function won't be called and `run` will resolve the whole thing to that Left, just like the regular Either#map */ | ||
map<R2>(f: (value: R) => R2): EitherAsync<L, Awaited<R2>>; | ||
/** Maps the `Left` value of `this`, acts like an identity if `this` is `Right` */ | ||
mapLeft<L2>(f: (value: L) => L2): EitherAsync<L2, R>; | ||
mapLeft<L2>(f: (value: L) => L2): EitherAsync<Awaited<L2>, R>; | ||
/** Transforms `this` with a function that returns a `EitherAsync`. Behaviour is the same as the regular Either#chain */ | ||
@@ -56,7 +56,7 @@ chain<L2, R2>(f: (value: R) => PromiseLike<Either<L2, R2>>): EitherAsync<L | L2, R2>; | ||
/** Applies a `Right` function wrapped in `EitherAsync` over a future `Right` value. Returns `Left` if either the `this` resolves to a `Left` or the function is `Left` */ | ||
ap<L2, R2>(other: PromiseLike<Either<L2, (value: R) => R2>>): EitherAsync<L | L2, R2>; | ||
ap<L2, R2>(other: PromiseLike<Either<L2, (value: R) => R2>>): EitherAsync<L | L2, Awaited<R2>>; | ||
/** Returns the first `Right` between the future value of `this` and another `EitherAsync` or the `Left` in the argument if both `this` and the argument resolve to `Left` */ | ||
alt(other: EitherAsync<L, R>): EitherAsync<L, R>; | ||
/** Returns `this` if it resolves to a `Left`, otherwise it returns the result of applying the function argument to `this` and wrapping it in a `Right` */ | ||
extend<R2>(f: (value: EitherAsync<L, R>) => R2): EitherAsync<L, R2>; | ||
extend<R2>(f: (value: EitherAsync<L, R>) => R2): EitherAsync<L, Awaited<R2>>; | ||
/** Returns a Promise that resolves to the value inside `this` if it\'s `Left` or a default value if `this` is `Right` */ | ||
@@ -72,7 +72,7 @@ leftOrDefault(defaultValue: L): Promise<L>; | ||
'fantasy-land/map'<R2>(f: (value: R) => R2): EitherAsync<L, Awaited<R2>>; | ||
'fantasy-land/bimap'<L2, R2>(f: (value: L) => L2, g: (value: R) => R2): EitherAsync<L2, R2>; | ||
'fantasy-land/bimap'<L2, R2>(f: (value: L) => L2, g: (value: R) => R2): EitherAsync<Awaited<L2>, Awaited<R2>>; | ||
'fantasy-land/chain'<R2>(f: (value: R) => PromiseLike<Either<L, R2>>): EitherAsync<L, R2>; | ||
'fantasy-land/ap'<R2>(other: EitherAsync<L, (value: R) => R2>): EitherAsync<L, R2>; | ||
'fantasy-land/ap'<R2>(other: EitherAsync<L, (value: R) => R2>): EitherAsync<L, Awaited<R2>>; | ||
'fantasy-land/alt'(other: EitherAsync<L, R>): EitherAsync<L, R>; | ||
'fantasy-land/extend'<R2>(f: (value: EitherAsync<L, R>) => R2): EitherAsync<L, R2>; | ||
'fantasy-land/extend'<R2>(f: (value: EitherAsync<L, R>) => R2): EitherAsync<L, Awaited<R2>>; | ||
/** WARNING: This is implemented only for Promise compatibility. Please use `chain` instead. */ | ||
@@ -79,0 +79,0 @@ then: PromiseLike<Either<L, R>>['then']; |
@@ -407,1 +407,3 @@ "use strict"; | ||
EitherAsyncImpl.prototype.constructor = exports.EitherAsync; | ||
var workflow = getUserId().map(processFile); | ||
var result = exports.EitherAsync.liftEither(fileRequest).ap(workflow).join(); |
@@ -35,7 +35,7 @@ import { Either, EitherPatterns } from './Either'; | ||
/** Given two functions, maps the value that the Promise inside `this` resolves to using the first if it is `Left` or using the second one if it is `Right` */ | ||
bimap<L2, R2>(f: (value: L) => L2, g: (value: R) => R2): EitherAsync<L2, R2>; | ||
bimap<L2, R2>(f: (value: L) => L2, g: (value: R) => R2): EitherAsync<Awaited<L2>, Awaited<R2>>; | ||
/** Transforms the `Right` value of `this` with a given function. If the `EitherAsync` that is being mapped resolves to a Left then the mapping function won't be called and `run` will resolve the whole thing to that Left, just like the regular Either#map */ | ||
map<R2>(f: (value: R) => R2): EitherAsync<L, Awaited<R2>>; | ||
/** Maps the `Left` value of `this`, acts like an identity if `this` is `Right` */ | ||
mapLeft<L2>(f: (value: L) => L2): EitherAsync<L2, R>; | ||
mapLeft<L2>(f: (value: L) => L2): EitherAsync<Awaited<L2>, R>; | ||
/** Transforms `this` with a function that returns a `EitherAsync`. Behaviour is the same as the regular Either#chain */ | ||
@@ -56,7 +56,7 @@ chain<L2, R2>(f: (value: R) => PromiseLike<Either<L2, R2>>): EitherAsync<L | L2, R2>; | ||
/** Applies a `Right` function wrapped in `EitherAsync` over a future `Right` value. Returns `Left` if either the `this` resolves to a `Left` or the function is `Left` */ | ||
ap<L2, R2>(other: PromiseLike<Either<L2, (value: R) => R2>>): EitherAsync<L | L2, R2>; | ||
ap<L2, R2>(other: PromiseLike<Either<L2, (value: R) => R2>>): EitherAsync<L | L2, Awaited<R2>>; | ||
/** Returns the first `Right` between the future value of `this` and another `EitherAsync` or the `Left` in the argument if both `this` and the argument resolve to `Left` */ | ||
alt(other: EitherAsync<L, R>): EitherAsync<L, R>; | ||
/** Returns `this` if it resolves to a `Left`, otherwise it returns the result of applying the function argument to `this` and wrapping it in a `Right` */ | ||
extend<R2>(f: (value: EitherAsync<L, R>) => R2): EitherAsync<L, R2>; | ||
extend<R2>(f: (value: EitherAsync<L, R>) => R2): EitherAsync<L, Awaited<R2>>; | ||
/** Returns a Promise that resolves to the value inside `this` if it\'s `Left` or a default value if `this` is `Right` */ | ||
@@ -72,7 +72,7 @@ leftOrDefault(defaultValue: L): Promise<L>; | ||
'fantasy-land/map'<R2>(f: (value: R) => R2): EitherAsync<L, Awaited<R2>>; | ||
'fantasy-land/bimap'<L2, R2>(f: (value: L) => L2, g: (value: R) => R2): EitherAsync<L2, R2>; | ||
'fantasy-land/bimap'<L2, R2>(f: (value: L) => L2, g: (value: R) => R2): EitherAsync<Awaited<L2>, Awaited<R2>>; | ||
'fantasy-land/chain'<R2>(f: (value: R) => PromiseLike<Either<L, R2>>): EitherAsync<L, R2>; | ||
'fantasy-land/ap'<R2>(other: EitherAsync<L, (value: R) => R2>): EitherAsync<L, R2>; | ||
'fantasy-land/ap'<R2>(other: EitherAsync<L, (value: R) => R2>): EitherAsync<L, Awaited<R2>>; | ||
'fantasy-land/alt'(other: EitherAsync<L, R>): EitherAsync<L, R>; | ||
'fantasy-land/extend'<R2>(f: (value: EitherAsync<L, R>) => R2): EitherAsync<L, R2>; | ||
'fantasy-land/extend'<R2>(f: (value: EitherAsync<L, R>) => R2): EitherAsync<L, Awaited<R2>>; | ||
/** WARNING: This is implemented only for Promise compatibility. Please use `chain` instead. */ | ||
@@ -79,0 +79,0 @@ then: PromiseLike<Either<L, R>>['then']; |
@@ -188,1 +188,3 @@ "use strict"; | ||
EitherAsyncImpl.prototype.constructor = exports.EitherAsync; | ||
const workflow = getUserId().map(processFile); | ||
const result = exports.EitherAsync.liftEither(fileRequest).ap(workflow).join(); |
@@ -41,7 +41,7 @@ import { Maybe, MaybePatterns } from './Maybe'; | ||
/** Maps the future value of `this` with another future `Maybe` function */ | ||
ap<U>(maybeF: PromiseLike<Maybe<(value: T) => U>>): MaybeAsync<U>; | ||
ap<U>(maybeF: PromiseLike<Maybe<(value: T) => U>>): MaybeAsync<Awaited<U>>; | ||
/** Returns the first `Just` between the future value of `this` and another future `Maybe` or future `Nothing` if both `this` and the argument are `Nothing` */ | ||
alt(other: MaybeAsync<T>): MaybeAsync<T>; | ||
/** Returns `this` if it resolves to `Nothing`, otherwise it returns the result of applying the function argument to the value of `this` and wrapping it in a `Just` */ | ||
extend<U>(f: (value: MaybeAsync<T>) => U): MaybeAsync<U>; | ||
extend<U>(f: (value: MaybeAsync<T>) => U): MaybeAsync<Awaited<U>>; | ||
/** Takes a predicate function and returns `this` if the predicate, applied to the resolved value, is true or Nothing if it's false */ | ||
@@ -60,5 +60,5 @@ filter<U extends T>(pred: (value: T) => value is U): MaybeAsync<U>; | ||
'fantasy-land/chain'<U>(f: (value: T) => PromiseLike<Maybe<U>>): MaybeAsync<U>; | ||
'fantasy-land/ap'<U>(maybeF: MaybeAsync<(value: T) => U>): MaybeAsync<U>; | ||
'fantasy-land/ap'<U>(maybeF: MaybeAsync<(value: T) => U>): MaybeAsync<Awaited<U>>; | ||
'fantasy-land/alt'(other: MaybeAsync<T>): MaybeAsync<T>; | ||
'fantasy-land/extend'<U>(f: (value: MaybeAsync<T>) => U): MaybeAsync<U>; | ||
'fantasy-land/extend'<U>(f: (value: MaybeAsync<T>) => U): MaybeAsync<Awaited<U>>; | ||
'fantasy-land/filter'<U extends T>(pred: (value: T) => value is U): MaybeAsync<U>; | ||
@@ -65,0 +65,0 @@ 'fantasy-land/filter'(pred: (value: T) => boolean): MaybeAsync<T>; |
@@ -35,7 +35,7 @@ import { Either, EitherPatterns } from './Either'; | ||
/** Given two functions, maps the value that the Promise inside `this` resolves to using the first if it is `Left` or using the second one if it is `Right` */ | ||
bimap<L2, R2>(f: (value: L) => L2, g: (value: R) => R2): EitherAsync<L2, R2>; | ||
bimap<L2, R2>(f: (value: L) => L2, g: (value: R) => R2): EitherAsync<Awaited<L2>, Awaited<R2>>; | ||
/** Transforms the `Right` value of `this` with a given function. If the `EitherAsync` that is being mapped resolves to a Left then the mapping function won't be called and `run` will resolve the whole thing to that Left, just like the regular Either#map */ | ||
map<R2>(f: (value: R) => R2): EitherAsync<L, Awaited<R2>>; | ||
/** Maps the `Left` value of `this`, acts like an identity if `this` is `Right` */ | ||
mapLeft<L2>(f: (value: L) => L2): EitherAsync<L2, R>; | ||
mapLeft<L2>(f: (value: L) => L2): EitherAsync<Awaited<L2>, R>; | ||
/** Transforms `this` with a function that returns a `EitherAsync`. Behaviour is the same as the regular Either#chain */ | ||
@@ -56,7 +56,7 @@ chain<L2, R2>(f: (value: R) => PromiseLike<Either<L2, R2>>): EitherAsync<L | L2, R2>; | ||
/** Applies a `Right` function wrapped in `EitherAsync` over a future `Right` value. Returns `Left` if either the `this` resolves to a `Left` or the function is `Left` */ | ||
ap<L2, R2>(other: PromiseLike<Either<L2, (value: R) => R2>>): EitherAsync<L | L2, R2>; | ||
ap<L2, R2>(other: PromiseLike<Either<L2, (value: R) => R2>>): EitherAsync<L | L2, Awaited<R2>>; | ||
/** Returns the first `Right` between the future value of `this` and another `EitherAsync` or the `Left` in the argument if both `this` and the argument resolve to `Left` */ | ||
alt(other: EitherAsync<L, R>): EitherAsync<L, R>; | ||
/** Returns `this` if it resolves to a `Left`, otherwise it returns the result of applying the function argument to `this` and wrapping it in a `Right` */ | ||
extend<R2>(f: (value: EitherAsync<L, R>) => R2): EitherAsync<L, R2>; | ||
extend<R2>(f: (value: EitherAsync<L, R>) => R2): EitherAsync<L, Awaited<R2>>; | ||
/** Returns a Promise that resolves to the value inside `this` if it\'s `Left` or a default value if `this` is `Right` */ | ||
@@ -72,7 +72,7 @@ leftOrDefault(defaultValue: L): Promise<L>; | ||
'fantasy-land/map'<R2>(f: (value: R) => R2): EitherAsync<L, Awaited<R2>>; | ||
'fantasy-land/bimap'<L2, R2>(f: (value: L) => L2, g: (value: R) => R2): EitherAsync<L2, R2>; | ||
'fantasy-land/bimap'<L2, R2>(f: (value: L) => L2, g: (value: R) => R2): EitherAsync<Awaited<L2>, Awaited<R2>>; | ||
'fantasy-land/chain'<R2>(f: (value: R) => PromiseLike<Either<L, R2>>): EitherAsync<L, R2>; | ||
'fantasy-land/ap'<R2>(other: EitherAsync<L, (value: R) => R2>): EitherAsync<L, R2>; | ||
'fantasy-land/ap'<R2>(other: EitherAsync<L, (value: R) => R2>): EitherAsync<L, Awaited<R2>>; | ||
'fantasy-land/alt'(other: EitherAsync<L, R>): EitherAsync<L, R>; | ||
'fantasy-land/extend'<R2>(f: (value: EitherAsync<L, R>) => R2): EitherAsync<L, R2>; | ||
'fantasy-land/extend'<R2>(f: (value: EitherAsync<L, R>) => R2): EitherAsync<L, Awaited<R2>>; | ||
/** WARNING: This is implemented only for Promise compatibility. Please use `chain` instead. */ | ||
@@ -79,0 +79,0 @@ then: PromiseLike<Either<L, R>>['then']; |
@@ -185,1 +185,3 @@ var _a; | ||
EitherAsyncImpl.prototype.constructor = EitherAsync; | ||
const workflow = getUserId().map(processFile); | ||
const result = EitherAsync.liftEither(fileRequest).ap(workflow).join(); |
@@ -41,7 +41,7 @@ import { Maybe, MaybePatterns } from './Maybe'; | ||
/** Maps the future value of `this` with another future `Maybe` function */ | ||
ap<U>(maybeF: PromiseLike<Maybe<(value: T) => U>>): MaybeAsync<U>; | ||
ap<U>(maybeF: PromiseLike<Maybe<(value: T) => U>>): MaybeAsync<Awaited<U>>; | ||
/** Returns the first `Just` between the future value of `this` and another future `Maybe` or future `Nothing` if both `this` and the argument are `Nothing` */ | ||
alt(other: MaybeAsync<T>): MaybeAsync<T>; | ||
/** Returns `this` if it resolves to `Nothing`, otherwise it returns the result of applying the function argument to the value of `this` and wrapping it in a `Just` */ | ||
extend<U>(f: (value: MaybeAsync<T>) => U): MaybeAsync<U>; | ||
extend<U>(f: (value: MaybeAsync<T>) => U): MaybeAsync<Awaited<U>>; | ||
/** Takes a predicate function and returns `this` if the predicate, applied to the resolved value, is true or Nothing if it's false */ | ||
@@ -60,5 +60,5 @@ filter<U extends T>(pred: (value: T) => value is U): MaybeAsync<U>; | ||
'fantasy-land/chain'<U>(f: (value: T) => PromiseLike<Maybe<U>>): MaybeAsync<U>; | ||
'fantasy-land/ap'<U>(maybeF: MaybeAsync<(value: T) => U>): MaybeAsync<U>; | ||
'fantasy-land/ap'<U>(maybeF: MaybeAsync<(value: T) => U>): MaybeAsync<Awaited<U>>; | ||
'fantasy-land/alt'(other: MaybeAsync<T>): MaybeAsync<T>; | ||
'fantasy-land/extend'<U>(f: (value: MaybeAsync<T>) => U): MaybeAsync<U>; | ||
'fantasy-land/extend'<U>(f: (value: MaybeAsync<T>) => U): MaybeAsync<Awaited<U>>; | ||
'fantasy-land/filter'<U extends T>(pred: (value: T) => value is U): MaybeAsync<U>; | ||
@@ -65,0 +65,0 @@ 'fantasy-land/filter'(pred: (value: T) => boolean): MaybeAsync<T>; |
@@ -41,7 +41,7 @@ import { Maybe, MaybePatterns } from './Maybe'; | ||
/** Maps the future value of `this` with another future `Maybe` function */ | ||
ap<U>(maybeF: PromiseLike<Maybe<(value: T) => U>>): MaybeAsync<U>; | ||
ap<U>(maybeF: PromiseLike<Maybe<(value: T) => U>>): MaybeAsync<Awaited<U>>; | ||
/** Returns the first `Just` between the future value of `this` and another future `Maybe` or future `Nothing` if both `this` and the argument are `Nothing` */ | ||
alt(other: MaybeAsync<T>): MaybeAsync<T>; | ||
/** Returns `this` if it resolves to `Nothing`, otherwise it returns the result of applying the function argument to the value of `this` and wrapping it in a `Just` */ | ||
extend<U>(f: (value: MaybeAsync<T>) => U): MaybeAsync<U>; | ||
extend<U>(f: (value: MaybeAsync<T>) => U): MaybeAsync<Awaited<U>>; | ||
/** Takes a predicate function and returns `this` if the predicate, applied to the resolved value, is true or Nothing if it's false */ | ||
@@ -60,5 +60,5 @@ filter<U extends T>(pred: (value: T) => value is U): MaybeAsync<U>; | ||
'fantasy-land/chain'<U>(f: (value: T) => PromiseLike<Maybe<U>>): MaybeAsync<U>; | ||
'fantasy-land/ap'<U>(maybeF: MaybeAsync<(value: T) => U>): MaybeAsync<U>; | ||
'fantasy-land/ap'<U>(maybeF: MaybeAsync<(value: T) => U>): MaybeAsync<Awaited<U>>; | ||
'fantasy-land/alt'(other: MaybeAsync<T>): MaybeAsync<T>; | ||
'fantasy-land/extend'<U>(f: (value: MaybeAsync<T>) => U): MaybeAsync<U>; | ||
'fantasy-land/extend'<U>(f: (value: MaybeAsync<T>) => U): MaybeAsync<Awaited<U>>; | ||
'fantasy-land/filter'<U extends T>(pred: (value: T) => value is U): MaybeAsync<U>; | ||
@@ -65,0 +65,0 @@ 'fantasy-land/filter'(pred: (value: T) => boolean): MaybeAsync<T>; |
{ | ||
"name": "purify-ts", | ||
"version": "1.3.3", | ||
"version": "1.3.4", | ||
"description": "Functional programming standard library for TypeScript ", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/gigobyte/purify.git", |
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
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
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
340715
7576
1