Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@jasongorman
Created March 15, 2019 09:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasongorman/1a9893b0a00e04694e7aa58de76640c0 to your computer and use it in GitHub Desktop.
Save jasongorman/1a9893b0a00e04694e7aa58de76640c0 to your computer and use it in GitHub Desktop.
const toXml = require("./xml_serializer");
const toHtml = require("./html_serializer");
const toString = require("./string_serializer");
const ResponseKind = {
XML: 1,
HTML: 2,
STRING: 3
}
const write = (customer, responseKind) => {
if(responseKind == ResponseKind.HTML) {
return toHtml(customer);
} else {
if(responseKind == ResponseKind.XML){
return toXml(customer);
}
}
return toString(customer);
}
module.exports = {ResponseKind, write};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment