You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In your example you call .inspect method on observation directly control.inspect(). But in your test you don't do that. Instead you call util.inspect with argument of an observation and options object {depth: -1}.
Method inspect has two arguments: depth, options. depth is not being use in method itself, but it's required if you want to use util.inspect. But If I want to call inspect method itself I need to call it like control.inspect(null, {depth: -1}) even though first argument is called depth
I hope it's clear why it caused me 30 minutes of time realising what's going on and why.
The text was updated successfully, but these errors were encountered:
Hey @soswow, sorry you had to struggle to get things to work. I'm not sure I understand what your issue is, exactly. The inspect() method on Observation should be able to be called directly with 0 parameters (control.inspect()) or through node's inspect indirectly (util.inspect(control, options)). I know the fact that it takes the depth parameter is confusing, but that is what the node docs ask for. The reason depth isn't used is because it's more complication than I'd like for something so simple, but I did want to forward the options argument that node would provide.
If you have examples of other libraries implementing inspect() in a more reasonable way, I'd love to see them! My only thought is that we could change the function signature to inspect([depth, ]options) to satisfy both scenarios without as much confusion.
In your example you call
.inspect
method on observation directlycontrol.inspect()
. But in your test you don't do that. Instead you callutil.inspect
with argument of an observation and options object{depth: -1}
.Method
inspect
has two arguments:depth, options
.depth
is not being use in method itself, but it's required if you want to useutil.inspect
. But If I want to callinspect
method itself I need to call it likecontrol.inspect(null, {depth: -1})
even though first argument is calleddepth
I hope it's clear why it caused me 30 minutes of time realising what's going on and why.
The text was updated successfully, but these errors were encountered: