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
6 changes: 1 addition & 5 deletions src/lib/isBase32.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,5 @@ export default function isBase32(str, options) {
return crockfordBase32.test(str);
}

const len = str.length;
if (len % 8 === 0 && base32.test(str)) {
return true;
}
return false;
return str.length % 8 === 0 && base32.test(str);
}
5 changes: 1 addition & 4 deletions src/lib/isBase58.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,5 @@ const base58Reg = /^[A-HJ-NP-Za-km-z1-9]*$/;

export default function isBase58(str) {
assertString(str);
if (base58Reg.test(str)) {
return true;
}
return false;
return base58Reg.test(str);
}
6 changes: 1 addition & 5 deletions src/lib/isIBAN.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,7 @@ function hasOnlyValidCountryCodes(countryCodeArray) {
const countryCodeArrayFilteredWithObjectIbanCode = countryCodeArray
.filter(countryCode => !(countryCode in ibanRegexThroughCountryCode));

if (countryCodeArrayFilteredWithObjectIbanCode.length > 0) {
return false;
}

return true;
return countryCodeArrayFilteredWithObjectIbanCode.length === 0;
}

/**
Expand Down
12 changes: 2 additions & 10 deletions src/lib/isIdentityCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,23 +217,15 @@ const validators = {
// sanitize user input
const sanitized = str.trim();

// validate the data structure
if (!NIN.test(sanitized)) {
return false;
}
return true;
return NIN.test(sanitized);
},
'ar-TN': (str) => {
const DNI = /^\d{8}$/;

// sanitize user input
const sanitized = str.trim();

// validate the data structure
if (!DNI.test(sanitized)) {
return false;
}
return true;
return DNI.test(sanitized);
},
'zh-CN': (str) => {
const provincesAndCities = [
Expand Down
Loading