Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 16 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
"test:ci": "jest --runInBand --no-cache --coverage --verbose"
},
"dependencies": {
"@types/validator": "^13.11.8",
"@types/validator": "^13.15.3",
"libphonenumber-js": "^1.11.1",
"validator": "^13.9.0"
"validator": "^13.15.20"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^25.0.7",
Expand Down
4 changes: 3 additions & 1 deletion src/decorator/string/IsRgbColor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ export const IS_RGB_COLOR = 'isRgbColor';
* If given value is not a string, then it returns false.
*/
export function isRgbColor(value: unknown, includePercentValues?: boolean): boolean {
return typeof value === 'string' && isRgbColorValidator(value, includePercentValues);
return typeof value === 'string' && isRgbColorValidator(value, {
includePercentValues
});
}

/**
Expand Down
19 changes: 14 additions & 5 deletions test/functional/validation-functions-and-decorators.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,6 @@ function checkReturnedError(
return Promise.all(promises);
}

const validator = new Validator();

describe('IsDefined', () => {
const validValues = [0, 1, true, false, '', '0', '1234', -1];
const invalidValues: any[] = [null, undefined];
Expand Down Expand Up @@ -3117,9 +3115,13 @@ describe('IsJWT', () => {
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJsb3JlbSI6Imlwc3VtIn0.ymiJSsMJXR6tMSr8G9usjQ15_8hKPDv_CArLhxw28MI',
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkb2xvciI6InNpdCIsImFtZXQiOlsibG9yZW0iLCJpcHN1bSJdfQ.rRpe04zbWbbJjwM43VnHzAboDzszJtGrNsUxaqQ-GQ8',
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqb2huIjp7ImFnZSI6MjUsImhlaWdodCI6MTg1fSwiamFrZSI6eyJhZ2UiOjMwLCJoZWlnaHQiOjI3MH19.YRLPARDmhGMC3BBk_OhtwwK21PIkVCqQe8ncIRPKo-E',
];
const invalidValues = [
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9',
'$Zs.ewu.su84',
'ks64$S/9.dy$§kz.3sd73b',
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ', // No signature
];
const invalidValues = ['eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9', '$Zs.ewu.su84', 'ks64$S/9.dy$§kz.3sd73b'];

class MyClass {
@IsJWT()
Expand Down Expand Up @@ -3533,7 +3535,7 @@ describe('IsUrl', () => {

describe('IsUUID', () => {
const validValues = [
'A987FBC9-4BED-3078-CF07-9141BA07C9F3',
'A987FBC9-4BED-3078-8F07-9141BA07C9F3',
'A987FBC9-4BED-4078-8F07-9141BA07C9F3',
'A987FBC9-4BED-5078-AF07-9141BA07C9F3',
];
Expand All @@ -3547,6 +3549,7 @@ describe('IsUUID', () => {
'934859',
'987FBC9-4BED-3078-CF07A-9141BA07C9F3',
'AAAAAAAA-1111-1111-AAAG-111111111111',
'A987FBC9-4BED-3078-CF07-9141BA07C9F3', // does not conform to RFC9562 UUID
];

class MyClass {
Expand Down Expand Up @@ -3578,7 +3581,12 @@ describe('IsUUID', () => {
});

describe('IsUUID v3', () => {
const validValues = ['A987FBC9-4BED-3078-CF07-9141BA07C9F3'];
const validValues = [
'A987FBC9-4BED-3078-8F07-9141BA07C9F3',
'A987FBC9-4BED-3078-9F07-9141BA07C9F3',
'A987FBC9-4BED-3078-AF07-9141BA07C9F3',
'A987FBC9-4BED-3078-BF07-9141BA07C9F3',
];
const invalidValues = [
null,
undefined,
Expand All @@ -3588,6 +3596,7 @@ describe('IsUUID v3', () => {
'AAAAAAAA-1111-1111-AAAG-111111111111',
'A987FBC9-4BED-4078-8F07-9141BA07C9F3',
'A987FBC9-4BED-5078-AF07-9141BA07C9F3',
'A987FBC9-4BED-3078-CF07-9141BA07C9F3', // does not conform to RFC9562 UUID
];

class MyClass {
Expand Down