All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m15s
- 将逻辑转移到Server端后,简化前端逻辑
17 lines
372 B
TypeScript
17 lines
372 B
TypeScript
/**
|
|
* 搜索索引转换器
|
|
* @param hit 搜索条目
|
|
* @returns 转换后的搜索条目视图模型
|
|
*
|
|
* ---
|
|
* @example
|
|
* const view = toSearchItemView(item, 'products');
|
|
*/
|
|
export function toSearchItemView<T extends MeiliSearchItemType>(
|
|
item: MeiliIndexMap[T],
|
|
type: T
|
|
): SearchItemView {
|
|
const converter = converters[type];
|
|
return converter(item);
|
|
}
|