mirror of
https://github.com/iptv-org/database.git
synced 2024-12-22 07:50:23 -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
|
||||
}
|
||||
|
||||
update(data: { [key: string]: string }) {
|
||||
for (const key in data) {
|
||||
if (this[key] && data[key]) {
|
||||
this[key] = data[key]
|
||||
}
|
||||
data() {
|
||||
const { ...object } = this
|
||||
|
||||
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