diff options
author | Benjamin Lupton <b@lupton.cc> | 2020-08-13 04:03:51 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-12 14:03:51 -0400 |
commit | 452693256ce7b607fa0b9454b22c57748f616742 (patch) | |
tree | 31126efb5a41bc5de305feab540dd582c60960c5 /std/node/util.ts | |
parent | 3d70a2b94eac4d4032b8b11039efe6d070fa114f (diff) |
feat(std/node): add util.inspect (#6833)
Diffstat (limited to 'std/node/util.ts')
-rw-r--r-- | std/node/util.ts | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/std/node/util.ts b/std/node/util.ts index 8e3c50b87..e897931f2 100644 --- a/std/node/util.ts +++ b/std/node/util.ts @@ -4,6 +4,16 @@ import * as types from "./_util/_util_types.ts"; export { types }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any +export function inspect(object: unknown, ...opts: any): string { + return Deno.inspect(object, { + depth: opts.depth ?? 4, + iterableLimit: opts.iterableLimit ?? 100, + compact: !!(opts.compact ?? true), + sorted: !!(opts.sorted ?? false), + }); +} + export function isArray(value: unknown): boolean { return Array.isArray(value); } |