Skip to content

Commit

Permalink
fix: mapFields helper function failing with missing nested keys
Browse files Browse the repository at this point in the history
  • Loading branch information
Bionus committed Mar 26, 2023
1 parent c7a78f7 commit 5b162cb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/sites/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function _set(obj: any, path: string, value: any): void {
* Get a value in an object using the dot ("a.b.c") path notation.
*/
function _get(obj: any, path: string): any {
return path.split(".").reduce((ctx, part) => ctx[part], obj);
return path.split(".").reduce((ctx, part) => ctx?.[part], obj);
}

addHelper("mapFields", (data: any, map: { [key: string]: string }): any => {
Expand Down

0 comments on commit 5b162cb

Please sign in to comment.