Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function start(opts = {}) {
const [major, minor] = process.versions.node.split('.').map(n => parseInt(n));
if (major === 0 && minor < 8) {
console.warn('Node 0.8.0+ required for CoffeeScript REPL');
// TODO: callback instead
process.exit(1);}
if (opts.historyFile == null && process.env.HOME) {
opts.historyFile = path.join(process.env.HOME, '.taco_history');}
if (opts.historyMaxInputSize == null) {
opts.historyMaxInputSize = 10240;}
const repl = nodeREPL.start({
prompt: hasUnicode() ? '🌮 > ' : 'taco> ',
...opts,
eval(input, context, filename, cb) {
// XXX: multiline hack.
input = input.replace(/\uFF00/g, '\n');
return opts.eval(input, context, filename, cb);} });
repl.on('exit', function () {
if (!repl.rli.closed) repl.outputStream.write('\n');});
addMultilineHandler(repl);
if (opts.historyFile) {
addHistory(repl, opts.historyFile, opts.historyMaxInputSize);}
// Adapt help inherited from the node REPL