Skip to content

Commit

Permalink
Merge pull request #280 from fluture-js/avaq/resolve
Browse files Browse the repository at this point in the history
Add 'resolve' as an alias to 'of'
  • Loading branch information
Avaq committed Aug 30, 2018
2 parents db91a2e + c26c616 commit 04c3025
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -456,14 +456,18 @@ Future(function computation(reject, resolve){
<details><summary><code>of :: b -> Future a b</code></summary>

```hs
of :: b -> Future a b
Future.of :: b -> Future a b
of :: b -> Future a b
resolve :: b -> Future a b
Future.of :: b -> Future a b
Future.resolve :: b -> Future a b
```

</details>

Creates a Future which immediately resolves with the given value.

This function has an alias `resolve`.

```js
var eventualThing = Future.of('world');
eventualThing.fork(
Expand Down
6 changes: 5 additions & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,9 @@ declare module 'fluture' {
/** Create a Future with the given resolution value. See https://github.com/fluture-js/Fluture#of */
export function of<L, R>(value: R): FutureInstance<L, R>

/** Create a Future with the given resolution value. See https://github.com/fluture-js/Fluture#of */
export function resolve<L, R>(value: R): FutureInstance<L, R>

/** Logical or for Futures. See https://github.com/fluture-js/Fluture#or */
export function or<L, R>(left: FutureInstance<L, R>, right: FutureInstance<L, R>): FutureInstance<L, R>
export function or<L, R>(left: FutureInstance<L, R>): (right: FutureInstance<L, R>) => FutureInstance<L, R>
Expand Down Expand Up @@ -335,7 +338,8 @@ declare module 'fluture' {
bimap: typeof bimap
chain: typeof chain
map: typeof map
of: typeof of
of: typeof resolve
resolve: typeof resolve
reject: typeof reject

'@@type': string
Expand Down
2 changes: 1 addition & 1 deletion index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {FL} from './src/internal/const';
import {chainRec} from './src/chain-rec';
import {ap, map, bimap, chain, race, alt} from './src/dispatchers/index';

Future.of = Future[FL.of] = resolve;
Future.resolve = Future.of = Future[FL.of] = resolve;
Future.chainRec = Future[FL.chainRec] = chainRec;
Future.reject = reject;
Future.ap = ap;
Expand Down

0 comments on commit 04c3025

Please sign in to comment.