Comparing version 0.16.2 to 0.16.3
12
Codec.js
@@ -366,3 +366,3 @@ "use strict"; | ||
type: 'array', | ||
items: [codec.schema()] | ||
items: codec.schema() | ||
}); } | ||
@@ -479,7 +479,7 @@ }); | ||
encode: function (input) { return input.map(codec.encode).orDefault(undefined); }, | ||
schema: function () { return ({ | ||
oneOf: isEmptySchema(codec.schema()) | ||
? [] | ||
: [codec.schema(), { type: 'null' }] | ||
}); } | ||
schema: function () { | ||
return isEmptySchema(codec.schema()) | ||
? {} | ||
: { oneOf: [codec.schema(), { type: 'null' }] }; | ||
} | ||
}); | ||
@@ -486,0 +486,0 @@ return __assign(__assign({}, baseCodec), { _isOptional: true }); |
@@ -31,3 +31,3 @@ import { Maybe } from './Maybe'; | ||
/** The same as Either#chain but executes the transformation function only if the value is Left. Useful for recovering from errors */ | ||
chainLeft<L2>(f: (value: L) => Either<L2, R>): Either<L2, R>; | ||
chainLeft<L2, R2>(f: (value: L) => Either<L2, R2>): Either<L2, R | R2>; | ||
/** Flattens nested Eithers. `e.join()` is equivalent to `e.chain(x => x)` */ | ||
@@ -37,2 +37,4 @@ join<R2>(this: Either<L, Either<L, R2>>): Either<L, R2>; | ||
alt(other: Either<L, R>): Either<L, R>; | ||
/** Lazy version of `alt` */ | ||
altLazy(other: () => Either<L, R>): Either<L, R>; | ||
/** Takes a reducer and an initial value and returns the initial value if `this` is `Left` or the result of applying the function to the initial value and the value inside `this` */ | ||
@@ -39,0 +41,0 @@ reduce<T>(reducer: (accumulator: T, value: R) => T, initialValue: T): T; |
@@ -151,2 +151,5 @@ "use strict"; | ||
}; | ||
Right.prototype.altLazy = function (_) { | ||
return this; | ||
}; | ||
Right.prototype.reduce = function (reducer, initialValue) { | ||
@@ -255,2 +258,5 @@ return reducer(initialValue, this.__value); | ||
}; | ||
Left.prototype.altLazy = function (other) { | ||
return other(); | ||
}; | ||
Left.prototype.reduce = function (_, initialValue) { | ||
@@ -257,0 +263,0 @@ return initialValue; |
@@ -43,3 +43,3 @@ import { Either } from './Either'; | ||
/** The same as EitherAsync#chain but executes the transformation function only if the value is Left. Useful for recovering from errors */ | ||
chainLeft<L2>(f: (value: L) => PromiseLike<Either<L2, R>>): EitherAsync<L2, R>; | ||
chainLeft<L2, R2>(f: (value: L) => PromiseLike<Either<L2, R2>>): EitherAsync<L2, R | R2>; | ||
/** Flattens nested `EitherAsync`s. `e.join()` is equivalent to `e.chain(x => x)` */ | ||
@@ -46,0 +46,0 @@ join<R2>(this: EitherAsync<L, EitherAsync<L, R2>>): EitherAsync<L, R2>; |
@@ -28,2 +28,4 @@ import { Either } from './Either'; | ||
alt(other: Maybe<T>): Maybe<T>; | ||
/** Lazy version of `alt` */ | ||
altLazy(other: () => Maybe<T>): Maybe<T>; | ||
/** Transforms `this` with a function that returns a `Maybe`. Useful for chaining many computations that may result in a missing value */ | ||
@@ -115,2 +117,3 @@ chain<U>(f: (value: T) => Maybe<U>): Maybe<U>; | ||
alt<T>(other: Maybe<T>): Maybe<T>; | ||
altLazy<T>(other: () => Maybe<T>): Maybe<T>; | ||
chain<U>(_: (value: never) => Maybe<U>): Maybe<U>; | ||
@@ -117,0 +120,0 @@ chainNullable<U>(_: (value: never) => U | undefined | null | void): Maybe<U>; |
@@ -151,2 +151,5 @@ "use strict"; | ||
}; | ||
Just.prototype.altLazy = function (_) { | ||
return this; | ||
}; | ||
Just.prototype.chain = function (f) { | ||
@@ -244,2 +247,5 @@ return f(this.__value); | ||
}; | ||
Nothing.prototype.altLazy = function (other) { | ||
return other(); | ||
}; | ||
Nothing.prototype.chain = function (_) { | ||
@@ -246,0 +252,0 @@ return nothing; |
{ | ||
"name": "purify-ts", | ||
"version": "0.16.2", | ||
"version": "0.16.3", | ||
"description": "Functional programming standard library for TypeScript ", | ||
@@ -30,7 +30,9 @@ "main": "index.js", | ||
"devDependencies": { | ||
"@types/jest": "26.0.22", | ||
"@types/jest": "26.0.23", | ||
"ajv": "8.2.0", | ||
"ajv-formats": "2.1.0", | ||
"coveralls": "3.1.0", | ||
"jest": "26.6.3", | ||
"prettier": "2.2.1", | ||
"ts-jest": "26.5.4", | ||
"ts-jest": "26.5.6", | ||
"typescript": "4.2.4" | ||
@@ -37,0 +39,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
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
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
482708
79
9857
8