mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
first draft of node.js REPL
This commit is contained in:
parent
83285fe170
commit
ba2d9df25f
5 changed files with 95 additions and 1 deletions
20
lib/coffee_script/coffee-script.js
Normal file
20
lib/coffee_script/coffee-script.js
Normal file
|
@ -0,0 +1,20 @@
|
|||
(function(){
|
||||
var sys;
|
||||
// Executes the `coffee` Ruby program to convert from CoffeeScript to JavaScript.
|
||||
sys = require('sys');
|
||||
exports.compile = function compile(code, callback) {
|
||||
var coffee, js;
|
||||
js = '';
|
||||
coffee = process.createChildProcess('coffee', ['--eval', '--no-wrap', '--globals']);
|
||||
coffee.addListener('output', function(results) {
|
||||
if ((typeof results !== "undefined" && results !== null)) {
|
||||
return js += results;
|
||||
}
|
||||
});
|
||||
coffee.addListener('exit', function() {
|
||||
return callback(js);
|
||||
});
|
||||
coffee.write(code);
|
||||
return coffee.close();
|
||||
};
|
||||
})();
|
Loading…
Add table
Add a link
Reference in a new issue