ddan-js 1.2.2 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/ddan-js.esm.js +1 -1
- package/bin/ddan-js.js +1 -1
- package/bin/lib/index.js +2 -1
- package/bin/lib/modules/math/index.js +14 -1
- package/bin/lib/modules/mini/index.js +13 -13
- package/bin/lib/modules/rule/async-validator/index.js +300 -0
- package/bin/lib/modules/rule/async-validator/interface.js +2 -0
- package/bin/lib/modules/rule/async-validator/messages.js +59 -0
- package/bin/lib/modules/rule/async-validator/rule/enum.js +13 -0
- package/bin/lib/modules/rule/async-validator/rule/index.js +16 -0
- package/bin/lib/modules/rule/async-validator/rule/pattern.js +27 -0
- package/bin/lib/modules/rule/async-validator/rule/range.js +54 -0
- package/bin/lib/modules/rule/async-validator/rule/required.js +12 -0
- package/bin/lib/modules/rule/async-validator/rule/type.js +98 -0
- package/bin/lib/modules/rule/async-validator/rule/url.js +55 -0
- package/bin/lib/modules/rule/async-validator/rule/whitespace.js +20 -0
- package/bin/lib/modules/rule/async-validator/util.js +250 -0
- package/bin/lib/modules/rule/async-validator/validator/any.js +16 -0
- package/bin/lib/modules/rule/async-validator/validator/array.js +19 -0
- package/bin/lib/modules/rule/async-validator/validator/boolean.js +20 -0
- package/bin/lib/modules/rule/async-validator/validator/date.js +31 -0
- package/bin/lib/modules/rule/async-validator/validator/enum.js +20 -0
- package/bin/lib/modules/rule/async-validator/validator/float.js +20 -0
- package/bin/lib/modules/rule/async-validator/validator/index.js +36 -0
- package/bin/lib/modules/rule/async-validator/validator/integer.js +20 -0
- package/bin/lib/modules/rule/async-validator/validator/method.js +19 -0
- package/bin/lib/modules/rule/async-validator/validator/number.js +23 -0
- package/bin/lib/modules/rule/async-validator/validator/object.js +19 -0
- package/bin/lib/modules/rule/async-validator/validator/pattern.js +19 -0
- package/bin/lib/modules/rule/async-validator/validator/regexp.js +19 -0
- package/bin/lib/modules/rule/async-validator/validator/required.js +10 -0
- package/bin/lib/modules/rule/async-validator/validator/string.js +24 -0
- package/bin/lib/modules/rule/async-validator/validator/type.js +20 -0
- package/bin/lib/modules/rule/index.js +31 -0
- package/bin/lib/modules/url/index.js +12 -1
- package/bin/lib/util/index.js +30 -1
- package/bin/types/index.d.ts +37 -6
- package/bin/types/modules/math/index.d.ts +2 -0
- package/bin/types/modules/mini/index.d.ts +4 -2
- package/bin/types/modules/rule/async-validator/index.d.ts +43 -0
- package/bin/types/modules/rule/async-validator/interface.d.ts +135 -0
- package/bin/types/modules/rule/async-validator/messages.d.ts +3 -0
- package/bin/types/modules/rule/async-validator/rule/enum.d.ts +3 -0
- package/bin/types/modules/rule/async-validator/rule/index.d.ts +9 -0
- package/bin/types/modules/rule/async-validator/rule/pattern.d.ts +3 -0
- package/bin/types/modules/rule/async-validator/rule/range.d.ts +3 -0
- package/bin/types/modules/rule/async-validator/rule/required.d.ts +3 -0
- package/bin/types/modules/rule/async-validator/rule/type.d.ts +3 -0
- package/bin/types/modules/rule/async-validator/rule/url.d.ts +2 -0
- package/bin/types/modules/rule/async-validator/rule/whitespace.d.ts +14 -0
- package/bin/types/modules/rule/async-validator/util.d.ts +16 -0
- package/bin/types/modules/rule/async-validator/validator/any.d.ts +3 -0
- package/bin/types/modules/rule/async-validator/validator/array.d.ts +3 -0
- package/bin/types/modules/rule/async-validator/validator/boolean.d.ts +3 -0
- package/bin/types/modules/rule/async-validator/validator/date.d.ts +3 -0
- package/bin/types/modules/rule/async-validator/validator/enum.d.ts +3 -0
- package/bin/types/modules/rule/async-validator/validator/float.d.ts +3 -0
- package/bin/types/modules/rule/async-validator/validator/index.d.ts +20 -0
- package/bin/types/modules/rule/async-validator/validator/integer.d.ts +3 -0
- package/bin/types/modules/rule/async-validator/validator/method.d.ts +3 -0
- package/bin/types/modules/rule/async-validator/validator/number.d.ts +3 -0
- package/bin/types/modules/rule/async-validator/validator/object.d.ts +3 -0
- package/bin/types/modules/rule/async-validator/validator/pattern.d.ts +3 -0
- package/bin/types/modules/rule/async-validator/validator/regexp.d.ts +3 -0
- package/bin/types/modules/rule/async-validator/validator/required.d.ts +3 -0
- package/bin/types/modules/rule/async-validator/validator/string.d.ts +3 -0
- package/bin/types/modules/rule/async-validator/validator/type.d.ts +3 -0
- package/bin/types/modules/rule/index.d.ts +12 -0
- package/bin/types/modules/url/index.d.ts +26 -4
- package/bin/types/util/index.d.ts +4 -0
- package/package.json +1 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ValidateError, ValidateOption, RuleValuePackage, InternalRuleItem, SyncErrorType, Value, Values } from './interface';
|
|
2
|
+
export declare let warning: (type: string, errors: SyncErrorType[]) => void;
|
|
3
|
+
export declare function convertFieldsError(errors: ValidateError[]): Record<string, ValidateError[]> | null;
|
|
4
|
+
export declare function format(template: ((...args: any[]) => string) | string, ...args: any[]): string;
|
|
5
|
+
export declare function isEmptyValue(value: Value, type?: string): boolean;
|
|
6
|
+
export declare function isEmptyObject(obj: object): boolean;
|
|
7
|
+
export declare class AsyncValidationError extends Error {
|
|
8
|
+
errors: ValidateError[];
|
|
9
|
+
fields: Record<string, ValidateError[]>;
|
|
10
|
+
constructor(errors: ValidateError[], fields: Record<string, ValidateError[]>);
|
|
11
|
+
}
|
|
12
|
+
type ValidateFunc = (data: RuleValuePackage, doIt: (errors: ValidateError[]) => void) => void;
|
|
13
|
+
export declare function asyncMap(objArr: Record<string, RuleValuePackage[]>, option: ValidateOption, func: ValidateFunc, callback: (errors: ValidateError[]) => void, source: Values): Promise<Values>;
|
|
14
|
+
export declare function complementError(rule: InternalRuleItem, source: Values): (oe: ValidateError | (() => string) | string) => ValidateError;
|
|
15
|
+
export declare function deepMerge<T extends object>(target: T, source: Partial<T>): T;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
string: import("..").ExecuteValidator;
|
|
3
|
+
method: import("..").ExecuteValidator;
|
|
4
|
+
number: import("..").ExecuteValidator;
|
|
5
|
+
boolean: import("..").ExecuteValidator;
|
|
6
|
+
regexp: import("..").ExecuteValidator;
|
|
7
|
+
integer: import("..").ExecuteValidator;
|
|
8
|
+
float: import("..").ExecuteValidator;
|
|
9
|
+
array: import("..").ExecuteValidator;
|
|
10
|
+
object: import("..").ExecuteValidator;
|
|
11
|
+
enum: import("..").ExecuteValidator;
|
|
12
|
+
pattern: import("..").ExecuteValidator;
|
|
13
|
+
date: import("..").ExecuteValidator;
|
|
14
|
+
url: import("..").ExecuteValidator;
|
|
15
|
+
hex: import("..").ExecuteValidator;
|
|
16
|
+
email: import("..").ExecuteValidator;
|
|
17
|
+
required: import("..").ExecuteValidator;
|
|
18
|
+
any: import("..").ExecuteValidator;
|
|
19
|
+
};
|
|
20
|
+
export default _default;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import Schema, { Rules, ValidateCallback, ValidateOption, Values } from "./async-validator";
|
|
2
|
+
declare function validateId(content: any): boolean;
|
|
3
|
+
declare function validatePhone(content: any): boolean;
|
|
4
|
+
declare function validator(rules: Rules): Schema;
|
|
5
|
+
declare function validate(rules: Rules, source_: Values, o?: ValidateOption | any, oc?: ValidateCallback | any): Promise<Values>;
|
|
6
|
+
declare const _default: {
|
|
7
|
+
validateId: typeof validateId;
|
|
8
|
+
validatePhone: typeof validatePhone;
|
|
9
|
+
validator: typeof validator;
|
|
10
|
+
validate: typeof validate;
|
|
11
|
+
};
|
|
12
|
+
export default _default;
|
|
@@ -1,7 +1,29 @@
|
|
|
1
|
+
declare function useHttps(url: string): string;
|
|
1
2
|
declare const _default: {
|
|
2
|
-
parse: (qs: any, sep
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
parse: (qs: any, { sep, eq, max, multiple }?: {
|
|
4
|
+
sep?: string | undefined;
|
|
5
|
+
eq?: string | undefined;
|
|
6
|
+
max?: number | undefined;
|
|
7
|
+
multiple?: boolean | undefined;
|
|
8
|
+
}) => {};
|
|
9
|
+
decode: (qs: any, { sep, eq, max, multiple }?: {
|
|
10
|
+
sep?: string | undefined;
|
|
11
|
+
eq?: string | undefined;
|
|
12
|
+
max?: number | undefined;
|
|
13
|
+
multiple?: boolean | undefined;
|
|
14
|
+
}) => {};
|
|
15
|
+
stringify: (obj: any, { sep, eq, name, multiple }?: {
|
|
16
|
+
sep?: string | undefined;
|
|
17
|
+
eq?: string | undefined;
|
|
18
|
+
name?: null | undefined;
|
|
19
|
+
multiple?: boolean | undefined;
|
|
20
|
+
}) => string;
|
|
21
|
+
encode: (obj: any, { sep, eq, name, multiple }?: {
|
|
22
|
+
sep?: string | undefined;
|
|
23
|
+
eq?: string | undefined;
|
|
24
|
+
name?: null | undefined;
|
|
25
|
+
multiple?: boolean | undefined;
|
|
26
|
+
}) => string;
|
|
27
|
+
useHttps: typeof useHttps;
|
|
6
28
|
};
|
|
7
29
|
export default _default;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import includes from "./includes";
|
|
2
|
+
declare function compareArray(arr1: any, arr2: any): boolean;
|
|
3
|
+
declare function merge(target: any, source: any): any;
|
|
2
4
|
declare const _default: {
|
|
3
5
|
includes: typeof includes;
|
|
6
|
+
merge: typeof merge;
|
|
7
|
+
compareArray: typeof compareArray;
|
|
4
8
|
getTag: (value: any) => string;
|
|
5
9
|
getType: (value: any) => string;
|
|
6
10
|
toString: () => string;
|