feat(client, learn): add helper functions for common validation operations (#38605)

Co-authored-by: Randell Dawson <5313213+RandellDawson@users.noreply.github.com>
This commit is contained in:
Hassaan Pasha
2020-09-17 19:08:01 +05:00
committed by GitHub
parent aecbc28798
commit 80438cac3e
54 changed files with 326 additions and 157 deletions

View File

@@ -77,7 +77,7 @@ function isValid(iban) {
MC:27, MR:27, SM:27, AL:28, AZ:28, CY:28, DO:28, GT:28,
HU:28, LB:28, PL:28, BR:29, PS:29, KW:30, MU:30, MT:31
}
iban = iban.replace(/\s/g, '')
iban = __helpers.removeWhiteSpace(iban)
if (!iban.match(/^[\dA-Z]+$/)) return false
var len = iban.length
if (len != ibanLen[iban.substr(0,2)]) return false

View File

@@ -66,7 +66,7 @@ function solve(input) {
function solve(input) {
var orig = {};
input.forEach(function(e) {
orig[e.replace(/\s/g, '').toLowerCase()] = e;
orig[__helpers.removeWhiteSpace(e).toLowerCase()] = e;
});
input = Object.keys(orig);