diff options
| author | Michael Williamson <mike@zwobble.org> | 2014-06-10 16:23:15 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2014-06-10 16:23:15 +0100 |
| commit | 8aec6e713d08a532194b50591fa338ecb9a251f9 (patch) | |
| tree | 00004b0324527dac50add38cdf6ac39cec604227 /lib/results.js | |
| parent | ee2fc5da880df5f9ea8cdaebc506d130c3009ce3 (diff) | |
Basic support for footnotes
Diffstat (limited to 'lib/results.js')
| -rw-r--r-- | lib/results.js | 5 |
1 files changed, 5 insertions, 0 deletions
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) { |
