@@ -8,7 +8,13 @@ import { ErrorCode } from '#src/enums'
88import formatList from '#src/internal/format-list'
99import type { MessageFn , NodeError , NodeErrorConstructor } from '#src/types'
1010import { createNodeError , determineSpecificType } from '#src/utils'
11- import type { OneOrMany } from '@flex-development/tutils'
11+ import {
12+ DOT ,
13+ includes ,
14+ isArray ,
15+ lowercase ,
16+ type OneOrMany
17+ } from '@flex-development/tutils'
1218
1319/**
1420 * `ERR_INVALID_ARG_TYPE` model.
@@ -47,7 +53,7 @@ const ERR_INVALID_ARG_TYPE: NodeErrorConstructor<
4753 if ( typeof name !== 'string' ) throw new TypeError ( "'name' must be a string" )
4854
4955 // ensure expected is an array
50- if ( ! Array . isArray ( expected ) ) expected = [ expected ]
56+ if ( ! isArray ( expected ) ) expected = [ expected ]
5157
5258 /**
5359 * Primitive value names.
@@ -78,7 +84,7 @@ const ERR_INVALID_ARG_TYPE: NodeErrorConstructor<
7884 // stylize invalid argument name
7985 msg += name . endsWith ( ' argument' )
8086 ? name
81- : `'${ name } ' ${ name . includes ( '.' ) ? 'property' : 'argument' } `
87+ : `'${ name } ' ${ includes ( name , DOT ) ? 'property' : 'argument' } `
8288
8389 // continue building error message
8490 msg += ' must be '
@@ -151,7 +157,7 @@ const ERR_INVALID_ARG_TYPE: NodeErrorConstructor<
151157 msg += `one of ${ formatList ( other , 'or' ) } `
152158 } else {
153159 /* c8 ignore next */
154- if ( other [ 0 ] ! . toLowerCase ( ) !== other [ 0 ] ) msg += 'an '
160+ if ( lowercase ( other [ 0 ] ! ) !== other [ 0 ] ) msg += 'an '
155161 msg += `${ other [ 0 ] } `
156162 }
157163 }
0 commit comments