Skip to content

Commit

Permalink
(!! re future) Renames mapRejection → mapRejected for consistency
Browse files Browse the repository at this point in the history
BREAKING CHANGE
  • Loading branch information
robotlolita committed May 3, 2017
1 parent c48d1c6 commit f43441b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@annotate: folktale.data.future._Future.prototype.mapRejection
@annotate: folktale.data.future._Future.prototype.mapRejected
category: Transforming
---

Expand All @@ -11,9 +11,9 @@ Transforms failure values in a Future without touching its state.


of(1).mapRejected(x => x + 1).listen({
Resolved: (x) => $ASSERT(x == 1)
onResolved: (x) => $ASSERT(x == 1)
});

rejected(1).mapRejected(x => x + 1).listen({
Rejected: (x) => $ASSERT(x == 2)
onRejected: (x) => $ASSERT(x == 2)
});
2 changes: 1 addition & 1 deletion src/data/future/_future.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ class Future {
* type: |
* (Future 'f 's).(('f) => 'f2) => Future 'f2 's
*/
mapRejection(transformation) {
mapRejected(transformation) {
return this.bimap(transformation, x => x);
}

Expand Down
12 changes: 6 additions & 6 deletions test/specs-src/data.future.es6
Original file line number Diff line number Diff line change
Expand Up @@ -302,16 +302,16 @@ describe('Data.Future', function() {
return cancelled().bimap(f, g) ::eq(cancelled());
});

property('#mapRejection(f) ignores successes', 'nat', 'nat -> nat', (a, f) => {
return Future.of(a).mapRejection(f) ::eq(Future.of(a));
property('#mapRejected(f) ignores successes', 'nat', 'nat -> nat', (a, f) => {
return Future.of(a).mapRejected(f) ::eq(Future.of(a));
});

property('#mapRejection(f) transforms rejections', 'nat', 'nat -> nat', (a, f) => {
return Future.rejected(a).mapRejection(f) ::eq(Future.rejected(f(a)));
property('#mapRejected(f) transforms rejections', 'nat', 'nat -> nat', (a, f) => {
return Future.rejected(a).mapRejected(f) ::eq(Future.rejected(f(a)));
});

property('#mapRejection(f) ignores cancellations', 'nat', 'nat -> nat', (a, f) => {
return cancelled().mapRejection(f) ::eq(cancelled());
property('#mapRejected(f) ignores cancellations', 'nat', 'nat -> nat', (a, f) => {
return cancelled().mapRejected(f) ::eq(cancelled());
});

property('#recover(f) ignores successes', 'nat', 'nat -> future nat', env, (a, f) => {
Expand Down

0 comments on commit f43441b

Please sign in to comment.