I have a script foo.js that contains some functions I want to play with in the REPL.
foo.js
Is there a way to have node execute my script and then jump into a
Here's a bash function version of George's answer:
noderepl() { FILE_CONTENTS="$(< $1 )" node -i -e "$FILE_CONTENTS" }
If you put this in your ~/.bash_profile you can use it like an alias, i.e.:
~/.bash_profile
noderepl foo.js