computation
Advanced tools
Comparing version 2.0.0 to 2.0.1-alpha.1
@@ -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", | ||
"version": "2.0.1-alpha.1+5a5439e", | ||
"description": "A small JavaScript library to express computations", | ||
@@ -18,11 +18,3 @@ "main": "computation.js", | ||
"url": "https://github.com/wereHamster/computation/issues" | ||
}, | ||
"devDependencies": { | ||
"@types/chai": "^4.1.4", | ||
"@types/mocha": "^5.2.5", | ||
"chai": "^4.1.2", | ||
"mocha": "^2.3.4", | ||
"tslint": "^5.11.0", | ||
"typescript": "^3.0.1" | ||
} | ||
} |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
0
4209
2
1