You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

37 lines
701 B

export class PageNumber {
num: number
constructor(public page: number) {
if (typeof page === 'string' && /^\d+$/.test(page)) {
this.num = parseInt(page, 10)
}
if (typeof page === 'number' && page > 0) {
this.num = page
}
this.num = 1
}
}
export class OptionItem {
constructor(public page: number, public q?: string, public isChecked?: string) {}
static valueOf({
page,
q = '',
isChecked = ''
}: {
page: number
q?: string
isChecked?: string
}): OptionItem {
return new OptionItem(page, q, isChecked)
}
toObject(): Object {
return {
page: this.page,
q: this.q,
isChecked: this.isChecked
}
}
}