Created
September 21, 2015 11:38
-
-
Save BenoitZugmeyer/eda47acf3e525329beca to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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