22 lines
495 B
TypeScript
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';
|
|
}
|
|
}
|