Files
materialious/materialious/src/lib/api/misc.ts
T
2026-02-11 22:09:26 +13:00

22 lines
495 B
TypeScript

import type { CommentsOptions, SearchOptions } from './model';
export function searchSetDefaults(options: SearchOptions) {
if (typeof options.sort_by === 'undefined') {
options.sort_by = 'relevance';
}
if (typeof options.type === 'undefined') {
options.type = 'all';
}
if (typeof options.page === 'undefined') {
options.page = '1';
}
}
export function commentsSetDefaults(options: CommentsOptions) {
if (typeof options.sort_by === 'undefined') {
options.sort_by = 'top';
}
}