4
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Node.jsのREPLでawaitする

Last updated at Posted at 2017-05-30

追記

Node v10から --experimental-repl-await オプションを付けて実行するとawaitできるようになった:tada:
https://github.com/nodejs/node/issues/13209#issuecomment-385852791


Node.jsのREPLで非同期扱うのがめんどい。
PromiseもREPLでチェーンしていくのはだるい。
async/awaitはちょうどよさそうだけどREPLではasyncで囲まないといけないので使えない。

というのを解決してくれるツールがあった。
https://github.com/nfcampos/await-outside

binにPATHが通っていれば

$ await-outside

とすれば使える。
PATHが通ってなければ

$ node --require await-outside/repl

としても使える。
便利。

4
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?