replthis
v1.0.2
Published
Spend one line of code to run a Node REPL in the console under the scope of a function on that line.
Downloads
6
Readme
replthis
Spend one line of code to run a Node REPL in the console under the scope of a function on that line.
First, enter this into the command line to install this package.
npm install replthis
Now here's that line I was talking about.
require("replthis")(v => eval(v));
You can put this line anywhere in your code. It will start the JavaScript REPL once it runs, and under the scope of that arrow function. Then you should be able to enter JavaScript code into the console, pressing enter
to evaluate it.
That's it!
This uses the built-in Node repl
module. Other than that, there are no dependencies and this package is super lightweight.