summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorNathan Rajlich <nathan@tootallnate.net>2012-09-08 15:09:59 -0700
committerNathan Rajlich <nathan@tootallnate.net>2012-09-08 15:09:59 -0700
commitfb383a0ad08470d2a50923c7f3baa3a59a530026 (patch)
tree0c7c62709729836ba2581988e8b6b73b6c98dea6 /lib
parent9a3521cb25e5f0035cf38ed7b16729c8d0dc3c65 (diff)
downloadandroid-node-v8-fb383a0ad08470d2a50923c7f3baa3a59a530026.tar.gz
android-node-v8-fb383a0ad08470d2a50923c7f3baa3a59a530026.tar.bz2
android-node-v8-fb383a0ad08470d2a50923c7f3baa3a59a530026.zip
util: make util.inspect() work when "hasOwnProperty" is overwritten
Diffstat (limited to 'lib')
-rw-r--r--lib/util.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/util.js b/lib/util.js
index 53775e74da..d9a5c2b227 100644
--- a/lib/util.js
+++ b/lib/util.js
@@ -318,7 +318,7 @@ function formatError(value) {
function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
var output = [];
for (var i = 0, l = value.length; i < l; ++i) {
- if (Object.prototype.hasOwnProperty.call(value, String(i))) {
+ if (hasOwnProperty(value, String(i))) {
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
String(i), true));
} else {
@@ -349,7 +349,7 @@ function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
str = ctx.stylize('[Setter]', 'special');
}
}
- if (!visibleKeys.hasOwnProperty(key)) {
+ if (!hasOwnProperty(visibleKeys, key)) {
name = '[' + key + ']';
}
if (!str) {
@@ -556,3 +556,7 @@ exports._extend = function(origin, add) {
}
return origin;
};
+
+function hasOwnProperty(obj, prop) {
+ return Object.prototype.hasOwnProperty.call(obj, prop);
+}