check key words

This commit is contained in:
codetypes committed 2025-07-31 16:19:53 +08:00
1 parent 6575515305
commit 8bee70fc9a
4 files changed
+8 -5

No files matched your search

+3 -1
View File
@@ -1,6 +1,8 @@
import { NodeDef } from "../behavior3/src/behavior3";
export const VERSION = "1.8.2";
export const VERSION = "1.8.4";
export const keyWords = ["true", "false", "null", "undefined", "NaN", "Infinity"];
export type NodeType = NodeDef["type"] | "Other" | "Error";
export type NodeArg = Exclude<NodeDef["args"], undefined>[number];
+2 -1
View File
@@ -12,6 +12,7 @@ import {
isIntType,
isJsonType,
isStringType,
keyWords,
NodeArg,
NodeData,
TreeData,
@@ -141,7 +142,7 @@ export const isNewVersion = (version: string) => {
};
export const isValidVariableName = (name: string) => {
return /^[a-zA-Z_$][a-zA-Z_$0-9]*$/.test(name);
return /^[a-zA-Z_$][a-zA-Z_$0-9]*$/.test(name) && !keyWords.includes(name);
};
export const isSubtreeRoot = (data: NodeData) => {