Fix: unhandled rejection, notif center settings not being respected

This commit is contained in:
csrapr 2021-02-25 20:00:26 +00:00 committed by Josh Harvey
parent f0afbf0137
commit 61fec80899
2 changed files with 10 additions and 3 deletions

View file

@ -180,6 +180,12 @@ function getAlertTypes (alertRec, config) {
return alerts
}
const stripl = _.curry((q, str) => _.startsWith(q, str) ? str.slice(q.length) : str)
const filter = namespace => _.pickBy((value, key) => _.startsWith(`${namespace}_`)(key))
const strip = key => _.mapKeys(stripl(`${key}_`))
const fromNamespace = _.curry((key, config) => _.compose(strip(key), filter(key))(config))
module.exports = {
codeDisplay,
parseEventNote,
@ -196,5 +202,6 @@ module.exports = {
formatCurrency,
formatAge,
buildDetail,
deviceAlerts
deviceAlerts,
fromNamespace
}