Skip to content

Commit

Permalink
chore: all finished
Browse files Browse the repository at this point in the history
  • Loading branch information
zombieJ committed May 31, 2021
1 parent 7fe5e93 commit b8b2c2a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/index.ts
Expand Up @@ -302,7 +302,7 @@ class Schema {
);
}

getType(rule: RuleItem) {
getType(rule: InternalRuleItem) {
if (rule.type === undefined && rule.pattern instanceof RegExp) {
rule.type = 'pattern';
}
Expand All @@ -316,7 +316,7 @@ class Schema {
return rule.type || 'string';
}

getValidationMethod(rule: RuleItem) {
getValidationMethod(rule: InternalRuleItem) {
if (typeof rule.validator === 'function') {
return rule.validator;
}
Expand Down
3 changes: 2 additions & 1 deletion src/interface.ts
Expand Up @@ -192,7 +192,8 @@ export interface RuleValuePackage {
field: string;
}

export interface InternalRuleItem extends RuleItem {
export interface InternalRuleItem extends Omit<RuleItem, 'validator'> {
field?: string;
fullField?: string;
validator?: RuleItem['validator'] | ExecuteValidator;
}
4 changes: 2 additions & 2 deletions src/util.ts
Expand Up @@ -82,7 +82,7 @@ export function format(
return template;
}

function isNativeStringType(type: RuleType) {
function isNativeStringType(type: string) {
return (
type === 'string' ||
type === 'url' ||
Expand All @@ -93,7 +93,7 @@ function isNativeStringType(type: RuleType) {
);
}

export function isEmptyValue(value: Value, type?: RuleType) {
export function isEmptyValue(value: Value, type?: string) {
if (value === undefined || value === null) {
return true;
}
Expand Down

0 comments on commit b8b2c2a

Please sign in to comment.