iptv/scripts/store/setters/status.js
Aleksandr Statciuk efeb7894cc Update status.js
2021-12-14 09:34:03 +03:00

12 lines
291 B
JavaScript

const statuses = require('../../data/statuses')
module.exports = function ({ title, status = {} }) {
if (title) {
const [_, label] = title.match(/\[(.*)\]/i) || [null, null]
return Object.values(statuses).find(s => s.label === label) || statuses['online']
}
return status
}