valgen 5.19.5 → 5.20.0
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/constants.js +1 -1
- package/index.d.ts +4 -1
- package/index.js +4 -1
- package/package.json +3 -3
- package/rules/format-rules/is-base64.d.ts +2 -2
- package/rules/format-rules/is-credit-card.d.ts +2 -2
- package/rules/format-rules/is-hash.d.ts +2 -2
- package/rules/format-rules/is-mobile-phone.d.ts +2 -2
- package/rules/format-rules/is-url.d.ts +2 -2
- package/rules/format-rules/is-uuid.d.ts +4 -2
- package/rules/format-rules/is-uuid.js +1 -1
- package/rules/format-rules/is-vat-number.d.ts +4 -2
- package/rules/format-rules/is-vat-number.js +1 -1
- package/rules/type-rules/is-date.js +1 -1
- package/rules/type-rules/is-object.js +1 -1
package/constants.js
CHANGED
package/index.d.ts
CHANGED
|
@@ -56,6 +56,9 @@ declare const isUUID2: import("./core/validator.js").Validator<string, string, E
|
|
|
56
56
|
declare const isUUID3: import("./core/validator.js").Validator<string, string, ExecutionOptions>;
|
|
57
57
|
declare const isUUID4: import("./core/validator.js").Validator<string, string, ExecutionOptions>;
|
|
58
58
|
declare const isUUID5: import("./core/validator.js").Validator<string, string, ExecutionOptions>;
|
|
59
|
+
declare const isUUID6: import("./core/validator.js").Validator<string, string, ExecutionOptions>;
|
|
60
|
+
declare const isUUID7: import("./core/validator.js").Validator<string, string, ExecutionOptions>;
|
|
61
|
+
declare const isUUID8: import("./core/validator.js").Validator<string, string, ExecutionOptions>;
|
|
59
62
|
declare const toArray: import("./core/validator.js").Validator<any[], any, ExecutionOptions>;
|
|
60
63
|
declare const toBigint: import("./core/validator.js").Validator<bigint, unknown, ExecutionOptions>;
|
|
61
64
|
declare const toBoolean: import("./core/validator.js").Validator<boolean | undefined, unknown, ExecutionOptions>;
|
|
@@ -67,4 +70,4 @@ declare const toInteger: import("./core/validator.js").Validator<number, unknown
|
|
|
67
70
|
declare const toNumber: import("./core/validator.js").Validator<number, unknown, ExecutionOptions>;
|
|
68
71
|
declare const toString: import("./core/validator.js").Validator<string, unknown, ExecutionOptions>;
|
|
69
72
|
declare const toTime: import("./core/validator.js").Validator<string, string | Date, ExecutionOptions>;
|
|
70
|
-
export { isAlpha, isAlphanumeric, isAny, isArray, isAscii, isBase64, isBigint, isBoolean, isBtcAddress, isCreditCard, isDate, isDateString, isDecimal, isDefined, isEAN, isEmail, isEmpty, isETHAddress, isFQDN, isHex, isHexColor, isIBAN, isInteger, isIP, isIPRange, isISSN, isJWT, isLowercase, isMACAddress, isMobilePhone, isNotEmpty, isNotNull, isNotNullish, isNull, isNullish, isNumber, isObject, isObjectId, isPort, isString, isSWIFT, isTime, isUndefined, isUppercase, isURL, isUUID, isUUID1, isUUID2, isUUID3, isUUID4, isUUID5, toArray, toBigint, toBoolean, toDate, toDateString, toInteger, toNumber, toString, toTime, vg, };
|
|
73
|
+
export { isAlpha, isAlphanumeric, isAny, isArray, isAscii, isBase64, isBigint, isBoolean, isBtcAddress, isCreditCard, isDate, isDateString, isDecimal, isDefined, isEAN, isEmail, isEmpty, isETHAddress, isFQDN, isHex, isHexColor, isIBAN, isInteger, isIP, isIPRange, isISSN, isJWT, isLowercase, isMACAddress, isMobilePhone, isNotEmpty, isNotNull, isNotNullish, isNull, isNullish, isNumber, isObject, isObjectId, isPort, isString, isSWIFT, isTime, isUndefined, isUppercase, isURL, isUUID, isUUID1, isUUID2, isUUID3, isUUID4, isUUID5, isUUID6, isUUID7, isUUID8, toArray, toBigint, toBoolean, toDate, toDateString, toInteger, toNumber, toString, toTime, vg, };
|
package/index.js
CHANGED
|
@@ -52,6 +52,9 @@ const isUUID2 = vg.isUUID(2);
|
|
|
52
52
|
const isUUID3 = vg.isUUID(3);
|
|
53
53
|
const isUUID4 = vg.isUUID(4);
|
|
54
54
|
const isUUID5 = vg.isUUID(5);
|
|
55
|
+
const isUUID6 = vg.isUUID(6);
|
|
56
|
+
const isUUID7 = vg.isUUID(7);
|
|
57
|
+
const isUUID8 = vg.isUUID(8);
|
|
55
58
|
const toArray = vg.isArray(isAny, { coerce: true });
|
|
56
59
|
const toBigint = vg.isBigint({ coerce: true });
|
|
57
60
|
const toBoolean = vg.isBoolean({ coerce: true });
|
|
@@ -74,4 +77,4 @@ const toInteger = vg.isInteger({ coerce: true });
|
|
|
74
77
|
const toNumber = vg.isNumber({ coerce: true });
|
|
75
78
|
const toString = vg.isString({ coerce: true });
|
|
76
79
|
const toTime = vg.isTime({ coerce: true });
|
|
77
|
-
export { isAlpha, isAlphanumeric, isAny, isArray, isAscii, isBase64, isBigint, isBoolean, isBtcAddress, isCreditCard, isDate, isDateString, isDecimal, isDefined, isEAN, isEmail, isEmpty, isETHAddress, isFQDN, isHex, isHexColor, isIBAN, isInteger, isIP, isIPRange, isISSN, isJWT, isLowercase, isMACAddress, isMobilePhone, isNotEmpty, isNotNull, isNotNullish, isNull, isNullish, isNumber, isObject, isObjectId, isPort, isString, isSWIFT, isTime, isUndefined, isUppercase, isURL, isUUID, isUUID1, isUUID2, isUUID3, isUUID4, isUUID5, toArray, toBigint, toBoolean, toDate, toDateString, toInteger, toNumber, toString, toTime, vg, };
|
|
80
|
+
export { isAlpha, isAlphanumeric, isAny, isArray, isAscii, isBase64, isBigint, isBoolean, isBtcAddress, isCreditCard, isDate, isDateString, isDecimal, isDefined, isEAN, isEmail, isEmpty, isETHAddress, isFQDN, isHex, isHexColor, isIBAN, isInteger, isIP, isIPRange, isISSN, isJWT, isLowercase, isMACAddress, isMobilePhone, isNotEmpty, isNotNull, isNotNullish, isNull, isNullish, isNumber, isObject, isObjectId, isPort, isString, isSWIFT, isTime, isUndefined, isUppercase, isURL, isUUID, isUUID1, isUUID2, isUUID3, isUUID4, isUUID5, isUUID6, isUUID7, isUUID8, toArray, toBigint, toBoolean, toDate, toDateString, toInteger, toNumber, toString, toTime, vg, };
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "valgen",
|
|
3
3
|
"description": "Fast runtime type validator, converter and io (encoding/decoding) library",
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.20.0",
|
|
5
5
|
"author": "Panates",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@browsery/validator": "^13.15.
|
|
8
|
+
"@browsery/validator": "^13.15.35",
|
|
9
9
|
"date-fns": "^4.1.0",
|
|
10
10
|
"reflect-metadata": "^0.2.2",
|
|
11
|
-
"ts-gems": "^3.11.
|
|
11
|
+
"ts-gems": "^3.11.6",
|
|
12
12
|
"tslib": "^2.8.1"
|
|
13
13
|
},
|
|
14
14
|
"type": "module",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { type IsBase64Options as _IsBase64Options } from '@browsery/validator';
|
|
2
2
|
import { type ValidationOptions } from '../../core/index.js';
|
|
3
|
-
export interface Base64ValidatorOptions extends ValidationOptions,
|
|
3
|
+
export interface Base64ValidatorOptions extends ValidationOptions, _IsBase64Options {
|
|
4
4
|
}
|
|
5
5
|
/**
|
|
6
6
|
* Validates if value is a "Base64" string.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { type IsCreditCardOptions as _IsCreditCardOptions } from '@browsery/validator';
|
|
2
2
|
import { type ValidationOptions } from '../../core/index.js';
|
|
3
|
-
export interface CreditCardValidatorOptions extends ValidationOptions,
|
|
3
|
+
export interface CreditCardValidatorOptions extends ValidationOptions, _IsCreditCardOptions {
|
|
4
4
|
}
|
|
5
5
|
/**
|
|
6
6
|
* Validates if value is a credit card number
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { type HashAlgorithm as _HashAlgorithm } from '@browsery/validator';
|
|
2
2
|
import { type ValidationOptions } from '../../core/index.js';
|
|
3
|
-
export type HashAlgorithm =
|
|
3
|
+
export type HashAlgorithm = _HashAlgorithm;
|
|
4
4
|
/**
|
|
5
5
|
* Validates if value a hash of type algorithm
|
|
6
6
|
* @validator isHash
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { type MobilePhoneLocale as _MobilePhoneLocale } from '@browsery/validator';
|
|
2
2
|
import { type ValidationOptions } from '../../core/index.js';
|
|
3
3
|
export interface IsMobilePhoneOptions extends ValidationOptions {
|
|
4
4
|
/**
|
|
@@ -11,7 +11,7 @@ export interface IsMobilePhoneOptions extends ValidationOptions {
|
|
|
11
11
|
* Locale or locales of the mobile phone
|
|
12
12
|
* @default 'any'
|
|
13
13
|
*/
|
|
14
|
-
locale?: 'any' |
|
|
14
|
+
locale?: 'any' | _MobilePhoneLocale | _MobilePhoneLocale[];
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
17
|
* Validates if value is a valid Email
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { type IsURLOptions as _IsURLOptions } from '@browsery/validator';
|
|
2
2
|
import { type ValidationOptions } from '../../core/index.js';
|
|
3
|
-
export interface IsURLOptions extends ValidationOptions,
|
|
3
|
+
export interface IsURLOptions extends ValidationOptions, _IsURLOptions {
|
|
4
4
|
}
|
|
5
5
|
/**
|
|
6
6
|
* Validates if value is an URL
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { type UUIDVersion as _UUIDVersion } from '@browsery/validator';
|
|
1
2
|
import { type ValidationOptions } from '../../core/index.js';
|
|
3
|
+
export type UUIDVersion = _UUIDVersion;
|
|
2
4
|
/**
|
|
3
|
-
* Validates if value is
|
|
5
|
+
* Validates if value is a "UUID".
|
|
4
6
|
* @validator isUUID
|
|
5
7
|
*/
|
|
6
|
-
export declare function isUUID(version?:
|
|
8
|
+
export declare function isUUID(version?: UUIDVersion, options?: ValidationOptions): import("../../core/validator.js").Validator<string, string, import("../../core/types.js").ExecutionOptions>;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { type VATCountryCode as _VATCountryCode } from '@browsery/validator';
|
|
1
2
|
import { type ValidationOptions } from '../../core/index.js';
|
|
3
|
+
export type VATCountryCode = _VATCountryCode;
|
|
2
4
|
/**
|
|
3
|
-
* Validates if value is
|
|
5
|
+
* Validates if value is a VAT number
|
|
4
6
|
* @validator isVAT
|
|
5
7
|
*/
|
|
6
|
-
export declare function isVATNumber(countryCode:
|
|
8
|
+
export declare function isVATNumber(countryCode: VATCountryCode, options?: ValidationOptions): import("../../core/validator.js").Validator<string, string, import("../../core/types.js").ExecutionOptions>;
|
|
@@ -64,7 +64,7 @@ const DATE_PATTERN2 = /^(\d{4,14})(?:\.(\d{1,6}))?(?:(?:([+-])(0[0-9]|1[0-2])(\d
|
|
|
64
64
|
function coerceDateString(input, trimPrecision) {
|
|
65
65
|
const precisionIndex = (trimPrecision ? PRECISION_INDEX[trimPrecision] : 9) || 9;
|
|
66
66
|
let dateParts;
|
|
67
|
-
let detectedPrecision
|
|
67
|
+
let detectedPrecision;
|
|
68
68
|
if (input instanceof Date || typeof input === 'number') {
|
|
69
69
|
const d = typeof input === 'number' ? new Date(input) : input;
|
|
70
70
|
dateParts = [
|