test-numbers-generator
Version:
Generate and validate European test phone numbers (mobile and landline) in safe, non-existent ranges.
66 lines (65 loc) • 2.61 kB
JavaScript
;
// Generator functions for Dutch test phone numbers
Object.defineProperty(exports, "__esModule", { value: true });
exports.testNumbersGenerator = exports.generateTestMobileNumber = void 0;
exports.generateTestLandlineNumber = generateTestLandlineNumber;
exports.generateTestMobileNumber = {
Netherlands: () => {
// +31 6 99xxxxxx
const random = Math.floor(100000 + Math.random() * 900000);
return `+31 6 99${random.toString().padStart(6, '0')}`;
},
Germany: () => {
// +49 151 99xxxxx (test range)
const random = Math.floor(10000 + Math.random() * 90000);
return `+49 151 99${random.toString().padStart(5, '0')}`;
},
Belgium: () => {
// +32 470 99xxxx (test range)
const random = Math.floor(1000 + Math.random() * 9000);
return `+32 470 99${random.toString().padStart(4, '0')}`;
},
France: () => {
// +33 6 99xxxxxx (test range)
const random = Math.floor(100000 + Math.random() * 900000);
return `+33 6 99${random.toString().padStart(6, '0')}`;
},
UnitedKingdom: () => {
// +44 7900 99xxxx (test range)
const random = Math.floor(1000 + Math.random() * 9000);
return `+44 7900 99${random.toString().padStart(4, '0')}`;
},
Spain: () => {
// +34 699 99xxxx (test range)
const random = Math.floor(1000 + Math.random() * 9000);
return `+34 699 99${random.toString().padStart(4, '0')}`;
},
Italy: () => {
// +39 399 99xxxx (test range)
const random = Math.floor(1000 + Math.random() * 9000);
return `+39 399 99${random.toString().padStart(4, '0')}`;
},
Austria: () => {
// +43 699 99xxxx (test range)
const random = Math.floor(1000 + Math.random() * 9000);
return `+43 699 99${random.toString().padStart(4, '0')}`;
},
Switzerland: () => {
// +41 79 99xxxxxx (test range)
const random = Math.floor(100000 + Math.random() * 900000);
return `+41 79 99${random.toString().padStart(6, '0')}`;
},
Sweden: () => {
// +46 79 99xxxxx (test range)
const random = Math.floor(10000 + Math.random() * 90000);
return `+46 79 99${random.toString().padStart(5, '0')}`;
},
};
function generateTestLandlineNumber() {
// +31 10 99xxxx (non-existent/test range for Rotterdam)
const random = Math.floor(1000 + Math.random() * 9000);
return `+31 10 99${random.toString().padStart(4, '0')}`;
}
exports.testNumbersGenerator = {
generateTestMobileNumber: exports.generateTestMobileNumber,
};