Created
July 31, 2013 18:48
-
-
Save tj/6124922 to your computer and use it in GitHub Desktop.
console.api()
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
function params(fn) { | |
var str = fn.toString(); | |
var sig = str.match(/\(([^)]*)\)/)[1]; | |
if (!sig) return []; | |
return sig.split(', '); | |
} | |
console.api = function(obj){ | |
console.log(); | |
var proto = Object.getPrototypeOf(obj); | |
console.log(' %s:', obj.constructor.name); | |
for (var key in proto) { | |
if (proto.hasOwnProperty(key)) { | |
console.log(' - %s(%s)', key, params(proto[key]).join(', ')); | |
} | |
} | |
console.log(); | |
}; |
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
Item: | |
- isNew() | |
- toJSON() | |
- file(file) | |
- link(url) | |
- remove(fn) | |
- set(prop, val, fn) | |
- load(fn) | |
- create(fn) | |
- thumb(path, fn) | |
- postFile(fn) | |
- postURL(fn) | |
- save(fn) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is neat. Will be using this for my constructors so that I can reformat and/or remove prototype functions.