Skip to content

Commit

Permalink
fix(Common): Handle null and undefined case for convertObjectToMapRoles
Browse files Browse the repository at this point in the history
  • Loading branch information
hoangnt2 authored and heliocastro committed Oct 31, 2024
1 parent e996799 commit 2f6863b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/utils/common.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,9 @@ const convertObjectToMap = (data: { [k: string]: string }): InputKeyValue[] => {
* @param data - The object to convert.
* @returns An array of key-value pairs.
*/
const convertObjectToMapRoles = (data: { [k: string]: Array<string> }): InputKeyValue[] => {
const convertObjectToMapRoles = (data: { [k: string]: Array<string> } | null | undefined): InputKeyValue[] => {
if (isNullOrUndefined(data))
return []
const inputRoles: InputKeyValue[] = []
const mapRoles = new Map(Object.entries(data))
mapRoles.forEach((value, key) => {
Expand Down

0 comments on commit 2f6863b

Please sign in to comment.