(target, key, src, metaVal)
| 17 | || key === 'hasListeners'; |
| 18 | /** API types or enums or literal constants */ |
| 19 | const proxifyValue = (target, key, src, metaVal) => { |
| 20 | const srcVal = src[key]; |
| 21 | if (srcVal === undefined) return; |
| 22 | let res; |
| 23 | if (isFunction(metaVal)) { |
| 24 | res = metaVal(src, srcVal); |
| 25 | } else if (isFunction(srcVal)) { |
| 26 | res = metaVal === 0 || isSyncMethodName(key) || !hasOwnProperty(src, key) |
| 27 | ? srcVal::bind(src) |
| 28 | : wrapAsync(src, srcVal); // eslint-disable-line no-use-before-define |
| 29 | } else if (isObject(srcVal) && metaVal !== 0) { |
| 30 | res = proxifyGroup(srcVal, metaVal); // eslint-disable-line no-use-before-define |
| 31 | } else { |
| 32 | res = srcVal; |
| 33 | } |
| 34 | target[key] = res; |
| 35 | return res; |
| 36 | }; |
| 37 | const proxifyGroup = (src, meta) => new SafeProxy({ __proto__: null }, { |
| 38 | __proto__: null, |
| 39 | get: (group, key) => group[key] ?? proxifyValue(group, key, src, meta?.[key]), |
no test coverage detected