Last active
December 22, 2015 19:19
-
-
Save fiveisprime/6518753 to your computer and use it in GitHub Desktop.
Easy interaction with node.js REPL.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var local = require('repl').start('> '); | |
| local.context.set = function(name) { | |
| return function(err, value) { | |
| if (err) throw err; | |
| local.context[name] = value; | |
| }; | |
| }; | |
| // | |
| // Run in node to see a REPL prompt. | |
| // Now do fun stuff like: | |
| // > fs.readFile('repl.js', 'utf8', set('file')) | |
| // undefined | |
| // > console.log(file) | |
| // |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment