Skip to content

Commit cc79fd2

Browse files
committed
fix: review
1 parent 83c5385 commit cc79fd2

File tree

1 file changed

+4
-20
lines changed

1 file changed

+4
-20
lines changed

src/utils/flattenUnipika.ts

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -553,22 +553,6 @@ function rowSearchInfo(
553553
return res.length ? res : undefined;
554554
}
555555

556-
/**
557-
* Check if primitive value matches filter
558-
*/
559-
function checkPrimitiveMatch(
560-
value: UnipikaValue,
561-
filter: string,
562-
settings: UnipikaSettings,
563-
currentPath: string,
564-
): Array<string> {
565-
if (value.$type === 'map' || value.$type === 'list') {
566-
return [];
567-
}
568-
const valueMatch = rowSearchInfo(value, filter, settings);
569-
return valueMatch && currentPath ? [currentPath] : [];
570-
}
571-
572556
/**
573557
* Collect matches from attributes
574558
*/
@@ -670,23 +654,23 @@ function collectAllMatchPaths(
670654
}
671655

672656
// Process nested structures
673-
if (value.$type === 'map' && value.$value) {
657+
if (value.$type === 'map') {
674658
// Get value path with JSON $ prefix if needed for structures
675659
const valuePath = getJsonValuePath(value, isJson, currentPath);
676660
const mapMatches = collectMapMatches(value.$value, filter, settings, isJson, valuePath);
677661
if (mapMatches.length > 0) {
678662
dstPaths.push(...mapMatches);
679663
}
680-
} else if (value.$type === 'list' && value.$value) {
664+
} else if (value.$type === 'list') {
681665
// Get value path with JSON $ prefix if needed for structures
682666
const valuePath = getJsonValuePath(value, isJson, currentPath);
683667
const listMatches = collectListMatches(value.$value, filter, settings, isJson, valuePath);
684668
if (listMatches.length > 0) {
685669
dstPaths.push(...listMatches);
686670
}
687671
} else {
688-
// Check primitive values
689-
const primitiveMatches = checkPrimitiveMatch(value, filter, settings, currentPath);
672+
const valueMatch = rowSearchInfo(value, filter, settings);
673+
const primitiveMatches = valueMatch && currentPath ? [currentPath] : [];
690674
if (primitiveMatches.length > 0) {
691675
dstPaths.push(...primitiveMatches);
692676
}

0 commit comments

Comments
 (0)