@chantouchsek/validatorjs
Advanced tools
Comparing version 2.0.0 to 2.0.1
type LangTypes = 'ar' | 'az' | 'be' | 'bg' | 'bs' | 'ca' | 'cs' | 'cy' | 'da' | 'de' | 'el' | 'en' | 'es' | 'et' | 'eu' | 'fa' | 'fi' | 'fr' | 'hr' | 'hu' | 'id' | 'it' | 'ja' | 'ka' | 'km' | 'ko' | 'lt' | 'lv' | 'mk' | 'mn' | 'ms' | 'nb_NO' | 'nl' | 'pl' | 'pt' | 'pt_BR' | 'ro' | 'ru' | 'se' | 'sl' | 'sq' | 'sr' | 'sv' | 'tr' | 'ua' | 'uk' | 'uz' | 'vi' | 'zh' | 'zh_TW'; | ||
type RuleType = 'accepted' | 'alpha' | 'alpha_dash' | 'alpha_num' | 'array' | 'boolean' | 'date' | 'email' | 'hex' | 'integer' | 'ipv4' | 'ipv6' | 'numeric' | 'nullable' | 'password' | 'present' | 'required' | 'regex' | 'sometimes' | 'string' | 'url' | 'after' | 'after_or_equal' | 'required_if' | 'required_unless' | 'required_with' | 'required_with_all' | 'required_without' | 'required_without_all' | 'size' | 'min' | 'max' | 'between' | 'same' | 'different' | 'in' | 'not_in' | 'confirmed' | 'digits' | 'digits_between' | 'before' | 'before_or_equal' | 'ip' | string; | ||
type RuleType = 'accepted' | 'after' | 'after_or_equal' | 'alpha' | 'alpha_dash' | 'alpha_num' | 'array' | 'before' | 'before_or_equal' | 'between' | 'boolean' | 'confirmed' | 'date' | 'different' | 'digits' | 'digits_between' | 'email' | 'hex' | 'in' | 'integer' | 'ip' | 'ipv4' | 'ipv6' | 'max' | 'min' | 'not_in' | 'nullable' | 'numeric' | 'password' | 'present' | 'regex' | 'required' | 'required_if' | 'required_unless' | 'required_with' | 'required_with_all' | 'required_without' | 'required_without_all' | 'same' | 'size' | 'sometimes' | 'string' | 'url' | string; | ||
type SimpleObject<T = any> = Record<string, T>; | ||
interface ValidatorOptions { | ||
locale?: LangTypes; | ||
confirmedReverse?: boolean; | ||
customAttributes?: SimpleObject; | ||
customMessages?: SimpleObject; | ||
customAttributes?: SimpleObject; | ||
defaultAttributeName?: Partial<Record<LangTypes, string>>; | ||
locale?: LangTypes; | ||
} | ||
@@ -17,22 +17,22 @@ type CbFunction<R = any> = ((...arg: any) => R); | ||
private readonly async; | ||
attribute: string; | ||
static rules: SimpleObject; | ||
private _customMessage; | ||
private callback; | ||
private input; | ||
private passes; | ||
private input; | ||
private rule; | ||
private validator; | ||
static rules: SimpleObject; | ||
private callback; | ||
attribute: string; | ||
constructor(name: string, fn: VoidFunction, async: boolean); | ||
validate(input: SimpleObject | string | number, rule: SimpleObject, attribute?: string, callback?: CbFunction): any; | ||
_apply(input: SimpleObject | string | number, rule: SimpleObject, attribute: string | null, callback?: CbFunction): any; | ||
_setValidatingData(attribute: string, input: SimpleObject | string | number, rule: any): void; | ||
_apply(input: SimpleObject | number | string, rule: SimpleObject, attribute: null | string, callback?: CbFunction): any; | ||
_getValueType(): "numeric" | "string"; | ||
static _setRules(): void; | ||
_setValidatingData(attribute: string, input: SimpleObject | number | string, rule: any): void; | ||
get customMessages(): string | undefined; | ||
getParameters(): (string | number)[]; | ||
getSize(value?: string | number | Array<string | number>): string | number; | ||
_getValueType(): "numeric" | "string"; | ||
getSize(value?: Array<number | string> | number | string): number | string; | ||
isMissed(): boolean; | ||
response(passes: boolean | undefined, message?: string): void; | ||
setValidator(validator: Validator): void; | ||
isMissed(): boolean; | ||
get customMessages(): string | undefined; | ||
static _setRules(): void; | ||
validate(input: SimpleObject | number | string, rule: SimpleObject, attribute?: string, callback?: CbFunction): any; | ||
} | ||
@@ -42,9 +42,9 @@ declare class Manager { | ||
implicitRules: string[]; | ||
make(name: string, validator: Validator): Rule; | ||
isAsync(name: string): boolean; | ||
isImplicit(name: string): boolean; | ||
make(name: string, validator: Validator): Rule; | ||
register(name: string, fn: CbFunction): void; | ||
registerImplicit(name: string, fn: CbFunction): void; | ||
registerAsync(name: string, fn: CbFunction): void; | ||
registerAsyncImplicit(name: string, fn: CbFunction): void; | ||
registerImplicit(name: string, fn: CbFunction): void; | ||
registerMissedRuleValidator(fn: CbFunction, message?: string): void; | ||
@@ -56,15 +56,15 @@ } | ||
defaultAttributeName?: string | undefined; | ||
static replacements: SimpleObject; | ||
private attributeFormatter; | ||
private attributeNames; | ||
customMessages: SimpleObject; | ||
private attributeNames; | ||
private attributeFormatter; | ||
static replacements: SimpleObject; | ||
constructor(messages: SimpleObject, defaultAttributeName?: string | undefined); | ||
static _setReplacements(): void; | ||
_setCustom(customMessages?: SimpleObject): void; | ||
_setAttributeNames(attributes: SimpleObject): void; | ||
_setAttributeFormatter(func: any): void; | ||
_getAttributeName(attribute: string): string; | ||
render(rule: Rule): string; | ||
_getTemplate(rule: Rule): string; | ||
_replacePlaceholders(rule: Rule, template: string, data: SimpleObject): string; | ||
_setAttributeFormatter(func: any): void; | ||
_setAttributeNames(attributes: SimpleObject): void; | ||
_setCustom(customMessages?: SimpleObject): void; | ||
static _setReplacements(): void; | ||
render(rule: Rule): string; | ||
} | ||
@@ -74,13 +74,13 @@ | ||
private errors; | ||
private _getFields; | ||
add(field: string, message: string | string[], forceUpdate?: boolean): void; | ||
missed(field: string | string[]): boolean; | ||
get(field: string | string[]): string[]; | ||
first(field: string | string[]): string; | ||
all(): SimpleObject<string[]>; | ||
has(field: string | string[]): boolean; | ||
clear(attribute?: string | string[]): void; | ||
fill(errors: SimpleObject<string[]>): void; | ||
clear(attribute?: string | string[]): void; | ||
first(field: string | string[]): string; | ||
flush(): void; | ||
get(field: string | string[]): string[]; | ||
has(field: string | string[]): boolean; | ||
missed(field: string | string[]): boolean; | ||
onKeydown(event: KeyboardEvent): void; | ||
private _getFields; | ||
} | ||
@@ -94,53 +94,53 @@ | ||
readonly options: ValidatorOptions; | ||
static attributeFormatter: typeof formatter; | ||
static lang: LangTypes; | ||
static manager: Manager; | ||
private readonly confirmedReverse; | ||
errorCount: number; | ||
readonly errors: Errors; | ||
hasAsync: boolean; | ||
readonly messages: Messages; | ||
readonly numericRules: string[]; | ||
stopOnAttributes: SimpleObject | boolean | string[] | undefined; | ||
readonly numericRules: string[]; | ||
readonly errors: Errors; | ||
readonly messages: Messages; | ||
private readonly confirmedReverse; | ||
static lang: LangTypes; | ||
static attributeFormatter: typeof formatter; | ||
static manager: Manager; | ||
constructor(input: SimpleObject | null, rules?: SimpleObject, options?: ValidatorOptions); | ||
check(): boolean; | ||
checkAsync(passes?: boolean | (() => void), fails?: any): void; | ||
_parseRules(rules?: SimpleObject): SimpleObject; | ||
static getDefaultLang(): LangTypes; | ||
static getMessages(lang: LangTypes): SimpleObject; | ||
static register(name: string, fn: any, message?: string): void; | ||
static registerAsync(name: string, fn: any, message?: string): void; | ||
static registerAsyncImplicit(name: string, fn: any, message?: string): void; | ||
static registerImplicit(name: string, fn: any, message?: string): void; | ||
static registerMissedRuleValidator(fn: any, message?: string): void; | ||
static setAttributeFormatter(func: any): void; | ||
static setMessages(lang: LangTypes, messages: SimpleObject): typeof Validator; | ||
static getMessages(lang: LangTypes): SimpleObject; | ||
static stopOnError(attributes: SimpleObject | boolean): void; | ||
static useLang(lang: LangTypes): void; | ||
static getDefaultLang(): LangTypes; | ||
static setAttributeFormatter(func: any): void; | ||
getDefaultLang(): LangTypes; | ||
setAttributeFormatter(func: any): void; | ||
_addFailure(rule: Rule, message?: string): void; | ||
_checkAsync(funcName: string, callback?: (() => void) | boolean): boolean; | ||
_extractRuleAndRuleValue(ruleString: SimpleObject | string): SimpleObject; | ||
_hasNumericRule(attribute: string): boolean; | ||
_hasRule(attribute: string, findRules: string[]): boolean; | ||
_passesOptionalCheck(attribute: string): boolean; | ||
_suppliedWithData(attribute: string): boolean; | ||
getRule(name: string): Rule; | ||
_isValidatable(rule: SimpleObject, value: any): boolean; | ||
_addFailure(rule: Rule, message?: string): void; | ||
_shouldStopValidating(attribute: string, rulePassed: any): boolean; | ||
_onlyInputWithRules(obj?: SimpleObject, keyPrefix?: string): SimpleObject; | ||
_parseRules(rules?: SimpleObject): SimpleObject; | ||
_parseRulesCheck(attribute: string, rulesArray: (SimpleObject | any | string)[], parsedRules: SimpleObject, wildCardValues?: number[]): void; | ||
_parseRulesDefault(attribute: string, rulesArray: SimpleObject[] | any[] | string, parsedRules: SimpleObject | any, wildCardValues?: (number | string)[]): void; | ||
_parsedRulesRecurse(attribute: string, rulesArray: (SimpleObject | any | string)[], parsedRules: SimpleObject, wildCardValues?: number[]): void; | ||
_parseRulesDefault(attribute: string, rulesArray: SimpleObject[] | any[] | string, parsedRules: SimpleObject | any, wildCardValues?: (string | number)[]): void; | ||
_passesOptionalCheck(attribute: string): boolean; | ||
_prepareRulesArray(rulesArray: SimpleObject[] | any[]): SimpleObject[]; | ||
_extractRuleAndRuleValue(ruleString: string | SimpleObject): SimpleObject; | ||
_replaceWildCards(path: string, nums: (string | number)[] | undefined): string; | ||
_replaceWildCardsMessages(nums: (string | number)[] | undefined): void; | ||
_hasNumericRule(attribute: string): boolean; | ||
_replaceWildCards(path: string, nums: (number | string)[] | undefined): string; | ||
_replaceWildCardsMessages(nums: (number | string)[] | undefined): void; | ||
_shouldStopValidating(attribute: string, rulePassed: any): boolean; | ||
_suppliedWithData(attribute: string): boolean; | ||
check(): boolean; | ||
checkAsync(passes?: (() => void) | boolean, fails?: any): void; | ||
fails(fails?: CbFunction): boolean | void; | ||
getDefaultLang(): LangTypes; | ||
getRule(name: string): Rule; | ||
passes(passes?: () => void): boolean | void; | ||
setAttributeFormatter(func: any): void; | ||
setAttributeNames(attributes?: SimpleObject): void; | ||
stopOnError(attributes: SimpleObject | boolean): void; | ||
static stopOnError(attributes: SimpleObject | boolean): void; | ||
passes(passes?: () => void): boolean | void; | ||
fails(fails?: CbFunction): boolean | void; | ||
_checkAsync(funcName: string, callback?: boolean | (() => void)): boolean; | ||
validated(passes?: CbFunction, fails?: CbFunction): void | SimpleObject; | ||
_onlyInputWithRules(obj?: SimpleObject, keyPrefix?: string): SimpleObject; | ||
static register(name: string, fn: any, message?: string): void; | ||
static registerImplicit(name: string, fn: any, message?: string): void; | ||
static registerAsync(name: string, fn: any, message?: string): void; | ||
static registerAsyncImplicit(name: string, fn: any, message?: string): void; | ||
static registerMissedRuleValidator(fn: any, message?: string): void; | ||
} | ||
export { Errors, type LangTypes, type RuleType, Validator, type ValidatorOptions }; |
{ | ||
"name": "@chantouchsek/validatorjs", | ||
"type": "module", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"packageManager": "pnpm@8.11.0", | ||
@@ -29,3 +29,2 @@ "description": "The validatorjs library makes data validation in JavaScript very easy in both the browser and Node.js.", | ||
".": { | ||
"types": "./dist/main.d.ts", | ||
"import": "./dist/main.mjs", | ||
@@ -48,3 +47,3 @@ "require": "./dist/main.cjs" | ||
"devDependencies": { | ||
"@antfu/eslint-config": "^2.3.3", | ||
"@antfu/eslint-config": "^2.3.4", | ||
"@commitlint/cli": "^18.4.3", | ||
@@ -51,0 +50,0 @@ "@commitlint/config-conventional": "^18.4.3", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
694277