Skip to content

Instantly share code, notes, and snippets.

@paulserraino
Created January 31, 2015 21:04
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 paulserraino/19b5c27addfe15847fad to your computer and use it in GitHub Desktop.
Save paulserraino/19b5c27addfe15847fad to your computer and use it in GitHub Desktop.
method lookups
//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