goluhn

package module
v0.0.0-...-c9a6103 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 6, 2017 License: LGPL-3.0 Imports: 3 Imported by: 0

README

goluhn

Build Status ![GoDoc](https://godoc.org/github.com/abado jack/goluhn?status.png)

Validates credit card numbers using Luhn's algorithm and regular expressions.

Installation

go get -u github.com/abadojack/goluhn

Usage

import "github.com/abadojack/goluhn"
Validate credit/debit card number
goluhn.IsValid("4024007146787212")	//returns true
Validate credit/debit card number and return type
goluhn.CardType("4024007146787212")	//returns visa

Credit cards supported

  • (Visa) Electron
  • Amex
  • Dankort
  • Diners
  • Discover
  • JCB
  • Interpayment
  • Maestro
  • Unionpay
  • Visa

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CardType

func CardType(cardNumStr string) string

CardType returns the type of credit card as a string i.e. visa, mastercard ... or an empty string. It calls the IsValid function.

func IsValid

func IsValid(cardNumStr string) bool

IsValid returns true if cardNumber is a valid credit card number or false otherwise.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL