Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

string representations of objects in node and the browser

License

NotificationsYou must be signed in to change notification settings

inspect-js/object-inspect

string representations of objects in node and the browser

github actionscoverageLicenseDownloads

npm badge

example

circular

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

dom element

varinspect=require('object-inspect');vard=document.createElement('div');d.setAttribute('id','beep');d.innerHTML='<b>wooo</b><i>iiiii</i>';console.log(inspect([d,{a:3,b :4,c:[5,6,[7,[8,[9]]]]}]));

output:

[ <div>...</div>, { a: 3, b: 4, c: [ 5, 6, [ 7, [ 8, [ ... ] ] ] ] } ]

methods

varinspect=require('object-inspect')

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

Return a strings with the string representation ofobj up to a depth ofopts.depth.

Additional options:

  • quoteStyle: must be "single" or "double", if present. Default'single' for strings,'double' for HTML elements.
  • maxStringLength: must be0, a positive integer,Infinity, ornull, if present. DefaultInfinity.
  • customInspect: Whentrue, a custom inspect method function will be invoked (either undere theutil.inspect.custom symbol, or theinspect property). When the string'symbol', only the symbol method will be invoked. Defaulttrue.
  • indent: must be "\t",null, or a positive integer. Defaultnull.
  • numericSeparator: must be a boolean, if present. Defaultfalse. Iftrue, all numbers will be printed with numeric separators (eg,1234.5678 will be printed as'1_234.567_8')

install

Withnpm do:

npm install object-inspect

license

MIT

About

string representations of objects in node and the browser

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Contributors8


[8]ページ先頭

©2009-2025 Movatter.jp