node package manager

inspect

Object method inspector

Inspect

Tiny utility for node which outputs a hierarchical display of methods (accessors as well) and properties available. Comes in handy when using alien apis :)

Installation

$ npm install inspect

Example Output

[Admin]
  .first "tj"
  .last "holowaychuk"
  Admin
    .may(perm)
    User
      .may(perm)
      .name
      Object

Example JavaScript

var inspect = require('inspect');

function User(first, last) {
  this.first = first;
  this.last = last;
}

User.prototype.__defineGetter__('name', function(){
  return this.first + ' ' + this.last;
});

User.prototype.may = function(perm){
  return false;
};

function Admin(first, last) {
  User.call(this, first, last);
}

Admin.prototype.__proto__ = User.prototype;

Admin.prototype.may = function(perm){
  return true;
};

inspect(new Admin('tj', 'holowaychuk'));