Skip to content

Commit

Permalink
Merge branch 'master' into feat/storage-feature
Browse files Browse the repository at this point in the history
  • Loading branch information
arturovt authored Mar 13, 2024
2 parents 589d87b + 42a8ed3 commit 033e7c8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/store/src/internal/internals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,13 @@ export interface StatesAndDefaults {
* @ignore
*/
function compliantPropGetter(paths: string[]): (x: any) => any {
const copyOfPaths = paths.slice();
return obj => copyOfPaths.reduce((acc: any, part: string) => acc && acc[part], obj);
return obj => {
for (let i = 0; i < paths.length; i++) {
if (!obj) return undefined;
obj = obj[paths[i]];
}
return obj;
};
}

/**
Expand Down

0 comments on commit 033e7c8

Please sign in to comment.