-
-
Save ashumeow/58361b885f439d0c950a 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
let tee = (a) => {console.log(String(a)); return a} | |
// our applicator | |
let $_ = (n) => { | |
let args = new Array(n); | |
for (let i = 1; i <= n; i++) { | |
args[i-1] = `$${i}` | |
} | |
return (raw, ...values) => | |
Function(...args.concat(tee('return ' + raw.reduce( | |
(src,str,i) => { | |
return src + values[i-1] + str | |
} | |
).trim()))); | |
} | |
let just_a_sec = $_(1)` | |
setTimeout($1, 1000) | |
` | |
just_a_sec((_)=> | |
alert('ok') | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment