Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/KushalP/uk_postcode
UK postcode parsing and validation for Elixir
https://github.com/KushalP/uk_postcode
Last synced: 7 days ago
JSON representation
UK postcode parsing and validation for Elixir
- Host: GitHub
- URL: https://github.com/KushalP/uk_postcode
- Owner: KushalP
- License: mit
- Created: 2015-03-19T18:40:19.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2023-04-03T22:04:40.000Z (over 1 year ago)
- Last Synced: 2024-10-08T13:41:05.231Z (about 1 month ago)
- Language: Elixir
- Size: 75.2 KB
- Stars: 10
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- freaking_awesome_elixir - Elixir - UK postcode parsing and validation library. (Validations)
- fucking-awesome-elixir - uk_postcode - UK postcode parsing and validation library. (Validations)
- awesome-elixir - uk_postcode - UK postcode parsing and validation library. (Validations)
README
# UK Postcode
[![Build Status](https://travis-ci.org/KushalP/uk_postcode.svg?branch=master)](https://travis-ci.org/KushalP/uk_postcode)
[![Hex Version](http://img.shields.io/hexpm/v/uk_postcode.svg?style=flat)](https://hex.pm/packages/uk_postcode)
[![Inline docs](http://inch-ci.org/github/KushalP/uk_postcode.svg?branch=master&style=flat)](http://inch-ci.org/github/KushalP/uk_postcode)UK postcode parsing and validation for
[Elixir](http://elixir-lang.org/). Based on the excellent Ruby library
of the [same name](https://github.com/threedaymonk/uk_postcode) by
[@threedaymonk](https://github.com/threedaymonk).## Usage
Validate full postcodes or parts of a postcode.
```elixir
UKPostcode.valid? "W1A 1AA" #=> true
UKPostcode.full? "W1A 1AA" #=> true
UKPostcode.outcode? "W1A" #=> true
```Extract parts of a full postcode.
```elixir
UKPostcode.outcode "W1A 1AA" #=> "W1A"
UKPostcode.incode "W1A 1AA" #=> "1AA"
```Normalise badly formatted postcodes.
```elixir
UKPostcode.normalise "w1a1aa" #=> "W1A 1AA"
```