Hacker News new | ask | show | jobs
by dsherret 1778 days ago
Just to be clear, `deno eval "console.log(5)"` has existed for some time which is similar to `node -e "console.log(5)"`. In this case, the deno repl subcommand's --eval flag provides a cross-platform way to evaluate some setup code before launching into the REPL. This is useful if you alias the command in your shell's initialization file allowing you to easily launch a REPL with everything already setup to your liking.

For example:

  $ alias add_repl='deno repl --eval "const add = (a, b) => a + b"'
  ...
  $ add_repl
  Deno 1.13
  exit using ctrl+d or close()
  > add(1, 2)
  3