(self, name)
| 26 | }; |
| 27 | |
| 28 | export const createFunction = (self, name) => { |
| 29 | const cbs = [...worker(name)]; |
| 30 | if (cbs.length) { |
| 31 | const cb = toJSONCallback( |
| 32 | self[`_${name}`] || |
| 33 | (name.endsWith("Async") |
| 34 | ? async (wrap, xworker, ...cbs) => { |
| 35 | for (const cb of cbs) await cb(wrap, xworker); |
| 36 | } |
| 37 | : (wrap, xworker, ...cbs) => { |
| 38 | for (const cb of cbs) cb(wrap, xworker); |
| 39 | }), |
| 40 | ); |
| 41 | const a = cbs.map(toJSONCallback).join(", "); |
| 42 | return Function(`return(w,x)=>(${cb})(w,x,...[${a}])`)(); |
| 43 | } |
| 44 | }; |
| 45 | |
| 46 | const SetFunction = typedSet({ typeof: "function" }); |
| 47 | const SetString = typedSet({ typeof: "string" }); |
no test coverage detected