mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-13 20:27:19 +00:00
12 lines
313 B
TypeScript
12 lines
313 B
TypeScript
/**
|
|
* 去掉 JS 表达式的 "{...}" 的封装, 如:
|
|
* {<xxx />} => <xxx />
|
|
*/
|
|
export function unwrapJsExprQuoteInJsx(jsxExpr: string): string {
|
|
if (jsxExpr.length >= 2 && jsxExpr[0] === '{' && jsxExpr[jsxExpr.length - 1] === '}') {
|
|
return jsxExpr.slice(1, jsxExpr.length - 1);
|
|
}
|
|
|
|
return jsxExpr;
|
|
}
|