4 ms·
I feel like the await keyword everywhere is a bit verbose. One might use something like the gpp preprocessor (hopefully the macros could be defined in a separa
by ilaksh 5y ago
I feel like the await keyword everywhere is a bit verbose. One might use something like the gpp preprocessor (hopefully the macros could be defined in a separate file):
#!/usr/bin/env zx
#define _ await $
#define __ await Promise.all
#define _1 process.argv[1]
#define _2 process.argv[1]
#define _3 process.argv[1]
_`cat package.json | grep name`
let branch = _`git branch --show-current`
_`dep deploy --branch=${branch}`
__([
$`sleep 1; echo 1`,
$`sleep 2; echo 2`,
$`sleep 3; echo 3`,
])
let name = 'foo bar'
_`mkdir /tmp/${_1}`
- williamdclt 5y agoI don't think it is very relevant to critique the Javascript syntax on a post about a specific library
- masklinn 5y agoThis is a node package, so using async/await would have been a specific design decision of the library.
- ilaksh 5y agoI am not talking about JavaScript in general. I have been doing mainly JavaScript programming for the last 8 or 9 years or so (before that other languages like C# and C++ for many years). And I use those keywords all the time. For this specific use case, they are trying to replace shell scripts. So I thought maybe some people might be willing to consider abbreviations for the async and await keywords for this case.
- deleted 5y ago[deleted]