diff options
author | Nathan Rajlich <nathan@tootallnate.net> | 2012-02-16 16:33:40 -0800 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2012-02-17 15:51:33 +0100 |
commit | a118f2172880d338101f80647437b8832ac1f768 (patch) | |
tree | 7cb12ff4f8d8714db9de3f9650d5d144110e1c4f /lib | |
parent | 30e462e91937ced3847af3fe9c393ebd32294b68 (diff) | |
download | node-a118f2172880d338101f80647437b8832ac1f768.tar.gz |
repl: make tab completion work on non-objects
Diffstat (limited to 'lib')
-rw-r--r-- | lib/repl.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/repl.js b/lib/repl.js index 08697ab72..20fa7aefc 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -523,8 +523,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); |