repl: use Object.getPrototypeOf on functions for tab complete()
authorNathan Rajlich <nathan@tootallnate.net>
Sat, 21 Apr 2012 20:53:49 +0000 (13:53 -0700)
committerNathan Rajlich <nathan@tootallnate.net>
Sat, 21 Apr 2012 20:53:49 +0000 (13:53 -0700)
lib/repl.js

index 0a81ebc..9cd88af 100644 (file)
@@ -589,7 +589,7 @@ REPLServer.prototype.complete = function(line, callback) {
             try {
               var sentinel = 5;
               var p;
-              if (typeof obj == 'object') {
+              if (typeof obj === 'object' || typeof obj === 'function') {
                 p = Object.getPrototypeOf(obj);
               } else {
                 p = obj.constructor ? obj.constructor.prototype : null;