Skip to content

Commit

Permalink
fix: improved function display, fix #1852
Browse files Browse the repository at this point in the history
  • Loading branch information
Akryum committed May 8, 2022
1 parent 0c78611 commit 0247fdc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/shared-utils/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -353,13 +353,14 @@ export function getCustomFunctionDetails (func: Function): CustomState {
// Trim any excess whitespace from the argument string
const match = matches && matches[0]
const args = typeof match === 'string'
? `(${match.substring(1, match.length - 2).split(',').map(a => a.trim()).join(', ')})`
? match
: '(?)'
const name = typeof func.name === 'string' ? func.name : ''
return {
_custom: {
type: 'function',
display: `<span>f</span> ${escape(name)}${args}`,
display: `<span style="opacity:.5;">function</span> ${escape(name)}${args}`,
tooltip: string.trim() ? `<pre>${string}</pre>` : null,
_reviveId: reviveCache.cache(func),
},
}
Expand Down

0 comments on commit 0247fdc

Please sign in to comment.