Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/max-mapper/node-repl
run a node program but also attach a repl to the same context that your code runs in so you can inspect + mess with stuff as your program is running. node 0.12/iojs and above only
https://github.com/max-mapper/node-repl
Last synced: 14 days ago
JSON representation
run a node program but also attach a repl to the same context that your code runs in so you can inspect + mess with stuff as your program is running. node 0.12/iojs and above only
- Host: GitHub
- URL: https://github.com/max-mapper/node-repl
- Owner: max-mapper
- Created: 2015-01-23T21:07:07.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-07-25T08:27:18.000Z (over 9 years ago)
- Last Synced: 2024-12-08T13:47:58.792Z (about 1 month ago)
- Language: JavaScript
- Homepage: http://maxogden.com/node-repl
- Size: 203 KB
- Stars: 129
- Watchers: 7
- Forks: 12
- Open Issues: 3
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# node-repl
an interactive repl for debugging node programs.
run a node program but also attach a repl to the same context that your code runs in so you can inspect + mess with stuff as your program is running
available as a command-line tool
[![NPM](https://nodei.co/npm/node-repl.png)](https://nodei.co/npm/node-repl/)
currently this only works on node >=0.12 and iojs as it uses a generator to make the eval loop preserve scope.
## installation
```js
npm install node-repl -g
```## CLI usage
```bash
$ node-repl
Usage: node-repl$ node-repl your-program.js
>
```## example
suppose we have a program called `hello.js` that has these contents:
```js
var pizza = 1
```if you run `node-repl hello.js` you will get a repl, just like when you run `node`.
The difference is that this repl is running *in the same context as your program*.
```
$ node-repl hello.js
> 1 + 1 // we are in a node repl
2
> pizza // we can access variables in our program
1
>
```