Skip to content

Commit

Permalink
fix: 修复undefined问题
Browse files Browse the repository at this point in the history
  • Loading branch information
三少 committed Nov 10, 2023
1 parent e4ca678 commit 905851e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
12 changes: 7 additions & 5 deletions packages/mini-fix/src/index.ts
Expand Up @@ -103,11 +103,13 @@ function smoothOutParams() {

const filterFunctions = (obj: any, isApp = false) => {
try {
Object.keys(obj)
.filter((prop) => typeof obj[prop] === 'function')
.forEach((methodName) => {
wrapMethod(obj, methodName, isApp)
})
if (obj) {
Object.keys(obj)
.filter((prop) => typeof obj[prop] === 'function')
.forEach((methodName) => {
wrapMethod(obj, methodName, isApp)
})
}
} catch (e) {
console.info('antmjs filterFunctions error', e)
}
Expand Down
12 changes: 7 additions & 5 deletions packages/trace/src/index.ts
Expand Up @@ -461,11 +461,13 @@ const wrapMethod = function (target: any, methodName: string, isApp = false) {
*/
const filterFunctions = (obj: any, isApp = false) => {
try {
Object.keys(obj)
.filter((prop) => typeof obj[prop] === 'function')
.forEach((methodName) => {
wrapMethod(obj, methodName, isApp)
})
if (obj) {
Object.keys(obj)
.filter((prop) => typeof obj[prop] === 'function')
.forEach((methodName) => {
wrapMethod(obj, methodName, isApp)
})
}
} catch (e) {
console.info('trace filterFunctions error', e)
}
Expand Down

0 comments on commit 905851e

Please sign in to comment.