Skip to content

Instantly share code, notes, and snippets.

@Shestac92
Created March 27, 2019 15:46
Show Gist options
  • Save Shestac92/7846c22876f1d5f329f12b2fcc03710e to your computer and use it in GitHub Desktop.
Save Shestac92/7846c22876f1d5f329f12b2fcc03710e to your computer and use it in GitHub Desktop.
function createProcessor(strings, ...args) {
return function (...symbols) {
let str = '';
for (let i = 0; i < args.length; i++) {
str += `${strings[i]}`;
if (symbols[i] || symbols[i] === 0)
str += `${symbols[i]}`;
}
return str;
};
}
const processor = createProcessor`this${0}is${1}fucking${2}awesome${3}`;
console.log(processor(' q ', ' w ', ' e ', ' r '));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment