Skip to content

Instantly share code, notes, and snippets.

@BenoitZugmeyer
Created September 21, 2015 11:38
Show Gist options
  • Save BenoitZugmeyer/eda47acf3e525329beca to your computer and use it in GitHub Desktop.
Save BenoitZugmeyer/eda47acf3e525329beca to your computer and use it in GitHub Desktop.
function dd(chunks) {
const variables = [].slice.call(arguments, 1);
let formated = "";
for (let i = 0; i < chunks.length; i += 1) {
formated += chunks[i]
if (i < chunks.length - 1) {
formated += variables[i];
}
}
if (formated[0] === "\n") formated = formated.slice(1);
const indent = formated.match(/([\t ]*)\S/);
if (indent) {
formated = formated.replace(new RegExp("^" + indent[1], "mg"), "");
}
return formated;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment