@nr1e/commons 0.0.3-alpha.14 → 0.0.3-alpha.15

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.
Files changed (42) hide show
  1. package/package.json +7 -7
  2. package/LICENSE +0 -26
  3. package/README.md +0 -14
  4. package/dist/bitsnbytes/b64.d.ts +0 -39
  5. package/dist/bitsnbytes/b64.js +0 -130
  6. package/dist/bitsnbytes/b64.js.map +0 -1
  7. package/dist/bitsnbytes/index.d.ts +0 -1
  8. package/dist/bitsnbytes/index.js +0 -2
  9. package/dist/bitsnbytes/index.js.map +0 -1
  10. package/dist/errors/errors.d.ts +0 -160
  11. package/dist/errors/errors.js +0 -230
  12. package/dist/errors/errors.js.map +0 -1
  13. package/dist/errors/index.d.ts +0 -1
  14. package/dist/errors/index.js +0 -2
  15. package/dist/errors/index.js.map +0 -1
  16. package/dist/http/http-method.d.ts +0 -9
  17. package/dist/http/http-method.js +0 -11
  18. package/dist/http/http-method.js.map +0 -1
  19. package/dist/http/http-status-code.d.ts +0 -42
  20. package/dist/http/http-status-code.js +0 -44
  21. package/dist/http/http-status-code.js.map +0 -1
  22. package/dist/http/index.d.ts +0 -2
  23. package/dist/http/index.js +0 -3
  24. package/dist/http/index.js.map +0 -1
  25. package/dist/index.d.ts +0 -5
  26. package/dist/index.js +0 -6
  27. package/dist/index.js.map +0 -1
  28. package/dist/lang/index.d.ts +0 -2
  29. package/dist/lang/index.js +0 -3
  30. package/dist/lang/index.js.map +0 -1
  31. package/dist/lang/sleep.d.ts +0 -6
  32. package/dist/lang/sleep.js +0 -9
  33. package/dist/lang/sleep.js.map +0 -1
  34. package/dist/lang/type-functions.d.ts +0 -3
  35. package/dist/lang/type-functions.js +0 -10
  36. package/dist/lang/type-functions.js.map +0 -1
  37. package/dist/validator/index.d.ts +0 -1
  38. package/dist/validator/index.js +0 -2
  39. package/dist/validator/index.js.map +0 -1
  40. package/dist/validator/validators.d.ts +0 -188
  41. package/dist/validator/validators.js +0 -302
  42. package/dist/validator/validators.js.map +0 -1
@@ -1 +0,0 @@
1
- export * from './errors';
@@ -1,2 +0,0 @@
1
- export * from './errors';
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
@@ -1,9 +0,0 @@
1
- export declare enum HttpMethod {
2
- GET = "GET",
3
- POST = "POST",
4
- PUT = "PUT",
5
- PATCH = "PATCH",
6
- DELETE = "DELETE",
7
- HEAD = "HEAD",
8
- OPTIONS = "OPTIONS"
9
- }
@@ -1,11 +0,0 @@
1
- export var HttpMethod;
2
- (function (HttpMethod) {
3
- HttpMethod["GET"] = "GET";
4
- HttpMethod["POST"] = "POST";
5
- HttpMethod["PUT"] = "PUT";
6
- HttpMethod["PATCH"] = "PATCH";
7
- HttpMethod["DELETE"] = "DELETE";
8
- HttpMethod["HEAD"] = "HEAD";
9
- HttpMethod["OPTIONS"] = "OPTIONS";
10
- })(HttpMethod || (HttpMethod = {}));
11
- //# sourceMappingURL=http-method.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"http-method.js","sourceRoot":"","sources":["../../src/http/http-method.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,UAQX;AARD,WAAY,UAAU;IACpB,yBAAW,CAAA;IACX,2BAAa,CAAA;IACb,yBAAW,CAAA;IACX,6BAAe,CAAA;IACf,+BAAiB,CAAA;IACjB,2BAAa,CAAA;IACb,iCAAmB,CAAA;AACrB,CAAC,EARW,UAAU,KAAV,UAAU,QAQrB"}
@@ -1,42 +0,0 @@
1
- export declare enum HttpStatusCode {
2
- CONTINUE = 100,
3
- SWITCHING_PROTOCOLS = 101,
4
- OK = 200,
5
- CREATED = 201,
6
- ACCEPTED = 202,
7
- NON_AUTHORITATIVE_INFORMATION = 203,
8
- NO_CONTENT = 204,
9
- RESET_CONTENT = 205,
10
- PARTIAL_CONTENT = 206,
11
- MULTIPLE_CHOICES = 300,
12
- PERMANENT_REDIRECT = 301,
13
- FOUND = 302,
14
- SEE_OTHER = 303,
15
- NOT_MODIFIED = 304,
16
- USE_PROXY = 305,
17
- TEMPORARY_REDIRECT = 307,
18
- BAD_REQUEST = 400,
19
- UNAUTHORIZED = 401,
20
- PAYMENT_REQUIRED = 402,
21
- FORBIDDEN = 403,
22
- NOT_FOUND = 404,
23
- METHOD_NOT_ALLOWED = 405,
24
- NOT_ACCEPTABLE = 406,
25
- PROXY_AUTHENTICATION_REQUIRED = 407,
26
- REQUEST_TIMEOUT = 408,
27
- CONFLICT = 409,
28
- GONE = 410,
29
- LENGTH_REQUIRED = 411,
30
- PRECONDITION_FAILED = 412,
31
- REQUEST_ENTITY_TOO_LARGE = 413,
32
- REQUEST_URI_TOO_LONG = 414,
33
- UNSUPPORTED_MEDIA_TYPE = 415,
34
- RANGE_NOT_SATISFIABLE = 416,
35
- EXPECTATION_FAILED = 417,
36
- INTERNAL_SERVER_ERROR = 500,
37
- NOT_IMPLEMENTED = 501,
38
- BAD_GATEWAY = 502,
39
- SERVICE_UNAVAILABLE = 503,
40
- GATEWAY_TIMEOUT = 504,
41
- HTTP_VERSION_NOT_SUPPORTED = 505
42
- }
@@ -1,44 +0,0 @@
1
- export var HttpStatusCode;
2
- (function (HttpStatusCode) {
3
- HttpStatusCode[HttpStatusCode["CONTINUE"] = 100] = "CONTINUE";
4
- HttpStatusCode[HttpStatusCode["SWITCHING_PROTOCOLS"] = 101] = "SWITCHING_PROTOCOLS";
5
- HttpStatusCode[HttpStatusCode["OK"] = 200] = "OK";
6
- HttpStatusCode[HttpStatusCode["CREATED"] = 201] = "CREATED";
7
- HttpStatusCode[HttpStatusCode["ACCEPTED"] = 202] = "ACCEPTED";
8
- HttpStatusCode[HttpStatusCode["NON_AUTHORITATIVE_INFORMATION"] = 203] = "NON_AUTHORITATIVE_INFORMATION";
9
- HttpStatusCode[HttpStatusCode["NO_CONTENT"] = 204] = "NO_CONTENT";
10
- HttpStatusCode[HttpStatusCode["RESET_CONTENT"] = 205] = "RESET_CONTENT";
11
- HttpStatusCode[HttpStatusCode["PARTIAL_CONTENT"] = 206] = "PARTIAL_CONTENT";
12
- HttpStatusCode[HttpStatusCode["MULTIPLE_CHOICES"] = 300] = "MULTIPLE_CHOICES";
13
- HttpStatusCode[HttpStatusCode["PERMANENT_REDIRECT"] = 301] = "PERMANENT_REDIRECT";
14
- HttpStatusCode[HttpStatusCode["FOUND"] = 302] = "FOUND";
15
- HttpStatusCode[HttpStatusCode["SEE_OTHER"] = 303] = "SEE_OTHER";
16
- HttpStatusCode[HttpStatusCode["NOT_MODIFIED"] = 304] = "NOT_MODIFIED";
17
- HttpStatusCode[HttpStatusCode["USE_PROXY"] = 305] = "USE_PROXY";
18
- HttpStatusCode[HttpStatusCode["TEMPORARY_REDIRECT"] = 307] = "TEMPORARY_REDIRECT";
19
- HttpStatusCode[HttpStatusCode["BAD_REQUEST"] = 400] = "BAD_REQUEST";
20
- HttpStatusCode[HttpStatusCode["UNAUTHORIZED"] = 401] = "UNAUTHORIZED";
21
- HttpStatusCode[HttpStatusCode["PAYMENT_REQUIRED"] = 402] = "PAYMENT_REQUIRED";
22
- HttpStatusCode[HttpStatusCode["FORBIDDEN"] = 403] = "FORBIDDEN";
23
- HttpStatusCode[HttpStatusCode["NOT_FOUND"] = 404] = "NOT_FOUND";
24
- HttpStatusCode[HttpStatusCode["METHOD_NOT_ALLOWED"] = 405] = "METHOD_NOT_ALLOWED";
25
- HttpStatusCode[HttpStatusCode["NOT_ACCEPTABLE"] = 406] = "NOT_ACCEPTABLE";
26
- HttpStatusCode[HttpStatusCode["PROXY_AUTHENTICATION_REQUIRED"] = 407] = "PROXY_AUTHENTICATION_REQUIRED";
27
- HttpStatusCode[HttpStatusCode["REQUEST_TIMEOUT"] = 408] = "REQUEST_TIMEOUT";
28
- HttpStatusCode[HttpStatusCode["CONFLICT"] = 409] = "CONFLICT";
29
- HttpStatusCode[HttpStatusCode["GONE"] = 410] = "GONE";
30
- HttpStatusCode[HttpStatusCode["LENGTH_REQUIRED"] = 411] = "LENGTH_REQUIRED";
31
- HttpStatusCode[HttpStatusCode["PRECONDITION_FAILED"] = 412] = "PRECONDITION_FAILED";
32
- HttpStatusCode[HttpStatusCode["REQUEST_ENTITY_TOO_LARGE"] = 413] = "REQUEST_ENTITY_TOO_LARGE";
33
- HttpStatusCode[HttpStatusCode["REQUEST_URI_TOO_LONG"] = 414] = "REQUEST_URI_TOO_LONG";
34
- HttpStatusCode[HttpStatusCode["UNSUPPORTED_MEDIA_TYPE"] = 415] = "UNSUPPORTED_MEDIA_TYPE";
35
- HttpStatusCode[HttpStatusCode["RANGE_NOT_SATISFIABLE"] = 416] = "RANGE_NOT_SATISFIABLE";
36
- HttpStatusCode[HttpStatusCode["EXPECTATION_FAILED"] = 417] = "EXPECTATION_FAILED";
37
- HttpStatusCode[HttpStatusCode["INTERNAL_SERVER_ERROR"] = 500] = "INTERNAL_SERVER_ERROR";
38
- HttpStatusCode[HttpStatusCode["NOT_IMPLEMENTED"] = 501] = "NOT_IMPLEMENTED";
39
- HttpStatusCode[HttpStatusCode["BAD_GATEWAY"] = 502] = "BAD_GATEWAY";
40
- HttpStatusCode[HttpStatusCode["SERVICE_UNAVAILABLE"] = 503] = "SERVICE_UNAVAILABLE";
41
- HttpStatusCode[HttpStatusCode["GATEWAY_TIMEOUT"] = 504] = "GATEWAY_TIMEOUT";
42
- HttpStatusCode[HttpStatusCode["HTTP_VERSION_NOT_SUPPORTED"] = 505] = "HTTP_VERSION_NOT_SUPPORTED";
43
- })(HttpStatusCode || (HttpStatusCode = {}));
44
- //# sourceMappingURL=http-status-code.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"http-status-code.js","sourceRoot":"","sources":["../../src/http/http-status-code.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,cAyCX;AAzCD,WAAY,cAAc;IACxB,6DAAc,CAAA;IACd,mFAAyB,CAAA;IACzB,iDAAQ,CAAA;IACR,2DAAa,CAAA;IACb,6DAAc,CAAA;IACd,uGAAmC,CAAA;IACnC,iEAAgB,CAAA;IAChB,uEAAmB,CAAA;IACnB,2EAAqB,CAAA;IACrB,6EAAsB,CAAA;IACtB,iFAAwB,CAAA;IACxB,uDAAW,CAAA;IACX,+DAAe,CAAA;IACf,qEAAkB,CAAA;IAClB,+DAAe,CAAA;IACf,iFAAwB,CAAA;IACxB,mEAAiB,CAAA;IACjB,qEAAkB,CAAA;IAClB,6EAAsB,CAAA;IACtB,+DAAe,CAAA;IACf,+DAAe,CAAA;IACf,iFAAwB,CAAA;IACxB,yEAAoB,CAAA;IACpB,uGAAmC,CAAA;IACnC,2EAAqB,CAAA;IACrB,6DAAc,CAAA;IACd,qDAAU,CAAA;IACV,2EAAqB,CAAA;IACrB,mFAAyB,CAAA;IACzB,6FAA8B,CAAA;IAC9B,qFAA0B,CAAA;IAC1B,yFAA4B,CAAA;IAC5B,uFAA2B,CAAA;IAC3B,iFAAwB,CAAA;IACxB,uFAA2B,CAAA;IAC3B,2EAAqB,CAAA;IACrB,mEAAiB,CAAA;IACjB,mFAAyB,CAAA;IACzB,2EAAqB,CAAA;IACrB,iGAAgC,CAAA;AAClC,CAAC,EAzCW,cAAc,KAAd,cAAc,QAyCzB"}
@@ -1,2 +0,0 @@
1
- export * from './http-status-code';
2
- export * from './http-method';
@@ -1,3 +0,0 @@
1
- export * from './http-status-code';
2
- export * from './http-method';
3
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/http/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC"}
package/dist/index.d.ts DELETED
@@ -1,5 +0,0 @@
1
- export * from './bitsnbytes';
2
- export * from './errors';
3
- export * from './http';
4
- export * from './lang';
5
- export * from './validator';
package/dist/index.js DELETED
@@ -1,6 +0,0 @@
1
- export * from './bitsnbytes';
2
- export * from './errors';
3
- export * from './http';
4
- export * from './lang';
5
- export * from './validator';
6
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC"}
@@ -1,2 +0,0 @@
1
- export * from './type-functions';
2
- export * from './sleep';
@@ -1,3 +0,0 @@
1
- export * from './type-functions';
2
- export * from './sleep';
3
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lang/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,SAAS,CAAC"}
@@ -1,6 +0,0 @@
1
- /**
2
- * Sleep for a given amount of time
3
- *
4
- * @param ms the number of milliseconds to sleep
5
- */
6
- export declare function sleep(ms: number): Promise<unknown>;
@@ -1,9 +0,0 @@
1
- /**
2
- * Sleep for a given amount of time
3
- *
4
- * @param ms the number of milliseconds to sleep
5
- */
6
- export function sleep(ms) {
7
- return new Promise(resolve => setTimeout(resolve, ms));
8
- }
9
- //# sourceMappingURL=sleep.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sleep.js","sourceRoot":"","sources":["../../src/lang/sleep.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,UAAU,KAAK,CAAC,EAAU;IAC9B,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AACzD,CAAC"}
@@ -1,3 +0,0 @@
1
- export declare function isObject(item: unknown): item is Record<string, unknown>;
2
- export declare function isString(item: unknown): item is string;
3
- export declare function isError(item: unknown): item is Error;
@@ -1,10 +0,0 @@
1
- export function isObject(item) {
2
- return (item !== null && typeof item === 'object' && Array.isArray(item) === false);
3
- }
4
- export function isString(item) {
5
- return typeof item === 'string';
6
- }
7
- export function isError(item) {
8
- return item instanceof Error;
9
- }
10
- //# sourceMappingURL=type-functions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"type-functions.js","sourceRoot":"","sources":["../../src/lang/type-functions.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,QAAQ,CAAC,IAAa;IACpC,OAAO,CACL,IAAI,KAAK,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,KAAK,CAC3E,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,IAAa;IACpC,OAAO,OAAO,IAAI,KAAK,QAAQ,CAAC;AAClC,CAAC;AAED,MAAM,UAAU,OAAO,CAAC,IAAa;IACnC,OAAO,IAAI,YAAY,KAAK,CAAC;AAC/B,CAAC"}
@@ -1 +0,0 @@
1
- export * from './validators';
@@ -1,2 +0,0 @@
1
- export * from './validators';
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/validator/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
@@ -1,188 +0,0 @@
1
- /**
2
- * Tests if a value is null or undefined.
3
- *
4
- * @param o the value to check
5
- */
6
- export declare function isNotNull(o?: unknown): o is NonNullable<unknown>;
7
- /**
8
- * Throws a ValidationError if the value is null or undefined.
9
- * This function also asserts the value to be NonNullable if the check passes.
10
- *
11
- * @param name the name of the variable
12
- * @param o the value to check
13
- */
14
- export declare function notNull(name: string, o?: unknown): asserts o is NonNullable<unknown>;
15
- /**
16
- * Tests if a value is empty, null, undefined or has a length of 0.
17
- *
18
- * @param o the value to check
19
- */
20
- export declare function isNotEmpty(o?: unknown): o is NonNullable<unknown>;
21
- /**
22
- * Throws a ValidationError if the value is null, undefined or the length is 0.
23
- * This function also asserts the value to be NonNullable if the check passes.
24
- *
25
- * @param name the name of the variable
26
- * @param o the value to check
27
- */
28
- export declare function notEmpty(name: string, o?: unknown): asserts o is NonNullable<unknown>;
29
- /**
30
- * Tests if a value is null, undefined, has a length of 0 or contains only whitespace.
31
- *
32
- * @param o the value to check
33
- */
34
- export declare function isNotBlank(o?: unknown): o is NonNullable<unknown>;
35
- /**
36
- * Throws a ValidationError if the value is null, undefined, has a length of 0 or contains only whitespace.
37
- * This function also asserts the value to be NonNullable if the check passes.
38
- *
39
- * @param name the name of the variable
40
- * @param o the value to check
41
- */
42
- export declare function notBlank(name: string, o?: unknown): asserts o is NonNullable<unknown>;
43
- /**
44
- * Tests if a value does not match the regular expression provided.
45
- * Undefined and null values are skipped and not tested.
46
- *
47
- * @param regex the regular expression to test with
48
- * @param o the value to check
49
- */
50
- export declare function isMatch(regex: RegExp, o?: string | null): o is string;
51
- /**
52
- * Throws a ValidationError if the value matches the regular expression provided.
53
- * Undefined and null values are skipped and not validated.
54
- *
55
- * @param name the name of the variable
56
- * @param regex the regular expression to validate with
57
- * @param o the value to check
58
- */
59
- export declare function match(name: string, regex: RegExp, o?: string | null): void;
60
- /**
61
- * Tests if a value is a valid email address.
62
- * Undefined and null values are skipped and not validated.
63
- *
64
- * @param o the value to check
65
- */
66
- export declare function isEmail(o?: string | null): o is string;
67
- /**
68
- * Throws a ValidationError if the value provided is not an email.
69
- * Undefined and null values are skipped and not validated.
70
- *
71
- * @param name the name of the variable
72
- * @param o the value to check
73
- */
74
- export declare function email(name: string, o?: string | null): void;
75
- /**
76
- * Tests if a value has a length that is less than the provided length.
77
- * Undefined and null values are skipped and not validated.
78
- *
79
- * @param length the maximum length of the variable
80
- * @param o the value to check
81
- */
82
- export declare function isMaxLength(length: number, o?: string | unknown[] | null): boolean;
83
- /**
84
- * Throws a ValidationError if the value provided has a length that exceeds the provided length.
85
- * Undefined and null values are skipped and not validated.
86
- *
87
- * @param name the name of the variable
88
- * @param length the maximum length of the variable
89
- * @param o the value to check
90
- */
91
- export declare function maxLength(name: string, length: number, o?: string | unknown[] | null): void;
92
- /**
93
- * Tests if a value has a length that is greater than the provided length.
94
- * Undefined and null values are skipped and not validated.
95
- *
96
- * @param length the minimum length of the variable
97
- * @param o the value to check
98
- */
99
- export declare function isMinLength(length: number, o?: string | unknown[] | null): boolean;
100
- /**
101
- * Throws a ValidationError if the value provided has a length that is less than the provided length.
102
- * Undefined and null values are skipped and not validated.
103
- *
104
- * @param name the name of the variable
105
- * @param length the minimum length of the variable
106
- * @param o the value to check
107
- */
108
- export declare function minLength(name: string, length: number, o?: string | unknown[] | null): void;
109
- /**
110
- * Tests if a value provided is a number.
111
- * Undefined and null values are skipped and not validated.
112
- *
113
- * @param o the value to check
114
- */
115
- export declare function isNumber(o?: string | null | number): boolean;
116
- /**
117
- * Throws a ValidationError if the value provided is not a number.
118
- * Undefined and null values are skipped and not validated.
119
- *
120
- * @param name the name of the variable
121
- * @param o the value to check
122
- */
123
- export declare function number(name: string, o?: string | null | number): void;
124
- /**
125
- * Tests if a value is less than the provided minimum value.
126
- * Undefined and null values are skipped and not validated.
127
- *
128
- * @param minValue the minimum value allowed
129
- * @param o the value to check
130
- */
131
- export declare function isMinValue(minValue: number, o?: string | number | null): boolean;
132
- /**
133
- * Throws a ValidationError if the value is less than the provided minimum value.
134
- * Undefined and null values are skipped and not validated.
135
- *
136
- * @param name the name of the variable
137
- * @param minValue the minimum value allowed
138
- * @param o the value to check
139
- */
140
- export declare function minValue(name: string, minValue: number, o?: number | string | null): void;
141
- /**
142
- * Tests if a value is more than the provided maximum value.
143
- * Undefined and null values are skipped and not validated.
144
- *
145
- * @param maxValue the maximum value allowed
146
- * @param o the value to check
147
- */
148
- export declare function isMaxValue(maxValue: number, o?: string | number | null): boolean;
149
- /**
150
- * Throws a ValidationError if the value is more than the provided maximum value.
151
- * Undefined and null values are skipped and not validated.
152
- *
153
- * @param name the name of the variable
154
- * @param maxValue the maximum value allowed
155
- * @param o the value to check
156
- */
157
- export declare function maxValue(name: string, maxValue: number, o?: number | string | null): void;
158
- /**
159
- * Tests if the value is between the provided minimum and maximum values inclusive.
160
- * Undefined and null values are skipped and not validated.
161
- *
162
- * @param minValue the minimum value allowed
163
- * @param maxValue the maximum value allowed
164
- * @param o the value to check
165
- */
166
- export declare function isBetweenValues(minValue: number, maxValue: number, o?: string | number | null): boolean;
167
- /**
168
- * Throws a ValidationError if the value is not between the provided minimum and maximum values inclusive.
169
- * Undefined and null values are skipped and not validated.
170
- *
171
- * @param name the name of the variable
172
- * @param minValue the minimum value allowed
173
- * @param maxValue the maximum value allowed
174
- * @param o the value to check
175
- */
176
- export declare function betweenValues(name: string, minValue: number, maxValue: number, o?: string | number | null): void;
177
- export interface StringValidationOptions {
178
- readonly required: boolean;
179
- readonly minLength?: number;
180
- readonly maxLength?: number;
181
- readonly regex?: RegExp;
182
- readonly notBlank?: boolean;
183
- readonly notEmpty?: boolean;
184
- readonly email?: boolean;
185
- readonly number?: boolean;
186
- }
187
- export declare function isValidString(options: StringValidationOptions, value?: unknown): value is string;
188
- export declare function validString(name: string, options: StringValidationOptions, value?: unknown): void;