Created
January 31, 2015 21:04
-
-
Save paulserraino/19b5c27addfe15847fad to your computer and use it in GitHub Desktop.
method lookups
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
//returns an array of methods | |
Object.prototype.methods = function () { | |
var m = [], k; | |
for (k in this) | |
if (typeof this[k] === "function") m.push(k); | |
return m; | |
}; | |
Object.prototype.hasMethod = function (m) { | |
return m in this && typeof this[m] === "function"; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment