web 3d图形渲染器
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.

62 lines
1.4 KiB

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