MCPcopy
hub / github.com/baidu/amis / isPureVariable

Function isPureVariable

packages/amis-core/src/utils/isPureVariable.ts:3–15  ·  view source on GitHub ↗
(path?: any)

Source from the content-addressed store, hash-verified

1import {memoryParse} from './memoryParse';
2
3export function isPureVariable(path?: any): path is string {
4 if (typeof path === 'string' && path.includes('$')) {
5 try {
6 const ast = memoryParse(path);
7 // 只有一个成员说明是纯表达式模式
8 return ast?.body.length === 1 && ast.body[0].type === 'script';
9 } catch (err) {
10 return false;
11 }
12 }
13
14 return false;
15}

Callers 15

renderMethod · 0.90
constructorMethod · 0.90
updateContentMethod · 0.90
componentDidUpdateMethod · 0.90
renderMethod · 0.90
componentDidUpdateMethod · 0.90
renderMethod · 0.90
getImageSettingsMethod · 0.90
renderMethod · 0.90
TimelineCmptFunction · 0.90
componentDidUpdateMethod · 0.90
componentDidUpdateMethod · 0.90

Calls 1

memoryParseFunction · 0.90

Tested by

no test coverage detected