Update scripts

This commit is contained in:
freearhey
2025-09-02 01:36:29 +03:00
parent 5397ab25b0
commit 825d198ac8
3 changed files with 15 additions and 0 deletions

View File

@@ -8,6 +8,7 @@ export class Subdivision {
countryCode: string
country?: Country
parentCode?: string
parent?: Subdivision
regions?: Collection
cities?: Collection
@@ -40,6 +41,14 @@ export class Subdivision {
return this
}
withParent(subdivisionsKeyByCode: Dictionary): this {
if (!this.parentCode) return this
this.parent = subdivisionsKeyByCode.get(this.parentCode)
return this
}
getRegions(): Collection {
if (!this.regions) return new Collection()