You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

readme.markdown 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. # object-inspect
  2. string representations of objects in node and the browser
  3. [![testling badge](https://ci.testling.com/substack/object-inspect.png)](https://ci.testling.com/substack/object-inspect)
  4. [![build status](https://secure.travis-ci.org/substack/object-inspect.png)](http://travis-ci.org/substack/object-inspect)
  5. # example
  6. ## circular
  7. ``` js
  8. var inspect = require('object-inspect');
  9. var obj = { a: 1, b: [3,4] };
  10. obj.c = obj;
  11. console.log(inspect(obj));
  12. ```
  13. ## dom element
  14. ``` js
  15. var inspect = require('object-inspect');
  16. var d = document.createElement('div');
  17. d.setAttribute('id', 'beep');
  18. d.innerHTML = '<b>wooo</b><i>iiiii</i>';
  19. console.log(inspect([ d, { a: 3, b : 4, c: [5,6,[7,[8,[9]]]] } ]));
  20. ```
  21. output:
  22. ```
  23. [ <div id="beep">...</div>, { a: 3, b: 4, c: [ 5, 6, [ 7, [ 8, [ ... ] ] ] ] } ]
  24. ```
  25. # methods
  26. ``` js
  27. var inspect = require('object-inspect')
  28. ```
  29. ## var s = inspect(obj, opts={})
  30. Return a string `s` with the string representation of `obj` up to a depth of `opts.depth`.
  31. Additional options:
  32. - `quoteStyle`: must be "single" or "double", if present
  33. # install
  34. With [npm](https://npmjs.org) do:
  35. ```
  36. npm install object-inspect
  37. ```
  38. # license
  39. MIT