Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4941.js (118.4 MB)
47 lines
1.5 KiB
TypeScript
47 lines
1.5 KiB
TypeScript
// Module ID: 5320
|
|
// Function ID: 5321
|
|
// Name: GameAutocompleteUtils
|
|
// Dependencies: [5321, 2]
|
|
// Exports: isGameAutocompleteResultAllowedInGameWidgets, normalizeGameAutocompleteQuery, shouldSuppressAutocompleteFetch
|
|
|
|
// Module 5320 (GameAutocompleteUtils)
|
|
import GameWidgetLimits from "GameWidgetLimits" /* 5321 */;
|
|
import size from "module_2" /* 2 */;
|
|
|
|
const result = size.fileFinishedImporting("modules/games/autocomplete/GameAutocompleteUtils.tsx");
|
|
|
|
export const GAME_AUTOCOMPLETE_MAX_QUERY_LENGTH = 100;
|
|
export const MIN_TRUSTED_EMPTY_PREFIX_LENGTH = 7;
|
|
export const shouldSuppressAutocompleteFetch = function shouldSuppressAutocompleteFetch(arr, fn) {
|
|
let diff = arr.length - 1;
|
|
if (1 <= diff) {
|
|
arr = fn(arr.slice(0, diff));
|
|
while (null == arr) {
|
|
diff = diff - 1;
|
|
}
|
|
let tmp3 = arr.length <= 0;
|
|
if (tmp3) {
|
|
tmp3 = diff >= 7;
|
|
}
|
|
return tmp3;
|
|
}
|
|
return false;
|
|
};
|
|
export const normalizeGameAutocompleteQuery = function normalizeGameAutocompleteQuery(query) {
|
|
if (null == query) {
|
|
return null;
|
|
} else {
|
|
const formatted = query.trim().toLowerCase();
|
|
const replaced = formatted.replaceAll("_", " ");
|
|
const substr = replaced.slice(0, 100);
|
|
let tmp = null;
|
|
if (substr.length > 0) {
|
|
tmp = substr;
|
|
}
|
|
return tmp;
|
|
}
|
|
};
|
|
export const isGameAutocompleteResultAllowedInGameWidgets = function isGameAutocompleteResultAllowedInGameWidgets(id) {
|
|
const GAME_WIDGET_BANNED_APPLICATION_IDS = GameWidgetLimits.GAME_WIDGET_BANNED_APPLICATION_IDS;
|
|
return !GAME_WIDGET_BANNED_APPLICATION_IDS.has(id.id);
|
|
};
|