fix: ensures getDataByPath works

This commit is contained in:
James
2021-12-22 14:18:50 -05:00
parent 35bf092813
commit 140a3aa9ea
3 changed files with 4 additions and 2 deletions

View File

@@ -7,7 +7,7 @@ const getDataByPath = (fields: Fields, path: string): unknown => {
const name = path.split('.').pop();
const data = Object.keys(fields).reduce((matchedData, key) => {
if (key.indexOf(`${path}.`) === 0) {
if (key.indexOf(`${path}.`) === 0 || key === path) {
return {
...matchedData,
[key.replace(pathPrefixToRemove, '')]: fields[key],