mirror of
https://github.com/iptv-org/database.git
synced 2024-11-25 03:51:28 -05:00
Update channel.ts
This commit is contained in:
parent
454ed7f5e8
commit
7ab66d6c7f
1 changed files with 12 additions and 5 deletions
|
@ -75,11 +75,18 @@ export class Channel {
|
||||||
this.logo = logo
|
this.logo = logo
|
||||||
}
|
}
|
||||||
|
|
||||||
update(data: { [key: string]: string }) {
|
data() {
|
||||||
for (const key in data) {
|
const { ...object } = this
|
||||||
if (this[key] && data[key]) {
|
|
||||||
this[key] = data[key]
|
return object
|
||||||
}
|
}
|
||||||
|
|
||||||
|
merge(channel: Channel) {
|
||||||
|
const data: { [key: string]: string | string[] | boolean } = channel.data()
|
||||||
|
for (const prop in data) {
|
||||||
|
if (data[prop] === undefined) continue
|
||||||
|
if (Array.isArray(data[prop]) && !data[prop].length) continue
|
||||||
|
this[prop] = data[prop]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue