summaryrefslogtreecommitdiff
path: root/lib/repl.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/repl.js')
-rw-r--r--lib/repl.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/repl.js b/lib/repl.js
index aeb51110eb..7bbc6d1448 100644
--- a/lib/repl.js
+++ b/lib/repl.js
@@ -525,8 +525,13 @@ REPLServer.prototype.complete = function(line, callback) {
}
// works for non-objects
try {
- var p = Object.getPrototypeOf(obj);
var sentinel = 5;
+ var p;
+ if (typeof obj == 'object') {
+ p = Object.getPrototypeOf(obj);
+ } else {
+ p = obj.constructor ? obj.constructor.prototype : null;
+ }
while (p !== null) {
memberGroups.push(Object.getOwnPropertyNames(p));
p = Object.getPrototypeOf(p);