You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
381 B
17 lines
381 B
const dataHook = function(dataList = [], hook) {
|
|
if (
|
|
!dataList instanceof Array ||
|
|
!dataList.length ||
|
|
!dataList.every(item => typeof item == "string")
|
|
)
|
|
return {}
|
|
if (!hook instanceof Function) hook = () => void 0
|
|
let obj = {
|
|
observers: {}
|
|
},
|
|
key = dataList.join(",")
|
|
obj["observers"][key] = hook
|
|
return obj
|
|
}
|
|
|
|
module.exports = dataHook
|