UNPKG

781 BJavaScriptView Raw
1
2export default function (binder, data) {
3
4 if (binder.type === 'on') {
5 return data;
6 }
7
8 if (!binder.pipes.length) {
9 return data;
10 }
11
12 const methods = binder.container.methods;
13
14 if (!methods) {
15 return data;
16 }
17
18 for (let i = 0, l = binder.pipes.length; i < l; i++) {
19 const name = binder.pipes[i];
20
21 if (name in methods) {
22 const method = methods[name];
23 if (method && method.constructor === Function) {
24 data = methods[name].call(binder.container, data);
25 } else {
26 console.warn(`Oxe.piper - pipe ${name} invalid type`);
27 }
28 } else {
29 console.warn(`Oxe.piper - pipe ${name} not found`);
30 }
31
32 }
33
34 return data;
35}