redux-freeform 6.2.0-beta.0 → 6.2.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/dist/redux-freeform.cjs.js +23 -22
- package/dist/redux-freeform.esm.js +23 -23
- package/dist/redux-freeform.umd.js +23 -22
- package/package.json +1 -1
|
@@ -155,38 +155,38 @@ function luhnValid(string) {
|
|
|
155
155
|
return false;
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
+
// Extract all digit characters from the string.
|
|
158
159
|
const digits = string.match(/\d/g);
|
|
159
160
|
if (!digits) {
|
|
160
161
|
return false;
|
|
161
162
|
}
|
|
162
163
|
|
|
163
|
-
const digitArray = digits.map(Number);
|
|
164
164
|
let totalSum = 0;
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
165
|
+
let shouldDouble = false;
|
|
166
|
+
|
|
167
|
+
// Process digits from right to left
|
|
168
|
+
for (let i = digits.length - 1; i >= 0; i--) {
|
|
169
|
+
// Convert the current character to a number.
|
|
170
|
+
let digit = parseInt(digits[i], 10);
|
|
171
|
+
|
|
172
|
+
// Double the digit and adjust if it exceeds 9.
|
|
173
|
+
if (shouldDouble) {
|
|
174
|
+
digit *= 2;
|
|
175
|
+
if (digit > 9) {
|
|
176
|
+
// If the result of any doubling operation is greater than nine,
|
|
177
|
+
// then add the digits of the result together to obtain a single-digit number.
|
|
178
|
+
// This is equivalent to adding the digits together (e.g. 16: 1 + 6 = 7 = 16 - 9).
|
|
179
|
+
digit -= 9;
|
|
179
180
|
}
|
|
180
|
-
|
|
181
|
-
totalSum += secondToLastDigitDoubled;
|
|
182
181
|
}
|
|
183
182
|
|
|
184
|
-
//
|
|
185
|
-
totalSum +=
|
|
183
|
+
// Add the processed digit to the total sum.
|
|
184
|
+
totalSum += digit;
|
|
185
|
+
// After doubling the value of the second-to-last digit, continue doing the same for every other digit.
|
|
186
|
+
shouldDouble = !shouldDouble;
|
|
186
187
|
}
|
|
187
188
|
|
|
188
|
-
//
|
|
189
|
-
// According to the Luhn algorithm, the number is considered to be valid if the total ends in zero.
|
|
189
|
+
// The number is valid if totalSum is divisible by 10.
|
|
190
190
|
return totalSum % 10 === 0;
|
|
191
191
|
}
|
|
192
192
|
|
|
@@ -194,7 +194,7 @@ const INCLUDES_POTENTIAL_CARD_NUMBER =
|
|
|
194
194
|
'validator/INCLUDES_POTENTIAL_CARD_NUMBER';
|
|
195
195
|
const INCLUDES_POTENTIAL_CARD_NUMBER_ERROR =
|
|
196
196
|
'error/INCLUDES_POTENTIAL_CARD_NUMBER';
|
|
197
|
-
createValidator(
|
|
197
|
+
const includesPotentialCardNumber = createValidator(
|
|
198
198
|
INCLUDES_POTENTIAL_CARD_NUMBER,
|
|
199
199
|
INCLUDES_POTENTIAL_CARD_NUMBER_ERROR
|
|
200
200
|
);
|
|
@@ -780,6 +780,7 @@ exports.hasNumber = hasNumber;
|
|
|
780
780
|
exports.hasSpecialCharacter = hasSpecialCharacter;
|
|
781
781
|
exports.hasUppercaseLetter = hasUppercaseLetter;
|
|
782
782
|
exports.includedIn = includedIn;
|
|
783
|
+
exports.includesPotentialCardNumber = includesPotentialCardNumber;
|
|
783
784
|
exports.isProbablyEmail = isProbablyEmail;
|
|
784
785
|
exports.isRoutingNumber = isRoutingNumber;
|
|
785
786
|
exports.isValidMonth = isValidMonth;
|
|
@@ -151,38 +151,38 @@ function luhnValid(string) {
|
|
|
151
151
|
return false;
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
+
// Extract all digit characters from the string.
|
|
154
155
|
const digits = string.match(/\d/g);
|
|
155
156
|
if (!digits) {
|
|
156
157
|
return false;
|
|
157
158
|
}
|
|
158
159
|
|
|
159
|
-
const digitArray = digits.map(Number);
|
|
160
160
|
let totalSum = 0;
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
161
|
+
let shouldDouble = false;
|
|
162
|
+
|
|
163
|
+
// Process digits from right to left
|
|
164
|
+
for (let i = digits.length - 1; i >= 0; i--) {
|
|
165
|
+
// Convert the current character to a number.
|
|
166
|
+
let digit = parseInt(digits[i], 10);
|
|
167
|
+
|
|
168
|
+
// Double the digit and adjust if it exceeds 9.
|
|
169
|
+
if (shouldDouble) {
|
|
170
|
+
digit *= 2;
|
|
171
|
+
if (digit > 9) {
|
|
172
|
+
// If the result of any doubling operation is greater than nine,
|
|
173
|
+
// then add the digits of the result together to obtain a single-digit number.
|
|
174
|
+
// This is equivalent to adding the digits together (e.g. 16: 1 + 6 = 7 = 16 - 9).
|
|
175
|
+
digit -= 9;
|
|
175
176
|
}
|
|
176
|
-
|
|
177
|
-
totalSum += secondToLastDigitDoubled;
|
|
178
177
|
}
|
|
179
178
|
|
|
180
|
-
//
|
|
181
|
-
totalSum +=
|
|
179
|
+
// Add the processed digit to the total sum.
|
|
180
|
+
totalSum += digit;
|
|
181
|
+
// After doubling the value of the second-to-last digit, continue doing the same for every other digit.
|
|
182
|
+
shouldDouble = !shouldDouble;
|
|
182
183
|
}
|
|
183
184
|
|
|
184
|
-
//
|
|
185
|
-
// According to the Luhn algorithm, the number is considered to be valid if the total ends in zero.
|
|
185
|
+
// The number is valid if totalSum is divisible by 10.
|
|
186
186
|
return totalSum % 10 === 0;
|
|
187
187
|
}
|
|
188
188
|
|
|
@@ -190,7 +190,7 @@ const INCLUDES_POTENTIAL_CARD_NUMBER =
|
|
|
190
190
|
'validator/INCLUDES_POTENTIAL_CARD_NUMBER';
|
|
191
191
|
const INCLUDES_POTENTIAL_CARD_NUMBER_ERROR =
|
|
192
192
|
'error/INCLUDES_POTENTIAL_CARD_NUMBER';
|
|
193
|
-
createValidator(
|
|
193
|
+
const includesPotentialCardNumber = createValidator(
|
|
194
194
|
INCLUDES_POTENTIAL_CARD_NUMBER,
|
|
195
195
|
INCLUDES_POTENTIAL_CARD_NUMBER_ERROR
|
|
196
196
|
);
|
|
@@ -767,4 +767,4 @@ const createFormState = (formConfig) => ({
|
|
|
767
767
|
mapStateToProps: mapStateToProps,
|
|
768
768
|
});
|
|
769
769
|
|
|
770
|
-
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 };
|
|
770
|
+
export { createFormState, dateAfterToday, dateBeforeToday, hasLength, hasLowercaseLetter, hasNumber, hasSpecialCharacter, hasUppercaseLetter, includedIn, includesPotentialCardNumber, isProbablyEmail, isRoutingNumber, isValidMonth, matchesField, matchesRegex, numberGreaterThan, numberGreaterThanOrEqualTo, numberLessThan, numberLessThanOrEqualTo, onlyExpirationDate, onlyIntegers, onlyNaturals, required, validName, validateSum, validateWhen };
|
|
@@ -157,38 +157,38 @@
|
|
|
157
157
|
return false;
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
+
// Extract all digit characters from the string.
|
|
160
161
|
const digits = string.match(/\d/g);
|
|
161
162
|
if (!digits) {
|
|
162
163
|
return false;
|
|
163
164
|
}
|
|
164
165
|
|
|
165
|
-
const digitArray = digits.map(Number);
|
|
166
166
|
let totalSum = 0;
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
167
|
+
let shouldDouble = false;
|
|
168
|
+
|
|
169
|
+
// Process digits from right to left
|
|
170
|
+
for (let i = digits.length - 1; i >= 0; i--) {
|
|
171
|
+
// Convert the current character to a number.
|
|
172
|
+
let digit = parseInt(digits[i], 10);
|
|
173
|
+
|
|
174
|
+
// Double the digit and adjust if it exceeds 9.
|
|
175
|
+
if (shouldDouble) {
|
|
176
|
+
digit *= 2;
|
|
177
|
+
if (digit > 9) {
|
|
178
|
+
// If the result of any doubling operation is greater than nine,
|
|
179
|
+
// then add the digits of the result together to obtain a single-digit number.
|
|
180
|
+
// This is equivalent to adding the digits together (e.g. 16: 1 + 6 = 7 = 16 - 9).
|
|
181
|
+
digit -= 9;
|
|
181
182
|
}
|
|
182
|
-
|
|
183
|
-
totalSum += secondToLastDigitDoubled;
|
|
184
183
|
}
|
|
185
184
|
|
|
186
|
-
//
|
|
187
|
-
totalSum +=
|
|
185
|
+
// Add the processed digit to the total sum.
|
|
186
|
+
totalSum += digit;
|
|
187
|
+
// After doubling the value of the second-to-last digit, continue doing the same for every other digit.
|
|
188
|
+
shouldDouble = !shouldDouble;
|
|
188
189
|
}
|
|
189
190
|
|
|
190
|
-
//
|
|
191
|
-
// According to the Luhn algorithm, the number is considered to be valid if the total ends in zero.
|
|
191
|
+
// The number is valid if totalSum is divisible by 10.
|
|
192
192
|
return totalSum % 10 === 0;
|
|
193
193
|
}
|
|
194
194
|
|
|
@@ -196,7 +196,7 @@
|
|
|
196
196
|
'validator/INCLUDES_POTENTIAL_CARD_NUMBER';
|
|
197
197
|
const INCLUDES_POTENTIAL_CARD_NUMBER_ERROR =
|
|
198
198
|
'error/INCLUDES_POTENTIAL_CARD_NUMBER';
|
|
199
|
-
createValidator(
|
|
199
|
+
const includesPotentialCardNumber = createValidator(
|
|
200
200
|
INCLUDES_POTENTIAL_CARD_NUMBER,
|
|
201
201
|
INCLUDES_POTENTIAL_CARD_NUMBER_ERROR
|
|
202
202
|
);
|
|
@@ -782,6 +782,7 @@
|
|
|
782
782
|
exports.hasSpecialCharacter = hasSpecialCharacter;
|
|
783
783
|
exports.hasUppercaseLetter = hasUppercaseLetter;
|
|
784
784
|
exports.includedIn = includedIn;
|
|
785
|
+
exports.includesPotentialCardNumber = includesPotentialCardNumber;
|
|
785
786
|
exports.isProbablyEmail = isProbablyEmail;
|
|
786
787
|
exports.isRoutingNumber = isRoutingNumber;
|
|
787
788
|
exports.isValidMonth = isValidMonth;
|
package/package.json
CHANGED