Files
iptv/scripts/core/issueData.ts

35 lines
792 B
TypeScript
Raw Normal View History

2025-02-22 12:54:00 +03:00
import { Dictionary } from '@freearhey/core'
export class IssueData {
_data: Dictionary
constructor(data: Dictionary) {
this._data = data
}
has(key: string): boolean {
return this._data.has(key)
}
missing(key: string): boolean {
return this._data.missing(key) || this._data.get(key) === undefined
}
getBoolean(key: string): boolean {
return Boolean(this._data.get(key))
}
2025-03-29 11:39:46 +03:00
getString(key: string): string | undefined {
2025-02-22 12:54:00 +03:00
const deleteSymbol = '~'
return this._data.get(key) === deleteSymbol ? '' : this._data.get(key)
}
2025-07-10 21:13:43 +03:00
getArray(key: string): string[] | undefined {
2025-02-22 12:54:00 +03:00
const deleteSymbol = '~'
2025-07-10 21:13:43 +03:00
if (this._data.missing(key)) return undefined
2025-02-27 20:55:39 +03:00
return this._data.get(key) === deleteSymbol ? [] : this._data.get(key).split('\r\n')
2025-02-22 12:54:00 +03:00
}
}