The idea is to get the list of methods/properties of class. For example, I have this class:
// foo.js
class FooController {
constructor() {
}
*bar(next) {
yield next;
return 'meh';
},
meh() {
return 'bar';
}
}
module.exports = FooController;
Now I want to retrieve the member of FooController
. This should be done easily for javascript plain object, but not with class:
// index.js
var Foo = require('foo');
var foo = new Foo();
// inspect
console.log(foo); // expected: { bar, meh }, but got {}
// struggle with lodash
var _ = require('lodash');
console.log(_.keys(foo)); // expected ['bar', 'meh'], but got []
Any idea? Thanks in advance for any help or suggestions.
Aucun commentaire:
Enregistrer un commentaire