Skip to content

Commit

Permalink
fix check typeof object and non null
Browse files Browse the repository at this point in the history
  • Loading branch information
Ugo evola authored and ugoevola committed Jan 12, 2023
1 parent d724557 commit ac60848
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/core/mapping-for-implicit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const mapImplicitObject = <T>(
sourceArg: ArgumentDescriptor,
targetedObject: T
): void => {
if (typeof sourceArg.value === 'object') {
if (typeof sourceArg.value === 'object' && sourceArg.value !== null) {
Object.entries(sourceArg.value).forEach(([propertyName, propertyValue]) => {
if (propertyName in targetedObject)
targetedObject[propertyName] = propertyValue
Expand Down
2 changes: 1 addition & 1 deletion src/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export const clean = <T>(object: T): T => {
Object.entries(object).forEach(([key, value]) => {
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
if (value === undefined) delete object[key]
else if (typeof value === 'object') clean(value)
else if (typeof value === 'object' && value !== null) clean(value)
})
return object
}
Expand Down

0 comments on commit ac60848

Please sign in to comment.