@thisisagile/easy
Advanced tools
Comparing version 1.8.8 to 1.8.9
@@ -26,10 +26,9 @@ "use strict"; | ||
exports.isRestResult = isRestResult; | ||
const toRestResult = (payload) => { | ||
return utils_1.choose(payload) | ||
.case(p => !p, () => data()) | ||
.case(p => p.data && p.data.items, p => data(p.data.items)) | ||
.case(p => p.error && p.error.errors, p => error(p.error.errors)) | ||
.else(p => data(List_1.toList(p))); | ||
}; | ||
const toRestResult = (payload) => utils_1.choose(payload) | ||
.case(p => !p, () => data()) | ||
.case(p => types_1.isResult(p), p => error([p])) | ||
.case(p => p.error && p.error.errors, p => error(p.error.errors)) | ||
.case(p => p.data && p.data.items, p => data(p.data.items)) | ||
.else(p => data(List_1.toList(p))); | ||
exports.toRestResult = toRestResult; | ||
//# sourceMappingURL=RestResult.js.map |
{ | ||
"name": "@thisisagile/easy", | ||
"version": "1.8.8", | ||
"version": "1.8.9", | ||
"description": "Straightforward library for building domain-driven microservice architectures", | ||
@@ -5,0 +5,0 @@ "author": "Sander Hoogendoorn", |
@@ -1,2 +0,2 @@ | ||
import { isDefined, Json, Result } from '../types'; | ||
import { isDefined, isResult, Json, Result } from '../types'; | ||
import { choose } from '../utils'; | ||
@@ -29,8 +29,8 @@ import { list, List, toList } from '../types/List'; | ||
export const toRestResult = (payload?: any | any[]): RestResult => { | ||
return choose<RestResult, any>(payload) | ||
export const toRestResult = (payload?: any | any[]): RestResult => | ||
choose<RestResult, any>(payload) | ||
.case(p => !p, () => data()) | ||
.case(p => isResult(p), p => error([p])) | ||
.case(p => p.error && p.error.errors, p => error(p.error.errors)) | ||
.case(p => p.data && p.data.items, p => data(p.data.items)) | ||
.case(p => p.error && p.error.errors, p => error(p.error.errors)) | ||
.else(p => data(toList(p))); | ||
}; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
108108
1628