computation
Advanced tools
Comparing version 2.0.0-alpha.2 to 2.0.0-alpha.3
@@ -6,4 +6,4 @@ export default class Computation<T> { | ||
static pure<V>(value: V): Computation<V>; | ||
static fail<V>(e: Error): Computation<V>; | ||
static pending: Computation<any>; | ||
static fail(e: Error): Computation<never>; | ||
static pending: Computation<never>; | ||
then<V>(resolve: (value: T) => V, reject?: (err: Error) => V): Computation<V>; | ||
@@ -13,4 +13,4 @@ fmap<V>(f: (value: T) => V): Computation<V>; | ||
static liftA2<A, B, C>(a: Computation<A>, b: Computation<B>, f: (a: A, b: B) => C): Computation<C>; | ||
get(fallback: T): T; | ||
getf(fallback: () => T): T; | ||
get<A>(fallback: A): T | A; | ||
getf<A>(fallback: () => A): T | A; | ||
} |
@@ -55,3 +55,3 @@ "use strict"; | ||
return new Computation(() => { | ||
let av = a.fn(), bv = b.fn(); | ||
const av = a.fn(), bv = b.fn(); | ||
if (av !== Computation.Pending && bv !== Computation.Pending) { | ||
@@ -73,3 +73,3 @@ return f(av, bv); | ||
try { | ||
let result = this.fn(); | ||
const result = this.fn(); | ||
if (result === Computation.Pending) { | ||
@@ -96,3 +96,3 @@ return fallback(); | ||
// rather than a function because it doesn't have to be parametrized. | ||
Computation.pending = new Computation(() => Computation.Pending); | ||
Computation.pending = new Computation((() => Computation.Pending)); | ||
exports.default = Computation; |
{ | ||
"name": "computation", | ||
"version": "2.0.0-alpha.2+439afa9", | ||
"version": "2.0.0-alpha.3+eaa5207", | ||
"description": "A small JavaScript library to express computations", | ||
@@ -5,0 +5,0 @@ "main": "computation.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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
4209