I'd like to use the stdin parameter of this function: http://graspjs.com/docs/lib/.
The grasp function expects this parameter to be an object with the same interface that process.stdin. And what I have is a simple variable in memory of type string.
How can I give this variable to the stdin input of this function?
var grasp = require('grasp');
var sourceCode = 'if (condititon) { console.log("In the condition"); }';
grasp({
args: '--equery condititon --replace true',
stdin: SomethingLikeStringToStdin(sourceCode),
callback: console.log
});
Expected log:
if (true) { console.log("In the condition"); }