router-register-plugin
Version:
鸿蒙ZRouter动态路由框架页面模板化插件
31 lines (26 loc) • 812 B
text/typescript
/**
* @author: HZWei
* @date: 2024/12/5
* @desc:
*/
import ts, { isClassDeclaration, isIdentifier, isStructDeclaration } from "ohos-typescript";
export default class NodeHelper {
static getClassName(node: ts.Node) {
let className = ""
if (isClassDeclaration(node) || isStructDeclaration(node)) {
if (node.name && isIdentifier(node.name)) {
className = node.name.escapedText ?? ""
}
}
return className
}
static getBooleanByKind(kind: ts.SyntaxKind) {
let value = false
if (kind && kind === ts.SyntaxKind.FalseKeyword) {
value = false
} else if (kind && kind === ts.SyntaxKind.TrueKeyword) {
value = true
}
return value
}
}