redux-freeform 6.0.0 → 6.1.1-beta.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.
|
@@ -110,6 +110,25 @@ const onlyExpirationDate = createValidator(
|
|
|
110
110
|
validatorFns[ONLY_EXPIRATION_DATE] = (value, args, form) =>
|
|
111
111
|
/^(\d?\d?\/?\d?\d?)?$/.test(value);
|
|
112
112
|
|
|
113
|
+
/*
|
|
114
|
+
11/24 - Users have been adding full CC numbers to the name field
|
|
115
|
+
This validator will check if the value has more than 6 numeric characters
|
|
116
|
+
We have to allow for some numeric characters to account for business
|
|
117
|
+
names that include numbers like "3M Company" or "Smith Street Trust 40389"
|
|
118
|
+
*/
|
|
119
|
+
const NO_MORE_THAN_SIX_NUMBERS = 'validator/NO_MORE_THAN_SIX_NUMBERS';
|
|
120
|
+
const NO_MORE_THAN_SIX_NUMBERS_ERROR = 'error/NO_MORE_THAN_SIX_NUMBERS';
|
|
121
|
+
createValidator(
|
|
122
|
+
NO_MORE_THAN_SIX_NUMBERS,
|
|
123
|
+
NO_MORE_THAN_SIX_NUMBERS_ERROR
|
|
124
|
+
);
|
|
125
|
+
validatorFns[NO_MORE_THAN_SIX_NUMBERS] = (value) => {
|
|
126
|
+
if (value === '') {
|
|
127
|
+
return true;
|
|
128
|
+
}
|
|
129
|
+
return !/(\d.*){7,}/.test(value);
|
|
130
|
+
};
|
|
131
|
+
|
|
113
132
|
const NUMBER_LESS_THAN = 'validator/NUMBER_LESS_THAN';
|
|
114
133
|
const NUMBER_LESS_THAN_ERROR = 'error/NUMBER_LESS_THAN';
|
|
115
134
|
const numberLessThan = createValidator(
|
|
@@ -380,6 +399,28 @@ validatorFns[MATCHES_REGEX] = (value, args, form) => {
|
|
|
380
399
|
return new RegExp(args[0]).test(value); // new RexExp never throws an error, no matter the input
|
|
381
400
|
};
|
|
382
401
|
|
|
402
|
+
const IS_AMERICAN_OR_CANADIAN_ROUTING_NUMBER =
|
|
403
|
+
'validator/IS_AMERICAN_OR_CANADIAN_ROUTING_NUMBER';
|
|
404
|
+
const IS_AMERICAN_OR_CANADIAN_ROUTING_NUMBER_ERROR =
|
|
405
|
+
'validator/IS_AMERICAN_OR_CANADIAN_ROUTING_NUMBER_ERROR';
|
|
406
|
+
const isAmericanOrCanadianRoutingNumber = createValidator(
|
|
407
|
+
IS_AMERICAN_OR_CANADIAN_ROUTING_NUMBER,
|
|
408
|
+
IS_AMERICAN_OR_CANADIAN_ROUTING_NUMBER_ERROR
|
|
409
|
+
);
|
|
410
|
+
validatorFns[IS_AMERICAN_OR_CANADIAN_ROUTING_NUMBER] = (value, args, form) => {
|
|
411
|
+
if (value === '') {
|
|
412
|
+
return true;
|
|
413
|
+
} else if (value.length === 8) {
|
|
414
|
+
const regExp = /^\d{8}$/;
|
|
415
|
+
return regExp.test(value);
|
|
416
|
+
} else if (value.length === 9) {
|
|
417
|
+
const regExp = /^\d{9}$/;
|
|
418
|
+
return validatorFns[IS_ROUTING_NUMBER](value, args, form) && regExp.test(value);
|
|
419
|
+
} else {
|
|
420
|
+
return false;
|
|
421
|
+
}
|
|
422
|
+
};
|
|
423
|
+
|
|
383
424
|
// based on http://www.brainjar.com/js/validation/
|
|
384
425
|
const IS_ROUTING_NUMBER = 'validator/IS_ROUTING_NUMBER';
|
|
385
426
|
const IS_ROUTING_NUMBER_ERROR = 'error/IS_ROUTING_NUMBER';
|
|
@@ -684,6 +725,7 @@ exports.hasNumber = hasNumber;
|
|
|
684
725
|
exports.hasSpecialCharacter = hasSpecialCharacter;
|
|
685
726
|
exports.hasUppercaseLetter = hasUppercaseLetter;
|
|
686
727
|
exports.includedIn = includedIn;
|
|
728
|
+
exports.isAmericanOrCanadianRoutingNumber = isAmericanOrCanadianRoutingNumber;
|
|
687
729
|
exports.isProbablyEmail = isProbablyEmail;
|
|
688
730
|
exports.isRoutingNumber = isRoutingNumber;
|
|
689
731
|
exports.isValidMonth = isValidMonth;
|
|
@@ -106,6 +106,25 @@ const onlyExpirationDate = createValidator(
|
|
|
106
106
|
validatorFns[ONLY_EXPIRATION_DATE] = (value, args, form) =>
|
|
107
107
|
/^(\d?\d?\/?\d?\d?)?$/.test(value);
|
|
108
108
|
|
|
109
|
+
/*
|
|
110
|
+
11/24 - Users have been adding full CC numbers to the name field
|
|
111
|
+
This validator will check if the value has more than 6 numeric characters
|
|
112
|
+
We have to allow for some numeric characters to account for business
|
|
113
|
+
names that include numbers like "3M Company" or "Smith Street Trust 40389"
|
|
114
|
+
*/
|
|
115
|
+
const NO_MORE_THAN_SIX_NUMBERS = 'validator/NO_MORE_THAN_SIX_NUMBERS';
|
|
116
|
+
const NO_MORE_THAN_SIX_NUMBERS_ERROR = 'error/NO_MORE_THAN_SIX_NUMBERS';
|
|
117
|
+
createValidator(
|
|
118
|
+
NO_MORE_THAN_SIX_NUMBERS,
|
|
119
|
+
NO_MORE_THAN_SIX_NUMBERS_ERROR
|
|
120
|
+
);
|
|
121
|
+
validatorFns[NO_MORE_THAN_SIX_NUMBERS] = (value) => {
|
|
122
|
+
if (value === '') {
|
|
123
|
+
return true;
|
|
124
|
+
}
|
|
125
|
+
return !/(\d.*){7,}/.test(value);
|
|
126
|
+
};
|
|
127
|
+
|
|
109
128
|
const NUMBER_LESS_THAN = 'validator/NUMBER_LESS_THAN';
|
|
110
129
|
const NUMBER_LESS_THAN_ERROR = 'error/NUMBER_LESS_THAN';
|
|
111
130
|
const numberLessThan = createValidator(
|
|
@@ -376,6 +395,28 @@ validatorFns[MATCHES_REGEX] = (value, args, form) => {
|
|
|
376
395
|
return new RegExp(args[0]).test(value); // new RexExp never throws an error, no matter the input
|
|
377
396
|
};
|
|
378
397
|
|
|
398
|
+
const IS_AMERICAN_OR_CANADIAN_ROUTING_NUMBER =
|
|
399
|
+
'validator/IS_AMERICAN_OR_CANADIAN_ROUTING_NUMBER';
|
|
400
|
+
const IS_AMERICAN_OR_CANADIAN_ROUTING_NUMBER_ERROR =
|
|
401
|
+
'validator/IS_AMERICAN_OR_CANADIAN_ROUTING_NUMBER_ERROR';
|
|
402
|
+
const isAmericanOrCanadianRoutingNumber = createValidator(
|
|
403
|
+
IS_AMERICAN_OR_CANADIAN_ROUTING_NUMBER,
|
|
404
|
+
IS_AMERICAN_OR_CANADIAN_ROUTING_NUMBER_ERROR
|
|
405
|
+
);
|
|
406
|
+
validatorFns[IS_AMERICAN_OR_CANADIAN_ROUTING_NUMBER] = (value, args, form) => {
|
|
407
|
+
if (value === '') {
|
|
408
|
+
return true;
|
|
409
|
+
} else if (value.length === 8) {
|
|
410
|
+
const regExp = /^\d{8}$/;
|
|
411
|
+
return regExp.test(value);
|
|
412
|
+
} else if (value.length === 9) {
|
|
413
|
+
const regExp = /^\d{9}$/;
|
|
414
|
+
return validatorFns[IS_ROUTING_NUMBER](value, args, form) && regExp.test(value);
|
|
415
|
+
} else {
|
|
416
|
+
return false;
|
|
417
|
+
}
|
|
418
|
+
};
|
|
419
|
+
|
|
379
420
|
// based on http://www.brainjar.com/js/validation/
|
|
380
421
|
const IS_ROUTING_NUMBER = 'validator/IS_ROUTING_NUMBER';
|
|
381
422
|
const IS_ROUTING_NUMBER_ERROR = 'error/IS_ROUTING_NUMBER';
|
|
@@ -671,4 +712,4 @@ const createFormState = (formConfig) => ({
|
|
|
671
712
|
mapStateToProps: mapStateToProps,
|
|
672
713
|
});
|
|
673
714
|
|
|
674
|
-
export { createFormState, dateAfterToday, dateBeforeToday, hasLength, hasLowercaseLetter, hasNumber, hasSpecialCharacter, hasUppercaseLetter, includedIn, isProbablyEmail, isRoutingNumber, isValidMonth, matchesField, matchesRegex, numberGreaterThan, numberGreaterThanOrEqualTo, numberLessThan, numberLessThanOrEqualTo, onlyExpirationDate, onlyIntegers, onlyNaturals, required, validName, validateSum, validateWhen };
|
|
715
|
+
export { createFormState, dateAfterToday, dateBeforeToday, hasLength, hasLowercaseLetter, hasNumber, hasSpecialCharacter, hasUppercaseLetter, includedIn, isAmericanOrCanadianRoutingNumber, isProbablyEmail, isRoutingNumber, isValidMonth, matchesField, matchesRegex, numberGreaterThan, numberGreaterThanOrEqualTo, numberLessThan, numberLessThanOrEqualTo, onlyExpirationDate, onlyIntegers, onlyNaturals, required, validName, validateSum, validateWhen };
|
|
@@ -112,6 +112,25 @@
|
|
|
112
112
|
validatorFns[ONLY_EXPIRATION_DATE] = (value, args, form) =>
|
|
113
113
|
/^(\d?\d?\/?\d?\d?)?$/.test(value);
|
|
114
114
|
|
|
115
|
+
/*
|
|
116
|
+
11/24 - Users have been adding full CC numbers to the name field
|
|
117
|
+
This validator will check if the value has more than 6 numeric characters
|
|
118
|
+
We have to allow for some numeric characters to account for business
|
|
119
|
+
names that include numbers like "3M Company" or "Smith Street Trust 40389"
|
|
120
|
+
*/
|
|
121
|
+
const NO_MORE_THAN_SIX_NUMBERS = 'validator/NO_MORE_THAN_SIX_NUMBERS';
|
|
122
|
+
const NO_MORE_THAN_SIX_NUMBERS_ERROR = 'error/NO_MORE_THAN_SIX_NUMBERS';
|
|
123
|
+
createValidator(
|
|
124
|
+
NO_MORE_THAN_SIX_NUMBERS,
|
|
125
|
+
NO_MORE_THAN_SIX_NUMBERS_ERROR
|
|
126
|
+
);
|
|
127
|
+
validatorFns[NO_MORE_THAN_SIX_NUMBERS] = (value) => {
|
|
128
|
+
if (value === '') {
|
|
129
|
+
return true;
|
|
130
|
+
}
|
|
131
|
+
return !/(\d.*){7,}/.test(value);
|
|
132
|
+
};
|
|
133
|
+
|
|
115
134
|
const NUMBER_LESS_THAN = 'validator/NUMBER_LESS_THAN';
|
|
116
135
|
const NUMBER_LESS_THAN_ERROR = 'error/NUMBER_LESS_THAN';
|
|
117
136
|
const numberLessThan = createValidator(
|
|
@@ -382,6 +401,28 @@
|
|
|
382
401
|
return new RegExp(args[0]).test(value); // new RexExp never throws an error, no matter the input
|
|
383
402
|
};
|
|
384
403
|
|
|
404
|
+
const IS_AMERICAN_OR_CANADIAN_ROUTING_NUMBER =
|
|
405
|
+
'validator/IS_AMERICAN_OR_CANADIAN_ROUTING_NUMBER';
|
|
406
|
+
const IS_AMERICAN_OR_CANADIAN_ROUTING_NUMBER_ERROR =
|
|
407
|
+
'validator/IS_AMERICAN_OR_CANADIAN_ROUTING_NUMBER_ERROR';
|
|
408
|
+
const isAmericanOrCanadianRoutingNumber = createValidator(
|
|
409
|
+
IS_AMERICAN_OR_CANADIAN_ROUTING_NUMBER,
|
|
410
|
+
IS_AMERICAN_OR_CANADIAN_ROUTING_NUMBER_ERROR
|
|
411
|
+
);
|
|
412
|
+
validatorFns[IS_AMERICAN_OR_CANADIAN_ROUTING_NUMBER] = (value, args, form) => {
|
|
413
|
+
if (value === '') {
|
|
414
|
+
return true;
|
|
415
|
+
} else if (value.length === 8) {
|
|
416
|
+
const regExp = /^\d{8}$/;
|
|
417
|
+
return regExp.test(value);
|
|
418
|
+
} else if (value.length === 9) {
|
|
419
|
+
const regExp = /^\d{9}$/;
|
|
420
|
+
return validatorFns[IS_ROUTING_NUMBER](value, args, form) && regExp.test(value);
|
|
421
|
+
} else {
|
|
422
|
+
return false;
|
|
423
|
+
}
|
|
424
|
+
};
|
|
425
|
+
|
|
385
426
|
// based on http://www.brainjar.com/js/validation/
|
|
386
427
|
const IS_ROUTING_NUMBER = 'validator/IS_ROUTING_NUMBER';
|
|
387
428
|
const IS_ROUTING_NUMBER_ERROR = 'error/IS_ROUTING_NUMBER';
|
|
@@ -686,6 +727,7 @@
|
|
|
686
727
|
exports.hasSpecialCharacter = hasSpecialCharacter;
|
|
687
728
|
exports.hasUppercaseLetter = hasUppercaseLetter;
|
|
688
729
|
exports.includedIn = includedIn;
|
|
730
|
+
exports.isAmericanOrCanadianRoutingNumber = isAmericanOrCanadianRoutingNumber;
|
|
689
731
|
exports.isProbablyEmail = isProbablyEmail;
|
|
690
732
|
exports.isRoutingNumber = isRoutingNumber;
|
|
691
733
|
exports.isValidMonth = isValidMonth;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "redux-freeform",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.1.1-beta.0",
|
|
4
4
|
"description": "A small Redux form library that supports purely functional apps, without magic",
|
|
5
5
|
"main": "dist/redux-freeform.cjs.js",
|
|
6
6
|
"module": "dist/redux-freeform.esm.js",
|
|
@@ -11,11 +11,11 @@
|
|
|
11
11
|
"scripts": {
|
|
12
12
|
"dev": "rollup -c -w",
|
|
13
13
|
"build": "rollup -c",
|
|
14
|
-
"test": "
|
|
14
|
+
"test": "jest",
|
|
15
15
|
"format": "prettier --write \"{src,examples,website,test}/**/*.js\" && eslint ./ --ext .js,.jsx,.ts,.tsx --fix",
|
|
16
16
|
"format-check": "prettier --check \"{src,examples,website,test}/**/*.js\"",
|
|
17
17
|
"lint": "eslint ./ --ext .js,.jsx,.ts,.tsx",
|
|
18
|
-
"coverage": "
|
|
18
|
+
"coverage": "jest --coverage --coverageReporters=lcov --coverageReporters=text --coveragePerFile=true"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"acorn": "^8.8.2",
|
|
@@ -29,11 +29,10 @@
|
|
|
29
29
|
"@babel/preset-env": "^7.21.5",
|
|
30
30
|
"@babel/preset-react": "^7.18.6",
|
|
31
31
|
"@babel/register": "^7.21.0",
|
|
32
|
+
"@fast-check/jest": "^2.0.3",
|
|
33
|
+
"@jest/globals": "^29.7.0",
|
|
32
34
|
"@rollup/plugin-commonjs": "^24.1.0",
|
|
33
35
|
"@rollup/plugin-node-resolve": "^15.0.2",
|
|
34
|
-
"ava": "^3.15.0",
|
|
35
|
-
"ava-fast-check": "^4.0.2",
|
|
36
|
-
"babel-plugin-istanbul": "^6.1.1",
|
|
37
36
|
"coveralls": "^3.1.0",
|
|
38
37
|
"eslint": "^8.39.0",
|
|
39
38
|
"eslint-config-prettier": "^8.8.0",
|
|
@@ -41,8 +40,7 @@
|
|
|
41
40
|
"eslint-plugin-prettier": "^4.2.1",
|
|
42
41
|
"eslint-plugin-react": "^7.32.2",
|
|
43
42
|
"esm": "^3.2.25",
|
|
44
|
-
"
|
|
45
|
-
"nyc": "^15.1.0",
|
|
43
|
+
"jest": "^29.7.0",
|
|
46
44
|
"prettier": "^2.8.8",
|
|
47
45
|
"prettier-eslint": "^15.0.1",
|
|
48
46
|
"rollup": "2.79.1"
|