module.exports = { CN: /^1\d{10}$/, SG: /^[89]\d{7}$/, US: /^\d{10}$/, JP: /^\d{10}$/, validatePhone ({ phone } = {}) { try { let [fullphone, areacode, callnumber] = /^\+(\d{1,3})-(\d{7,11})$/.exec(phone) switch (areacode) { case this.landSet['CN'].itc: return this.CN.test(callnumber) case this.landSet['SG'].itc: return this.SG.test(callnumber) case this.landSet['US'].itc: return this.US.test(callnumber) case this.landSet['JP'].itc: return this.JP.test(callnumber) default: return true } } catch (err) { return false } }, }