Last active
December 17, 2015 08:19
-
-
Save sindresorhus/5579216 to your computer and use it in GitHub Desktop.
Wrap method calls in console.time
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'); | |
var src = 'test();'; | |
var output = falafel(src, function (node) { | |
if (node.type === 'CallExpression') { | |
var parent = node.parent; | |
var funcName = node.callee.name; | |
parent.update('console.time(\'' + funcName + '()\');' + parent.source() + 'console.timeEnd(\'' + funcName + '()\');'); | |
} | |
}); | |
console.log(output); | |
// console.time('test()');test();console.timeEnd('test()'); |
require.extensions is deprecated
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For applying this maybe
require.extensions
. (yes yes, it's bad, but just debugging, remember)