-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NI partial postcode fix and page not found fix for url.
- Loading branch information
1 parent
49201c8
commit 6cc33c2
Showing
6 changed files
with
58 additions
and
13 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const fullNorthernIrelandPostcodeRegex = /^BT\d{1,2}\s?\d[A-Z]{2}$/i // Regular expression to match full Northern Ireland postcode format '' | ||
const partialNorthernIrelandPostcodeRegex = /^BT\d{1,2}$/i // Regular expression to match partial Northern Ireland postcode format '' | ||
const fullUKPostcodeRegex = /^[A-Z]{1,2}\d[A-Z\d]?\s?\d[A-Z]{2}$/i // Regular expression to match full UK postcode format '' | ||
const partialUKPostcodeRegex = /^[A-Z]{1,2}\d[A-Z\d]?$/i // Regular expression to match partial UK postcode format '' | ||
|
||
function getPostcode(postcode) { | ||
let postcodeType = '' | ||
if (fullNorthernIrelandPostcodeRegex.test(postcode)) { | ||
postcodeType = 'Full Northern Ireland Postcode' // Return postcodeType for full Northern Ireland postcode '' | ||
} else if (partialNorthernIrelandPostcodeRegex.test(postcode)) { | ||
postcodeType = 'Partial Northern Ireland Postcode' // Return postcodeType for partial Northern Ireland postcode '' | ||
} else if (fullUKPostcodeRegex.test(postcode)) { | ||
postcodeType = 'Full UK Postcode' // Return postcodeType for full UK postcode '' | ||
} else if (partialUKPostcodeRegex.test(postcode)) { | ||
postcodeType = 'Partial UK Postcode' // Return postcodeType for partial UK postcode '' | ||
} else { | ||
postcodeType = 'Invalid Postcode' // Return postcodeType for invalid postcode '' | ||
} | ||
return { postcodeType } | ||
} | ||
|
||
export { getPostcode } |
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
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