MCPcopy Index your code
hub / github.com/codeceptjs/CodeceptJS / methodsOfObject

Function methodsOfObject

lib/utils.js:82–106  ·  view source on GitHub ↗
(obj, className)

Source from the content-addressed store, hash-verified

80}
81
82export 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
108export const template = function (template, data) {
109 return template.replace(/{{([^{}]*)}}/g, (a, b) => {

Callers 5

actor.jsFile · 0.90
completerFunction · 0.90
getFunction · 0.90
list.jsFile · 0.90
mcp-server.jsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected