Created
July 24, 2015 17:44
-
-
Save markotom/5441d66045e278c37d70 to your computer and use it in GitHub Desktop.
Falafel to node process
This file contains 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 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