Skip to content

Instantly share code, notes, and snippets.

@narennaik
Last active June 28, 2021 19:52
Show Gist options
  • Save narennaik/bcd01964694c750620c5a2ce7065aad5 to your computer and use it in GitHub Desktop.
Save narennaik/bcd01964694c750620c5a2ce7065aad5 to your computer and use it in GitHub Desktop.
Split into multiple functions
const getDomainName = (item) => item.details.name;
const getProtocol = (item) => (item.details.valid ? 'https' : 'http');
const getUrl = (item) => `${getProtocol(item)}://${getDomainName(item)}`;
// TODO: (temporary) Adding callback=true because server side redirection needs this parameter
const addCallbackParameter = (url) => `${url}?callback=true`;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment