mirror of
https://github.com/iptv-org/iptv.git
synced 2025-05-11 17:40:03 -04:00
Update scripts
This commit is contained in:
parent
74b3cff1d2
commit
02ec7e6f76
42 changed files with 1317 additions and 694 deletions
30
scripts/models/timezone.ts
Normal file
30
scripts/models/timezone.ts
Normal file
|
@ -0,0 +1,30 @@
|
|||
import { Collection, Dictionary } from '@freearhey/core'
|
||||
|
||||
type TimezoneData = {
|
||||
id: string
|
||||
utc_offset: string
|
||||
countries: string[]
|
||||
}
|
||||
|
||||
export class Timezone {
|
||||
id: string
|
||||
utcOffset: string
|
||||
countryCodes: Collection
|
||||
countries?: Collection
|
||||
|
||||
constructor(data: TimezoneData) {
|
||||
this.id = data.id
|
||||
this.utcOffset = data.utc_offset
|
||||
this.countryCodes = new Collection(data.countries)
|
||||
}
|
||||
|
||||
withCountries(countriesGroupedByCode: Dictionary): this {
|
||||
this.countries = this.countryCodes.map((code: string) => countriesGroupedByCode.get(code))
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
getCountries(): Collection {
|
||||
return this.countries || new Collection()
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue