Skip to content

Commit b1e6bb5

Browse files
chore: refactoring
1 parent 0b8cc7e commit b1e6bb5

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

lib/module/utils.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { getMetadataStorage, validateSync } from 'class-validator'
33
import { configDotenv } from 'dotenv'
44
import { isNotNil } from 'ramda'
55
import { ValidationException } from 'lib/exceptions'
6-
import { toParsedBasicType } from 'lib/utils'
6+
import { toValueByType } from 'lib/utils'
77
import { Class, RegisteredConfig } from './types'
88
import { registry } from './constants'
99

@@ -94,7 +94,7 @@ export const getConfigInstance = <T extends Class>(base: T, transformOptions?: T
9494

9595
return {
9696
...acc,
97-
[propertyName]: isNotNil(value) ? toParsedBasicType(type, value) : value
97+
[propertyName]: isNotNil(value) ? toValueByType(type, value) : value
9898
}
9999
},
100100
// eslint-disable-next-line @typescript-eslint/no-explicit-any

lib/utils/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export * from './to-parsed-basic-type'
1+
export * from './to-value-by-type'

lib/utils/to-parsed-basic-type.ts renamed to lib/utils/to-value-by-type.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// eslint-disable-next-line @typescript-eslint/no-explicit-any
2-
export const toParsedBasicType = (type: any, value: string) => {
2+
export const toValueByType = (type: any, value: string) => {
33
switch (type) {
44
case Boolean: {
5-
return Boolean(value === 'true')
5+
return Boolean(value === 'true' || value === '1')
66
}
77

88
case Number: {

0 commit comments

Comments
 (0)