UNPKG
ibird-core
Version:
latest (0.9.60)
0.9.60
0.9.58
0.9.57
0.9.56
0.9.55
0.9.54
0.9.53
0.9.52
0.9.51
0.9.50
0.9.49
0.9.48
0.9.47
0.9.46
0.9.45
0.9.44
0.9.43
0.9.42
0.9.41
0.9.40
0.9.39
0.9.38
0.9.37
0.9.36
0.9.35
0.9.34
0.9.33
0.9.32
0.9.31
0.9.30
0.9.29
0.9.28
0.9.27
0.9.26
0.9.25
0.9.24
0.9.23
0.9.22
0.9.21
0.9.20
0.9.19
0.9.18
0.9.17
0.9.16
0.9.15
0.9.14
0.9.13
0.9.12
0.9.11
0.9.10
0.9.9
0.9.8
0.9.7
0.9.6
0.9.5
0.9.4
0.9.3
0.9.2
0.9.1
The core module of ibird.
github.com/yinfxs/ibird
yinfxs/ibird
ibird-core
/
lib
/
hooks.js
14 lines
•
349 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
/** * 钩子处理 *
@param
fns 处理函数数组类型 *
@param
data 传递参数 *
@returns
{
Promise.<*>
} */
module
.
exports
=
async
(fns, data) => {
if
(!fns)
return
;
if
(!
Array
.
isArray
(fns) || fns.
length
===
0
) fns = [fns];
for
(
const
fn
of
fns) {
if
(
typeof
fn !==
'function'
)
continue
;
await
fn
(data); } };