From 8aec6e713d08a532194b50591fa338ecb9a251f9 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Tue, 10 Jun 2014 16:23:15 +0100 Subject: Basic support for footnotes --- lib/results.js | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib/results.js') diff --git a/lib/results.js b/lib/results.js index fe9f632..bd66430 100644 --- a/lib/results.js +++ b/lib/results.js @@ -14,6 +14,11 @@ Result.prototype.map = function(func) { return new Result(func(this.value), this.messages); }; +Result.prototype.flatMap = function(func) { + var funcResult = func(this.value); + return new Result(funcResult.value, combineMessages([this, funcResult])); +}; + Result.prototype.flatMapThen = function(func) { var that = this; return func(this.value).then(function(otherResult) { -- cgit v1.2.3