A functional port of the postcode.js library.
The postcode library will not create a PostcodeString type unless it passes validation as a genuine UK postcode.
Examples:
// This will create a validated postcode type and output the string representation of its value.
// An invalid postcode would result in an Error type with a value of 'Invalid Postcode'
printf "The postcode was %s" <| match postcode "L27 8XY" with
| Result.Ok p -> p |> string
| Result.Error e -> e The functions can be chained together to extract different parts of the postcode
// This will create a validated postcode type and output the string representation of its outcode value.
// An invalid postcode would result in an Error type with a value of 'Invalid Postcode'
printf "The outcodecode was %s" <| match postcode "L27 8XY" with
| Result.Ok p -> p |> Outcode
| Result.Error e -> e
Postcode is built with the latest .NET Core SDK.
You can either install Visual Studio 2017 which comes with the latest SDK or manually download and install the .NET SDK 2.1.
After installation you should be able to run the .\build script to successfully build, test and package the library.
The build script supports the following flags:
Releasewill build the libraryTestwill build and test the libraryExhaustiveTestswill build and test the library running the exhaustive tests against the full UK postcode list