check key words
This commit is contained in:
1 parent
6575515305
commit
8bee70fc9a
4 files changed
+8
-5
No files matched your search
+3
-1
@@ -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
@@ -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) => {
|
||||
|
||||
Reference in new issue
Block a user