Skip to content

Commit 8c7f57a

Browse files
liujupingJackLian
authored andcommitted
fix: fix isJSFunction lacks the judgment of the old version of the protocol
1 parent f25babe commit 8c7f57a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed
Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1+
/**
2+
* 内部版本 的 { type: 'JSExpression', source: '', value: '', extType: 'function' } 能力上等同于 JSFunction
3+
*/
4+
export function isInnerJsFunction(data: any) {
5+
return data && data.type === 'JSExpression' && data.extType === 'function';
6+
}
17

2-
export function isJSFunction(x: any): boolean {
3-
return typeof x === 'object' && x && x.type === 'JSFunction';
8+
export function isJSFunction(data: any): boolean {
9+
return typeof data === 'object' && data && data.type === 'JSFunction' || isInnerJsFunction(data);
410
}

0 commit comments

Comments
 (0)