check key words
This commit is contained in:
1 parent
6575515305
commit
8bee70fc9a
4 files changed
+8
-5
No files matched your search
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "behavior3editor",
|
||||
"version": "1.8.3",
|
||||
"version": "1.8.4",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "behavior3editor",
|
||||
"version": "1.8.3",
|
||||
"version": "1.8.4",
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "behavior3editor",
|
||||
"version": "1.8.3",
|
||||
"version": "1.8.4",
|
||||
"main": "dist-electron/main/index.js",
|
||||
"description": "行为树编辑器",
|
||||
"author": "zhandouxiaojiji & codetypes",
|
||||
|
||||
+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