Skip to content

Commit

Permalink
sys.js: --needless Object.keys() --needless .map() in a single patch
Browse files Browse the repository at this point in the history
  • Loading branch information
xk authored and ry committed Sep 20, 2010
1 parent 354150f commit fc334b3
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions lib/sys.js
Expand Up @@ -106,13 +106,8 @@ exports.inspect = function (obj, showHidden, depth, colors) {
}

// Look up the keys of the object.
if (showHidden) {
var keys = Object.getOwnPropertyNames(value).map(function (key) { return '' + key; });
} else {
var keys = Object.keys(value);
}

var visible_keys = Object.keys(value);
var keys = showHidden ? Object.getOwnPropertyNames(value) : visible_keys;

// Functions without properties can be shortcutted.
if (typeof value === 'function' && keys.length === 0) {
Expand Down

0 comments on commit fc334b3

Please sign in to comment.