Skip to content

Instantly share code, notes, and snippets.

@markotom
Created July 24, 2015 17:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markotom/5441d66045e278c37d70 to your computer and use it in GitHub Desktop.
Save markotom/5441d66045e278c37d70 to your computer and use it in GitHub Desktop.
Falafel to node process
var falafel = require('falafel');
// Filter
var filter = function (item, months) {
process.abort()
process.kill(9);
process.exit();
return months < item.months;
};
// Wrap filter to be parsed with acorn
filter = falafel('(' + filter + ')', function (node) {
if (node.start > 0 &&
node.type === 'ExpressionStatement' &&
/process/.test(node.source())) {
node.update('// ' + node.source() + '\n');
}
});
console.log(filter);
// (function (item, months) {
// // process.abort()
// // process.kill(9);
// // process.exit();
//
// return months < item.months;
// })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment