Created
August 8, 2013 07:29
-
-
Save jussi-kalliokoski/6182349 to your computer and use it in GitHub Desktop.
Detect which lodash/underscore functions your code is using.
This file contains hidden or 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 usedFunctions = function (_) { | |
"use strict"; | |
var usedFunctions = []; | |
var isFunction = _.isFunction; | |
var contains = _.contains; | |
_.forOwn(_, function (func, name) { | |
if ( !isFunction(func) ) { return; } | |
_[name] = function () { | |
usedFunctions.push(name); | |
_[name] = func; | |
return func.apply(_, arguments); | |
}; | |
}); | |
return usedFunctions; | |
}(window._); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment