fix: fix isJSFunction lacks the judgment of the old version of the protocol

This commit is contained in:
liujuping 2023-01-13 18:01:29 +08:00 committed by 林熠
parent f25babe728
commit 8c7f57a120

View File

@ -1,4 +1,10 @@
export function isJSFunction(x: any): boolean {
return typeof x === 'object' && x && x.type === 'JSFunction';
/**
* { type: 'JSExpression', source: '', value: '', extType: 'function' } JSFunction
*/
export function isInnerJsFunction(data: any) {
return data && data.type === 'JSExpression' && data.extType === 'function';
}
export function isJSFunction(data: any): boolean {
return typeof data === 'object' && data && data.type === 'JSFunction' || isInnerJsFunction(data);
}