Last active
January 2, 2020 21:49
-
-
Save nadeesha/a86f9b8b27d44879a63aebd773599b57 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const successNoContent = [ | |
(data: string) => data.length === 0, | |
() => 204, | |
]; | |
const successWithContent = [ | |
(data: string) => data.length > 0, | |
() => 200 | |
]; | |
const error = [ | |
(data: string) => data.includes("Error"), | |
() => 400 | |
]; | |
const statusCode = _.cond([ | |
successNoContent, | |
successWithContent, | |
error | |
]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment