@sweet-monads/maybe
Advanced tools
Comparing version 1.3.0 to 1.3.1
26
index.js
@@ -52,18 +52,24 @@ "use strict"; | ||
Maybe.prototype.apply = function (argOrFn) { | ||
if (isWrappedFunction(this) && !isWrappedFunction(argOrFn)) { | ||
if (this.isJust()) { | ||
return argOrFn.map(this.value); | ||
} | ||
if (this.isNone() || argOrFn.isNone()) { | ||
return Maybe.none(); | ||
} | ||
return argOrFn.apply(this); | ||
if (isWrappedFunction(this)) { | ||
return argOrFn.map(this.value); | ||
} | ||
if (isWrappedFunction(argOrFn)) { | ||
return argOrFn.apply(this); | ||
} | ||
throw new Error("Some of the arguments should be a function"); | ||
}; | ||
Maybe.prototype.asyncApply = function (argOrFn) { | ||
if (isWrappedFunction(this) && !isWrappedFunction(argOrFn)) { | ||
if (this.isJust()) { | ||
return argOrFn.asyncMap(this.value); | ||
} | ||
if (this.isNone() || argOrFn.isNone()) { | ||
return Promise.resolve(Maybe.none()); | ||
} | ||
return argOrFn.asyncApply(this); | ||
if (isWrappedFunction(this)) { | ||
return argOrFn.asyncMap(this.value); | ||
} | ||
if (isWrappedFunction(argOrFn)) { | ||
return argOrFn.asyncApply(this); | ||
} | ||
throw new Error("Some of the arguments should be a function"); | ||
}; | ||
@@ -70,0 +76,0 @@ Maybe.prototype.chain = function (f) { |
{ | ||
"name": "@sweet-monads/maybe", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
14780
120
0