I have a CoffeeScript object and I want to get all of its instance methods.
Is there an easy way to do this?
You can get all of the instance methods as they are now using the following CoffeeScript code:
keys = (k for k, v of obj when typeof v is 'function')
@thejh's solution will give you more than just functions and doesn't work in all JS platforms, but is otherwise correct. Also note that a CoffeeScript object is a JavaScript object -- there's no distinction, really.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With