44 lines
1.5 KiB
TypeScript
44 lines
1.5 KiB
TypeScript
// Module ID: 4874
|
|
// Function ID: 4875
|
|
// Name: GAME_AUTOCOMPLETE_MAX_QUERY_LENGTH
|
|
// Dependencies: [4875, 2]
|
|
// Exports: isGameAutocompleteResultAllowedInGameWidgets, normalizeGameAutocompleteQuery, shouldSuppressAutocompleteFetch
|
|
|
|
// Module 4874 (GAME_AUTOCOMPLETE_MAX_QUERY_LENGTH)
|
|
const result = require("set").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(result, arg1) {
|
|
let diff = result.length - 1;
|
|
if (1 <= diff) {
|
|
const arr = arg1(result.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(c0) {
|
|
if (null == c0) {
|
|
return null;
|
|
} else {
|
|
const formatted = c0.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 = require(4875) /* GAME_WIDGET_LIMITS_BY_TYPE */.GAME_WIDGET_BANNED_APPLICATION_IDS;
|
|
return !GAME_WIDGET_BANNED_APPLICATION_IDS.has(id.id);
|
|
};
|