Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Equivalent of `util.inspect` in Deno

Does Deno have a utility function that dumps a Object or primitive to a string like Node.js util.inspect?

For example in Node.js I create an json object and want to dump out its contents in Node:

> m = {k1:'v1', k2:'v2'}
{ k1: 'v1', k2: 'v2' }
> util.inspect(m)
'{ k1: \'v1\', k2: \'v2\' }'
like image 274
Timothy C. Quinn Avatar asked Dec 18 '22 13:12

Timothy C. Quinn


1 Answers

Deno's equivalent of Node's util.inspect is Deno.inspect.

For example in the deno REPL:

> m = {k1:'v1', k2:'v2'}
{ k1: "v1", k2: "v2" }
> Deno.inspect(m)
{ k1: "v1", k2: "v2" }
like image 117
Timothy C. Quinn Avatar answered Dec 29 '22 16:12

Timothy C. Quinn