diff options
| author | Michael Williamson <mike@zwobble.org> | 2013-04-18 20:07:23 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2013-04-18 20:07:23 +0100 |
| commit | 554e939ed6f3ce697fca925a333cb9fc14ccbe5a (patch) | |
| tree | a777f5c2fb2b67066196951a7d954c16c6ba12fd /lib/results.js | |
| parent | 58d57f995fcf2077c3c4147dfc637cb1759de98b (diff) | |
Return Result from document-to-HTML conversion
Diffstat (limited to 'lib/results.js')
| -rw-r--r-- | lib/results.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/results.js b/lib/results.js index 5bd81c0..d5dd7af 100644 --- a/lib/results.js +++ b/lib/results.js @@ -11,10 +11,10 @@ Result.prototype.map = function(func) { return new Result(func(this.value), this.messages); }; -Result.prototype.mapThen = function(func) { +Result.prototype.flatMapThen = function(func) { var messages = this.messages; - return func(this.value).then(function(resultValue) { - return new Result(resultValue, messages); + return func(this.value).then(function(otherResult) { + return new Result(otherResult.value, messages.concat(otherResult.messages)); }); }; |
