redux-freeform 5.9.0 → 5.9.1-beta.2

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.
@@ -480,6 +480,21 @@ validatorFns[VALID_NAME] = (value, args, form) =>
480
480
  ? false
481
481
  : new RegExp(/[A-zÀ-ÿ\-,'\S]+(\s?[A-zÀ-ÿ\-,'\S])*/).test(value);
482
482
 
483
+ const IS_NOT_AMEX_CARD = 'validator/IS_NOT_AMEX_CARD';
484
+ const IS_NOT_AMEX_CARD_ERROR = 'validator/IS_NOT_AMEX_CARD_ERROR';
485
+ const isNotAmExCard = createValidator(
486
+ IS_NOT_AMEX_CARD,
487
+ IS_NOT_AMEX_CARD_ERROR
488
+ );
489
+ /* This regular expression looks for values not starting with 34 or 37, and
490
+ * reflects that the shortest credit card number we will see is 8 digits,
491
+ * while the longest we'd see is 19 digits according to ansi.org. We want to
492
+ * allow any number with a length in that range that is not an AmEx Card.
493
+ * Source: https://www.ansi.org/standards-news/all-news/2016/07/announcing-major-changes-to-the-issuer-identification-number-iin-standard-28
494
+ */
495
+ validatorFns[IS_NOT_AMEX_CARD] = (value, args, form) =>
496
+ new RegExp(/^([^3]\d{7,18}|3[^47]\d{6,17})$/).test(value);
497
+
483
498
  const runValidatorErrorMessage = (type) =>
484
499
  `${type} was passed to runValidator, but that validator type does not exist.
485
500
  Please check that you are only calling validator creator functions exported from
@@ -684,6 +699,7 @@ exports.hasNumber = hasNumber;
684
699
  exports.hasSpecialCharacter = hasSpecialCharacter;
685
700
  exports.hasUppercaseLetter = hasUppercaseLetter;
686
701
  exports.includedIn = includedIn;
702
+ exports.isNotAmExCard = isNotAmExCard;
687
703
  exports.isProbablyEmail = isProbablyEmail;
688
704
  exports.isRoutingNumber = isRoutingNumber;
689
705
  exports.isValidMonth = isValidMonth;
@@ -476,6 +476,21 @@ validatorFns[VALID_NAME] = (value, args, form) =>
476
476
  ? false
477
477
  : new RegExp(/[A-zÀ-ÿ\-,'\S]+(\s?[A-zÀ-ÿ\-,'\S])*/).test(value);
478
478
 
479
+ const IS_NOT_AMEX_CARD = 'validator/IS_NOT_AMEX_CARD';
480
+ const IS_NOT_AMEX_CARD_ERROR = 'validator/IS_NOT_AMEX_CARD_ERROR';
481
+ const isNotAmExCard = createValidator(
482
+ IS_NOT_AMEX_CARD,
483
+ IS_NOT_AMEX_CARD_ERROR
484
+ );
485
+ /* This regular expression looks for values not starting with 34 or 37, and
486
+ * reflects that the shortest credit card number we will see is 8 digits,
487
+ * while the longest we'd see is 19 digits according to ansi.org. We want to
488
+ * allow any number with a length in that range that is not an AmEx Card.
489
+ * Source: https://www.ansi.org/standards-news/all-news/2016/07/announcing-major-changes-to-the-issuer-identification-number-iin-standard-28
490
+ */
491
+ validatorFns[IS_NOT_AMEX_CARD] = (value, args, form) =>
492
+ new RegExp(/^([^3]\d{7,18}|3[^47]\d{6,17})$/).test(value);
493
+
479
494
  const runValidatorErrorMessage = (type) =>
480
495
  `${type} was passed to runValidator, but that validator type does not exist.
481
496
  Please check that you are only calling validator creator functions exported from
@@ -671,4 +686,4 @@ const createFormState = (formConfig) => ({
671
686
  mapStateToProps: mapStateToProps,
672
687
  });
673
688
 
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 };
689
+ export { createFormState, dateAfterToday, dateBeforeToday, hasLength, hasLowercaseLetter, hasNumber, hasSpecialCharacter, hasUppercaseLetter, includedIn, isNotAmExCard, isProbablyEmail, isRoutingNumber, isValidMonth, matchesField, matchesRegex, numberGreaterThan, numberGreaterThanOrEqualTo, numberLessThan, numberLessThanOrEqualTo, onlyExpirationDate, onlyIntegers, onlyNaturals, required, validName, validateSum, validateWhen };
@@ -482,6 +482,21 @@
482
482
  ? false
483
483
  : new RegExp(/[A-zÀ-ÿ\-,'\S]+(\s?[A-zÀ-ÿ\-,'\S])*/).test(value);
484
484
 
485
+ const IS_NOT_AMEX_CARD = 'validator/IS_NOT_AMEX_CARD';
486
+ const IS_NOT_AMEX_CARD_ERROR = 'validator/IS_NOT_AMEX_CARD_ERROR';
487
+ const isNotAmExCard = createValidator(
488
+ IS_NOT_AMEX_CARD,
489
+ IS_NOT_AMEX_CARD_ERROR
490
+ );
491
+ /* This regular expression looks for values not starting with 34 or 37, and
492
+ * reflects that the shortest credit card number we will see is 8 digits,
493
+ * while the longest we'd see is 19 digits according to ansi.org. We want to
494
+ * allow any number with a length in that range that is not an AmEx Card.
495
+ * Source: https://www.ansi.org/standards-news/all-news/2016/07/announcing-major-changes-to-the-issuer-identification-number-iin-standard-28
496
+ */
497
+ validatorFns[IS_NOT_AMEX_CARD] = (value, args, form) =>
498
+ new RegExp(/^([^3]\d{7,18}|3[^47]\d{6,17})$/).test(value);
499
+
485
500
  const runValidatorErrorMessage = (type) =>
486
501
  `${type} was passed to runValidator, but that validator type does not exist.
487
502
  Please check that you are only calling validator creator functions exported from
@@ -686,6 +701,7 @@
686
701
  exports.hasSpecialCharacter = hasSpecialCharacter;
687
702
  exports.hasUppercaseLetter = hasUppercaseLetter;
688
703
  exports.includedIn = includedIn;
704
+ exports.isNotAmExCard = isNotAmExCard;
689
705
  exports.isProbablyEmail = isProbablyEmail;
690
706
  exports.isRoutingNumber = isRoutingNumber;
691
707
  exports.isValidMonth = isValidMonth;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "redux-freeform",
3
- "version": "5.9.0",
3
+ "version": "5.9.1-beta.2",
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",