Skip to content

Commit

Permalink
docs complete
Browse files Browse the repository at this point in the history
  • Loading branch information
James Halliday committed Jul 26, 2013
1 parent 4b4a7b9 commit b80cce2
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 4 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
module.exports = function inspect_ (obj, opts, depth, seen) {
if (!opts) opts = {};

var maxDepth = opts.depth || 5;
var maxDepth = opts.depth === undefined ? 5 : opts.depth;
if (depth === undefined) depth = 0;
if (depth > maxDepth) return '...';
if (depth > maxDepth && maxDepth > 0) return '...';

if (seen === undefined) seen = [];
else if (seen.indexOf(obj) >= 0) {
Expand Down
34 changes: 32 additions & 2 deletions readme.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,16 @@ inspect objects in node and in the browser

# example

## browser
## circular

``` js
var inspect = require('object-inspect');
var obj = { a: 1, b: [3,4] };
obj.c = obj;
console.log(inspect(obj));
```

## dom element

``` js
var inspect = require('object-inspect');
Expand All @@ -22,4 +31,25 @@ output:
[ <div id="beep">...</div>, { a: 3, b: 4, c: [ 5, 6, [ 7, [ 8, [ ... ] ] ] ] } ]
```

## node
# methods

``` js
var inspect = require('object-inspect')
```

## var s = inspect(obj, opts={})

Return a string `s` with the string representation of `obj` up to a depth of
`opts.depth`.

# install

With [npm](https://npmjs.org) do:

```
npm install object-inspect
```

# license

MIT

0 comments on commit b80cce2

Please sign in to comment.