Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
Use Object.getPrototypeOf() on the object in the REPL tab-completion.
Browse files Browse the repository at this point in the history
Some people use __proto__ to augment an Object's prototype after it's been created.
This patch helps make the "new" prototype properties visible if necessary.

This is also more consistent with the while logic below.
  • Loading branch information
TooTallNate authored and ry committed Aug 23, 2011
1 parent b15ab5d commit 8ec31a3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -412,8 +412,8 @@ REPLServer.prototype.complete = function(line) {
memberGroups.push(Object.getOwnPropertyNames(obj));
}
// works for non-objects
var p = obj.constructor ? obj.constructor.prototype : null;
try {
var p = Object.getPrototypeOf(obj);
var sentinel = 5;
while (p !== null) {
memberGroups.push(Object.getOwnPropertyNames(p));
Expand Down

0 comments on commit 8ec31a3

Please sign in to comment.