mirror of https://github.com/iptv-org/iptv
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
527 B
TypeScript
28 lines
527 B
TypeScript
import { Dictionary } from '@freearhey/core'
|
|
import { Country } from '.'
|
|
|
|
type SubdivisionData = {
|
|
code: string
|
|
name: string
|
|
country: string
|
|
}
|
|
|
|
export class Subdivision {
|
|
code: string
|
|
name: string
|
|
countryCode: string
|
|
country?: Country
|
|
|
|
constructor(data: SubdivisionData) {
|
|
this.code = data.code
|
|
this.name = data.name
|
|
this.countryCode = data.country
|
|
}
|
|
|
|
withCountry(countriesGroupedByCode: Dictionary): this {
|
|
this.country = countriesGroupedByCode.get(this.countryCode)
|
|
|
|
return this
|
|
}
|
|
}
|