-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmapper.js
More file actions
executable file
·27 lines (22 loc) · 907 Bytes
/
mapper.js
File metadata and controls
executable file
·27 lines (22 loc) · 907 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// eslint-disable-next-line no-unused-vars
function Mapper (initalFunctionName) {
window.wrappedJSObject !== undefined ? this.originalWinObj = window.wrappedJSObject : this.originalWinObj = window
const mapArray = []
const parsedMethods = []
function init (functionName, level) {
level++
Object.entries(this.originalWinObj).forEach((v) => {
if (typeof v[1] === 'function' && v[0] !== functionName && v[1].toString().indexOf(functionName) !== -1 && parsedMethods.indexOf(v[0]) === -1) {
mapArray.push({ functionName: v[0], function: v[1], level })
parsedMethods.push(v[0])
init(v[0], level)
}
})
}
init(initalFunctionName, 0)
const result = mapArray
console.log('Level:', 0, 'Function Name:', initalFunctionName)
result.forEach((v) => {
console.log('Level', v.level, 'Function Name:', v.functionName, 'Function:', v.function)
})
}