Skip to content

Commit

Permalink
[] and {} instead of [ ] and { }
Browse files Browse the repository at this point in the history
  • Loading branch information
James Halliday committed Mar 5, 2014
1 parent 209d829 commit 654c44b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ module.exports = function inspect_ (obj, opts, depth, seen) {
return s;
}
else if (isArray(obj)) {
if (obj.length === 0) return '[]';
var xs = Array(obj.length);
for (var i = 0; i < obj.length; i++) {
xs[i] = has(obj, i) ? inspect(obj[i], obj) : '';
Expand All @@ -58,6 +59,7 @@ module.exports = function inspect_ (obj, opts, depth, seen) {
}
else xs.push(key + ': ' + inspect(obj[key], obj));
}
if (xs.length === 0) return '{}';
return '{ ' + xs.join(', ') + ' }';
}
else return String(obj);
Expand Down

0 comments on commit 654c44b

Please sign in to comment.