Removed pad function

This commit is contained in:
Luca Vandro 2019-04-14 15:14:17 +02:00
parent b114ba9693
commit 89b66b8fbf
8 changed files with 9 additions and 21 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -57,16 +57,7 @@ function extractConsonants(str) {
return str.replace(/[^BCDFGHJKLMNPQRSTVWXYZ]/gi, '');
}
function pad(n) {
var size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
var s = String(n);
while (s.length < size) {
s = "0".concat(s);
}
return s;
}
function birthplaceFields(provinceSelector, birthplaceSelector) {
var provinceSelect = document.querySelector(provinceSelector);

View File

@ -41,13 +41,6 @@ export function extractVowels (str) {
export function extractConsonants (str) {
return str.replace(/[^BCDFGHJKLMNPQRSTVWXYZ]/gi, '')
}
export function pad (n, size = 2) {
let s = String(n)
while (s.length < size) {
s = `0${s}`
}
return s
}
export function birthplaceFields (provinceSelector, birthplaceSelector) {
const provinceSelect = document.querySelector(provinceSelector)

View File

@ -299,5 +299,9 @@ describe('Calcolo codice fiscale inverso -> metodo .computeInverse per le donne'
expect(CodiceFiscale.computeInverse(maria_rossi_cf).year).toBe(1980);
})
test('la data corretta', () => {
expect(CodiceFiscale.computeInverse(maria_rossi_cf).birthday).toBe("1980-06-23");
})
})