Skip to content

Instantly share code, notes, and snippets.

@jamesplease
Last active August 31, 2016 21:21
Show Gist options
  • Save jamesplease/895da463b22a3cd219c9ff5b4d4d148b to your computer and use it in GitHub Desktop.
Save jamesplease/895da463b22a3cd219c9ff5b4d4d148b to your computer and use it in GitHub Desktop.
// need to fill these out
const RTL = ['ar', 'whatevs'];
const reverseComma = ['ar'];
function generateList(arr, languageCode) {
const rtl = RTL.indexOf(languageCode) >= 0;
const comma = reverseComma.indexOf(languageCode) >= 0 ? '،' : ',';
if (rtl) {
return arr.reverse().join(` ${comma}`);
} else {
return arr.join(`${comma} `)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment