Comparing version 10.2.0 to 10.3.0
@@ -66,2 +66,5 @@ declare module 'fluture' { | ||
/** Logical or for Futures. See https://github.com/fluture-js/Fluture#alt */ | ||
alt(right: FutureInstance<L, R>): FutureInstance<L, R> | ||
/** Apply the function in this Future to the value in another. See https://github.com/fluture-js/Fluture#ap */ | ||
@@ -115,3 +118,3 @@ ap<A, B>(this: FutureInstance<L, (value: A) => B>, right: FutureInstance<L, A>): FutureInstance<L, B> | ||
/** Logical or for Futures. See https://github.com/fluture-js/Fluture#or */ | ||
/** Logical or for Futures. See https://github.com/fluture-js/Fluture#alt */ | ||
or(right: FutureInstance<L, R>): FutureInstance<L, R> | ||
@@ -141,2 +144,6 @@ | ||
/** Logical or for Futures. See https://github.com/fluture-js/Fluture#alt */ | ||
export function alt<L, R>(left: FutureInstance<L, R>, right: FutureInstance<L, R>): FutureInstance<L, R> | ||
export function alt<L, R>(left: FutureInstance<L, R>): (right: FutureInstance<L, R>) => FutureInstance<L, R> | ||
/** Race two ConcurrentFutures. See https://github.com/fluture-js/Fluture#alt */ | ||
@@ -291,3 +298,3 @@ export function alt<L, R>(left: ConcurrentFutureInstance<L, R>, right: ConcurrentFutureInstance<L, R>): ConcurrentFutureInstance<L, R> | ||
/** Logical or for Futures. See https://github.com/fluture-js/Fluture#or */ | ||
/** Logical or for Futures. See https://github.com/fluture-js/Fluture#alt */ | ||
export function or<L, R>(left: FutureInstance<L, R>, right: FutureInstance<L, R>): FutureInstance<L, R> | ||
@@ -294,0 +301,0 @@ export function or<L, R>(left: FutureInstance<L, R>): (right: FutureInstance<L, R>) => FutureInstance<L, R> |
{ | ||
"name": "fluture", | ||
"version": "10.2.0", | ||
"version": "10.3.0", | ||
"description": "FantasyLand compliant (monadic) alternative to Promises", | ||
@@ -22,6 +22,7 @@ "main": "index", | ||
"release": "npm outdated --long; xyz --edit --repo git@github.com:fluture-js/Fluture.git --tag 'X.Y.Z' --script scripts/distribute --increment", | ||
"test": "npm run lint && npm run lint:readme && npm run test:unit && npm run test:types && npm run test:build", | ||
"test:unit": "npm run clean && mocha --require esm --ui bdd --reporter list --full-trace --check-leaks --bail test.js", | ||
"test:build": "npm run clean && npm run build && es-check es5 index.js && mocha --require esm --ui bdd --reporter dot --bail test-build.js", | ||
"test:coverage": "npm run clean && nyc --extension .mjs --include src mocha --require esm --ui bdd --reporter dot test.js || true", | ||
"test": "npm run lint && npm run lint:readme && npm run test:unit && npm run test:prop && npm run test:types && npm run test:build", | ||
"test:unit": "npm run clean && mocha --require esm --ui bdd --reporter list --full-trace --check-leaks --bail test/unit.js", | ||
"test:prop": "npm run clean && mocha --require esm --ui bdd --reporter list --full-trace --bail test/prop.js", | ||
"test:build": "npm run clean && npm run build && es-check es5 index.js && mocha --require esm --ui bdd --reporter dot --bail test/build.js", | ||
"test:coverage": "npm run clean && nyc --extension .mjs --include src mocha --require esm --ui bdd --reporter dot test/unit.js test/prop.js || true", | ||
"coverage:upload": "nyc report --reporter=text-lcov > coverage.lcov && codecov", | ||
@@ -67,3 +68,3 @@ "coverage:report": "nyc report --reporter=html", | ||
"codecov": "^3.0.0", | ||
"es-check": "^4.0.0", | ||
"es-check": "^5.0.0", | ||
"eslint": "^5.5.0", | ||
@@ -79,9 +80,9 @@ "eslint-config-warp": "^3.0.0", | ||
"nyc": "^13.0.1", | ||
"ramda": "^0.25.0", | ||
"ramda": "^0.26.1", | ||
"remark-cli": "^6.0.0", | ||
"remark-validate-links": "^7.1.0", | ||
"rimraf": "^2.6.2", | ||
"rollup": "^0.66.0", | ||
"rollup": "^0.67.0", | ||
"rollup-plugin-commonjs": "^9.1.6", | ||
"rollup-plugin-node-resolve": "^3.0.0", | ||
"rollup-plugin-node-resolve": "^4.0.0", | ||
"sanctuary-benchmark": "^1.0.0", | ||
@@ -88,0 +89,0 @@ "sanctuary-type-classes": "^9.0.0", |
@@ -107,3 +107,4 @@ # [![Fluture](logo.png)](#butterfly) | ||
* `Future` implements [Fantasy Land][FL] and [Static Land][6] -compatible | ||
`Bifunctor`, `Monad` and `ChainRec` (`of`, `ap`, `map`, `bimap`, `chain`, `chainRec`). | ||
`Alt`, `Bifunctor`, `Monad`, and `ChainRec` | ||
(`of`, `ap`, `alt`, `map`, `bimap`, `chain`, `chainRec`). | ||
All versions of Fantasy Land are supported. | ||
@@ -153,3 +154,3 @@ * `Future.Par` implements [Fantasy Land 3][FL] and [Static Land][6] -compatible | ||
- [`encase`: Convert a possibly throwing function to a Future function](#encase) | ||
- [`encaseP`: Convert a Promise-retuning function to a Future function](#encasep) | ||
- [`encaseP`: Convert a Promise-returning function to a Future function](#encasep) | ||
- [`encaseN`: Convert a Nodeback function to a Future function](#encasen) | ||
@@ -170,3 +171,3 @@ | ||
- [`tryP`: Create a Future using a Promise-returning function](#tryp) | ||
- [`encaseP`: Convert a Promise-retuning function to a Future function](#encasep) | ||
- [`encaseP`: Convert a Promise-returning function to a Future function](#encasep) | ||
- [`promise`: Convert a Future to a Promise](#promise) | ||
@@ -188,3 +189,3 @@ | ||
- [`and`: Logical *and* for Futures](#and) | ||
- [`or`: Logical *or* for Futures](#or) | ||
- [`alt`: Logical *or* for Futures](#alt) | ||
- [`finally`: Run a Future after the previous settles](#finally) | ||
@@ -213,2 +214,3 @@ - [`race`: Race two Futures against each other](#race) | ||
- [`ConcurrentFuture`: A separate data-type for doing algebraic concurrency](#concurrentfuture) | ||
- [`alt`: Behaves like `race` on `ConcurrentFuture` instances](#alt) | ||
@@ -1102,3 +1104,3 @@ </details> | ||
See also [`or`](#or) and [`finally`](#finally). | ||
See also [`alt`](#alt) and [`finally`](#finally). | ||
@@ -1122,9 +1124,13 @@ ```js | ||
#### or | ||
#### alt | ||
<details><summary><code>or :: Future a b -> Future a b -> Future a b</code></summary> | ||
<details><summary><code>alt :: Alt f => f a -> f a -> f a</code></summary> | ||
```hs | ||
or :: Future a b -> Future a b -> Future a b | ||
Future.prototype.or :: Future a b ~> Future a b -> Future a b | ||
alt :: Alt f => f a -> f a -> f a | ||
or :: Alt f => f a -> f a -> f a | ||
Future.alt :: Alt f => f a -> f a -> f a | ||
Par.alt :: Alt f => f a -> f a -> f a | ||
Future.prototype.alt :: Future a b ~> Future a b -> Future a b | ||
Future.prototype.or :: Future a b ~> Future a b -> Future a b | ||
``` | ||
@@ -1134,8 +1140,13 @@ | ||
Logical *or* for Futures. | ||
Select one of two [Alts](#types). | ||
Returns a new Future which either resolves with the first resolution value, or | ||
rejects with the last rejection value once and if both Futures reject. We can | ||
use it if we want a computation to run only if another has failed. | ||
Behaves like logical *or* on [`Future`](#future) instances, returning a new | ||
Future which either resolves with the first resolution value, or rejects with | ||
the last rejection reason. We can use it if we want a computation to run only | ||
if another has failed. | ||
Behaves like [`race`](#race) on [`ConcurrentFuture`](#concurrentfuture) instances. | ||
This function has an alias `or` for legacy reasons. | ||
See also [`and`](#and) and [`finally`](#finally). | ||
@@ -1145,3 +1156,3 @@ | ||
Future.rejectAfter(300, new Error('Failed')) | ||
.or(Future.of('hello')) | ||
.alt(Future.of('hello')) | ||
.fork(console.error, console.log); | ||
@@ -1156,3 +1167,3 @@ //> "hello" | ||
```js | ||
var any = ms => ms.reduce(Future.or, Future.reject('empty list')); | ||
var any = ms => ms.reduce(Future.alt, Future.reject('empty list')); | ||
any([Future.reject(1), Future.after(20, 2), Future.of(3)]).value(console.log); | ||
@@ -1187,3 +1198,3 @@ //> 2 | ||
See also [`and`](#and) and [`or`](#or). | ||
See also [`and`](#and) and [`alt`](#alt). | ||
@@ -1595,27 +1606,2 @@ ```js | ||
##### alt | ||
Select one of two [Alts](#types). In terms of the `ConcurrentFuture` | ||
type, this means racing the two against one another with the same | ||
semantics as [`race`](#race). | ||
<details><summary><code>alt :: Alt f => f a -> f a -> f a</code></summary> | ||
```hs | ||
alt :: Alt f => f a -> f a -> f a | ||
Par.alt :: Alt f => f a -> f a -> f a | ||
``` | ||
</details> | ||
```js | ||
import {Future, Par, seq, alt} from 'fluture'; | ||
seq(alt(Par.zero, Par.of(1))).value(console.log); | ||
//> 1 | ||
seq(alt(Par(Future.after(20, 1)), Future.after(10, 2))).value(console.log); | ||
//> 2 | ||
``` | ||
### Resource management | ||
@@ -1680,3 +1666,3 @@ | ||
```hs | ||
pipe :: Future a b ~> (Future a b -> c) -> c | ||
Future.prototype.pipe :: Future a b ~> (Future a b -> c) -> c | ||
``` | ||
@@ -1889,4 +1875,4 @@ | ||
[JS:Object.create]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign | ||
[JS:Object.assign]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create | ||
[JS:Object.create]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create | ||
[JS:Object.assign]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign | ||
[JS:Array.isArray]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray | ||
@@ -1893,0 +1879,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
231782
56
4448
1893