Browse Source

change check first character function name

tumao 4 years ago
parent
commit
e1af842e87
2 changed files with 5 additions and 5 deletions
  1. 1 1
      client/src/pages/collections/Create.tsx
  2. 4 4
      client/src/utils/Validation.ts

+ 1 - 1
client/src/pages/collections/Create.tsx

@@ -135,7 +135,7 @@ const CreateCollection: FC<CollectionCreateProps> = ({ handleCreate }) => {
         },
         // name can not start with number
         {
-          rule: 'start',
+          rule: 'firstCharacter',
           extraParam: {
             invalidTypes: [TypeEnum.number],
           },

+ 4 - 4
client/src/utils/Validation.ts

@@ -14,7 +14,7 @@ export type ValidType =
   | 'dimension'
   | 'multiple'
   | 'partitionName'
-  | 'start';
+  | 'firstCharacter';
 export interface ICheckMapParam {
   value: string;
   extraParam?: IExtraParam;
@@ -132,12 +132,12 @@ export const checkType = (type: TypeEnum, value: string): boolean => {
 };
 
 /**
- * check string start letter
+ * check input first character
  * @param value
  * @param invalidTypes
  * @returns whether start letter type not belongs to invalid types
  */
-export const checkStart = (param: {
+export const checkFirstCharacter = (param: {
   value: string;
   invalidTypes?: TypeEnum[];
 }): boolean => {
@@ -211,7 +211,7 @@ export const getCheckResult = (param: ICheckMapParam): boolean => {
       multipleNumber: extraParam?.multipleNumber,
     }),
     partitionName: checkPartitionName(value),
-    start: checkStart({
+    firstCharacter: checkFirstCharacter({
       value,
       invalidTypes: extraParam?.invalidTypes,
     }),