Closed
Description
Describe the problem
Some feedback we've had on $inspect
is that this...
console.log('>>> HERE', foo, bar, baz);
...is a common pattern that doesn't work with $inspect
, as it only takes a single value argument (in order to prevent ambiguity when providing a callback function).
Describe the proposed solution
@dummdidumm had a great idea — allow an arbitrary number of arguments, and put the callback in a .with
method:
// these are effectively identical
$inspect('>>> HERE', foo, bar, baz);
$inspect('>>> HERE', foo, bar, baz).with(console.log);
// can also use `console.trace` or `debugger`...
$inspect('>>> HERE', foo, bar, baz).with(console.trace);
$inspect('>>> HERE', foo, bar, baz).with((type, ...values) => {
debugger;
});
// ...or whatever custom logic you want to provide
$inspect('>>> HERE', foo, bar, baz).with((type, ...values) => {
klaxon.play();
});
Alternatives considered
n/a
Importance
nice to have
Metadata
Metadata
Assignees
Labels
No labels