diff --git a/i18n-lands.js b/i18n-lands.js index 56c43b0..7c56fbb 100644 --- a/i18n-lands.js +++ b/i18n-lands.js @@ -769,7 +769,9 @@ module.exports = { namefull: { enUS: "the People's Republic of China", zhCN: '中华人民共和国' }, notes: '“GB/T 2659-2000”的“CN”适用于整个中华人民共和国辖区(包括中国大陆、香港、澳门)。而“ISO 3166-1”和“CNS 12842”的“CN”则仅适用于中国大陆,不含港澳地区。', - reCallnumber: /^1\d{10}$/.source, + phoneRegex: /^1\d{10}$/.source, + phoneMaxlen: 11, + phoneMinlen: 11, timezone: '0', }, CO: { @@ -1832,7 +1834,7 @@ module.exports = { name: { enUS: 'Japan', native: '日本', zhCN: '日本', zhHK: '日本', zhTW: '日本' }, namefull: { enUS: '', zhCN: '日本国' }, notes: '', - reCallnumber: /^\d{10}$/.source, + phoneRegex: /^\d{10,11}$/.source, timezone: '1', }, KE: { @@ -3184,7 +3186,7 @@ module.exports = { name: { enUS: 'Singapore', zhCN: '新加坡', zhHK: '新加坡', zhTW: '新加坡' }, namefull: { enUS: 'the Republic of Singapore', zhCN: '新加坡共和国' }, notes: '', - reCallnumber: /^[89]\d{7}$/.source, + phoneRegex: /^[89]\d{7}$/.source, timezone: '0', }, SH: { @@ -3746,7 +3748,9 @@ module.exports = { name: { enUS: 'United States', zhCN: '美国', zhHK: '美国', zhTW: '美国' }, namefull: { enUS: 'the United States of America', zhCN: '美利坚合众国' }, notes: '', - reCallnumber: /^\d{10}$/.source, + phoneRegex: /^\d{10}$/.source, + phoneMaxlen: 10, + phoneMinlen: 10, timezone: '-13', }, UY: { diff --git a/i18n-tool.js b/i18n-tool.js index d5f885a..a5e8847 100644 --- a/i18n-tool.js +++ b/i18n-tool.js @@ -3,16 +3,16 @@ const landSet = require('./i18n-lands.js') module.exports = { validate_phone ({ phone } = {}) { try { - let [fullphone, itc, callnumber] = /^\+(\d{1,3})-(\d{7,11})$/.exec(phone) + let [fullphone, itc, callnumber] = /^\+(\d{1,3})-(\d{7,12})$/.exec(phone) switch (itc) { case landSet.CN.itc: - return new RegExp(landSet.CN.reCallnumber).test(callnumber) + return new RegExp(landSet.CN.phoneRegex).test(callnumber) case landSet.JP.itc: - return new RegExp(landSet.JP.reCallnumber).test(callnumber) + return new RegExp(landSet.JP.phoneRegex).test(callnumber) case landSet.SG.itc: - return new RegExp(landSet.SG.reCallnumber).test(callnumber) + return new RegExp(landSet.SG.phoneRegex).test(callnumber) case landSet.US.itc: - return new RegExp(landSet.US.reCallnumber).test(callnumber) + return new RegExp(landSet.US.phoneRegex).test(callnumber) default: return true }