feat: notifications rework
This commit is contained in:
parent
b6e7d98b72
commit
ffa8713ee4
77 changed files with 2281 additions and 3269 deletions
21
new-lamassu-admin/src/utils/config.js
Normal file
21
new-lamassu-admin/src/utils/config.js
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
import * as R from 'ramda'
|
||||
|
||||
const mapKeys = R.curry((fn, obj) =>
|
||||
R.fromPairs(R.map(R.adjust(0, fn), R.toPairs(obj)))
|
||||
)
|
||||
|
||||
const filterByKey = R.curry((fn, obj) =>
|
||||
R.fromPairs(R.filter(it => fn(it[0]), R.toPairs(obj)))
|
||||
)
|
||||
|
||||
const stripl = R.curry((q, str) =>
|
||||
R.startsWith(q, str) ? str.slice(q.length) : str
|
||||
)
|
||||
|
||||
const filtered = key => filterByKey(R.startsWith(`${key}_`))
|
||||
const stripped = key => mapKeys(stripl(`${key}_`))
|
||||
|
||||
const fromServer = key => R.compose(stripped(key), filtered(key))
|
||||
const toServer = key => mapKeys(it => `${key}_${it}`)
|
||||
|
||||
export { fromServer, toServer }
|
||||
Loading…
Add table
Add a link
Reference in a new issue