Skip to content

Commit 87fed82

Browse files
committed
feat(interfaces): InspectOptions
Signed-off-by: Lexus Drumgold <unicornware@flexdevelopment.llc>
1 parent 5d1924a commit 87fed82

File tree

6 files changed

+51
-6
lines changed

6 files changed

+51
-6
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/**
2+
* @file Type Tests - InspectOptions
3+
* @module log/interfaces/tests/unit-d/InspectOptions
4+
*/
5+
6+
import type TestSubject from '#interfaces/inspect-options'
7+
import type { Nilable } from '@flex-development/tutils'
8+
import type { InspectOptions } from 'node-inspect-extracted'
9+
10+
describe('unit-d:interfaces/InspectOptions', () => {
11+
it('should extend Omit<BaseInspectOptions, "colors">', () => {
12+
expectTypeOf<TestSubject>().toMatchTypeOf<Omit<InspectOptions, 'colors'>>()
13+
})
14+
15+
it('should match [colors?: boolean | null | undefined]', () => {
16+
expectTypeOf<TestSubject>()
17+
.toHaveProperty('colors')
18+
.toEqualTypeOf<Nilable<boolean>>()
19+
})
20+
})

src/interfaces/__tests__/log-functions.spec-d.mts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
*/
55

66
import type TestSubject from '#interfaces/log-functions'
7-
import type { LogTypeFunctions } from '@flex-development/log'
8-
import type { InspectOptions } from 'node-inspect-extracted'
7+
import type { InspectOptions, LogTypeFunctions } from '@flex-development/log'
98

109
describe('unit-d:interfaces/LogFunctions', () => {
1110
it('should extend LogTypeFunctions', () => {

src/interfaces/index.mts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*/
55

66
export type { default as InputLogObject } from '#interfaces/input-log-object'
7+
export type { default as InspectOptions } from '#interfaces/inspect-options'
78
export type {
89
default as LogFormatOptions
910
} from '#interfaces/log-format-options'

src/interfaces/inspect-options.mts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/**
2+
* @file Interfaces - InspectOptions
3+
* @module log/interfaces/InspectOptions
4+
*/
5+
6+
import type * as util from 'node-inspect-extracted'
7+
8+
/**
9+
* Options for using {@linkcode util.inspect} on a value.
10+
*
11+
* @see {@linkcode util.InspectOptions}
12+
*
13+
* @extends {Omit<util.InspectOptions,'colors'>}
14+
*/
15+
interface InspectOptions extends Omit<util.InspectOptions, 'colors'> {
16+
/**
17+
* Use color.
18+
*
19+
* @default isColorSupported()
20+
*/
21+
colors?: boolean | null | undefined
22+
}
23+
24+
export type { InspectOptions as default }

src/interfaces/log-functions.mts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
* @module log/interfaces/LogFunctions
44
*/
55

6-
import type { LogTypeFunctions } from '@flex-development/log'
7-
import type { InspectOptions, inspect } from 'node-inspect-extracted'
6+
import type { InspectOptions, LogTypeFunctions } from '@flex-development/log'
7+
import type * as util from 'node-inspect-extracted'
88

99
/**
1010
* Registry of log functions.
@@ -15,7 +15,8 @@ import type { InspectOptions, inspect } from 'node-inspect-extracted'
1515
*/
1616
interface LogFunctions extends LogTypeFunctions {
1717
/**
18-
* Use {@linkcode inspect} on `value` and print a string representation.
18+
* Use {@linkcode util.inspect} on `value` and print its string
19+
* representation.
1920
*
2021
* @see {@linkcode InspectOptions}
2122
*

src/lib/create-logger.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ function bind(
238238
}
239239

240240
/**
241-
* Use {@linkcode util.inspect} on `value` and print a string representation.
241+
* Use {@linkcode util.inspect} on `value` and print its string representation.
242242
*
243243
* @internal
244244
*

0 commit comments

Comments
 (0)