Skip to content

Commit 8c27467

Browse files
committed
pass in inspect options only
1 parent 5628434 commit 8c27467

File tree

1 file changed

+4
-17
lines changed

1 file changed

+4
-17
lines changed

packages/core/src/shared/utilities/collectionUtils.ts

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55

66
import { isWeb } from '../extensionGlobals'
7-
import { InspectOptions as nodeInspectOptions, inspect as nodeInspect } from 'util'
7+
import { inspect as nodeInspect, InspectOptions } from 'util'
88
import { AsyncCollection, toCollection } from './asyncCollection'
99
import { SharedProp, AccumulableKeys, Coalesce, isNonNullable } from './tsUtils'
1010

@@ -330,29 +330,16 @@ export function partialClone(obj: any, depth: number = 3, omitKeys: string[] = [
330330
return clonedObj
331331
}
332332

333-
type inspectOptions = Partial<
334-
nodeInspectOptions & {
335-
omitKeys: string[]
336-
replacement: any
337-
}
338-
>
339-
340333
/**
341334
* Wrapper around nodes inspect function that works on web. Defaults to JSON.stringify on web.
342335
* @param obj object to show
343336
* @param opt options for showing (ex. depth, omitting keys)
344337
*/
345-
export function inspect(obj: any, opt?: inspectOptions): string {
338+
export function inspect(obj: any, opt?: InspectOptions): string {
346339
const options = {
347340
depth: opt?.depth ?? 3,
348-
omitKeys: opt?.omitKeys ?? [],
349-
replacement: opt?.replacement,
350-
showHidden: opt?.showHidden ?? false,
351-
color: opt?.colors ?? false,
352-
}
353-
return isWeb()
354-
? JSON.stringify(partialClone(obj, options.depth, options.omitKeys, options.replacement), undefined, 2)
355-
: nodeInspect(obj, options)
341+
}
342+
return isWeb() ? JSON.stringify(partialClone(obj, options.depth), undefined, 2) : nodeInspect(obj, options)
356343
}
357344

358345
/** Recursively delete undefined key/value pairs */

0 commit comments

Comments
 (0)