Skip to content

Commit 32f1908

Browse files
committed
[sc-12720] resolve SonarCloud issue: move "settingToQueryParam" to the outer scope
1 parent b106f47 commit 32f1908

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

src/apifetch.ts

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,18 @@ export type ExecuteApiFetch = (
8484
) => void;
8585
/* eslint-enable @typescript-eslint/no-explicit-any */
8686

87+
/**
88+
* Helper function to convert a setting to a query parameter string
89+
*/
90+
/* eslint-disable @typescript-eslint/no-explicit-any */
91+
const settingToQueryParam = function (setting: any, key: string): string {
92+
if (setting || setting === false) {
93+
return '&' + key + '=' + setting;
94+
}
95+
return '';
96+
};
97+
/* eslint-enable @typescript-eslint/no-explicit-any */
98+
8799
/**
88100
* Fetch search results of search suggestions from the Addsearch API
89101
*/
@@ -97,15 +109,6 @@ const executeApiFetch: ExecuteApiFetch = function (
97109
customFilterObject,
98110
recommendOptions
99111
) {
100-
/* eslint-disable @typescript-eslint/no-explicit-any */
101-
const settingToQueryParam = function (setting: any, key: string) {
102-
if (setting || setting === false) {
103-
return '&' + key + '=' + setting;
104-
}
105-
return '';
106-
};
107-
/* eslint-enable @typescript-eslint/no-explicit-any */
108-
109112
// Validate query type
110113
if (
111114
type !== 'search' &&

0 commit comments

Comments
 (0)