fix: add optional chaining operator in toHuman (#5825)
* fix: add optional chaining operator in toHuman * fix typo
This commit is contained in:
@@ -88,11 +88,11 @@ export class Json extends Map<string, any> implements Codec {
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
|
||||
* @description Converts the Object to a human-friendly JSON, with additional fields, expansion and formatting of information
|
||||
*/
|
||||
public toHuman (): Record<string, AnyJson> {
|
||||
return [...this.entries()].reduce<Record<string, AnyJson>>((json, [key, value]): Record<string, AnyJson> => {
|
||||
json[key] = isFunction((value as Codec).toHuman)
|
||||
json[key] = isFunction((value as Codec)?.toHuman)
|
||||
? (value as Codec).toHuman()
|
||||
: value as AnyJson;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user