Last active
August 29, 2015 14:24
-
-
Save geirsagberg/5c79e37954c7e3145162 to your computer and use it in GitHub Desktop.
Shortcuts for JSend JSON API (http://labs.omniti.com/labs/jsend)
This file contains 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
/** | |
* Shortcuts for JSend JSON API (http://labs.omniti.com/labs/jsend) | |
* @author Geir Sagberg | |
*/ | |
export function fail(data) { | |
return { | |
status: 'fail', | |
data | |
}; | |
} | |
export function success(data) { | |
return { | |
status: 'success', | |
data | |
}; | |
} | |
export function error(message, {code, data}) { | |
return { | |
status: 'error', | |
message, | |
code, | |
data | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment