(obj, className)
| 80 | } |
| 81 | |
| 82 | export const methodsOfObject = function (obj, className) { |
| 83 | const methods = [] |
| 84 | |
| 85 | const standard = ['constructor', 'toString', 'toLocaleString', 'valueOf', 'hasOwnProperty', 'bind', 'apply', 'call', 'isPrototypeOf', 'propertyIsEnumerable'] |
| 86 | |
| 87 | function pushToMethods(prop) { |
| 88 | try { |
| 89 | if (!isFunction(obj[prop]) && !isAsyncFunction(obj[prop])) return |
| 90 | } catch (err) { |
| 91 | // can't access property |
| 92 | return |
| 93 | } |
| 94 | if (standard.indexOf(prop) >= 0) return |
| 95 | if (prop.indexOf('_') === 0) return |
| 96 | methods.push(prop) |
| 97 | } |
| 98 | |
| 99 | while (obj.constructor.name !== className) { |
| 100 | Object.getOwnPropertyNames(obj).forEach(pushToMethods) |
| 101 | obj = Object.getPrototypeOf(obj) |
| 102 | |
| 103 | if (!obj || !obj.constructor) break |
| 104 | } |
| 105 | return methods |
| 106 | } |
| 107 | |
| 108 | export const template = function (template, data) { |
| 109 | return template.replace(/{{([^{}]*)}}/g, (a, b) => { |
no outgoing calls
no test coverage detected