Skip to content

Instantly share code, notes, and snippets.

@Noitidart
Last active May 7, 2021 07:13
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 Noitidart/6cda735a60b4f9a799d78ab9766bc62b to your computer and use it in GitHub Desktop.
Save Noitidart/6cda735a60b4f9a799d78ab9766bc62b to your computer and use it in GitHub Desktop.
var { stripIndents } = require("common-tags")
const toTitle = ad => ad.title;
const ads = [{ title: 'a' }, { title: 'b' }];
function bulletLists(strs, ...lists) {
return strs.reduce((compiled, str, ix) => {
compiled.push(str);
const list = lists[ix];
if (list) {
compiled.push('- ' + list.join('\n - '))
}
return compiled;
}, []).join('');
}
function doit() {
var a = stripIndents(bulletLists)`
Please support your community:
${ads.map(toTitle)}
(tap here to see more about our sponsors)
`;
return a;
}
doit();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment