This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const countyToNo= (county: string, subCounty: string): object => { | |
county = String(county).trim() | |
subCounty = String(subCounty).trim() | |
let countyNo: number; | |
let subCountyNo: number; | |
switch (true) { | |
//Regex county names to avoid typos | |
//01 Mombasa | |
case /^momb.*/gi.test(county): | |
countyNo = 101; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"name": "Mombasa", | |
"code": 1, | |
"capital": "Mombasa City", | |
"subCounties": [ "Changamwe", "Jomvu", "Kisauni", "Likoni", "Mvita", "Nyali" ] | |
}, | |
{ | |
"name": "Kwale", | |
"code": 2, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"name": "English", | |
"code": "101" | |
}, | |
{ | |
"name": "Kiswahili", | |
"code": "102" | |
}, | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let phoneNumberRegex = new RegExp(/^(\+254|0)(7[0-9]|1[0-1])[0-9][0-9]{6}$/) |