Skip to content

Instantly share code, notes, and snippets.

@geirsagberg
Last active August 29, 2015 14:24
Show Gist options
  • Save geirsagberg/5c79e37954c7e3145162 to your computer and use it in GitHub Desktop.
Save geirsagberg/5c79e37954c7e3145162 to your computer and use it in GitHub Desktop.
Shortcuts for JSend JSON API (http://labs.omniti.com/labs/jsend)
/**
* 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