mirror of
https://github.com/iptv-org/iptv
synced 2026-09-06 12:01:57 -04:00
- stream.updateWithIssue: 'Live 24/7: Yes' meant the stream IS 24/7, but it was assigned straight to isNot247, inverting the label. A 'No' answer was also ignored because the guard skipped falsy values. - dataSet.getBoolean: an unanswered dropdown is stored as '' by parseIssueBody, which getBoolean read as false. Treat it as undefined so 'no answer' means 'leave unchanged' instead of 'Not 24/7'. - update.addStream: has() is true for an unanswered field, so it produced isNot247 = true for issues that left the dropdown blank. - generate: sortBy got five orders for four iteratees. - 2_streams_edit.yml: restore the '~' reset option dropped from the quality dropdown when the Label field was removed. - stream.getLabels: use const to satisfy prefer-const.
45 lines
1.0 KiB
TypeScript
45 lines
1.0 KiB
TypeScript
import { Dictionary } from '@freearhey/core'
|
|
|
|
export class DataSet {
|
|
_data: Dictionary<string>
|
|
constructor(data: Dictionary<string>) {
|
|
this._data = data
|
|
}
|
|
|
|
has(key: string): boolean {
|
|
return this._data.has(key)
|
|
}
|
|
|
|
missing(key: string): boolean {
|
|
const keys = Array.isArray(key) ? key : [key]
|
|
|
|
return keys.every(_key => this._data.get(_key) === undefined)
|
|
}
|
|
|
|
isDeleted(key: string): boolean {
|
|
const deleteSymbol = '~'
|
|
|
|
return this._data.get(key) === deleteSymbol
|
|
}
|
|
|
|
getBoolean(key: string): boolean | undefined {
|
|
const value = this._data.get(key)
|
|
|
|
if (value === undefined || value === '') return undefined
|
|
|
|
return value === 'TRUE'
|
|
}
|
|
|
|
getString(key: string): string | undefined {
|
|
return this._data.get(key)
|
|
}
|
|
|
|
getArray(key: string): string[] | undefined {
|
|
if (this._data.missing(key)) return undefined
|
|
|
|
const value = this._data.get(key)
|
|
|
|
return !value || this.isDeleted(key) ? [] : value.split('\r\n')
|
|
}
|
|
}
|